Class: QgsCrossSection

Encapsulates the definition of a cross section in 3D map coordinates.

Defined by a line (p1, p2) and a half-width (extent from the line).

Added in version 4.0.

Methods

asGeometry

Returns the cross section extent as a geometry (Polygon or LineString).

endPoint

Returns the end point of the cross section

halfWidth

Returns the half-width of the cross section

isValid

Returns cross section validity.

nudgeLeft

Nudges the cross section to the left by the specified distance

nudgeRight

Nudges the cross section to the right by the specified distance

setHalfWidth

Sets the half-width of the cross section

startPoint

Returns the start point of the cross section

class qgis._3d.QgsCrossSection[source]

Bases: object

__init__()

Constructs an invalid cross section

__init__(p1: QgsPoint, p2: QgsPoint, halfWidth: float)

Constructs a cross section defined by two points and a half-width

Parameters:
__init__(a0: QgsCrossSection)
Parameters:

a0 (QgsCrossSection)

asGeometry(self, ct: QgsCoordinateTransform | None = None) QgsGeometry[source]

Returns the cross section extent as a geometry (Polygon or LineString). If a coordinate transform is provided, the geometry is transformed. The transform should be from the cross section CRS (3D map CRS) to the destination CRS (2D map canvas CRS).

Parameters:

ct (Optional[QgsCoordinateTransform] = None)

Return type:

QgsGeometry

endPoint(self) QgsPoint[source]

Returns the end point of the cross section

Return type:

QgsPoint

halfWidth(self) float[source]

Returns the half-width of the cross section

Return type:

float

isValid(self) bool[source]

Returns cross section validity. A valid cross section has distinct start and end points and a positive half-width.

Return type:

bool

nudgeLeft(self, distance: float)[source]

Nudges the cross section to the left by the specified distance

Parameters:

distance (float)

nudgeRight(self, distance: float)[source]

Nudges the cross section to the right by the specified distance

Parameters:

distance (float)

setHalfWidth(self, halfWidth: float)[source]

Sets the half-width of the cross section

Parameters:

halfWidth (float)

startPoint(self) QgsPoint[source]

Returns the start point of the cross section

Return type:

QgsPoint