Skip to content
Permalink
Browse files

Merge pull request #35096 from ismailsunni/fix_critical_warning_35078

[3d] Fix connection issues
  • Loading branch information
m-kuhn committed Mar 26, 2020
2 parents 7248c43 + e7f4e00 commit f282a0487f6ab680f1793cd64aa8fe8fae0b843a
@@ -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;
@@ -51,6 +51,11 @@ QCursor Qgs3DMapTool::cursor() const
return Qt::CrossCursor;
}

void Qgs3DMapTool::onMapSettingsChanged()
{

}

Qgs3DMapCanvas *Qgs3DMapTool::canvas()
{
return mCanvas;
@@ -54,6 +54,10 @@ class Qgs3DMapTool : public QObject

Qgs3DMapCanvas *canvas();

private slots:
//! Called when canvas's map setting is changed
virtual void onMapSettingsChanged();

protected:
Qgs3DMapCanvas *mCanvas = nullptr;
};
@@ -17,6 +17,7 @@

#include "qgsapplication.h"
#include "qgs3dmapcanvas.h"
#include "qgs3dmapcanvasdockwidget.h"
#include "qgs3dmapscene.h"
#include "qgs3dutils.h"
#include "qgsterrainentity_p.h"
@@ -63,9 +64,8 @@ void Qgs3DMapToolIdentifyPickHandler::handlePickOnVectorLayer( QgsVectorLayer *v
Qgs3DMapToolIdentify::Qgs3DMapToolIdentify( Qgs3DMapCanvas *canvas )
: Qgs3DMapTool( canvas )
{
connect( mCanvas->scene(), &Qgs3DMapScene::terrainEntityChanged, this, &Qgs3DMapToolIdentify::onTerrainEntityChanged );

mPickHandler.reset( new Qgs3DMapToolIdentifyPickHandler( this ) );
connect( canvas, &Qgs3DMapCanvas::mapSettingsChanged, this, &Qgs3DMapToolIdentify::onMapSettingsChanged );
}

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

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

void Qgs3DMapToolIdentify::onTerrainPicked( Qt3DRender::QPickEvent *event )
{
if ( event->button() != Qt3DRender::QPickEvent::LeftButton )
@@ -48,6 +48,7 @@ class Qgs3DMapToolIdentify : public Qgs3DMapTool
private slots:
void onTerrainPicked( Qt3DRender::QPickEvent *event );
void onTerrainEntityChanged();
void onMapSettingsChanged() override;

private:
std::unique_ptr<Qgs3DMapToolIdentifyPickHandler> mPickHandler;
@@ -50,16 +50,14 @@ void Qgs3DMapToolMeasureLinePickHandler::handlePickOnVectorLayer( QgsVectorLayer
Qgs3DMapToolMeasureLine::Qgs3DMapToolMeasureLine( Qgs3DMapCanvas *canvas )
: Qgs3DMapTool( canvas )
{
connect( mCanvas->scene(), &Qgs3DMapScene::terrainEntityChanged, this, &Qgs3DMapToolMeasureLine::onTerrainEntityChanged );
mPickHandler.reset( new Qgs3DMapToolMeasureLinePickHandler( this ) );

// Dialog
mDialog = new Qgs3DMeasureDialog( this );
mDialog->setWindowFlags( mDialog->windowFlags() | Qt::Tool );
mDialog->restorePosition();

// Update scale if the terrain vertical scale changed
connect( mCanvas->map(), &Qgs3DMapSettings::terrainVerticalScaleChanged, this, &Qgs3DMapToolMeasureLine::updateMeasurementLayer );
connect( canvas, &Qgs3DMapCanvas::mapSettingsChanged, this, &Qgs3DMapToolMeasureLine::onMapSettingsChanged );
}

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

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

// Update scale if the terrain vertical scale changed
connect( mCanvas->map(), &Qgs3DMapSettings::terrainVerticalScaleChanged, this, &Qgs3DMapToolMeasureLine::updateMeasurementLayer );
}

void Qgs3DMapToolMeasureLine::onTerrainPicked( Qt3DRender::QPickEvent *event )
{
handleClick( event, event->worldIntersection() );
@@ -71,6 +71,7 @@ class Qgs3DMapToolMeasureLine : public Qgs3DMapTool
void onTerrainPicked( Qt3DRender::QPickEvent *event );
void onTerrainEntityChanged();
void handleClick( Qt3DRender::QPickEvent *event, const QgsVector3D &worldIntersection );
void onMapSettingsChanged() override;

private:
std::unique_ptr<Qgs3DMapToolMeasureLinePickHandler> mPickHandler;

0 comments on commit f282a04

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