mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-03 00:04:47 -04:00
Compare commits
1 Commits
3480669932
...
4cda88cf22
Author | SHA1 | Date | |
---|---|---|---|
|
4cda88cf22 |
@ -6,7 +6,6 @@
|
|||||||
%Include auto_generated/qgs3dtypes.sip
|
%Include auto_generated/qgs3dtypes.sip
|
||||||
%Include auto_generated/qgs3dmapcanvas.sip
|
%Include auto_generated/qgs3dmapcanvas.sip
|
||||||
%Include auto_generated/qgsabstractvectorlayer3drenderer.sip
|
%Include auto_generated/qgsabstractvectorlayer3drenderer.sip
|
||||||
%Include auto_generated/qgsannotationlayer3drenderer.sip
|
|
||||||
%Include auto_generated/qgscameracontroller.sip
|
%Include auto_generated/qgscameracontroller.sip
|
||||||
%Include auto_generated/qgscamerapose.sip
|
%Include auto_generated/qgscamerapose.sip
|
||||||
%Include auto_generated/qgslayoutitem3dmap.sip
|
%Include auto_generated/qgslayoutitem3dmap.sip
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
# The following has been generated automatically from src/3d/qgsannotationlayer3drenderer.h
|
|
||||||
try:
|
|
||||||
QgsAnnotationLayer3DRendererMetadata.__overridden_methods__ = ['createRenderer']
|
|
||||||
except (NameError, AttributeError):
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
QgsAnnotationLayer3DRenderer.__overridden_methods__ = ['type', 'clone', 'writeXml', 'readXml', 'resolveReferences']
|
|
||||||
except (NameError, AttributeError):
|
|
||||||
pass
|
|
@ -1,154 +0,0 @@
|
|||||||
/************************************************************************
|
|
||||||
* This file has been generated automatically from *
|
|
||||||
* *
|
|
||||||
* src/3d/qgsannotationlayer3drenderer.h *
|
|
||||||
* *
|
|
||||||
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// this is needed for the "convert to subclass" code below to compile
|
|
||||||
%ModuleHeaderCode
|
|
||||||
#include "qgsannotationlayer3drenderer.h"
|
|
||||||
%End
|
|
||||||
|
|
||||||
class QgsAnnotationLayer3DRendererMetadata : Qgs3DRendererAbstractMetadata
|
|
||||||
{
|
|
||||||
%Docstring(signature="appended")
|
|
||||||
Metadata for annotation layer 3D renderer to allow creation of its
|
|
||||||
instances from XML.
|
|
||||||
|
|
||||||
.. warning::
|
|
||||||
|
|
||||||
This is not considered stable API, and may change in future QGIS releases. It is
|
|
||||||
exposed to the Python bindings as a tech preview only.
|
|
||||||
|
|
||||||
.. versionadded:: 4.0
|
|
||||||
%End
|
|
||||||
|
|
||||||
%TypeHeaderCode
|
|
||||||
#include "qgsannotationlayer3drenderer.h"
|
|
||||||
%End
|
|
||||||
public:
|
|
||||||
QgsAnnotationLayer3DRendererMetadata();
|
|
||||||
|
|
||||||
virtual QgsAbstract3DRenderer *createRenderer( QDomElement &elem, const QgsReadWriteContext &context ) /Factory/;
|
|
||||||
|
|
||||||
%Docstring
|
|
||||||
Creates an instance of a 3D renderer based on a DOM element with
|
|
||||||
renderer configuration
|
|
||||||
%End
|
|
||||||
};
|
|
||||||
|
|
||||||
class QgsAnnotationLayer3DRenderer : QgsAbstract3DRenderer
|
|
||||||
{
|
|
||||||
%Docstring(signature="appended")
|
|
||||||
3D renderers for annotation layers.
|
|
||||||
|
|
||||||
.. versionadded:: 4.0
|
|
||||||
%End
|
|
||||||
|
|
||||||
%TypeHeaderCode
|
|
||||||
#include "qgsannotationlayer3drenderer.h"
|
|
||||||
%End
|
|
||||||
%ConvertToSubClassCode
|
|
||||||
if ( dynamic_cast<QgsAnnotationLayer3DRenderer *>( sipCpp ) != nullptr )
|
|
||||||
sipType = sipType_QgsAnnotationLayer3DRenderer;
|
|
||||||
else
|
|
||||||
sipType = nullptr;
|
|
||||||
%End
|
|
||||||
public:
|
|
||||||
QgsAnnotationLayer3DRenderer();
|
|
||||||
|
|
||||||
void setLayer( QgsAnnotationLayer *layer );
|
|
||||||
%Docstring
|
|
||||||
Sets the annotation layer associated with the renderer.
|
|
||||||
|
|
||||||
.. seealso:: :py:func:`layer`
|
|
||||||
%End
|
|
||||||
|
|
||||||
QgsAnnotationLayer *layer() const;
|
|
||||||
%Docstring
|
|
||||||
Returns the annotation layer associated with the renderer.
|
|
||||||
|
|
||||||
.. seealso:: :py:func:`setLayer`
|
|
||||||
%End
|
|
||||||
|
|
||||||
virtual QString type() const;
|
|
||||||
|
|
||||||
virtual QgsAnnotationLayer3DRenderer *clone() const /Factory/;
|
|
||||||
|
|
||||||
|
|
||||||
virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const;
|
|
||||||
|
|
||||||
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
|
|
||||||
|
|
||||||
virtual void resolveReferences( const QgsProject &project );
|
|
||||||
|
|
||||||
|
|
||||||
Qgis::AltitudeClamping altitudeClamping() const;
|
|
||||||
%Docstring
|
|
||||||
Returns the altitude clamping method, which determines the vertical
|
|
||||||
position of annotations.
|
|
||||||
|
|
||||||
.. seealso:: :py:func:`setAltitudeClamping`
|
|
||||||
%End
|
|
||||||
|
|
||||||
void setAltitudeClamping( Qgis::AltitudeClamping clamping );
|
|
||||||
%Docstring
|
|
||||||
Sets the altitude ``clamping`` method, which determines the vertical
|
|
||||||
position of annotations.
|
|
||||||
|
|
||||||
.. seealso:: :py:func:`altitudeClamping`
|
|
||||||
%End
|
|
||||||
|
|
||||||
double zOffset() const;
|
|
||||||
%Docstring
|
|
||||||
Returns the z offset, which is a fixed offset amount which should be
|
|
||||||
added to z values for the annotations.
|
|
||||||
|
|
||||||
.. seealso:: :py:func:`setZOffset`
|
|
||||||
%End
|
|
||||||
|
|
||||||
void setZOffset( double offset );
|
|
||||||
%Docstring
|
|
||||||
Sets the z ``offset``, which is a fixed offset amount which will be
|
|
||||||
added to z values for the annotations.
|
|
||||||
|
|
||||||
.. seealso:: :py:func:`zOffset`
|
|
||||||
%End
|
|
||||||
|
|
||||||
bool showCalloutLines() const;
|
|
||||||
%Docstring
|
|
||||||
Returns ``True`` if callout lines are shown, vertically joining the
|
|
||||||
annotations to the terrain.
|
|
||||||
|
|
||||||
.. seealso:: :py:func:`setShowCalloutLines`
|
|
||||||
%End
|
|
||||||
|
|
||||||
void setShowCalloutLines( bool show );
|
|
||||||
%Docstring
|
|
||||||
Sets whether callout lines are shown, vertically joining the annotations
|
|
||||||
to the terrain.
|
|
||||||
|
|
||||||
.. seealso:: :py:func:`showCalloutLines`
|
|
||||||
%End
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
QgsAnnotationLayer3DRenderer( const QgsAnnotationLayer3DRenderer & );
|
|
||||||
};
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* This file has been generated automatically from *
|
|
||||||
* *
|
|
||||||
* src/3d/qgsannotationlayer3drenderer.h *
|
|
||||||
* *
|
|
||||||
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
||||||
************************************************************************/
|
|
@ -246,22 +246,6 @@ QgsAbstractVectorLayer3DRenderer.setTilingSettings: src/3d/qgsabstractvectorlaye
|
|||||||
QgsAbstractVectorLayer3DRenderer.tilingSettings: src/3d/qgsabstractvectorlayer3drenderer.h#L89
|
QgsAbstractVectorLayer3DRenderer.tilingSettings: src/3d/qgsabstractvectorlayer3drenderer.h#L89
|
||||||
QgsAbstractVectorLayer3DRenderer.writeXmlBaseProperties: src/3d/qgsabstractvectorlayer3drenderer.h#L97
|
QgsAbstractVectorLayer3DRenderer.writeXmlBaseProperties: src/3d/qgsabstractvectorlayer3drenderer.h#L97
|
||||||
QgsAbstractVectorLayer3DRenderer: src/3d/qgsabstractvectorlayer3drenderer.h#L76
|
QgsAbstractVectorLayer3DRenderer: src/3d/qgsabstractvectorlayer3drenderer.h#L76
|
||||||
QgsAnnotationLayer3DRenderer.altitudeClamping: src/3d/qgsannotationlayer3drenderer.h#L100
|
|
||||||
QgsAnnotationLayer3DRenderer.clone: src/3d/qgsannotationlayer3drenderer.h#L88
|
|
||||||
QgsAnnotationLayer3DRenderer.layer: src/3d/qgsannotationlayer3drenderer.h#L85
|
|
||||||
QgsAnnotationLayer3DRenderer.readXml: src/3d/qgsannotationlayer3drenderer.h#L92
|
|
||||||
QgsAnnotationLayer3DRenderer.resolveReferences: src/3d/qgsannotationlayer3drenderer.h#L93
|
|
||||||
QgsAnnotationLayer3DRenderer.setAltitudeClamping: src/3d/qgsannotationlayer3drenderer.h#L107
|
|
||||||
QgsAnnotationLayer3DRenderer.setLayer: src/3d/qgsannotationlayer3drenderer.h#L78
|
|
||||||
QgsAnnotationLayer3DRenderer.setShowCalloutLines: src/3d/qgsannotationlayer3drenderer.h#L135
|
|
||||||
QgsAnnotationLayer3DRenderer.setZOffset: src/3d/qgsannotationlayer3drenderer.h#L121
|
|
||||||
QgsAnnotationLayer3DRenderer.showCalloutLines: src/3d/qgsannotationlayer3drenderer.h#L128
|
|
||||||
QgsAnnotationLayer3DRenderer.type: src/3d/qgsannotationlayer3drenderer.h#L87
|
|
||||||
QgsAnnotationLayer3DRenderer.writeXml: src/3d/qgsannotationlayer3drenderer.h#L91
|
|
||||||
QgsAnnotationLayer3DRenderer.zOffset: src/3d/qgsannotationlayer3drenderer.h#L114
|
|
||||||
QgsAnnotationLayer3DRenderer: src/3d/qgsannotationlayer3drenderer.h#L59
|
|
||||||
QgsAnnotationLayer3DRendererMetadata.createRenderer: src/3d/qgsannotationlayer3drenderer.h#L50
|
|
||||||
QgsAnnotationLayer3DRendererMetadata: src/3d/qgsannotationlayer3drenderer.h#L44
|
|
||||||
QgsCameraController.cameraChanged: src/3d/qgscameracontroller.h#L360
|
QgsCameraController.cameraChanged: src/3d/qgscameracontroller.h#L360
|
||||||
QgsCameraController.cameraMovementSpeed: src/3d/qgscameracontroller.h#L89
|
QgsCameraController.cameraMovementSpeed: src/3d/qgscameracontroller.h#L89
|
||||||
QgsCameraController.cameraMovementSpeedChanged: src/3d/qgscameracontroller.h#L368
|
QgsCameraController.cameraMovementSpeedChanged: src/3d/qgscameracontroller.h#L368
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
%Include auto_generated/qgs3dtypes.sip
|
%Include auto_generated/qgs3dtypes.sip
|
||||||
%Include auto_generated/qgs3dmapcanvas.sip
|
%Include auto_generated/qgs3dmapcanvas.sip
|
||||||
%Include auto_generated/qgsabstractvectorlayer3drenderer.sip
|
%Include auto_generated/qgsabstractvectorlayer3drenderer.sip
|
||||||
%Include auto_generated/qgsannotationlayer3drenderer.sip
|
|
||||||
%Include auto_generated/qgscameracontroller.sip
|
%Include auto_generated/qgscameracontroller.sip
|
||||||
%Include auto_generated/qgscamerapose.sip
|
%Include auto_generated/qgscamerapose.sip
|
||||||
%Include auto_generated/qgslayoutitem3dmap.sip
|
%Include auto_generated/qgslayoutitem3dmap.sip
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
# The following has been generated automatically from src/3d/qgsannotationlayer3drenderer.h
|
|
||||||
try:
|
|
||||||
QgsAnnotationLayer3DRendererMetadata.__overridden_methods__ = ['createRenderer']
|
|
||||||
except (NameError, AttributeError):
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
QgsAnnotationLayer3DRenderer.__overridden_methods__ = ['type', 'clone', 'writeXml', 'readXml', 'resolveReferences']
|
|
||||||
except (NameError, AttributeError):
|
|
||||||
pass
|
|
@ -1,154 +0,0 @@
|
|||||||
/************************************************************************
|
|
||||||
* This file has been generated automatically from *
|
|
||||||
* *
|
|
||||||
* src/3d/qgsannotationlayer3drenderer.h *
|
|
||||||
* *
|
|
||||||
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// this is needed for the "convert to subclass" code below to compile
|
|
||||||
%ModuleHeaderCode
|
|
||||||
#include "qgsannotationlayer3drenderer.h"
|
|
||||||
%End
|
|
||||||
|
|
||||||
class QgsAnnotationLayer3DRendererMetadata : Qgs3DRendererAbstractMetadata
|
|
||||||
{
|
|
||||||
%Docstring(signature="appended")
|
|
||||||
Metadata for annotation layer 3D renderer to allow creation of its
|
|
||||||
instances from XML.
|
|
||||||
|
|
||||||
.. warning::
|
|
||||||
|
|
||||||
This is not considered stable API, and may change in future QGIS releases. It is
|
|
||||||
exposed to the Python bindings as a tech preview only.
|
|
||||||
|
|
||||||
.. versionadded:: 4.0
|
|
||||||
%End
|
|
||||||
|
|
||||||
%TypeHeaderCode
|
|
||||||
#include "qgsannotationlayer3drenderer.h"
|
|
||||||
%End
|
|
||||||
public:
|
|
||||||
QgsAnnotationLayer3DRendererMetadata();
|
|
||||||
|
|
||||||
virtual QgsAbstract3DRenderer *createRenderer( QDomElement &elem, const QgsReadWriteContext &context ) /Factory/;
|
|
||||||
|
|
||||||
%Docstring
|
|
||||||
Creates an instance of a 3D renderer based on a DOM element with
|
|
||||||
renderer configuration
|
|
||||||
%End
|
|
||||||
};
|
|
||||||
|
|
||||||
class QgsAnnotationLayer3DRenderer : QgsAbstract3DRenderer
|
|
||||||
{
|
|
||||||
%Docstring(signature="appended")
|
|
||||||
3D renderers for annotation layers.
|
|
||||||
|
|
||||||
.. versionadded:: 4.0
|
|
||||||
%End
|
|
||||||
|
|
||||||
%TypeHeaderCode
|
|
||||||
#include "qgsannotationlayer3drenderer.h"
|
|
||||||
%End
|
|
||||||
%ConvertToSubClassCode
|
|
||||||
if ( dynamic_cast<QgsAnnotationLayer3DRenderer *>( sipCpp ) != nullptr )
|
|
||||||
sipType = sipType_QgsAnnotationLayer3DRenderer;
|
|
||||||
else
|
|
||||||
sipType = nullptr;
|
|
||||||
%End
|
|
||||||
public:
|
|
||||||
QgsAnnotationLayer3DRenderer();
|
|
||||||
|
|
||||||
void setLayer( QgsAnnotationLayer *layer );
|
|
||||||
%Docstring
|
|
||||||
Sets the annotation layer associated with the renderer.
|
|
||||||
|
|
||||||
.. seealso:: :py:func:`layer`
|
|
||||||
%End
|
|
||||||
|
|
||||||
QgsAnnotationLayer *layer() const;
|
|
||||||
%Docstring
|
|
||||||
Returns the annotation layer associated with the renderer.
|
|
||||||
|
|
||||||
.. seealso:: :py:func:`setLayer`
|
|
||||||
%End
|
|
||||||
|
|
||||||
virtual QString type() const;
|
|
||||||
|
|
||||||
virtual QgsAnnotationLayer3DRenderer *clone() const /Factory/;
|
|
||||||
|
|
||||||
|
|
||||||
virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const;
|
|
||||||
|
|
||||||
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
|
|
||||||
|
|
||||||
virtual void resolveReferences( const QgsProject &project );
|
|
||||||
|
|
||||||
|
|
||||||
Qgis::AltitudeClamping altitudeClamping() const;
|
|
||||||
%Docstring
|
|
||||||
Returns the altitude clamping method, which determines the vertical
|
|
||||||
position of annotations.
|
|
||||||
|
|
||||||
.. seealso:: :py:func:`setAltitudeClamping`
|
|
||||||
%End
|
|
||||||
|
|
||||||
void setAltitudeClamping( Qgis::AltitudeClamping clamping );
|
|
||||||
%Docstring
|
|
||||||
Sets the altitude ``clamping`` method, which determines the vertical
|
|
||||||
position of annotations.
|
|
||||||
|
|
||||||
.. seealso:: :py:func:`altitudeClamping`
|
|
||||||
%End
|
|
||||||
|
|
||||||
double zOffset() const;
|
|
||||||
%Docstring
|
|
||||||
Returns the z offset, which is a fixed offset amount which should be
|
|
||||||
added to z values for the annotations.
|
|
||||||
|
|
||||||
.. seealso:: :py:func:`setZOffset`
|
|
||||||
%End
|
|
||||||
|
|
||||||
void setZOffset( double offset );
|
|
||||||
%Docstring
|
|
||||||
Sets the z ``offset``, which is a fixed offset amount which will be
|
|
||||||
added to z values for the annotations.
|
|
||||||
|
|
||||||
.. seealso:: :py:func:`zOffset`
|
|
||||||
%End
|
|
||||||
|
|
||||||
bool showCalloutLines() const;
|
|
||||||
%Docstring
|
|
||||||
Returns ``True`` if callout lines are shown, vertically joining the
|
|
||||||
annotations to the terrain.
|
|
||||||
|
|
||||||
.. seealso:: :py:func:`setShowCalloutLines`
|
|
||||||
%End
|
|
||||||
|
|
||||||
void setShowCalloutLines( bool show );
|
|
||||||
%Docstring
|
|
||||||
Sets whether callout lines are shown, vertically joining the annotations
|
|
||||||
to the terrain.
|
|
||||||
|
|
||||||
.. seealso:: :py:func:`showCalloutLines`
|
|
||||||
%End
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
QgsAnnotationLayer3DRenderer( const QgsAnnotationLayer3DRenderer & );
|
|
||||||
};
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* This file has been generated automatically from *
|
|
||||||
* *
|
|
||||||
* src/3d/qgsannotationlayer3drenderer.h *
|
|
||||||
* *
|
|
||||||
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
||||||
************************************************************************/
|
|
@ -246,22 +246,6 @@ QgsAbstractVectorLayer3DRenderer.setTilingSettings: src/3d/qgsabstractvectorlaye
|
|||||||
QgsAbstractVectorLayer3DRenderer.tilingSettings: src/3d/qgsabstractvectorlayer3drenderer.h#L89
|
QgsAbstractVectorLayer3DRenderer.tilingSettings: src/3d/qgsabstractvectorlayer3drenderer.h#L89
|
||||||
QgsAbstractVectorLayer3DRenderer.writeXmlBaseProperties: src/3d/qgsabstractvectorlayer3drenderer.h#L97
|
QgsAbstractVectorLayer3DRenderer.writeXmlBaseProperties: src/3d/qgsabstractvectorlayer3drenderer.h#L97
|
||||||
QgsAbstractVectorLayer3DRenderer: src/3d/qgsabstractvectorlayer3drenderer.h#L76
|
QgsAbstractVectorLayer3DRenderer: src/3d/qgsabstractvectorlayer3drenderer.h#L76
|
||||||
QgsAnnotationLayer3DRenderer.altitudeClamping: src/3d/qgsannotationlayer3drenderer.h#L100
|
|
||||||
QgsAnnotationLayer3DRenderer.clone: src/3d/qgsannotationlayer3drenderer.h#L88
|
|
||||||
QgsAnnotationLayer3DRenderer.layer: src/3d/qgsannotationlayer3drenderer.h#L85
|
|
||||||
QgsAnnotationLayer3DRenderer.readXml: src/3d/qgsannotationlayer3drenderer.h#L92
|
|
||||||
QgsAnnotationLayer3DRenderer.resolveReferences: src/3d/qgsannotationlayer3drenderer.h#L93
|
|
||||||
QgsAnnotationLayer3DRenderer.setAltitudeClamping: src/3d/qgsannotationlayer3drenderer.h#L107
|
|
||||||
QgsAnnotationLayer3DRenderer.setLayer: src/3d/qgsannotationlayer3drenderer.h#L78
|
|
||||||
QgsAnnotationLayer3DRenderer.setShowCalloutLines: src/3d/qgsannotationlayer3drenderer.h#L135
|
|
||||||
QgsAnnotationLayer3DRenderer.setZOffset: src/3d/qgsannotationlayer3drenderer.h#L121
|
|
||||||
QgsAnnotationLayer3DRenderer.showCalloutLines: src/3d/qgsannotationlayer3drenderer.h#L128
|
|
||||||
QgsAnnotationLayer3DRenderer.type: src/3d/qgsannotationlayer3drenderer.h#L87
|
|
||||||
QgsAnnotationLayer3DRenderer.writeXml: src/3d/qgsannotationlayer3drenderer.h#L91
|
|
||||||
QgsAnnotationLayer3DRenderer.zOffset: src/3d/qgsannotationlayer3drenderer.h#L114
|
|
||||||
QgsAnnotationLayer3DRenderer: src/3d/qgsannotationlayer3drenderer.h#L59
|
|
||||||
QgsAnnotationLayer3DRendererMetadata.createRenderer: src/3d/qgsannotationlayer3drenderer.h#L50
|
|
||||||
QgsAnnotationLayer3DRendererMetadata: src/3d/qgsannotationlayer3drenderer.h#L44
|
|
||||||
QgsCameraController.cameraChanged: src/3d/qgscameracontroller.h#L360
|
QgsCameraController.cameraChanged: src/3d/qgscameracontroller.h#L360
|
||||||
QgsCameraController.cameraMovementSpeed: src/3d/qgscameracontroller.h#L89
|
QgsCameraController.cameraMovementSpeed: src/3d/qgscameracontroller.h#L89
|
||||||
QgsCameraController.cameraMovementSpeedChanged: src/3d/qgscameracontroller.h#L368
|
QgsCameraController.cameraMovementSpeedChanged: src/3d/qgscameracontroller.h#L368
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
# The following has been generated automatically from src/gui/qgsshortcutsmanager.h
|
|
||||||
# monkey patching scoped based enum
|
|
||||||
QgsShortcutsManager.CommonAction.CodeToggleComment.__doc__ = "Toggle code comments"
|
|
||||||
QgsShortcutsManager.CommonAction.CodeReformat.__doc__ = "Reformat code"
|
|
||||||
QgsShortcutsManager.CommonAction.CodeRunScript.__doc__ = "Run script"
|
|
||||||
QgsShortcutsManager.CommonAction.CodeRunSelection.__doc__ = "Run selection from script"
|
|
||||||
QgsShortcutsManager.CommonAction.__doc__ = """Contains common actions which are used across a variety of classes.
|
|
||||||
|
|
||||||
.. versionadded:: 4.0
|
|
||||||
|
|
||||||
* ``CodeToggleComment``: Toggle code comments
|
|
||||||
* ``CodeReformat``: Reformat code
|
|
||||||
* ``CodeRunScript``: Run script
|
|
||||||
* ``CodeRunSelection``: Run selection from script
|
|
||||||
|
|
||||||
"""
|
|
||||||
# --
|
|
||||||
QgsShortcutsManager.CommonAction.baseClass = QgsShortcutsManager
|
|
@ -23,14 +23,6 @@ rather accessed through :py:func:`QgsGui.shortcutsManager()`.
|
|||||||
#include "qgsshortcutsmanager.h"
|
#include "qgsshortcutsmanager.h"
|
||||||
%End
|
%End
|
||||||
public:
|
public:
|
||||||
enum class CommonAction
|
|
||||||
{
|
|
||||||
CodeToggleComment,
|
|
||||||
CodeReformat,
|
|
||||||
CodeRunScript,
|
|
||||||
CodeRunSelection,
|
|
||||||
};
|
|
||||||
|
|
||||||
QgsShortcutsManager( QObject *parent /TransferThis/ = 0, const QString &settingsRoot = "/shortcuts/" );
|
QgsShortcutsManager( QObject *parent /TransferThis/ = 0, const QString &settingsRoot = "/shortcuts/" );
|
||||||
%Docstring
|
%Docstring
|
||||||
Constructor for QgsShortcutsManager.
|
Constructor for QgsShortcutsManager.
|
||||||
@ -44,8 +36,6 @@ Constructor for QgsShortcutsManager.
|
|||||||
QGIS actions.
|
QGIS actions.
|
||||||
%End
|
%End
|
||||||
|
|
||||||
~QgsShortcutsManager();
|
|
||||||
|
|
||||||
void registerAllChildren( QObject *object, bool recursive = false, const QString §ion = QString() );
|
void registerAllChildren( QObject *object, bool recursive = false, const QString §ion = QString() );
|
||||||
%Docstring
|
%Docstring
|
||||||
Automatically registers all QActions and QShortcuts which are children
|
Automatically registers all QActions and QShortcuts which are children
|
||||||
@ -115,16 +105,6 @@ in GUI.
|
|||||||
.. seealso:: :py:func:`unregisterAction`
|
.. seealso:: :py:func:`unregisterAction`
|
||||||
|
|
||||||
.. seealso:: :py:func:`registerAllChildActions`
|
.. seealso:: :py:func:`registerAllChildActions`
|
||||||
%End
|
|
||||||
|
|
||||||
void initializeCommonAction( QAction *action, CommonAction commonAction );
|
|
||||||
%Docstring
|
|
||||||
Initializes an ``action`` as a common action.
|
|
||||||
|
|
||||||
This automatically configures the ``action`` to use the properties for
|
|
||||||
the common action, such as setting the action's tooltip and shortcut.
|
|
||||||
|
|
||||||
.. versionadded:: 4.0
|
|
||||||
%End
|
%End
|
||||||
|
|
||||||
bool registerShortcut( QShortcut *shortcut, const QString &defaultSequence = QString(), const QString §ion = QString() );
|
bool registerShortcut( QShortcut *shortcut, const QString &defaultSequence = QString(), const QString §ion = QString() );
|
||||||
@ -310,14 +290,6 @@ if no shortcut is associated.
|
|||||||
.. seealso:: :py:func:`objectForSequence`
|
.. seealso:: :py:func:`objectForSequence`
|
||||||
|
|
||||||
.. seealso:: :py:func:`actionForSequence`
|
.. seealso:: :py:func:`actionForSequence`
|
||||||
%End
|
|
||||||
|
|
||||||
QKeySequence sequenceForCommonAction( CommonAction action ) const;
|
|
||||||
%Docstring
|
|
||||||
Returns the key sequence which is associated with a common ``action``,
|
|
||||||
or an empty sequence if no shortcut is assigned to that action.
|
|
||||||
|
|
||||||
.. versionadded:: 4.0
|
|
||||||
%End
|
%End
|
||||||
|
|
||||||
QAction *actionByName( const QString &name ) const;
|
QAction *actionByName( const QString &name ) const;
|
||||||
|
@ -6977,30 +6977,28 @@ QgsShapeburstFillSymbolLayerWidget.setColor: src/gui/symbology/qgssymbollayerwid
|
|||||||
QgsShapeburstFillSymbolLayerWidget.setSymbolLayer: src/gui/symbology/qgssymbollayerwidget.h#L426
|
QgsShapeburstFillSymbolLayerWidget.setSymbolLayer: src/gui/symbology/qgssymbollayerwidget.h#L426
|
||||||
QgsShapeburstFillSymbolLayerWidget.symbolLayer: src/gui/symbology/qgssymbollayerwidget.h#L427
|
QgsShapeburstFillSymbolLayerWidget.symbolLayer: src/gui/symbology/qgssymbollayerwidget.h#L427
|
||||||
QgsShapeburstFillSymbolLayerWidget: src/gui/symbology/qgssymbollayerwidget.h#L407
|
QgsShapeburstFillSymbolLayerWidget: src/gui/symbology/qgssymbollayerwidget.h#L407
|
||||||
QgsShortcutsManager.actionByName: src/gui/qgsshortcutsmanager.h#L267
|
QgsShortcutsManager.actionByName: src/gui/qgsshortcutsmanager.h#L236
|
||||||
QgsShortcutsManager.actionForSequence: src/gui/qgsshortcutsmanager.h#L246
|
QgsShortcutsManager.actionForSequence: src/gui/qgsshortcutsmanager.h#L221
|
||||||
QgsShortcutsManager.defaultKeySequence: src/gui/qgsshortcutsmanager.h#L188
|
QgsShortcutsManager.defaultKeySequence: src/gui/qgsshortcutsmanager.h#L163
|
||||||
QgsShortcutsManager.defaultKeySequence: src/gui/qgsshortcutsmanager.h#L196
|
QgsShortcutsManager.defaultKeySequence: src/gui/qgsshortcutsmanager.h#L171
|
||||||
QgsShortcutsManager.initializeCommonAction: src/gui/qgsshortcutsmanager.h#L119
|
QgsShortcutsManager.objectDefaultKeySequence: src/gui/qgsshortcutsmanager.h#L155
|
||||||
QgsShortcutsManager.objectDefaultKeySequence: src/gui/qgsshortcutsmanager.h#L180
|
QgsShortcutsManager.objectForSequence: src/gui/qgsshortcutsmanager.h#L213
|
||||||
QgsShortcutsManager.objectForSequence: src/gui/qgsshortcutsmanager.h#L238
|
QgsShortcutsManager.objectForSettingKey: src/gui/qgsshortcutsmanager.h#L262
|
||||||
QgsShortcutsManager.objectForSettingKey: src/gui/qgsshortcutsmanager.h#L293
|
QgsShortcutsManager.objectSettingKey: src/gui/qgsshortcutsmanager.h#L254
|
||||||
QgsShortcutsManager.objectSettingKey: src/gui/qgsshortcutsmanager.h#L285
|
QgsShortcutsManager.registerAction: src/gui/qgsshortcutsmanager.h#L94
|
||||||
QgsShortcutsManager.registerAction: src/gui/qgsshortcutsmanager.h#L109
|
QgsShortcutsManager.registerAllChildActions: src/gui/qgsshortcutsmanager.h#L70
|
||||||
QgsShortcutsManager.registerAllChildActions: src/gui/qgsshortcutsmanager.h#L85
|
QgsShortcutsManager.registerAllChildShortcuts: src/gui/qgsshortcutsmanager.h#L81
|
||||||
QgsShortcutsManager.registerAllChildShortcuts: src/gui/qgsshortcutsmanager.h#L96
|
QgsShortcutsManager.registerAllChildren: src/gui/qgsshortcutsmanager.h#L59
|
||||||
QgsShortcutsManager.registerAllChildren: src/gui/qgsshortcutsmanager.h#L74
|
QgsShortcutsManager.registerShortcut: src/gui/qgsshortcutsmanager.h#L106
|
||||||
QgsShortcutsManager.registerShortcut: src/gui/qgsshortcutsmanager.h#L131
|
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L180
|
||||||
QgsShortcutsManager.sequenceForCommonAction: src/gui/qgsshortcutsmanager.h#L260
|
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L196
|
||||||
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L205
|
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L204
|
||||||
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L221
|
QgsShortcutsManager.setObjectKeySequence: src/gui/qgsshortcutsmanager.h#L188
|
||||||
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L229
|
QgsShortcutsManager.settingsPath: src/gui/qgsshortcutsmanager.h#L246
|
||||||
QgsShortcutsManager.setObjectKeySequence: src/gui/qgsshortcutsmanager.h#L213
|
QgsShortcutsManager.shortcutByName: src/gui/qgsshortcutsmanager.h#L243
|
||||||
QgsShortcutsManager.settingsPath: src/gui/qgsshortcutsmanager.h#L277
|
QgsShortcutsManager.shortcutForSequence: src/gui/qgsshortcutsmanager.h#L229
|
||||||
QgsShortcutsManager.shortcutByName: src/gui/qgsshortcutsmanager.h#L274
|
QgsShortcutsManager.unregisterAction: src/gui/qgsshortcutsmanager.h#L116
|
||||||
QgsShortcutsManager.shortcutForSequence: src/gui/qgsshortcutsmanager.h#L254
|
QgsShortcutsManager.unregisterShortcut: src/gui/qgsshortcutsmanager.h#L126
|
||||||
QgsShortcutsManager.unregisterAction: src/gui/qgsshortcutsmanager.h#L141
|
|
||||||
QgsShortcutsManager.unregisterShortcut: src/gui/qgsshortcutsmanager.h#L151
|
|
||||||
QgsShortcutsManager: src/gui/qgsshortcutsmanager.h#L36
|
QgsShortcutsManager: src/gui/qgsshortcutsmanager.h#L36
|
||||||
QgsSimpleFillSymbolLayerWidget.create: src/gui/symbology/qgssymbollayerwidget.h#L264
|
QgsSimpleFillSymbolLayerWidget.create: src/gui/symbology/qgssymbollayerwidget.h#L264
|
||||||
QgsSimpleFillSymbolLayerWidget.setColor: src/gui/symbology/qgssymbollayerwidget.h#L271
|
QgsSimpleFillSymbolLayerWidget.setColor: src/gui/symbology/qgssymbollayerwidget.h#L271
|
||||||
|
@ -19,4 +19,5 @@ __author__ = "Salvatore Larosa"
|
|||||||
__date__ = "September 2012"
|
__date__ = "September 2012"
|
||||||
__copyright__ = "(C) 2012, Salvatore Larosa"
|
__copyright__ = "(C) 2012, Salvatore Larosa"
|
||||||
|
|
||||||
from .console import show_console, init_console # NOQA
|
from .console import show_console # NOQA
|
||||||
|
from .console import init_options_widget
|
||||||
|
@ -61,7 +61,6 @@ from qgis.gui import (
|
|||||||
QgsGui,
|
QgsGui,
|
||||||
QgsApplicationExitBlockerInterface,
|
QgsApplicationExitBlockerInterface,
|
||||||
QgsCodeEditorDockWidget,
|
QgsCodeEditorDockWidget,
|
||||||
QgsShortcutsManager,
|
|
||||||
)
|
)
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
@ -107,11 +106,8 @@ def console_displayhook(obj):
|
|||||||
_console_output = obj
|
_console_output = obj
|
||||||
|
|
||||||
|
|
||||||
def init_console():
|
def init_options_widget():
|
||||||
"""
|
"""called from QGIS to add the console options widget"""
|
||||||
Called from QGIS to initialize the console related options and shortcuts,
|
|
||||||
before the dock is shown
|
|
||||||
"""
|
|
||||||
global _options_factory
|
global _options_factory
|
||||||
_options_factory.setTitle(QCoreApplication.translate("PythonConsole", "Python"))
|
_options_factory.setTitle(QCoreApplication.translate("PythonConsole", "Python"))
|
||||||
iface.registerOptionsWidgetFactory(_options_factory)
|
iface.registerOptionsWidgetFactory(_options_factory)
|
||||||
@ -225,137 +221,169 @@ class PythonConsoleWidget(QWidget):
|
|||||||
|
|
||||||
# Action for Open File
|
# Action for Open File
|
||||||
openFileBt = QCoreApplication.translate("PythonConsole", "Open Script…")
|
openFileBt = QCoreApplication.translate("PythonConsole", "Open Script…")
|
||||||
self.open_file_action = QAction(self)
|
self.openFileButton = QAction(self)
|
||||||
self.open_file_action.setIcon(
|
self.openFileButton.setCheckable(False)
|
||||||
|
self.openFileButton.setEnabled(True)
|
||||||
|
self.openFileButton.setIcon(
|
||||||
QgsApplication.getThemeIcon("mActionScriptOpen.svg")
|
QgsApplication.getThemeIcon("mActionScriptOpen.svg")
|
||||||
)
|
)
|
||||||
self.open_file_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.openFileButton.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
self.open_file_action.setIconVisibleInMenu(True)
|
self.openFileButton.setIconVisibleInMenu(True)
|
||||||
self.open_file_action.setToolTip(f"<b>{openFileBt}</b> (Ctrl+O)")
|
self.openFileButton.setToolTip(openFileBt + " <b>Ctrl+O</b>")
|
||||||
self.open_file_action.setText(openFileBt)
|
self.openFileButton.setText(openFileBt)
|
||||||
|
|
||||||
openExtEditorBt = QCoreApplication.translate(
|
openExtEditorBt = QCoreApplication.translate(
|
||||||
"PythonConsole", "Open in External Editor"
|
"PythonConsole", "Open in External Editor"
|
||||||
)
|
)
|
||||||
self.open_in_editor_action = QAction(self)
|
self.openInEditorButton = QAction(self)
|
||||||
self.open_in_editor_action.setIcon(
|
self.openInEditorButton.setCheckable(False)
|
||||||
|
self.openInEditorButton.setEnabled(True)
|
||||||
|
self.openInEditorButton.setIcon(
|
||||||
QgsApplication.getThemeIcon("console/iconShowEditorConsole.svg")
|
QgsApplication.getThemeIcon("console/iconShowEditorConsole.svg")
|
||||||
)
|
)
|
||||||
self.open_in_editor_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.openInEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
self.open_in_editor_action.setIconVisibleInMenu(True)
|
self.openInEditorButton.setIconVisibleInMenu(True)
|
||||||
self.open_in_editor_action.setToolTip(openExtEditorBt)
|
self.openInEditorButton.setToolTip(openExtEditorBt)
|
||||||
self.open_in_editor_action.setText(openExtEditorBt)
|
self.openInEditorButton.setText(openExtEditorBt)
|
||||||
|
|
||||||
# Action for Save File
|
# Action for Save File
|
||||||
saveFileBt = QCoreApplication.translate("PythonConsole", "Save")
|
saveFileBt = QCoreApplication.translate("PythonConsole", "Save")
|
||||||
self.save_file_action = QAction(self)
|
self.saveFileButton = QAction(self)
|
||||||
self.save_file_action.setEnabled(False)
|
self.saveFileButton.setCheckable(False)
|
||||||
self.save_file_action.setIcon(
|
self.saveFileButton.setEnabled(False)
|
||||||
QgsApplication.getThemeIcon("mActionFileSave.svg")
|
self.saveFileButton.setIcon(QgsApplication.getThemeIcon("mActionFileSave.svg"))
|
||||||
)
|
self.saveFileButton.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
self.save_file_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.saveFileButton.setIconVisibleInMenu(True)
|
||||||
self.save_file_action.setIconVisibleInMenu(True)
|
self.saveFileButton.setToolTip(saveFileBt + " <b>Ctrl+S</b>")
|
||||||
self.save_file_action.setToolTip(f"<b>{saveFileBt}</b> (Ctrl+S)")
|
self.saveFileButton.setText(saveFileBt)
|
||||||
self.save_file_action.setText(saveFileBt)
|
|
||||||
|
|
||||||
# Action for Save File As
|
# Action for Save File As
|
||||||
saveAsFileBt = QCoreApplication.translate("PythonConsole", "Save As…")
|
saveAsFileBt = QCoreApplication.translate("PythonConsole", "Save As…")
|
||||||
self.save_as_file_action = QAction(self)
|
self.saveAsFileButton = QAction(self)
|
||||||
self.save_as_file_action.setIcon(
|
self.saveAsFileButton.setCheckable(False)
|
||||||
|
self.saveAsFileButton.setEnabled(True)
|
||||||
|
self.saveAsFileButton.setIcon(
|
||||||
QgsApplication.getThemeIcon("mActionFileSaveAs.svg")
|
QgsApplication.getThemeIcon("mActionFileSaveAs.svg")
|
||||||
)
|
)
|
||||||
self.save_as_file_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.saveAsFileButton.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
self.save_as_file_action.setIconVisibleInMenu(True)
|
self.saveAsFileButton.setIconVisibleInMenu(True)
|
||||||
self.save_as_file_action.setToolTip(f"<b>{saveAsFileBt}</b> (Ctrl+Shift+S)")
|
self.saveAsFileButton.setToolTip(saveAsFileBt + " <b>Ctrl+Shift+S</b>")
|
||||||
self.save_as_file_action.setText(saveAsFileBt)
|
self.saveAsFileButton.setText(saveAsFileBt)
|
||||||
|
|
||||||
# Action Cut
|
# Action Cut
|
||||||
cutEditorBt = QCoreApplication.translate("PythonConsole", "Cut")
|
cutEditorBt = QCoreApplication.translate("PythonConsole", "Cut")
|
||||||
self.cut_action = QAction(self)
|
self.cutEditorButton = QAction(self)
|
||||||
self.cut_action.setIcon(QgsApplication.getThemeIcon("mActionEditCut.svg"))
|
self.cutEditorButton.setCheckable(False)
|
||||||
self.cut_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.cutEditorButton.setEnabled(True)
|
||||||
self.cut_action.setIconVisibleInMenu(True)
|
self.cutEditorButton.setIcon(QgsApplication.getThemeIcon("mActionEditCut.svg"))
|
||||||
self.cut_action.setToolTip(f"<b>{cutEditorBt}</b> (Ctrl+X)")
|
self.cutEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
self.cut_action.setText(cutEditorBt)
|
self.cutEditorButton.setIconVisibleInMenu(True)
|
||||||
|
self.cutEditorButton.setToolTip(cutEditorBt + " <b>Ctrl+X</b>")
|
||||||
|
self.cutEditorButton.setText(cutEditorBt)
|
||||||
|
|
||||||
# Action Copy
|
# Action Copy
|
||||||
copyEditorBt = QCoreApplication.translate("PythonConsole", "Copy")
|
copyEditorBt = QCoreApplication.translate("PythonConsole", "Copy")
|
||||||
self.copy_action = QAction(self)
|
self.copyEditorButton = QAction(self)
|
||||||
self.copy_action.setIcon(QgsApplication.getThemeIcon("mActionEditCopy.svg"))
|
self.copyEditorButton.setCheckable(False)
|
||||||
self.copy_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.copyEditorButton.setEnabled(True)
|
||||||
self.copy_action.setIconVisibleInMenu(True)
|
self.copyEditorButton.setIcon(
|
||||||
self.copy_action.setToolTip(f"<b>{copyEditorBt}</b> (Ctrl+C)")
|
QgsApplication.getThemeIcon("mActionEditCopy.svg")
|
||||||
self.copy_action.setText(copyEditorBt)
|
)
|
||||||
|
self.copyEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
|
self.copyEditorButton.setIconVisibleInMenu(True)
|
||||||
|
self.copyEditorButton.setToolTip(copyEditorBt + " <b>Ctrl+C</b>")
|
||||||
|
self.copyEditorButton.setText(copyEditorBt)
|
||||||
|
|
||||||
# Action Paste
|
# Action Paste
|
||||||
pasteEditorBt = QCoreApplication.translate("PythonConsole", "Paste")
|
pasteEditorBt = QCoreApplication.translate("PythonConsole", "Paste")
|
||||||
self.paste_action = QAction(self)
|
self.pasteEditorButton = QAction(self)
|
||||||
self.paste_action.setIcon(QgsApplication.getThemeIcon("mActionEditPaste.svg"))
|
self.pasteEditorButton.setCheckable(False)
|
||||||
self.paste_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.pasteEditorButton.setEnabled(True)
|
||||||
self.paste_action.setIconVisibleInMenu(True)
|
self.pasteEditorButton.setIcon(
|
||||||
self.paste_action.setToolTip(f"<b>{pasteEditorBt}</b> (Ctrl+V)")
|
QgsApplication.getThemeIcon("mActionEditPaste.svg")
|
||||||
self.paste_action.setText(pasteEditorBt)
|
)
|
||||||
|
self.pasteEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
|
self.pasteEditorButton.setIconVisibleInMenu(True)
|
||||||
|
self.pasteEditorButton.setToolTip(pasteEditorBt + " <b>Ctrl+V</b>")
|
||||||
|
self.pasteEditorButton.setText(pasteEditorBt)
|
||||||
|
|
||||||
# Action Run Script (subprocess)
|
# Action Run Script (subprocess)
|
||||||
self.run_script_action = QAction(self)
|
runScriptEditorBt = QCoreApplication.translate("PythonConsole", "Run Script")
|
||||||
self.run_script_action.setIcon(QgsApplication.getThemeIcon("mActionStart.svg"))
|
self.runScriptEditorButton = QAction(self)
|
||||||
self.run_script_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.runScriptEditorButton.setCheckable(False)
|
||||||
self.run_script_action.setIconVisibleInMenu(True)
|
self.runScriptEditorButton.setEnabled(True)
|
||||||
QgsGui.shortcutsManager().initializeCommonAction(
|
self.runScriptEditorButton.setIcon(
|
||||||
self.run_script_action, QgsShortcutsManager.CommonAction.CodeRunScript
|
QgsApplication.getThemeIcon("mActionStart.svg")
|
||||||
)
|
)
|
||||||
|
self.runScriptEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
|
self.runScriptEditorButton.setIconVisibleInMenu(True)
|
||||||
|
self.runScriptEditorButton.setToolTip(
|
||||||
|
runScriptEditorBt + " <b>Ctrl+Shift+E</b>"
|
||||||
|
)
|
||||||
|
self.runScriptEditorButton.setText(runScriptEditorBt)
|
||||||
|
|
||||||
# Action Run Selected
|
# Action Run Selected
|
||||||
self.run_selection_action = QAction(self)
|
runSelectedEditorBt = QCoreApplication.translate(
|
||||||
self.run_selection_action.setIcon(
|
"PythonConsole", "Run Selected"
|
||||||
|
)
|
||||||
|
self.runSelectedEditorButton = QAction(self)
|
||||||
|
self.runSelectedEditorButton.setCheckable(False)
|
||||||
|
self.runSelectedEditorButton.setEnabled(True)
|
||||||
|
self.runSelectedEditorButton.setIcon(
|
||||||
QgsApplication.getThemeIcon("mActionRunSelected.svg")
|
QgsApplication.getThemeIcon("mActionRunSelected.svg")
|
||||||
)
|
)
|
||||||
self.run_selection_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.runSelectedEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
self.run_selection_action.setIconVisibleInMenu(True)
|
self.runSelectedEditorButton.setIconVisibleInMenu(True)
|
||||||
QgsGui.shortcutsManager().initializeCommonAction(
|
self.runSelectedEditorButton.setToolTip(runSelectedEditorBt + " <b>Ctrl+E</b>")
|
||||||
self.run_selection_action, QgsShortcutsManager.CommonAction.CodeRunSelection
|
self.runSelectedEditorButton.setShortcut("Ctrl+E")
|
||||||
)
|
self.runSelectedEditorButton.setText(runSelectedEditorBt)
|
||||||
|
|
||||||
# Action Toggle comment
|
# Action Toggle comment
|
||||||
self.toggle_comment_action = QAction(self)
|
toggleText = QCoreApplication.translate("PythonConsole", "Toggle Comment")
|
||||||
self.toggle_comment_action.setIcon(
|
self.toggleCommentEditorButton = QAction(self)
|
||||||
|
self.toggleCommentEditorButton.setCheckable(False)
|
||||||
|
self.toggleCommentEditorButton.setEnabled(True)
|
||||||
|
self.toggleCommentEditorButton.setIcon(
|
||||||
QgsApplication.getThemeIcon(
|
QgsApplication.getThemeIcon(
|
||||||
"console/iconCommentEditorConsole.svg",
|
"console/iconCommentEditorConsole.svg",
|
||||||
self.palette().color(QPalette.ColorRole.WindowText),
|
self.palette().color(QPalette.ColorRole.WindowText),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
self.toggle_comment_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.toggleCommentEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
self.toggle_comment_action.setIconVisibleInMenu(True)
|
self.toggleCommentEditorButton.setIconVisibleInMenu(True)
|
||||||
QgsGui.shortcutsManager().initializeCommonAction(
|
self.toggleCommentEditorButton.setToolTip(toggleText + " <b>Ctrl+:</b>")
|
||||||
self.toggle_comment_action,
|
self.toggleCommentEditorButton.setText(toggleText)
|
||||||
QgsShortcutsManager.CommonAction.CodeToggleComment,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Action Format code
|
# Action Format code
|
||||||
self.reformat_code_action = QAction(self)
|
reformatCodeText = QCoreApplication.translate("PythonConsole", "Reformat Code")
|
||||||
self.reformat_code_action.setIcon(
|
self.reformatCodeEditorButton = QAction(self)
|
||||||
|
self.reformatCodeEditorButton.setCheckable(False)
|
||||||
|
self.reformatCodeEditorButton.setEnabled(True)
|
||||||
|
self.reformatCodeEditorButton.setIcon(
|
||||||
QgsApplication.getThemeIcon("console/iconFormatCode.svg")
|
QgsApplication.getThemeIcon("console/iconFormatCode.svg")
|
||||||
)
|
)
|
||||||
self.reformat_code_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.reformatCodeEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
self.reformat_code_action.setIconVisibleInMenu(True)
|
self.reformatCodeEditorButton.setIconVisibleInMenu(True)
|
||||||
QgsGui.shortcutsManager().initializeCommonAction(
|
self.reformatCodeEditorButton.setToolTip(
|
||||||
self.reformat_code_action, QgsShortcutsManager.CommonAction.CodeReformat
|
reformatCodeText + " <b>Ctrl+Alt+F</b>"
|
||||||
)
|
)
|
||||||
|
self.reformatCodeEditorButton.setShortcut("Ctrl+Alt+F")
|
||||||
|
self.reformatCodeEditorButton.setText(reformatCodeText)
|
||||||
|
|
||||||
# Action for Object browser
|
# Action for Object browser
|
||||||
objList = QCoreApplication.translate("PythonConsole", "Object Inspector…")
|
objList = QCoreApplication.translate("PythonConsole", "Object Inspector…")
|
||||||
self.object_inspector_action = QAction(self)
|
self.objectListButton = QAction(self)
|
||||||
self.object_inspector_action.setCheckable(True)
|
self.objectListButton.setCheckable(True)
|
||||||
self.object_inspector_action.setEnabled(
|
self.objectListButton.setEnabled(
|
||||||
QgsSettings().value("pythonConsole/enableObjectInsp", False, type=bool)
|
QgsSettings().value("pythonConsole/enableObjectInsp", False, type=bool)
|
||||||
)
|
)
|
||||||
self.object_inspector_action.setIcon(
|
self.objectListButton.setIcon(
|
||||||
QgsApplication.getThemeIcon("console/iconClassBrowserConsole.svg")
|
QgsApplication.getThemeIcon("console/iconClassBrowserConsole.svg")
|
||||||
)
|
)
|
||||||
self.object_inspector_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.objectListButton.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
self.object_inspector_action.setIconVisibleInMenu(True)
|
self.objectListButton.setIconVisibleInMenu(True)
|
||||||
self.object_inspector_action.setToolTip(objList)
|
self.objectListButton.setToolTip(objList)
|
||||||
self.object_inspector_action.setText(objList)
|
self.objectListButton.setText(objList)
|
||||||
|
|
||||||
# Action for Find text
|
# Action for Find text
|
||||||
findText = QCoreApplication.translate("PythonConsole", "Find Text")
|
findText = QCoreApplication.translate("PythonConsole", "Find Text")
|
||||||
@ -367,7 +395,7 @@ class PythonConsoleWidget(QWidget):
|
|||||||
)
|
)
|
||||||
self.find_text_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.find_text_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
self.find_text_action.setIconVisibleInMenu(True)
|
self.find_text_action.setIconVisibleInMenu(True)
|
||||||
self.find_text_action.setToolTip(f"<b>{findText}</b> (Ctrl+F)")
|
self.find_text_action.setToolTip(findText + " <b>Ctrl+F</b>")
|
||||||
self.find_text_action.setText(findText)
|
self.find_text_action.setText(findText)
|
||||||
|
|
||||||
self.tabEditorWidget.search_bar_toggled.connect(
|
self.tabEditorWidget.search_bar_toggled.connect(
|
||||||
@ -379,65 +407,75 @@ class PythonConsoleWidget(QWidget):
|
|||||||
|
|
||||||
# Action Show Editor
|
# Action Show Editor
|
||||||
showEditor = QCoreApplication.translate("PythonConsole", "Show Editor")
|
showEditor = QCoreApplication.translate("PythonConsole", "Show Editor")
|
||||||
self.show_editor_action = QAction(self)
|
self.showEditorButton = QAction(self)
|
||||||
self.show_editor_action.setCheckable(True)
|
self.showEditorButton.setEnabled(True)
|
||||||
self.show_editor_action.setIcon(
|
self.showEditorButton.setCheckable(True)
|
||||||
|
self.showEditorButton.setIcon(
|
||||||
QgsApplication.getThemeIcon("console/iconShowEditorConsole.svg")
|
QgsApplication.getThemeIcon("console/iconShowEditorConsole.svg")
|
||||||
)
|
)
|
||||||
self.show_editor_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.showEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
self.show_editor_action.setIconVisibleInMenu(True)
|
self.showEditorButton.setIconVisibleInMenu(True)
|
||||||
self.show_editor_action.setToolTip(showEditor)
|
self.showEditorButton.setToolTip(showEditor)
|
||||||
self.show_editor_action.setText(showEditor)
|
self.showEditorButton.setText(showEditor)
|
||||||
|
|
||||||
# Action for Clear button
|
# Action for Clear button
|
||||||
clearBt = QCoreApplication.translate("PythonConsole", "Clear Console")
|
clearBt = QCoreApplication.translate("PythonConsole", "Clear Console")
|
||||||
self.clear_action = QAction(self)
|
self.clearButton = QAction(self)
|
||||||
self.clear_action.setIcon(
|
self.clearButton.setCheckable(False)
|
||||||
|
self.clearButton.setEnabled(True)
|
||||||
|
self.clearButton.setIcon(
|
||||||
QgsApplication.getThemeIcon("console/iconClearConsole.svg")
|
QgsApplication.getThemeIcon("console/iconClearConsole.svg")
|
||||||
)
|
)
|
||||||
self.clear_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.clearButton.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
self.clear_action.setIconVisibleInMenu(True)
|
self.clearButton.setIconVisibleInMenu(True)
|
||||||
self.clear_action.setToolTip(clearBt)
|
self.clearButton.setToolTip(clearBt)
|
||||||
self.clear_action.setText(clearBt)
|
self.clearButton.setText(clearBt)
|
||||||
|
|
||||||
# Action for settings
|
# Action for settings
|
||||||
optionsBt = QCoreApplication.translate("PythonConsole", "Options…")
|
optionsBt = QCoreApplication.translate("PythonConsole", "Options…")
|
||||||
self.options_action = QAction(self)
|
self.optionsButton = QAction(self)
|
||||||
self.options_action.setIcon(
|
self.optionsButton.setCheckable(False)
|
||||||
|
self.optionsButton.setEnabled(True)
|
||||||
|
self.optionsButton.setIcon(
|
||||||
QgsApplication.getThemeIcon("console/iconSettingsConsole.svg")
|
QgsApplication.getThemeIcon("console/iconSettingsConsole.svg")
|
||||||
)
|
)
|
||||||
self.options_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.optionsButton.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
self.options_action.setIconVisibleInMenu(True)
|
self.optionsButton.setIconVisibleInMenu(True)
|
||||||
self.options_action.setToolTip(optionsBt)
|
self.optionsButton.setToolTip(optionsBt)
|
||||||
self.options_action.setText(optionsBt)
|
self.optionsButton.setText(optionsBt)
|
||||||
|
|
||||||
# Action for Run script
|
# Action for Run script
|
||||||
runBt = QCoreApplication.translate("PythonConsole", "Run Command")
|
runBt = QCoreApplication.translate("PythonConsole", "Run Command")
|
||||||
self.run_action = QAction(self)
|
self.runButton = QAction(self)
|
||||||
self.run_action.setIcon(QgsApplication.getThemeIcon("mActionStart.svg"))
|
self.runButton.setCheckable(False)
|
||||||
self.run_action.setMenuRole(QAction.MenuRole.PreferencesRole)
|
self.runButton.setEnabled(True)
|
||||||
self.run_action.setIconVisibleInMenu(True)
|
self.runButton.setIcon(QgsApplication.getThemeIcon("mActionStart.svg"))
|
||||||
self.run_action.setToolTip(runBt)
|
self.runButton.setMenuRole(QAction.MenuRole.PreferencesRole)
|
||||||
self.run_action.setText(runBt)
|
self.runButton.setIconVisibleInMenu(True)
|
||||||
|
self.runButton.setToolTip(runBt)
|
||||||
|
self.runButton.setText(runBt)
|
||||||
|
|
||||||
# Help button
|
# Help button
|
||||||
self.help_console_action = QAction(self)
|
self.helpConsoleAction = QAction(self)
|
||||||
self.help_console_action.setText(
|
self.helpConsoleAction.setEnabled(True)
|
||||||
|
self.helpConsoleAction.setText(
|
||||||
QCoreApplication.translate("PythonConsole", "Python Console Help")
|
QCoreApplication.translate("PythonConsole", "Python Console Help")
|
||||||
)
|
)
|
||||||
self.help_api_action = QAction(self)
|
self.helpAPIAction = QAction(self)
|
||||||
self.help_api_action.setText(
|
self.helpAPIAction.setEnabled(True)
|
||||||
|
self.helpAPIAction.setText(
|
||||||
QCoreApplication.translate("PythonConsole", "PyQGIS API Documentation")
|
QCoreApplication.translate("PythonConsole", "PyQGIS API Documentation")
|
||||||
)
|
)
|
||||||
self.help_cookbook_action = QAction(self)
|
self.helpCookbookAction = QAction(self)
|
||||||
self.help_cookbook_action.setText(
|
self.helpCookbookAction.setEnabled(True)
|
||||||
|
self.helpCookbookAction.setText(
|
||||||
QCoreApplication.translate("PythonConsole", "PyQGIS Cookbook")
|
QCoreApplication.translate("PythonConsole", "PyQGIS Cookbook")
|
||||||
)
|
)
|
||||||
|
|
||||||
self.helpMenu = QMenu(self)
|
self.helpMenu = QMenu(self)
|
||||||
self.helpMenu.addAction(self.help_console_action)
|
self.helpMenu.addAction(self.helpConsoleAction)
|
||||||
self.helpMenu.addAction(self.help_api_action)
|
self.helpMenu.addAction(self.helpAPIAction)
|
||||||
self.helpMenu.addAction(self.help_cookbook_action)
|
self.helpMenu.addAction(self.helpCookbookAction)
|
||||||
|
|
||||||
helpBt = QCoreApplication.translate("PythonConsole", "Help…")
|
helpBt = QCoreApplication.translate("PythonConsole", "Help…")
|
||||||
self.helpButton = QToolButton(self)
|
self.helpButton = QToolButton(self)
|
||||||
@ -457,12 +495,12 @@ class PythonConsoleWidget(QWidget):
|
|||||||
self.toolBar.setIconSize(icon_size)
|
self.toolBar.setIconSize(icon_size)
|
||||||
self.toolBar.setMovable(False)
|
self.toolBar.setMovable(False)
|
||||||
self.toolBar.setFloatable(False)
|
self.toolBar.setFloatable(False)
|
||||||
self.toolBar.addAction(self.clear_action)
|
self.toolBar.addAction(self.clearButton)
|
||||||
self.toolBar.addAction(self.run_action)
|
self.toolBar.addAction(self.runButton)
|
||||||
self.toolBar.addSeparator()
|
self.toolBar.addSeparator()
|
||||||
self.toolBar.addAction(self.show_editor_action)
|
self.toolBar.addAction(self.showEditorButton)
|
||||||
self.toolBar.addSeparator()
|
self.toolBar.addSeparator()
|
||||||
self.toolBar.addAction(self.options_action)
|
self.toolBar.addAction(self.optionsButton)
|
||||||
self.toolBar.addWidget(self.helpButton)
|
self.toolBar.addWidget(self.helpButton)
|
||||||
self.toolBar.addSeparator()
|
self.toolBar.addSeparator()
|
||||||
self.toolBar.addWidget(parent.dockToggleButton())
|
self.toolBar.addWidget(parent.dockToggleButton())
|
||||||
@ -475,25 +513,25 @@ class PythonConsoleWidget(QWidget):
|
|||||||
self.toolBarEditor.setIconSize(icon_size)
|
self.toolBarEditor.setIconSize(icon_size)
|
||||||
self.toolBarEditor.setMovable(False)
|
self.toolBarEditor.setMovable(False)
|
||||||
self.toolBarEditor.setFloatable(False)
|
self.toolBarEditor.setFloatable(False)
|
||||||
self.toolBarEditor.addAction(self.open_file_action)
|
self.toolBarEditor.addAction(self.openFileButton)
|
||||||
self.toolBarEditor.addAction(self.open_in_editor_action)
|
self.toolBarEditor.addAction(self.openInEditorButton)
|
||||||
self.toolBarEditor.addSeparator()
|
self.toolBarEditor.addSeparator()
|
||||||
self.toolBarEditor.addAction(self.save_file_action)
|
self.toolBarEditor.addAction(self.saveFileButton)
|
||||||
self.toolBarEditor.addAction(self.save_as_file_action)
|
self.toolBarEditor.addAction(self.saveAsFileButton)
|
||||||
self.toolBarEditor.addSeparator()
|
self.toolBarEditor.addSeparator()
|
||||||
self.toolBarEditor.addAction(self.run_script_action)
|
self.toolBarEditor.addAction(self.runScriptEditorButton)
|
||||||
self.toolBarEditor.addAction(self.run_selection_action)
|
self.toolBarEditor.addAction(self.runSelectedEditorButton)
|
||||||
self.toolBarEditor.addSeparator()
|
self.toolBarEditor.addSeparator()
|
||||||
self.toolBarEditor.addAction(self.cut_action)
|
self.toolBarEditor.addAction(self.cutEditorButton)
|
||||||
self.toolBarEditor.addAction(self.copy_action)
|
self.toolBarEditor.addAction(self.copyEditorButton)
|
||||||
self.toolBarEditor.addAction(self.paste_action)
|
self.toolBarEditor.addAction(self.pasteEditorButton)
|
||||||
self.toolBarEditor.addSeparator()
|
self.toolBarEditor.addSeparator()
|
||||||
self.toolBarEditor.addAction(self.find_text_action)
|
self.toolBarEditor.addAction(self.find_text_action)
|
||||||
self.toolBarEditor.addSeparator()
|
self.toolBarEditor.addSeparator()
|
||||||
self.toolBarEditor.addAction(self.toggle_comment_action)
|
self.toolBarEditor.addAction(self.toggleCommentEditorButton)
|
||||||
self.toolBarEditor.addAction(self.reformat_code_action)
|
self.toolBarEditor.addAction(self.reformatCodeEditorButton)
|
||||||
self.toolBarEditor.addSeparator()
|
self.toolBarEditor.addSeparator()
|
||||||
self.toolBarEditor.addAction(self.object_inspector_action)
|
self.toolBarEditor.addAction(self.objectListButton)
|
||||||
|
|
||||||
self.widgetButton = QWidget()
|
self.widgetButton = QWidget()
|
||||||
sizePolicy = QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Preferred)
|
sizePolicy = QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Preferred)
|
||||||
@ -547,25 +585,25 @@ class PythonConsoleWidget(QWidget):
|
|||||||
|
|
||||||
# ------------ Signal -------------------------------
|
# ------------ Signal -------------------------------
|
||||||
|
|
||||||
self.object_inspector_action.toggled.connect(self.toggleObjectListWidget)
|
self.objectListButton.toggled.connect(self.toggleObjectListWidget)
|
||||||
self.toggle_comment_action.triggered.connect(self.toggleComment)
|
self.toggleCommentEditorButton.triggered.connect(self.toggleComment)
|
||||||
self.reformat_code_action.triggered.connect(self.reformatCode)
|
self.reformatCodeEditorButton.triggered.connect(self.reformatCode)
|
||||||
self.run_script_action.triggered.connect(self.runScriptEditor)
|
self.runScriptEditorButton.triggered.connect(self.runScriptEditor)
|
||||||
self.run_selection_action.triggered.connect(self.runSelectedEditor)
|
self.runSelectedEditorButton.triggered.connect(self.runSelectedEditor)
|
||||||
self.cut_action.triggered.connect(self.cutEditor)
|
self.cutEditorButton.triggered.connect(self.cutEditor)
|
||||||
self.copy_action.triggered.connect(self.copyEditor)
|
self.copyEditorButton.triggered.connect(self.copyEditor)
|
||||||
self.paste_action.triggered.connect(self.pasteEditor)
|
self.pasteEditorButton.triggered.connect(self.pasteEditor)
|
||||||
self.show_editor_action.toggled.connect(self.toggleEditor)
|
self.showEditorButton.toggled.connect(self.toggleEditor)
|
||||||
self.clear_action.triggered.connect(self.shell_output.clearConsole)
|
self.clearButton.triggered.connect(self.shell_output.clearConsole)
|
||||||
self.options_action.triggered.connect(self.openSettings)
|
self.optionsButton.triggered.connect(self.openSettings)
|
||||||
self.run_action.triggered.connect(self.shell.entered)
|
self.runButton.triggered.connect(self.shell.entered)
|
||||||
self.open_file_action.triggered.connect(self.openScriptFile)
|
self.openFileButton.triggered.connect(self.openScriptFile)
|
||||||
self.open_in_editor_action.triggered.connect(self.openScriptFileExtEditor)
|
self.openInEditorButton.triggered.connect(self.openScriptFileExtEditor)
|
||||||
self.save_file_action.triggered.connect(self.saveScriptFile)
|
self.saveFileButton.triggered.connect(self.saveScriptFile)
|
||||||
self.save_as_file_action.triggered.connect(self.saveAsScriptFile)
|
self.saveAsFileButton.triggered.connect(self.saveAsScriptFile)
|
||||||
self.help_console_action.triggered.connect(self.openHelpConsole)
|
self.helpConsoleAction.triggered.connect(self.openHelpConsole)
|
||||||
self.help_api_action.triggered.connect(self.openHelpAPI)
|
self.helpAPIAction.triggered.connect(self.openHelpAPI)
|
||||||
self.help_cookbook_action.triggered.connect(self.openHelpCookbook)
|
self.helpCookbookAction.triggered.connect(self.openHelpCookbook)
|
||||||
self.listClassMethod.itemClicked.connect(self.onClickGoToLine)
|
self.listClassMethod.itemClicked.connect(self.onClickGoToLine)
|
||||||
|
|
||||||
if iface is not None:
|
if iface is not None:
|
||||||
|
@ -33,13 +33,7 @@ from operator import itemgetter
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from qgis.core import Qgis, QgsApplication, QgsBlockingNetworkRequest, QgsSettings
|
from qgis.core import Qgis, QgsApplication, QgsBlockingNetworkRequest, QgsSettings
|
||||||
from qgis.gui import (
|
from qgis.gui import QgsCodeEditorPython, QgsCodeEditorWidget, QgsMessageBar
|
||||||
QgsCodeEditorPython,
|
|
||||||
QgsCodeEditorWidget,
|
|
||||||
QgsGui,
|
|
||||||
QgsMessageBar,
|
|
||||||
QgsShortcutsManager,
|
|
||||||
)
|
|
||||||
|
|
||||||
from qgis.PyQt.Qsci import QsciScintilla
|
from qgis.PyQt.Qsci import QsciScintilla
|
||||||
from qgis.PyQt.QtCore import (
|
from qgis.PyQt.QtCore import (
|
||||||
@ -165,6 +159,15 @@ class Editor(QgsCodeEditorPython):
|
|||||||
syntaxCheckAction.setShortcut("Ctrl+4")
|
syntaxCheckAction.setShortcut("Ctrl+4")
|
||||||
menu.addAction(syntaxCheckAction)
|
menu.addAction(syntaxCheckAction)
|
||||||
|
|
||||||
|
runSelected = QAction(
|
||||||
|
QgsApplication.getThemeIcon("mActionRunSelected.svg"), # spellok
|
||||||
|
QCoreApplication.translate("PythonConsole", "Run Selected"),
|
||||||
|
menu,
|
||||||
|
)
|
||||||
|
runSelected.triggered.connect(self.runSelectedCode) # spellok
|
||||||
|
runSelected.setShortcut("Ctrl+E") # spellok
|
||||||
|
menu.addAction(runSelected) # spellok
|
||||||
|
|
||||||
word = self.selectedText() or self.wordAtPoint(e.pos())
|
word = self.selectedText() or self.wordAtPoint(e.pos())
|
||||||
if word:
|
if word:
|
||||||
context_help_action = QAction(
|
context_help_action = QAction(
|
||||||
@ -182,24 +185,13 @@ class Editor(QgsCodeEditorPython):
|
|||||||
context_help_action.setShortcut(QKeySequence.StandardKey.HelpContents)
|
context_help_action.setShortcut(QKeySequence.StandardKey.HelpContents)
|
||||||
menu.addAction(context_help_action)
|
menu.addAction(context_help_action)
|
||||||
|
|
||||||
run_selection_action = QAction(menu)
|
start_action = QAction(
|
||||||
run_selection_action.setIcon(
|
QgsApplication.getThemeIcon("mActionStart.svg"),
|
||||||
QgsApplication.getThemeIcon("mActionRunSelected.svg"),
|
QCoreApplication.translate("PythonConsole", "Run Script"),
|
||||||
|
menu,
|
||||||
)
|
)
|
||||||
run_selection_action.triggered.connect(self.runSelectedCode)
|
|
||||||
QgsGui.shortcutsManager().initializeCommonAction(
|
|
||||||
run_selection_action,
|
|
||||||
QgsShortcutsManager.CommonAction.CodeRunSelection,
|
|
||||||
)
|
|
||||||
menu.addAction(run_selection_action)
|
|
||||||
|
|
||||||
start_action = QAction(self)
|
|
||||||
start_action.setIcon(QgsApplication.getThemeIcon("mActionStart.svg"))
|
|
||||||
start_action.triggered.connect(self.runScriptCode)
|
start_action.triggered.connect(self.runScriptCode)
|
||||||
QgsGui.shortcutsManager().initializeCommonAction(
|
start_action.setShortcut("Ctrl+Shift+E")
|
||||||
start_action,
|
|
||||||
QgsShortcutsManager.CommonAction.CodeRunScript,
|
|
||||||
)
|
|
||||||
menu.addAction(start_action)
|
menu.addAction(start_action)
|
||||||
|
|
||||||
menu.addSeparator()
|
menu.addSeparator()
|
||||||
@ -266,31 +258,18 @@ class Editor(QgsCodeEditorPython):
|
|||||||
menu.addAction(selectAllAction)
|
menu.addAction(selectAllAction)
|
||||||
|
|
||||||
menu.addSeparator()
|
menu.addSeparator()
|
||||||
toggle_comment_action = QAction(menu)
|
toggle_comment_action = QAction(
|
||||||
toggle_comment_action.setIcon(
|
|
||||||
QgsApplication.getThemeIcon(
|
QgsApplication.getThemeIcon(
|
||||||
"console/iconCommentEditorConsole.svg",
|
"console/iconCommentEditorConsole.svg",
|
||||||
self.palette().color(QPalette.ColorRole.WindowText),
|
self.palette().color(QPalette.ColorRole.WindowText),
|
||||||
)
|
),
|
||||||
|
QCoreApplication.translate("PythonConsole", "Toggle Comment"),
|
||||||
|
menu,
|
||||||
)
|
)
|
||||||
toggle_comment_action.triggered.connect(self.toggleComment)
|
toggle_comment_action.triggered.connect(self.toggleComment)
|
||||||
QgsGui.shortcutsManager().initializeCommonAction(
|
toggle_comment_action.setShortcut("Ctrl+:")
|
||||||
toggle_comment_action,
|
|
||||||
QgsShortcutsManager.CommonAction.CodeToggleComment,
|
|
||||||
)
|
|
||||||
menu.addAction(toggle_comment_action)
|
menu.addAction(toggle_comment_action)
|
||||||
|
|
||||||
reformat_code_action = QAction(menu)
|
|
||||||
reformat_code_action.setIcon(
|
|
||||||
QgsApplication.getThemeIcon("console/iconFormatCode.svg")
|
|
||||||
)
|
|
||||||
reformat_code_action.triggered.connect(self.reformatCode)
|
|
||||||
QgsGui.shortcutsManager().initializeCommonAction(
|
|
||||||
reformat_code_action,
|
|
||||||
QgsShortcutsManager.CommonAction.CodeReformat,
|
|
||||||
)
|
|
||||||
menu.addAction(reformat_code_action)
|
|
||||||
|
|
||||||
menu.addSeparator()
|
menu.addSeparator()
|
||||||
gist_menu = QMenu(self)
|
gist_menu = QMenu(self)
|
||||||
gist_menu.setTitle(
|
gist_menu.setTitle(
|
||||||
@ -320,14 +299,14 @@ class Editor(QgsCodeEditorPython):
|
|||||||
syntaxCheckAction.setEnabled(False)
|
syntaxCheckAction.setEnabled(False)
|
||||||
pasteAction.setEnabled(False)
|
pasteAction.setEnabled(False)
|
||||||
cutAction.setEnabled(False)
|
cutAction.setEnabled(False)
|
||||||
run_selection_action.setEnabled(False)
|
runSelected.setEnabled(False) # spellok
|
||||||
copyAction.setEnabled(False)
|
copyAction.setEnabled(False)
|
||||||
selectAllAction.setEnabled(False)
|
selectAllAction.setEnabled(False)
|
||||||
undoAction.setEnabled(False)
|
undoAction.setEnabled(False)
|
||||||
redoAction.setEnabled(False)
|
redoAction.setEnabled(False)
|
||||||
showCodeInspection.setEnabled(False)
|
showCodeInspection.setEnabled(False)
|
||||||
if self.hasSelectedText():
|
if self.hasSelectedText():
|
||||||
run_selection_action.setEnabled(True)
|
runSelected.setEnabled(True) # spellok
|
||||||
copyAction.setEnabled(True)
|
copyAction.setEnabled(True)
|
||||||
cutAction.setEnabled(True)
|
cutAction.setEnabled(True)
|
||||||
if not self.text() == "":
|
if not self.text() == "":
|
||||||
@ -347,17 +326,17 @@ class Editor(QgsCodeEditorPython):
|
|||||||
listObj = self.console_widget.listClassMethod
|
listObj = self.console_widget.listClassMethod
|
||||||
if listObj.isVisible():
|
if listObj.isVisible():
|
||||||
listObj.hide()
|
listObj.hide()
|
||||||
self.console_widget.object_inspector_action.setChecked(False)
|
self.console_widget.objectListButton.setChecked(False)
|
||||||
else:
|
else:
|
||||||
listObj.show()
|
listObj.show()
|
||||||
self.console_widget.object_inspector_action.setChecked(True)
|
self.console_widget.objectListButton.setChecked(True)
|
||||||
|
|
||||||
def shareOnGist(self, is_public):
|
def shareOnGist(self, is_public):
|
||||||
self.code_editor_widget.shareOnGist(is_public)
|
self.code_editor_widget.shareOnGist(is_public)
|
||||||
|
|
||||||
def hideEditor(self):
|
def hideEditor(self):
|
||||||
self.console_widget.splitterObj.hide()
|
self.console_widget.splitterObj.hide()
|
||||||
self.console_widget.show_editor_action.setChecked(False)
|
self.console_widget.showEditorButton.setChecked(False)
|
||||||
|
|
||||||
def createTempFile(self):
|
def createTempFile(self):
|
||||||
name = tempfile.NamedTemporaryFile(delete=False).name
|
name = tempfile.NamedTemporaryFile(delete=False).name
|
||||||
@ -496,7 +475,7 @@ class Editor(QgsCodeEditorPython):
|
|||||||
)
|
)
|
||||||
self.tab_widget.setTabToolTip(index, self.code_editor_widget.filePath())
|
self.tab_widget.setTabToolTip(index, self.code_editor_widget.filePath())
|
||||||
self.setModified(False)
|
self.setModified(False)
|
||||||
self.console_widget.save_file_action.setEnabled(False)
|
self.console_widget.saveFileButton.setEnabled(False)
|
||||||
self.console_widget.updateTabListScript(
|
self.console_widget.updateTabListScript(
|
||||||
self.code_editor_widget.filePath(), action="append"
|
self.code_editor_widget.filePath(), action="append"
|
||||||
)
|
)
|
||||||
@ -741,7 +720,7 @@ class EditorTabWidget(QTabWidget):
|
|||||||
# New Editor button
|
# New Editor button
|
||||||
self.newTabButton = QToolButton()
|
self.newTabButton = QToolButton()
|
||||||
txtToolTipNewTab = QCoreApplication.translate("PythonConsole", "New Editor")
|
txtToolTipNewTab = QCoreApplication.translate("PythonConsole", "New Editor")
|
||||||
self.newTabButton.setToolTip(f"<b>{txtToolTipNewTab}</b> (Ctrl+T)")
|
self.newTabButton.setToolTip(txtToolTipNewTab + " <b>Ctrl+T</b>")
|
||||||
self.newTabButton.setAutoRaise(True)
|
self.newTabButton.setAutoRaise(True)
|
||||||
self.newTabButton.setIcon(
|
self.newTabButton.setIcon(
|
||||||
QgsApplication.getThemeIcon("console/iconNewTabEditorConsole.svg")
|
QgsApplication.getThemeIcon("console/iconNewTabEditorConsole.svg")
|
||||||
@ -831,7 +810,7 @@ class EditorTabWidget(QTabWidget):
|
|||||||
def enableSaveIfModified(self, tab):
|
def enableSaveIfModified(self, tab):
|
||||||
tabWidget = self.widget(tab)
|
tabWidget = self.widget(tab)
|
||||||
if tabWidget:
|
if tabWidget:
|
||||||
self.console_widget.save_file_action.setEnabled(tabWidget.isModified())
|
self.console_widget.saveFileButton.setEnabled(tabWidget.isModified())
|
||||||
|
|
||||||
def enableToolBarEditor(self, enable):
|
def enableToolBarEditor(self, enable):
|
||||||
if self.topFrame.isVisible():
|
if self.topFrame.isVisible():
|
||||||
@ -885,7 +864,7 @@ class EditorTabWidget(QTabWidget):
|
|||||||
index = self.indexOf(tab)
|
index = self.indexOf(tab)
|
||||||
s = self.tabText(index)
|
s = self.tabText(index)
|
||||||
self.setTabTitle(index, f"*{s}" if modified else re.sub(r"^(\*)", "", s))
|
self.setTabTitle(index, f"*{s}" if modified else re.sub(r"^(\*)", "", s))
|
||||||
self.console_widget.save_file_action.setEnabled(modified)
|
self.console_widget.saveFileButton.setEnabled(modified)
|
||||||
|
|
||||||
def setTabTitle(self, tab, title):
|
def setTabTitle(self, tab, title):
|
||||||
self.setTabText(tab, title)
|
self.setTabText(tab, title)
|
||||||
@ -1092,9 +1071,10 @@ class EditorTabWidget(QTabWidget):
|
|||||||
objInspectorEnabled = QgsSettings().value(
|
objInspectorEnabled = QgsSettings().value(
|
||||||
"pythonConsole/enableObjectInsp", False, type=bool
|
"pythonConsole/enableObjectInsp", False, type=bool
|
||||||
)
|
)
|
||||||
|
listObj = self.console_widget.objectListButton
|
||||||
if self.console_widget.listClassMethod.isVisible():
|
if self.console_widget.listClassMethod.isVisible():
|
||||||
self.console_widget.object_inspector_action.setChecked(objInspectorEnabled)
|
listObj.setChecked(objInspectorEnabled)
|
||||||
self.console_widget.object_inspector_action.setEnabled(objInspectorEnabled)
|
listObj.setEnabled(objInspectorEnabled)
|
||||||
if objInspectorEnabled:
|
if objInspectorEnabled:
|
||||||
cW = self.currentWidget()
|
cW = self.currentWidget()
|
||||||
if cW and not self.console_widget.listClassMethod.isVisible():
|
if cW and not self.console_widget.listClassMethod.isVisible():
|
||||||
|
@ -348,7 +348,7 @@ class ShellOutputScintilla(QgsCodeEditorPython):
|
|||||||
Ed = self.console_widget.splitterObj
|
Ed = self.console_widget.splitterObj
|
||||||
if not Ed.isVisible():
|
if not Ed.isVisible():
|
||||||
Ed.show()
|
Ed.show()
|
||||||
self.console_widget.show_editor_action.setChecked(True)
|
self.console_widget.showEditorButton.setChecked(True)
|
||||||
self.shell_editor.setFocus()
|
self.shell_editor.setFocus()
|
||||||
|
|
||||||
def copy(self):
|
def copy(self):
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
# The following has been generated automatically from src/gui/qgsshortcutsmanager.h
|
|
||||||
# monkey patching scoped based enum
|
|
||||||
QgsShortcutsManager.CommonAction.CodeToggleComment.__doc__ = "Toggle code comments"
|
|
||||||
QgsShortcutsManager.CommonAction.CodeReformat.__doc__ = "Reformat code"
|
|
||||||
QgsShortcutsManager.CommonAction.CodeRunScript.__doc__ = "Run script"
|
|
||||||
QgsShortcutsManager.CommonAction.CodeRunSelection.__doc__ = "Run selection from script"
|
|
||||||
QgsShortcutsManager.CommonAction.__doc__ = """Contains common actions which are used across a variety of classes.
|
|
||||||
|
|
||||||
.. versionadded:: 4.0
|
|
||||||
|
|
||||||
* ``CodeToggleComment``: Toggle code comments
|
|
||||||
* ``CodeReformat``: Reformat code
|
|
||||||
* ``CodeRunScript``: Run script
|
|
||||||
* ``CodeRunSelection``: Run selection from script
|
|
||||||
|
|
||||||
"""
|
|
||||||
# --
|
|
||||||
QgsShortcutsManager.CommonAction.baseClass = QgsShortcutsManager
|
|
@ -23,14 +23,6 @@ rather accessed through :py:func:`QgsGui.shortcutsManager()`.
|
|||||||
#include "qgsshortcutsmanager.h"
|
#include "qgsshortcutsmanager.h"
|
||||||
%End
|
%End
|
||||||
public:
|
public:
|
||||||
enum class CommonAction
|
|
||||||
{
|
|
||||||
CodeToggleComment,
|
|
||||||
CodeReformat,
|
|
||||||
CodeRunScript,
|
|
||||||
CodeRunSelection,
|
|
||||||
};
|
|
||||||
|
|
||||||
QgsShortcutsManager( QObject *parent /TransferThis/ = 0, const QString &settingsRoot = "/shortcuts/" );
|
QgsShortcutsManager( QObject *parent /TransferThis/ = 0, const QString &settingsRoot = "/shortcuts/" );
|
||||||
%Docstring
|
%Docstring
|
||||||
Constructor for QgsShortcutsManager.
|
Constructor for QgsShortcutsManager.
|
||||||
@ -44,8 +36,6 @@ Constructor for QgsShortcutsManager.
|
|||||||
QGIS actions.
|
QGIS actions.
|
||||||
%End
|
%End
|
||||||
|
|
||||||
~QgsShortcutsManager();
|
|
||||||
|
|
||||||
void registerAllChildren( QObject *object, bool recursive = false, const QString §ion = QString() );
|
void registerAllChildren( QObject *object, bool recursive = false, const QString §ion = QString() );
|
||||||
%Docstring
|
%Docstring
|
||||||
Automatically registers all QActions and QShortcuts which are children
|
Automatically registers all QActions and QShortcuts which are children
|
||||||
@ -115,16 +105,6 @@ in GUI.
|
|||||||
.. seealso:: :py:func:`unregisterAction`
|
.. seealso:: :py:func:`unregisterAction`
|
||||||
|
|
||||||
.. seealso:: :py:func:`registerAllChildActions`
|
.. seealso:: :py:func:`registerAllChildActions`
|
||||||
%End
|
|
||||||
|
|
||||||
void initializeCommonAction( QAction *action, CommonAction commonAction );
|
|
||||||
%Docstring
|
|
||||||
Initializes an ``action`` as a common action.
|
|
||||||
|
|
||||||
This automatically configures the ``action`` to use the properties for
|
|
||||||
the common action, such as setting the action's tooltip and shortcut.
|
|
||||||
|
|
||||||
.. versionadded:: 4.0
|
|
||||||
%End
|
%End
|
||||||
|
|
||||||
bool registerShortcut( QShortcut *shortcut, const QString &defaultSequence = QString(), const QString §ion = QString() );
|
bool registerShortcut( QShortcut *shortcut, const QString &defaultSequence = QString(), const QString §ion = QString() );
|
||||||
@ -310,14 +290,6 @@ if no shortcut is associated.
|
|||||||
.. seealso:: :py:func:`objectForSequence`
|
.. seealso:: :py:func:`objectForSequence`
|
||||||
|
|
||||||
.. seealso:: :py:func:`actionForSequence`
|
.. seealso:: :py:func:`actionForSequence`
|
||||||
%End
|
|
||||||
|
|
||||||
QKeySequence sequenceForCommonAction( CommonAction action ) const;
|
|
||||||
%Docstring
|
|
||||||
Returns the key sequence which is associated with a common ``action``,
|
|
||||||
or an empty sequence if no shortcut is assigned to that action.
|
|
||||||
|
|
||||||
.. versionadded:: 4.0
|
|
||||||
%End
|
%End
|
||||||
|
|
||||||
QAction *actionByName( const QString &name ) const;
|
QAction *actionByName( const QString &name ) const;
|
||||||
|
@ -6977,30 +6977,28 @@ QgsShapeburstFillSymbolLayerWidget.setColor: src/gui/symbology/qgssymbollayerwid
|
|||||||
QgsShapeburstFillSymbolLayerWidget.setSymbolLayer: src/gui/symbology/qgssymbollayerwidget.h#L426
|
QgsShapeburstFillSymbolLayerWidget.setSymbolLayer: src/gui/symbology/qgssymbollayerwidget.h#L426
|
||||||
QgsShapeburstFillSymbolLayerWidget.symbolLayer: src/gui/symbology/qgssymbollayerwidget.h#L427
|
QgsShapeburstFillSymbolLayerWidget.symbolLayer: src/gui/symbology/qgssymbollayerwidget.h#L427
|
||||||
QgsShapeburstFillSymbolLayerWidget: src/gui/symbology/qgssymbollayerwidget.h#L407
|
QgsShapeburstFillSymbolLayerWidget: src/gui/symbology/qgssymbollayerwidget.h#L407
|
||||||
QgsShortcutsManager.actionByName: src/gui/qgsshortcutsmanager.h#L267
|
QgsShortcutsManager.actionByName: src/gui/qgsshortcutsmanager.h#L236
|
||||||
QgsShortcutsManager.actionForSequence: src/gui/qgsshortcutsmanager.h#L246
|
QgsShortcutsManager.actionForSequence: src/gui/qgsshortcutsmanager.h#L221
|
||||||
QgsShortcutsManager.defaultKeySequence: src/gui/qgsshortcutsmanager.h#L188
|
QgsShortcutsManager.defaultKeySequence: src/gui/qgsshortcutsmanager.h#L163
|
||||||
QgsShortcutsManager.defaultKeySequence: src/gui/qgsshortcutsmanager.h#L196
|
QgsShortcutsManager.defaultKeySequence: src/gui/qgsshortcutsmanager.h#L171
|
||||||
QgsShortcutsManager.initializeCommonAction: src/gui/qgsshortcutsmanager.h#L119
|
QgsShortcutsManager.objectDefaultKeySequence: src/gui/qgsshortcutsmanager.h#L155
|
||||||
QgsShortcutsManager.objectDefaultKeySequence: src/gui/qgsshortcutsmanager.h#L180
|
QgsShortcutsManager.objectForSequence: src/gui/qgsshortcutsmanager.h#L213
|
||||||
QgsShortcutsManager.objectForSequence: src/gui/qgsshortcutsmanager.h#L238
|
QgsShortcutsManager.objectForSettingKey: src/gui/qgsshortcutsmanager.h#L262
|
||||||
QgsShortcutsManager.objectForSettingKey: src/gui/qgsshortcutsmanager.h#L293
|
QgsShortcutsManager.objectSettingKey: src/gui/qgsshortcutsmanager.h#L254
|
||||||
QgsShortcutsManager.objectSettingKey: src/gui/qgsshortcutsmanager.h#L285
|
QgsShortcutsManager.registerAction: src/gui/qgsshortcutsmanager.h#L94
|
||||||
QgsShortcutsManager.registerAction: src/gui/qgsshortcutsmanager.h#L109
|
QgsShortcutsManager.registerAllChildActions: src/gui/qgsshortcutsmanager.h#L70
|
||||||
QgsShortcutsManager.registerAllChildActions: src/gui/qgsshortcutsmanager.h#L85
|
QgsShortcutsManager.registerAllChildShortcuts: src/gui/qgsshortcutsmanager.h#L81
|
||||||
QgsShortcutsManager.registerAllChildShortcuts: src/gui/qgsshortcutsmanager.h#L96
|
QgsShortcutsManager.registerAllChildren: src/gui/qgsshortcutsmanager.h#L59
|
||||||
QgsShortcutsManager.registerAllChildren: src/gui/qgsshortcutsmanager.h#L74
|
QgsShortcutsManager.registerShortcut: src/gui/qgsshortcutsmanager.h#L106
|
||||||
QgsShortcutsManager.registerShortcut: src/gui/qgsshortcutsmanager.h#L131
|
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L180
|
||||||
QgsShortcutsManager.sequenceForCommonAction: src/gui/qgsshortcutsmanager.h#L260
|
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L196
|
||||||
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L205
|
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L204
|
||||||
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L221
|
QgsShortcutsManager.setObjectKeySequence: src/gui/qgsshortcutsmanager.h#L188
|
||||||
QgsShortcutsManager.setKeySequence: src/gui/qgsshortcutsmanager.h#L229
|
QgsShortcutsManager.settingsPath: src/gui/qgsshortcutsmanager.h#L246
|
||||||
QgsShortcutsManager.setObjectKeySequence: src/gui/qgsshortcutsmanager.h#L213
|
QgsShortcutsManager.shortcutByName: src/gui/qgsshortcutsmanager.h#L243
|
||||||
QgsShortcutsManager.settingsPath: src/gui/qgsshortcutsmanager.h#L277
|
QgsShortcutsManager.shortcutForSequence: src/gui/qgsshortcutsmanager.h#L229
|
||||||
QgsShortcutsManager.shortcutByName: src/gui/qgsshortcutsmanager.h#L274
|
QgsShortcutsManager.unregisterAction: src/gui/qgsshortcutsmanager.h#L116
|
||||||
QgsShortcutsManager.shortcutForSequence: src/gui/qgsshortcutsmanager.h#L254
|
QgsShortcutsManager.unregisterShortcut: src/gui/qgsshortcutsmanager.h#L126
|
||||||
QgsShortcutsManager.unregisterAction: src/gui/qgsshortcutsmanager.h#L141
|
|
||||||
QgsShortcutsManager.unregisterShortcut: src/gui/qgsshortcutsmanager.h#L151
|
|
||||||
QgsShortcutsManager: src/gui/qgsshortcutsmanager.h#L36
|
QgsShortcutsManager: src/gui/qgsshortcutsmanager.h#L36
|
||||||
QgsSimpleFillSymbolLayerWidget.create: src/gui/symbology/qgssymbollayerwidget.h#L264
|
QgsSimpleFillSymbolLayerWidget.create: src/gui/symbology/qgssymbollayerwidget.h#L264
|
||||||
QgsSimpleFillSymbolLayerWidget.setColor: src/gui/symbology/qgssymbollayerwidget.h#L271
|
QgsSimpleFillSymbolLayerWidget.setColor: src/gui/symbology/qgssymbollayerwidget.h#L271
|
||||||
|
@ -30,7 +30,7 @@ from qgis.PyQt.QtCore import Qt
|
|||||||
from qgis.PyQt.QtGui import QPalette
|
from qgis.PyQt.QtGui import QPalette
|
||||||
from qgis.PyQt.QtWidgets import QMessageBox, QFileDialog, QVBoxLayout
|
from qgis.PyQt.QtWidgets import QMessageBox, QFileDialog, QVBoxLayout
|
||||||
|
|
||||||
from qgis.gui import QgsGui, QgsErrorDialog, QgsCodeEditorWidget, QgsShortcutsManager
|
from qgis.gui import QgsGui, QgsErrorDialog, QgsCodeEditorWidget
|
||||||
from qgis.core import (
|
from qgis.core import (
|
||||||
QgsApplication,
|
QgsApplication,
|
||||||
QgsFileUtils,
|
QgsFileUtils,
|
||||||
@ -122,9 +122,6 @@ class ScriptEditorDialog(BASE, WIDGET):
|
|||||||
self.palette().color(QPalette.ColorRole.WindowText),
|
self.palette().color(QPalette.ColorRole.WindowText),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
QgsGui.shortcutsManager().initializeCommonAction(
|
|
||||||
self.actionToggleComment, QgsShortcutsManager.CommonAction.CodeToggleComment
|
|
||||||
)
|
|
||||||
|
|
||||||
# Connect signals and slots
|
# Connect signals and slots
|
||||||
self.actionOpenScript.triggered.connect(self.openScript)
|
self.actionOpenScript.triggered.connect(self.openScript)
|
||||||
|
@ -8,8 +8,6 @@ set(QGIS_3D_SRCS
|
|||||||
qgsaabb.cpp
|
qgsaabb.cpp
|
||||||
qgsabstract3dengine.cpp
|
qgsabstract3dengine.cpp
|
||||||
qgsabstractvectorlayer3drenderer.cpp
|
qgsabstractvectorlayer3drenderer.cpp
|
||||||
qgsannotationlayer3drenderer.cpp
|
|
||||||
qgsannotationlayerchunkloader_p.cpp
|
|
||||||
qgs3danimationsettings.cpp
|
qgs3danimationsettings.cpp
|
||||||
qgs3dexportobject.cpp
|
qgs3dexportobject.cpp
|
||||||
qgs3dmapexportsettings.cpp
|
qgs3dmapexportsettings.cpp
|
||||||
@ -156,8 +154,6 @@ set(QGIS_3D_HDRS
|
|||||||
qgsaabb.h
|
qgsaabb.h
|
||||||
qgsabstract3dengine.h
|
qgsabstract3dengine.h
|
||||||
qgsabstractvectorlayer3drenderer.h
|
qgsabstractvectorlayer3drenderer.h
|
||||||
qgsannotationlayer3drenderer.h
|
|
||||||
qgsannotationlayerchunkloader_p.h
|
|
||||||
qgscameracontroller.h
|
qgscameracontroller.h
|
||||||
qgscamerapose.h
|
qgscamerapose.h
|
||||||
qgsgeotransform.h
|
qgsgeotransform.h
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "qgsmeshlayer3drenderer.h"
|
#include "qgsmeshlayer3drenderer.h"
|
||||||
#include "qgspointcloudlayer3drenderer.h"
|
#include "qgspointcloudlayer3drenderer.h"
|
||||||
#include "qgstiledscenelayer3drenderer.h"
|
#include "qgstiledscenelayer3drenderer.h"
|
||||||
#include "qgsannotationlayer3drenderer.h"
|
|
||||||
#include "qgs3dsymbolregistry.h"
|
#include "qgs3dsymbolregistry.h"
|
||||||
#include "qgspoint3dsymbol.h"
|
#include "qgspoint3dsymbol.h"
|
||||||
#include "qgsline3dsymbol.h"
|
#include "qgsline3dsymbol.h"
|
||||||
@ -69,7 +68,6 @@ void Qgs3D::initialize()
|
|||||||
QgsApplication::renderer3DRegistry()->addRenderer( new QgsMeshLayer3DRendererMetadata );
|
QgsApplication::renderer3DRegistry()->addRenderer( new QgsMeshLayer3DRendererMetadata );
|
||||||
QgsApplication::renderer3DRegistry()->addRenderer( new QgsPointCloudLayer3DRendererMetadata );
|
QgsApplication::renderer3DRegistry()->addRenderer( new QgsPointCloudLayer3DRendererMetadata );
|
||||||
QgsApplication::renderer3DRegistry()->addRenderer( new QgsTiledSceneLayer3DRendererMetadata );
|
QgsApplication::renderer3DRegistry()->addRenderer( new QgsTiledSceneLayer3DRendererMetadata );
|
||||||
QgsApplication::renderer3DRegistry()->addRenderer( new QgsAnnotationLayer3DRendererMetadata );
|
|
||||||
|
|
||||||
QgsApplication::symbol3DRegistry()->addSymbolType( new Qgs3DSymbolMetadata( QStringLiteral( "point" ), QObject::tr( "Point" ), &QgsPoint3DSymbol::create, nullptr, Qgs3DSymbolImpl::handlerForPoint3DSymbol ) );
|
QgsApplication::symbol3DRegistry()->addSymbolType( new Qgs3DSymbolMetadata( QStringLiteral( "point" ), QObject::tr( "Point" ), &QgsPoint3DSymbol::create, nullptr, Qgs3DSymbolImpl::handlerForPoint3DSymbol ) );
|
||||||
QgsApplication::symbol3DRegistry()->addSymbolType( new Qgs3DSymbolMetadata( QStringLiteral( "line" ), QObject::tr( "Line" ), &QgsLine3DSymbol::create, nullptr, Qgs3DSymbolImpl::handlerForLine3DSymbol ) );
|
QgsApplication::symbol3DRegistry()->addSymbolType( new Qgs3DSymbolMetadata( QStringLiteral( "line" ), QObject::tr( "Line" ), &QgsLine3DSymbol::create, nullptr, Qgs3DSymbolImpl::handlerForLine3DSymbol ) );
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
#include "qgsapplication.h"
|
#include "qgsapplication.h"
|
||||||
#include "qgsaabb.h"
|
#include "qgsaabb.h"
|
||||||
#include "qgsabstract3dengine.h"
|
#include "qgsabstract3dengine.h"
|
||||||
#include "qgsannotationlayer.h"
|
|
||||||
#include "qgs3dmapsettings.h"
|
#include "qgs3dmapsettings.h"
|
||||||
#include "qgs3dutils.h"
|
#include "qgs3dutils.h"
|
||||||
#include "qgsabstract3drenderer.h"
|
#include "qgsabstract3drenderer.h"
|
||||||
@ -67,7 +66,6 @@
|
|||||||
#include "qgsterraingenerator.h"
|
#include "qgsterraingenerator.h"
|
||||||
#include "qgstiledscenelayer.h"
|
#include "qgstiledscenelayer.h"
|
||||||
#include "qgstiledscenelayer3drenderer.h"
|
#include "qgstiledscenelayer3drenderer.h"
|
||||||
#include "qgsannotationlayer3drenderer.h"
|
|
||||||
#include "qgsdirectionallightsettings.h"
|
#include "qgsdirectionallightsettings.h"
|
||||||
#include "qgsvectorlayer.h"
|
#include "qgsvectorlayer.h"
|
||||||
#include "qgsvectorlayer3drenderer.h"
|
#include "qgsvectorlayer3drenderer.h"
|
||||||
@ -748,11 +746,6 @@ void Qgs3DMapScene::addLayerEntity( QgsMapLayer *layer )
|
|||||||
QgsTiledSceneLayer3DRenderer *tiledSceneRenderer = static_cast<QgsTiledSceneLayer3DRenderer *>( renderer );
|
QgsTiledSceneLayer3DRenderer *tiledSceneRenderer = static_cast<QgsTiledSceneLayer3DRenderer *>( renderer );
|
||||||
tiledSceneRenderer->setLayer( static_cast<QgsTiledSceneLayer *>( layer ) );
|
tiledSceneRenderer->setLayer( static_cast<QgsTiledSceneLayer *>( layer ) );
|
||||||
}
|
}
|
||||||
else if ( layer->type() == Qgis::LayerType::Annotation && renderer->type() == QLatin1String( "annotation" ) )
|
|
||||||
{
|
|
||||||
auto annotationLayerRenderer = qgis::down_cast<QgsAnnotationLayer3DRenderer *>( renderer );
|
|
||||||
annotationLayerRenderer->setLayer( qobject_cast<QgsAnnotationLayer *>( layer ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt3DCore::QEntity *newEntity = renderer->createEntity( &mMap );
|
Qt3DCore::QEntity *newEntity = renderer->createEntity( &mMap );
|
||||||
if ( newEntity )
|
if ( newEntity )
|
||||||
|
@ -1161,7 +1161,7 @@ QgsCameraPose Qgs3DUtils::lineSegmentToCameraPose( const QgsVector3D &startPoint
|
|||||||
|
|
||||||
std::unique_ptr<Qt3DRender::QCamera> Qgs3DUtils::copyCamera( Qt3DRender::QCamera *cam )
|
std::unique_ptr<Qt3DRender::QCamera> Qgs3DUtils::copyCamera( Qt3DRender::QCamera *cam )
|
||||||
{
|
{
|
||||||
auto copy = std::make_unique<Qt3DRender::QCamera>();
|
std::unique_ptr<Qt3DRender::QCamera> copy = std::make_unique<Qt3DRender::QCamera>();
|
||||||
copy->setPosition( cam->position() );
|
copy->setPosition( cam->position() );
|
||||||
copy->setViewCenter( cam->viewCenter() );
|
copy->setViewCenter( cam->viewCenter() );
|
||||||
copy->setUpVector( cam->upVector() );
|
copy->setUpVector( cam->upVector() );
|
||||||
|
@ -1,155 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
qgsannotationlayer3drenderer.cpp
|
|
||||||
--------------------------------------
|
|
||||||
Date : January 2020
|
|
||||||
Copyright : (C) 2020 by Martin Dobias
|
|
||||||
Email : wonder dot sk at gmail dot com
|
|
||||||
***************************************************************************
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "qgsannotationlayer3drenderer.h"
|
|
||||||
#include "qgsannotationlayer.h"
|
|
||||||
#include "qgsannotationlayerchunkloader_p.h"
|
|
||||||
#include "qgis.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// QgsAnnotationLayer3DRendererMetadata
|
|
||||||
//
|
|
||||||
|
|
||||||
QgsAnnotationLayer3DRendererMetadata::QgsAnnotationLayer3DRendererMetadata()
|
|
||||||
: Qgs3DRendererAbstractMetadata( QStringLiteral( "annotation" ) )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsAbstract3DRenderer *QgsAnnotationLayer3DRendererMetadata::createRenderer( QDomElement &elem, const QgsReadWriteContext &context )
|
|
||||||
{
|
|
||||||
auto r = std::make_unique< QgsAnnotationLayer3DRenderer >();
|
|
||||||
r->readXml( elem, context );
|
|
||||||
return r.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// QgsAnnotationLayer3DRenderer
|
|
||||||
//
|
|
||||||
|
|
||||||
QgsAnnotationLayer3DRenderer::QgsAnnotationLayer3DRenderer() = default;
|
|
||||||
|
|
||||||
void QgsAnnotationLayer3DRenderer::setLayer( QgsAnnotationLayer *layer )
|
|
||||||
{
|
|
||||||
mLayerRef = QgsMapLayerRef( layer );
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsAnnotationLayer *QgsAnnotationLayer3DRenderer::layer() const
|
|
||||||
{
|
|
||||||
return qobject_cast<QgsAnnotationLayer *>( mLayerRef.layer );
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsAnnotationLayer3DRenderer::resolveReferences( const QgsProject &project )
|
|
||||||
{
|
|
||||||
mLayerRef.resolve( &project );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QgsAnnotationLayer3DRenderer::showCalloutLines() const
|
|
||||||
{
|
|
||||||
return mShowCalloutLines;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsAnnotationLayer3DRenderer::setShowCalloutLines( bool show )
|
|
||||||
{
|
|
||||||
mShowCalloutLines = show;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsAnnotationLayer3DRenderer::setCalloutLineColor( const QColor &color )
|
|
||||||
{
|
|
||||||
mCalloutLineColor = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
QColor QgsAnnotationLayer3DRenderer::calloutLineColor() const
|
|
||||||
{
|
|
||||||
return mCalloutLineColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsAnnotationLayer3DRenderer::setCalloutLineWidth( double width )
|
|
||||||
{
|
|
||||||
mCalloutLineWidth = width;
|
|
||||||
}
|
|
||||||
|
|
||||||
double QgsAnnotationLayer3DRenderer::calloutLineWidth() const
|
|
||||||
{
|
|
||||||
return mCalloutLineWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QgsAnnotationLayer3DRenderer::type() const
|
|
||||||
{
|
|
||||||
return "annotation";
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsAnnotationLayer3DRenderer *QgsAnnotationLayer3DRenderer::clone() const
|
|
||||||
{
|
|
||||||
auto r = std::make_unique< QgsAnnotationLayer3DRenderer >();
|
|
||||||
r->mLayerRef = mLayerRef;
|
|
||||||
r->mAltClamping = mAltClamping;
|
|
||||||
r->mZOffset = mZOffset;
|
|
||||||
r->mShowCalloutLines = mShowCalloutLines;
|
|
||||||
r->mCalloutLineColor = mCalloutLineColor;
|
|
||||||
r->mCalloutLineWidth = mCalloutLineWidth;
|
|
||||||
return r.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt3DCore::QEntity *QgsAnnotationLayer3DRenderer::createEntity( Qgs3DMapSettings *map ) const
|
|
||||||
{
|
|
||||||
QgsAnnotationLayer *l = layer();
|
|
||||||
|
|
||||||
if ( !l )
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
// For some cases we start with a maximal z range because we can't know this upfront, as it potentially involves terrain heights.
|
|
||||||
// This range will be refined after populating the nodes to the actual z range of the generated chunks nodes.
|
|
||||||
// Assuming the vertical height is in meter, then it's extremely unlikely that a real vertical
|
|
||||||
// height will exceed this amount!
|
|
||||||
constexpr double MINIMUM_ANNOTATION_Z_ESTIMATE = -100000;
|
|
||||||
constexpr double MAXIMUM_ANNOTATION_Z_ESTIMATE = 100000;
|
|
||||||
|
|
||||||
double minimumZ = MINIMUM_ANNOTATION_Z_ESTIMATE;
|
|
||||||
double maximumZ = MAXIMUM_ANNOTATION_Z_ESTIMATE;
|
|
||||||
switch ( mAltClamping )
|
|
||||||
{
|
|
||||||
case Qgis::AltitudeClamping::Absolute:
|
|
||||||
// special case where we DO know the exact z range upfront!
|
|
||||||
minimumZ = mZOffset;
|
|
||||||
maximumZ = mZOffset;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Qgis::AltitudeClamping::Relative:
|
|
||||||
case Qgis::AltitudeClamping::Terrain:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new QgsAnnotationLayerChunkedEntity( map, l, mAltClamping, mZOffset, mShowCalloutLines, mCalloutLineColor, mCalloutLineWidth, minimumZ, maximumZ );
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsAnnotationLayer3DRenderer::writeXml( QDomElement &elem, const QgsReadWriteContext & ) const
|
|
||||||
{
|
|
||||||
QDomDocument doc = elem.ownerDocument();
|
|
||||||
|
|
||||||
elem.setAttribute( QStringLiteral( "layer" ), mLayerRef.layerId );
|
|
||||||
elem.setAttribute( QStringLiteral( "clamping" ), qgsEnumValueToKey( mAltClamping ) );
|
|
||||||
elem.setAttribute( QStringLiteral( "offset" ), mZOffset );
|
|
||||||
if ( mShowCalloutLines )
|
|
||||||
elem.setAttribute( QStringLiteral( "callouts" ), QStringLiteral( "1" ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsAnnotationLayer3DRenderer::readXml( const QDomElement &elem, const QgsReadWriteContext & )
|
|
||||||
{
|
|
||||||
mLayerRef = QgsMapLayerRef( elem.attribute( QStringLiteral( "layer" ) ) );
|
|
||||||
mAltClamping = qgsEnumKeyToValue( elem.attribute( QStringLiteral( "clamping" ) ), Qgis::AltitudeClamping::Relative );
|
|
||||||
mZOffset = elem.attribute( QStringLiteral( "offset" ), QString::number( DEFAULT_Z_OFFSET ) ).toDouble();
|
|
||||||
mShowCalloutLines = elem.attribute( QStringLiteral( "callouts" ), QStringLiteral( "0" ) ).toInt();
|
|
||||||
}
|
|
@ -1,185 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
qgsannotationlayer3drenderer.h
|
|
||||||
--------------------------------------
|
|
||||||
Date : September 2025
|
|
||||||
Copyright : (C) 2025 by Nyall Dawson
|
|
||||||
Email : nyall dot dawson at gmail dot com
|
|
||||||
***************************************************************************
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef QGSANNOTATIONLAYER3DRENDERER_H
|
|
||||||
#define QGSANNOTATIONLAYER3DRENDERER_H
|
|
||||||
|
|
||||||
#include "qgis_3d.h"
|
|
||||||
#include "qgis_sip.h"
|
|
||||||
|
|
||||||
#include "qgs3drendererregistry.h"
|
|
||||||
#include "qgsabstract3drenderer.h"
|
|
||||||
#include "qgsmaplayerref.h"
|
|
||||||
|
|
||||||
class QgsAnnotationLayer;
|
|
||||||
|
|
||||||
#ifdef SIP_RUN
|
|
||||||
// this is needed for the "convert to subclass" code below to compile
|
|
||||||
% ModuleHeaderCode
|
|
||||||
#include "qgsannotationlayer3drenderer.h"
|
|
||||||
% End
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \ingroup core
|
|
||||||
* \brief Metadata for annotation layer 3D renderer to allow creation of its instances from XML.
|
|
||||||
*
|
|
||||||
* \warning This is not considered stable API, and may change in future QGIS releases. It is
|
|
||||||
* exposed to the Python bindings as a tech preview only.
|
|
||||||
*
|
|
||||||
* \since QGIS 4.0
|
|
||||||
*/
|
|
||||||
class _3D_EXPORT QgsAnnotationLayer3DRendererMetadata : public Qgs3DRendererAbstractMetadata
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QgsAnnotationLayer3DRendererMetadata();
|
|
||||||
|
|
||||||
//! Creates an instance of a 3D renderer based on a DOM element with renderer configuration
|
|
||||||
QgsAbstract3DRenderer *createRenderer( QDomElement &elem, const QgsReadWriteContext &context ) override SIP_FACTORY;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \ingroup qgis_3d
|
|
||||||
* \brief 3D renderers for annotation layers.
|
|
||||||
*
|
|
||||||
* \since QGIS 4.0
|
|
||||||
*/
|
|
||||||
class _3D_EXPORT QgsAnnotationLayer3DRenderer : public QgsAbstract3DRenderer
|
|
||||||
{
|
|
||||||
#ifdef SIP_RUN
|
|
||||||
SIP_CONVERT_TO_SUBCLASS_CODE
|
|
||||||
if ( dynamic_cast<QgsAnnotationLayer3DRenderer *>( sipCpp ) != nullptr )
|
|
||||||
sipType = sipType_QgsAnnotationLayer3DRenderer;
|
|
||||||
else
|
|
||||||
sipType = nullptr;
|
|
||||||
SIP_END
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public:
|
|
||||||
QgsAnnotationLayer3DRenderer();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the annotation layer associated with the renderer.
|
|
||||||
*
|
|
||||||
* \see layer()
|
|
||||||
*/
|
|
||||||
void setLayer( QgsAnnotationLayer *layer );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the annotation layer associated with the renderer.
|
|
||||||
*
|
|
||||||
* \see setLayer()
|
|
||||||
*/
|
|
||||||
QgsAnnotationLayer *layer() const;
|
|
||||||
|
|
||||||
QString type() const override;
|
|
||||||
QgsAnnotationLayer3DRenderer *clone() const override SIP_FACTORY;
|
|
||||||
Qt3DCore::QEntity *createEntity( Qgs3DMapSettings *map ) const override SIP_SKIP;
|
|
||||||
|
|
||||||
void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
|
|
||||||
void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
|
|
||||||
void resolveReferences( const QgsProject &project ) override;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the altitude clamping method, which determines the vertical position of annotations.
|
|
||||||
*
|
|
||||||
* \see setAltitudeClamping()
|
|
||||||
*/
|
|
||||||
Qgis::AltitudeClamping altitudeClamping() const { return mAltClamping; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the altitude \a clamping method, which determines the vertical position of annotations.
|
|
||||||
*
|
|
||||||
* \see altitudeClamping()
|
|
||||||
*/
|
|
||||||
void setAltitudeClamping( Qgis::AltitudeClamping clamping ) { mAltClamping = clamping; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the z offset, which is a fixed offset amount which should be added to z values for the annotations.
|
|
||||||
*
|
|
||||||
* \see setZOffset()
|
|
||||||
*/
|
|
||||||
double zOffset() const { return mZOffset; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the z \a offset, which is a fixed offset amount which will be added to z values for the annotations.
|
|
||||||
*
|
|
||||||
* \see zOffset()
|
|
||||||
*/
|
|
||||||
void setZOffset( double offset ) { mZOffset = offset; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns TRUE if callout lines are shown, vertically joining the annotations to the terrain.
|
|
||||||
*
|
|
||||||
* \see setShowCalloutLines()
|
|
||||||
*/
|
|
||||||
bool showCalloutLines() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets whether callout lines are shown, vertically joining the annotations to the terrain.
|
|
||||||
*
|
|
||||||
* \see showCalloutLines()
|
|
||||||
*/
|
|
||||||
void setShowCalloutLines( bool show );
|
|
||||||
|
|
||||||
// TODO -- consider exposing via QgsSimpleLineMaterialSettings, for now, for testing only
|
|
||||||
/**
|
|
||||||
* Sets the callout line \a color.
|
|
||||||
*
|
|
||||||
* \see calloutLineColor()
|
|
||||||
* \note Not available in Python bindings
|
|
||||||
*/
|
|
||||||
SIP_SKIP void setCalloutLineColor( const QColor &color );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the callout line color.
|
|
||||||
*
|
|
||||||
* \see setCalloutLineColor()
|
|
||||||
* \note Not available in Python bindings
|
|
||||||
*/
|
|
||||||
SIP_SKIP QColor calloutLineColor() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the callout line \a width.
|
|
||||||
*
|
|
||||||
* \see calloutLineWidth()
|
|
||||||
* \note Not available in Python bindings
|
|
||||||
*/
|
|
||||||
SIP_SKIP void setCalloutLineWidth( double width );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the callout line width.
|
|
||||||
*
|
|
||||||
* \see setCalloutLineWidth()
|
|
||||||
* \note Not available in Python bindings
|
|
||||||
*/
|
|
||||||
SIP_SKIP double calloutLineWidth() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
#ifdef SIP_RUN
|
|
||||||
QgsAnnotationLayer3DRenderer( const QgsAnnotationLayer3DRenderer & );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static constexpr double DEFAULT_Z_OFFSET = 50;
|
|
||||||
|
|
||||||
QgsMapLayerRef mLayerRef;
|
|
||||||
Qgis::AltitudeClamping mAltClamping = Qgis::AltitudeClamping::Relative;
|
|
||||||
double mZOffset = DEFAULT_Z_OFFSET;
|
|
||||||
bool mShowCalloutLines = true;
|
|
||||||
QColor mCalloutLineColor { 0, 0, 0 };
|
|
||||||
double mCalloutLineWidth = 2;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QGSANNOTATIONLAYER3DRENDERER_H
|
|
@ -1,396 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
qgsannotationlayerchunkloader_p.cpp
|
|
||||||
--------------------------------------
|
|
||||||
Date : September 2025
|
|
||||||
Copyright : (C) 2025 by Nyall Dawson
|
|
||||||
Email : nyall dot dawson at gmail dot com
|
|
||||||
***************************************************************************
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "qgsannotationlayerchunkloader_p.h"
|
|
||||||
#include "moc_qgsannotationlayerchunkloader_p.cpp"
|
|
||||||
#include "qgs3dutils.h"
|
|
||||||
#include "qgsannotationitem.h"
|
|
||||||
#include "qgstessellatedpolygongeometry.h"
|
|
||||||
#include "qgschunknode.h"
|
|
||||||
#include "qgseventtracing.h"
|
|
||||||
#include "qgslogger.h"
|
|
||||||
#include "qgsannotationlayer.h"
|
|
||||||
#include "qgsabstract3dsymbol.h"
|
|
||||||
#include "qgsabstractterrainsettings.h"
|
|
||||||
#include "qgsannotationmarkeritem.h"
|
|
||||||
#include "qgsbillboardgeometry.h"
|
|
||||||
#include "qgspoint3dbillboardmaterial.h"
|
|
||||||
#include "qgsgeotransform.h"
|
|
||||||
#include "qgsexpressioncontextutils.h"
|
|
||||||
#include "qgstextureatlasgenerator.h"
|
|
||||||
#include "qgslinevertexdata_p.h"
|
|
||||||
#include "qgslinematerial_p.h"
|
|
||||||
|
|
||||||
#include <QtConcurrent>
|
|
||||||
#include <Qt3DCore/QTransform>
|
|
||||||
|
|
||||||
///@cond PRIVATE
|
|
||||||
|
|
||||||
|
|
||||||
QgsAnnotationLayerChunkLoader::QgsAnnotationLayerChunkLoader( const QgsAnnotationLayerChunkLoaderFactory *factory, QgsChunkNode *node )
|
|
||||||
: QgsChunkLoader( node )
|
|
||||||
, mFactory( factory )
|
|
||||||
, mRenderContext( factory->mRenderContext )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struct Billboard
|
|
||||||
{
|
|
||||||
QVector3D position;
|
|
||||||
int textureId;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void QgsAnnotationLayerChunkLoader::start()
|
|
||||||
{
|
|
||||||
QgsChunkNode *node = chunk();
|
|
||||||
if ( node->level() < mFactory->mLeafLevel )
|
|
||||||
{
|
|
||||||
QTimer::singleShot( 0, this, &QgsAnnotationLayerChunkLoader::finished );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsAnnotationLayer *layer = mFactory->mLayer;
|
|
||||||
mLayerName = mFactory->mLayer->name();
|
|
||||||
|
|
||||||
// only a subset of data to be queried
|
|
||||||
const QgsRectangle rect = node->box3D().toRectangle();
|
|
||||||
// origin for coordinates of the chunk - it is kind of arbitrary, but it should be
|
|
||||||
// picked so that the coordinates are relatively small to avoid numerical precision issues
|
|
||||||
mChunkOrigin = QgsVector3D( rect.center().x(), rect.center().y(), 0 );
|
|
||||||
|
|
||||||
QgsExpressionContext exprContext;
|
|
||||||
exprContext.appendScopes( QgsExpressionContextUtils::globalProjectLayerScopes( layer ) );
|
|
||||||
mRenderContext.setExpressionContext( exprContext );
|
|
||||||
|
|
||||||
QgsCoordinateTransform layerToMapTransform( layer->crs(), mRenderContext.crs(), mRenderContext.transformContext() );
|
|
||||||
|
|
||||||
QgsRectangle layerExtent;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
layerExtent = layerToMapTransform.transformBoundingBox( rect, Qgis::TransformDirection::Reverse );
|
|
||||||
}
|
|
||||||
catch ( QgsCsException &e )
|
|
||||||
{
|
|
||||||
QgsDebugError( QStringLiteral( "Error transforming annotation layer extent to 3d map extent: %1" ).arg( e.what() ) );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const double zOffset = mFactory->mZOffset;
|
|
||||||
const Qgis::AltitudeClamping altitudeClamping = mFactory->mClamping;
|
|
||||||
bool showCallouts = mFactory->mShowCallouts;
|
|
||||||
|
|
||||||
// see logic from QgsAnnotationLayerRenderer
|
|
||||||
const QStringList itemsList = layer->queryIndex( layerExtent );
|
|
||||||
QSet< QString > itemIds( itemsList.begin(), itemsList.end() );
|
|
||||||
|
|
||||||
// we also have NO choice but to clone ALL non-indexed items (i.e. those with a scale-dependent bounding box)
|
|
||||||
// since these won't be in the layer's spatial index, and it's too expensive to determine their actual bounding box
|
|
||||||
// upfront (we are blocking the main thread right now!)
|
|
||||||
|
|
||||||
// TODO -- come up with some brilliant way to avoid this and also index scale-dependent items ;)
|
|
||||||
itemIds.unite( layer->mNonIndexedItems );
|
|
||||||
|
|
||||||
mItemsToRender.reserve( itemIds.size() );
|
|
||||||
std::transform( itemIds.begin(), itemIds.end(), std::back_inserter( mItemsToRender ), [layer]( const QString &id ) -> std::unique_ptr< QgsAnnotationItem > {
|
|
||||||
return std::unique_ptr< QgsAnnotationItem >( layer->item( id )->clone() );
|
|
||||||
} );
|
|
||||||
|
|
||||||
//
|
|
||||||
// this will be run in a background thread
|
|
||||||
//
|
|
||||||
mFutureWatcher = new QFutureWatcher<void>( this );
|
|
||||||
connect( mFutureWatcher, &QFutureWatcher<void>::finished, this, &QgsChunkQueueJob::finished );
|
|
||||||
|
|
||||||
const QFuture<void> future = QtConcurrent::run( [this, rect, layerToMapTransform, zOffset, altitudeClamping, showCallouts] {
|
|
||||||
const QgsEventTracing::ScopedEvent e( QStringLiteral( "3D" ), QStringLiteral( "Annotation layer chunk load" ) );
|
|
||||||
|
|
||||||
std::vector< Billboard > billboards;
|
|
||||||
billboards.reserve( mItemsToRender.size() );
|
|
||||||
QVector< QImage > textures;
|
|
||||||
textures.reserve( mItemsToRender.size() );
|
|
||||||
|
|
||||||
for ( const std::unique_ptr< QgsAnnotationItem > &item : std::as_const( mItemsToRender ) )
|
|
||||||
{
|
|
||||||
if ( mCanceled )
|
|
||||||
break;
|
|
||||||
|
|
||||||
QgsAnnotationItem *annotation = item.get();
|
|
||||||
|
|
||||||
if ( !annotation->enabled() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ( QgsAnnotationMarkerItem *marker = dynamic_cast< QgsAnnotationMarkerItem * >( annotation ) )
|
|
||||||
{
|
|
||||||
if ( marker->symbol() )
|
|
||||||
{
|
|
||||||
QgsPointXY p = marker->geometry();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
const QgsPointXY mapPoint = layerToMapTransform.transform( p );
|
|
||||||
if ( !rect.contains( mapPoint ) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
double z = 0;
|
|
||||||
const float terrainZ = ( altitudeClamping == Qgis::AltitudeClamping::Absolute && !showCallouts ) ? 0 : mRenderContext.terrainRenderingEnabled() && mRenderContext.terrainGenerator() ? static_cast<float>( mRenderContext.terrainGenerator()->heightAt( mapPoint.x(), mapPoint.y(), mRenderContext ) * mRenderContext.terrainSettings()->verticalScale() )
|
|
||||||
: 0.f;
|
|
||||||
|
|
||||||
switch ( altitudeClamping )
|
|
||||||
{
|
|
||||||
case Qgis::AltitudeClamping::Absolute:
|
|
||||||
z = zOffset;
|
|
||||||
break;
|
|
||||||
case Qgis::AltitudeClamping::Terrain:
|
|
||||||
z = terrainZ;
|
|
||||||
break;
|
|
||||||
case Qgis::AltitudeClamping::Relative:
|
|
||||||
z = terrainZ + zOffset;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Billboard billboard;
|
|
||||||
billboard.position = ( QgsVector3D( mapPoint.x(), mapPoint.y(), z ) - mChunkOrigin ).toVector3D();
|
|
||||||
billboard.textureId = textures.size();
|
|
||||||
textures.append( QgsPoint3DBillboardMaterial::renderSymbolToImage( marker->symbol(), mRenderContext ) );
|
|
||||||
billboards.emplace_back( std::move( billboard ) );
|
|
||||||
|
|
||||||
if ( showCallouts )
|
|
||||||
{
|
|
||||||
mCalloutLines << QgsLineString( { mapPoint.x(), mapPoint.x() }, { mapPoint.y(), mapPoint.y() }, { terrainZ, z } );
|
|
||||||
}
|
|
||||||
|
|
||||||
mZMax = std::max( mZMax, showCallouts ? std::max( 0.0, z ) : z );
|
|
||||||
mZMin = std::min( mZMin, showCallouts ? std::min( 0.0, z ) : z );
|
|
||||||
}
|
|
||||||
catch ( QgsCsException &e )
|
|
||||||
{
|
|
||||||
QgsDebugError( e.what() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// free memory
|
|
||||||
mItemsToRender.clear();
|
|
||||||
|
|
||||||
const QgsTextureAtlas atlas = QgsTextureAtlasGenerator::createFromImages( textures, 2048 );
|
|
||||||
if ( atlas.isValid() )
|
|
||||||
{
|
|
||||||
mBillboardAtlas = atlas.renderAtlasTexture();
|
|
||||||
mBillboardPositions.reserve( static_cast< int >( billboards.size() ) );
|
|
||||||
for ( Billboard &billboard : billboards )
|
|
||||||
{
|
|
||||||
const QRect textureRect = atlas.rect( billboard.textureId );
|
|
||||||
QgsBillboardGeometry::BillboardAtlasData geometry;
|
|
||||||
geometry.position = billboard.position;
|
|
||||||
geometry.textureAtlasOffset = QVector2D( static_cast< float >( textureRect.left() ) / static_cast< float>( mBillboardAtlas.width() ), 1 - ( static_cast< float >( textureRect.bottom() ) / static_cast< float>( mBillboardAtlas.height() ) ) );
|
|
||||||
geometry.textureAtlasSize = QVector2D( static_cast< float >( textureRect.width() ) / static_cast< float>( mBillboardAtlas.width() ), static_cast< float>( textureRect.height() ) / static_cast< float>( mBillboardAtlas.height() ) );
|
|
||||||
mBillboardPositions.append( geometry );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QgsDebugError( QStringLiteral( "Error encountered building texture atlas" ) );
|
|
||||||
mBillboardAtlas = QImage();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
// emit finished() as soon as the handler is populated with features
|
|
||||||
mFutureWatcher->setFuture( future );
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsAnnotationLayerChunkLoader::~QgsAnnotationLayerChunkLoader()
|
|
||||||
{
|
|
||||||
if ( mFutureWatcher && !mFutureWatcher->isFinished() )
|
|
||||||
{
|
|
||||||
disconnect( mFutureWatcher, &QFutureWatcher<void>::finished, this, &QgsChunkQueueJob::finished );
|
|
||||||
mFutureWatcher->waitForFinished();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsAnnotationLayerChunkLoader::cancel()
|
|
||||||
{
|
|
||||||
mCanceled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt3DCore::QEntity *QgsAnnotationLayerChunkLoader::createEntity( Qt3DCore::QEntity *parent )
|
|
||||||
{
|
|
||||||
if ( mNode->level() < mFactory->mLeafLevel )
|
|
||||||
{
|
|
||||||
Qt3DCore::QEntity *entity = new Qt3DCore::QEntity( parent ); // dummy entity
|
|
||||||
entity->setObjectName( mLayerName + "_CONTAINER_" + mNode->tileId().text() );
|
|
||||||
return entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( mBillboardPositions.empty() )
|
|
||||||
{
|
|
||||||
// an empty node, so we return no entity. This tags the node as having no data and effectively removes it.
|
|
||||||
// we just make sure first that its initial estimated vertical range does not affect its parents' bboxes calculation
|
|
||||||
mNode->setExactBox3D( QgsBox3D() );
|
|
||||||
mNode->updateParentBoundingBoxesRecursively();
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt3DCore::QEntity *entity = new Qt3DCore::QEntity( parent );
|
|
||||||
entity->setObjectName( mLayerName + "_" + mNode->tileId().text() );
|
|
||||||
|
|
||||||
QgsBillboardGeometry *billboardGeometry = new QgsBillboardGeometry();
|
|
||||||
billboardGeometry->setBillboardData( mBillboardPositions );
|
|
||||||
|
|
||||||
Qt3DRender::QGeometryRenderer *billboardGeometryRenderer = new Qt3DRender::QGeometryRenderer;
|
|
||||||
billboardGeometryRenderer->setPrimitiveType( Qt3DRender::QGeometryRenderer::Points );
|
|
||||||
billboardGeometryRenderer->setGeometry( billboardGeometry );
|
|
||||||
billboardGeometryRenderer->setVertexCount( billboardGeometry->count() );
|
|
||||||
|
|
||||||
QgsPoint3DBillboardMaterial *billboardMaterial = new QgsPoint3DBillboardMaterial( QgsPoint3DBillboardMaterial::Mode::AtlasTexture );
|
|
||||||
billboardMaterial->setTexture2DFromImage( mBillboardAtlas );
|
|
||||||
|
|
||||||
QgsGeoTransform *billboardTransform = new QgsGeoTransform;
|
|
||||||
billboardTransform->setGeoTranslation( mChunkOrigin );
|
|
||||||
|
|
||||||
Qt3DCore::QEntity *billboardEntity = new Qt3DCore::QEntity;
|
|
||||||
billboardEntity->addComponent( billboardMaterial );
|
|
||||||
billboardEntity->addComponent( billboardTransform );
|
|
||||||
billboardEntity->addComponent( billboardGeometryRenderer );
|
|
||||||
billboardEntity->setParent( entity );
|
|
||||||
|
|
||||||
if ( mFactory->mShowCallouts )
|
|
||||||
{
|
|
||||||
QgsLineVertexData lineData;
|
|
||||||
lineData.withAdjacency = true;
|
|
||||||
lineData.geocentricCoordinates = false; // mMapSettings->sceneMode() == Qgis::SceneMode::Globe;
|
|
||||||
lineData.init( Qgis::AltitudeClamping::Absolute, Qgis::AltitudeBinding::Vertex, 0, mRenderContext, mChunkOrigin );
|
|
||||||
|
|
||||||
for ( const QgsLineString &line : mCalloutLines )
|
|
||||||
{
|
|
||||||
lineData.addLineString( line, 0, false );
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsLineMaterial *mat = new QgsLineMaterial;
|
|
||||||
mat->setLineColor( mFactory->mCalloutLineColor );
|
|
||||||
mat->setLineWidth( mFactory->mCalloutLineWidth );
|
|
||||||
|
|
||||||
Qt3DCore::QEntity *calloutEntity = new Qt3DCore::QEntity;
|
|
||||||
calloutEntity->setObjectName( parent->objectName() + "_CALLOUTS" );
|
|
||||||
|
|
||||||
// geometry renderer
|
|
||||||
Qt3DRender::QGeometryRenderer *calloutRenderer = new Qt3DRender::QGeometryRenderer;
|
|
||||||
calloutRenderer->setPrimitiveType( Qt3DRender::QGeometryRenderer::LineStripAdjacency );
|
|
||||||
calloutRenderer->setGeometry( lineData.createGeometry( calloutEntity ) );
|
|
||||||
calloutRenderer->setVertexCount( lineData.indexes.count() );
|
|
||||||
calloutRenderer->setPrimitiveRestartEnabled( true );
|
|
||||||
calloutRenderer->setRestartIndexValue( 0 );
|
|
||||||
|
|
||||||
// make entity
|
|
||||||
calloutEntity->addComponent( calloutRenderer );
|
|
||||||
calloutEntity->addComponent( mat );
|
|
||||||
|
|
||||||
calloutEntity->setParent( billboardEntity );
|
|
||||||
}
|
|
||||||
|
|
||||||
// fix the vertical range of the node from the estimated vertical range to the true range
|
|
||||||
if ( mZMin != std::numeric_limits<float>::max() && mZMax != std::numeric_limits<float>::lowest() )
|
|
||||||
{
|
|
||||||
QgsBox3D box = mNode->box3D();
|
|
||||||
box.setZMinimum( mZMin );
|
|
||||||
box.setZMaximum( mZMax );
|
|
||||||
mNode->setExactBox3D( box );
|
|
||||||
mNode->updateParentBoundingBoxesRecursively();
|
|
||||||
}
|
|
||||||
return entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
|
||||||
|
|
||||||
|
|
||||||
QgsAnnotationLayerChunkLoaderFactory::QgsAnnotationLayerChunkLoaderFactory( const Qgs3DRenderContext &context, QgsAnnotationLayer *layer, int leafLevel, Qgis::AltitudeClamping clamping, double zOffset, bool showCallouts, const QColor &calloutLineColor, double calloutLineWidth, double zMin, double zMax )
|
|
||||||
: mRenderContext( context )
|
|
||||||
, mLayer( layer )
|
|
||||||
, mLeafLevel( leafLevel )
|
|
||||||
, mClamping( clamping )
|
|
||||||
, mZOffset( zOffset )
|
|
||||||
, mShowCallouts( showCallouts )
|
|
||||||
, mCalloutLineColor( calloutLineColor )
|
|
||||||
, mCalloutLineWidth( calloutLineWidth )
|
|
||||||
{
|
|
||||||
if ( context.crs().type() == Qgis::CrsType::Geocentric )
|
|
||||||
{
|
|
||||||
// TODO: add support for handling of annotation layers
|
|
||||||
// (we're using dummy quadtree here to make sure the empty extent does not break the scene completely)
|
|
||||||
QgsDebugError( QStringLiteral( "Annotation layers in globe scenes are not supported yet!" ) );
|
|
||||||
setupQuadtree( QgsBox3D( -1e7, -1e7, -1e7, 1e7, 1e7, 1e7 ), -1, leafLevel );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsBox3D rootBox3D( context.extent(), zMin, zMax );
|
|
||||||
// add small padding to avoid clipping of point features located at the edge of the bounding box
|
|
||||||
rootBox3D.grow( 1.0 );
|
|
||||||
setupQuadtree( rootBox3D, -1, leafLevel ); // negative root error means that the node does not contain anything
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsChunkLoader *QgsAnnotationLayerChunkLoaderFactory::createChunkLoader( QgsChunkNode *node ) const
|
|
||||||
{
|
|
||||||
return new QgsAnnotationLayerChunkLoader( this, node );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
|
||||||
|
|
||||||
|
|
||||||
QgsAnnotationLayerChunkedEntity::QgsAnnotationLayerChunkedEntity( Qgs3DMapSettings *map, QgsAnnotationLayer *layer, Qgis::AltitudeClamping clamping, double zOffset, bool showCallouts, const QColor &calloutLineColor, double calloutLineWidth, double zMin, double zMax )
|
|
||||||
: QgsChunkedEntity( map,
|
|
||||||
-1, // max. allowed screen error (negative tau means that we need to go until leaves are reached)
|
|
||||||
new QgsAnnotationLayerChunkLoaderFactory( Qgs3DRenderContext::fromMapSettings( map ), layer, 3, clamping, zOffset, showCallouts, calloutLineColor, calloutLineWidth, zMin, zMax ), true )
|
|
||||||
{
|
|
||||||
mTransform = new Qt3DCore::QTransform;
|
|
||||||
if ( applyTerrainOffset() )
|
|
||||||
{
|
|
||||||
mTransform->setTranslation( QVector3D( 0.0f, 0.0f, static_cast<float>( map->terrainSettings()->elevationOffset() ) ) );
|
|
||||||
}
|
|
||||||
this->addComponent( mTransform );
|
|
||||||
|
|
||||||
connect( map, &Qgs3DMapSettings::terrainSettingsChanged, this, &QgsAnnotationLayerChunkedEntity::onTerrainElevationOffsetChanged );
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsAnnotationLayerChunkedEntity::~QgsAnnotationLayerChunkedEntity()
|
|
||||||
{
|
|
||||||
// cancel / wait for jobs
|
|
||||||
cancelActiveJobs();
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the AltitudeClamping is `Absolute`, do not apply the offset
|
|
||||||
bool QgsAnnotationLayerChunkedEntity::applyTerrainOffset() const
|
|
||||||
{
|
|
||||||
if ( auto loaderFactory = static_cast<QgsAnnotationLayerChunkLoaderFactory *>( mChunkLoaderFactory ) )
|
|
||||||
{
|
|
||||||
return loaderFactory->mClamping != Qgis::AltitudeClamping::Absolute;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsAnnotationLayerChunkedEntity::onTerrainElevationOffsetChanged()
|
|
||||||
{
|
|
||||||
QgsDebugMsgLevel( QStringLiteral( "QgsAnnotationLayerChunkedEntity::onTerrainElevationOffsetChanged" ), 2 );
|
|
||||||
float newOffset = static_cast<float>( qobject_cast<Qgs3DMapSettings *>( sender() )->terrainSettings()->elevationOffset() );
|
|
||||||
if ( !applyTerrainOffset() )
|
|
||||||
{
|
|
||||||
newOffset = 0.0;
|
|
||||||
}
|
|
||||||
mTransform->setTranslation( QVector3D( 0.0f, 0.0f, newOffset ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// @endcond
|
|
@ -1,146 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
qgsannotationlayerchunkloader_p.h
|
|
||||||
--------------------------------------
|
|
||||||
Date : September 2025
|
|
||||||
Copyright : (C) 2025 by Nyall Dawson
|
|
||||||
Email : nyall dot dawson at gmail dot com
|
|
||||||
***************************************************************************
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef QGSANNOTATIONLAYERCHUNKLOADER_P_H
|
|
||||||
#define QGSANNOTATIONLAYERCHUNKLOADER_P_H
|
|
||||||
|
|
||||||
///@cond PRIVATE
|
|
||||||
|
|
||||||
//
|
|
||||||
// W A R N I N G
|
|
||||||
// -------------
|
|
||||||
//
|
|
||||||
// This file is not part of the QGIS API. It exists purely as an
|
|
||||||
// implementation detail. This header file may change from version to
|
|
||||||
// version without notice, or even be removed.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "qgschunkloader.h"
|
|
||||||
#include "qgschunkedentity.h"
|
|
||||||
#include "qgs3drendercontext.h"
|
|
||||||
#include "qgsbillboardgeometry.h"
|
|
||||||
#include <QImage>
|
|
||||||
|
|
||||||
#define SIP_NO_FILE
|
|
||||||
|
|
||||||
class QgsAnnotationLayer;
|
|
||||||
class QgsAnnotationItem;
|
|
||||||
|
|
||||||
namespace Qt3DCore
|
|
||||||
{
|
|
||||||
class QTransform;
|
|
||||||
}
|
|
||||||
|
|
||||||
#include <QFutureWatcher>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \ingroup qgis_3d
|
|
||||||
* \brief This loader factory is responsible for creation of loaders of QgsAnnotationLayerChunkedEntity.
|
|
||||||
*
|
|
||||||
* \since QGIS 4.0
|
|
||||||
*/
|
|
||||||
class QgsAnnotationLayerChunkLoaderFactory : public QgsQuadtreeChunkLoaderFactory
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
//! Constructs the factory
|
|
||||||
QgsAnnotationLayerChunkLoaderFactory( const Qgs3DRenderContext &context, QgsAnnotationLayer *layer, int leafLevel, Qgis::AltitudeClamping clamping, double zOffset, bool showCallouts, const QColor &calloutLineColor, double calloutLineWidth, double zMin, double zMax );
|
|
||||||
|
|
||||||
//! Creates loader for the given chunk node. Ownership of the returned is passed to the caller.
|
|
||||||
virtual QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
|
|
||||||
|
|
||||||
Qgs3DRenderContext mRenderContext;
|
|
||||||
QgsAnnotationLayer *mLayer = nullptr;
|
|
||||||
int mLeafLevel = 0;
|
|
||||||
Qgis::AltitudeClamping mClamping = Qgis::AltitudeClamping::Relative;
|
|
||||||
double mZOffset = 0;
|
|
||||||
bool mShowCallouts = false;
|
|
||||||
QColor mCalloutLineColor;
|
|
||||||
double mCalloutLineWidth = 2;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \ingroup qgis_3d
|
|
||||||
* \brief This loader class is responsible for async loading of data for QgsAnnotationLayerChunkedEntity
|
|
||||||
* and creation of final 3D entity from the data previously prepared in a worker thread.
|
|
||||||
*
|
|
||||||
* \since QGIS 4.0
|
|
||||||
*/
|
|
||||||
class QgsAnnotationLayerChunkLoader : public QgsChunkLoader
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
//! Constructs the loader
|
|
||||||
QgsAnnotationLayerChunkLoader( const QgsAnnotationLayerChunkLoaderFactory *factory, QgsChunkNode *node );
|
|
||||||
~QgsAnnotationLayerChunkLoader() override;
|
|
||||||
|
|
||||||
void start() override;
|
|
||||||
virtual void cancel() override;
|
|
||||||
virtual Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const QgsAnnotationLayerChunkLoaderFactory *mFactory = nullptr;
|
|
||||||
Qgs3DRenderContext mRenderContext;
|
|
||||||
bool mCanceled = false;
|
|
||||||
QFutureWatcher<void> *mFutureWatcher = nullptr;
|
|
||||||
QString mLayerName;
|
|
||||||
QgsVector3D mChunkOrigin;
|
|
||||||
|
|
||||||
std::vector< std::unique_ptr< QgsAnnotationItem > > mItemsToRender;
|
|
||||||
|
|
||||||
QVector< QgsBillboardGeometry::BillboardAtlasData > mBillboardPositions;
|
|
||||||
QVector< QgsLineString > mCalloutLines;
|
|
||||||
QImage mBillboardAtlas;
|
|
||||||
double mZMin = std::numeric_limits< double >::max();
|
|
||||||
double mZMax = std::numeric_limits< double >::lowest();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \ingroup qgis_3d
|
|
||||||
* \brief 3D entity used for rendering of annotation layers.
|
|
||||||
*
|
|
||||||
* Internally it uses QgsAnnotationLayerChunkLoaderFactory and
|
|
||||||
* QgsAnnotationLayerChunkLoader to do the actual work
|
|
||||||
* of loading and creating 3D sub-entities for the layer.
|
|
||||||
*
|
|
||||||
* \since QGIS 4.0
|
|
||||||
*/
|
|
||||||
class QgsAnnotationLayerChunkedEntity : public QgsChunkedEntity
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
//! Constructs the entity.
|
|
||||||
explicit QgsAnnotationLayerChunkedEntity( Qgs3DMapSettings *map, QgsAnnotationLayer *layer, Qgis::AltitudeClamping clamping, double zOffset, bool showCallouts, const QColor &calloutLineColor, double calloutLineWidth, double zMin, double zMax );
|
|
||||||
~QgsAnnotationLayerChunkedEntity();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void onTerrainElevationOffsetChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Qt3DCore::QTransform *mTransform = nullptr;
|
|
||||||
|
|
||||||
bool applyTerrainOffset() const;
|
|
||||||
|
|
||||||
friend class TestQgsChunkedEntity;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @endcond
|
|
||||||
|
|
||||||
#endif // QGSANNOTATIONLAYERCHUNKLOADER_P_H
|
|
@ -296,7 +296,7 @@ QgsPointCloudLayer *QgsPdalAlgorithmBase::parameterAsPointCloudLayer( const QVar
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// if COPC provider, return as it is
|
// if COPC provider, return as it is
|
||||||
if ( layer->dataProvider()->name() == QLatin1String( "copc" ) )
|
if ( layer->dataProvider()->name() == QStringLiteral( "copc" ) )
|
||||||
{
|
{
|
||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ void QgsGeometryCheckAngleAlgorithm::initAlgorithm( const QVariantMap &configura
|
|||||||
QStringLiteral( "ERRORS" ), QObject::tr( "Small angle errors" ), Qgis::ProcessingSourceType::VectorPoint
|
QStringLiteral( "ERRORS" ), QObject::tr( "Small angle errors" ), Qgis::ProcessingSourceType::VectorPoint
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -97,7 +97,7 @@ void QgsGeometryCheckAreaAlgorithm::initAlgorithm( const QVariantMap &configurat
|
|||||||
QStringLiteral( "OUTPUT" ), QObject::tr( "Small polygons features" ), Qgis::ProcessingSourceType::VectorPolygon, QVariant(), true, false
|
QStringLiteral( "OUTPUT" ), QObject::tr( "Small polygons features" ), Qgis::ProcessingSourceType::VectorPolygon, QVariant(), true, false
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -98,7 +98,7 @@ void QgsGeometryCheckContainedAlgorithm::initAlgorithm( const QVariantMap &confi
|
|||||||
QStringLiteral( "OUTPUT" ), QObject::tr( "Contained features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
|
QStringLiteral( "OUTPUT" ), QObject::tr( "Contained features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ void QgsGeometryCheckDangleAlgorithm::initAlgorithm( const QVariantMap &configur
|
|||||||
QStringLiteral( "OUTPUT" ), QObject::tr( "Dangle-end features" ), Qgis::ProcessingSourceType::VectorLine, QVariant(), true, false
|
QStringLiteral( "OUTPUT" ), QObject::tr( "Dangle-end features" ), Qgis::ProcessingSourceType::VectorLine, QVariant(), true, false
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -87,7 +87,7 @@ void QgsGeometryCheckDegeneratePolygonAlgorithm::initAlgorithm( const QVariantMa
|
|||||||
QStringLiteral( "OUTPUT" ), QObject::tr( "Degenerate polygons features" ), Qgis::ProcessingSourceType::VectorPolygon, QVariant(), true, false
|
QStringLiteral( "OUTPUT" ), QObject::tr( "Degenerate polygons features" ), Qgis::ProcessingSourceType::VectorPolygon, QVariant(), true, false
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 );
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 );
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
tolerance->setHelp( QObject::tr( "The \"Tolerance\" advanced parameter defines the numerical precision of geometric operations, "
|
tolerance->setHelp( QObject::tr( "The \"Tolerance\" advanced parameter defines the numerical precision of geometric operations, "
|
||||||
"given as an integer n, meaning that any difference smaller than 10⁻ⁿ (in map units) is considered zero." ) );
|
"given as an integer n, meaning that any difference smaller than 10⁻ⁿ (in map units) is considered zero." ) );
|
||||||
|
@ -94,7 +94,7 @@ void QgsGeometryCheckDuplicateAlgorithm::initAlgorithm( const QVariantMap &confi
|
|||||||
QStringLiteral( "OUTPUT" ), QObject::tr( "Duplicate geometries" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
|
QStringLiteral( "OUTPUT" ), QObject::tr( "Duplicate geometries" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -89,7 +89,7 @@ void QgsGeometryCheckDuplicateNodesAlgorithm::initAlgorithm( const QVariantMap &
|
|||||||
QStringLiteral( "OUTPUT" ), QObject::tr( "Duplicated vertices features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
|
QStringLiteral( "OUTPUT" ), QObject::tr( "Duplicated vertices features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -92,7 +92,7 @@ void QgsGeometryCheckFollowBoundariesAlgorithm::initAlgorithm( const QVariantMap
|
|||||||
QStringLiteral( "REF_LAYER" ), QObject::tr( "Reference layer" ), QList<int>() << static_cast<int>( Qgis::ProcessingSourceType::VectorPolygon )
|
QStringLiteral( "REF_LAYER" ), QObject::tr( "Reference layer" ), QList<int>() << static_cast<int>( Qgis::ProcessingSourceType::VectorPolygon )
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -108,7 +108,7 @@ void QgsGeometryCheckGapAlgorithm::initAlgorithm( const QVariantMap &configurati
|
|||||||
QStringLiteral( "OUTPUT" ), QObject::tr( "Gap features" ), Qgis::ProcessingSourceType::VectorPolygon
|
QStringLiteral( "OUTPUT" ), QObject::tr( "Gap features" ), Qgis::ProcessingSourceType::VectorPolygon
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -94,7 +94,7 @@ void QgsGeometryCheckHoleAlgorithm::initAlgorithm( const QVariantMap &configurat
|
|||||||
QStringLiteral( "OUTPUT" ), QObject::tr( "Polygons with holes" ), Qgis::ProcessingSourceType::VectorPolygon, QVariant(), true, false
|
QStringLiteral( "OUTPUT" ), QObject::tr( "Polygons with holes" ), Qgis::ProcessingSourceType::VectorPolygon, QVariant(), true, false
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -88,7 +88,7 @@ void QgsGeometryCheckLineIntersectionAlgorithm::initAlgorithm( const QVariantMap
|
|||||||
QStringLiteral( "OUTPUT" ), QObject::tr( "Intersecting feature" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
|
QStringLiteral( "OUTPUT" ), QObject::tr( "Intersecting feature" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -94,7 +94,7 @@ void QgsGeometryCheckLineLayerIntersectionAlgorithm::initAlgorithm( const QVaria
|
|||||||
QStringLiteral( "OUTPUT" ), QObject::tr( "Line intersecting other layer features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
|
QStringLiteral( "OUTPUT" ), QObject::tr( "Line intersecting other layer features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -95,7 +95,7 @@ void QgsGeometryCheckMissingVertexAlgorithm::initAlgorithm( const QVariantMap &c
|
|||||||
QStringLiteral( "OUTPUT" ), QObject::tr( "Missing vertices features" ), Qgis::ProcessingSourceType::VectorPolygon, QVariant(), true, false
|
QStringLiteral( "OUTPUT" ), QObject::tr( "Missing vertices features" ), Qgis::ProcessingSourceType::VectorPolygon, QVariant(), true, false
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -93,7 +93,7 @@ void QgsGeometryCheckMultipartAlgorithm::initAlgorithm( const QVariantMap &confi
|
|||||||
QStringLiteral( "OUTPUT" ), QObject::tr( "One-part geometry features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
|
QStringLiteral( "OUTPUT" ), QObject::tr( "One-part geometry features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -92,7 +92,7 @@ void QgsGeometryCheckOverlapAlgorithm::initAlgorithm( const QVariantMap &configu
|
|||||||
QStringLiteral( "MIN_OVERLAP_AREA" ), QObject::tr( "Minimum overlap area" ), Qgis::ProcessingNumberParameterType::Double, 0, false, 0.0
|
QStringLiteral( "MIN_OVERLAP_AREA" ), QObject::tr( "Minimum overlap area" ), Qgis::ProcessingNumberParameterType::Double, 0, false, 0.0
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -88,7 +88,7 @@ void QgsGeometryCheckPointCoveredByLineAlgorithm::initAlgorithm( const QVariantM
|
|||||||
QStringLiteral( "ERRORS" ), QObject::tr( "Points not covered by a line" ), Qgis::ProcessingSourceType::VectorPoint
|
QStringLiteral( "ERRORS" ), QObject::tr( "Points not covered by a line" ), Qgis::ProcessingSourceType::VectorPoint
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -88,7 +88,7 @@ void QgsGeometryCheckPointInPolygonAlgorithm::initAlgorithm( const QVariantMap &
|
|||||||
QStringLiteral( "ERRORS" ), QObject::tr( "Points outside polygons errors" ), Qgis::ProcessingSourceType::VectorPoint
|
QStringLiteral( "ERRORS" ), QObject::tr( "Points outside polygons errors" ), Qgis::ProcessingSourceType::VectorPoint
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -93,7 +93,7 @@ void QgsGeometryCheckSegmentLengthAlgorithm::initAlgorithm( const QVariantMap &c
|
|||||||
QStringLiteral( "MIN_SEGMENT_LENGTH" ), QObject::tr( "Minimum segment length" ), Qgis::ProcessingNumberParameterType::Double, 0, false, 0.0
|
QStringLiteral( "MIN_SEGMENT_LENGTH" ), QObject::tr( "Minimum segment length" ), Qgis::ProcessingNumberParameterType::Double, 0, false, 0.0
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -89,7 +89,7 @@ void QgsGeometryCheckSelfContactAlgorithm::initAlgorithm( const QVariantMap &con
|
|||||||
QStringLiteral( "OUTPUT" ), QObject::tr( "Self contact features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
|
QStringLiteral( "OUTPUT" ), QObject::tr( "Self contact features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -91,7 +91,7 @@ void QgsGeometryCheckSelfIntersectionAlgorithm::initAlgorithm( const QVariantMap
|
|||||||
QStringLiteral( "OUTPUT" ), QObject::tr( "Self-intersecting features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
|
QStringLiteral( "OUTPUT" ), QObject::tr( "Self-intersecting features" ), Qgis::ProcessingSourceType::VectorAnyGeometry, QVariant(), true, false
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -100,7 +100,7 @@ void QgsGeometryCheckSliverPolygonAlgorithm::initAlgorithm( const QVariantMap &c
|
|||||||
QStringLiteral( "MAX_AREA" ), QObject::tr( "Maximum area (map units squared)" ), Qgis::ProcessingNumberParameterType::Double, 0, false, 0.0
|
QStringLiteral( "MAX_AREA" ), QObject::tr( "Maximum area (map units squared)" ), Qgis::ProcessingNumberParameterType::Double, 0, false, 0.0
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -196,11 +196,11 @@ QVariantMap QgsClimbAlgorithm::processAlgorithm( const QVariantMap ¶meters,
|
|||||||
|
|
||||||
if ( !noGeometry.empty() )
|
if ( !noGeometry.empty() )
|
||||||
{
|
{
|
||||||
feedback->pushInfo( QObject::tr( "The following features do not have geometry: %1" ).arg( noGeometry.join( QLatin1String( ", " ) ) ) );
|
feedback->pushInfo( QObject::tr( "The following features do not have geometry: %1" ).arg( noGeometry.join( QStringLiteral( ", " ) ) ) );
|
||||||
}
|
}
|
||||||
if ( !noZValue.empty() )
|
if ( !noZValue.empty() )
|
||||||
{
|
{
|
||||||
feedback->pushInfo( QObject::tr( "The following points do not have Z value: %1" ).arg( noZValue.join( QLatin1String( ", " ) ) ) );
|
feedback->pushInfo( QObject::tr( "The following points do not have Z value: %1" ).arg( noZValue.join( QStringLiteral( ", " ) ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
|
@ -107,7 +107,7 @@ void QgsFixGeometryAngleAlgorithm::initAlgorithm( const QVariantMap &configurati
|
|||||||
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing small angles" ), Qgis::ProcessingSourceType::VectorPoint
|
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing small angles" ), Qgis::ProcessingSourceType::VectorPoint
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -120,7 +120,7 @@ void QgsFixGeometryAreaAlgorithm::initAlgorithm( const QVariantMap &configuratio
|
|||||||
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from merging small polygons" ), Qgis::ProcessingSourceType::VectorPoint
|
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from merging small polygons" ), Qgis::ProcessingSourceType::VectorPoint
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -104,7 +104,7 @@ void QgsFixGeometryDuplicateNodesAlgorithm::initAlgorithm( const QVariantMap &co
|
|||||||
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing duplicate vertices" ), Qgis::ProcessingSourceType::VectorPoint
|
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing duplicate vertices" ), Qgis::ProcessingSourceType::VectorPoint
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -108,7 +108,7 @@ void QgsFixGeometryGapAlgorithm::initAlgorithm( const QVariantMap &configuration
|
|||||||
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing gaps" ), Qgis::ProcessingSourceType::VectorPoint
|
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing gaps" ), Qgis::ProcessingSourceType::VectorPoint
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -104,7 +104,7 @@ void QgsFixGeometryHoleAlgorithm::initAlgorithm( const QVariantMap &configuratio
|
|||||||
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing holes" ), Qgis::ProcessingSourceType::VectorPoint
|
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing holes" ), Qgis::ProcessingSourceType::VectorPoint
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -105,7 +105,7 @@ void QgsFixGeometryMissingVertexAlgorithm::initAlgorithm( const QVariantMap &con
|
|||||||
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing border vertices" ), Qgis::ProcessingSourceType::VectorPoint
|
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing border vertices" ), Qgis::ProcessingSourceType::VectorPoint
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -91,7 +91,7 @@ void QgsFixGeometryMultipartAlgorithm::initAlgorithm( const QVariantMap &configu
|
|||||||
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing multiparts" ), Qgis::ProcessingSourceType::VectorPoint
|
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing multiparts" ), Qgis::ProcessingSourceType::VectorPoint
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -99,7 +99,7 @@ void QgsFixGeometryOverlapAlgorithm::initAlgorithm( const QVariantMap &configura
|
|||||||
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing overlaps" ), Qgis::ProcessingSourceType::VectorPoint
|
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing overlaps" ), Qgis::ProcessingSourceType::VectorPoint
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -129,7 +129,7 @@ void QgsFixGeometrySelfIntersectionAlgorithm::initAlgorithm( const QVariantMap &
|
|||||||
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing self-intersections" ), Qgis::ProcessingSourceType::VectorPoint
|
QStringLiteral( "REPORT" ), QObject::tr( "Report layer from fixing self-intersections" ), Qgis::ProcessingSourceType::VectorPoint
|
||||||
) );
|
) );
|
||||||
|
|
||||||
auto tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>(
|
||||||
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13
|
||||||
);
|
);
|
||||||
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
|
||||||
|
@ -90,7 +90,7 @@ Qgis::ProcessingFeatureSourceFlags QgsRemovePartsByAreaAlgorithm::sourceFlags()
|
|||||||
|
|
||||||
void QgsRemovePartsByAreaAlgorithm::initParameters( const QVariantMap & )
|
void QgsRemovePartsByAreaAlgorithm::initParameters( const QVariantMap & )
|
||||||
{
|
{
|
||||||
auto minArea = std::make_unique< QgsProcessingParameterArea >( QStringLiteral( "MIN_AREA" ), QObject::tr( "Remove parts with area less than" ), 0.0, QStringLiteral( "INPUT" ), false, 0 );
|
std::unique_ptr< QgsProcessingParameterArea > minArea = std::make_unique< QgsProcessingParameterArea >( QStringLiteral( "MIN_AREA" ), QObject::tr( "Remove parts with area less than" ), 0.0, QStringLiteral( "INPUT" ), false, 0 );
|
||||||
minArea->setIsDynamic( true );
|
minArea->setIsDynamic( true );
|
||||||
minArea->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "MIN_AREA" ), QObject::tr( "Remove parts with area less than" ), QgsPropertyDefinition::DoublePositive ) );
|
minArea->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "MIN_AREA" ), QObject::tr( "Remove parts with area less than" ), QgsPropertyDefinition::DoublePositive ) );
|
||||||
minArea->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) );
|
minArea->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) );
|
||||||
|
@ -90,7 +90,7 @@ Qgis::ProcessingFeatureSourceFlags QgsRemovePartsByLengthAlgorithm::sourceFlags(
|
|||||||
|
|
||||||
void QgsRemovePartsByLengthAlgorithm::initParameters( const QVariantMap & )
|
void QgsRemovePartsByLengthAlgorithm::initParameters( const QVariantMap & )
|
||||||
{
|
{
|
||||||
auto minLength = std::make_unique< QgsProcessingParameterDistance >( QStringLiteral( "MIN_LENGTH" ), QObject::tr( "Remove parts with lengths less than" ), 0.0, QStringLiteral( "INPUT" ), false, 0 );
|
std::unique_ptr< QgsProcessingParameterDistance > minLength = std::make_unique< QgsProcessingParameterDistance >( QStringLiteral( "MIN_LENGTH" ), QObject::tr( "Remove parts with lengths less than" ), 0.0, QStringLiteral( "INPUT" ), false, 0 );
|
||||||
minLength->setIsDynamic( true );
|
minLength->setIsDynamic( true );
|
||||||
minLength->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "MIN_LENGTH" ), QObject::tr( "Remove parts with length less than" ), QgsPropertyDefinition::DoublePositive ) );
|
minLength->setDynamicPropertyDefinition( QgsPropertyDefinition( QStringLiteral( "MIN_LENGTH" ), QObject::tr( "Remove parts with length less than" ), QgsPropertyDefinition::DoublePositive ) );
|
||||||
minLength->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) );
|
minLength->setDynamicLayerParameterName( QStringLiteral( "INPUT" ) );
|
||||||
|
@ -1,199 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
qgsannotationlayer3drendererwidget.cpp
|
|
||||||
------------------------------
|
|
||||||
Date : September 2025
|
|
||||||
Copyright : (C) 2025 by Nyall Dawson
|
|
||||||
Email : nyall dot dawson at gmail dot com
|
|
||||||
***************************************************************************
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "qgsannotationlayer3drendererwidget.h"
|
|
||||||
#include "moc_qgsannotationlayer3drendererwidget.cpp"
|
|
||||||
|
|
||||||
#include "qgsapplication.h"
|
|
||||||
#include "qgsannotationlayer.h"
|
|
||||||
#include "qgsannotationlayer3drenderer.h"
|
|
||||||
|
|
||||||
#include <QBoxLayout>
|
|
||||||
#include <QCheckBox>
|
|
||||||
|
|
||||||
QgsAnnotationLayer3DRendererWidget::QgsAnnotationLayer3DRendererWidget( QgsAnnotationLayer *layer, QgsMapCanvas *canvas, QWidget *parent )
|
|
||||||
: QgsMapLayerConfigWidget( layer, canvas, parent )
|
|
||||||
{
|
|
||||||
setPanelTitle( tr( "3D View" ) );
|
|
||||||
setObjectName( QStringLiteral( "mOptsPage_3DView" ) );
|
|
||||||
|
|
||||||
setupUi( this );
|
|
||||||
|
|
||||||
mComboRendererType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "rendererNullSymbol.svg" ) ), tr( "No Symbols" ), QVariant::fromValue( RendererType::None ) );
|
|
||||||
mComboRendererType->addItem( QgsApplication::getThemeIcon( QStringLiteral( "rendererSingleSymbol.svg" ) ), tr( "3D Billboards" ), QVariant::fromValue( RendererType::Billboards ) );
|
|
||||||
mComboRendererType->setCurrentIndex( mComboRendererType->findData( QVariant::fromValue( RendererType::None ) ) );
|
|
||||||
mStackedWidget->setCurrentWidget( mPageNoRenderer );
|
|
||||||
|
|
||||||
connect( mComboRendererType, qOverload< int >( &QComboBox::currentIndexChanged ), this, &QgsAnnotationLayer3DRendererWidget::rendererTypeChanged );
|
|
||||||
|
|
||||||
mComboClamping->addItem( tr( "Relative to Terrain" ), QVariant::fromValue( Qgis::AltitudeClamping::Relative ) );
|
|
||||||
mComboClamping->addItem( tr( "Absolute" ), QVariant::fromValue( Qgis::AltitudeClamping::Absolute ) );
|
|
||||||
|
|
||||||
connect( mComboClamping, qOverload<int>( &QComboBox::currentIndexChanged ), this, &QgsAnnotationLayer3DRendererWidget::clampingChanged );
|
|
||||||
mComboClamping->setCurrentIndex( mComboClamping->findData( QVariant::fromValue( Qgis::AltitudeClamping::Relative ) ) );
|
|
||||||
clampingChanged();
|
|
||||||
|
|
||||||
connect( mOffsetZSpinBox, qOverload< double >( &QDoubleSpinBox::valueChanged ), this, [this]( double ) {
|
|
||||||
if ( !mBlockChanges )
|
|
||||||
emit widgetChanged();
|
|
||||||
} );
|
|
||||||
|
|
||||||
connect( mCheckShowCallouts, &QCheckBox::toggled, this, [this] {
|
|
||||||
if ( !mBlockChanges )
|
|
||||||
emit widgetChanged();
|
|
||||||
} );
|
|
||||||
|
|
||||||
syncToLayer( layer );
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsAnnotationLayer3DRendererWidget::setRenderer( const QgsAnnotationLayer3DRenderer *renderer )
|
|
||||||
{
|
|
||||||
mBlockChanges++;
|
|
||||||
mRenderer.reset( renderer ? renderer->clone() : nullptr );
|
|
||||||
if ( renderer )
|
|
||||||
{
|
|
||||||
mComboRendererType->setCurrentIndex( mComboRendererType->findData( QVariant::fromValue( RendererType::Billboards ) ) );
|
|
||||||
mComboClamping->setCurrentIndex( mComboClamping->findData( QVariant::fromValue( renderer->altitudeClamping() ) ) );
|
|
||||||
mOffsetZSpinBox->setValue( renderer->zOffset() );
|
|
||||||
mCheckShowCallouts->setChecked( renderer->showCalloutLines() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mComboRendererType->setCurrentIndex( mComboRendererType->findData( QVariant::fromValue( RendererType::None ) ) );
|
|
||||||
}
|
|
||||||
mBlockChanges--;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr< QgsAnnotationLayer3DRenderer > QgsAnnotationLayer3DRendererWidget::renderer()
|
|
||||||
{
|
|
||||||
const RendererType type = mComboRendererType->currentData().value< RendererType >();
|
|
||||||
switch ( type )
|
|
||||||
{
|
|
||||||
case RendererType::None:
|
|
||||||
return nullptr;
|
|
||||||
break;
|
|
||||||
case RendererType::Billboards:
|
|
||||||
{
|
|
||||||
auto renderer = std::make_unique< QgsAnnotationLayer3DRenderer >();
|
|
||||||
renderer->setAltitudeClamping( mComboClamping->currentData().value< Qgis::AltitudeClamping >() );
|
|
||||||
renderer->setZOffset( mOffsetZSpinBox->value() );
|
|
||||||
renderer->setShowCalloutLines( mCheckShowCallouts->isChecked() );
|
|
||||||
return renderer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BUILTIN_UNREACHABLE
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsAnnotationLayer3DRendererWidget::apply()
|
|
||||||
{
|
|
||||||
std::unique_ptr< QgsAnnotationLayer3DRenderer > r = renderer();
|
|
||||||
mLayer->setRenderer3D( r.release() );
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsAnnotationLayer3DRendererWidget::rendererTypeChanged()
|
|
||||||
{
|
|
||||||
const RendererType type = mComboRendererType->currentData().value< RendererType >();
|
|
||||||
switch ( type )
|
|
||||||
{
|
|
||||||
case RendererType::None:
|
|
||||||
mStackedWidget->setCurrentWidget( mPageNoRenderer );
|
|
||||||
break;
|
|
||||||
case RendererType::Billboards:
|
|
||||||
mStackedWidget->setCurrentWidget( mPageBillboards );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ( !mBlockChanges )
|
|
||||||
emit widgetChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsAnnotationLayer3DRendererWidget::clampingChanged()
|
|
||||||
{
|
|
||||||
switch ( mComboClamping->currentData().value< Qgis::AltitudeClamping >() )
|
|
||||||
{
|
|
||||||
case Qgis::AltitudeClamping::Absolute:
|
|
||||||
mLabelClampingExplanation->setText(
|
|
||||||
QStringLiteral( "<p><b>%1</b></p><p>%2</p>" ).arg( tr( "All billboards will be placed at the same elevation." ), tr( "The terrain height will be ignored." ) )
|
|
||||||
);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case Qgis::AltitudeClamping::Relative:
|
|
||||||
mLabelClampingExplanation->setText(
|
|
||||||
QStringLiteral( "<p><b>%1</b></p>" ).arg( tr( "Billboard elevation is relative to terrain height." ) )
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case Qgis::AltitudeClamping::Terrain:
|
|
||||||
mLabelClampingExplanation->setText(
|
|
||||||
QStringLiteral( "<p><b>%1</b></p><p>%2</p>" ).arg( tr( "Billboard elevation will be taken directly from the terrain height." ), tr( "Billboards will be placed directly on the terrain." ) )
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ( !mBlockChanges )
|
|
||||||
emit widgetChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsAnnotationLayer3DRendererWidget::syncToLayer( QgsMapLayer *layer )
|
|
||||||
{
|
|
||||||
mLayer = layer;
|
|
||||||
QgsAbstract3DRenderer *r = layer->renderer3D();
|
|
||||||
if ( r && r->type() == QLatin1String( "annotation" ) )
|
|
||||||
{
|
|
||||||
QgsAnnotationLayer3DRenderer *annotationRenderer = qgis::down_cast<QgsAnnotationLayer3DRenderer *>( r );
|
|
||||||
setRenderer( annotationRenderer );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setRenderer( nullptr );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// QgsAnnotationLayer3DRendererWidgetFactory
|
|
||||||
//
|
|
||||||
|
|
||||||
QgsAnnotationLayer3DRendererWidgetFactory::QgsAnnotationLayer3DRendererWidgetFactory( QObject *parent )
|
|
||||||
: QObject( parent )
|
|
||||||
{
|
|
||||||
setIcon( QIcon( ":/images/themes/default/3d.svg" ) );
|
|
||||||
setTitle( tr( "3D View" ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsMapLayerConfigWidget *QgsAnnotationLayer3DRendererWidgetFactory::createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockWidget, QWidget *parent ) const
|
|
||||||
{
|
|
||||||
Q_UNUSED( dockWidget )
|
|
||||||
QgsAnnotationLayer *annotationLayer = qobject_cast<QgsAnnotationLayer *>( layer );
|
|
||||||
if ( !annotationLayer )
|
|
||||||
return nullptr;
|
|
||||||
return new QgsAnnotationLayer3DRendererWidget( annotationLayer, canvas, parent );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QgsAnnotationLayer3DRendererWidgetFactory::supportLayerPropertiesDialog() const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QgsAnnotationLayer3DRendererWidgetFactory::supportsStyleDock() const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QgsAnnotationLayer3DRendererWidgetFactory::supportsLayer( QgsMapLayer *layer ) const
|
|
||||||
{
|
|
||||||
return layer->type() == Qgis::LayerType::Annotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QgsAnnotationLayer3DRendererWidgetFactory::layerPropertiesPagePositionHint() const
|
|
||||||
{
|
|
||||||
return QStringLiteral( "mOptsPage_Rendering" );
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
qgsannotationlayer3drendererwidget.h
|
|
||||||
------------------------------
|
|
||||||
Date : September 2025
|
|
||||||
Copyright : (C) 2025 by Nyall Dawson
|
|
||||||
Email : nyall dot dawson at gmail dot com
|
|
||||||
***************************************************************************
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef QGSANNOTATIONLAYER3DRENDERERWIDGET_H
|
|
||||||
#define QGSANNOTATIONLAYER3DRENDERERWIDGET_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "qgsmaplayerconfigwidget.h"
|
|
||||||
#include "qgsmaplayerconfigwidgetfactory.h"
|
|
||||||
#include "ui_qgsannotationlayer3drendererwidget.h"
|
|
||||||
|
|
||||||
class QgsAnnotationLayer;
|
|
||||||
class QgsAnnotationLayer3DRenderer;
|
|
||||||
class QgsMapCanvas;
|
|
||||||
|
|
||||||
|
|
||||||
//! Widget for configuration of 3D renderer of an annotation layer
|
|
||||||
class QgsAnnotationLayer3DRendererWidget : public QgsMapLayerConfigWidget, private Ui::QgsAnnotationLayer3dRendererWidgetBase
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
enum class RendererType
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
Billboards,
|
|
||||||
};
|
|
||||||
Q_ENUM( RendererType )
|
|
||||||
|
|
||||||
explicit QgsAnnotationLayer3DRendererWidget( QgsAnnotationLayer *layer, QgsMapCanvas *canvas, QWidget *parent = nullptr );
|
|
||||||
|
|
||||||
void syncToLayer( QgsMapLayer *layer ) final;
|
|
||||||
|
|
||||||
//! no transfer of ownership
|
|
||||||
void setRenderer( const QgsAnnotationLayer3DRenderer *renderer );
|
|
||||||
std::unique_ptr< QgsAnnotationLayer3DRenderer > renderer();
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void apply() override;
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void rendererTypeChanged();
|
|
||||||
void clampingChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
int mBlockChanges = 0;
|
|
||||||
std::unique_ptr<QgsAnnotationLayer3DRenderer> mRenderer;
|
|
||||||
};
|
|
||||||
|
|
||||||
class QgsAnnotationLayer3DRendererWidgetFactory : public QObject, public QgsMapLayerConfigWidgetFactory
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit QgsAnnotationLayer3DRendererWidgetFactory( QObject *parent = nullptr );
|
|
||||||
|
|
||||||
QgsMapLayerConfigWidget *createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockWidget, QWidget *parent ) const override;
|
|
||||||
bool supportLayerPropertiesDialog() const override;
|
|
||||||
bool supportsStyleDock() const override;
|
|
||||||
bool supportsLayer( QgsMapLayer *layer ) const override;
|
|
||||||
QString layerPropertiesPagePositionHint() const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QGSANNOTATIONLAYER3DRENDERERWIDGET_H
|
|
@ -353,7 +353,6 @@ if (WITH_3D)
|
|||||||
3d/qgs3dmodelsourcelineedit.cpp
|
3d/qgs3dmodelsourcelineedit.cpp
|
||||||
3d/qgs3dnavigationwidget.cpp
|
3d/qgs3dnavigationwidget.cpp
|
||||||
3d/qgs3doptions.cpp
|
3d/qgs3doptions.cpp
|
||||||
3d/qgsannotationlayer3drendererwidget.cpp
|
|
||||||
3d/qgsgoochmaterialwidget.cpp
|
3d/qgsgoochmaterialwidget.cpp
|
||||||
3d/qgslightswidget.cpp
|
3d/qgslightswidget.cpp
|
||||||
3d/qgsline3dsymbolwidget.cpp
|
3d/qgsline3dsymbolwidget.cpp
|
||||||
|
@ -327,14 +327,11 @@ void QgsAppLayerHandling::postProcessAddedLayers( const QList<QgsMapLayer *> &la
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Qgis::LayerType::Annotation:
|
|
||||||
postProcessAddedLayer( layer );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Qgis::LayerType::Raster:
|
case Qgis::LayerType::Raster:
|
||||||
case Qgis::LayerType::Plugin:
|
case Qgis::LayerType::Plugin:
|
||||||
case Qgis::LayerType::Mesh:
|
case Qgis::LayerType::Mesh:
|
||||||
case Qgis::LayerType::VectorTile:
|
case Qgis::LayerType::VectorTile:
|
||||||
|
case Qgis::LayerType::Annotation:
|
||||||
case Qgis::LayerType::PointCloud:
|
case Qgis::LayerType::PointCloud:
|
||||||
case Qgis::LayerType::Group:
|
case Qgis::LayerType::Group:
|
||||||
case Qgis::LayerType::TiledScene:
|
case Qgis::LayerType::TiledScene:
|
||||||
|
@ -156,7 +156,6 @@
|
|||||||
#include "qgsmeshlayer3drendererwidget.h"
|
#include "qgsmeshlayer3drendererwidget.h"
|
||||||
#include "qgspointcloudlayer3drendererwidget.h"
|
#include "qgspointcloudlayer3drendererwidget.h"
|
||||||
#include "qgstiledscenelayer3drendererwidget.h"
|
#include "qgstiledscenelayer3drendererwidget.h"
|
||||||
#include "qgsannotationlayer3drendererwidget.h"
|
|
||||||
#include "qgs3dapputils.h"
|
#include "qgs3dapputils.h"
|
||||||
#include "qgs3doptions.h"
|
#include "qgs3doptions.h"
|
||||||
#include "qgsmapviewsmanager.h"
|
#include "qgsmapviewsmanager.h"
|
||||||
@ -1330,6 +1329,12 @@ QgisApp::QgisApp( QSplashScreen *splash, AppOptions options, const QString &root
|
|||||||
registerMapLayerPropertiesFactory( new QgsVectorLayerDigitizingPropertiesFactory( this ) );
|
registerMapLayerPropertiesFactory( new QgsVectorLayerDigitizingPropertiesFactory( this ) );
|
||||||
registerMapLayerPropertiesFactory( new QgsPointCloudRendererWidgetFactory( this ) );
|
registerMapLayerPropertiesFactory( new QgsPointCloudRendererWidgetFactory( this ) );
|
||||||
registerMapLayerPropertiesFactory( new QgsTiledSceneRendererWidgetFactory( this ) );
|
registerMapLayerPropertiesFactory( new QgsTiledSceneRendererWidgetFactory( this ) );
|
||||||
|
#ifdef HAVE_3D
|
||||||
|
registerMapLayerPropertiesFactory( new QgsVectorLayer3DRendererWidgetFactory( this ) );
|
||||||
|
registerMapLayerPropertiesFactory( new QgsMeshLayer3DRendererWidgetFactory( this ) );
|
||||||
|
registerMapLayerPropertiesFactory( new QgsPointCloudLayer3DRendererWidgetFactory( this ) );
|
||||||
|
registerMapLayerPropertiesFactory( new QgsTiledSceneLayer3DRendererWidgetFactory( this ) );
|
||||||
|
#endif
|
||||||
registerMapLayerPropertiesFactory( new QgsPointCloudElevationPropertiesWidgetFactory( this ) );
|
registerMapLayerPropertiesFactory( new QgsPointCloudElevationPropertiesWidgetFactory( this ) );
|
||||||
registerMapLayerPropertiesFactory( new QgsRasterElevationPropertiesWidgetFactory( this ) );
|
registerMapLayerPropertiesFactory( new QgsRasterElevationPropertiesWidgetFactory( this ) );
|
||||||
registerMapLayerPropertiesFactory( new QgsVectorElevationPropertiesWidgetFactory( this ) );
|
registerMapLayerPropertiesFactory( new QgsVectorElevationPropertiesWidgetFactory( this ) );
|
||||||
@ -1337,13 +1342,6 @@ QgisApp::QgisApp( QSplashScreen *splash, AppOptions options, const QString &root
|
|||||||
registerMapLayerPropertiesFactory( new QgsMeshElevationPropertiesWidgetFactory( this ) );
|
registerMapLayerPropertiesFactory( new QgsMeshElevationPropertiesWidgetFactory( this ) );
|
||||||
registerMapLayerPropertiesFactory( new QgsAnnotationItemPropertiesWidgetFactory( this ) );
|
registerMapLayerPropertiesFactory( new QgsAnnotationItemPropertiesWidgetFactory( this ) );
|
||||||
registerMapLayerPropertiesFactory( new QgsLayerTreeGroupPropertiesWidgetFactory( this ) );
|
registerMapLayerPropertiesFactory( new QgsLayerTreeGroupPropertiesWidgetFactory( this ) );
|
||||||
#ifdef HAVE_3D
|
|
||||||
registerMapLayerPropertiesFactory( new QgsVectorLayer3DRendererWidgetFactory( this ) );
|
|
||||||
registerMapLayerPropertiesFactory( new QgsMeshLayer3DRendererWidgetFactory( this ) );
|
|
||||||
registerMapLayerPropertiesFactory( new QgsPointCloudLayer3DRendererWidgetFactory( this ) );
|
|
||||||
registerMapLayerPropertiesFactory( new QgsTiledSceneLayer3DRendererWidgetFactory( this ) );
|
|
||||||
registerMapLayerPropertiesFactory( new QgsAnnotationLayer3DRendererWidgetFactory( this ) );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mMapStyleWidget = new QgsLayerStylingWidget( mMapCanvas, mInfoBar, mMapLayerPanelFactories );
|
mMapStyleWidget = new QgsLayerStylingWidget( mMapCanvas, mInfoBar, mMapLayerPanelFactories );
|
||||||
mMapStylingDock->setWidget( mMapStyleWidget );
|
mMapStylingDock->setWidget( mMapStyleWidget );
|
||||||
@ -3249,7 +3247,7 @@ void QgisApp::showStyleManager()
|
|||||||
void QgisApp::initPythonConsoleOptions()
|
void QgisApp::initPythonConsoleOptions()
|
||||||
{
|
{
|
||||||
QgsPythonRunner::run( QStringLiteral( "import console" ) );
|
QgsPythonRunner::run( QStringLiteral( "import console" ) );
|
||||||
QgsPythonRunner::run( QStringLiteral( "console.init_console()" ) );
|
QgsPythonRunner::run( QStringLiteral( "console.init_options_widget()" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgisApp::showPythonDialog()
|
void QgisApp::showPythonDialog()
|
||||||
@ -7955,7 +7953,6 @@ void QgisApp::createAnnotationLayer()
|
|||||||
// layer should be created at top of layer tree
|
// layer should be created at top of layer tree
|
||||||
QgsProject::instance()->addMapLayer( layer, false );
|
QgsProject::instance()->addMapLayer( layer, false );
|
||||||
QgsProject::instance()->layerTreeRoot()->insertLayer( 0, layer );
|
QgsProject::instance()->layerTreeRoot()->insertLayer( 0, layer );
|
||||||
QgsAppLayerHandling::postProcessAddedLayers( { layer } );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgisApp::setCadDockVisible( bool visible )
|
void QgisApp::setCadDockVisible( bool visible )
|
||||||
|
@ -157,7 +157,7 @@ void QgsAuthPlanetaryComputerEdit::updateServerType( int indx )
|
|||||||
lblTenantId->setVisible( isPro );
|
lblTenantId->setVisible( isPro );
|
||||||
leTenantId->setVisible( isPro );
|
leTenantId->setVisible( isPro );
|
||||||
|
|
||||||
const QString openHelp = tr( "Use this server type for %1 - the data are publicly accessible and do not require an account." ).arg( QLatin1String( "<a href=\"https://planetarycomputer.microsoft.com/\">https://planetarycomputer.microsoft.com/</a>" ) );
|
const QString openHelp = tr( "Use this server type for %1 - the data are publicly accessible and do not require an account." ).arg( QStringLiteral( "<a href=\"https://planetarycomputer.microsoft.com/\">https://planetarycomputer.microsoft.com/</a>" ) );
|
||||||
const QString proHelp = tr(
|
const QString proHelp = tr(
|
||||||
"Use this server type for <a href=\"https://learn.microsoft.com/en-us/azure/planetary-computer/get-started-planetary-computer\">Planetary Computer Pro</a> instances.<br/>"
|
"Use this server type for <a href=\"https://learn.microsoft.com/en-us/azure/planetary-computer/get-started-planetary-computer\">Planetary Computer Pro</a> instances.<br/>"
|
||||||
"The Directory (tenant) and Application (client) IDs can be found in your organization's Microsoft Entra ID main and application page respectively.<br/>"
|
"The Directory (tenant) and Application (client) IDs can be found in your organization's Microsoft Entra ID main and application page respectively.<br/>"
|
||||||
|
@ -241,7 +241,6 @@ class CORE_EXPORT QgsAnnotationLayer : public QgsMapLayer
|
|||||||
QgsMapLayerRef mLinkedLayer;
|
QgsMapLayerRef mLinkedLayer;
|
||||||
|
|
||||||
friend class QgsAnnotationLayerRenderer;
|
friend class QgsAnnotationLayerRenderer;
|
||||||
friend class QgsAnnotationLayerChunkLoader;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4627,7 +4627,7 @@ QgsGeometry QgsGeometry::doChamferFillet( ChamferFilletOperationType op, int ver
|
|||||||
// insert \a result geometry (obtain by the chamfer/fillet operation) back into original \a inputPoly polygon
|
// insert \a result geometry (obtain by the chamfer/fillet operation) back into original \a inputPoly polygon
|
||||||
auto updatePolygon = []( const QgsPolygon * inputPoly, QgsAbstractGeometry * result, int modifiedRing ) -> std::unique_ptr<QgsPolygon>
|
auto updatePolygon = []( const QgsPolygon * inputPoly, QgsAbstractGeometry * result, int modifiedRing ) -> std::unique_ptr<QgsPolygon>
|
||||||
{
|
{
|
||||||
auto newPoly = std::make_unique<QgsPolygon>();
|
std::unique_ptr<QgsPolygon> newPoly = std::make_unique<QgsPolygon>();
|
||||||
for ( int ringIndex = 0; ringIndex < inputPoly->numInteriorRings() + 1; ++ringIndex )
|
for ( int ringIndex = 0; ringIndex < inputPoly->numInteriorRings() + 1; ++ringIndex )
|
||||||
{
|
{
|
||||||
if ( ringIndex == modifiedRing )
|
if ( ringIndex == modifiedRing )
|
||||||
@ -4656,7 +4656,7 @@ QgsGeometry QgsGeometry::doChamferFillet( ChamferFilletOperationType op, int ver
|
|||||||
{
|
{
|
||||||
if ( modifiedPart >= 0 )
|
if ( modifiedPart >= 0 )
|
||||||
{
|
{
|
||||||
auto newMultiLine = std::make_unique<QgsMultiLineString>();
|
std::unique_ptr<QgsMultiLineString> newMultiLine = std::make_unique<QgsMultiLineString>();
|
||||||
int partIndex = 0;
|
int partIndex = 0;
|
||||||
for ( QgsMultiLineString::part_iterator partIte = inputMultiLine->parts_begin(); partIte != inputMultiLine->parts_end(); ++partIte )
|
for ( QgsMultiLineString::part_iterator partIte = inputMultiLine->parts_begin(); partIte != inputMultiLine->parts_end(); ++partIte )
|
||||||
{
|
{
|
||||||
@ -4686,7 +4686,7 @@ QgsGeometry QgsGeometry::doChamferFillet( ChamferFilletOperationType op, int ver
|
|||||||
// geomType == Qgis::GeometryType::Polygon
|
// geomType == Qgis::GeometryType::Polygon
|
||||||
if ( modifiedPart >= 0 )
|
if ( modifiedPart >= 0 )
|
||||||
{
|
{
|
||||||
auto newMultiPoly = std::make_unique<QgsMultiPolygon>();
|
std::unique_ptr<QgsMultiPolygon> newMultiPoly = std::make_unique<QgsMultiPolygon>();
|
||||||
int partIndex = 0;
|
int partIndex = 0;
|
||||||
for ( QgsAbstractGeometry::part_iterator partIte = inputMultiPoly->parts_begin(); partIte != inputMultiPoly->parts_end(); ++partIte )
|
for ( QgsAbstractGeometry::part_iterator partIte = inputMultiPoly->parts_begin(); partIte != inputMultiPoly->parts_end(); ++partIte )
|
||||||
{
|
{
|
||||||
|
@ -972,7 +972,7 @@ bool QgsLayoutItemElevationProfile::readPropertiesFromElement( const QDomElement
|
|||||||
QDomElement sourceElement = sourcesElement.firstChildElement();
|
QDomElement sourceElement = sourcesElement.firstChildElement();
|
||||||
while ( !sourceElement.isNull() )
|
while ( !sourceElement.isNull() )
|
||||||
{
|
{
|
||||||
if ( sourceElement.tagName() == QLatin1String( "profileCustomSource" ) )
|
if ( sourceElement.tagName() == QStringLiteral( "profileCustomSource" ) )
|
||||||
{
|
{
|
||||||
const QString sourceId = sourceElement.attribute( QStringLiteral( "id" ) );
|
const QString sourceId = sourceElement.attribute( QStringLiteral( "id" ) );
|
||||||
if ( QgsAbstractProfileSource *profileSource = QgsApplication::profileSourceRegistry()->findSourceById( sourceId ) )
|
if ( QgsAbstractProfileSource *profileSource = QgsApplication::profileSourceRegistry()->findSourceById( sourceId ) )
|
||||||
@ -980,7 +980,7 @@ bool QgsLayoutItemElevationProfile::readPropertiesFromElement( const QDomElement
|
|||||||
mSources.append( profileSource );
|
mSources.append( profileSource );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( sourceElement.tagName() == QLatin1String( "profileLayerSource" ) )
|
else if ( sourceElement.tagName() == QStringLiteral( "profileLayerSource" ) )
|
||||||
{
|
{
|
||||||
QgsMapLayerRef ref;
|
QgsMapLayerRef ref;
|
||||||
ref.readXml( sourceElement, context );
|
ref.readXml( sourceElement, context );
|
||||||
|
@ -403,7 +403,7 @@ inline std::unique_ptr<Chain> Problem::chain( int seed )
|
|||||||
{
|
{
|
||||||
|
|
||||||
// A lot of conflict : make them inactive and store chain
|
// A lot of conflict : make them inactive and store chain
|
||||||
auto newChain = std::make_unique< Chain >();
|
std::unique_ptr< Chain > newChain = std::make_unique< Chain >();
|
||||||
newChain->degree = currentChain.size() + 1 + conflicts.size();
|
newChain->degree = currentChain.size() + 1 + conflicts.size();
|
||||||
newChain->feat.resize( newChain->degree );
|
newChain->feat.resize( newChain->degree );
|
||||||
newChain->label.resize( newChain->degree );
|
newChain->label.resize( newChain->degree );
|
||||||
|
@ -44,7 +44,7 @@ bool QgsVectorLayerXyPlotDataGatherer::run()
|
|||||||
gatheredSeries.reserve( mSeriesDetails.size() );
|
gatheredSeries.reserve( mSeriesDetails.size() );
|
||||||
for ( int i = 0; i < mSeriesDetails.size(); i++ )
|
for ( int i = 0; i < mSeriesDetails.size(); i++ )
|
||||||
{
|
{
|
||||||
auto series = std::make_unique<QgsXyPlotSeries>();
|
std::unique_ptr<QgsXyPlotSeries> series = std::make_unique<QgsXyPlotSeries>();
|
||||||
gatheredSeries.emplace_back( std::move( series ) );
|
gatheredSeries.emplace_back( std::move( series ) );
|
||||||
gatheredSeriesCategoriesSum << QMap<QString, double>();
|
gatheredSeriesCategoriesSum << QMap<QString, double>();
|
||||||
}
|
}
|
||||||
|
@ -663,11 +663,11 @@ void QgsProject::registerTranslatableObjects( QgsTranslationContext *translation
|
|||||||
|
|
||||||
translationContext->registerTranslation( QStringLiteral( "project:layers:%1:fieldaliases" ).arg( vlayer->id() ), fieldName );
|
translationContext->registerTranslation( QStringLiteral( "project:layers:%1:fieldaliases" ).arg( vlayer->id() ), fieldName );
|
||||||
|
|
||||||
if ( field.editorWidgetSetup().type() == QLatin1String( "ValueRelation" ) )
|
if ( field.editorWidgetSetup().type() == QStringLiteral( "ValueRelation" ) )
|
||||||
{
|
{
|
||||||
translationContext->registerTranslation( QStringLiteral( "project:layers:%1:fields:%2:valuerelationvalue" ).arg( vlayer->id(), field.name() ), field.editorWidgetSetup().config().value( QStringLiteral( "Value" ) ).toString() );
|
translationContext->registerTranslation( QStringLiteral( "project:layers:%1:fields:%2:valuerelationvalue" ).arg( vlayer->id(), field.name() ), field.editorWidgetSetup().config().value( QStringLiteral( "Value" ) ).toString() );
|
||||||
}
|
}
|
||||||
if ( field.editorWidgetSetup().type() == QLatin1String( "ValueMap" ) )
|
if ( field.editorWidgetSetup().type() == QStringLiteral( "ValueMap" ) )
|
||||||
{
|
{
|
||||||
if ( field.editorWidgetSetup().config().value( QStringLiteral( "map" ) ).canConvert<QList<QVariant>>() )
|
if ( field.editorWidgetSetup().config().value( QStringLiteral( "map" ) ).canConvert<QList<QVariant>>() )
|
||||||
{
|
{
|
||||||
@ -4003,11 +4003,11 @@ bool QgsProject::createEmbeddedLayer( const QString &layerId, const QString &pro
|
|||||||
if ( e.isNull() )
|
if ( e.isNull() )
|
||||||
{
|
{
|
||||||
e = propertiesElem.firstChildElement( QStringLiteral( "properties" ) );
|
e = propertiesElem.firstChildElement( QStringLiteral( "properties" ) );
|
||||||
while ( !e.isNull() && e.attribute( QStringLiteral( "name" ) ) != QLatin1String( "Paths" ) )
|
while ( !e.isNull() && e.attribute( QStringLiteral( "name" ) ) != QStringLiteral( "Paths" ) )
|
||||||
e = e.nextSiblingElement( QStringLiteral( "properties" ) );
|
e = e.nextSiblingElement( QStringLiteral( "properties" ) );
|
||||||
|
|
||||||
e = e.firstChildElement( QStringLiteral( "properties" ) );
|
e = e.firstChildElement( QStringLiteral( "properties" ) );
|
||||||
while ( !e.isNull() && e.attribute( QStringLiteral( "name" ) ) != QLatin1String( "Absolute" ) )
|
while ( !e.isNull() && e.attribute( QStringLiteral( "name" ) ) != QStringLiteral( "Absolute" ) )
|
||||||
e = e.nextSiblingElement( QStringLiteral( "properties" ) );
|
e = e.nextSiblingElement( QStringLiteral( "properties" ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -365,7 +365,7 @@ bool QgsProjectPropertyKey::readXml( const QDomNode &keyNode )
|
|||||||
const QDomNode subkey = subkeys.item( i );
|
const QDomNode subkey = subkeys.item( i );
|
||||||
QString name;
|
QString name;
|
||||||
|
|
||||||
if ( subkey.nodeName() == QLatin1String( "properties" ) &&
|
if ( subkey.nodeName() == QStringLiteral( "properties" ) &&
|
||||||
subkey.hasAttributes() && // if we have attributes
|
subkey.hasAttributes() && // if we have attributes
|
||||||
subkey.isElement() && // and we're an element
|
subkey.isElement() && // and we're an element
|
||||||
subkey.toElement().hasAttribute( QStringLiteral( "name" ) ) ) // and we have a "name" attribute
|
subkey.toElement().hasAttribute( QStringLiteral( "name" ) ) ) // and we have a "name" attribute
|
||||||
|
@ -129,7 +129,7 @@ QString QgsCommandLineUtils::allVersions( )
|
|||||||
versionString += QStringLiteral( "SFCGAL version %1\n" ).arg( sfcgalVersionCompiled );
|
versionString += QStringLiteral( "SFCGAL version %1\n" ).arg( sfcgalVersionCompiled );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
versionString += QLatin1String( "No support for SFCGAL\n" );
|
versionString += QStringLiteral( "No support for SFCGAL\n" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// SQLite version
|
// SQLite version
|
||||||
|
@ -572,7 +572,7 @@ QVariant QgsOgrUtils::getOgrFeatureAttribute( OGRFeatureH ogrFet, const QgsField
|
|||||||
{
|
{
|
||||||
case QMetaType::Type::QString:
|
case QMetaType::Type::QString:
|
||||||
{
|
{
|
||||||
if ( field.typeName() != QLatin1String( "JSON" ) || ! getJsonValue() )
|
if ( field.typeName() != QStringLiteral( "JSON" ) || ! getJsonValue() )
|
||||||
{
|
{
|
||||||
if ( encoding )
|
if ( encoding )
|
||||||
value = QVariant( encoding->toUnicode( OGR_F_GetFieldAsString( ogrFet, attIndex ) ) );
|
value = QVariant( encoding->toUnicode( OGR_F_GetFieldAsString( ogrFet, attIndex ) ) );
|
||||||
@ -641,7 +641,7 @@ QVariant QgsOgrUtils::getOgrFeatureAttribute( OGRFeatureH ogrFet, const QgsField
|
|||||||
|
|
||||||
case QMetaType::Type::QStringList:
|
case QMetaType::Type::QStringList:
|
||||||
{
|
{
|
||||||
if ( field.typeName() != QLatin1String( "JSON" ) || ! getJsonValue() )
|
if ( field.typeName() != QStringLiteral( "JSON" ) || ! getJsonValue() )
|
||||||
{
|
{
|
||||||
QStringList list;
|
QStringList list;
|
||||||
char **lst = OGR_F_GetFieldAsStringList( ogrFet, attIndex );
|
char **lst = OGR_F_GetFieldAsStringList( ogrFet, attIndex );
|
||||||
@ -668,7 +668,7 @@ QVariant QgsOgrUtils::getOgrFeatureAttribute( OGRFeatureH ogrFet, const QgsField
|
|||||||
{
|
{
|
||||||
case QMetaType::Type::QString:
|
case QMetaType::Type::QString:
|
||||||
{
|
{
|
||||||
if ( field.typeName() != QLatin1String( "JSON" ) || ! getJsonValue() )
|
if ( field.typeName() != QStringLiteral( "JSON" ) || ! getJsonValue() )
|
||||||
{
|
{
|
||||||
QStringList list;
|
QStringList list;
|
||||||
char **lst = OGR_F_GetFieldAsStringList( ogrFet, attIndex );
|
char **lst = OGR_F_GetFieldAsStringList( ogrFet, attIndex );
|
||||||
@ -691,7 +691,7 @@ QVariant QgsOgrUtils::getOgrFeatureAttribute( OGRFeatureH ogrFet, const QgsField
|
|||||||
|
|
||||||
case QMetaType::Type::Int:
|
case QMetaType::Type::Int:
|
||||||
{
|
{
|
||||||
if ( field.typeName() != QLatin1String( "JSON" ) || ! getJsonValue() )
|
if ( field.typeName() != QStringLiteral( "JSON" ) || ! getJsonValue() )
|
||||||
{
|
{
|
||||||
QVariantList list;
|
QVariantList list;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -711,7 +711,7 @@ QVariant QgsOgrUtils::getOgrFeatureAttribute( OGRFeatureH ogrFet, const QgsField
|
|||||||
|
|
||||||
case QMetaType::Type::Double:
|
case QMetaType::Type::Double:
|
||||||
{
|
{
|
||||||
if ( field.typeName() != QLatin1String( "JSON" ) || ! getJsonValue() )
|
if ( field.typeName() != QStringLiteral( "JSON" ) || ! getJsonValue() )
|
||||||
{
|
{
|
||||||
QVariantList list;
|
QVariantList list;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -731,7 +731,7 @@ QVariant QgsOgrUtils::getOgrFeatureAttribute( OGRFeatureH ogrFet, const QgsField
|
|||||||
|
|
||||||
case QMetaType::Type::LongLong:
|
case QMetaType::Type::LongLong:
|
||||||
{
|
{
|
||||||
if ( field.typeName() != QLatin1String( "JSON" ) || ! getJsonValue() )
|
if ( field.typeName() != QStringLiteral( "JSON" ) || ! getJsonValue() )
|
||||||
{
|
{
|
||||||
QVariantList list;
|
QVariantList list;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -3563,7 +3563,7 @@ bool QgsRasterMarkerSymbolLayer::writeSldMarker( QDomDocument &doc, QDomElement
|
|||||||
QMimeType mimeType;
|
QMimeType mimeType;
|
||||||
|
|
||||||
QString base64data;
|
QString base64data;
|
||||||
if ( mPath.startsWith( QLatin1String( "base64:" ) ) )
|
if ( mPath.startsWith( QStringLiteral( "base64:" ) ) )
|
||||||
{
|
{
|
||||||
base64data = mPath.mid( 7 );
|
base64data = mPath.mid( 7 );
|
||||||
}
|
}
|
||||||
@ -3601,7 +3601,7 @@ bool QgsRasterMarkerSymbolLayer::writeSldMarker( QDomDocument &doc, QDomElement
|
|||||||
extGraphElem.appendChild( onlineResElem );
|
extGraphElem.appendChild( onlineResElem );
|
||||||
|
|
||||||
// determine mime type
|
// determine mime type
|
||||||
if ( mPath.startsWith( QLatin1String( "http://" ) ) || mPath.startsWith( QLatin1String( "https://" ) ) )
|
if ( mPath.startsWith( QStringLiteral( "http://" ) ) || mPath.startsWith( QStringLiteral( "https://" ) ) )
|
||||||
{
|
{
|
||||||
// Qt can't guess mime type for remote URLs, and it seems geoserver can handle wrong image mime types
|
// Qt can't guess mime type for remote URLs, and it seems geoserver can handle wrong image mime types
|
||||||
// but not generic ones, so let's hardcode to png.
|
// but not generic ones, so let's hardcode to png.
|
||||||
|
@ -2708,11 +2708,11 @@ bool QgsVectorLayer::readSymbology( const QDomNode &layerNode, QString &errorMes
|
|||||||
const QDomElement optionsElem = cfgElem.childNodes().at( 0 ).toElement();
|
const QDomElement optionsElem = cfgElem.childNodes().at( 0 ).toElement();
|
||||||
QVariantMap optionsMap = QgsXmlUtils::readVariant( optionsElem ).toMap();
|
QVariantMap optionsMap = QgsXmlUtils::readVariant( optionsElem ).toMap();
|
||||||
// translate widget configuration strings
|
// translate widget configuration strings
|
||||||
if ( widgetType == QLatin1String( "ValueRelation" ) )
|
if ( widgetType == QStringLiteral( "ValueRelation" ) )
|
||||||
{
|
{
|
||||||
optionsMap[ QStringLiteral( "Value" ) ] = context.projectTranslator()->translate( QStringLiteral( "project:layers:%1:fields:%2:valuerelationvalue" ).arg( layerNode.namedItem( QStringLiteral( "id" ) ).toElement().text(), fieldName ), optionsMap[ QStringLiteral( "Value" ) ].toString() );
|
optionsMap[ QStringLiteral( "Value" ) ] = context.projectTranslator()->translate( QStringLiteral( "project:layers:%1:fields:%2:valuerelationvalue" ).arg( layerNode.namedItem( QStringLiteral( "id" ) ).toElement().text(), fieldName ), optionsMap[ QStringLiteral( "Value" ) ].toString() );
|
||||||
}
|
}
|
||||||
if ( widgetType == QLatin1String( "ValueMap" ) )
|
if ( widgetType == QStringLiteral( "ValueMap" ) )
|
||||||
{
|
{
|
||||||
if ( optionsMap[ QStringLiteral( "map" ) ].canConvert<QList<QVariant>>() )
|
if ( optionsMap[ QStringLiteral( "map" ) ].canConvert<QList<QVariant>>() )
|
||||||
{
|
{
|
||||||
|
@ -344,7 +344,7 @@ void QgsVectorTileUtils::loadSprites( const QVariantMap &styleDefinition, QgsMap
|
|||||||
{
|
{
|
||||||
return sprite;
|
return sprite;
|
||||||
}
|
}
|
||||||
else if ( sprite.startsWith( QLatin1Char( '/' ) ) )
|
else if ( sprite.startsWith( QLatin1String( "/" ) ) )
|
||||||
{
|
{
|
||||||
const QUrl url( styleUrl );
|
const QUrl url( styleUrl );
|
||||||
return QStringLiteral( "%1://%2%3" ).arg( url.scheme(), url.host(), sprite );
|
return QStringLiteral( "%1://%2%3" ).arg( url.scheme(), url.host(), sprite );
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "qgsstringutils.h"
|
#include "qgsstringutils.h"
|
||||||
#include "qgsfontutils.h"
|
#include "qgsfontutils.h"
|
||||||
#include "qgssettingsentryimpl.h"
|
#include "qgssettingsentryimpl.h"
|
||||||
#include "qgsshortcutsmanager.h"
|
|
||||||
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
@ -253,30 +252,25 @@ void QgsCodeEditor::keyPressEvent( QKeyEvent *event )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for reformat code sequence
|
const bool ctrlModifier = event->modifiers() & Qt::ControlModifier;
|
||||||
|
const bool altModifier = event->modifiers() & Qt::AltModifier;
|
||||||
|
|
||||||
|
// Ctrl+Alt+F: reformat code
|
||||||
const bool canReformat = languageCapabilities() & Qgis::ScriptLanguageCapability::Reformat;
|
const bool canReformat = languageCapabilities() & Qgis::ScriptLanguageCapability::Reformat;
|
||||||
if ( !isReadOnly() && canReformat )
|
if ( !isReadOnly() && canReformat && ctrlModifier && altModifier && event->key() == Qt::Key_F )
|
||||||
{
|
{
|
||||||
const QKeySequence reformatCodeSequence = QgsGui::shortcutsManager()->sequenceForCommonAction( QgsShortcutsManager::CommonAction::CodeReformat );
|
event->accept();
|
||||||
if ( !reformatCodeSequence.isEmpty() && reformatCodeSequence.matches( event->key() | event->modifiers() ) )
|
reformatCode();
|
||||||
{
|
return;
|
||||||
event->accept();
|
|
||||||
reformatCode();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for toggle comment sequence
|
// Toggle comment when user presses Ctrl+:
|
||||||
const bool canToggle = languageCapabilities() & Qgis::ScriptLanguageCapability::ToggleComment;
|
const bool canToggle = languageCapabilities() & Qgis::ScriptLanguageCapability::ToggleComment;
|
||||||
if ( !isReadOnly() && canToggle )
|
if ( !isReadOnly() && canToggle && ctrlModifier && event->key() == Qt::Key_Colon )
|
||||||
{
|
{
|
||||||
const QKeySequence toggleCommentCodeSequence = QgsGui::shortcutsManager()->sequenceForCommonAction( QgsShortcutsManager::CommonAction::CodeToggleComment );
|
event->accept();
|
||||||
if ( !toggleCommentCodeSequence.isEmpty() && toggleCommentCodeSequence.matches( event->key() | event->modifiers() ) )
|
toggleComment();
|
||||||
{
|
return;
|
||||||
event->accept();
|
|
||||||
toggleComment();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QsciScintilla::keyPressEvent( event );
|
QsciScintilla::keyPressEvent( event );
|
||||||
@ -305,7 +299,7 @@ void QgsCodeEditor::contextMenuEvent( QContextMenuEvent *event )
|
|||||||
if ( languageCapabilities() & Qgis::ScriptLanguageCapability::Reformat )
|
if ( languageCapabilities() & Qgis::ScriptLanguageCapability::Reformat )
|
||||||
{
|
{
|
||||||
QAction *reformatAction = new QAction( tr( "Reformat Code" ), menu );
|
QAction *reformatAction = new QAction( tr( "Reformat Code" ), menu );
|
||||||
reformatAction->setShortcut( QgsGui::shortcutsManager()->sequenceForCommonAction( QgsShortcutsManager::CommonAction::CodeReformat ) );
|
reformatAction->setShortcut( QStringLiteral( "Ctrl+Alt+F" ) );
|
||||||
reformatAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "console/iconFormatCode.svg" ) ) );
|
reformatAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "console/iconFormatCode.svg" ) ) );
|
||||||
reformatAction->setEnabled( !isReadOnly() );
|
reformatAction->setEnabled( !isReadOnly() );
|
||||||
connect( reformatAction, &QAction::triggered, this, &QgsCodeEditor::reformatCode );
|
connect( reformatAction, &QAction::triggered, this, &QgsCodeEditor::reformatCode );
|
||||||
@ -323,7 +317,7 @@ void QgsCodeEditor::contextMenuEvent( QContextMenuEvent *event )
|
|||||||
if ( languageCapabilities() & Qgis::ScriptLanguageCapability::ToggleComment )
|
if ( languageCapabilities() & Qgis::ScriptLanguageCapability::ToggleComment )
|
||||||
{
|
{
|
||||||
QAction *toggleCommentAction = new QAction( tr( "Toggle Comment" ), menu );
|
QAction *toggleCommentAction = new QAction( tr( "Toggle Comment" ), menu );
|
||||||
toggleCommentAction->setShortcut( QgsGui::shortcutsManager()->sequenceForCommonAction( QgsShortcutsManager::CommonAction::CodeToggleComment ) );
|
toggleCommentAction->setShortcut( QStringLiteral( "Ctrl+:" ) );
|
||||||
toggleCommentAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "console/iconCommentEditorConsole.svg" ), palette().color( QPalette::ColorRole::WindowText ) ) );
|
toggleCommentAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "console/iconCommentEditorConsole.svg" ), palette().color( QPalette::ColorRole::WindowText ) ) );
|
||||||
toggleCommentAction->setEnabled( !isReadOnly() );
|
toggleCommentAction->setEnabled( !isReadOnly() );
|
||||||
connect( toggleCommentAction, &QAction::triggered, this, &QgsCodeEditor::toggleComment );
|
connect( toggleCommentAction, &QAction::triggered, this, &QgsCodeEditor::toggleComment );
|
||||||
|
@ -491,7 +491,7 @@ void QgsElevationProfileLayerTreeView::populateInitialSources( QgsProject *proje
|
|||||||
|
|
||||||
void QgsElevationProfileLayerTreeView::addNodeForRegisteredSource( const QString &sourceId, const QString &sourceName )
|
void QgsElevationProfileLayerTreeView::addNodeForRegisteredSource( const QString &sourceId, const QString &sourceName )
|
||||||
{
|
{
|
||||||
auto customNode = std::make_unique< QgsLayerTreeCustomNode >( sourceId, sourceName.isEmpty() ? sourceId : sourceName );
|
std::unique_ptr< QgsLayerTreeCustomNode > customNode = std::make_unique< QgsLayerTreeCustomNode >( sourceId, sourceName.isEmpty() ? sourceId : sourceName );
|
||||||
customNode->setItemVisibilityChecked( true );
|
customNode->setItemVisibilityChecked( true );
|
||||||
// Mark the node so that we know which custom nodes correspond to elevation profile sources
|
// Mark the node so that we know which custom nodes correspond to elevation profile sources
|
||||||
customNode->setCustomProperty( QStringLiteral( "source" ), QgsElevationProfileLayerTreeView::CUSTOM_NODE_ELEVATION_PROFILE_SOURCE );
|
customNode->setCustomProperty( QStringLiteral( "source" ), QgsElevationProfileLayerTreeView::CUSTOM_NODE_ELEVATION_PROFILE_SOURCE );
|
||||||
|
@ -578,7 +578,7 @@ QgsExpressionContext QgsLayoutElevationProfileWidget::createExpressionContext()
|
|||||||
{
|
{
|
||||||
QgsExpressionContext context = mProfile->createExpressionContext();
|
QgsExpressionContext context = mProfile->createExpressionContext();
|
||||||
|
|
||||||
auto plotScope = std::make_unique<QgsExpressionContextScope>( QStringLiteral( "plot" ) );
|
std::unique_ptr<QgsExpressionContextScope> plotScope = std::make_unique<QgsExpressionContextScope>( QStringLiteral( "plot" ) );
|
||||||
plotScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "plot_axis" ), QString(), true ) );
|
plotScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "plot_axis" ), QString(), true ) );
|
||||||
plotScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "plot_axis_value" ), 0.0, true ) );
|
plotScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "plot_axis_value" ), 0.0, true ) );
|
||||||
context.appendScope( plotScope.release() );
|
context.appendScope( plotScope.release() );
|
||||||
|
@ -44,12 +44,12 @@ QgsExpressionContext QgsPlotWidget::createExpressionContext() const
|
|||||||
context.appendScope( QgsExpressionContextUtils::globalScope() );
|
context.appendScope( QgsExpressionContextUtils::globalScope() );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto plotScope = std::make_unique<QgsExpressionContextScope>( QStringLiteral( "plot" ) );
|
std::unique_ptr<QgsExpressionContextScope> plotScope = std::make_unique<QgsExpressionContextScope>( QStringLiteral( "plot" ) );
|
||||||
plotScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "plot_axis" ), QString(), true ) );
|
plotScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "plot_axis" ), QString(), true ) );
|
||||||
plotScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "plot_axis_value" ), 0.0, true ) );
|
plotScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "plot_axis_value" ), 0.0, true ) );
|
||||||
context.appendScope( plotScope.release() );
|
context.appendScope( plotScope.release() );
|
||||||
|
|
||||||
auto chartScope = std::make_unique<QgsExpressionContextScope>( QStringLiteral( "chart" ) );
|
std::unique_ptr<QgsExpressionContextScope> chartScope = std::make_unique<QgsExpressionContextScope>( QStringLiteral( "chart" ) );
|
||||||
chartScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "chart_category" ), QString(), true ) );
|
chartScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "chart_category" ), QString(), true ) );
|
||||||
chartScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "chart_value" ), 0.0, true ) );
|
chartScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "chart_value" ), 0.0, true ) );
|
||||||
context.appendScope( chartScope.release() );
|
context.appendScope( chartScope.release() );
|
||||||
|
@ -17,44 +17,15 @@
|
|||||||
#include "moc_qgsshortcutsmanager.cpp"
|
#include "moc_qgsshortcutsmanager.cpp"
|
||||||
#include "qgslogger.h"
|
#include "qgslogger.h"
|
||||||
#include "qgssettings.h"
|
#include "qgssettings.h"
|
||||||
#include "qgsapplication.h"
|
|
||||||
|
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QWidgetAction>
|
#include <QWidgetAction>
|
||||||
#include <QPalette>
|
|
||||||
|
|
||||||
QgsShortcutsManager::QgsShortcutsManager( QObject *parent, const QString &settingsRoot )
|
QgsShortcutsManager::QgsShortcutsManager( QObject *parent, const QString &settingsRoot )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, mSettingsPath( settingsRoot )
|
, mSettingsPath( settingsRoot )
|
||||||
{
|
{
|
||||||
// Register common actions
|
|
||||||
auto registerCommonAction = [this]( CommonAction commonAction, const QIcon &icon, const QString &text, const QString &toolTip, const QString &sequence, const QString &objectName, const QString §ion ) {
|
|
||||||
QAction *action = new QAction( icon, text, this );
|
|
||||||
action->setToolTip( toolTip );
|
|
||||||
setObjectName( objectName );
|
|
||||||
// We do not want these actions to be enabled, they are just there to be able to change
|
|
||||||
// the shortcuts in the Shortcuts Manager.
|
|
||||||
action->setEnabled( false );
|
|
||||||
action->setProperty( "commonAction", static_cast< int >( commonAction ) );
|
|
||||||
registerAction( action, sequence, section );
|
|
||||||
mCommonActions.insert( static_cast< int >( commonAction ), action );
|
|
||||||
};
|
|
||||||
registerCommonAction( CommonAction::CodeToggleComment, QgsApplication::getThemeIcon( QStringLiteral( "console/iconCommentEditorConsole.svg" ), QgsApplication::palette().color( QPalette::ColorRole::WindowText ) ), tr( "Toggle Comment" ), tr( "Toggle comment" ), QStringLiteral( "Ctrl+/" ), QStringLiteral( "mEditorToggleComment" ), QStringLiteral( "Editor" ) );
|
|
||||||
registerCommonAction( CommonAction::CodeReformat, QgsApplication::getThemeIcon( QStringLiteral( "console/iconFormatCode.svg" ) ), tr( "Reformat Code" ), tr( "Reformat code" ), QStringLiteral( "Ctrl+Alt+F" ), QStringLiteral( "mEditorReformatCode" ), QStringLiteral( "Editor" ) );
|
|
||||||
registerCommonAction( CommonAction::CodeRunScript, QgsApplication::getThemeIcon( QStringLiteral( "mActionStart.svg" ) ), tr( "Run Script" ), tr( "Run entire script" ), QStringLiteral( "Ctrl+Shift+E" ), QStringLiteral( "mEditorRunScript" ), QStringLiteral( "Editor" ) );
|
|
||||||
registerCommonAction( CommonAction::CodeRunSelection, QgsApplication::getThemeIcon( QStringLiteral( "mActionRunSelected.svg" ) ), tr( "Run Selection" ), tr( "Run selected part of script" ), QStringLiteral( "Ctrl+E" ), QStringLiteral( "mEditorRunSelection" ), QStringLiteral( "Editor" ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
QgsShortcutsManager::~QgsShortcutsManager()
|
|
||||||
{
|
|
||||||
// delete all common actions BEFORE this object is destroyed -- they have a lambda connection which
|
|
||||||
// we do NOT want to be triggered during the qt child object cleanup which will occur after this destructor
|
|
||||||
const QHash< int, QAction * > commonActionsToCleanup = std::move( mCommonActions );
|
|
||||||
for ( auto it = commonActionsToCleanup.constBegin(); it != commonActionsToCleanup.constEnd(); ++it )
|
|
||||||
{
|
|
||||||
delete it.value();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsShortcutsManager::registerAllChildren( QObject *object, bool recursive, const QString §ion )
|
void QgsShortcutsManager::registerAllChildren( QObject *object, bool recursive, const QString §ion )
|
||||||
@ -122,7 +93,7 @@ bool QgsShortcutsManager::registerAction( QAction *action, const QString &defaul
|
|||||||
QgsLogger::warning( QStringLiteral( "Duplicate shortcut registered: %1" ).arg( key ) );
|
QgsLogger::warning( QStringLiteral( "Duplicate shortcut registered: %1" ).arg( key ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const QString settingKey = mSettingsPath + ( section.isEmpty() || section.endsWith( QLatin1Char( '/' ) ) ? section : section + QStringLiteral( "/" ) ) + key;
|
const QString settingKey = mSettingsPath + section + key;
|
||||||
|
|
||||||
mActions.insert( action, { defaultSequence, settingKey } );
|
mActions.insert( action, { defaultSequence, settingKey } );
|
||||||
connect( action, &QObject::destroyed, this, [action, this]() { actionDestroyed( action ); } );
|
connect( action, &QObject::destroyed, this, [action, this]() { actionDestroyed( action ); } );
|
||||||
@ -134,28 +105,21 @@ bool QgsShortcutsManager::registerAction( QAction *action, const QString &defaul
|
|||||||
action->setShortcut( sequence );
|
action->setShortcut( sequence );
|
||||||
if ( !action->toolTip().isEmpty() )
|
if ( !action->toolTip().isEmpty() )
|
||||||
{
|
{
|
||||||
action->setToolTip( formatActionToolTip( action->toolTip() ) );
|
const QStringList parts = action->toolTip().split( '\n' );
|
||||||
|
QString formatted = QStringLiteral( "<b>%1</b>" ).arg( parts.at( 0 ) );
|
||||||
|
if ( parts.count() > 1 )
|
||||||
|
{
|
||||||
|
for ( int i = 1; i < parts.count(); ++i )
|
||||||
|
formatted += QStringLiteral( "<p>%1</p>" ).arg( parts.at( i ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
action->setToolTip( formatted );
|
||||||
updateActionToolTip( action, sequence );
|
updateActionToolTip( action, sequence );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsShortcutsManager::initializeCommonAction( QAction *action, CommonAction commonAction )
|
|
||||||
{
|
|
||||||
const auto it = mCommonActions.constFind( static_cast< int >( commonAction ) );
|
|
||||||
if ( it == mCommonActions.constEnd() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// copy properties from common action
|
|
||||||
action->setText( it.value()->text() );
|
|
||||||
action->setToolTip( it.value()->toolTip() );
|
|
||||||
action->setShortcut( it.value()->shortcut() );
|
|
||||||
|
|
||||||
mLinkedCommonActions.insert( action, commonAction );
|
|
||||||
connect( action, &QObject::destroyed, this, [action, this]() { actionDestroyed( action ); } );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QgsShortcutsManager::registerShortcut( QShortcut *shortcut, const QString &defaultSequence, const QString §ion )
|
bool QgsShortcutsManager::registerShortcut( QShortcut *shortcut, const QString &defaultSequence, const QString §ion )
|
||||||
{
|
{
|
||||||
#ifdef QGISDEBUG
|
#ifdef QGISDEBUG
|
||||||
@ -166,7 +130,7 @@ bool QgsShortcutsManager::registerShortcut( QShortcut *shortcut, const QString &
|
|||||||
QgsLogger::warning( QStringLiteral( "Duplicate shortcut registered: %1" ).arg( shortcut->objectName() ) );
|
QgsLogger::warning( QStringLiteral( "Duplicate shortcut registered: %1" ).arg( shortcut->objectName() ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const QString settingKey = mSettingsPath + ( section.isEmpty() || section.endsWith( QLatin1Char( '/' ) ) ? section : section + QStringLiteral( "/" ) ) + shortcut->objectName();
|
const QString settingKey = mSettingsPath + section + shortcut->objectName();
|
||||||
|
|
||||||
mShortcuts.insert( shortcut, { defaultSequence, settingKey } );
|
mShortcuts.insert( shortcut, { defaultSequence, settingKey } );
|
||||||
connect( shortcut, &QObject::destroyed, this, [shortcut, this]() { shortcutDestroyed( shortcut ); } );
|
connect( shortcut, &QObject::destroyed, this, [shortcut, this]() { shortcutDestroyed( shortcut ); } );
|
||||||
@ -273,21 +237,6 @@ bool QgsShortcutsManager::setKeySequence( QAction *action, const QString &sequen
|
|||||||
action->setShortcut( sequence );
|
action->setShortcut( sequence );
|
||||||
this->updateActionToolTip( action, sequence );
|
this->updateActionToolTip( action, sequence );
|
||||||
|
|
||||||
if ( action->property( "commonAction" ).isValid() )
|
|
||||||
{
|
|
||||||
// if the key sequence for a common action is changed, update all QActions currently linked
|
|
||||||
// to that common action
|
|
||||||
const CommonAction commonAction = static_cast< CommonAction >( action->property( "commonAction" ).toInt() );
|
|
||||||
for ( auto it = mLinkedCommonActions.constBegin(); it != mLinkedCommonActions.constEnd(); ++it )
|
|
||||||
{
|
|
||||||
if ( it.value() == commonAction )
|
|
||||||
{
|
|
||||||
it.key()->setShortcut( action->shortcut() );
|
|
||||||
it.key()->setToolTip( action->toolTip() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString settingKey = mActions[action].second;
|
const QString settingKey = mActions[action].second;
|
||||||
|
|
||||||
// save to settings
|
// save to settings
|
||||||
@ -350,15 +299,6 @@ QShortcut *QgsShortcutsManager::shortcutForSequence( const QKeySequence &sequenc
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QKeySequence QgsShortcutsManager::sequenceForCommonAction( CommonAction action ) const
|
|
||||||
{
|
|
||||||
const auto it = mCommonActions.constFind( static_cast< int >( action ) );
|
|
||||||
if ( it == mCommonActions.constEnd() )
|
|
||||||
return QKeySequence();
|
|
||||||
|
|
||||||
return it.value()->shortcut();
|
|
||||||
}
|
|
||||||
|
|
||||||
QAction *QgsShortcutsManager::actionByName( const QString &name ) const
|
QAction *QgsShortcutsManager::actionByName( const QString &name ) const
|
||||||
{
|
{
|
||||||
for ( ActionsHash::const_iterator it = mActions.constBegin(); it != mActions.constEnd(); ++it )
|
for ( ActionsHash::const_iterator it = mActions.constBegin(); it != mActions.constEnd(); ++it )
|
||||||
@ -391,7 +331,6 @@ QShortcut *QgsShortcutsManager::shortcutByName( const QString &name ) const
|
|||||||
void QgsShortcutsManager::actionDestroyed( QAction *action )
|
void QgsShortcutsManager::actionDestroyed( QAction *action )
|
||||||
{
|
{
|
||||||
mActions.remove( action );
|
mActions.remove( action );
|
||||||
mLinkedCommonActions.remove( action );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QgsShortcutsManager::objectSettingKey( QObject *object ) const
|
QString QgsShortcutsManager::objectSettingKey( QObject *object ) const
|
||||||
@ -427,26 +366,10 @@ void QgsShortcutsManager::shortcutDestroyed( QShortcut *shortcut )
|
|||||||
mShortcuts.remove( shortcut );
|
mShortcuts.remove( shortcut );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QgsShortcutsManager::formatActionToolTip( const QString &toolTip )
|
|
||||||
{
|
|
||||||
if ( toolTip.isEmpty() )
|
|
||||||
return QString();
|
|
||||||
|
|
||||||
const QStringList parts = toolTip.split( '\n' );
|
|
||||||
QString formatted = QStringLiteral( "<b>%1</b>" ).arg( parts.at( 0 ) );
|
|
||||||
if ( parts.count() > 1 )
|
|
||||||
{
|
|
||||||
for ( int i = 1; i < parts.count(); ++i )
|
|
||||||
formatted += QStringLiteral( "<p>%1</p>" ).arg( parts.at( i ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return formatted;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsShortcutsManager::updateActionToolTip( QAction *action, const QString &sequence )
|
void QgsShortcutsManager::updateActionToolTip( QAction *action, const QString &sequence )
|
||||||
{
|
{
|
||||||
QString current = action->toolTip();
|
QString current = action->toolTip();
|
||||||
const thread_local QRegularExpression rx( QStringLiteral( "\\s*\\((.*)\\)" ) );
|
const thread_local QRegularExpression rx( QStringLiteral( "\\((.*)\\)" ) );
|
||||||
// Look for the last occurrence of text inside parentheses
|
// Look for the last occurrence of text inside parentheses
|
||||||
QRegularExpressionMatch match;
|
QRegularExpressionMatch match;
|
||||||
if ( current.lastIndexOf( rx, -1, &match ) != -1 )
|
if ( current.lastIndexOf( rx, -1, &match ) != -1 )
|
||||||
|
@ -38,19 +38,6 @@ class GUI_EXPORT QgsShortcutsManager : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* Contains common actions which are used across a variety of classes.
|
|
||||||
* \since QGIS 4.0
|
|
||||||
*/
|
|
||||||
enum class CommonAction
|
|
||||||
{
|
|
||||||
CodeToggleComment, //!< Toggle code comments
|
|
||||||
CodeReformat, //!< Reformat code
|
|
||||||
CodeRunScript, //!< Run script
|
|
||||||
CodeRunSelection, //!< Run selection from script
|
|
||||||
};
|
|
||||||
Q_ENUM( CommonAction )
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for QgsShortcutsManager.
|
* Constructor for QgsShortcutsManager.
|
||||||
* \param parent parent object
|
* \param parent parent object
|
||||||
@ -60,8 +47,6 @@ class GUI_EXPORT QgsShortcutsManager : public QObject
|
|||||||
*/
|
*/
|
||||||
QgsShortcutsManager( QObject *parent SIP_TRANSFERTHIS = nullptr, const QString &settingsRoot = "/shortcuts/" );
|
QgsShortcutsManager( QObject *parent SIP_TRANSFERTHIS = nullptr, const QString &settingsRoot = "/shortcuts/" );
|
||||||
|
|
||||||
~QgsShortcutsManager() override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Automatically registers all QActions and QShortcuts which are children of the
|
* Automatically registers all QActions and QShortcuts which are children of the
|
||||||
* passed object.
|
* passed object.
|
||||||
@ -108,16 +93,6 @@ class GUI_EXPORT QgsShortcutsManager : public QObject
|
|||||||
*/
|
*/
|
||||||
bool registerAction( QAction *action, const QString &defaultShortcut = QString(), const QString §ion = QString() );
|
bool registerAction( QAction *action, const QString &defaultShortcut = QString(), const QString §ion = QString() );
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes an \a action as a common action.
|
|
||||||
*
|
|
||||||
* This automatically configures the \a action to use the properties for the common action, such
|
|
||||||
* as setting the action's tooltip and shortcut.
|
|
||||||
*
|
|
||||||
* \since QGIS 4.0
|
|
||||||
*/
|
|
||||||
void initializeCommonAction( QAction *action, CommonAction commonAction );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a QShortcut with the manager so the shortcut can be configured in GUI.
|
* Registers a QShortcut with the manager so the shortcut can be configured in GUI.
|
||||||
* \param shortcut QShortcut to register. The shortcut must have a unique QObject::objectName() for
|
* \param shortcut QShortcut to register. The shortcut must have a unique QObject::objectName() for
|
||||||
@ -253,12 +228,6 @@ class GUI_EXPORT QgsShortcutsManager : public QObject
|
|||||||
*/
|
*/
|
||||||
QShortcut *shortcutForSequence( const QKeySequence &sequence ) const;
|
QShortcut *shortcutForSequence( const QKeySequence &sequence ) const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the key sequence which is associated with a common \a action, or an empty sequence if no shortcut is assigned to that action.
|
|
||||||
* \since QGIS 4.0
|
|
||||||
*/
|
|
||||||
QKeySequence sequenceForCommonAction( CommonAction action ) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an action by its name, or NULLPTR if nothing found.
|
* Returns an action by its name, or NULLPTR if nothing found.
|
||||||
* \param name action name. Must match QAction's text.
|
* \param name action name. Must match QAction's text.
|
||||||
@ -304,10 +273,6 @@ class GUI_EXPORT QgsShortcutsManager : public QObject
|
|||||||
ActionsHash mActions;
|
ActionsHash mActions;
|
||||||
ShortcutsHash mShortcuts;
|
ShortcutsHash mShortcuts;
|
||||||
QString mSettingsPath;
|
QString mSettingsPath;
|
||||||
QHash< int, QAction * > mCommonActions;
|
|
||||||
QHash< QAction *, CommonAction > mLinkedCommonActions;
|
|
||||||
|
|
||||||
static QString formatActionToolTip( const QString &toolTip );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the action to include the shortcut keys. Shortcut keys are
|
* Updates the action to include the shortcut keys. Shortcut keys are
|
||||||
|
@ -1694,7 +1694,7 @@ void QgsAttributesFormLayoutModel::addContainer( QModelIndex &parent, const QStr
|
|||||||
|
|
||||||
QgsAttributesFormItem *parentItem = itemForIndex( parent );
|
QgsAttributesFormItem *parentItem = itemForIndex( parent );
|
||||||
|
|
||||||
auto containerItem = std::make_unique< QgsAttributesFormItem >( QgsAttributesFormData::Container, name, QString(), parentItem );
|
std::unique_ptr< QgsAttributesFormItem > containerItem = std::make_unique< QgsAttributesFormItem >( QgsAttributesFormData::Container, name, QString(), parentItem );
|
||||||
|
|
||||||
QgsAttributesFormData::AttributeFormItemData itemData;
|
QgsAttributesFormData::AttributeFormItemData itemData;
|
||||||
itemData.setColumnCount( columnCount );
|
itemData.setColumnCount( columnCount );
|
||||||
@ -1713,7 +1713,7 @@ void QgsAttributesFormLayoutModel::insertChild( const QModelIndex &parent, int r
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
beginInsertRows( parent, row, row );
|
beginInsertRows( parent, row, row );
|
||||||
auto item = std::make_unique< QgsAttributesFormItem >();
|
std::unique_ptr< QgsAttributesFormItem > item = std::make_unique< QgsAttributesFormItem >();
|
||||||
|
|
||||||
item->setData( QgsAttributesFormModel::ItemIdRole, itemId );
|
item->setData( QgsAttributesFormModel::ItemIdRole, itemId );
|
||||||
item->setData( QgsAttributesFormModel::ItemTypeRole, itemType );
|
item->setData( QgsAttributesFormModel::ItemTypeRole, itemType );
|
||||||
|
@ -1147,11 +1147,11 @@ void QgsAttributesFormProperties::pasteWidgetConfiguration()
|
|||||||
QVariantMap optionsMap = QgsXmlUtils::readVariant( optionsElem ).toMap();
|
QVariantMap optionsMap = QgsXmlUtils::readVariant( optionsElem ).toMap();
|
||||||
QgsReadWriteContext context;
|
QgsReadWriteContext context;
|
||||||
// translate widget configuration strings
|
// translate widget configuration strings
|
||||||
if ( widgetType == QLatin1String( "ValueRelation" ) )
|
if ( widgetType == QStringLiteral( "ValueRelation" ) )
|
||||||
{
|
{
|
||||||
optionsMap[QStringLiteral( "Value" )] = context.projectTranslator()->translate( QStringLiteral( "project:layers:%1:fields:%2:valuerelationvalue" ).arg( mLayer->id(), fieldName ), optionsMap[QStringLiteral( "Value" )].toString() );
|
optionsMap[QStringLiteral( "Value" )] = context.projectTranslator()->translate( QStringLiteral( "project:layers:%1:fields:%2:valuerelationvalue" ).arg( mLayer->id(), fieldName ), optionsMap[QStringLiteral( "Value" )].toString() );
|
||||||
}
|
}
|
||||||
if ( widgetType == QLatin1String( "ValueMap" ) )
|
if ( widgetType == QStringLiteral( "ValueMap" ) )
|
||||||
{
|
{
|
||||||
if ( optionsMap[QStringLiteral( "map" )].canConvert<QList<QVariant>>() )
|
if ( optionsMap[QStringLiteral( "map" )].canConvert<QList<QVariant>>() )
|
||||||
{
|
{
|
||||||
|
@ -1284,7 +1284,7 @@ bool QgsMssqlProvider::addAttributes( const QList<QgsField> &attributes )
|
|||||||
|
|
||||||
attributeClauses.append( QStringLiteral( "[%1] %2" ).arg( it->name(), type ) );
|
attributeClauses.append( QStringLiteral( "[%1] %2" ).arg( it->name(), type ) );
|
||||||
}
|
}
|
||||||
statement += attributeClauses.join( QLatin1String( ", " ) );
|
statement += attributeClauses.join( QStringLiteral( ", " ) );
|
||||||
|
|
||||||
QSqlQuery query = createQuery();
|
QSqlQuery query = createQuery();
|
||||||
query.setForwardOnly( true );
|
query.setForwardOnly( true );
|
||||||
|
@ -5191,7 +5191,7 @@ QString QgsPostgresProvider::htmlMetadata() const
|
|||||||
")" )
|
")" )
|
||||||
.arg( QgsPostgresConn::quotedValue( mTableName ), QgsPostgresConn::quotedValue( mSchemaName ) );
|
.arg( QgsPostgresConn::quotedValue( mTableName ), QgsPostgresConn::quotedValue( mSchemaName ) );
|
||||||
|
|
||||||
const QString sqlWithPrivileges = QStringLiteral( "privileges AS ("
|
const QString sqlWithPrivilages = QStringLiteral( "privileges AS ("
|
||||||
"SELECT table_info.oid as oid, "
|
"SELECT table_info.oid as oid, "
|
||||||
"COALESCE(NULLIF(CONCAT_WS(', ',"
|
"COALESCE(NULLIF(CONCAT_WS(', ',"
|
||||||
"CASE WHEN has_table_privilege(table_info.oid, 'SELECT') THEN 'SELECT' END,"
|
"CASE WHEN has_table_privilege(table_info.oid, 'SELECT') THEN 'SELECT' END,"
|
||||||
@ -5221,7 +5221,7 @@ QString QgsPostgresProvider::htmlMetadata() const
|
|||||||
"LEFT JOIN privileges ON table_info.oid = privileges.oid "
|
"LEFT JOIN privileges ON table_info.oid = privileges.oid "
|
||||||
"LEFT JOIN table_indexes_info ON table_indexes_info.table_name = table_info.table_name AND table_indexes_info.schema_name = table_info.schema_name "
|
"LEFT JOIN table_indexes_info ON table_indexes_info.table_name = table_info.table_name AND table_indexes_info.schema_name = table_info.schema_name "
|
||||||
"LEFT JOIN pg_description ON pg_description.objoid = table_info.oid" )
|
"LEFT JOIN pg_description ON pg_description.objoid = table_info.oid" )
|
||||||
.arg( sqlWithTableInfo, sqlWithPrivileges, sqlWithIndexes );
|
.arg( sqlWithTableInfo, sqlWithPrivilages, sqlWithIndexes );
|
||||||
|
|
||||||
QgsPostgresResult resTable( connectionRO()->LoggedPQexec( "QgsPostgresProvider", sqlMainQuery ) );
|
QgsPostgresResult resTable( connectionRO()->LoggedPQexec( "QgsPostgresProvider", sqlMainQuery ) );
|
||||||
|
|
||||||
@ -5233,7 +5233,7 @@ QString QgsPostgresProvider::htmlMetadata() const
|
|||||||
if ( resTable.PQntuples() > 0 )
|
if ( resTable.PQntuples() > 0 )
|
||||||
{
|
{
|
||||||
tableComment = resTable.PQgetvalue( 0, 6 );
|
tableComment = resTable.PQgetvalue( 0, 6 );
|
||||||
tableComment = tableComment.replace( QLatin1String( "\n" ), QLatin1String( "<br>" ) );
|
tableComment = tableComment.replace( QStringLiteral( "\n" ), QStringLiteral( "<br>" ) );
|
||||||
|
|
||||||
estimateRowCount = resTable.PQgetvalue( 0, 4 ).toLongLong();
|
estimateRowCount = resTable.PQgetvalue( 0, 4 ).toLongLong();
|
||||||
|
|
||||||
|
@ -1950,7 +1950,7 @@ void QgsPostgresProviderConnection::moveTableToSchema( const QString &sourceSche
|
|||||||
|
|
||||||
const QString sqlMoveTable = sqlMoveToSchema.arg( QgsPostgresConn::quotedIdentifier( sourceSchema ), QgsPostgresConn::quotedIdentifier( tableName ), QgsPostgresConn::quotedIdentifier( targetSchema ) );
|
const QString sqlMoveTable = sqlMoveToSchema.arg( QgsPostgresConn::quotedIdentifier( sourceSchema ), QgsPostgresConn::quotedIdentifier( tableName ), QgsPostgresConn::quotedIdentifier( targetSchema ) );
|
||||||
|
|
||||||
auto conn = std::make_shared<QgsPoolPostgresConn>( QgsPostgresConn::connectionInfo( QgsDataSourceUri( uri() ), false ) );
|
std::shared_ptr<QgsPoolPostgresConn> conn = std::make_shared<QgsPoolPostgresConn>( QgsPostgresConn::connectionInfo( QgsDataSourceUri( uri() ), false ) );
|
||||||
QgsPostgresLayerProperty property;
|
QgsPostgresLayerProperty property;
|
||||||
// need property from target schema, it is already moved
|
// need property from target schema, it is already moved
|
||||||
bool ok = conn->get()->supportedLayer( property, sourceSchema, tableName );
|
bool ok = conn->get()->supportedLayer( property, sourceSchema, tableName );
|
||||||
|
@ -1003,7 +1003,7 @@ QDomElement QgsWFSProvider::geometryElement( const QgsGeometry &geometry, QDomDo
|
|||||||
bool applyAxisInversion;
|
bool applyAxisInversion;
|
||||||
QgsOgcUtils::GMLVersion gmlVersion;
|
QgsOgcUtils::GMLVersion gmlVersion;
|
||||||
|
|
||||||
if ( mShared->mWFSVersion.startsWith( QLatin1String( "1.1" ) ) || mShared->mWFSVersion.startsWith( QLatin1Char( '2' ) ) )
|
if ( mShared->mWFSVersion.startsWith( QLatin1String( "1.1" ) ) || mShared->mWFSVersion.startsWith( QLatin1String( "2" ) ) )
|
||||||
{
|
{
|
||||||
// WFS 1.1.0 uses preferably GML 3, but ESRI mapserver in 2020 doesn't like it so we stick to GML2
|
// WFS 1.1.0 uses preferably GML 3, but ESRI mapserver in 2020 doesn't like it so we stick to GML2
|
||||||
if ( !mShared->mServerPrefersCoordinatesForTransactions_1_1 )
|
if ( !mShared->mServerPrefersCoordinatesForTransactions_1_1 )
|
||||||
|
@ -248,7 +248,7 @@ QList<QgsProviderSublayerDetails> QgsWfsProviderMetadata::querySublayers( const
|
|||||||
// If set: always issue a GetFeature because the guessed type can't be trusted,
|
// If set: always issue a GetFeature because the guessed type can't be trusted,
|
||||||
// for example when dealing with Z geometries identified as 2D.
|
// for example when dealing with Z geometries identified as 2D.
|
||||||
const bool forceInitialGetFeature = dsUri.hasParam( QgsWFSConstants::URI_PARAM_FORCE_INITIAL_GET_FEATURE )
|
const bool forceInitialGetFeature = dsUri.hasParam( QgsWFSConstants::URI_PARAM_FORCE_INITIAL_GET_FEATURE )
|
||||||
&& dsUri.param( QgsWFSConstants::URI_PARAM_FORCE_INITIAL_GET_FEATURE ).toUpper() == QLatin1String( "TRUE" );
|
&& dsUri.param( QgsWFSConstants::URI_PARAM_FORCE_INITIAL_GET_FEATURE ).toUpper() == QStringLiteral( "TRUE" );
|
||||||
|
|
||||||
if ( wfsUri.hasGeometryTypeFilter() || !caps.supportsGeometryTypeFilters() )
|
if ( wfsUri.hasGeometryTypeFilter() || !caps.supportsGeometryTypeFilters() )
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ class QgsWfs3Module : public QgsServiceModule
|
|||||||
{
|
{
|
||||||
rootPath = serverIface->serverSettings()->apiWfs3RootPath();
|
rootPath = serverIface->serverSettings()->apiWfs3RootPath();
|
||||||
}
|
}
|
||||||
auto wfs3Api = std::make_unique<QgsServerOgcApi>( serverIface, rootPath, QStringLiteral( "OAPIF" ), QStringLiteral( "1.0.0" ) );
|
std::unique_ptr<QgsServerOgcApi> wfs3Api = std::make_unique<QgsServerOgcApi>( serverIface, rootPath, QStringLiteral( "OAPIF" ), QStringLiteral( "1.0.0" ) );
|
||||||
// Register handlers
|
// Register handlers
|
||||||
wfs3Api->registerHandler<QgsWfs3CollectionsItemsHandler>();
|
wfs3Api->registerHandler<QgsWfs3CollectionsItemsHandler>();
|
||||||
wfs3Api->registerHandler<QgsWfs3CollectionsFeatureHandler>();
|
wfs3Api->registerHandler<QgsWfs3CollectionsFeatureHandler>();
|
||||||
|
@ -1,124 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>QgsAnnotationLayer3dRendererWidgetBase</class>
|
|
||||||
<widget class="QWidget" name="QgsAnnotationLayer3dRendererWidgetBase">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>555</width>
|
|
||||||
<height>515</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Annotation Layer 3D Renderer</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="mComboRendererType"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QStackedWidget" name="mStackedWidget">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="mPageNoRenderer"/>
|
|
||||||
<widget class="QWidget" name="mPageBillboards">
|
|
||||||
<layout class="QGridLayout" name="gridLayout" columnstretch="1,2">
|
|
||||||
<item row="1" column="0" colspan="2">
|
|
||||||
<widget class="QLabel" name="mLabelClampingExplanation">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QgsDoubleSpinBox" name="mOffsetZSpinBox">
|
|
||||||
<property name="decimals">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<double>-99999999999.000000000000000</double>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<double>99999999999.000000000000000</double>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<spacer name="verticalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="mOffsetLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Offset</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<widget class="QComboBox" name="mComboClamping"/>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="mCheckShowCallouts">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>If checked, vertical lines will be drawn from the terrain to the billboard symbol</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Show callout lines</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>QgsDoubleSpinBox</class>
|
|
||||||
<extends>QDoubleSpinBox</extends>
|
|
||||||
<header>qgsdoublespinbox.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
@ -57,9 +57,6 @@
|
|||||||
#include "qgsdemterraingenerator.h"
|
#include "qgsdemterraingenerator.h"
|
||||||
#include "qgsbillboardgeometry.h"
|
#include "qgsbillboardgeometry.h"
|
||||||
#include "qgspoint3dbillboardmaterial.h"
|
#include "qgspoint3dbillboardmaterial.h"
|
||||||
#include "qgsannotationlayer.h"
|
|
||||||
#include "qgsannotationmarkeritem.h"
|
|
||||||
#include "qgsannotationlayer3drenderer.h"
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QSignalSpy>
|
#include <QSignalSpy>
|
||||||
@ -113,7 +110,6 @@ class TestQgs3DRendering : public QgsTest
|
|||||||
void testDepthBuffer();
|
void testDepthBuffer();
|
||||||
void testAmbientOcclusion();
|
void testAmbientOcclusion();
|
||||||
void testDebugMap();
|
void testDebugMap();
|
||||||
void testAnnotationLayerBillboards();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QImage convertDepthImageToGrayscaleImage( const QImage &depthImage );
|
QImage convertDepthImageToGrayscaleImage( const QImage &depthImage );
|
||||||
@ -2491,85 +2487,5 @@ void TestQgs3DRendering::testDebugMap()
|
|||||||
mapSettings.setLayers( {} );
|
mapSettings.setLayers( {} );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestQgs3DRendering::testAnnotationLayerBillboards()
|
|
||||||
{
|
|
||||||
const QgsRectangle fullExtent( 1000, 1000, 2000, 2000 );
|
|
||||||
|
|
||||||
auto annotationLayer = std::make_unique<QgsAnnotationLayer>( "test", QgsAnnotationLayer::LayerOptions( QgsCoordinateTransformContext() ) );
|
|
||||||
|
|
||||||
auto marker1 = std::make_unique< QgsAnnotationMarkerItem >( QgsPoint( 1000, 1000 ) );
|
|
||||||
QgsMarkerSymbol *markerSymbol = static_cast<QgsMarkerSymbol *>( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) );
|
|
||||||
markerSymbol->setColor( QColor( 255, 0, 0 ) );
|
|
||||||
markerSymbol->setSize( 4 );
|
|
||||||
QgsSimpleMarkerSymbolLayer *sl = static_cast<QgsSimpleMarkerSymbolLayer *>( markerSymbol->symbolLayer( 0 ) );
|
|
||||||
sl->setStrokeColor( QColor( 0, 0, 255 ) );
|
|
||||||
sl->setStrokeWidth( 2 );
|
|
||||||
marker1->setSymbol( markerSymbol );
|
|
||||||
annotationLayer->addItem( marker1.release() );
|
|
||||||
|
|
||||||
auto marker2 = std::make_unique< QgsAnnotationMarkerItem >( QgsPoint( 1000, 2000 ) );
|
|
||||||
markerSymbol = static_cast<QgsMarkerSymbol *>( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) );
|
|
||||||
markerSymbol->setColor( QColor( 0, 255, 0 ) );
|
|
||||||
markerSymbol->setSize( 20 );
|
|
||||||
sl = static_cast<QgsSimpleMarkerSymbolLayer *>( markerSymbol->symbolLayer( 0 ) );
|
|
||||||
sl->setStrokeColor( QColor( 255, 0, 255 ) );
|
|
||||||
sl->setStrokeWidth( 2 );
|
|
||||||
marker2->setSymbol( markerSymbol );
|
|
||||||
annotationLayer->addItem( marker2.release() );
|
|
||||||
|
|
||||||
auto marker3 = std::make_unique< QgsAnnotationMarkerItem >( QgsPoint( 2000, 2000 ) );
|
|
||||||
markerSymbol = static_cast<QgsMarkerSymbol *>( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) );
|
|
||||||
markerSymbol->setColor( QColor( 0, 0, 255 ) );
|
|
||||||
markerSymbol->setSize( 30 );
|
|
||||||
sl = static_cast<QgsSimpleMarkerSymbolLayer *>( markerSymbol->symbolLayer( 0 ) );
|
|
||||||
sl->setStrokeColor( QColor( 0, 255, 255 ) );
|
|
||||||
sl->setStrokeWidth( 2 );
|
|
||||||
marker3->setSymbol( markerSymbol );
|
|
||||||
annotationLayer->addItem( marker3.release() );
|
|
||||||
|
|
||||||
auto renderer = std::make_unique< QgsAnnotationLayer3DRenderer >();
|
|
||||||
|
|
||||||
annotationLayer->setRenderer3D( renderer->clone() );
|
|
||||||
|
|
||||||
Qgs3DMapSettings *map = new Qgs3DMapSettings;
|
|
||||||
map->setCrs( mProject->crs() );
|
|
||||||
map->setExtent( fullExtent );
|
|
||||||
map->setLayers( QList<QgsMapLayer *>() << annotationLayer.get() );
|
|
||||||
|
|
||||||
QgsFlatTerrainGenerator *flatTerrain = new QgsFlatTerrainGenerator;
|
|
||||||
flatTerrain->setCrs( map->crs(), map->transformContext() );
|
|
||||||
map->setTerrainGenerator( flatTerrain );
|
|
||||||
|
|
||||||
QgsOffscreen3DEngine engine;
|
|
||||||
Qgs3DMapScene *scene = new Qgs3DMapScene( *map, &engine );
|
|
||||||
engine.setRootEntity( scene );
|
|
||||||
|
|
||||||
// look from the top
|
|
||||||
scene->cameraController()->setLookingAtPoint( QgsVector3D( 0, 0, 0 ), 2500, 0, 0 );
|
|
||||||
|
|
||||||
// When running the test on Travis, it would initially return empty rendered image.
|
|
||||||
// Capturing the initial image and throwing it away fixes that. Hopefully we will
|
|
||||||
// find a better fix in the future.
|
|
||||||
Qgs3DUtils::captureSceneImage( engine, scene );
|
|
||||||
|
|
||||||
QImage img = Qgs3DUtils::captureSceneImage( engine, scene );
|
|
||||||
QGSVERIFYIMAGECHECK( "annotation_billboard_rendering_1", "annotation_billboard_rendering_1", img, QString(), 40, QSize( 0, 0 ), 2 );
|
|
||||||
|
|
||||||
// more perspective look, with z offset
|
|
||||||
renderer->setZOffset( 600 );
|
|
||||||
renderer->setShowCalloutLines( true );
|
|
||||||
renderer->setCalloutLineColor( QColor( 255, 255, 255 ) );
|
|
||||||
renderer->setCalloutLineWidth( 8 );
|
|
||||||
annotationLayer->setRenderer3D( renderer->clone() );
|
|
||||||
|
|
||||||
scene->cameraController()->setLookingAtPoint( QgsVector3D( 0, 0, 0 ), 2500, 45, 45 );
|
|
||||||
|
|
||||||
QImage img2 = Qgs3DUtils::captureSceneImage( engine, scene );
|
|
||||||
delete scene;
|
|
||||||
delete map;
|
|
||||||
|
|
||||||
QGSVERIFYIMAGECHECK( "annotation_billboard_rendering_2", "annotation_billboard_rendering_2", img2, QString(), 40, QSize( 0, 0 ), 2 );
|
|
||||||
}
|
|
||||||
|
|
||||||
QGSTEST_MAIN( TestQgs3DRendering )
|
QGSTEST_MAIN( TestQgs3DRendering )
|
||||||
#include "testqgs3drendering.moc"
|
#include "testqgs3drendering.moc"
|
||||||
|
@ -226,7 +226,7 @@ void TestNineCellFilters::testCreationOptions()
|
|||||||
{
|
{
|
||||||
QString tmpFile( tempFile( QStringLiteral( "createopts" ) ) );
|
QString tmpFile( tempFile( QStringLiteral( "createopts" ) ) );
|
||||||
|
|
||||||
QString worldFileName = tmpFile.replace( QLatin1String( ".tif" ), QLatin1String( ".tfw" ) );
|
QString worldFileName = tmpFile.replace( QStringLiteral( ".tif" ), QStringLiteral( ".tfw" ) );
|
||||||
QFile worldFile( worldFileName );
|
QFile worldFile( worldFileName );
|
||||||
QVERIFY( !worldFile.exists() );
|
QVERIFY( !worldFile.exists() );
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ void TestQgsProcessingCheckGeometry::containedAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
@ -324,7 +324,7 @@ void TestQgsProcessingCheckGeometry::degeneratePolygonAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
@ -365,7 +365,7 @@ void TestQgsProcessingCheckGeometry::segmentLengthAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
@ -404,7 +404,7 @@ void TestQgsProcessingCheckGeometry::selfIntersectionAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
@ -433,7 +433,7 @@ void TestQgsProcessingCheckGeometry::dangleAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
@ -473,7 +473,7 @@ void TestQgsProcessingCheckGeometry::duplicateNodesAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
@ -507,7 +507,7 @@ void TestQgsProcessingCheckGeometry::followBoundariesAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
@ -537,7 +537,7 @@ void TestQgsProcessingCheckGeometry::overlapAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
@ -577,7 +577,7 @@ void TestQgsProcessingCheckGeometry::selfContactAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
@ -608,7 +608,7 @@ void TestQgsProcessingCheckGeometry::sliverPolygonAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
@ -632,7 +632,7 @@ void TestQgsProcessingCheckGeometry::gapAlg()
|
|||||||
const QDir testDataDir( QDir( TEST_DATA_DIR ).absoluteFilePath( "geometry_checker" ) );
|
const QDir testDataDir( QDir( TEST_DATA_DIR ).absoluteFilePath( "geometry_checker" ) );
|
||||||
QgsVectorLayer *gapLayer = new QgsVectorLayer( testDataDir.absoluteFilePath( "gap_layer.shp" ), QStringLiteral( "polygons" ), QStringLiteral( "ogr" ) );
|
QgsVectorLayer *gapLayer = new QgsVectorLayer( testDataDir.absoluteFilePath( "gap_layer.shp" ), QStringLiteral( "polygons" ), QStringLiteral( "ogr" ) );
|
||||||
|
|
||||||
auto allowedGapsLayer = std::make_unique< QgsVectorLayer >( QStringLiteral( "Polygon?crs=epsg:4326" ), QStringLiteral( "allowedGaps" ), QStringLiteral( "memory" ) );
|
std::unique_ptr<QgsVectorLayer> allowedGapsLayer = std::make_unique< QgsVectorLayer >( QStringLiteral( "Polygon?crs=epsg:4326" ), QStringLiteral( "allowedGaps" ), QStringLiteral( "memory" ) );
|
||||||
QgsProject::instance()->addMapLayer( allowedGapsLayer.get() );
|
QgsProject::instance()->addMapLayer( allowedGapsLayer.get() );
|
||||||
QgsFeature allowedGap;
|
QgsFeature allowedGap;
|
||||||
|
|
||||||
@ -648,7 +648,7 @@ void TestQgsProcessingCheckGeometry::gapAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
@ -688,7 +688,7 @@ void TestQgsProcessingCheckGeometry::gapAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
@ -721,7 +721,7 @@ void TestQgsProcessingCheckGeometry::pointInPolygonAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
@ -747,7 +747,7 @@ void TestQgsProcessingCheckGeometry::pointCoveredByLineAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
@ -774,7 +774,7 @@ void TestQgsProcessingCheckGeometry::lineLayerIntersectionAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
@ -803,7 +803,7 @@ void TestQgsProcessingCheckGeometry::lineIntersectionAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
@ -843,7 +843,7 @@ void TestQgsProcessingCheckGeometry::multipartAlg()
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QgsProcessingFeedback feedback;
|
QgsProcessingFeedback feedback;
|
||||||
auto context = std::make_unique< QgsProcessingContext >();
|
std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
|
||||||
|
|
||||||
QVariantMap results;
|
QVariantMap results;
|
||||||
results = alg->run( parameters, *context, &feedback, &ok );
|
results = alg->run( parameters, *context, &feedback, &ok );
|
||||||
|
@ -886,4 +886,4 @@ void TestQgsProcessingFixGeometry::fixDeleteFeaturesAlg()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QGSTEST_MAIN( TestQgsProcessingFixGeometry )
|
QGSTEST_MAIN( TestQgsProcessingFixGeometry )
|
||||||
#include "testqgsprocessingfixgeometry.moc"
|
#include "testqgsprocessingfixgeometry.moc"
|
@ -1152,7 +1152,7 @@ void TestQgsRasterCalculator::testCreationOptions()
|
|||||||
QString tmpName = tmpFile.fileName();
|
QString tmpName = tmpFile.fileName();
|
||||||
tmpFile.close();
|
tmpFile.close();
|
||||||
|
|
||||||
QString worldFileName = tmpName.replace( QLatin1String( ".tif" ), QLatin1String( ".tfw" ) );
|
QString worldFileName = tmpName.replace( QStringLiteral( ".tif" ), QStringLiteral( ".tfw" ) );
|
||||||
QFile worldFile( worldFileName );
|
QFile worldFile( worldFileName );
|
||||||
QVERIFY( !worldFile.exists() );
|
QVERIFY( !worldFile.exists() );
|
||||||
|
|
||||||
|
@ -425,7 +425,7 @@ void TestQgsSfcgal::isEqual()
|
|||||||
void TestQgsSfcgal::boundary()
|
void TestQgsSfcgal::boundary()
|
||||||
{
|
{
|
||||||
// 2D line
|
// 2D line
|
||||||
auto sfcgalLine2D = std::make_unique<QgsSfcgalGeometry>( mpPolylineGeometryD );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalLine2D = std::make_unique<QgsSfcgalGeometry>( mpPolylineGeometryD );
|
||||||
#if SFCGAL_VERSION_MAJOR_INT == 2 && SFCGAL_VERSION_MINOR_INT < 1
|
#if SFCGAL_VERSION_MAJOR_INT == 2 && SFCGAL_VERSION_MINOR_INT < 1
|
||||||
QVERIFY_EXCEPTION_THROWN( sfcgalLine2D->boundary(), QgsNotSupportedException );
|
QVERIFY_EXCEPTION_THROWN( sfcgalLine2D->boundary(), QgsNotSupportedException );
|
||||||
#else
|
#else
|
||||||
@ -435,7 +435,7 @@ void TestQgsSfcgal::boundary()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 3D polygon
|
// 3D polygon
|
||||||
auto sfcgalPolygon3D = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZA );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalPolygon3D = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZA );
|
||||||
#if SFCGAL_VERSION_MAJOR_INT == 2 && SFCGAL_VERSION_MINOR_INT < 1
|
#if SFCGAL_VERSION_MAJOR_INT == 2 && SFCGAL_VERSION_MINOR_INT < 1
|
||||||
QVERIFY_EXCEPTION_THROWN( sfcgalPolygon3D->boundary(), QgsNotSupportedException );
|
QVERIFY_EXCEPTION_THROWN( sfcgalPolygon3D->boundary(), QgsNotSupportedException );
|
||||||
#else
|
#else
|
||||||
@ -448,16 +448,16 @@ void TestQgsSfcgal::boundary()
|
|||||||
|
|
||||||
void TestQgsSfcgal::centroid()
|
void TestQgsSfcgal::centroid()
|
||||||
{
|
{
|
||||||
auto geomZA = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZA );
|
std::unique_ptr<QgsSfcgalGeometry> geomZA = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZA );
|
||||||
auto geomZB = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZB );
|
std::unique_ptr<QgsSfcgalGeometry> geomZB = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZB );
|
||||||
auto geomZC = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZC );
|
std::unique_ptr<QgsSfcgalGeometry> geomZC = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZC );
|
||||||
|
|
||||||
#if SFCGAL_VERSION_MAJOR_INT == 2 && SFCGAL_VERSION_MINOR_INT < 1
|
#if SFCGAL_VERSION_MAJOR_INT == 2 && SFCGAL_VERSION_MINOR_INT < 1
|
||||||
QVERIFY_EXCEPTION_THROWN( geomZA->centroid(), QgsNotSupportedException );
|
QVERIFY_EXCEPTION_THROWN( geomZA->centroid(), QgsNotSupportedException );
|
||||||
QVERIFY_EXCEPTION_THROWN( geomZB->centroid(), QgsNotSupportedException );
|
QVERIFY_EXCEPTION_THROWN( geomZB->centroid(), QgsNotSupportedException );
|
||||||
QVERIFY_EXCEPTION_THROWN( geomZC->centroid(), QgsNotSupportedException );
|
QVERIFY_EXCEPTION_THROWN( geomZC->centroid(), QgsNotSupportedException );
|
||||||
#else
|
#else
|
||||||
auto res = std::make_unique<QgsPoint>( geomZA->centroid() );
|
std::unique_ptr<QgsPoint> res = std::make_unique<QgsPoint>( geomZA->centroid() );
|
||||||
QCOMPARE( res->asWkt( 2 ), QStringLiteral( "Point Z (-5673.79 3594.8 20)" ) );
|
QCOMPARE( res->asWkt( 2 ), QStringLiteral( "Point Z (-5673.79 3594.8 20)" ) );
|
||||||
|
|
||||||
res = std::make_unique<QgsPoint>( geomZB->centroid() );
|
res = std::make_unique<QgsPoint>( geomZB->centroid() );
|
||||||
@ -471,7 +471,7 @@ void TestQgsSfcgal::centroid()
|
|||||||
void TestQgsSfcgal::dropZ()
|
void TestQgsSfcgal::dropZ()
|
||||||
{
|
{
|
||||||
// PolygonZ
|
// PolygonZ
|
||||||
auto sfcgalPolygonZ = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZA );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalPolygonZ = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZA );
|
||||||
QCOMPARE( sfcgalPolygonZ->wkbType(), Qgis::WkbType::PolygonZ );
|
QCOMPARE( sfcgalPolygonZ->wkbType(), Qgis::WkbType::PolygonZ );
|
||||||
#if SFCGAL_VERSION_MAJOR_INT == 2 && SFCGAL_VERSION_MINOR_INT < 1
|
#if SFCGAL_VERSION_MAJOR_INT == 2 && SFCGAL_VERSION_MINOR_INT < 1
|
||||||
QVERIFY_EXCEPTION_THROWN( sfcgalPolygonZ->dropZValue(), QgsNotSupportedException );
|
QVERIFY_EXCEPTION_THROWN( sfcgalPolygonZ->dropZValue(), QgsNotSupportedException );
|
||||||
@ -482,7 +482,7 @@ void TestQgsSfcgal::dropZ()
|
|||||||
QVERIFY( !sfcgalPolygonZ->dropZValue() );
|
QVERIFY( !sfcgalPolygonZ->dropZValue() );
|
||||||
|
|
||||||
// Polygon2D
|
// Polygon2D
|
||||||
auto sfcgalPolygon2D = std::make_unique<QgsSfcgalGeometry>( QgsGeometry::fromPolygonXY( mPolygonA ) );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalPolygon2D = std::make_unique<QgsSfcgalGeometry>( QgsGeometry::fromPolygonXY( mPolygonA ) );
|
||||||
QCOMPARE( sfcgalPolygon2D->wkbType(), Qgis::WkbType::Polygon );
|
QCOMPARE( sfcgalPolygon2D->wkbType(), Qgis::WkbType::Polygon );
|
||||||
QVERIFY( !sfcgalPolygon2D->dropZValue() );
|
QVERIFY( !sfcgalPolygon2D->dropZValue() );
|
||||||
QCOMPARE( sfcgalPolygon2D->wkbType(), Qgis::WkbType::Polygon );
|
QCOMPARE( sfcgalPolygon2D->wkbType(), Qgis::WkbType::Polygon );
|
||||||
@ -506,7 +506,7 @@ void TestQgsSfcgal::dropZ()
|
|||||||
void TestQgsSfcgal::dropM()
|
void TestQgsSfcgal::dropM()
|
||||||
{
|
{
|
||||||
// PolygonZ
|
// PolygonZ
|
||||||
auto sfcgalPolygonZ = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZA );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalPolygonZ = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZA );
|
||||||
QCOMPARE( sfcgalPolygonZ->wkbType(), Qgis::WkbType::PolygonZ );
|
QCOMPARE( sfcgalPolygonZ->wkbType(), Qgis::WkbType::PolygonZ );
|
||||||
#if SFCGAL_VERSION_MAJOR_INT == 2 && SFCGAL_VERSION_MINOR_INT < 1
|
#if SFCGAL_VERSION_MAJOR_INT == 2 && SFCGAL_VERSION_MINOR_INT < 1
|
||||||
QVERIFY_EXCEPTION_THROWN( sfcgalPolygonZ->dropMValue(), QgsNotSupportedException );
|
QVERIFY_EXCEPTION_THROWN( sfcgalPolygonZ->dropMValue(), QgsNotSupportedException );
|
||||||
@ -515,7 +515,7 @@ void TestQgsSfcgal::dropM()
|
|||||||
QCOMPARE( sfcgalPolygonZ->wkbType(), Qgis::WkbType::PolygonZ );
|
QCOMPARE( sfcgalPolygonZ->wkbType(), Qgis::WkbType::PolygonZ );
|
||||||
|
|
||||||
// Polygon2D
|
// Polygon2D
|
||||||
auto sfcgalPolygon2D = std::make_unique<QgsSfcgalGeometry>( QgsGeometry::fromPolygonXY( mPolygonA ) );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalPolygon2D = std::make_unique<QgsSfcgalGeometry>( QgsGeometry::fromPolygonXY( mPolygonA ) );
|
||||||
QCOMPARE( sfcgalPolygon2D->wkbType(), Qgis::WkbType::Polygon );
|
QCOMPARE( sfcgalPolygon2D->wkbType(), Qgis::WkbType::Polygon );
|
||||||
QVERIFY( !sfcgalPolygon2D->dropMValue() );
|
QVERIFY( !sfcgalPolygon2D->dropMValue() );
|
||||||
QCOMPARE( sfcgalPolygon2D->wkbType(), Qgis::WkbType::Polygon );
|
QCOMPARE( sfcgalPolygon2D->wkbType(), Qgis::WkbType::Polygon );
|
||||||
@ -620,7 +620,7 @@ void TestQgsSfcgal::swapXY()
|
|||||||
|
|
||||||
void TestQgsSfcgal::isEmpty()
|
void TestQgsSfcgal::isEmpty()
|
||||||
{
|
{
|
||||||
auto sfcgalGeomZA = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZA );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalGeomZA = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZA );
|
||||||
QVERIFY( !sfcgalGeomZA->isEmpty() );
|
QVERIFY( !sfcgalGeomZA->isEmpty() );
|
||||||
|
|
||||||
QgsSfcgalGeometry sfcgalGeomEmpty( "POLYGON EMPTY" );
|
QgsSfcgalGeometry sfcgalGeomEmpty( "POLYGON EMPTY" );
|
||||||
@ -648,7 +648,7 @@ void TestQgsSfcgal::scale()
|
|||||||
QCOMPARE( sfcgalScalePoint3DCenter->asWkt( 0 ), QStringLiteral( "POINT Z (7 7 2)" ) );
|
QCOMPARE( sfcgalScalePoint3DCenter->asWkt( 0 ), QStringLiteral( "POINT Z (7 7 2)" ) );
|
||||||
|
|
||||||
// 3D Polygon - no center
|
// 3D Polygon - no center
|
||||||
auto sfcgalPolygonA = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZA );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalPolygonA = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZA );
|
||||||
const QgsVector3D scaleFactorPolygon( 2, 2, 2 );
|
const QgsVector3D scaleFactorPolygon( 2, 2, 2 );
|
||||||
std::unique_ptr<QgsSfcgalGeometry> sfcgalScalePolygonA( sfcgalPolygonA->scale( scaleFactorPolygon, QgsPoint() ) );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalScalePolygonA( sfcgalPolygonA->scale( scaleFactorPolygon, QgsPoint() ) );
|
||||||
|
|
||||||
@ -666,7 +666,7 @@ void TestQgsSfcgal::scale()
|
|||||||
QVERIFY2( expectedScalePolygonACenter.covers( *sfcgalScalePolygonACenter.get() ), "scale polygon A with center does not match expected WKT" );
|
QVERIFY2( expectedScalePolygonACenter.covers( *sfcgalScalePolygonACenter.get() ), "scale polygon A with center does not match expected WKT" );
|
||||||
|
|
||||||
// 2D LineString - no center
|
// 2D LineString - no center
|
||||||
auto sfcgalLineD = std::make_unique<QgsSfcgalGeometry>( mpPolylineGeometryD );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalLineD = std::make_unique<QgsSfcgalGeometry>( mpPolylineGeometryD );
|
||||||
const QgsVector3D scaleFactorLine( 3, 2, 0 );
|
const QgsVector3D scaleFactorLine( 3, 2, 0 );
|
||||||
std::unique_ptr<QgsSfcgalGeometry> sfcgalScaleLineD( sfcgalLineD->scale( scaleFactorLine, QgsPoint() ) );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalScaleLineD( sfcgalLineD->scale( scaleFactorLine, QgsPoint() ) );
|
||||||
|
|
||||||
@ -706,9 +706,9 @@ void TestQgsSfcgal::intersection3d()
|
|||||||
initPainterTest();
|
initPainterTest();
|
||||||
|
|
||||||
// first triangulate polygon as some are not coplanar
|
// first triangulate polygon as some are not coplanar
|
||||||
auto geomZA = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZA );
|
std::unique_ptr<QgsSfcgalGeometry> geomZA = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZA );
|
||||||
auto geomZB = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZB );
|
std::unique_ptr<QgsSfcgalGeometry> geomZB = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZB );
|
||||||
auto geomZC = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZC );
|
std::unique_ptr<QgsSfcgalGeometry> geomZC = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZC );
|
||||||
|
|
||||||
geomZA = geomZA->triangulate();
|
geomZA = geomZA->triangulate();
|
||||||
geomZB = geomZB->triangulate();
|
geomZB = geomZB->triangulate();
|
||||||
@ -803,7 +803,7 @@ void TestQgsSfcgal::unionCheck1()
|
|||||||
{
|
{
|
||||||
initPainterTest();
|
initPainterTest();
|
||||||
// should be a multipolygon with 2 parts as A does not intersect C
|
// should be a multipolygon with 2 parts as A does not intersect C
|
||||||
auto geomA = std::make_unique<QgsSfcgalGeometry>( mpPolygonGeometryA );
|
std::unique_ptr<QgsSfcgalGeometry> geomA = std::make_unique<QgsSfcgalGeometry>( mpPolygonGeometryA );
|
||||||
|
|
||||||
QVector<QgsAbstractGeometry *> geomList;
|
QVector<QgsAbstractGeometry *> geomList;
|
||||||
geomList.append( mpPolygonGeometryC.get() );
|
geomList.append( mpPolygonGeometryC.get() );
|
||||||
@ -827,7 +827,7 @@ void TestQgsSfcgal::unionCheck2()
|
|||||||
{
|
{
|
||||||
initPainterTest();
|
initPainterTest();
|
||||||
// should be a single polygon as A intersect B
|
// should be a single polygon as A intersect B
|
||||||
auto geomA = std::make_unique<QgsSfcgalGeometry>( mpPolygonGeometryA );
|
std::unique_ptr<QgsSfcgalGeometry> geomA = std::make_unique<QgsSfcgalGeometry>( mpPolygonGeometryA );
|
||||||
|
|
||||||
QVector<QgsAbstractGeometry *> geomList;
|
QVector<QgsAbstractGeometry *> geomList;
|
||||||
geomList.append( mpPolygonGeometryB.get() );
|
geomList.append( mpPolygonGeometryB.get() );
|
||||||
@ -851,7 +851,7 @@ void TestQgsSfcgal::differenceCheck1()
|
|||||||
{
|
{
|
||||||
initPainterTest();
|
initPainterTest();
|
||||||
// should be same as A since A does not intersect C so diff is 100% of A
|
// should be same as A since A does not intersect C so diff is 100% of A
|
||||||
auto geomA = std::make_unique<QgsSfcgalGeometry>( mpPolygonGeometryA );
|
std::unique_ptr<QgsSfcgalGeometry> geomA = std::make_unique<QgsSfcgalGeometry>( mpPolygonGeometryA );
|
||||||
|
|
||||||
std::unique_ptr<QgsSfcgalGeometry> diffGeom = geomA->difference( mpPolygonGeometryC.constGet() );
|
std::unique_ptr<QgsSfcgalGeometry> diffGeom = geomA->difference( mpPolygonGeometryC.constGet() );
|
||||||
QCOMPARE( diffGeom->wkbType(), Qgis::WkbType::Polygon );
|
QCOMPARE( diffGeom->wkbType(), Qgis::WkbType::Polygon );
|
||||||
@ -869,7 +869,7 @@ void TestQgsSfcgal::differenceCheck2()
|
|||||||
{
|
{
|
||||||
initPainterTest();
|
initPainterTest();
|
||||||
// should be a single polygon as (A - B) = subset of A
|
// should be a single polygon as (A - B) = subset of A
|
||||||
auto geomA = std::make_unique<QgsSfcgalGeometry>( mpPolygonGeometryA );
|
std::unique_ptr<QgsSfcgalGeometry> geomA = std::make_unique<QgsSfcgalGeometry>( mpPolygonGeometryA );
|
||||||
|
|
||||||
std::unique_ptr<QgsSfcgalGeometry> diffGeom = geomA->difference( mpPolygonGeometryB.constGet() );
|
std::unique_ptr<QgsSfcgalGeometry> diffGeom = geomA->difference( mpPolygonGeometryB.constGet() );
|
||||||
QCOMPARE( diffGeom->wkbType(), Qgis::WkbType::Polygon );
|
QCOMPARE( diffGeom->wkbType(), Qgis::WkbType::Polygon );
|
||||||
@ -935,7 +935,7 @@ void TestQgsSfcgal::buffer3DCheck()
|
|||||||
"116.868555 35.534051, 116.617007 35.869448, 116.491233 35.953297, "
|
"116.868555 35.534051, 116.617007 35.869448, 116.491233 35.953297, "
|
||||||
"116.155836 36.288694, 116.071987 36.372544, 115.443117 36.749865, "
|
"116.155836 36.288694, 116.071987 36.372544, 115.443117 36.749865, "
|
||||||
"114.814247 37.043338, 114.311152 37.169112)";
|
"114.814247 37.043338, 114.311152 37.169112)";
|
||||||
auto sfcgalLine2D = std::make_unique<QgsSfcgalGeometry>( sfcgalLine2DWkt );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalLine2D = std::make_unique<QgsSfcgalGeometry>( sfcgalLine2DWkt );
|
||||||
|
|
||||||
std::unique_ptr<QgsSfcgalGeometry> sfcgalBuffer3D( sfcgalLine2D->buffer3D( 20.0, 7, Qgis::JoinStyle3D::Round ) );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalBuffer3D( sfcgalLine2D->buffer3D( 20.0, 7, Qgis::JoinStyle3D::Round ) );
|
||||||
QVERIFY2( sfcgalBuffer3D != nullptr, "buffer 3d is NULL." );
|
QVERIFY2( sfcgalBuffer3D != nullptr, "buffer 3d is NULL." );
|
||||||
@ -966,7 +966,7 @@ void TestQgsSfcgal::buffer3DCheck()
|
|||||||
|
|
||||||
void TestQgsSfcgal::buffer2DCheck()
|
void TestQgsSfcgal::buffer2DCheck()
|
||||||
{
|
{
|
||||||
auto sfcgalLine2D = std::make_unique<QgsSfcgalGeometry>( mpPolygonGeometryA );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalLine2D = std::make_unique<QgsSfcgalGeometry>( mpPolygonGeometryA );
|
||||||
std::unique_ptr<QgsSfcgalGeometry> sfcgalBuffer2D( sfcgalLine2D->buffer2D( 20.0, 7, Qgis::JoinStyle::Round ) );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalBuffer2D( sfcgalLine2D->buffer2D( 20.0, 7, Qgis::JoinStyle::Round ) );
|
||||||
QVERIFY2( sfcgalBuffer2D != nullptr, "2D Buffer is NULL" );
|
QVERIFY2( sfcgalBuffer2D != nullptr, "2D Buffer is NULL" );
|
||||||
|
|
||||||
@ -979,7 +979,7 @@ void TestQgsSfcgal::buffer2DCheck()
|
|||||||
|
|
||||||
void TestQgsSfcgal::extrude()
|
void TestQgsSfcgal::extrude()
|
||||||
{
|
{
|
||||||
auto sfcgalPolygonA = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZA );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalPolygonA = std::make_unique<QgsSfcgalGeometry>( mSfcgalPolygonZA );
|
||||||
const QgsVector3D extrusion( 0, 0, 30 );
|
const QgsVector3D extrusion( 0, 0, 30 );
|
||||||
std::unique_ptr<QgsSfcgalGeometry> sfcgalExtrusion( sfcgalPolygonA->extrude( extrusion ) );
|
std::unique_ptr<QgsSfcgalGeometry> sfcgalExtrusion( sfcgalPolygonA->extrude( extrusion ) );
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user