Class: QgsCurvePolygon¶
Curve polygon geometry type.
Class Hierarchy¶
Base classes¶
Surface geometry type. |
|
Abstract base class for all geometries. |
Subclasses¶
Polygon geometry type. |
Abstract Methods
Returns approximate rotation angle for a vertex. |
Methods
Returns the curve polygon's exterior ring. |
|
Forces the polygon to respect the exterior ring is clockwise, interior rings are counter-clockwise convention. |
|
Forces the polygon to respect the exterior ring is counter-clockwise, interior rings are clockwise convention. |
|
Forces the geometry to respect the Right-Hand-Rule, in which the area that is bounded by the polygon is to the right of the boundary. |
|
Retrieves an interior ring from the curve polygon. |
|
Returns the number of interior rings contained with the curve polygon. |
|
Removes an interior ring from the polygon. |
|
Removes the interior rings from the polygon. |
|
Removes any interior rings which are not valid from the polygon. |
|
Returns the roundness of the curve polygon. |
|
Sets all interior rings (takes ownership) |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsCurvePolygon. See the FAQ for more details.
Adds an interior ring to the geometry (takes ownership) |
|
Returns a geometry without curves. |
|
Sets the exterior ring of the polygon. |
|
Gets a polygon representation of this surface. |
|
Returns a new polygon geometry corresponding to a segmentized approximation of the curve. |
- class qgis.core.QgsCurvePolygon[source]¶
Bases:
QgsSurface
- virtual addInteriorRing(self, ring: QgsCurve | None)[source]¶
Adds an interior ring to the geometry (takes ownership)
- Parameters:
ring (Optional[QgsCurve])
- exteriorRing(self) QgsCurve | None [source]¶
Returns the curve polygon’s exterior ring.
See also
- Return type:
Optional[QgsCurve]
- forceClockwise(self)[source]¶
Forces the polygon to respect the exterior ring is clockwise, interior rings are counter-clockwise convention.
This convention is used primarily by ESRI software.
See also
Added in version 3.24.
- forceCounterClockwise(self)[source]¶
Forces the polygon to respect the exterior ring is counter-clockwise, interior rings are clockwise convention.
This convention matches the OGC Simple Features specification.
See also
Added in version 3.24.
- forceRHR(self)[source]¶
Forces the geometry to respect the Right-Hand-Rule, in which the area that is bounded by the polygon is to the right of the boundary. In particular, the exterior ring is oriented in a clockwise direction and the interior rings in a counter-clockwise direction.
Warning
Due to the conflicting definitions of the right-hand-rule in general use, it is recommended to use the explicit
forceClockwise()
orforceCounterClockwise()
methods instead.See also
See also
Added in version 3.6.
- interiorRing(self, i: int) QgsCurve [source]¶
Retrieves an interior ring from the curve polygon. The first interior ring has index 0.
- Raises:
IndexError – if no interior ring with the specified index exists.
See also
See also
- Parameters:
i (int)
- Return type:
- numInteriorRings(self) int [source]¶
Returns the number of interior rings contained with the curve polygon.
See also
- Return type:
int
- removeInteriorRing(self, i: int) bool [source]¶
Removes an interior ring from the polygon. The first interior ring has index 0. The corresponding ring is removed from the polygon and deleted. It is not possible to remove the exterior ring using this method.
- Raises:
IndexError – if no interior ring with the specified index exists.
See also
- Parameters:
i (int)
- Return type:
bool
- removeInteriorRings(self, minimumAllowedArea: float = -1)[source]¶
Removes the interior rings from the polygon. If the minimumAllowedArea parameter is specified then only rings smaller than this minimum area will be removed.
See also
- Parameters:
minimumAllowedArea (float = -1)
- removeInvalidRings(self)[source]¶
Removes any interior rings which are not valid from the polygon.
For example, this removes unclosed rings and rings with less than 4 vertices.
- roundness(self) float [source]¶
Returns the roundness of the curve polygon. The returned value is between 0 and 1.
Added in version 3.24.
- Return type:
float
- 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 setExteriorRing(self, ring: QgsCurve | None)[source]¶
Sets the exterior ring of the polygon. The CurvePolygon type will be updated to match the dimensionality of the exterior ring. For instance, setting a 2D exterior ring on a 3D CurvePolygon will drop the z dimension from the CurvePolygon and all interior rings.
- Parameters:
ring (Optional[QgsCurve]) – new exterior ring. Ownership is transferred to the CurvePolygon.
See also
See also
- setInteriorRings(self, rings: Iterable[QgsCurve])[source]¶
Sets all interior rings (takes ownership)
- Parameters:
rings (Iterable[QgsCurve])
- virtual surfaceToPolygon(self) QgsPolygon | None [source]¶
Gets a polygon representation of this surface. Ownership is transferred to the caller.
- Return type:
Optional[QgsPolygon]
- virtual toPolygon(self, tolerance: float = M_PI_2 / 90, toleranceType: QgsAbstractGeometry.SegmentationToleranceType = QgsAbstractGeometry.MaximumAngle) QgsPolygon | None [source]¶
Returns a new polygon geometry corresponding to a segmentized approximation of the curve.
- 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[QgsPolygon]
- 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