Skip to content
Permalink
Browse files

Add signal for map settings changed.

  • Loading branch information
ismailsunni committed Mar 19, 2020
1 parent b181e53 commit 5c44eea1217c67b4446219469ae64e967c4d8a22
@@ -106,6 +106,8 @@ void Qgs3DMapCanvas::setMap( Qgs3DMapSettings *map )
mNavigationWidget->updateFromCamera();
}
);

emit mapSettingsChanged();
}

QgsCameraController *Qgs3DMapCanvas::cameraController()
@@ -82,6 +82,9 @@ class Qgs3DMapCanvas : public QWidget
//! Emitted when the 3D map canvas was successfully saved as image
void savedAsImage( QString fileName );

//! Emitted when the the map setting is changed
void mapSettingsChanged();

protected:
void resizeEvent( QResizeEvent *ev ) override;
bool eventFilter( QObject *watched, QEvent *event ) override;
@@ -223,10 +223,6 @@ void Qgs3DMapCanvasDockWidget::setMapSettings( Qgs3DMapSettings *map )

connect( mCanvas->scene(), &Qgs3DMapScene::totalPendingJobsCountChanged, this, &Qgs3DMapCanvasDockWidget::onTotalPendingJobsCountChanged );

// Update the connection after the map is updated
mMapToolIdentify->updateSignalSlots();
mMapToolMeasureLine->updateSignalSlots();

mAnimationWidget->setCameraController( mCanvas->scene()->cameraController() );
mAnimationWidget->setMap( map );

@@ -51,7 +51,7 @@ QCursor Qgs3DMapTool::cursor() const
return Qt::CrossCursor;
}

void Qgs3DMapTool::updateSignalSlots()
void Qgs3DMapTool::onMapSettingsChanged()
{

}
@@ -44,8 +44,8 @@ class Qgs3DMapTool : public QObject
//! Mouse cursor to be used when the tool is active
virtual QCursor cursor() const;

//! Update the connection to the map canvas's property (scene, map setting)
virtual void updateSignalSlots();
//! Called when canvas's map setting is changed
virtual void onMapSettingsChanged();

/**
* Whether the default mouse controls to zoom/pan/rotate camera can stay enabled
@@ -17,6 +17,7 @@

#include "qgsapplication.h"
#include "qgs3dmapcanvas.h"
#include "qgs3dmapcanvasdockwidget.h"
#include "qgs3dmapscene.h"
#include "qgs3dutils.h"
#include "qgsterrainentity_p.h"
@@ -64,6 +65,7 @@ Qgs3DMapToolIdentify::Qgs3DMapToolIdentify( Qgs3DMapCanvas *canvas )
: Qgs3DMapTool( canvas )
{
mPickHandler.reset( new Qgs3DMapToolIdentifyPickHandler( this ) );
connect( canvas, &Qgs3DMapCanvas::mapSettingsChanged, this, &Qgs3DMapToolIdentify::onMapSettingsChanged );
}

Qgs3DMapToolIdentify::~Qgs3DMapToolIdentify() = default;
@@ -102,7 +104,7 @@ QCursor Qgs3DMapToolIdentify::cursor() const
return QgsApplication::getThemeCursor( QgsApplication::Cursor::Identify );
}

void Qgs3DMapToolIdentify::updateSignalSlots()
void Qgs3DMapToolIdentify::onMapSettingsChanged()
{
connect( mCanvas->scene(), &Qgs3DMapScene::terrainEntityChanged, this, &Qgs3DMapToolIdentify::onTerrainEntityChanged );
}
@@ -45,7 +45,7 @@ class Qgs3DMapToolIdentify : public Qgs3DMapTool

QCursor cursor() const override;

void updateSignalSlots() override;
void onMapSettingsChanged() override;

private slots:
void onTerrainPicked( Qt3DRender::QPickEvent *event );
@@ -57,6 +57,7 @@ Qgs3DMapToolMeasureLine::Qgs3DMapToolMeasureLine( Qgs3DMapCanvas *canvas )
mDialog->setWindowFlags( mDialog->windowFlags() | Qt::Tool );
mDialog->restorePosition();

connect( canvas, &Qgs3DMapCanvas::mapSettingsChanged, this, &Qgs3DMapToolMeasureLine::onMapSettingsChanged );
}

Qgs3DMapToolMeasureLine::~Qgs3DMapToolMeasureLine() = default;
@@ -121,7 +122,7 @@ QCursor Qgs3DMapToolMeasureLine::cursor() const
return Qt::CrossCursor;
}

void Qgs3DMapToolMeasureLine::updateSignalSlots()
void Qgs3DMapToolMeasureLine::onMapSettingsChanged()
{
connect( mCanvas->scene(), &Qgs3DMapScene::terrainEntityChanged, this, &Qgs3DMapToolMeasureLine::onTerrainEntityChanged );

@@ -67,7 +67,7 @@ class Qgs3DMapToolMeasureLine : public Qgs3DMapTool

QCursor cursor() const override;

void updateSignalSlots() override;
void onMapSettingsChanged() override;

private slots:
void onTerrainPicked( Qt3DRender::QPickEvent *event );

0 comments on commit 5c44eea

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