QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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 
78  private:
79  void init();
80 
81  QgsRectangle mBounds;
82  double mOriginX = 0, mOriginY = 0;
83  bool mAddNormals = false;
84  bool mInvertNormals = false;
85  bool mAddBackFaces = false;
86  QVector<float> mData;
87  int mStride;
88  bool mNoZ = false;
89 };
90 
91 #endif // QGSTESSELLATOR_H
QVector< float > data() const
Returns array of triangle vertex data.
A rectangle specified with double values.
Definition: qgsrectangle.h:41
int stride() const
Returns size of one vertex entry in bytes.
Class that takes care of tessellation of polygons into triangles.
#define SIP_SKIP
Definition: qgis_sip.h:126
Multi polygon geometry collection.
Polygon geometry type.
Definition: qgspolygon.h:31