Qgs3DUtils class
3 Miscellaneous utility functions used from 3D code.
Contents
- Reference
Public static functions
-
static auto altBindingFromString(const QString& str) -> Qgs3DTypes::
AltitudeBinding - Converts a string to a value from AltitudeBinding enum.
-
static auto altBindingToString(Qgs3DTypes::
AltitudeBinding altBind) -> QString - Converts a value from AltitudeBinding enum to a string.
-
static auto altClampingFromString(const QString& str) -> Qgs3DTypes::
AltitudeClamping - Converts a string to a value from AltitudeClamping enum.
-
static auto altClampingToString(Qgs3DTypes::
AltitudeClamping altClamp) -> QString - Converts a value from AltitudeClamping enum to a string.
- static auto captureSceneImage(QgsAbstract3DEngine& engine, Qgs3DMapScene* scene) -> QImage
- Captures image of the current 3D scene of a 3D engine.
-
static auto clampAltitude(const QgsPoint& p,
Qgs3DTypes::
AltitudeClamping altClamp, Qgs3DTypes:: AltitudeBinding altBind, float height, const QgsPoint& centroid, const Qgs3DMapSettings& map) -> float - Clamps altitude of a vertex according to the settings, returns Z value.
-
static void clampAltitudes(QgsLineString* lineString,
Qgs3DTypes::
AltitudeClamping altClamp, Qgs3DTypes:: AltitudeBinding altBind, const QgsPoint& centroid, float height, const Qgs3DMapSettings& map) - Clamps altitude of vertices of a linestring according to the settings.
-
static auto clampAltitudes(QgsPolygon* polygon,
Qgs3DTypes::
AltitudeClamping altClamp, Qgs3DTypes:: AltitudeBinding altBind, float height, const Qgs3DMapSettings& map) -> bool - Clamps altitude of vertices of a polygon according to the settings.
-
static auto cullingModeFromString(const QString& str) -> Qgs3DTypes::
CullingMode - Converts a string to a value from CullingMode enum.
-
static auto cullingModeToString(Qgs3DTypes::
CullingMode mode) -> QString - Converts a value from CullingMode enum to a string.
- static auto isCullable(const QgsAABB& bbox, const QMatrix4x4& viewProjectionMatrix) -> bool
- Returns true if bbox is completely outside the current viewing volume.
- static auto mapToWorldCoordinates(const QgsVector3D& mapCoords, const QgsVector3D& origin) -> QgsVector3D
- Converts map coordinates to 3D world coordinates (applies offset and turns (x,y,z) into (x,-z,y))
- static auto matrix4x4toString(const QMatrix4x4& m) -> QString
- Converts a 4x4 transform matrix to a string.
- static auto maxZoomLevel(double tile0width, double tileResolution, double maxError) -> int
- Calculates the highest needed zoom level for tiles in quad-tree given width of the base tile (zoom level 0) in map units, resolution of the tile (e.g.
-
static auto positions(const Qgs3DMapSettings& map,
QgsVectorLayer* layer,
const QgsFeatureRequest& req,
Qgs3DTypes::
AltitudeClamping altClamp) -> QList<QVector3D> - Calculates (x,y,z) positions of a (multi)point in the Point vector layers.
- static auto stringToMatrix4x4(const QString& str) -> QMatrix4x4
- Convert a string to a 4x4 transform matrix.
- static auto transformWorldCoordinates(const QgsVector3D& worldPoint1, const QgsVector3D& origin1, const QgsCoordinateReferenceSystem& crs1, const QgsVector3D& origin2, const QgsCoordinateReferenceSystem& crs2, const QgsCoordinateTransformContext& context) -> QgsVector3D
- Transforms a world point from (origin1, crs1) to (origin2, crs2)
- static auto worldToMapCoordinates(const QgsVector3D& worldCoords, const QgsVector3D& origin) -> QgsVector3D
- Converts 3D world coordinates to map coordinates (applies offset and turns (x,y,z) into (x,-z,y))
Function documentation
static QImage Qgs3DUtils:: captureSceneImage(QgsAbstract3DEngine& engine,
Qgs3DMapScene* scene)
Captures image of the current 3D scene of a 3D engine.
The function waits until the scene is not fully loaded/updated before capturing the image.
static bool Qgs3DUtils:: isCullable(const QgsAABB& bbox,
const QMatrix4x4& viewProjectionMatrix)
Returns true if bbox is completely outside the current viewing volume.
coarse box vs frustum test for culling.
This is used to perform object culling checks.
corners of oriented box are transformed to clip space and there is a test that all points are on the wrong side of the same plane see http:/
should be equivalent to https:/
static int Qgs3DUtils:: maxZoomLevel(double tile0width,
double tileResolution,
double maxError)
Calculates the highest needed zoom level for tiles in quad-tree given width of the base tile (zoom level 0) in map units, resolution of the tile (e.g.
tile's texture width) and desired maximum error in map units.