Skip to content
Permalink
Browse files

Add a trigger3DUpdate method to QgsMapLayer so that an explicit updat…

…e of the layer in 3d maps can be requested

This is the 3d equivalent of QgsMapLayer::triggerUpdate()
  • Loading branch information
nyalldawson committed Dec 16, 2020
1 parent 1963ef9 commit 9fc11d93c71618a06416593fd0d79b9bf57d7a5a
Showing with 38 additions and 2 deletions.
  1. +15 −0 python/core/auto_generated/qgsmaplayer.sip.in
  2. +2 −2 src/3d/qgs3dmapscene.cpp
  3. +6 −0 src/core/qgsmaplayer.cpp
  4. +15 −0 src/core/qgsmaplayer.h
@@ -1431,6 +1431,14 @@ re-rendered, and will not trigger any canvas redraws itself.
in 2.6 function moved from vector/raster subclasses to QgsMapLayer
%End

void trigger3DUpdate();
%Docstring
Will advise any 3D maps that this layer requires to be updated in the scene.
Will emit a :py:func:`~QgsMapLayer.request3DUpdate` signal.

.. versionadded:: 3.18
%End

void emitStyleChanged();
%Docstring
Triggers an emission of the :py:func:`~QgsMapLayer.styleChanged` signal.
@@ -1576,6 +1584,13 @@ Signal emitted when legend of the layer has changed
Signal emitted when 3D renderer associated with the layer has changed.

.. versionadded:: 3.0
%End

void request3DUpdate();
%Docstring
Signal emitted when a layer requires an update in any 3D maps.

.. versionadded:: 3.18
%End

void configChanged();
@@ -830,7 +830,7 @@ void Qgs3DMapScene::addLayerEntity( QgsMapLayer *layer )
if ( needsSceneUpdate )
onCameraChanged(); // needed for chunked entities

connect( layer, &QgsMapLayer::renderer3DChanged, this, &Qgs3DMapScene::onLayerRenderer3DChanged );
connect( layer, &QgsMapLayer::request3DUpdate, this, &Qgs3DMapScene::onLayerRenderer3DChanged );

if ( layer->type() == QgsMapLayerType::VectorLayer )
{
@@ -858,7 +858,7 @@ void Qgs3DMapScene::removeLayerEntity( QgsMapLayer *layer )
if ( entity )
entity->deleteLater();

disconnect( layer, &QgsMapLayer::renderer3DChanged, this, &Qgs3DMapScene::onLayerRenderer3DChanged );
disconnect( layer, &QgsMapLayer::request3DUpdate, this, &Qgs3DMapScene::onLayerRenderer3DChanged );

if ( layer->type() == QgsMapLayerType::VectorLayer )
{
@@ -1851,6 +1851,7 @@ void QgsMapLayer::setRenderer3D( QgsAbstract3DRenderer *renderer )
delete m3DRenderer;
m3DRenderer = renderer;
emit renderer3DChanged();
trigger3DUpdate();
}

QgsAbstract3DRenderer *QgsMapLayer::renderer3D() const
@@ -1868,6 +1869,11 @@ void QgsMapLayer::triggerRepaint( bool deferredUpdate )
mRepaintRequestedFired = false;
}

void QgsMapLayer::trigger3DUpdate()
{
emit request3DUpdate();
}

void QgsMapLayer::setMetadata( const QgsLayerMetadata &metadata )
{
mMetadata = metadata;
@@ -1280,6 +1280,14 @@ class CORE_EXPORT QgsMapLayer : public QObject
*/
void triggerRepaint( bool deferredUpdate = false );

/**
* Will advise any 3D maps that this layer requires to be updated in the scene.
* Will emit a request3DUpdate() signal.
*
* \since QGIS 3.18
*/
void trigger3DUpdate();

/**
* Triggers an emission of the styleChanged() signal.
* \since QGIS 2.16
@@ -1404,6 +1412,13 @@ class CORE_EXPORT QgsMapLayer : public QObject
*/
void renderer3DChanged();

/**
* Signal emitted when a layer requires an update in any 3D maps.
*
* \since QGIS 3.18
*/
void request3DUpdate();

/**
* Emitted whenever the configuration is changed. The project listens to this signal
* to be marked as dirty.

0 comments on commit 9fc11d9

Please sign in to comment.
You can’t perform that action at this time.