QGIS API Documentation  3.0.2-Girona (307d082)
Static Public Member Functions | List of all members
Qgs3DUtils Class Reference

3 Miscellaneous utility functions used from 3D code. More...

#include <qgs3dutils.h>

Static Public Member Functions

static AltitudeBinding altBindingFromString (const QString &str)
 Converts a string to a value from AltitudeBinding enum. More...
 
static QString altBindingToString (AltitudeBinding altBind)
 Converts a value from AltitudeBinding enum to a string. More...
 
static AltitudeClamping altClampingFromString (const QString &str)
 Converts a string to a value from AltitudeClamping enum. More...
 
static QString altClampingToString (AltitudeClamping altClamp)
 Converts a value from AltitudeClamping enum to a string. More...
 
static void clampAltitudes (QgsLineString *lineString, AltitudeClamping altClamp, AltitudeBinding altBind, const QgsPoint &centroid, float height, const Qgs3DMapSettings &map)
 Clamps altitude of vertices of a linestring according to the settings. More...
 
static bool clampAltitudes (QgsPolygon *polygon, AltitudeClamping altClamp, AltitudeBinding altBind, float height, const Qgs3DMapSettings &map)
 Clamps altitude of vertices of a polygon according to the settings. More...
 
static Qt3DRender::QCullFace::CullingMode cullingModeFromString (const QString &str)
 Converts a string to a value from CullingMode enum. More...
 
static QString cullingModeToString (Qt3DRender::QCullFace::CullingMode mode)
 Converts a value from CullingMode enum to a string. More...
 
static bool isCullable (const QgsAABB &bbox, const QMatrix4x4 &viewProjectionMatrix)
 Returns true if bbox is completely outside the current viewing volume. More...
 
static QgsVector3D mapToWorldCoordinates (const QgsVector3D &mapCoords, const QgsVector3D &origin)
 Converts map coordinates to 3D world coordinates (applies offset and turns (x,y,z) into (x,-z,y)) More...
 
static QString matrix4x4toString (const QMatrix4x4 &m)
 Converts a 4x4 transform matrix to a string. More...
 
static int 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. More...
 
static QList< QVector3D > positions (const Qgs3DMapSettings &map, QgsVectorLayer *layer, const QgsFeatureRequest &req, AltitudeClamping altClamp)
 Calculates (x,y,z) positions of a (multi)point in the Point vector layers. More...
 
static QMatrix4x4 stringToMatrix4x4 (const QString &str)
 Convert a string to a 4x4 transform matrix. More...
 
static QgsVector3D transformWorldCoordinates (const QgsVector3D &worldPoint1, const QgsVector3D &origin1, const QgsCoordinateReferenceSystem &crs1, const QgsVector3D &origin2, const QgsCoordinateReferenceSystem &crs2, const QgsCoordinateTransformContext &context)
 Transforms a world point from (origin1, crs1) to (origin2, crs2) More...
 
static QgsVector3D worldToMapCoordinates (const QgsVector3D &worldCoords, const QgsVector3D &origin)
 Converts 3D world coordinates to map coordinates (applies offset and turns (x,y,z) into (x,-z,y)) More...
 

Detailed Description

3 Miscellaneous utility functions used from 3D code.

Since
QGIS 3.0

Definition at line 49 of file qgs3dutils.h.

Member Function Documentation

◆ altBindingFromString()

AltitudeBinding Qgs3DUtils::altBindingFromString ( const QString &  str)
static

Converts a string to a value from AltitudeBinding enum.

Definition at line 77 of file qgs3dutils.cpp.

◆ altBindingToString()

QString Qgs3DUtils::altBindingToString ( AltitudeBinding  altBind)
static

Converts a value from AltitudeBinding enum to a string.

Definition at line 66 of file qgs3dutils.cpp.

◆ altClampingFromString()

AltitudeClamping Qgs3DUtils::altClampingFromString ( const QString &  str)
static

Converts a string to a value from AltitudeClamping enum.

Definition at line 55 of file qgs3dutils.cpp.

◆ altClampingToString()

