Class: QgsPolyhedralSurface

Polyhedral surface geometry type.

A polyhedral surface is a collection of polygons which share common boundary segments.

Added in version 3.40.

Class Hierarchy

Inheritance diagram of qgis.core.QgsPolyhedralSurface

Base classes

QgsSurface

Surface geometry type.

QgsAbstractGeometry

Abstract base class for all geometries.

Subclasses

QgsTriangulatedSurface

Triangulated surface geometry type.

class qgis.core.QgsPolyhedralSurface[source]

Bases: QgsSurface

__init__()
__init__(p: QgsPolyhedralSurface)
Parameters:

p (QgsPolyhedralSurface)

__init__(multiPolygon: QgsMultiPolygon | None)

Creates a polyhedral surface from a multiPolygon.

Parameters:

multiPolygon (Optional[QgsMultiPolygon])

virtual addPatch(self, patch: QgsPolygon | None)[source]

Adds a patch to the geometry, transferring ownership to the polyhedral surface.

Parameters:

patch (Optional[QgsPolygon])

numPatches(self) int[source]

Returns the number of patches contained with the polyhedral surface.

See also

patchN()

Return type:

int

patchN(self, i: int) QgsPolygon[source]

Retrieves a patch from the polyhedral surface. The first patch has index 0.

Raises:

IndexError – if no patch with the specified index exists.

See also

numPatches()

Parameters:

i (int)

Return type:

QgsPolygon

removePatch(self, ringIndex: int) bool[source]

Removes a patch from the polyhedral surface. The first patch has index 0. The corresponding patch is removed from the polyhedral surface and deleted.

Raises:

IndexError – if no patch with the specified index exists.

Parameters:

ringIndex (int)

Return type:

bool

virtual segmentize(self, tolerance: float = M_PI_2 / 90, toleranceType: QgsAbstractGeometry.SegmentationToleranceType = QgsAbstractGeometry.MaximumAngle) QgsAbstractGeometry | None[source]

Returns a geometry without curves. Caller takes ownership

Parameters:
  • tolerance (float = M_PI_2/90) – segmentation tolerance

  • toleranceType (QgsAbstractGeometry.SegmentationToleranceType = QgsAbstractGeometry.MaximumAngle) – maximum segmentation angle or maximum difference between approximation and curve

Return type:

Optional[QgsAbstractGeometry]

virtual setPatches(self, patches: Iterable[QgsPolygon])[source]

Sets all patches, transferring ownership to the polyhedral surface.

Parameters:

patches (Iterable[QgsPolygon])

toMultiPolygon(self) QgsMultiPolygon | None[source]

Converts a polyhedral surface to a multipolygon. Caller takes ownership.

Return type:

Optional[QgsMultiPolygon]

abstract vertexAngle(self, vertex: QgsVertexId) float[source]

Returns approximate rotation angle for a vertex. Usually average angle between adjacent segments.

Parameters:

vertex (QgsVertexId) – the vertex id

Return type:

float

Returns:

rotation in radians, clockwise from north