QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgspoint3dsymbol.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspoint3dsymbol.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 QGSPOINT3DSYMBOL_H
17 #define QGSPOINT3DSYMBOL_H
18 
19 #include "qgis_3d.h"
20 
21 #include "qgsabstract3dsymbol.h"
23 #include "qgs3dtypes.h"
24 #include "qgssymbol.h"
25 
26 #include <QMatrix4x4>
27 
37 class _3D_EXPORT QgsPoint3DSymbol : public QgsAbstract3DSymbol
38 {
39  public:
42 
44  QgsPoint3DSymbol( const QgsPoint3DSymbol &other );
45 
46  QString type() const override { return "point"; }
47  QgsAbstract3DSymbol *clone() const override SIP_FACTORY;
48 
49  void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
50  void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
51 
53  Qgs3DTypes::AltitudeClamping altitudeClamping() const { return mAltClamping; }
55  void setAltitudeClamping( Qgs3DTypes::AltitudeClamping altClamping ) { mAltClamping = altClamping; }
56 
58  QgsPhongMaterialSettings material() const { return mMaterial; }
60  void setMaterial( const QgsPhongMaterialSettings &material ) { mMaterial = material; }
61 
63  enum Shape
64  {
65  Cylinder,
66  Sphere,
67  Cone,
68  Cube,
69  Torus,
70  Plane,
71  ExtrudedText,
72  Model,
73  Billboard,
74  };
75 
77  static Shape shapeFromString( const QString &shape );
79  static QString shapeToString( Shape shape );
80 
82  Shape shape() const { return mShape; }
84  void setShape( Shape shape ) { mShape = shape; }
85 
87  QVariantMap shapeProperties() const { return mShapeProperties; }
89  void setShapeProperties( const QVariantMap &properties ) { mShapeProperties = properties; }
90 
92  QgsMarkerSymbol *billboardSymbol() const { return mBillboardSymbol.get(); }
94  void setBillboardSymbol( QgsMarkerSymbol *symbol ) { mBillboardSymbol.reset( symbol ); }
95 
97  QMatrix4x4 transform() const { return mTransform; }
99  void setTransform( const QMatrix4x4 &transform ) { mTransform = transform; }
100 
102  QMatrix4x4 billboardTransform() const;
103 
104  private:
107 
108  QgsPhongMaterialSettings mMaterial;
109  Shape mShape = Cylinder;
110  QVariantMap mShapeProperties;
111  QMatrix4x4 mTransform;
112  std::unique_ptr<QgsMarkerSymbol> mBillboardSymbol;
113 #ifdef SIP_RUN
114  QgsPoint3DSymbol &operator=( const QgsPoint3DSymbol & );
115 #else
116  QgsPoint3DSymbol &operator=( const QgsPoint3DSymbol & ) = delete;
117 #endif
118 };
119 
120 
121 #endif // QGSPOINT3DSYMBOL_H
QgsReadWriteContext
Definition: qgsreadwritecontext.h:34
QgsPoint3DSymbol::Shape
Shape
3D shape types supported by the symbol
Definition: qgspoint3dsymbol.h:76
QgsAbstract3DSymbol::readXml
virtual void readXml(const QDomElement &elem, const QgsReadWriteContext &context)=0
Reads symbol configuration from the given DOM element.
Qgs3DTypes::AltClampRelative
@ AltClampRelative
Z_final = z_terrain + z_geometry.
Definition: qgs3dtypes.h:63
qgsabstract3dsymbol.h
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsPhongMaterialSettings
Definition: qgsphongmaterialsettings.h:35
QgsAbstract3DSymbol
Definition: qgsabstract3dsymbol.h:41
QgsMarkerSymbol
Definition: qgssymbol.h:917
QgsAbstract3DSymbol::type
virtual QString type() const =0
Returns identifier of symbol type. Each 3D symbol implementation should return a different type.
qgs3dtypes.h
QgsAbstract3DSymbol::clone
virtual QgsAbstract3DSymbol * clone() const =0
Returns a new instance of the symbol with the same settings.
Qgs3DTypes::AltitudeClamping
AltitudeClamping
how to handle altitude of vector features
Definition: qgs3dtypes.h:47
QgsAbstract3DSymbol::writeXml
virtual void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const =0
Writes symbol configuration to the given DOM element.
qgsphongmaterialsettings.h
qgssymbol.h
QgsPoint3DSymbol
Definition: qgspoint3dsymbol.h:37