QGIS API Documentation  3.0.2-Girona (307d082)
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 );
43 
45  bool invertNormals() const { return mInvertNormals; }
47  void setInvertNormals( bool invert ) { mInvertNormals = invert; }
48 
50  void setPolygons( const QList<QgsPolygon *> &polygons, const QgsPointXY &origin, float extrusionHeight, const QList<float> &extrusionHeightPerPolygon = QList<float>() );
51 
52  private:
53 
54  Qt3DRender::QAttribute *mPositionAttribute = nullptr;
55  Qt3DRender::QAttribute *mNormalAttribute = nullptr;
56  Qt3DRender::QBuffer *mVertexBuffer = nullptr;
57 
58  bool mWithNormals = true;
59  bool mInvertNormals = false;
60 };
61 
62 #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 invertNormals() const
Returns whether the normals of triangles will be inverted (useful for fixing clockwise / counter-cloc...