16#ifndef QGSDISTANCEAREA_H
17#define QGSDISTANCEAREA_H
21#include <QReadWriteLock>
69 bool willUseEllipsoid()
const;
100 bool setEllipsoid(
const QString &ellipsoid );
109 bool setEllipsoid(
double semiMajor,
double semiMinor );
154 double measureArea(
const QgsGeometry &geometry )
const;
165 double measureLength(
const QgsGeometry &geometry )
const;
176 double measurePerimeter(
const QgsGeometry &geometry )
const;
184 double measureLine(
const QVector<QgsPointXY> &points )
const;
208 double measureLineProjected(
const QgsPointXY &p1,
double distance = 1,
double azimuth = M_PI_2,
QgsPointXY *projectedPoint
SIP_OUT =
nullptr )
const;
225 double measurePolygon(
const QVector<QgsPointXY> &points )
const;
244 static QString formatDistance(
double distance,
int decimals,
Qgis::DistanceUnit unit,
bool keepBaseUnit =
false );
256 static QString formatArea(
double area,
int decimals,
Qgis::AreaUnit unit,
bool keepBaseUnit =
false );
278 double convertAreaMeasurement(
double area,
Qgis::AreaUnit toUnits )
const;
290 QgsPointXY computeSpheroidProject(
const QgsPointXY &p1,
double distance = 1,
double azimuth = M_PI_2 )
const;
311 QVector<QVector<QgsPointXY> > geodesicLine(
const QgsPointXY &p1,
const QgsPointXY &p2,
double interval,
bool breakLine =
false )
const;
362 double computePolygonArea(
const QVector<QgsPointXY> &points )
const;
364 double computePolygonFlatArea(
const QVector<QgsPointXY> &points )
const;
370 void computeAreaInit()
const;
388 double mSemiMajor, mSemiMinor, mInvFlattening;
390 mutable std::unique_ptr< geod_geodesic > mGeod;
395 double measureLine(
const QgsCurve *curve )
const;
396 double measurePolygon(
const QgsCurve *curve )
const;
DistanceUnit
Units of distance.
Abstract base class for all geometries.
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Custom exception class for Coordinate Reference System related exceptions.
Abstract base class for curved geometry type.
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
QgsCoordinateReferenceSystem ellipsoidCrs() const
Returns the ellipsoid (destination) spatial reference system.
QgsCoordinateReferenceSystem sourceCrs() const
Returns the source spatial reference system.
double ellipsoidInverseFlattening() const
Returns ellipsoid's inverse flattening.
QString ellipsoid() const
Returns ellipsoid's acronym.
double ellipsoidSemiMajor() const
Returns the ellipsoid's semi major axis.
double ellipsoidSemiMinor() const
Returns ellipsoid's semi minor axis.
A geometry is the spatial representation of a feature.
A class to represent a 2D point.
#define SIP_THROW(name,...)
const QgsCoordinateReferenceSystem & crs
Contains parameters for an ellipsoid.