Class: QgsCompoundCurve

Compound curve geometry type.

Class Hierarchy

Inheritance diagram of qgis.core.QgsCompoundCurve

Base classes

QgsCurve

Abstract base class for curved geometry type.

QgsAbstractGeometry

Abstract base class for all geometries.

Abstract Methods

curveToLine

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

Methods

addCurve

Adds a curve to the geometry (takes ownership).

addVertex

Adds a vertex to the end of the geometry.

close

Appends first point if not already closed.

condenseCurves

Condenses the curves in this geometry by combining adjacent linestrings a to a single continuous linestring, and combining adjacent circularstrings to a single continuous circularstring.

curveAt

Returns the curve at the specified index.

nCurves

Returns the number of curves in the geometry.

removeCurve

Removes a curve from the geometry.

toggleCircularAtVertex

Converts the vertex at the given position from/to circular

class qgis.core.QgsCompoundCurve[source]

Bases: QgsCurve

addCurve(self, c: QgsCurve | None, extendPrevious: bool = False)[source]

Adds a curve to the geometry (takes ownership).

Since QGIS 3.20, if extendPrevious is True, then adding a LineString when the last existing curve in the compound curve is also a LineString will cause the existing linestring to be extended with the newly added LineString vertices instead of appending a whole new LineString curve to the compound curve. This can result in simplified compound curves with lesser number of component curves while still being topologically identical to the desired result.

Parameters:
  • c (Optional[QgsCurve])

  • extendPrevious (bool = False)

addVertex(self, pt: QgsPoint)[source]

Adds a vertex to the end of the geometry.

Parameters:

pt (QgsPoint)

close(self)[source]

Appends first point if not already closed.

condenseCurves(self)[source]

Condenses the curves in this geometry by combining adjacent linestrings a to a single continuous linestring, and combining adjacent circularstrings to a single continuous circularstring.

Added in version 3.20.

curveAt(self, i: int) QgsCurve | None[source]

Returns the curve at the specified index.

Parameters:

i (int)

Return type:

Optional[QgsCurve]

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

Returns a new line string 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[QgsLineString]

nCurves(self) int[source]

Returns the number of curves in the geometry.

Return type:

int

removeCurve(self, i: int)[source]

Removes a curve from the geometry.

Parameters:

i (int) – index of curve to remove

toggleCircularAtVertex(self, position: QgsVertexId) bool[source]

Converts the vertex at the given position from/to circular

Return type:

bool

Returns:

False if atVertex does not correspond to a valid vertex on this geometry (including if this geometry is a Point), or if the specified vertex can’t be converted (e.g. start/end points).

Added in version 3.20.

Parameters:

position (QgsVertexId)