QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
Public Member Functions | Friends | List of all members
QgsTessellatedPolygonGeometry Class Reference

3 Class derived from Qt3DRender::QGeometry that represents polygons tessellated into 3D geometry. More...

#include <qgstessellatedpolygongeometry.h>

Inheritance diagram for QgsTessellatedPolygonGeometry:
Inheritance graph
[legend]

Public Member Functions

 QgsTessellatedPolygonGeometry (bool _withNormals=true, bool invertNormals=false, bool addBackFaces=false, bool addTextureCoords=false, QNode *parent=nullptr)
 Constructor. More...
 
bool addBackFaces () const
 Returns whether also triangles facing the other side will be created. More...
 
bool invertNormals () const
 Returns whether the normals of triangles will be inverted (useful for fixing clockwise / counter-clockwise face vertex orders) More...
 
void setAddBackFaces (bool add)
 Sets whether also triangles facing the other side will be created. More...
 
void setAddTextureCoords (bool add)
 Sets whether the texture coordinates will be generated. More...
 
void setData (const QByteArray &vertexBufferData, int vertexCount, const QVector< QgsFeatureId > &triangleIndexFids, const QVector< uint > &triangleIndexStartingIndices)
 Initializes vertex buffer (and other members) from data that were already tessellated. More...
 
void setInvertNormals (bool invert)
 Sets whether the normals of triangles will be inverted (useful for fixing clockwise / counter-clockwise face vertex orders) More...
 
void setPolygons (const QList< QgsPolygon * > &polygons, const QList< QgsFeatureId > &featureIds, const QgsPointXY &origin, float extrusionHeight, const QList< float > &extrusionHeightPerPolygon=QList< float >())
 Initializes vertex buffer from given polygons. Takes ownership of passed polygon geometries. More...
 
QgsFeatureId triangleIndexToFeatureId (uint triangleIndex) const
 Returns ID of the feature to which given triangle index belongs (used for picking). More...
 

Friends

class Qgs3DSceneExporter
 

Detailed Description

3 Class derived from Qt3DRender::QGeometry that represents polygons tessellated into 3D geometry.

Takes a list of polygons as input, internally it does tessellation and writes output to the internal vertex buffer. Optionally it can add "walls" if the extrusion height is non-zero.

Note
Not available in Python bindings
Since
QGIS 3.0

Definition at line 44 of file qgstessellatedpolygongeometry.h.

Constructor & Destructor Documentation

◆ QgsTessellatedPolygonGeometry()

QgsTessellatedPolygonGeometry::QgsTessellatedPolygonGeometry ( bool  _withNormals = true,
bool  invertNormals = false,
bool  addBackFaces = false,
bool  addTextureCoords = false,
QNode *  parent = nullptr 
)

Constructor.

Definition at line 28 of file qgstessellatedpolygongeometry.cpp.

Member Function Documentation

◆ addBackFaces()

bool QgsTessellatedPolygonGeometry::addBackFaces ( ) const
inline

Returns whether also triangles facing the other side will be created.

Useful if input data have inconsistent order of vertices

Since
QGIS 3.2

Definition at line 60 of file qgstessellatedpolygongeometry.h.

◆ invertNormals()

bool QgsTessellatedPolygonGeometry::invertNormals ( ) const
inline

Returns whether the normals of triangles will be inverted (useful for fixing clockwise / counter-clockwise face vertex orders)

Definition at line 52 of file qgstessellatedpolygongeometry.h.

◆ setAddBackFaces()

void QgsTessellatedPolygonGeometry::setAddBackFaces ( bool  add)
inline

Sets whether also triangles facing the other side will be created.

Useful if input data have inconsistent order of vertices

Since
QGIS 3.2

Definition at line 66 of file qgstessellatedpolygongeometry.h.

◆ setAddTextureCoords()

void QgsTessellatedPolygonGeometry::setAddTextureCoords ( bool  add)
inline

Sets whether the texture coordinates will be generated.

Since
QGIS 3.16

Definition at line 72 of file qgstessellatedpolygongeometry.h.

◆ setData()

void QgsTessellatedPolygonGeometry::setData ( const QByteArray &  vertexBufferData,
int  vertexCount,
const QVector< QgsFeatureId > &  triangleIndexFids,
const QVector< uint > &  triangleIndexStartingIndices 
)

Initializes vertex buffer (and other members) from data that were already tessellated.

This is an alternative to setPolygons() - this method does not do any expensive work in the body.

Since
QGIS 3.12

Definition at line 112 of file qgstessellatedpolygongeometry.cpp.

◆ setInvertNormals()

void QgsTessellatedPolygonGeometry::setInvertNormals ( bool  invert)
inline

Sets whether the normals of triangles will be inverted (useful for fixing clockwise / counter-clockwise face vertex orders)

Definition at line 54 of file qgstessellatedpolygongeometry.h.

◆ setPolygons()

void QgsTessellatedPolygonGeometry::setPolygons ( const QList< QgsPolygon * > &  polygons,
const QList< QgsFeatureId > &  featureIds,
const QgsPointXY origin,
float  extrusionHeight,
const QList< float > &  extrusionHeightPerPolygon = QList<float>() 
)

Initializes vertex buffer from given polygons. Takes ownership of passed polygon geometries.

Definition at line 80 of file qgstessellatedpolygongeometry.cpp.

◆ triangleIndexToFeatureId()

QgsFeatureId QgsTessellatedPolygonGeometry::triangleIndexToFeatureId ( uint  triangleIndex) const

Returns ID of the feature to which given triangle index belongs (used for picking).

In case such triangle index does not match any feature, FID_NULL is returned.

Definition at line 153 of file qgstessellatedpolygongeometry.cpp.

Friends And Related Function Documentation

◆ Qgs3DSceneExporter

friend class Qgs3DSceneExporter
friend

Definition at line 90 of file qgstessellatedpolygongeometry.h.


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