QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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
64 void setOutputZUp( bool zUp ) { mOutputZUp = zUp; }
65
72 bool isOutputZUp() const { return mOutputZUp; }
73
75 void addPolygon( const QgsPolygon &polygon, float extrusionHeight );
76
82 QVector<float> data() const { return mData; }
83
85 int dataVerticesCount() const;
86
88 int stride() const { return mStride; }
89
93 std::unique_ptr< QgsMultiPolygon > asMultiPolygon() const SIP_SKIP;
94
99 float zMinimum() const { return mZMin; }
100
105 float zMaximum() const { return mZMax; }
106
112 QString error() const { return mError; }
113
114 private:
115 void init();
116
117 QgsRectangle mBounds;
118 double mOriginX = 0, mOriginY = 0;
119 bool mAddNormals = false;
120 bool mInvertNormals = false;
121 bool mAddBackFaces = false;
122 bool mAddTextureCoords = false;
123 bool mOutputZUp = false;
124 QVector<float> mData;
125 int mStride;
126 bool mNoZ = false;
127 int mTessellatedFacade = 3;
128 float mTextureRotation = 0.0f;
129 QString mError;
130
131 float mZMin = std::numeric_limits<float>::max();
132 float mZMax = -std::numeric_limits<float>::max();
133};
134
135#endif // QGSTESSELLATOR_H
Multi polygon geometry collection.
Polygon geometry type.
Definition qgspolygon.h:33
A rectangle specified with double values.
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.
void setOutputZUp(bool zUp)
Sets whether the "up" direction should be the Z axis on output (true), otherwise the "up" direction w...
bool isOutputZUp() const
Returns whether the "up" direction should be the Z axis on output (true), otherwise the "up" directio...
float zMaximum() const
Returns maximal Z value of the data (in world coordinates)
#define SIP_SKIP
Definition qgis_sip.h:126