QString Qgs3DUtils::altClampingToString ( AltitudeClamping  altClamp)
static

Converts a value from AltitudeClamping enum to a string.

Definition at line 43 of file qgs3dutils.cpp.

◆ clampAltitudes() [1/2]

void Qgs3DUtils::clampAltitudes ( QgsLineString lineString,
AltitudeClamping  altClamp,
AltitudeBinding  altBind,
const QgsPoint centroid,
float  height,
const Qgs3DMapSettings map 
)
static

Clamps altitude of vertices of a linestring according to the settings.

Definition at line 110 of file qgs3dutils.cpp.

◆ clampAltitudes() [2/2]

bool Qgs3DUtils::clampAltitudes ( QgsPolygon polygon,
AltitudeClamping  altClamp,
AltitudeBinding  altBind,
float  height,
const Qgs3DMapSettings map 
)
static

Clamps altitude of vertices of a polygon according to the settings.

Definition at line 140 of file qgs3dutils.cpp.

◆ cullingModeFromString()

Qt3DRender::QCullFace::CullingMode Qgs3DUtils::cullingModeFromString ( const QString &  str)
static

Converts a string to a value from CullingMode enum.

Definition at line 97 of file qgs3dutils.cpp.

◆ cullingModeToString()

QString Qgs3DUtils::cullingModeToString ( Qt3DRender::QCullFace::CullingMode  mode)
static

Converts a value from CullingMode enum to a string.

Definition at line 85 of file qgs3dutils.cpp.

◆ isCullable()

bool Qgs3DUtils::isCullable ( const QgsAABB bbox,
const QMatrix4x4 &  viewProjectionMatrix 
)
static

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://www.lighthouse3d.com/tutorials/view-frustum-culling/geometric-approach-testing-boxes/

should be equivalent to https://searchcode.com/codesearch/view/35195518/ qt3d /src/threed/painting/qglpainter.cpp bool QGLPainter::isCullable(const QBox3D& box) const

Definition at line 264 of file qgs3dutils.cpp.

◆ mapToWorldCoordinates()

QgsVector3D Qgs3DUtils::mapToWorldCoordinates ( const QgsVector3D mapCoords,
const QgsVector3D origin 
)
static

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

Definition at line 282 of file qgs3dutils.cpp.

◆ matrix4x4toString()

QString Qgs3DUtils::matrix4x4toString ( const QMatrix4x4 &  m)
static

Converts a 4x4 transform matrix to a string.

Definition at line 169 of file qgs3dutils.cpp.

◆ maxZoomLevel()

int Qgs3DUtils::maxZoomLevel ( double  tile0width,
double  tileResolution,
double  maxError 
)
static

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.

Definition at line 30 of file qgs3dutils.cpp.

◆ positions()

QList< QVector3D > Qgs3DUtils::positions ( const Qgs3DMapSettings map,
QgsVectorLayer layer,
const QgsFeatureRequest req,
AltitudeClamping  altClamp 
)
static

Calculates (x,y,z) positions of a (multi)point in the Point vector layers.

Definition at line 188 of file qgs3dutils.cpp.

◆ stringToMatrix4x4()

QMatrix4x4 Qgs3DUtils::stringToMatrix4x4 ( const QString &  str)
static

Convert a string to a 4x4 transform matrix.

Definition at line 178 of file qgs3dutils.cpp.

◆ transformWorldCoordinates()

QgsVector3D Qgs3DUtils::transformWorldCoordinates ( const QgsVector3D worldPoint1,
const QgsVector3D origin1,
const QgsCoordinateReferenceSystem crs1,
const QgsVector3D origin2,
const QgsCoordinateReferenceSystem crs2,
const QgsCoordinateTransformContext context 
)
static

Transforms a world point from (origin1, crs1) to (origin2, crs2)

Definition at line 297 of file qgs3dutils.cpp.

◆ worldToMapCoordinates()

QgsVector3D Qgs3DUtils::worldToMapCoordinates ( const QgsVector3D worldCoords,
const QgsVector3D origin 
)
static

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

Definition at line 290 of file qgs3dutils.cpp.


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