QGIS API Documentation  3.17.0-Master (a035f434f4)
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"
22 #include "qgs3dtypes.h"
23 #include "qgssymbol.h"
24 
25 #include <QMatrix4x4>
26 
28 
39 {
40  public:
43 
45  QgsPoint3DSymbol( const QgsPoint3DSymbol &other );
46 
52  static QgsAbstract3DSymbol *create() SIP_FACTORY;
53 
54  QString type() const override { return "point"; }
55  QgsAbstract3DSymbol *clone() const override SIP_FACTORY;
56 
57  void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
58  void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
59  QList< QgsWkbTypes::GeometryType > compatibleGeometryTypes() const override;
60 
62  Qgs3DTypes::AltitudeClamping altitudeClamping() const { return mAltClamping; }
64  void setAltitudeClamping( Qgs3DTypes::AltitudeClamping altClamping ) { mAltClamping = altClamping; }
65 
67  QgsAbstractMaterialSettings *material() const;
68 
74  void setMaterial( QgsAbstractMaterialSettings *material SIP_TRANSFER );
75 
77  enum Shape
78  {
88  };
89 
91  static Shape shapeFromString( const QString &shape );
93  static QString shapeToString( Shape shape );
94 
96  Shape shape() const { return mShape; }
98  void setShape( Shape shape ) { mShape = shape; }
99 
101  QVariantMap shapeProperties() const { return mShapeProperties; }
103  void setShapeProperties( const QVariantMap &properties ) { mShapeProperties = properties; }
104 
106  QgsMarkerSymbol *billboardSymbol() const { return mBillboardSymbol.get(); }
108  void setBillboardSymbol( QgsMarkerSymbol *symbol ) { mBillboardSymbol.reset( symbol ); }
109 
111  QMatrix4x4 transform() const { return mTransform; }
113  void setTransform( const QMatrix4x4 &transform ) { mTransform = transform; }
114 
116  QMatrix4x4 billboardTransform() const;
117 
122  bool exportGeometries( Qgs3DSceneExporter *exporter, Qt3DCore::QEntity *entity, const QString &objectNamePrefix ) const override SIP_SKIP;
123  private:
126 
127  std::unique_ptr< QgsAbstractMaterialSettings> mMaterial;
128  Shape mShape = Cylinder;
129  QVariantMap mShapeProperties;
130  QMatrix4x4 mTransform;
131  std::unique_ptr<QgsMarkerSymbol> mBillboardSymbol;
132 #ifdef SIP_RUN
133  QgsPoint3DSymbol &operator=( const QgsPoint3DSymbol & );
134 #else
135  QgsPoint3DSymbol &operator=( const QgsPoint3DSymbol & ) = delete;
136 #endif
137 };
138 
139 
140 #endif // QGSPOINT3DSYMBOL_H
QString type() const override
AltitudeClamping
how to handle altitude of vector features
Definition: qgs3dtypes.h:34
The class is used as a container of context for various read/write operations on other objects...
void setAltitudeClamping(Qgs3DTypes::AltitudeClamping altClamping)
Sets method that determines altitude (whether to clamp to feature to terrain)
virtual QgsAbstract3DSymbol * clone() const =0
Returns a new instance of the symbol with the same settings.
void setTransform(const QMatrix4x4 &transform)
Sets transform for individual objects represented by the symbol.
Qgs3DTypes::AltitudeClamping altitudeClamping() const
Returns method that determines altitude (whether to clamp to feature to terrain)
Shape shape() const
Returns 3D shape for points.
void setShape(Shape shape)
Sets 3D shape for points.
QVariantMap shapeProperties() const
Returns a key-value dictionary of point shape properties.
The Qgs3DSceneExporter class Entity that handles the exporting of 3D scene.
Supported in Qt 5.9+.
virtual void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const =0
Writes symbol configuration to the given DOM element.
A marker symbol type, for rendering Point and MultiPoint geometries.
Definition: qgssymbol.h:985
3 Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
QMatrix4x4 transform() const
Returns transform for individual objects represented by the symbol.
virtual bool exportGeometries(Qgs3DSceneExporter *exporter, Qt3DCore::QEntity *entity, const QString &objectNamePrefix) const
Exports the geometries contained within the hierarchy of entity.
3 Abstract base class for material settings.
#define SIP_SKIP
Definition: qgis_sip.h:126
3 3D symbol that draws point geometries as 3D objects using one of the predefined shapes...
void setShapeProperties(const QVariantMap &properties)
Sets a key-value dictionary of point shape properties.
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsMarkerSymbol * billboardSymbol() const
Returns a symbol for billboard.
virtual QList< QgsWkbTypes::GeometryType > compatibleGeometryTypes() const
Returns the list of the vector layer geometry types which are compatible with this symbol...
#define SIP_FACTORY
Definition: qgis_sip.h:76
Shape
3D shape types supported by the symbol
void setBillboardSymbol(QgsMarkerSymbol *symbol)
Set symbol for billboard and the ownership is transferred.
#define SIP_NODEFAULTCTORS
Definition: qgis_sip.h:101
virtual void readXml(const QDomElement &elem, const QgsReadWriteContext &context)=0
Reads symbol configuration from the given DOM element.
Z_final = z_terrain + z_geometry.
Definition: qgs3dtypes.h:37