QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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_sip.h"
21 #include "qgsrectangle.h"
22 
23 class QgsPolygon;
24 class QgsMultiPolygon;
25 
26 #include <QVector>
27 #include <memory>
28 
40 class CORE_EXPORT QgsTessellator
41 {
42  public:
44  QgsTessellator( double originX, double originY, bool addNormals, bool invertNormals = false, bool addBackFaces = false );
45 
55  QgsTessellator( const QgsRectangle &bounds, bool addNormals, bool invertNormals = false, bool addBackFaces = false, bool noZ = false );
56 
58  void addPolygon( const QgsPolygon &polygon, float extrusionHeight );
59 
65  QVector<float> data() const { return mData; }
66 
68  int dataVerticesCount() const;
69 
71  int stride() const { return mStride; }
72 
76  std::unique_ptr< QgsMultiPolygon > asMultiPolygon() const SIP_SKIP;
77 
82  float zMinimum() const { return mZMin; }
83 
88  float zMaximum() const { return mZMax; }
89 
90  private:
91  void init();
92 
93  QgsRectangle mBounds;
94  double mOriginX = 0, mOriginY = 0;
95  bool mAddNormals = false;
96  bool mInvertNormals = false;
97  bool mAddBackFaces = false;
98  QVector<float> mData;
99  int mStride;
100  bool mNoZ = false;
101 
102  float mZMin = std::numeric_limits<float>::max();
103  float mZMax = std::numeric_limits<float>::min();
104 };
105 
106 #endif // QGSTESSELLATOR_H
QgsPolygon
Polygon geometry type.
Definition: qgspolygon.h:33
qgsrectangle.h
QgsTessellator::stride
int stride() const
Returns size of one vertex entry in bytes.
Definition: qgstessellator.h:71
QgsRectangle
Definition: qgsrectangle.h:41
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
qgis_sip.h
QgsMultiPolygon
Multi polygon geometry collection.
Definition: qgsmultipolygon.h:29
QgsTessellator
Definition: qgstessellator.h:40
QgsTessellator::data
QVector< float > data() const
Returns array of triangle vertex data.
Definition: qgstessellator.h:65
QgsTessellator::zMaximum
float zMaximum() const
Returns maximal Z value of the data (in world coordinates)
Definition: qgstessellator.h:88