Class: QgsCurvePolygon

class qgis.core.QgsCurvePolygon

Bases: qgis._core.QgsSurface

Curve polygon geometry type

New in version 2.10: Enums

Methods

addInteriorRing

Adds an interior ring to the geometry (takes ownership)

addMValue

addZValue

adjacentVertices

area

asGml2

asGml3

asJson

asWkb

asWkt

boundary

calculateBoundingBox

childCount

childGeometry

childPoint

clear

clearCache

clone

closestSegment

coordinateSequence

createEmptyWithSameType

deleteVertex

dimension

draw

dropMValue

dropZValue

exteriorRing

Returns the curve polygon’s exterior ring.

forceRHR

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.

fromWkb

fromWkt

geometryType

hasChildGeometries

hasCurvedSegments

insertVertex

interiorRing

Retrieves an interior ring from the curve polygon.

isEmpty

moveVertex

nCoordinates

nextVertex

numInteriorRings

Returns the number of interior rings contained with the curve polygon.

partCount

perimeter

removeDuplicateNodes

removeInteriorRing

Removes an interior ring from the polygon.

removeInteriorRings

Removes the interior rings from the polygon.

removeInvalidRings

Removes any interior rings which are not valid from the polygon.

ringCount

segmentLength

segmentize

Returns a geometry without curves.

setExteriorRing

Sets the exterior ring of the polygon.

setInteriorRings

Sets all interior rings (takes ownership)

setZMTypeFromSubGeometry

snappedToGrid

surfaceToPolygon

swapXy

toCurveType

toPolygon

Returns a new polygon geometry corresponding to a segmentized approximation of the curve.

transform

transform(self, t: QTransform, zTranslate: float = 0, zScale: float = 1, mTranslate: float = 0, mScale: float = 1)

vertexAngle

Returns approximate rotation angle for a vertex.

vertexAt

vertexCount

vertexNumberFromVertexId

Signals

Attributes

addInteriorRing(self, ring: QgsCurve)

Adds an interior ring to the geometry (takes ownership)

addMValue(self, mValue: float = 0) → bool
addZValue(self, zValue: float = 0) → bool
adjacentVertices(self, vertex: QgsVertexId) → Tuple[QgsVertexId, QgsVertexId]
area(self) → float
asGml2(self, doc: QDomDocument, precision: int = 17, ns: str = '', axisOrder: QgsAbstractGeometry.AxisOrder = QgsAbstractGeometry.AxisOrder.XY) → QDomElement
asGml3(self, doc: QDomDocument, precision: int = 17, ns: str = '', axisOrder: QgsAbstractGeometry.AxisOrder = QgsAbstractGeometry.AxisOrder.XY) → QDomElement
asJson(self, precision: int = 17) → str
asWkb(self) → QByteArray
asWkt(self, precision: int = 17) → str
boundary(self) → QgsAbstractGeometry
calculateBoundingBox(self) → QgsRectangle
childCount(self) → int
childGeometry(self, index: int) → QgsAbstractGeometry
childPoint()
clear(self)
clearCache()
clone(self) → QgsCurvePolygon
closestSegment(self, pt: QgsPoint, epsilon: float = 4*DBL_EPSILON) → Tuple[float, QgsPoint, QgsVertexId, int]
coordinateSequence(self) → object
createEmptyWithSameType(self) → QgsCurvePolygon
deleteVertex(self, position: QgsVertexId) → bool
dimension(self) → int
draw(self, p: QPainter)
dropMValue(self) → bool
dropZValue(self) → bool
exteriorRing(self) → QgsCurve

Returns the curve polygon’s exterior ring.

See also

interiorRing()

forceRHR(self)

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.

New in version 3.4.3.

fromWkb(self, wkb: QgsConstWkbPtr) → bool
fromWkt(self, wkt: str) → bool
geometryType(self) → str
hasChildGeometries()
hasCurvedSegments(self) → bool
insertVertex(self, position: QgsVertexId, vertex: QgsPoint) → bool
interiorRing(self, i: int) → QgsCurve

Retrieves an interior ring from the curve polygon. The first interior ring has index 0.

An IndexError will be raised if no interior ring with the specified index exists.

See also

exteriorRing()

isEmpty(self) → bool
moveVertex(self, position: QgsVertexId, newPos: QgsPoint) → bool
nCoordinates(self) → int
nextVertex(self, id: QgsVertexId) → Tuple[bool, QgsPoint]
numInteriorRings(self) → int

Returns the number of interior rings contained with the curve polygon.

See also

interiorRing()

partCount(self) → int
perimeter(self) → float
removeDuplicateNodes(self, epsilon: float = 4*DBL_EPSILON, useZValues: bool = False) → bool
removeInteriorRing(self, i: int) → bool

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.

An IndexError will be raised if no interior ring with the specified index exists.

removeInteriorRings(self, minimumAllowedArea: float = -1)

Removes the interior rings from the polygon. If the minimumAllowedArea parameter is specified then only rings smaller than this minimum area will be removed.

New in version 3.0.

removeInvalidRings(self)

Removes any interior rings which are not valid from the polygon.

For example, this removes unclosed rings and rings with less than 4 vertices.

New in version 3.0.

ringCount(self, part: int = 0) → int
segmentLength(self, startVertex: QgsVertexId) → float
segmentize(self, tolerance: float = M_PI_2/90, toleranceType: QgsAbstractGeometry.SegmentationToleranceType = QgsAbstractGeometry.MaximumAngle) → QgsAbstractGeometry

Returns a geometry without curves. Caller takes ownership

Parameters
  • tolerance – segmentation tolerance

  • toleranceType – maximum segmentation angle or maximum difference between approximation and curve*

setExteriorRing(self, ring: QgsCurve)

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 – new exterior ring. Ownership is transferred to the CurvePolygon.

See also

exteriorRing()

setInteriorRings(self, rings: object)

Sets all interior rings (takes ownership)

setZMTypeFromSubGeometry()
snappedToGrid(self, hSpacing: float, vSpacing: float, dSpacing: float = 0, mSpacing: float = 0) → QgsCurvePolygon
surfaceToPolygon(self) → QgsPolygon
swapXy(self)
toCurveType(self) → QgsCurvePolygon
toPolygon(self, tolerance: float = M_PI_2/90, toleranceType: QgsAbstractGeometry.SegmentationToleranceType = QgsAbstractGeometry.MaximumAngle) → QgsPolygon

Returns a new polygon geometry corresponding to a segmentized approximation of the curve.

Parameters
  • tolerance – segmentation tolerance

  • toleranceType – maximum segmentation angle or maximum difference between approximation and curve*

transform(self, ct: QgsCoordinateTransform, d: QgsCoordinateTransform.TransformDirection = QgsCoordinateTransform.ForwardTransform, transformZ: bool = False)

transform(self, t: QTransform, zTranslate: float = 0, zScale: float = 1, mTranslate: float = 0, mScale: float = 1)

vertexAngle(self, vertex: QgsVertexId) → float

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

Parameters

vertex – the vertex id

Returns

rotation in radians, clockwise from north

vertexAt(self, id: QgsVertexId) → QgsPoint
vertexCount(self, part: int = 0, ring: int = 0) → int
vertexNumberFromVertexId(self, id: QgsVertexId) → int