16 #ifndef QGS3DMAPSETTINGS_H
17 #define QGS3DMAPSETTINGS_H
24 #include <Qt3DRender/QCamera>
73 void resolveReferences(
const QgsProject &project );
152 void setBackgroundColor(
const QColor &color );
154 QColor backgroundColor()
const;
157 void setSelectionColor(
const QColor &color );
159 QColor selectionColor()
const;
172 void setLayers(
const QList<QgsMapLayer *> &layers );
185 QList<QgsMapLayer *> layers()
const;
203 void setTerrainLayers(
const QList<QgsMapLayer *> &layers );
217 QList<QgsMapLayer *> terrainLayers()
const;
223 void setTerrainVerticalScale(
double zScale );
225 double terrainVerticalScale()
const;
231 void setMapTileResolution(
int res );
237 int mapTileResolution()
const;
243 void setMaxTerrainScreenError(
float error );
252 float maxTerrainScreenError()
const;
258 void setMaxTerrainGroundError(
float error );
266 float maxTerrainGroundError()
const;
273 void setTerrainElevationOffset(
float offset );
293 void setTerrainShadingEnabled(
bool enabled );
322 void setTerrainMapTheme(
const QString &theme );
337 void setRenderers(
const QList<QgsAbstract3DRenderer *> &renderers
SIP_TRANSFER );
339 QList<QgsAbstract3DRenderer *>
renderers()
const {
return mRenderers; }
342 void setShowTerrainBoundingBoxes(
bool enabled );
346 void setShowTerrainTilesInfo(
bool enabled );
354 void setShowCameraViewCenter(
bool enabled );
366 void setShowLightSourceOrigins(
bool enabled );
375 void setShowLabels(
bool enabled );
384 void setEyeDomeLightingEnabled(
bool enabled );
393 void setEyeDomeLightingStrength(
double strength );
402 void setEyeDomeLightingDistance(
int distance );
411 void setDebugShadowMapSettings(
bool enabled, Qt::Corner corner,
double size );
424 void setDebugDepthMapSettings(
bool enabled, Qt::Corner corner,
double size );
436 QList<QgsPointLightSettings>
pointLights()
const {
return mPointLights; }
448 void setPointLights(
const QList<QgsPointLightSettings> &pointLights );
454 void setDirectionalLights(
const QList<QgsDirectionalLightSettings> &directionalLights );
466 void setFieldOfView(
const float fieldOfView );
478 void setProjectionType(
const Qt3DRender::QCameraLens::ProjectionType projectionType )
SIP_SKIP;
505 void setCameraMovementSpeed(
double movementSpeed );
572 void setIsFpsCounterEnabled(
bool fpsCounterEnabled );
749 QColor mBackgroundColor = Qt::black;
750 QColor mSelectionColor;
751 double mTerrainVerticalScale = 1;
752 std::unique_ptr<QgsTerrainGenerator> mTerrainGenerator;
753 int mMapTileResolution = 512;
754 float mMaxTerrainScreenError = 3.f;
755 float mMaxTerrainGroundError = 1.f;
756 float mTerrainElevationOffset = 0.0f;
757 bool mTerrainShadingEnabled =
false;
759 QString mTerrainMapTheme;
760 bool mShowTerrainBoundingBoxes =
false;
761 bool mShowTerrainTileInfo =
false;
762 bool mShowCameraViewCenter =
false;
763 bool mShowLightSources =
false;
764 bool mShowLabels =
false;
765 QList<QgsPointLightSettings> mPointLights;
766 QList<QgsDirectionalLightSettings> mDirectionalLights;
767 float mFieldOfView = 45.0f;
768 Qt3DRender::QCameraLens::ProjectionType mProjectionType = Qt3DRender::QCameraLens::PerspectiveProjection;
770 double mCameraMovementSpeed = 5.0;
771 QList<QgsMapLayerRef> mLayers;
772 QList<QgsMapLayerRef> mTerrainLayers;
773 QList<QgsAbstract3DRenderer *> mRenderers;
779 bool mIsFpsCounterEnabled =
false;
781 bool mIsSkyboxEnabled =
false;
785 bool mEyeDomeLightingEnabled =
false;
786 double mEyeDomeLightingStrength = 1000.0;
787 int mEyeDomeLightingDistance = 1;
789 bool mDebugShadowMapEnabled =
false;
790 Qt::Corner mDebugShadowMapCorner = Qt::Corner::TopLeftCorner;
791 double mDebugShadowMapSize = 0.2;
793 bool mDebugDepthMapEnabled =
false;
794 Qt::Corner mDebugDepthMapCorner = Qt::Corner::TopRightCorner;
795 double mDebugDepthMapSize = 0.2;
void mapTileResolutionChanged()
Emitted when the map tile resoulution has changed.
void terrainVerticalScaleChanged()
Emitted when the vertical scale of the terrain has changed.
Qt::Corner debugDepthMapCorner() const
Returns the corner where the shadow map preview is displayed.
void renderersChanged()
Emitted when the list of map's extra renderers have been modified.
QList< QgsAbstract3DRenderer * > renderers() const
Returns list of extra 3D renderers.
QgsTerrainGenerator * terrainGenerator() const
Returns terrain generator. It takes care of producing terrain tiles from the input data.
void eyeDomeLightingDistanceChanged()
Emitted when the eye dome lighting distance has changed.
void terrainShadingChanged()
Emitted when terrain shading enabled flag or terrain shading material has changed.
double cameraMovementSpeed() const
Returns the camera movement speed.
Qt3DRender::QCameraLens::ProjectionType projectionType() const
Returns the camera lens' projection type.
bool debugDepthMapEnabled() const
Returns whether the shadow map debugging is enabled.
bool isSkyboxEnabled() const
Returns whether the skybox is enabled.
void debugDepthMapSettingsChanged()
Emitted when depth map debugging has changed.
QList< QgsDirectionalLightSettings > directionalLights() const
Returns list of directional lights defined in the scene.
double outputDpi() const
Returns DPI used for conversion between real world units (e.g.
double eyeDomeLightingStrength() const
Returns the eye dome lighting strength value.
void backgroundColorChanged()
Emitted when the background color has changed.
void showTerrainBoundingBoxesChanged()
Emitted when the flag whether terrain's bounding boxes are shown has changed.
Qt::Corner debugShadowMapCorner() const
Returns the corner where the shadow map preview is displayed.
void setMapThemeCollection(QgsMapThemeCollection *mapThemes)
Sets pointer to the collection of map themes.
bool showCameraViewCenter() const
Returns whether to show camera's view center as a sphere (for debugging)
void directionalLightsChanged()
Emitted when the list of directional lights changes.
void cameraNavigationModeChanged()
Emitted when the camera navigation mode was changed.
void shadowSettingsChanged()
Emitted when shadow rendering settings are changed.
void terrainLayersChanged()
Emitted when the list of map layers for terrain texture has changed.
void eyeDomeLightingEnabledChanged()
Emitted when the flag whether eye dome lighting is used has changed.
void setOutputDpi(const double dpi)
Sets DPI used for conversion between real world units (e.g.
void setIsSkyboxEnabled(bool enabled)
Sets whether the skybox is enabled.
void setOrigin(const QgsVector3D &origin)
Sets coordinates in map CRS at which our 3D world has origin (0,0,0)
void skyboxSettingsChanged()
Emitted when skybox settings are changed.
QgsShadowSettings shadowSettings() const
Returns the current configuration of shadows.
void terrainMapThemeChanged()
Emitted when terrain's map theme has changed.
Qgs3DMapSettings & operator=(Qgs3DMapSettings const &)=delete
void pointLightsChanged()
Emitted when the list of point lights changes.
double debugDepthMapSize() const
Returns the size of the shadow map preview.
void projectionTypeChanged()
Emitted when the camera lens projection type changes.
float fieldOfView() const
Returns the camera lens' field of view.
void selectionColorChanged()
Emitted when the selection color has changed.
float terrainElevationOffset() const
Returns the elevation offset of the terrain (used to move the terrain up or down)
int eyeDomeLightingDistance() const
Returns the eye dome lighting distance value (contributes to the contrast of the image)
const QgsPathResolver & pathResolver() const
Returns the path resolver for conversion between relative and absolute paths during rendering operati...
void showLightSourceOriginsChanged()
Emitted when the flag whether light source origins are shown has changed.
double debugShadowMapSize() const
Returns the size of the shadow map preview.
void setPathResolver(const QgsPathResolver &resolver)
Sets the path resolver for conversion between relative and absolute paths during rendering operations...
bool showTerrainBoundingBoxes() const
Returns whether to display bounding boxes of terrain tiles (for debugging)
Qgs3DMapSettings()=default
Constructor for Qgs3DMapSettings.
void showLabelsChanged()
Emitted when the flag whether labels are displayed on terrain tiles has changed.
void maxTerrainScreenErrorChanged()
Emitted when the maximum terrain screen error has changed.
bool showLabels() const
Returns whether to display labels on terrain tiles.
void terrainElevationOffsetChanged(float newElevation)
Emitted when the terrain elevation offset is changed.
bool debugShadowMapEnabled() const
Returns whether the shadow map debugging is enabled.
void fpsCounterEnabledChanged(bool fpsCounterEnabled)
Emitted when the FPS counter is enabled or disabled.
bool showTerrainTilesInfo() const
Returns whether to display extra tile info on top of terrain tiles (for debugging)
void layersChanged()
Emitted when the list of map layers for 3d rendering has changed.
void showTerrainTilesInfoChanged()
Emitted when the flag whether terrain's tile info is shown has changed.
QgsMapThemeCollection * mapThemeCollection() const
Returns pointer to the collection of map themes.
void eyeDomeLightingStrengthChanged()
Emitted when the eye dome lighting strength has changed.
QgsSkyboxSettings skyboxSettings() const
Returns the current configuration of the skybox.
bool isTerrainShadingEnabled() const
Returns whether terrain shading is enabled.
void cameraMovementSpeedChanged()
Emitted when the camera movement speed was changed.
QgsCoordinateReferenceSystem crs() const
Returns coordinate reference system used in the 3D scene.
bool eyeDomeLightingEnabled() const
Returns whether eye dome lighting is used.
QgsPhongMaterialSettings terrainShadingMaterial() const
Returns terrain shading material.
bool isFpsCounterEnabled() const
Returns whether FPS counter label is enabled.
QString terrainMapTheme() const
Returns name of the map theme (from the active project) that will be used for terrain's texture.
void fieldOfViewChanged()
Emitted when the camera lens field of view changes.
QList< QgsPointLightSettings > pointLights() const
Returns list of point lights defined in the scene.
QgsCameraController::NavigationMode cameraNavigationMode() const
Returns the navigation mode used by the camera.
void terrainGeneratorChanged()
Emitted when the terrain generator has changed.
bool showLightSourceOrigins() const
Returns whether to show light source origins as a sphere (for debugging)
void debugShadowMapSettingsChanged()
Emitted when shadow map debugging has changed.
void showCameraViewCenterChanged()
Emitted when the flag whether camera's view center is shown has changed.
void maxTerrainGroundErrorChanged()
Emitted when the maximum terrain ground error has changed.
QgsVector3D origin() const
Returns coordinates in map CRS at which 3D scene has origin (0,0,0)
Base class for all renderers that may to participate in 3D view.
NavigationMode
The navigation mode used by the camera.
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Base class for all map layer types.
Container class that allows storage of map themes consisting of visible map layers and layer styles.
Resolves relative paths into absolute paths and vice versa.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Represents a raster layer.
The class is used as a container of context for various read/write operations on other objects.
class containing the configuration of shadows rendering 3
Contains the configuration of a skybox entity.
Base class for objects with an associated (optional) temporal range.
const QgsCoordinateReferenceSystem & crs