Class: QgsTessellator¶
Tessellates 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.
Methods
Tessellates a triangle and adds its vertex entries to the output data array |
|
Returns array of triangle vertex data |
|
Returns the number of vertices stored in the output data array |
|
Returns a descriptive error string if the tessellation failed. |
|
Returns which faces are generated during extrusion. |
|
Returns whether back faces are being added to the output data ( |
|
Returns whether normals are inverted ( |
|
Returns whether normals are being added to the output data ( |
|
Returns whether texture UV coordinates are being added to the output data ( |
|
Returns whether the "up" direction should be the Z axis on output ( |
|
Returns whether Z values from the input geometries are ignored ( |
|
Returns the origin point of the map. |
|
Sets whether normals should be added to the output data ( |
|
Sets whether texture UV coordinates should be added to the output data ( |
|
Sets whether back faces should be added to the output data ( |
|
Sets scaling and the bounds of the input geometry coordinates. |
|
Sets which faces should be generated during extrusion. |
|
Sets whether Z values from the input geometries are ignored ( |
|
Sets whether normals should be inverted ( |
|
Sets the origin point of the map. |
|
Sets whether the "up" direction should be the Z axis on output ( |
|
Sets the rotation of texture UV coordinates (in degrees). |
|
Returns size of one vertex entry in bytes |
|
Returns the rotation of texture UV coordinates (in degrees). |
|
Returns maximal Z value of the data (in world coordinates) |
|
Returns minimal Z value of the data (in world coordinates) |
- class qgis.core.QgsTessellator[source]¶
Bases:
object- __init__()
- __init__(originX: float, originY: float, addNormals: bool, invertNormals: bool = False, addBackFaces: bool = False, noZ: bool = False, addTextureCoords: bool = False, facade: int = 3, textureRotation: float = 0)
Creates tessellator with a specified origin point of the world (in map coordinates)
Deprecated since version 4.0: Use the default QgsTessellator() constructor and individual setters instead.
- Parameters:
originX (float)
originY (float)
addNormals (bool)
invertNormals (bool = False)
addBackFaces (bool = False)
noZ (bool = False)
addTextureCoords (bool = False)
facade (int = 3)
textureRotation (float = 0)
- __init__(bounds: QgsRectangle, addNormals: bool, invertNormals: bool = False, addBackFaces: bool = False, noZ: bool = False, addTextureCoords: bool = False, facade: int = 3, textureRotation: float = 0)
Creates tessellator with a specified
boundsof input geometry coordinates. This constructor allows the tessellator to map input coordinates to a desirable range for numerical stability during calculations.If
noZisTrue, then a 2-dimensional tessellation only will be performed and all z coordinates will be ignored.Added in version 3.10.
Deprecated since version 4.0: Use the default QgsTessellator() constructor and individual setters instead.
- Parameters:
bounds (QgsRectangle)
addNormals (bool)
invertNormals (bool = False)
addBackFaces (bool = False)
noZ (bool = False)
addTextureCoords (bool = False)
facade (int = 3)
textureRotation (float = 0)
- __init__(a0: QgsTessellator)
- Parameters:
a0 (QgsTessellator)
- addPolygon(self, polygon: QgsPolygon, extrusionHeight: float)[source]¶
Tessellates a triangle and adds its vertex entries to the output data array
- Parameters:
polygon (QgsPolygon)
extrusionHeight (float)
- data(self) List[float]¶
Returns array of triangle vertex data
Vertice coordinates are stored as (x, z, -y)
- Return type:
List[float]
- dataVerticesCount(self) int[source]¶
Returns the number of vertices stored in the output data array
- Return type:
int
- error(self) str[source]¶
Returns a descriptive error string if the tessellation failed.
Added in version 3.34.
- Return type:
str
- extrusionFaces(self) Qgis.ExtrusionFaces[source]¶
Returns which faces are generated during extrusion.
Added in version 4.0.
- Return type:
- hasBackFacesEnabled(self) bool[source]¶
Returns whether back faces are being added to the output data (
True) or not (False).Added in version 4.0.
- Return type:
bool
- hasInvertedNormals(self) bool[source]¶
Returns whether normals are inverted (
True) or not (False).Added in version 4.0.
- Return type:
bool
- hasNormals(self) bool[source]¶
Returns whether normals are being added to the output data (
True) or not (False).Added in version 4.0.
- Return type:
bool
- hasTextureUVs(self) bool[source]¶
Returns whether texture UV coordinates are being added to the output data (
True) or not (False).Added in version 4.0.
- Return type:
bool
- isOutputZUp(self) bool[source]¶
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 isFalse(to keep compatibility for existing tessellator use cases).Added in version 3.42.
- Return type:
bool
- isZValueIgnored(self) bool[source]¶
Returns whether Z values from the input geometries are ignored (
True) or not (False).Added in version 4.0.
- Return type:
bool
- origin(self) QgsVector3D[source]¶
Returns the origin point of the map.
Added in version 4.0.
- Return type:
- setAddNormals(self, addNormals: bool)[source]¶
Sets whether normals should be added to the output data (
True) or not (False).Added in version 4.0.
- Parameters:
addNormals (bool)
- setAddTextureUVs(self, addTextureUVs: bool)[source]¶
Sets whether texture UV coordinates should be added to the output data (
True) or not (False).Added in version 4.0.
- Parameters:
addTextureUVs (bool)
- setBackFacesEnabled(self, addBackFaces: bool)[source]¶
Sets whether back faces should be added to the output data (
True) or not (False).Added in version 4.0.
- Parameters:
addBackFaces (bool)
- setBounds(self, bounds: QgsRectangle)[source]¶
Sets scaling and the bounds of the input geometry coordinates.
Added in version 4.0.
- Parameters:
bounds (QgsRectangle)
- setExtrusionFaces(self, faces: Qgis.ExtrusionFaces | Qgis.ExtrusionFace)[source]¶
Sets which faces should be generated during extrusion.
Added in version 4.0.
- Parameters:
faces (Union[Qgis.ExtrusionFaces, Qgis.ExtrusionFace])
- setInputZValueIgnored(self, ignore: bool)[source]¶
Sets whether Z values from the input geometries are ignored (
True) or not (False). By default, this isFalse.Added in version 4.0.
- Parameters:
ignore (bool)
- setInvertNormals(self, invertNormals: bool)[source]¶
Sets whether normals should be inverted (
True) or not (False).Added in version 4.0.
- Parameters:
invertNormals (bool)
- setOrigin(self, origin: QgsVector3D)[source]¶
Sets the origin point of the map.
Added in version 4.0.
- Parameters:
origin (QgsVector3D)
- setOutputZUp(self, zUp: bool)[source]¶
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 isFalse(to keep compatibility for existing tessellator use cases).Added in version 3.42.
- Parameters:
zUp (bool)
- setTextureRotation(self, rotation: float)[source]¶
Sets the rotation of texture UV coordinates (in degrees).
Added in version 4.0.
- Parameters:
rotation (float)
- textureRotation(self) float[source]¶
Returns the rotation of texture UV coordinates (in degrees).
Added in version 4.0.
- Return type:
float