QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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, bool noZ = false,
45  bool addTextureCoords = false, int facade = 3, float textureRotation = 0.0f );
46 
56  QgsTessellator( const QgsRectangle &bounds, bool addNormals, bool invertNormals = false, bool addBackFaces = false, bool noZ = false,
57  bool addTextureCoords = false, int facade = 3, float textureRotation = 0.0f );
58 
60  void addPolygon( const QgsPolygon &polygon, float extrusionHeight );
61 
67  QVector<float> data() const { return mData; }
68 
70  int dataVerticesCount() const;
71 
73  int stride() const { return mStride; }
74 
78  std::unique_ptr< QgsMultiPolygon > asMultiPolygon() const SIP_SKIP;
79 
84  float zMinimum() const { return mZMin; }
85 
90  float zMaximum() const { return mZMax; }
91 
92  private:
93  void init();
94 
95  QgsRectangle mBounds;
96  double mOriginX = 0, mOriginY = 0;
97  bool mAddNormals = false;
98  bool mInvertNormals = false;
99  bool mAddBackFaces = false;
100  bool mAddTextureCoords = false;
101  QVector<float> mData;
102  int mStride;
103  bool mNoZ = false;
104  int mTessellatedFacade = 3;
105  float mTextureRotation = 0.0f;
106 
107  float mZMin = std::numeric_limits<float>::max();
108  float mZMax = std::numeric_limits<float>::min();
109 };
110 
111 #endif // QGSTESSELLATOR_H
QgsPolygon
Polygon geometry type.
Definition: qgspolygon.h:34
qgsrectangle.h
QgsTessellator::stride
int stride() const
Returns size of one vertex entry in bytes.
Definition: qgstessellator.h:73
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:42
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
qgis_sip.h
QgsMultiPolygon
Multi polygon geometry collection.
Definition: qgsmultipolygon.h:32
QgsTessellator
Class that takes care of tessellation of polygons into triangles.
Definition: qgstessellator.h:41
QgsTessellator::data
QVector< float > data() const
Returns array of triangle vertex data.
Definition: qgstessellator.h:67
QgsTessellator::zMaximum
float zMaximum() const
Returns maximal Z value of the data (in world coordinates)
Definition: qgstessellator.h:90