QGIS API Documentation  3.2.0-Bonn (bc43194)
qgstessellator.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstessellator.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 QGSTESSELLATOR_H
17 #define QGSTESSELLATOR_H
18 
19 #include "qgis_3d.h"
20 
21 class QgsPolygon;
22 class QgsMultiPolygon;
23 
24 #include <QVector>
25 #include <memory>
26 
38 class _3D_EXPORT QgsTessellator
39 {
40  public:
42  QgsTessellator( double originX, double originY, bool addNormals, bool invertNormals = false, bool addBackFaces = false );
43 
45  void addPolygon( const QgsPolygon &polygon, float extrusionHeight );
46 
48  QVector<float> data() const { return mData; }
50  int stride() const { return mStride; }
51 
55  std::unique_ptr< QgsMultiPolygon > asMultiPolygon() const;
56 
57  private:
58  double mOriginX = 0, mOriginY = 0;
59  bool mAddNormals = false;
60  bool mInvertNormals = false;
61  bool mAddBackFaces = false;
62  QVector<float> mData;
63  int mStride;
64 };
65 
66 #endif // QGSTESSELLATOR_H
QVector< float > data() const
Returns array of triangle vertex data.
int stride() const
Returns size of one vertex entry in bytes.
3 Class that takes care of tessellation of polygons into triangles.
Multi polygon geometry collection.
Polygon geometry type.
Definition: qgspolygon.h:31