QGIS API Documentation 3.41.0-Master (3440c17df1d)
|
Class that takes care of tessellation of polygons into triangles. More...
#include <qgstessellator.h>
Public Member Functions | |
QgsTessellator (const QgsRectangle &bounds, bool addNormals, bool invertNormals=false, bool addBackFaces=false, bool noZ=false, bool addTextureCoords=false, int facade=3, float textureRotation=0.0f) | |
Creates tessellator with a specified bounds of input geometry coordinates. | |
QgsTessellator (double originX, double originY, bool addNormals, bool invertNormals=false, bool addBackFaces=false, bool noZ=false, bool addTextureCoords=false, int facade=3, float textureRotation=0.0f) | |
Creates tessellator with a specified origin point of the world (in map coordinates) | |
void | addPolygon (const QgsPolygon &polygon, float extrusionHeight) |
Tessellates a triangle and adds its vertex entries to the output data array. | |
std::unique_ptr< QgsMultiPolygon > | asMultiPolygon () const |
Returns the triangulation as a multipolygon geometry. | |
QVector< float > | data () const |
Returns array of triangle vertex data. | |
int | dataVerticesCount () const |
Returns the number of vertices stored in the output data array. | |
QString | error () const |
Returns a descriptive error string if the tessellation failed. | |
bool | isOutputZUp () const |
Returns whether the "up" direction should be the Z axis on output (true ), otherwise the "up" direction will be the Y axis (false ). | |
void | setOutputZUp (bool zUp) |
Sets whether the "up" direction should be the Z axis on output (true ), otherwise the "up" direction will be the Y axis (false ). | |
int | stride () const |
Returns size of one vertex entry in bytes. | |
float | zMaximum () const |
Returns maximal Z value of the data (in world coordinates) | |
float | zMinimum () const |
Returns minimal Z value of the data (in world coordinates) | |
Class that takes care of tessellation of polygons into triangles.
It is expected that client code will create the tessellator object, then repeatedly call addPolygon() method that will generate triangles, and finally call data() to get final vertex data.
Optionally provides extrusion by adding triangles that serve as walls when extrusion height is non-zero.
Definition at line 39 of file qgstessellator.h.
QgsTessellator::QgsTessellator | ( | double | originX, |
double | originY, | ||
bool | addNormals, | ||
bool | invertNormals = false , |
||
bool | addBackFaces = false , |
||
bool | noZ = false , |
||
bool | addTextureCoords = false , |
||
int | facade = 3 , |
||
float | textureRotation = 0.0f |
||
) |
Creates tessellator with a specified origin point of the world (in map coordinates)
Definition at line 179 of file qgstessellator.cpp.
QgsTessellator::QgsTessellator | ( | const QgsRectangle & | bounds, |
bool | addNormals, | ||
bool | invertNormals = false , |
||
bool | addBackFaces = false , |
||
bool | noZ = false , |
||
bool | addTextureCoords = false , |
||
int | facade = 3 , |
||
float | textureRotation = 0.0f |
||
) |
Creates tessellator with a specified bounds of input geometry coordinates.
This constructor allows the tessellator to map input coordinates to a desirable range for numerical stability during calculations.
If noZ is true
, then a 2-dimensional tessellation only will be performed and all z coordinates will be ignored.
Definition at line 194 of file qgstessellator.cpp.
void QgsTessellator::addPolygon | ( | const QgsPolygon & | polygon, |
float | extrusionHeight | ||
) |
Tessellates a triangle and adds its vertex entries to the output data array.
Definition at line 484 of file qgstessellator.cpp.
std::unique_ptr< QgsMultiPolygon > QgsTessellator::asMultiPolygon | ( | ) | const |
Returns the triangulation as a multipolygon geometry.
Definition at line 818 of file qgstessellator.cpp.
|
inline |
Returns array of triangle vertex data.
Vertice coordinates are stored as (x, z, -y)
Definition at line 82 of file qgstessellator.h.
int QgsTessellator::dataVerticesCount | ( | ) | const |
Returns the number of vertices stored in the output data array.
Definition at line 813 of file qgstessellator.cpp.
|
inline |
Returns a descriptive error string if the tessellation failed.
Definition at line 112 of file qgstessellator.h.
|
inline |
Returns whether the "up" direction should be the Z axis on output (true
), otherwise the "up" direction will be the Y axis (false
).
The default value is false
(to keep compatibility for existing tessellator use cases).
Definition at line 72 of file qgstessellator.h.
|
inline |
Sets whether the "up" direction should be the Z axis on output (true
), otherwise the "up" direction will be the Y axis (false
).
The default value is false
(to keep compatibility for existing tessellator use cases).
Definition at line 64 of file qgstessellator.h.
|
inline |
Returns size of one vertex entry in bytes.
Definition at line 88 of file qgstessellator.h.
|
inline |
Returns maximal Z value of the data (in world coordinates)
Definition at line 105 of file qgstessellator.h.
|
inline |
Returns minimal Z value of the data (in world coordinates)
Definition at line 99 of file qgstessellator.h.