QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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 #include "qgis_sip.h"
20 
21 class QgsLineString;
22 class QgsPolygon;
23 
25 class Qgs3DMapScene;
26 
27 #include "qgs3dmapsettings.h"
28 #include "qgs3dtypes.h"
29 #include "qgsaabb.h"
30 
31 
32 #ifndef SIP_RUN
33 
39 class _3D_EXPORT Qgs3DUtils
40 {
41  public:
42 
48  static QImage captureSceneImage( QgsAbstract3DEngine &engine, Qgs3DMapScene *scene );
49 
54  static int maxZoomLevel( double tile0width, double tileResolution, double maxError );
55 
57  static QString altClampingToString( Qgs3DTypes::AltitudeClamping altClamp );
59  static Qgs3DTypes::AltitudeClamping altClampingFromString( const QString &str );
60 
62  static QString altBindingToString( Qgs3DTypes::AltitudeBinding altBind );
64  static Qgs3DTypes::AltitudeBinding altBindingFromString( const QString &str );
65 
67  static QString cullingModeToString( Qgs3DTypes::CullingMode mode );
69  static Qgs3DTypes::CullingMode cullingModeFromString( const QString &str );
70 
72  static float clampAltitude( const QgsPoint &p, Qgs3DTypes::AltitudeClamping altClamp, Qgs3DTypes::AltitudeBinding altBind, float height, const QgsPoint &centroid, const Qgs3DMapSettings &map );
74  static void clampAltitudes( QgsLineString *lineString, Qgs3DTypes::AltitudeClamping altClamp, Qgs3DTypes::AltitudeBinding altBind, const QgsPoint &centroid, float height, const Qgs3DMapSettings &map );
76  static bool clampAltitudes( QgsPolygon *polygon, Qgs3DTypes::AltitudeClamping altClamp, Qgs3DTypes::AltitudeBinding altBind, float height, const Qgs3DMapSettings &map );
77 
79  static QString matrix4x4toString( const QMatrix4x4 &m );
81  static QMatrix4x4 stringToMatrix4x4( const QString &str );
82 
86  static QList<QVector3D> positions( const Qgs3DMapSettings &map, QgsVectorLayer *layer, const QgsFeatureRequest &req, Qgs3DTypes::AltitudeClamping altClamp );
87 
92  static bool isCullable( const QgsAABB &bbox, const QMatrix4x4 &viewProjectionMatrix );
93 
95  static QgsVector3D mapToWorldCoordinates( const QgsVector3D &mapCoords, const QgsVector3D &origin );
97  static QgsVector3D worldToMapCoordinates( const QgsVector3D &worldCoords, const QgsVector3D &origin );
98 
100  static QgsVector3D transformWorldCoordinates( const QgsVector3D &worldPoint1, const QgsVector3D &origin1, const QgsCoordinateReferenceSystem &crs1, const QgsVector3D &origin2, const QgsCoordinateReferenceSystem &crs2,
101  const QgsCoordinateTransformContext &context );
102 };
103 
104 #endif
105 
106 #endif // QGS3DUTILS_H
AltitudeClamping
how to handle altitude of vector features
Definition: qgs3dtypes.h:34
3 Class for storage of 3D vectors similar to QVector3D, with the difference that it uses double preci...
Definition: qgsvector3d.h:31
3 Axis-aligned bounding box - in world coords.
Definition: qgsaabb.h:30
CullingMode
Triangle culling mode.
Definition: qgs3dtypes.h:49
3 Definition of the world
This class wraps a request for features to a vector layer (or directly its vector data provider)...
3 Base class for 3D engine implementation.
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
AltitudeBinding
how to handle clamping of vertices of individual features
Definition: qgs3dtypes.h:42
3 Entity that encapsulates our 3D scene - contains all other entities (such as terrain) as children...
Definition: qgs3dmapscene.h:53
Line string geometry type, with support for z-dimension and m-values.
Definition: qgslinestring.h:43
This class represents a coordinate reference system (CRS).
Polygon geometry type.
Definition: qgspolygon.h:31
Represents a vector layer which manages a vector based data sets.
3 Miscellaneous utility functions used from 3D code.
Definition: qgs3dutils.h:39