QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Signals | Public Member Functions | List of all members
Qgs3DMapSettings Class Reference

3 Definition of the world More...

#include <qgs3dmapsettings.h>

Inheritance diagram for Qgs3DMapSettings:
Inheritance graph
[legend]

Signals

void backgroundColorChanged ()
 Emitted when the background color has changed. More...
 
void layersChanged ()
 Emitted when the list of map layers for terrain texture has changed. More...
 
void mapTileResolutionChanged ()
 Emitted when the map tile resoulution has changed. More...
 
void maxTerrainGroundErrorChanged ()
 Emitted when the maximum terrain ground error has changed. More...
 
void maxTerrainScreenErrorChanged ()
 Emitted when the maximum terrain screen error has changed. More...
 
void selectionColorChanged ()
 Emitted when the selection color has changed. More...
 
void showCameraViewCenterChanged ()
 Emitted when the flag whether camera's view center is shown has changed. More...
 
void showLabelsChanged ()
 Emitted when the flag whether labels are displayed on terrain tiles has changed. More...
 
void showTerrainBoundingBoxesChanged ()
 Emitted when the flag whether terrain's bounding boxes are shown has changed. More...
 
void showTerrainTilesInfoChanged ()
 Emitted when the flag whether terrain's tile info is shown has changed. More...
 
void terrainGeneratorChanged ()
 Emitted when the terrain generator has changed. More...
 
void terrainVerticalScaleChanged ()
 Emitted when the vertical scale of the terrain has changed. More...
 

Public Member Functions

 Qgs3DMapSettings ()=default
 Constructor for Qgs3DMapSettings. More...
 
 Qgs3DMapSettings (const Qgs3DMapSettings &other)
 Copy constructor. More...
 
 ~Qgs3DMapSettings () override
 
QColor backgroundColor () const
 Returns background color of the 3D map view. More...
 
QgsCoordinateReferenceSystem crs () const
 Returns coordinate reference system used in the 3D scene. More...
 
bool hasSkyboxEnabled () const
 Returns whether skybox is enabled. More...
 
QList< QgsMapLayer * > layers () const
 Returns the list of map layers to be rendered as a texture of the terrain. More...
 
int mapTileResolution () const
 Returns resolution (in pixels) of the texture of a terrain tile. More...
 
QgsVector3D mapToWorldCoordinates (const QgsVector3D &mapCoords) const
 Converts map coordinates to 3D world coordinates (applies offset and turns (x,y,z) into (x,-z,y)) More...
 
float maxTerrainGroundError () const
 Returns maximum ground error of terrain tiles in world units. More...
 
float maxTerrainScreenError () const
 Returns maximum allowed screen error of terrain tiles in pixels. More...
 
QgsVector3D origin () const
 Returns coordinates in map CRS at which 3D scene has origin (0,0,0) More...
 
const QgsPathResolverpathResolver () const
 Returns the path resolver for conversion between relative and absolute paths during rendering operations, e.g. More...
 
void readXml (const QDomElement &elem, const QgsReadWriteContext &context)
 Reads configuration from a DOM element previously written by writeXml() More...
 
QList< QgsAbstract3DRenderer * > renderers () const
 Returns list of extra 3D renderers. More...
 
void resolveReferences (const QgsProject &project)
 Resolves references to other objects (map layers) after the call to readXml() More...
 
QColor selectionColor () const
 Returns color used for selected features. More...
 
void setBackgroundColor (const QColor &color)
 Sets background color of the 3D map view. More...
 
void setCrs (const QgsCoordinateReferenceSystem &crs)
 Sets coordinate reference system used in the 3D scene. More...
 
void setLayers (const QList< QgsMapLayer * > &layers)
 Sets the list of map layers to be rendered as a texture of the terrain. More...
 
void setMapTileResolution (int res)
 Sets resolution (in pixels) of the texture of a terrain tile. More...
 
void setMaxTerrainGroundError (float error)
 Returns maximum ground error of terrain tiles in world units. More...
 
void setMaxTerrainScreenError (float error)
 Sets maximum allowed screen error of terrain tiles in pixels. More...
 
void setOrigin (const QgsVector3D &origin)
 Sets coordinates in map CRS at which our 3D world has origin (0,0,0) More...
 
void setPathResolver (const QgsPathResolver &resolver)
 Sets the path resolver for conversion between relative and absolute paths during rendering operations, e.g. More...
 
void setRenderers (const QList< QgsAbstract3DRenderer * > &renderers)
 Sets list of extra 3D renderers to use in the scene. Takes ownership of the objects. More...
 
void setSelectionColor (const QColor &color)
 Sets color used for selected features. More...
 
