16#ifndef QGS3DMAPCANVAS_H
17#define QGS3DMAPCANVAS_H
26#include <QtGui/QWindow>
32 class QAbstractAspect;
39 class QFrameGraphNode;
41 class QRenderSettings;
46 class QForwardRenderer;
63class Qgs3DMapSceneEntity;
67class QgsFeature3DHandler;
142 bool crossSectionEnabled()
const;
165 void setRootEntity( Qt3DCore::QEntity *root );
170 void setActiveFrameGraph( Qt3DRender::QFrameGraphNode *activeFrameGraph );
175 Qt3DRender::QFrameGraphNode *activeFrameGraph()
const;
180 Qt3DRender::QCamera *camera()
const;
185 Qt3DRender::QRenderSettings *renderSettings()
const;
194 void setViewFromTop(
const QgsPointXY ¢er,
float distance,
float rotation = 0 );
197 void saveAsImage(
const QString &fileName,
const QString &fileFormat );
217 QVector<QgsPointXY> viewFrustum2DExtent();
272 void captureDepthBuffer();
280 void showEvent( QShowEvent *e )
override;
287 bool eventFilter( QObject *watched, QEvent *event )
override;
291 bool canvasEventFilter( QEvent *event );
294 bool containerEventFilter( QEvent *event );
297 std::unique_ptr<Qt3DCore::QAspectEngine> m_aspectEngine;
300 Qt3DRender::QRenderAspect *m_renderAspect;
301 Qt3DInput::QInputAspect *m_inputAspect;
302 Qt3DLogic::QLogicAspect *m_logicAspect;
305 Qt3DRender::QRenderSettings *m_renderSettings;
306 Qt3DRender::QCamera *m_defaultCamera;
309 Qt3DInput::QInputSettings *m_inputSettings;
312 Qt3DCore::QEntity *m_root;
313 Qt3DCore::QEntity *m_userRoot =
nullptr;
315 bool m_initialized =
false;
327 QString mCaptureFileName;
328 QString mCaptureFileFormat;
332 std::unique_ptr<Qgs3DHighlightFeatureHandler> mHighlightsHandler =
nullptr;
NavigationMode
The navigation mode used by 3D cameras.
Handles the creation of 3D entities used for highlighting identified features.
QgsWindow3DEngine * engine() const
Returns the 3D engine.
Qgs3DMapSettings * mapSettings()
Returns access to the 3D scene configuration.
void mapSettingsChanged()
Emitted when the map setting is changed.
void crossSectionEnabledChanged(bool enabled)
Emitted when the cross section mode is enabled or disabled.
void viewed2DExtentFrom3DChanged(QVector< QgsPointXY > extent)
Emitted when the viewed 2D extent seen by the 3D camera has changed.
Qgs3DMapTool * mapTool() const
Returns the active map tool that will receive events from the 3D canvas.
void mapToolSet(Qgs3DMapTool *newTool, Qgs3DMapTool *oldTool)
Emitted when the map tool is changed from oldTool to newTool Any of those two may be nullptr if there...
void fpsCountChanged(float fpsCount)
Emitted when the FPS count changes (at most every frame).
void showEvent(QShowEvent *e) override
Manages the display events specified in e.
QgsCrossSection crossSection() const
Returns the current cross section definition for the 3D map canvas.
void cameraNavigationSpeedChanged(double speed)
Emitted when the camera navigation speed is changed.
Qgs3DMapScene * scene()
Returns access to the 3D scene (root 3D entity).
void resizeEvent(QResizeEvent *) override
Resets the aspect ratio of the 3D window.
void highlightFeature(const QgsFeature &feature, QgsMapLayer *layer)
Add a highlight 3d entity for feature of layer.
void savedAsImage(const QString &fileName)
Emitted when the 3D map canvas was successfully saved as image.
void clearHighlights()
Removes all highlight entities.
void fpsCounterEnabledChanged(bool enabled)
Emitted when the FPS counter is enabled or disabeld.
bool eventFilter(QObject *watched, QEvent *event) override
Entity that encapsulates our 3D scene - contains all other entities (such as terrain) as children.
Object that controls camera movement based on user input.
Encapsulates the definition of a cross section in 3D map coordinates.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Base class for all map layer types.
Responsible for defining parameters of the ray casting operations in 3D map canvases.
Contains the results of ray casting operations in a 3D map canvas.
A rectangle specified with double values.
A controller base class for temporal objects, contains a signal for notifying updates of the objects ...
On-screen 3D engine: it creates an OpenGL window (QWindow) and displays rendered 3D scenes there.
QgsTemporalRange< QDateTime > QgsDateTimeRange
QgsRange which stores a range of date times.