QGIS API Documentation  3.2.0-Bonn (bc43194)
qgstessellatedpolygongeometry.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstessellatedpolygongeometry.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 QGSTESSELLATEDPOLYGONGEOMETRY_H
17 #define QGSTESSELLATEDPOLYGONGEOMETRY_H
18 
19 #include "qgspolygon.h"
20 
21 #include <Qt3DRender/QGeometry>
22 
23 namespace Qt3DRender
24 {
25  class QBuffer;
26 }
27 
37 class QgsTessellatedPolygonGeometry : public Qt3DRender::QGeometry
38 {
39  public:
41  QgsTessellatedPolygonGeometry( QNode *parent = nullptr );
42 
44  bool invertNormals() const { return mInvertNormals; }
46  void setInvertNormals( bool invert ) { mInvertNormals = invert; }
47 
52  bool addBackFaces() const { return mAddBackFaces; }
53 
58  void setAddBackFaces( bool add ) { mAddBackFaces = add; }
59 
61  void setPolygons( const QList<QgsPolygon *> &polygons, const QgsPointXY &origin, float extrusionHeight, const QList<float> &extrusionHeightPerPolygon = QList<float>() );
62 
63  private:
64 
65  Qt3DRender::QAttribute *mPositionAttribute = nullptr;
66  Qt3DRender::QAttribute *mNormalAttribute = nullptr;
67  Qt3DRender::QBuffer *mVertexBuffer = nullptr;
68 
69  bool mWithNormals = true;
70  bool mInvertNormals = false;
71  bool mAddBackFaces = false;
72 };
73 
74 #endif // QGSTESSELLATEDPOLYGONGEOMETRY_H
void setInvertNormals(bool invert)
Sets whether the normals of triangles will be inverted (useful for fixing clockwise / counter-clockwi...
A class to represent a 2D point.
Definition: qgspointxy.h:43
3 Class derived from Qt3DRender::QGeometry that represents polygons tessellated into 3D geometry...
bool addBackFaces() const
Returns whether also triangles facing the other side will be created.
void setAddBackFaces(bool add)
Sets whether also triangles facing the other side will be created.
bool invertNormals() const
Returns whether the normals of triangles will be inverted (useful for fixing clockwise / counter-cloc...