void setShowCameraViewCenter (bool enabled)
 Sets whether to show camera's view center as a sphere (for debugging) More...
 
void setShowLabels (bool enabled)
 Sets whether to display labels on terrain tiles. More...
 
void setShowTerrainBoundingBoxes (bool enabled)
 Sets whether to display bounding boxes of terrain tiles (for debugging) More...
 
void setShowTerrainTilesInfo (bool enabled)
 Sets whether to display extra tile info on top of terrain tiles (for debugging) More...
 
void setSkybox (bool enabled, const QString &fileBase=QString(), const QString &fileExtension=QString())
 Sets skybox configuration. More...
 
void setTerrainGenerator (QgsTerrainGenerator *gen)
 Sets terrain generator. More...
 
void setTerrainVerticalScale (double zScale)
 Sets vertical scale (exaggeration) of terrain (1 = true scale, > 1 = hills get more pronounced) More...
 
void setTransformContext (const QgsCoordinateTransformContext &context)
 Sets the coordinate transform context, which stores various information regarding which datum transforms should be used when transforming points from a source to destination coordinate reference system. More...
 
bool showCameraViewCenter () const
 Returns whether to show camera's view center as a sphere (for debugging) More...
 
bool showLabels () const
 Returns whether to display labels on terrain tiles. More...
 
bool showTerrainBoundingBoxes () const
 Returns whether to display bounding boxes of terrain tiles (for debugging) More...
 
bool showTerrainTilesInfo () const
 Returns whether to display extra tile info on top of terrain tiles (for debugging) More...
 
QString skyboxFileBase () const
 Returns base part of filenames of skybox (see setSkybox()) More...
 
QString skyboxFileExtension () const
 Returns extension part of filenames of skybox (see setSkybox()) More...
 
QgsTerrainGeneratorterrainGenerator () const
 Returns terrain generator. It takes care of producing terrain tiles from the input data. More...
 
double terrainVerticalScale () const
 Returns vertical scale (exaggeration) of terrain. More...
 
QgsCoordinateTransformContext transformContext () const
 Returns the coordinate transform context, which stores various information regarding which datum transforms should be used when transforming points from a source to destination coordinate reference system. More...
 
QgsVector3D worldToMapCoordinates (const QgsVector3D &worldCoords) const
 Converts 3D world coordinates to map coordinates (applies offset and turns (x,y,z) into (x,-z,y)) More...
 
QDomElement writeXml (QDomDocument &doc, const QgsReadWriteContext &context) const
 Writes configuration to a DOM element, to be used later with readXml() More...
 

Detailed Description

3 Definition of the world

Since
QGIS 3.0

Definition at line 48 of file qgs3dmapsettings.h.

Constructor & Destructor Documentation

Qgs3DMapSettings::Qgs3DMapSettings ( )
default

Constructor for Qgs3DMapSettings.

Qgs3DMapSettings::Qgs3DMapSettings ( const Qgs3DMapSettings other)

Copy constructor.

Definition at line 30 of file qgs3dmapsettings.cpp.

Qgs3DMapSettings::~Qgs3DMapSettings ( )
override

Definition at line 54 of file qgs3dmapsettings.cpp.

Member Function Documentation

QColor Qgs3DMapSettings::backgroundColor ( ) const

Returns background color of the 3D map view.

Definition at line 264 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::backgroundColorChanged ( )
signal

Emitted when the background color has changed.

QgsCoordinateReferenceSystem Qgs3DMapSettings::crs ( ) const
inline

Returns coordinate reference system used in the 3D scene.

Definition at line 89 of file qgs3dmapsettings.h.

bool Qgs3DMapSettings::hasSkyboxEnabled ( ) const
inline

Returns whether skybox is enabled.

Definition at line 216 of file qgs3dmapsettings.h.

QList< QgsMapLayer * > Qgs3DMapSettings::layers ( ) const

Returns the list of map layers to be rendered as a texture of the terrain.

Definition at line 313 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::layersChanged ( )
signal

Emitted when the list of map layers for terrain texture has changed.

int Qgs3DMapSettings::mapTileResolution ( ) const

Returns resolution (in pixels) of the texture of a terrain tile.

This parameter influences how many zoom levels for terrain tiles there will be (together with maxTerrainGroundError())

Definition at line 334 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::mapTileResolutionChanged ( )
signal

Emitted when the map tile resoulution has changed.

QgsVector3D Qgs3DMapSettings::mapToWorldCoordinates ( const QgsVector3D mapCoords) const

Converts map coordinates to 3D world coordinates (applies offset and turns (x,y,z) into (x,-z,y))

Definition at line 230 of file qgs3dmapsettings.cpp.

float Qgs3DMapSettings::maxTerrainGroundError ( ) const

Returns maximum ground error of terrain tiles in world units.

