QGIS API Documentation  3.2.0-Bonn (bc43194)
qgs3dutils.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgs3dutils.h
3  --------------------------------------
4  Date : July 2017
5  Copyright : (C) 2017 by Martin Dobias
6  Email : wonder dot sk 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 #ifndef QGS3DUTILS_H
17 #define QGS3DUTILS_H
18 
19 class QgsLineString;
20 class QgsPolygon;
21 
22 #include "qgs3dmapsettings.h"
23 #include "qgsaabb.h"
24 
25 #include <Qt3DRender/QCullFace>
26 
29 {
33 };
34 
35 
38 {
41 };
42 
43 
49 class _3D_EXPORT Qgs3DUtils
50 {
51  public:
52 
57  static int maxZoomLevel( double tile0width, double tileResolution, double maxError );
58 
60  static QString altClampingToString( AltitudeClamping altClamp );
62  static AltitudeClamping altClampingFromString( const QString &str );
63 
65  static QString altBindingToString( AltitudeBinding altBind );
67  static AltitudeBinding altBindingFromString( const QString &str );
68 
70  static QString cullingModeToString( Qt3DRender::QCullFace::CullingMode mode );
72  static Qt3DRender::QCullFace::CullingMode cullingModeFromString( const QString &str );
73 
75  static void clampAltitudes( QgsLineString *lineString, AltitudeClamping altClamp, AltitudeBinding altBind, const QgsPoint &centroid, float height, const Qgs3DMapSettings &map );
77  static bool clampAltitudes( QgsPolygon *polygon, AltitudeClamping altClamp, AltitudeBinding altBind, float height, const Qgs3DMapSettings &map );
78 
80  static QString matrix4x4toString( const QMatrix4x4 &m );
82  static QMatrix4x4 stringToMatrix4x4( const QString &str );
83 
87  static QList<QVector3D> positions( const Qgs3DMapSettings &map, QgsVectorLayer *layer, const QgsFeatureRequest &req, AltitudeClamping altClamp );
88 
93  static bool isCullable( const QgsAABB &bbox, const QMatrix4x4 &viewProjectionMatrix );
94 
96  static QgsVector3D mapToWorldCoordinates( const QgsVector3D &mapCoords, const QgsVector3D &origin );
98  static QgsVector3D worldToMapCoordinates( const QgsVector3D &worldCoords, const QgsVector3D &origin );
99 
101  static QgsVector3D transformWorldCoordinates( const QgsVector3D &worldPoint1, const QgsVector3D &origin1, const QgsCoordinateReferenceSystem &crs1, const QgsVector3D &origin2, const QgsCoordinateReferenceSystem &crs2,
102  const QgsCoordinateTransformContext &context );
103 };
104 
105 #endif // QGS3DUTILS_H
3 Class for storage of 3D vectors similar to QVector3D, with the difference that it uses double preci...
Definition: qgsvector3d.h:29
3 Axis-aligned bounding box - in world coords.
Definition: qgsaabb.h:30
Z_final = z_terrain + z_geometry.
Definition: qgs3dutils.h:31
Clamp just centroid of feature.
Definition: qgs3dutils.h:40
3 Definition of the world
Z_final = z_terrain.
Definition: qgs3dutils.h:32
This class wraps a request for features to a vector layer (or directly its vector data provider)...
Contains information about the context in which a coordinate transform is executed.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:37
AltitudeClamping
how to handle altitude of vector features
Definition: qgs3dutils.h:28
Clamp every vertex of feature.
Definition: qgs3dutils.h:39
Line string geometry type, with support for z-dimension and m-values.
Definition: qgslinestring.h:43
This class represents a coordinate reference system (CRS).
Z_final = z_geometry.
Definition: qgs3dutils.h:30
Polygon geometry type.
Definition: qgspolygon.h:31
Represents a vector layer which manages a vector based data sets.
AltitudeBinding
how to handle clamping of vertices of individual features
Definition: qgs3dutils.h:37
3 Miscellaneous utility functions used from 3D code.
Definition: qgs3dutils.h:49