QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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_core.h"
20 #include "qgis.h"
21 
22 class QgsPolygon;
23 class QgsMultiPolygon;
24 
25 #include <QVector>
26 #include <memory>
27 
39 class CORE_EXPORT QgsTessellator
40 {
41  public:
43  QgsTessellator( double originX, double originY, bool addNormals, bool invertNormals = false, bool addBackFaces = false );
44 
46  void addPolygon( const QgsPolygon &polygon, float extrusionHeight );
47 
53  QVector<float> data() const { return mData; }
54 
56  int dataVerticesCount() const;
57 
59  int stride() const { return mStride; }
60 
64  std::unique_ptr< QgsMultiPolygon > asMultiPolygon() const SIP_SKIP;
65 
66  private:
67  double mOriginX = 0, mOriginY = 0;
68  bool mAddNormals = false;
69  bool mInvertNormals = false;
70  bool mAddBackFaces = false;
71  QVector<float> mData;
72  int mStride;
73 };
74 
75 #endif // QGSTESSELLATOR_H
Class that takes care of tessellation of polygons into triangles.
#define SIP_SKIP
Definition: qgis_sip.h:119
QVector< float > data() const
Returns array of triangle vertex data.
int stride() const
Returns size of one vertex entry in bytes.
Multi polygon geometry collection.
Polygon geometry type.
Definition: qgspolygon.h:31