This parameter influences how many zoom levels there will be (together with mapTileResolution()). This value tells that when the given ground error is reached (e.g. 10 meters), it makes no sense to further split terrain tiles into finer ones because they will not add extra details anymore.

Definition at line 362 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::maxTerrainGroundErrorChanged ( )
signal

Emitted when the maximum terrain ground error has changed.

float Qgs3DMapSettings::maxTerrainScreenError ( ) const

Returns maximum allowed screen error of terrain tiles in pixels.

This parameter decides how aggressively less detailed terrain tiles are swapped to more detailed ones as camera gets closer. Each tile has its error defined in world units - this error gets projected to screen pixels according to camera view and if the tile's error is greater than the allowed error, it will be swapped by more detailed tiles with lower error.

Definition at line 348 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::maxTerrainScreenErrorChanged ( )
signal

Emitted when the maximum terrain screen error has changed.

QgsVector3D Qgs3DMapSettings::origin ( ) const
inline

Returns coordinates in map CRS at which 3D scene has origin (0,0,0)

Definition at line 79 of file qgs3dmapsettings.h.

const QgsPathResolver& Qgs3DMapSettings::pathResolver ( ) const
inline

Returns the path resolver for conversion between relative and absolute paths during rendering operations, e.g.

for resolving relative symbol paths.

See also
setPathResolver()
Since
QGIS 3.0

Definition at line 116 of file qgs3dmapsettings.h.

void Qgs3DMapSettings::readXml ( const QDomElement &  elem,
const QgsReadWriteContext context 
)

Reads configuration from a DOM element previously written by writeXml()

Definition at line 59 of file qgs3dmapsettings.cpp.

QList<QgsAbstract3DRenderer *> Qgs3DMapSettings::renderers ( ) const
inline

Returns list of extra 3D renderers.

Definition at line 206 of file qgs3dmapsettings.h.

void Qgs3DMapSettings::resolveReferences ( const QgsProject project)

Resolves references to other objects (map layers) after the call to readXml()

Definition at line 213 of file qgs3dmapsettings.cpp.

QColor Qgs3DMapSettings::selectionColor ( ) const

Returns color used for selected features.

Definition at line 278 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::selectionColorChanged ( )
signal

Emitted when the selection color has changed.

void Qgs3DMapSettings::setBackgroundColor ( const QColor &  color)

Sets background color of the 3D map view.

Definition at line 255 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::setCrs ( const QgsCoordinateReferenceSystem crs)

Sets coordinate reference system used in the 3D scene.

Definition at line 240 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::setLayers ( const QList< QgsMapLayer * > &  layers)

Sets the list of map layers to be rendered as a texture of the terrain.

Definition at line 297 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::setMapTileResolution ( int  res)

Sets resolution (in pixels) of the texture of a terrain tile.

See also
mapTileResolution()

Definition at line 325 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::setMaxTerrainGroundError ( float  error)

Returns maximum ground error of terrain tiles in world units.

See also
maxTerrainGroundError()

Definition at line 353 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::setMaxTerrainScreenError ( float  error)

Sets maximum allowed screen error of terrain tiles in pixels.

See also
maxTerrainScreenError()

Definition at line 339 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::setOrigin ( const QgsVector3D origin)
inline

Sets coordinates in map CRS at which our 3D world has origin (0,0,0)

We move the 3D world origin to the center of the extent of our terrain: this is done to minimize the impact of numerical errors when operating with 32-bit floats. Unfortunately this is not enough when working with a large area (still results in jitter with scenes spanning hundreds of kilometers and zooming in a lot).

Need to look into more advanced techniques like "relative to center" or "relative to eye" to improve the precision.

Definition at line 77 of file qgs3dmapsettings.h.

void Qgs3DMapSettings::setPathResolver ( const QgsPathResolver resolver)
inline

Sets the path resolver for conversion between relative and absolute paths during rendering operations, e.g.

for resolving relative symbol paths.

See also
pathResolver()
Since
QGIS 3.0

Definition at line 125 of file qgs3dmapsettings.h.

void Qgs3DMapSettings::setRenderers ( const QList< QgsAbstract3DRenderer * > &  renderers)

Sets list of extra 3D renderers to use in the scene. Takes ownership of the objects.

Definition at line 373 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::setSelectionColor ( const QColor &  color)

Sets color used for selected features.

Definition at line 269 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::setShowCameraViewCenter ( bool  enabled)

Sets whether to show camera's view center as a sphere (for debugging)

Since
QGIS 3.4

Definition at line 396 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::setShowLabels ( bool  enabled)

Sets whether to display labels on terrain tiles.

Definition at line 405 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::setShowTerrainBoundingBoxes ( bool  enabled)

