mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-05 00:09:32 -04:00
Add QgsMapLayer::profileSource
This commit adds a virtual method to QgsMapLayer to enable the creation of custom elevation profiles for any type of layer. The methods returns a pointer to a helper class of type QgsAbstractProfileSource which is a factory for profile generators (cf. documentation for QgsAbstractProfileSource). Existing layers that derive from QgsAbstractProfileSource just override this method returning a *this* pointer. As the method is *sipified* it can be used in python to declare custom profile source for classes derived from PluginLayer (ownership of the QgsAbstractProfileSource must then be managed on the python side).
This commit is contained in:
parent
1fc67c6009
commit
1c2c2b3252
@ -81,7 +81,7 @@ try:
|
||||
QgsMapLayer.formatLayerName = staticmethod(QgsMapLayer.formatLayerName)
|
||||
QgsMapLayer.generateId = staticmethod(QgsMapLayer.generateId)
|
||||
QgsMapLayer.providerReadFlags = staticmethod(QgsMapLayer.providerReadFlags)
|
||||
QgsMapLayer.__virtual_methods__ = ['properties', 'dataProvider', 'setOpacity', 'opacity', 'reload', 'extent', 'extent3D', 'subLayers', 'setLayerOrder', 'setSubLayerVisibility', 'supportsEditing', 'isEditable', 'isModified', 'isSpatial', 'isTemporary', 'resolveReferences', 'listStylesInDatabase', 'getStyleFromDatabase', 'deleteStyleFromDatabase', 'saveStyleToDatabase', 'loadNamedStyle', 'error', 'metadataUri', 'saveDefaultMetadata', 'loadNamedMetadata', 'loadDefaultMetadata', 'styleURI', 'loadDefaultStyle', 'loadNamedStyleFromDatabase', 'importNamedStyle', 'exportNamedStyle', 'exportSldStyle', 'exportSldStyleV2', 'exportSldStyleV3', 'saveDefaultStyle', 'saveNamedStyle', 'saveSldStyle', 'saveSldStyleV2', 'loadSldStyle', 'readSld', 'readSymbology', 'readStyle', 'writeSymbology', 'writeStyle', 'setMetadata', 'htmlMetadata', 'timestamp', 'dependencies', 'accept', 'selectionProperties', 'temporalProperties', 'elevationProperties', 'hasMapTips', 'setDependencies', 'setExtent', 'setExtent3D', 'readXml', 'writeXml', 'encodedSource', 'decodedSource']
|
||||
QgsMapLayer.__virtual_methods__ = ['properties', 'dataProvider', 'setOpacity', 'opacity', 'reload', 'extent', 'extent3D', 'subLayers', 'setLayerOrder', 'setSubLayerVisibility', 'supportsEditing', 'isEditable', 'isModified', 'isSpatial', 'isTemporary', 'resolveReferences', 'listStylesInDatabase', 'getStyleFromDatabase', 'deleteStyleFromDatabase', 'saveStyleToDatabase', 'loadNamedStyle', 'error', 'metadataUri', 'saveDefaultMetadata', 'loadNamedMetadata', 'loadDefaultMetadata', 'styleURI', 'loadDefaultStyle', 'loadNamedStyleFromDatabase', 'importNamedStyle', 'exportNamedStyle', 'exportSldStyle', 'exportSldStyleV2', 'exportSldStyleV3', 'saveDefaultStyle', 'saveNamedStyle', 'saveSldStyle', 'saveSldStyleV2', 'loadSldStyle', 'readSld', 'readSymbology', 'readStyle', 'writeSymbology', 'writeStyle', 'setMetadata', 'htmlMetadata', 'timestamp', 'dependencies', 'accept', 'selectionProperties', 'temporalProperties', 'elevationProperties', 'profileSource', 'hasMapTips', 'setDependencies', 'setExtent', 'setExtent3D', 'readXml', 'writeXml', 'encodedSource', 'decodedSource']
|
||||
QgsMapLayer.__abstract_methods__ = ['clone', 'createMapRenderer', 'readSymbology', 'writeSymbology', 'setTransformContext']
|
||||
QgsMapLayer.__signal_arguments__ = {'beforeResolveReferences': ['project: QgsProject'], 'statusChanged': ['status: str'], 'idChanged': ['id: str'], 'repaintRequested': ['deferredUpdate: bool = False'], 'blendModeChanged': ['blendMode: QPainter.CompositionMode'], 'opacityChanged': ['opacity: float'], 'autoRefreshIntervalChanged': ['interval: int'], 'styleLoaded': ['categories: QgsMapLayer.StyleCategories'], 'customPropertyChanged': ['key: str']}
|
||||
except (NameError, AttributeError):
|
||||
|
@ -9,7 +9,7 @@ except (NameError, AttributeError):
|
||||
try:
|
||||
QgsMeshLayer.__attribute_docs__ = {'activeScalarDatasetGroupChanged': 'Emitted when active scalar group dataset is changed\n\n.. versionadded:: 3.14\n', 'activeVectorDatasetGroupChanged': 'Emitted when active vector group dataset is changed\n\n.. versionadded:: 3.14\n', 'timeSettingsChanged': 'Emitted when time format is changed\n\n.. versionadded:: 3.8\n', 'reloaded': 'Emitted when the mesh layer is reloaded, see\n:py:func:`~QgsMeshLayer.reload`\n\n.. versionadded:: 3.28\n'}
|
||||
QgsMeshLayer.__virtual_methods__ = ['loadDefaultStyle']
|
||||
QgsMeshLayer.__overridden_methods__ = ['dataProvider', 'clone', 'extent', 'createMapRenderer', 'createProfileGenerator', 'readSymbology', 'writeSymbology', 'writeStyle', 'readStyle', 'encodedSource', 'decodedSource', 'readXml', 'writeXml', 'temporalProperties', 'elevationProperties', 'reload', 'subLayers', 'htmlMetadata', 'isEditable', 'supportsEditing', 'isModified', 'setTransformContext']
|
||||
QgsMeshLayer.__overridden_methods__ = ['dataProvider', 'clone', 'extent', 'createMapRenderer', 'profileSource', 'createProfileGenerator', 'readSymbology', 'writeSymbology', 'writeStyle', 'readStyle', 'encodedSource', 'decodedSource', 'readXml', 'writeXml', 'temporalProperties', 'elevationProperties', 'reload', 'subLayers', 'htmlMetadata', 'isEditable', 'supportsEditing', 'isModified', 'setTransformContext']
|
||||
QgsMeshLayer.__signal_arguments__ = {'activeScalarDatasetGroupChanged': ['index: int'], 'activeVectorDatasetGroupChanged': ['index: int']}
|
||||
QgsMeshLayer.__group__ = ['mesh']
|
||||
except (NameError, AttributeError):
|
||||
|
@ -24,7 +24,7 @@ except (NameError, AttributeError):
|
||||
try:
|
||||
QgsPointCloudLayer.__attribute_docs__ = {'subsetStringChanged': "Emitted when the layer's subset string has changed.\n\n.. versionadded:: 3.26\n", 'raiseError': 'Signals an error related to this point cloud layer.\n\n.. versionadded:: 3.26\n', 'statisticsCalculationStateChanged': 'Emitted when statistics calculation state has changed\n\n.. versionadded:: 3.26\n', 'chunkAttributeValuesChanged': 'Emitted when a node gets some attribute values of some points changed\n\n.. versionadded:: 3.42\n'}
|
||||
QgsPointCloudLayer.__virtual_methods__ = ['readStyle', 'writeStyle', 'loadDefaultStyle']
|
||||
QgsPointCloudLayer.__overridden_methods__ = ['clone', 'extent', 'createMapRenderer', 'createProfileGenerator', 'dataProvider', 'supportsEditing', 'isEditable', 'isModified', 'readXml', 'writeXml', 'readSymbology', 'writeSymbology', 'setTransformContext', 'encodedSource', 'decodedSource', 'htmlMetadata', 'elevationProperties']
|
||||
QgsPointCloudLayer.__overridden_methods__ = ['clone', 'extent', 'createMapRenderer', 'profileSource', 'createProfileGenerator', 'dataProvider', 'supportsEditing', 'isEditable', 'isModified', 'readXml', 'writeXml', 'readSymbology', 'writeSymbology', 'setTransformContext', 'encodedSource', 'decodedSource', 'htmlMetadata', 'elevationProperties']
|
||||
QgsPointCloudLayer.__signal_arguments__ = {'raiseError': ['msg: str'], 'statisticsCalculationStateChanged': ['state: QgsPointCloudLayer.PointCloudStatisticsCalculationState'], 'chunkAttributeValuesChanged': ['n: QgsPointCloudNodeId']}
|
||||
QgsPointCloudLayer.__group__ = ['pointcloud']
|
||||
except (NameError, AttributeError):
|
||||
|
@ -5,7 +5,7 @@ try:
|
||||
QgsRasterLayer.isValidRasterFileName = staticmethod(QgsRasterLayer.isValidRasterFileName)
|
||||
QgsRasterLayer.lastModified = staticmethod(QgsRasterLayer.lastModified)
|
||||
QgsRasterLayer.__virtual_methods__ = ['setOpacity', 'opacity', 'subsetString', 'setSubsetString']
|
||||
QgsRasterLayer.__overridden_methods__ = ['clone', 'createProfileGenerator', 'dataProvider', 'reload', 'createMapRenderer', 'isSpatial', 'htmlMetadata', 'properties', 'subLayers', 'setLayerOrder', 'setSubLayerVisibility', 'timestamp', 'accept', 'temporalProperties', 'elevationProperties', 'setTransformContext', 'readSymbology', 'readStyle', 'readXml', 'writeSymbology', 'writeStyle', 'writeXml', 'encodedSource', 'decodedSource']
|
||||
QgsRasterLayer.__overridden_methods__ = ['clone', 'profileSource', 'createProfileGenerator', 'dataProvider', 'reload', 'createMapRenderer', 'isSpatial', 'htmlMetadata', 'properties', 'subLayers', 'setLayerOrder', 'setSubLayerVisibility', 'timestamp', 'accept', 'temporalProperties', 'elevationProperties', 'setTransformContext', 'readSymbology', 'readStyle', 'readXml', 'writeSymbology', 'writeStyle', 'writeXml', 'encodedSource', 'decodedSource']
|
||||
QgsRasterLayer.__group__ = ['raster']
|
||||
except (NameError, AttributeError):
|
||||
pass
|
||||
|
File diff suppressed because one or more lines are too long
@ -132,6 +132,7 @@ connect to and access the data.
|
||||
|
||||
virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) /Factory/;
|
||||
|
||||
virtual QgsAbstractProfileSource *profileSource();
|
||||
virtual QgsAbstractProfileGenerator *createProfileGenerator( const QgsProfileRequest &request ) /Factory/;
|
||||
|
||||
virtual bool readSymbology( const QDomNode &node, QString &errorMessage,
|
||||
|
@ -79,6 +79,7 @@ Constructor - creates a point cloud layer
|
||||
|
||||
virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) /Factory/;
|
||||
|
||||
virtual QgsAbstractProfileSource *profileSource();
|
||||
virtual QgsAbstractProfileGenerator *createProfileGenerator( const QgsProfileRequest &request ) /Factory/;
|
||||
|
||||
|
||||
|
@ -1932,6 +1932,15 @@ depending on the layer type.
|
||||
.. versionadded:: 3.18
|
||||
%End
|
||||
|
||||
|
||||
virtual QgsAbstractProfileSource *profileSource();
|
||||
%Docstring
|
||||
Returns the layer's profile source if it has profile capabilities. This
|
||||
may be ``None``, depending on the layer type.
|
||||
|
||||
.. versionadded:: 3.44
|
||||
%End
|
||||
|
||||
QString legendPlaceholderImage() const;
|
||||
%Docstring
|
||||
Returns path to the placeholder image or an empty string if a generated
|
||||
|
@ -106,6 +106,8 @@ for the same data source and renderer is cloned too.
|
||||
:return: a new layer instance
|
||||
%End
|
||||
|
||||
virtual QgsAbstractProfileSource *profileSource();
|
||||
|
||||
virtual QgsAbstractProfileGenerator *createProfileGenerator( const QgsProfileRequest &request ) /Factory/;
|
||||
|
||||
|
||||
|
@ -545,6 +545,7 @@ string. Uses :py:class:`QgsExpression`
|
||||
|
||||
virtual QgsMapLayerElevationProperties *elevationProperties();
|
||||
|
||||
virtual QgsAbstractProfileSource *profileSource();
|
||||
virtual QgsAbstractProfileGenerator *createProfileGenerator( const QgsProfileRequest &request ) /Factory/;
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ try:
|
||||
QgsMapLayer.formatLayerName = staticmethod(QgsMapLayer.formatLayerName)
|
||||
QgsMapLayer.generateId = staticmethod(QgsMapLayer.generateId)
|
||||
QgsMapLayer.providerReadFlags = staticmethod(QgsMapLayer.providerReadFlags)
|
||||
QgsMapLayer.__virtual_methods__ = ['properties', 'dataProvider', 'setOpacity', 'opacity', 'reload', 'extent', 'extent3D', 'subLayers', 'setLayerOrder', 'setSubLayerVisibility', 'supportsEditing', 'isEditable', 'isModified', 'isSpatial', 'isTemporary', 'resolveReferences', 'listStylesInDatabase', 'getStyleFromDatabase', 'deleteStyleFromDatabase', 'saveStyleToDatabase', 'loadNamedStyle', 'error', 'metadataUri', 'saveDefaultMetadata', 'loadNamedMetadata', 'loadDefaultMetadata', 'styleURI', 'loadDefaultStyle', 'loadNamedStyleFromDatabase', 'importNamedStyle', 'exportNamedStyle', 'exportSldStyle', 'exportSldStyleV2', 'exportSldStyleV3', 'saveDefaultStyle', 'saveNamedStyle', 'saveSldStyle', 'saveSldStyleV2', 'loadSldStyle', 'readSld', 'readSymbology', 'readStyle', 'writeSymbology', 'writeStyle', 'setMetadata', 'htmlMetadata', 'timestamp', 'dependencies', 'accept', 'selectionProperties', 'temporalProperties', 'elevationProperties', 'hasMapTips', 'setDependencies', 'setExtent', 'setExtent3D', 'readXml', 'writeXml', 'encodedSource', 'decodedSource']
|
||||
QgsMapLayer.__virtual_methods__ = ['properties', 'dataProvider', 'setOpacity', 'opacity', 'reload', 'extent', 'extent3D', 'subLayers', 'setLayerOrder', 'setSubLayerVisibility', 'supportsEditing', 'isEditable', 'isModified', 'isSpatial', 'isTemporary', 'resolveReferences', 'listStylesInDatabase', 'getStyleFromDatabase', 'deleteStyleFromDatabase', 'saveStyleToDatabase', 'loadNamedStyle', 'error', 'metadataUri', 'saveDefaultMetadata', 'loadNamedMetadata', 'loadDefaultMetadata', 'styleURI', 'loadDefaultStyle', 'loadNamedStyleFromDatabase', 'importNamedStyle', 'exportNamedStyle', 'exportSldStyle', 'exportSldStyleV2', 'exportSldStyleV3', 'saveDefaultStyle', 'saveNamedStyle', 'saveSldStyle', 'saveSldStyleV2', 'loadSldStyle', 'readSld', 'readSymbology', 'readStyle', 'writeSymbology', 'writeStyle', 'setMetadata', 'htmlMetadata', 'timestamp', 'dependencies', 'accept', 'selectionProperties', 'temporalProperties', 'elevationProperties', 'profileSource', 'hasMapTips', 'setDependencies', 'setExtent', 'setExtent3D', 'readXml', 'writeXml', 'encodedSource', 'decodedSource']
|
||||
QgsMapLayer.__abstract_methods__ = ['clone', 'createMapRenderer', 'readSymbology', 'writeSymbology', 'setTransformContext']
|
||||
QgsMapLayer.__signal_arguments__ = {'beforeResolveReferences': ['project: QgsProject'], 'statusChanged': ['status: str'], 'idChanged': ['id: str'], 'repaintRequested': ['deferredUpdate: bool = False'], 'blendModeChanged': ['blendMode: QPainter.CompositionMode'], 'opacityChanged': ['opacity: float'], 'autoRefreshIntervalChanged': ['interval: int'], 'styleLoaded': ['categories: QgsMapLayer.StyleCategories'], 'customPropertyChanged': ['key: str']}
|
||||
except (NameError, AttributeError):
|
||||
|
@ -9,7 +9,7 @@ except (NameError, AttributeError):
|
||||
try:
|
||||
QgsMeshLayer.__attribute_docs__ = {'activeScalarDatasetGroupChanged': 'Emitted when active scalar group dataset is changed\n\n.. versionadded:: 3.14\n', 'activeVectorDatasetGroupChanged': 'Emitted when active vector group dataset is changed\n\n.. versionadded:: 3.14\n', 'timeSettingsChanged': 'Emitted when time format is changed\n\n.. versionadded:: 3.8\n', 'reloaded': 'Emitted when the mesh layer is reloaded, see\n:py:func:`~QgsMeshLayer.reload`\n\n.. versionadded:: 3.28\n'}
|
||||
QgsMeshLayer.__virtual_methods__ = ['loadDefaultStyle']
|
||||
QgsMeshLayer.__overridden_methods__ = ['dataProvider', 'clone', 'extent', 'createMapRenderer', 'createProfileGenerator', 'readSymbology', 'writeSymbology', 'writeStyle', 'readStyle', 'encodedSource', 'decodedSource', 'readXml', 'writeXml', 'temporalProperties', 'elevationProperties', 'reload', 'subLayers', 'htmlMetadata', 'isEditable', 'supportsEditing', 'isModified', 'setTransformContext']
|
||||
QgsMeshLayer.__overridden_methods__ = ['dataProvider', 'clone', 'extent', 'createMapRenderer', 'profileSource', 'createProfileGenerator', 'readSymbology', 'writeSymbology', 'writeStyle', 'readStyle', 'encodedSource', 'decodedSource', 'readXml', 'writeXml', 'temporalProperties', 'elevationProperties', 'reload', 'subLayers', 'htmlMetadata', 'isEditable', 'supportsEditing', 'isModified', 'setTransformContext']
|
||||
QgsMeshLayer.__signal_arguments__ = {'activeScalarDatasetGroupChanged': ['index: int'], 'activeVectorDatasetGroupChanged': ['index: int']}
|
||||
QgsMeshLayer.__group__ = ['mesh']
|
||||
except (NameError, AttributeError):
|
||||
|
@ -24,7 +24,7 @@ except (NameError, AttributeError):
|
||||
try:
|
||||
QgsPointCloudLayer.__attribute_docs__ = {'subsetStringChanged': "Emitted when the layer's subset string has changed.\n\n.. versionadded:: 3.26\n", 'raiseError': 'Signals an error related to this point cloud layer.\n\n.. versionadded:: 3.26\n', 'statisticsCalculationStateChanged': 'Emitted when statistics calculation state has changed\n\n.. versionadded:: 3.26\n', 'chunkAttributeValuesChanged': 'Emitted when a node gets some attribute values of some points changed\n\n.. versionadded:: 3.42\n'}
|
||||
QgsPointCloudLayer.__virtual_methods__ = ['readStyle', 'writeStyle', 'loadDefaultStyle']
|
||||
QgsPointCloudLayer.__overridden_methods__ = ['clone', 'extent', 'createMapRenderer', 'createProfileGenerator', 'dataProvider', 'supportsEditing', 'isEditable', 'isModified', 'readXml', 'writeXml', 'readSymbology', 'writeSymbology', 'setTransformContext', 'encodedSource', 'decodedSource', 'htmlMetadata', 'elevationProperties']
|
||||
QgsPointCloudLayer.__overridden_methods__ = ['clone', 'extent', 'createMapRenderer', 'profileSource', 'createProfileGenerator', 'dataProvider', 'supportsEditing', 'isEditable', 'isModified', 'readXml', 'writeXml', 'readSymbology', 'writeSymbology', 'setTransformContext', 'encodedSource', 'decodedSource', 'htmlMetadata', 'elevationProperties']
|
||||
QgsPointCloudLayer.__signal_arguments__ = {'raiseError': ['msg: str'], 'statisticsCalculationStateChanged': ['state: QgsPointCloudLayer.PointCloudStatisticsCalculationState'], 'chunkAttributeValuesChanged': ['n: QgsPointCloudNodeId']}
|
||||
QgsPointCloudLayer.__group__ = ['pointcloud']
|
||||
except (NameError, AttributeError):
|
||||
|
@ -5,7 +5,7 @@ try:
|
||||
QgsRasterLayer.isValidRasterFileName = staticmethod(QgsRasterLayer.isValidRasterFileName)
|
||||
QgsRasterLayer.lastModified = staticmethod(QgsRasterLayer.lastModified)
|
||||
QgsRasterLayer.__virtual_methods__ = ['setOpacity', 'opacity', 'subsetString', 'setSubsetString']
|
||||
QgsRasterLayer.__overridden_methods__ = ['clone', 'createProfileGenerator', 'dataProvider', 'reload', 'createMapRenderer', 'isSpatial', 'htmlMetadata', 'properties', 'subLayers', 'setLayerOrder', 'setSubLayerVisibility', 'timestamp', 'accept', 'temporalProperties', 'elevationProperties', 'setTransformContext', 'readSymbology', 'readStyle', 'readXml', 'writeSymbology', 'writeStyle', 'writeXml', 'encodedSource', 'decodedSource']
|
||||
QgsRasterLayer.__overridden_methods__ = ['clone', 'profileSource', 'createProfileGenerator', 'dataProvider', 'reload', 'createMapRenderer', 'isSpatial', 'htmlMetadata', 'properties', 'subLayers', 'setLayerOrder', 'setSubLayerVisibility', 'timestamp', 'accept', 'temporalProperties', 'elevationProperties', 'setTransformContext', 'readSymbology', 'readStyle', 'readXml', 'writeSymbology', 'writeStyle', 'writeXml', 'encodedSource', 'decodedSource']
|
||||
QgsRasterLayer.__group__ = ['raster']
|
||||
except (NameError, AttributeError):
|
||||
pass
|
||||
|
File diff suppressed because one or more lines are too long
@ -132,6 +132,7 @@ connect to and access the data.
|
||||
|
||||
virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) /Factory/;
|
||||
|
||||
virtual QgsAbstractProfileSource *profileSource();
|
||||
virtual QgsAbstractProfileGenerator *createProfileGenerator( const QgsProfileRequest &request ) /Factory/;
|
||||
|
||||
virtual bool readSymbology( const QDomNode &node, QString &errorMessage,
|
||||
|
@ -79,6 +79,7 @@ Constructor - creates a point cloud layer
|
||||
|
||||
virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) /Factory/;
|
||||
|
||||
virtual QgsAbstractProfileSource *profileSource();
|
||||
virtual QgsAbstractProfileGenerator *createProfileGenerator( const QgsProfileRequest &request ) /Factory/;
|
||||
|
||||
|
||||
|
@ -1932,6 +1932,15 @@ depending on the layer type.
|
||||
.. versionadded:: 3.18
|
||||
%End
|
||||
|
||||
|
||||
virtual QgsAbstractProfileSource *profileSource();
|
||||
%Docstring
|
||||
Returns the layer's profile source if it has profile capabilities. This
|
||||
may be ``None``, depending on the layer type.
|
||||
|
||||
.. versionadded:: 3.44
|
||||
%End
|
||||
|
||||
QString legendPlaceholderImage() const;
|
||||
%Docstring
|
||||
Returns path to the placeholder image or an empty string if a generated
|
||||
|
@ -106,6 +106,8 @@ for the same data source and renderer is cloned too.
|
||||
:return: a new layer instance
|
||||
%End
|
||||
|
||||
virtual QgsAbstractProfileSource *profileSource();
|
||||
|
||||
virtual QgsAbstractProfileGenerator *createProfileGenerator( const QgsProfileRequest &request ) /Factory/;
|
||||
|
||||
|
||||
|
@ -545,6 +545,7 @@ string. Uses :py:class:`QgsExpression`
|
||||
|
||||
virtual QgsMapLayerElevationProperties *elevationProperties();
|
||||
|
||||
virtual QgsAbstractProfileSource *profileSource();
|
||||
virtual QgsAbstractProfileGenerator *createProfileGenerator( const QgsProfileRequest &request ) /Factory/;
|
||||
|
||||
|
||||
|
@ -180,7 +180,7 @@ bool QgsGenerateElevationProfileAlgorithm::prepareAlgorithm( const QVariantMap &
|
||||
QList<QgsAbstractProfileSource *> sources;
|
||||
for ( QgsMapLayer *layer : layers )
|
||||
{
|
||||
if ( QgsAbstractProfileSource *source = dynamic_cast<QgsAbstractProfileSource *>( layer ) )
|
||||
if ( QgsAbstractProfileSource *source = layer->profileSource() )
|
||||
sources.append( source );
|
||||
}
|
||||
|
||||
|
@ -921,7 +921,7 @@ void QgsElevationProfileWidget::exportResults( Qgis::ProfileExportType type )
|
||||
sources << registrySources;
|
||||
for ( QgsMapLayer *layer : layersToGenerate )
|
||||
{
|
||||
if ( QgsAbstractProfileSource *source = dynamic_cast<QgsAbstractProfileSource *>( layer ) )
|
||||
if ( QgsAbstractProfileSource *source = layer->profileSource() )
|
||||
sources.append( source );
|
||||
}
|
||||
|
||||
|
@ -685,7 +685,7 @@ void QgsLayoutItemElevationProfile::paint( QPainter *painter, const QStyleOption
|
||||
sources << QgsApplication::profileSourceRegistry()->profileSources();
|
||||
for ( const QgsMapLayerRef &layer : std::as_const( mLayers ) )
|
||||
{
|
||||
if ( QgsAbstractProfileSource *source = dynamic_cast< QgsAbstractProfileSource * >( layer.get() ) )
|
||||
if ( QgsAbstractProfileSource *source = layer->profileSource() )
|
||||
sources.append( source );
|
||||
}
|
||||
|
||||
@ -740,7 +740,7 @@ void QgsLayoutItemElevationProfile::paint( QPainter *painter, const QStyleOption
|
||||
sources << QgsApplication::profileSourceRegistry()->profileSources();
|
||||
for ( const QgsMapLayerRef &layer : std::as_const( mLayers ) )
|
||||
{
|
||||
if ( QgsAbstractProfileSource *source = dynamic_cast< QgsAbstractProfileSource * >( layer.get() ) )
|
||||
if ( QgsAbstractProfileSource *source = layer->profileSource() )
|
||||
sources.append( source );
|
||||
}
|
||||
|
||||
@ -997,7 +997,7 @@ void QgsLayoutItemElevationProfile::recreateCachedImageInBackground()
|
||||
sources << QgsApplication::profileSourceRegistry()->profileSources();
|
||||
for ( const QgsMapLayerRef &layer : std::as_const( mLayers ) )
|
||||
{
|
||||
if ( QgsAbstractProfileSource *source = dynamic_cast< QgsAbstractProfileSource * >( layer.get() ) )
|
||||
if ( QgsAbstractProfileSource *source = layer->profileSource() )
|
||||
sources.append( source );
|
||||
}
|
||||
|
||||
|
@ -177,6 +177,7 @@ class CORE_EXPORT QgsMeshLayer : public QgsMapLayer, public QgsAbstractProfileSo
|
||||
QgsMeshLayer *clone() const override SIP_FACTORY;
|
||||
QgsRectangle extent() const override;
|
||||
QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY;
|
||||
QgsAbstractProfileSource *profileSource() override {return this;}
|
||||
QgsAbstractProfileGenerator *createProfileGenerator( const QgsProfileRequest &request ) override SIP_FACTORY;
|
||||
bool readSymbology( const QDomNode &node, QString &errorMessage,
|
||||
QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) override;
|
||||
|
@ -130,6 +130,7 @@ class CORE_EXPORT QgsPointCloudLayer : public QgsMapLayer, public QgsAbstractPro
|
||||
QgsPointCloudLayer *clone() const override SIP_FACTORY;
|
||||
QgsRectangle extent() const override;
|
||||
QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY;
|
||||
QgsAbstractProfileSource *profileSource() override {return this;}
|
||||
QgsAbstractProfileGenerator *createProfileGenerator( const QgsProfileRequest &request ) override SIP_FACTORY;
|
||||
|
||||
QgsPointCloudDataProvider *dataProvider() override;
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "qgslogger.h"
|
||||
|
||||
class QgsAbstract3DRenderer;
|
||||
class QgsAbstractProfileSource;
|
||||
class QgsDataProvider;
|
||||
class QgsMapLayerLegend;
|
||||
class QgsMapLayerRenderer;
|
||||
@ -1802,6 +1803,14 @@ class CORE_EXPORT QgsMapLayer : public QObject
|
||||
*/
|
||||
virtual QgsMapLayerElevationProperties *elevationProperties() { return nullptr; }
|
||||
|
||||
|
||||
/**
|
||||
* Returns the layer's profile source if it has profile capabilities. This may be NULLPTR, depending on the layer type.
|
||||
*
|
||||
* \since QGIS 3.44
|
||||
*/
|
||||
virtual QgsAbstractProfileSource *profileSource() { return nullptr; }
|
||||
|
||||
/**
|
||||
* Returns path to the placeholder image or an empty string if a generated legend is shown
|
||||
* \return placeholder image path
|
||||
|
@ -183,6 +183,8 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer, public QgsAbstractProfile
|
||||
*/
|
||||
QgsRasterLayer *clone() const override SIP_FACTORY;
|
||||
|
||||
QgsAbstractProfileSource *profileSource() override {return this;}
|
||||
|
||||
QgsAbstractProfileGenerator *createProfileGenerator( const QgsProfileRequest &request ) override SIP_FACTORY;
|
||||
|
||||
/**
|
||||
|
@ -668,6 +668,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
|
||||
QgsMapLayerSelectionProperties *selectionProperties() override;
|
||||
QgsMapLayerTemporalProperties *temporalProperties() override;
|
||||
QgsMapLayerElevationProperties *elevationProperties() override;
|
||||
QgsAbstractProfileSource *profileSource() override {return this;}
|
||||
QgsAbstractProfileGenerator *createProfileGenerator( const QgsProfileRequest &request ) override SIP_FACTORY;
|
||||
|
||||
/**
|
||||
|
@ -886,7 +886,7 @@ void QgsElevationProfileCanvas::refresh()
|
||||
sources << registrySources;
|
||||
for ( QgsMapLayer *layer : layersToGenerate )
|
||||
{
|
||||
if ( QgsAbstractProfileSource *source = dynamic_cast<QgsAbstractProfileSource *>( layer ) )
|
||||
if ( QgsAbstractProfileSource *source = layer->profileSource() )
|
||||
sources.append( source );
|
||||
}
|
||||
|
||||
@ -957,7 +957,7 @@ void QgsElevationProfileCanvas::onLayerProfileGenerationPropertyChanged()
|
||||
|
||||
if ( QgsMapLayer *layer = qobject_cast<QgsMapLayer *>( properties->parent() ) )
|
||||
{
|
||||
if ( QgsAbstractProfileSource *source = dynamic_cast<QgsAbstractProfileSource *>( layer ) )
|
||||
if ( QgsAbstractProfileSource *source = layer->profileSource() )
|
||||
{
|
||||
if ( mCurrentJob->invalidateResults( source ) )
|
||||
scheduleDeferredRegeneration();
|
||||
@ -977,7 +977,7 @@ void QgsElevationProfileCanvas::onLayerProfileRendererPropertyChanged()
|
||||
|
||||
if ( QgsMapLayer *layer = qobject_cast<QgsMapLayer *>( properties->parent() ) )
|
||||
{
|
||||
if ( QgsAbstractProfileSource *source = dynamic_cast<QgsAbstractProfileSource *>( layer ) )
|
||||
if ( QgsAbstractProfileSource *source = layer->profileSource() )
|
||||
{
|
||||
mCurrentJob->replaceSource( source );
|
||||
}
|
||||
@ -993,7 +993,7 @@ void QgsElevationProfileCanvas::regenerateResultsForLayer()
|
||||
|
||||
if ( QgsMapLayer *layer = qobject_cast<QgsMapLayer *>( sender() ) )
|
||||
{
|
||||
if ( QgsAbstractProfileSource *source = dynamic_cast<QgsAbstractProfileSource *>( layer ) )
|
||||
if ( QgsAbstractProfileSource *source = layer->profileSource() )
|
||||
{
|
||||
if ( mCurrentJob->invalidateResults( source ) )
|
||||
scheduleDeferredRegeneration();
|
||||
|
@ -268,7 +268,7 @@ void QgsQuickElevationProfileCanvas::refresh()
|
||||
sources.reserve( layersToGenerate.size() );
|
||||
for ( QgsMapLayer *layer : layersToGenerate )
|
||||
{
|
||||
if ( QgsAbstractProfileSource *source = dynamic_cast<QgsAbstractProfileSource *>( layer ) )
|
||||
if ( QgsAbstractProfileSource *source = layer->profileSource() )
|
||||
sources.append( source );
|
||||
}
|
||||
|
||||
@ -347,7 +347,7 @@ void QgsQuickElevationProfileCanvas::onLayerProfileGenerationPropertyChanged()
|
||||
|
||||
if ( QgsMapLayer *layer = qobject_cast<QgsMapLayer *>( properties->parent() ) )
|
||||
{
|
||||
if ( QgsAbstractProfileSource *source = dynamic_cast<QgsAbstractProfileSource *>( layer ) )
|
||||
if ( QgsAbstractProfileSource *source = layer->profileSource() )
|
||||
{
|
||||
if ( mCurrentJob->invalidateResults( source ) )
|
||||
scheduleDeferredRegeneration();
|
||||
@ -367,7 +367,7 @@ void QgsQuickElevationProfileCanvas::onLayerProfileRendererPropertyChanged()
|
||||
|
||||
if ( QgsMapLayer *layer = qobject_cast<QgsMapLayer *>( properties->parent() ) )
|
||||
{
|
||||
if ( QgsAbstractProfileSource *source = dynamic_cast<QgsAbstractProfileSource *>( layer ) )
|
||||
if ( QgsAbstractProfileSource *source = layer->profileSource() )
|
||||
{
|
||||
mCurrentJob->replaceSource( source );
|
||||
}
|
||||
@ -383,7 +383,7 @@ void QgsQuickElevationProfileCanvas::regenerateResultsForLayer()
|
||||
|
||||
if ( QgsMapLayer *layer = qobject_cast<QgsMapLayer *>( sender() ) )
|
||||
{
|
||||
if ( QgsAbstractProfileSource *source = dynamic_cast<QgsAbstractProfileSource *>( layer ) )
|
||||
if ( QgsAbstractProfileSource *source = layer->profileSource() )
|
||||
{
|
||||
if ( mCurrentJob->invalidateResults( source ) )
|
||||
scheduleDeferredRegeneration();
|
||||
|
Loading…
x
Reference in New Issue
Block a user