QGIS API Documentation 3.41.0-Master (25ec5511245)
Loading...
Searching...
No Matches
qgs3drendercontext.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgs3drendercontext.cpp
3 --------------------------------------
4 Date : August 2024
5 Copyright : (C) 2024 by Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#include "qgs3drendercontext.h"
17#include "qgs3dutils.h"
18#include "qgsthreadingutils.h"
19
21{
23
25 res.mCrs = mapSettings->crs();
26 res.mTransformContext = mapSettings->transformContext();
27 res.mOrigin = mapSettings->origin();
28 res.mExtent = mapSettings->extent();
29 res.mTemporalRange = mapSettings->temporalRange();
30 res.mSelectionColor = mapSettings->selectionColor();
31 res.mDpi = mapSettings->outputDpi();
32 res.mFieldOfView = mapSettings->fieldOfView();
33 res.mTerrainRenderingEnabled = mapSettings->terrainRenderingEnabled();
34 res.mTerrainVerticalScale = mapSettings->terrainVerticalScale();
35 res.mTerrainGenerator = mapSettings->terrainGenerator();
36 return res;
37}
38
40{
41 return Qgs3DUtils::mapToWorldCoordinates( mapCoords, mOrigin );
42}
43
45{
46 return Qgs3DUtils::worldToMapCoordinates( worldCoords, mOrigin );
47}
double outputDpi() const
Returns DPI used for conversion between real world units (e.g.
QColor selectionColor() const
Returns color used for selected features.
double terrainVerticalScale() const
Returns vertical scale (exaggeration) of terrain.
float fieldOfView() const
Returns the camera lens' field of view.
QgsRectangle extent() const
Returns the 3D scene's 2D extent in the 3D scene's CRS.
QgsTerrainGenerator * terrainGenerator() const
Returns the terrain generator.
bool terrainRenderingEnabled() const
Returns whether the 2D terrain surface will be rendered.
QgsCoordinateReferenceSystem crs() const
Returns coordinate reference system used in the 3D scene.
QgsCoordinateTransformContext transformContext() const
Returns the coordinate transform context, which stores various information regarding which datum tran...
QgsVector3D origin() const
Returns coordinates in map CRS at which 3D scene has origin (0,0,0).
static Qgs3DRenderContext fromMapSettings(const Qgs3DMapSettings *mapSettings)
Creates an initialized Qgs3DRenderContext instance from given Qgs3DMapSettings.
QgsVector3D mapToWorldCoordinates(const QgsVector3D &mapCoords) const
Converts map coordinates to 3D world coordinates (applies offset and turns (x,y,z) into (x,...
QgsVector3D worldToMapCoordinates(const QgsVector3D &worldCoords) const
Converts 3D world coordinates to map coordinates (applies offset and turns (x,y,z) into (x,...
static QgsVector3D worldToMapCoordinates(const QgsVector3D &worldCoords, const QgsVector3D &origin)
Converts 3D world coordinates to map coordinates (applies offset)
static QgsVector3D mapToWorldCoordinates(const QgsVector3D &mapCoords, const QgsVector3D &origin)
Converts map coordinates to 3D world coordinates (applies offset)
const QgsDateTimeRange & temporalRange() const
Returns the datetime range for the object.
Class for storage of 3D vectors similar to QVector3D, with the difference that it uses double precisi...
Definition qgsvector3d.h:31
#define QGIS_CHECK_OTHER_QOBJECT_THREAD_ACCESS(other)