QGIS API Documentation 3.99.0-Master (a8882ad4560)
Loading...
Searching...
No Matches
QgsCrossSection Class Reference

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

#include <qgscrosssection.h>

Public Member Functions

 QgsCrossSection ()=default
 Constructs an invalid cross section.
 QgsCrossSection (const QgsPoint &p1, const QgsPoint &p2, double halfWidth)
 Constructs a cross section defined by two points and a half-width.
QgsGeometry asGeometry (const QgsCoordinateTransform *ct=nullptr) const
 Returns the cross section extent as a geometry (Polygon or LineString).
QgsPoint endPoint () const
 Returns the end point of the cross section.
double halfWidth () const
 Returns the half-width of the cross section.
bool isValid () const
 Returns cross section validity.
void nudgeLeft (double distance)
 Nudges the cross section to the left by the specified distance.
void nudgeRight (double distance)
 Nudges the cross section to the right by the specified distance.
void setHalfWidth (const double halfWidth)
 Sets the half-width of the cross section.
QgsPoint startPoint () const
 Returns the start point of the cross section.

Detailed Description

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).

Since
QGIS 4.0

Definition at line 32 of file qgscrosssection.h.

Constructor & Destructor Documentation

◆ QgsCrossSection() [1/2]

QgsCrossSection::QgsCrossSection ( )
default

Constructs an invalid cross section.

◆ QgsCrossSection() [2/2]

QgsCrossSection::QgsCrossSection ( const QgsPoint & p1,
const QgsPoint & p2,
double halfWidth )

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

Definition at line 22 of file qgscrosssection.cpp.

Member Function Documentation

◆ asGeometry()

QgsGeometry QgsCrossSection::asGeometry ( const QgsCoordinateTransform * ct = nullptr) const

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).

Definition at line 29 of file qgscrosssection.cpp.

◆ endPoint()

QgsPoint QgsCrossSection::endPoint ( ) const
inline

Returns the end point of the cross section.

Definition at line 51 of file qgscrosssection.h.

◆ halfWidth()

double QgsCrossSection::halfWidth ( ) const
inline

Returns the half-width of the cross section.

Definition at line 54 of file qgscrosssection.h.

◆ isValid()

bool QgsCrossSection::isValid ( ) const

Returns cross section validity.

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

Definition at line 91 of file qgscrosssection.cpp.

◆ nudgeLeft()

void QgsCrossSection::nudgeLeft ( double distance)

Nudges the cross section to the left by the specified distance.

Definition at line 68 of file qgscrosssection.cpp.

◆ nudgeRight()

void QgsCrossSection::nudgeRight ( double distance)

Nudges the cross section to the right by the specified distance.

Definition at line 73 of file qgscrosssection.cpp.

◆ setHalfWidth()

void QgsCrossSection::setHalfWidth ( const double halfWidth)
inline

Sets the half-width of the cross section.

Definition at line 57 of file qgscrosssection.h.

◆ startPoint()

QgsPoint QgsCrossSection::startPoint ( ) const
inline

Returns the start point of the cross section.

Definition at line 48 of file qgscrosssection.h.


The documentation for this class was generated from the following files: