QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
QgsTessellatedPolygonGeometry Class Reference

3 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.
 
bool addBackFaces () const
 Returns whether also triangles facing the other side will be created.
 
QVector< QgsFeatureIdfeatureIds () const
 Returns included feature ids.
 
bool invertNormals () const
 Returns whether the normals of triangles will be inverted (useful for fixing clockwise / counter-clockwise face vertex orders)
 
void setAddBackFaces (bool add)
 Sets whether also triangles facing the other side will be created.
 
void setAddTextureCoords (bool add)
 Sets whether the texture coordinates will be generated.
 
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.
 
void setInvertNormals (bool invert)
 Sets whether the normals of triangles will be inverted (useful for fixing clockwise / counter-clockwise face vertex orders)
 
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.
 
QVector< uint > triangleIndexStartingIndices () const
 Returns triangle index for features. For a feature featureIds()[i], matching triangles start at triangleIndexStartingIndices()[i].
 
QgsFeatureId triangleIndexToFeatureId (uint triangleIndex) const
 Returns ID of the feature to which given triangle index belongs (used for picking).
 

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

Definition at line 63 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 37 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 80 of file qgstessellatedpolygongeometry.h.

◆ featureIds()

QVector< QgsFeatureId > QgsTessellatedPolygonGeometry::featureIds ( ) const
inline

Returns included feature ids.

Definition at line 111 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 72 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 86 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 92 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 121 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 74 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 85 of file qgstessellatedpolygongeometry.cpp.

◆ triangleIndexStartingIndices()

QVector< uint > QgsTessellatedPolygonGeometry::triangleIndexStartingIndices ( ) const
inline

Returns triangle index for features. For a feature featureIds()[i], matching triangles start at triangleIndexStartingIndices()[i].

Definition at line 114 of file qgstessellatedpolygongeometry.h.

◆ 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 164 of file qgstessellatedpolygongeometry.cpp.

Friends And Related Symbol Documentation

◆ Qgs3DSceneExporter

friend class Qgs3DSceneExporter
friend

Definition at line 116 of file qgstessellatedpolygongeometry.h.


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