QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Member Functions | List of all members
QgsTessellator Class Reference

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. More...
 
 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) More...
 
void addPolygon (const QgsPolygon &polygon, float extrusionHeight)
 Tessellates a triangle and adds its vertex entries to the output data array. More...
 
std::unique_ptr< QgsMultiPolygonasMultiPolygon () const
 Returns the triangulation as a multipolygon geometry. More...
 
QVector< float > data () const
 Returns array of triangle vertex data. More...
 
int dataVerticesCount () const
 Returns the number of vertices stored in the output data array. More...
 
QString error () const
 Returns a descriptive error string if the tessellation failed. More...
 
int stride () const
 Returns size of one vertex entry in bytes. More...
 
float zMaximum () const
 Returns maximal Z value of the data (in world coordinates) More...
 
float zMinimum () const
 Returns minimal Z value of the data (in world coordinates) More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ QgsTessellator() [1/2]

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 162 of file qgstessellator.cpp.

◆ QgsTessellator() [2/2]

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.

Since
QGIS 3.10

Definition at line 177 of file qgstessellator.cpp.

Member Function Documentation

◆ addPolygon()

void QgsTessellator::addPolygon ( const QgsPolygon polygon,
float  extrusionHeight 
)

Tessellates a triangle and adds its vertex entries to the output data array.

Definition at line 467 of file qgstessellator.cpp.

◆ asMultiPolygon()

std::unique_ptr< QgsMultiPolygon > QgsTessellator::asMultiPolygon ( ) const

Returns the triangulation as a multipolygon geometry.

Definition at line 756 of file qgstessellator.cpp.

◆ data()

QVector< float > QgsTessellator::data ( ) const
inline

Returns array of triangle vertex data.

Vertice coordinates are stored as (x, z, -y)

Definition at line 66 of file qgstessellator.h.

◆ dataVerticesCount()

int QgsTessellator::dataVerticesCount ( ) const

Returns the number of vertices stored in the output data array.

Definition at line 751 of file qgstessellator.cpp.

◆ error()

QString QgsTessellator::error ( ) const
inline

Returns a descriptive error string if the tessellation failed.

Since
QGIS 3.34

Definition at line 96 of file qgstessellator.h.

◆ stride()

int QgsTessellator::stride ( ) const
inline

Returns size of one vertex entry in bytes.

Definition at line 72 of file qgstessellator.h.

◆ zMaximum()

float QgsTessellator::zMaximum ( ) const
inline

Returns maximal Z value of the data (in world coordinates)

Since
QGIS 3.12

Definition at line 89 of file qgstessellator.h.

◆ zMinimum()

float QgsTessellator::zMinimum ( ) const
inline

Returns minimal Z value of the data (in world coordinates)

Since
QGIS 3.12

Definition at line 83 of file qgstessellator.h.


The documentation for this class was generated from the following files: