Class: QgsSimpleCurve

Abstract base class for simple curved geometry type.

This class is not part of the SQL/MM standard and only exists for implementation convenience.

Added in version 4.2.

List of all members, including inherited members

Class Hierarchy

Inheritance diagram of qgis.core.QgsSimpleCurve

Base classes

QgsCurve

Abstract base class for curved geometry type.

QgsAbstractGeometry

Abstract base class for all geometries.

Subclasses

QgsCircularString

Circular string geometry type.

QgsLineString

Line string geometry type, with support for z-dimension and m-values.

Abstract Methods

mAt

Returns the m value of the specified node in the simple curve.

xAt

Returns the x-coordinate of the specified node in the simple curve.

yAt

Returns the y-coordinate of the specified node in the simple curve.

zAt

Returns the z-coordinate of the specified node in the simple curve.

Methods

append

Appends the contents of another simple curve to the end of this simple curve.

pointN

Returns the point at the specified index.

setMAt

Sets the m-coordinate of the specified node in the simple curve.

setPoints

Resets the simple curve to match the specified list of points.

setXAt

Sets the x-coordinate of the specified node in the simple curve.

setYAt

Sets the y-coordinate of the specified node in the simple curve.

setZAt

Sets the z-coordinate of the specified node in the simple curve.

class qgis.core.QgsSimpleCurve[source]

Bases: QgsCurve

append(self, curve: QgsSimpleCurve | None)[source]

Appends the contents of another simple curve to the end of this simple curve.

Parameters:

curve (Optional[QgsSimpleCurve]) – curve to append. Ownership is not transferred.

Note

The curve type to be appended must match the base curve type. That is, Only LinearStrings can be appended to LinearStrings and only CircularStrings can be appended to CircularStrings.

Warning

It is the caller’s responsibility to ensure that the first point in the appended curve matches the last point in the existing curve, or the result will be undefined.

Raises:

ValueError – if a LineString is passed to be appended to a CircularString or viceversa.

abstract mAt(self, index: int) float[source]

Returns the m value of the specified node in the simple curve.

If the SimpleCurve does not have m values then NaN will be returned. Indexes can be less than 0, in which case they correspond to positions from the end of the curve. E.g. an index of -1 corresponds to the last point in the curve.

Raises:

IndexError – if no point with the specified index exists.

Parameters:

index (int)

Return type:

float

pointN(self, i: int) QgsPoint[source]

Returns the point at the specified index.

Indexes can be less than 0, in which case they correspond to positions from the end of the simple curve. E.g. an index of -1 corresponds to the last point in the simple curve.

Raises:

IndexError – if no point with the specified index exists.

Parameters:

i (int)

Return type:

QgsPoint

setMAt(self, index: int, m: float)[source]

Sets the m-coordinate of the specified node in the simple curve. The corresponding node must already exist in the simple curve and the simple curve must have m-dimension.

Indexes can be less than 0, in which case they correspond to positions from the end of the curve. E.g. an index of -1 corresponds to the last point in the curve.

Raises:

IndexError – if no point with the specified index exists.

See also

mAt()

Parameters:
  • index (int)

  • m (float)

setPoints(self, points: Iterable[QgsPoint])[source]

Resets the simple curve to match the specified list of points. The simple curve will inherit the dimensionality of the first point in the list.

Parameters:

points (Iterable[QgsPoint]) – new points for simple curve. If empty, simple curve will be cleared.

setXAt(self, index: int, x: float)[source]

Sets the x-coordinate of the specified node in the simple curve. The corresponding node must already exist in simple curve.

Indexes can be less than 0, in which case they correspond to positions from the end of the curve. E.g. an index of -1 corresponds to the last point in the curve.

Raises:

IndexError – if no point with the specified index exists.

See also

xAt()

Parameters:
  • index (int)

  • x (float)

setYAt(self, index: int, y: float)[source]

Sets the y-coordinate of the specified node in the simple curve. The corresponding node must already exist in the simple curve.

Indexes can be less than 0, in which case they correspond to positions from the end of the curve. E.g. an index of -1 corresponds to the last point in the curve.

Raises:

IndexError – if no point with the specified index exists.

See also

yAt()

Parameters:
  • index (int)

  • y (float)

setZAt(self, index: int, z: float)[source]

Sets the z-coordinate of the specified node in the simple curve. The corresponding node must already exist in the simple curve and the simple curve must have z-dimension.

Indexes can be less than 0, in which case they correspond to positions from the end of the curve. E.g. an index of -1 corresponds to the last point in the curve.

Raises:

IndexError – if no point with the specified index exists.

See also

zAt()

Parameters:
  • index (int)

  • z (float)

abstract xAt(self, index: int) float[source]

Returns the x-coordinate of the specified node in the simple curve.

Indexes can be less than 0, in which case they correspond to positions from the end of the curve. E.g. an index of -1 corresponds to the last point in the curve.

Raises:

IndexError – if no point with the specified index exists.

Parameters:

index (int)

Return type:

float

abstract yAt(self, index: int) float[source]

Returns the y-coordinate of the specified node in the simple curve.

Indexes can be less than 0, in which case they correspond to positions from the end of the curve. E.g. an index of -1 corresponds to the last point in the curve.

Raises:

IndexError – if no point with the specified index exists.

Parameters:

index (int)

Return type:

float

abstract zAt(self, index: int) float[source]

Returns the z-coordinate of the specified node in the simple curve.

If the SimpleCurve does not have a z-dimension then NaN will be returned. Indexes can be less than 0, in which case they correspond to positions from the end of the curve. E.g. an index of -1 corresponds to the last point in the curve.

Raises:

IndexError – if no point with the specified index exists.

Parameters:

index (int)

Return type:

float