QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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
23class QgsPolygon;
24class QgsMultiPolygon;
25
26#include <QVector>
27#include <memory>
28
39class CORE_EXPORT QgsTessellator
40{
41 public:
43 QgsTessellator( double originX, double originY, bool addNormals, bool invertNormals = false, bool addBackFaces = false, bool noZ = false,
44 bool addTextureCoords = false, int facade = 3, float textureRotation = 0.0f );
45
55 QgsTessellator( const QgsRectangle &bounds, bool addNormals, bool invertNormals = false, bool addBackFaces = false, bool noZ = false,
56 bool addTextureCoords = false, int facade = 3, float textureRotation = 0.0f );
57
59 void addPolygon( const QgsPolygon &polygon, float extrusionHeight );
60
66 QVector<float> data() const { return mData; }
67
69 int dataVerticesCount() const;
70
72 int stride() const { return mStride; }
73
77 std::unique_ptr< QgsMultiPolygon > asMultiPolygon() const SIP_SKIP;
78
83 float zMinimum() const { return mZMin; }
84
89 float zMaximum() const { return mZMax; }
90
96 QString error() const { return mError; }
97
98 private:
99 void init();
100
101 QgsRectangle mBounds;
102 double mOriginX = 0, mOriginY = 0;
103 bool mAddNormals = false;
104 bool mInvertNormals = false;
105 bool mAddBackFaces = false;
106 bool mAddTextureCoords = false;
107 QVector<float> mData;
108 int mStride;
109 bool mNoZ = false;
110 int mTessellatedFacade = 3;
111 float mTextureRotation = 0.0f;
112 QString mError;
113
114 float mZMin = std::numeric_limits<float>::max();
115 float mZMax = -std::numeric_limits<float>::max();
116};
117
118#endif // QGSTESSELLATOR_H
Multi polygon geometry collection.
Polygon geometry type.
Definition: qgspolygon.h:33
A rectangle specified with double values.
Definition: qgsrectangle.h:42
Class that takes care of tessellation of polygons into triangles.
QVector< float > data() const
Returns array of triangle vertex data.
int stride() const
Returns size of one vertex entry in bytes.
QString error() const
Returns a descriptive error string if the tessellation failed.
float zMaximum() const
Returns maximal Z value of the data (in world coordinates)
#define SIP_SKIP
Definition: qgis_sip.h:126