Sets whether to display bounding boxes of terrain tiles (for debugging)

Definition at line 378 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::setShowTerrainTilesInfo ( bool  enabled)

Sets whether to display extra tile info on top of terrain tiles (for debugging)

Definition at line 387 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::setSkybox ( bool  enabled,
const QString &  fileBase = QString(),
const QString &  fileExtension = QString() 
)

Sets skybox configuration.

When enabled, map scene will try to load six texture files using the following syntax of filenames: "[base]_[side][extension]" where [side] is one of the following: posx/posy/posz/negx/negy/negz and [base] and [extension] are the arguments passed this method.

void Qgs3DMapSettings::setTerrainGenerator ( QgsTerrainGenerator gen)

Sets terrain generator.

It takes care of producing terrain tiles from the input data. Takes ownership of the generator

Definition at line 367 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::setTerrainVerticalScale ( double  zScale)

Sets vertical scale (exaggeration) of terrain (1 = true scale, > 1 = hills get more pronounced)

Definition at line 283 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::setTransformContext ( const QgsCoordinateTransformContext context)

Sets the coordinate transform context, which stores various information regarding which datum transforms should be used when transforming points from a source to destination coordinate reference system.

See also
transformContext()

Definition at line 250 of file qgs3dmapsettings.cpp.

bool Qgs3DMapSettings::showCameraViewCenter ( ) const
inline

Returns whether to show camera's view center as a sphere (for debugging)

Since
QGIS 3.4

Definition at line 241 of file qgs3dmapsettings.h.

void Qgs3DMapSettings::showCameraViewCenterChanged ( )
signal

Emitted when the flag whether camera's view center is shown has changed.

Since
QGIS 3.4
bool Qgs3DMapSettings::showLabels ( ) const
inline

Returns whether to display labels on terrain tiles.

Definition at line 245 of file qgs3dmapsettings.h.

void Qgs3DMapSettings::showLabelsChanged ( )
signal

Emitted when the flag whether labels are displayed on terrain tiles has changed.

bool Qgs3DMapSettings::showTerrainBoundingBoxes ( ) const
inline

Returns whether to display bounding boxes of terrain tiles (for debugging)

Definition at line 225 of file qgs3dmapsettings.h.

void Qgs3DMapSettings::showTerrainBoundingBoxesChanged ( )
signal

Emitted when the flag whether terrain's bounding boxes are shown has changed.

bool Qgs3DMapSettings::showTerrainTilesInfo ( ) const
inline

Returns whether to display extra tile info on top of terrain tiles (for debugging)

Definition at line 229 of file qgs3dmapsettings.h.

void Qgs3DMapSettings::showTerrainTilesInfoChanged ( )
signal

Emitted when the flag whether terrain's tile info is shown has changed.

QString Qgs3DMapSettings::skyboxFileBase ( ) const
inline

Returns base part of filenames of skybox (see setSkybox())

Definition at line 218 of file qgs3dmapsettings.h.

QString Qgs3DMapSettings::skyboxFileExtension ( ) const
inline

Returns extension part of filenames of skybox (see setSkybox())

Definition at line 220 of file qgs3dmapsettings.h.

QgsTerrainGenerator* Qgs3DMapSettings::terrainGenerator ( ) const
inline

Returns terrain generator. It takes care of producing terrain tiles from the input data.

Definition at line 201 of file qgs3dmapsettings.h.

void Qgs3DMapSettings::terrainGeneratorChanged ( )
signal

Emitted when the terrain generator has changed.

double Qgs3DMapSettings::terrainVerticalScale ( ) const

Returns vertical scale (exaggeration) of terrain.

Definition at line 292 of file qgs3dmapsettings.cpp.

void Qgs3DMapSettings::terrainVerticalScaleChanged ( )
signal

Emitted when the vertical scale of the terrain has changed.

QgsCoordinateTransformContext Qgs3DMapSettings::transformContext ( ) const

Returns the coordinate transform context, which stores various information regarding which datum transforms should be used when transforming points from a source to destination coordinate reference system.

See also
setTransformContext()

Definition at line 245 of file qgs3dmapsettings.cpp.

QgsVector3D Qgs3DMapSettings::worldToMapCoordinates ( const QgsVector3D worldCoords) const

Converts 3D world coordinates to map coordinates (applies offset and turns (x,y,z) into (x,-z,y))

Definition at line 235 of file qgs3dmapsettings.cpp.

QDomElement Qgs3DMapSettings::writeXml ( QDomDocument &  doc,
const QgsReadWriteContext context 
) const

Writes configuration to a DOM element, to be used later with readXml()

Definition at line 148 of file qgs3dmapsettings.cpp.


The documentation for this class was generated from the following files: