digiKam
Digikam::GeodeticCalculator Class Reference

Public Member Functions

double azimuth ()
 
bool checkOrthodromicDistance ()
 
bool computeDestinationPoint ()
 
bool computeDirection ()
 
QPointF destinationGeographicPoint ()
 
bool destinationGeographicPoint (double *longitude, double *latitude)
 
Ellipsoid ellipsoid () const
 
 GeodeticCalculator (const Ellipsoid &e=Ellipsoid::WGS84())
 
double meridianArcLength (double latitude1, double latitude2)
 
double meridianArcLengthRadians (double P1, double P2)
 
double orthodromicDistance ()
 
void setDestinationGeographicPoint (double longitude, double latitude)
 
void setDirection (double azimuth, double distance)
 
void setStartingGeographicPoint (double longitude, double latitude)
 

Protected Member Functions

double castToAngleRange (const double alpha)
 
bool checkAzimuth (double *azimuth)
 
bool checkLatitude (double *latitude)
 
bool checkLongitude (double *longitude)
 
bool checkOrthodromicDistance (const double distance)
 

Protected Attributes

double A
 
double a01
 
double a02
 
double a03
 
double a21
 
double a22
 
double a23
 
double a42
 
double a43
 
double a63
 
double B
 
double C
 
double D
 
double E
 
double F
 
double f
 
double f2
 
double f3
 
double f4
 
double fo
 
double m_azimuth
 
bool m_destinationValid
 
bool m_directionValid
 
double m_distance
 
double m_eccentricitySquared
 
Ellipsoid m_ellipsoid
 
double m_lat1
 
double m_lat2
 
double m_long1
 
double m_long2
 
double m_maxOrthodromicDistance
 
double m_semiMajorAxis
 
double m_semiMinorAxis
 
double T1
 
double T2
 
double T4
 
double T6
 
double TOLERANCE_0
 
double TOLERANCE_1
 
double TOLERANCE_2
 
double TOLERANCE_3
 
double TOLERANCE_CHECK
 

Constructor & Destructor Documentation

◆ GeodeticCalculator()

Digikam::GeodeticCalculator::GeodeticCalculator ( const Ellipsoid e = Ellipsoid::WGS84())
explicit

Performs geodetic calculations on an ellipsoid. This class encapsulates a generic ellipsoid and calculates the following properties:

Distance and azimuth between two points. Point located at a given distance and azimuth from an other point.

The calculation use the following information:

The starting position (setStartingPosition), which is always considered valid. It is initially set at (0,0) and can only be changed to another legitimate value. Only one of the following:

  The destination position (setDestinationPosition), or
  An azimuth and distance (setDirection).

The latest one set overrides the other and determines what will be calculated.

References A, a01, a02, a03, a21, a22, a23, a42, a43, a63, B, C, D, E, F, f, f2, f3, f4, fo, m_eccentricitySquared, m_ellipsoid, m_maxOrthodromicDistance, m_semiMajorAxis, m_semiMinorAxis, Digikam::Ellipsoid::semiMajorAxis(), Digikam::Ellipsoid::semiMinorAxis(), T1, T2, T4, T6, TOLERANCE_0, TOLERANCE_1, TOLERANCE_2, TOLERANCE_3, and TOLERANCE_CHECK.

Member Function Documentation

◆ azimuth()

double Digikam::GeodeticCalculator::azimuth ( )

Returns the azimuth. This method returns the value set by the last call to setDirection(double,double) setDirection(azimuth,distance), except if setDestinationGeographicPoint(double,double) setDestinationGeographicPoint(...) has been invoked after. In this later case, the azimuth will be computed from the startingGeographicPoint starting point to the destination point.

Returns
The azimuth, in decimal degrees from -180° to +180°.

References computeDirection(), m_azimuth, m_directionValid, and Digikam::Coordinates::toDegrees().

Referenced by checkAzimuth(), computeDestinationPoint(), and setDirection().

◆ castToAngleRange()

double Digikam::GeodeticCalculator::castToAngleRange ( const double  alpha)
protected

◆ checkAzimuth()

bool Digikam::GeodeticCalculator::checkAzimuth ( double *  azimuth)
protected

Checks the azimuth validity. The argument azimuth should be greater or equal than -180 degrees and lower or equals than +180 degrees. As a convenience, this method converts the azimuth to radians.

Parameters
azimuthThe azimuth value in decimal degrees.

References azimuth(), and Digikam::Coordinates::toRadians().

Referenced by setDirection().

◆ checkLatitude()

bool Digikam::GeodeticCalculator::checkLatitude ( double *  latitude)
protected

Checks the latitude validity. The argument latitude should be greater or equal than -90 degrees and lower or equals than +90 degrees. As a convenience, this method converts the latitude to radians.

Parameters
latitudeThe latitude value in decimal degrees.

References Digikam::Coordinates::toRadians().

Referenced by meridianArcLength(), setDestinationGeographicPoint(), and setStartingGeographicPoint().

◆ checkLongitude()

bool Digikam::GeodeticCalculator::checkLongitude ( double *  longitude)
protected

Checks the longitude validity. The argument longitude should be greater or equal than -180 degrees and lower or equals than +180 degrees. As a convenience, this method converts the longitude to radians.

Parameters
longitudeThe longitude value in decimal degrees.

References Digikam::Coordinates::toRadians().

Referenced by setDestinationGeographicPoint(), and setStartingGeographicPoint().

◆ checkOrthodromicDistance() [1/2]

bool Digikam::GeodeticCalculator::checkOrthodromicDistance ( )

Computes the orthodromic distance using the algorithm implemented in the Geotools's ellipsoid class (if available), and check if the error is smaller than some tolerance error.

References m_distance, m_ellipsoid, m_lat1, m_lat2, m_long1, m_long2, Digikam::Ellipsoid::orthodromicDistance(), Digikam::Coordinates::toDegrees(), and TOLERANCE_CHECK.

Referenced by orthodromicDistance(), and setDirection().

◆ checkOrthodromicDistance() [2/2]

bool Digikam::GeodeticCalculator::checkOrthodromicDistance ( const double  distance)
protected

Checks the orthodromic distance validity. Arguments orthodromicDistance should be greater or equal than 0 and lower or equals than the maximum orthodromic distance.

Parameters
distanceThe orthodromic distance value.

References m_maxOrthodromicDistance.

◆ computeDestinationPoint()

bool Digikam::GeodeticCalculator::computeDestinationPoint ( )

Computes the destination point from the starting point, the azimuth and the orthodromic distance.

References azimuth(), C, castToAngleRange(), D, E, f, fo, m_azimuth, m_destinationValid, m_directionValid, m_distance, m_lat1, m_lat2, m_long1, m_long2, m_semiMajorAxis, TOLERANCE_1, and X.

Referenced by destinationGeographicPoint().

◆ computeDirection()

bool Digikam::GeodeticCalculator::computeDirection ( )

Computes the azimuth and orthodromic distance from the startingGeographicPoint starting point and the destinationGeographicPoint destination point.

Computes the azimuth and orthodromic distance from the startingGeographicPoint() and the destinationGeographicPoint().

References a01, a02, a03, a21, a22, a23, a42, a43, a63, castToAngleRange(), f, fo, m_azimuth, m_destinationValid, m_directionValid, m_distance, m_eccentricitySquared, m_lat1, m_lat2, m_long1, m_long2, m_semiMajorAxis, m_semiMinorAxis, meridianArcLengthRadians(), T1, T2, T4, T6, TOLERANCE_0, TOLERANCE_1, TOLERANCE_2, and TOLERANCE_3.

Referenced by azimuth(), and orthodromicDistance().

◆ destinationGeographicPoint() [1/2]

QPointF Digikam::GeodeticCalculator::destinationGeographicPoint ( )

◆ destinationGeographicPoint() [2/2]

bool Digikam::GeodeticCalculator::destinationGeographicPoint ( double *  longitude,
double *  latitude 
)

Returns the destination point. This method returns the point set by the last call to a setDestinationGeographicPoint(...) method, except if setDirection(...) has been invoked after. In this later case, the destination point will be computed from the starting point to the azimuth and distance specified. Coordinates positive North and East.

Returns
The destination point. The x and y coordinates are the longitude and latitude in decimal degrees, respectively.

References computeDestinationPoint(), m_destinationValid, m_lat2, m_long2, and Digikam::Coordinates::toDegrees().

Referenced by Digikam::FieldQueryBuilder::addPosition().

◆ ellipsoid()

Ellipsoid Digikam::GeodeticCalculator::ellipsoid ( ) const

Returns the referenced ellipsoid.

References m_ellipsoid.

Referenced by Digikam::FieldQueryBuilder::addPosition().

◆ meridianArcLength()

double Digikam::GeodeticCalculator::meridianArcLength ( double  latitude1,
double  latitude2 
)

Calculates the meridian arc length between two points in the same meridian in the referenced ellipsoid.

Parameters
latitude1The latitude of the first point (in decimal degrees).
latitude2The latitude of the second point (in decimal degrees).
Returns
Returned the meridian arc length between latitude1 and latitude2

References checkLatitude(), and meridianArcLengthRadians().

◆ meridianArcLengthRadians()

double Digikam::GeodeticCalculator::meridianArcLengthRadians ( double  P1,
double  P2 
)

Calculates the meridian arc length between two points in the same meridian in the referenced ellipsoid.

Parameters
P1The latitude of the first point (in radians).
P2The latitude of the second point (in radians).
Returns
Returned the meridian arc length between P1 and P2

References A, B, C, D, E, F, m_eccentricitySquared, m_semiMajorAxis, and TOLERANCE_0.

Referenced by computeDirection(), and meridianArcLength().

◆ orthodromicDistance()

double Digikam::GeodeticCalculator::orthodromicDistance ( )

Returns the orthodromic distance. This method returns the value set by the last call to setDirection(double,double) setDirection(azimuth,distance), except if setDestinationGeographicPoint(double,double) setDestinationGeographicPoint(...) has been invoked after. In this later case, the distance will be computed from the startingGeographicPoint starting point to the destination point.

Returns
The orthodromic distance, in the same units as the getEllipsoid ellipsoid axis.

References checkOrthodromicDistance(), computeDirection(), m_directionValid, and m_distance.

◆ setDestinationGeographicPoint()

void Digikam::GeodeticCalculator::setDestinationGeographicPoint ( double  longitude,
double  latitude 
)

Set the destination point in geographic coordinates. The azimuth and distance values will be updated as a side effect of this call. They will be recomputed the next time getAzimuth() or getOrthodromicDistance() are invoked. Coordinates positive North and East.

Parameters
longitudeThe longitude in decimal degrees between -180 and +180°
latitudeThe latitude in decimal degrees between -90 and +90°

References checkLatitude(), checkLongitude(), m_destinationValid, m_directionValid, m_lat2, and m_long2.

◆ setDirection()

void Digikam::GeodeticCalculator::setDirection ( double  azimuth,
double  distance 
)

Set the azimuth and the distance from the startingGeographicPoint starting point. The destination point will be updated as a side effect of this call. It will be recomputed the next time destinationGeographicPoint() is invoked. Azimuth 0° North.

Parameters
azimuthThe azimuth in decimal degrees from -180° to 180°.
distanceThe orthodromic distance in the same units as the ellipsoid axis.

References azimuth(), checkAzimuth(), checkOrthodromicDistance(), m_azimuth, m_destinationValid, m_directionValid, and m_distance.

Referenced by Digikam::FieldQueryBuilder::addPosition().

◆ setStartingGeographicPoint()

void Digikam::GeodeticCalculator::setStartingGeographicPoint ( double  longitude,
double  latitude 
)

Set the starting point in geographic coordinates. The azimuth, the orthodromic distance and the destination point are discarded. They will need to be specified again. Coordinates positive North and East.

Parameters
longitudeThe longitude in decimal degrees between -180 and +180°
latitudeThe latitude in decimal degrees between -90 and +90°

References checkLatitude(), checkLongitude(), m_destinationValid, m_directionValid, m_lat1, and m_long1.

Referenced by Digikam::FieldQueryBuilder::addPosition().

Member Data Documentation

◆ A

double Digikam::GeodeticCalculator::A
protected

GPNARC parameters computed from the ellipsoid.

Referenced by GeodeticCalculator(), and meridianArcLengthRadians().

◆ a01

double Digikam::GeodeticCalculator::a01
protected

Parameters computed from the ellipsoid.

Referenced by computeDirection(), and GeodeticCalculator().

◆ a02

double Digikam::GeodeticCalculator::a02
protected

◆ a03

double Digikam::GeodeticCalculator::a03
protected

◆ a21

double Digikam::GeodeticCalculator::a21
protected

◆ a22

double Digikam::GeodeticCalculator::a22
protected

◆ a23

double Digikam::GeodeticCalculator::a23
protected

◆ a42

double Digikam::GeodeticCalculator::a42
protected

◆ a43

double Digikam::GeodeticCalculator::a43
protected

◆ a63

double Digikam::GeodeticCalculator::a63
protected

◆ B

double Digikam::GeodeticCalculator::B
protected

◆ C

double Digikam::GeodeticCalculator::C
protected

◆ D

double Digikam::GeodeticCalculator::D
protected

◆ E

double Digikam::GeodeticCalculator::E
protected

◆ F

double Digikam::GeodeticCalculator::F
protected

◆ f

double Digikam::GeodeticCalculator::f
protected

◆ f2

double Digikam::GeodeticCalculator::f2
protected

Referenced by GeodeticCalculator().

◆ f3

double Digikam::GeodeticCalculator::f3
protected

Referenced by GeodeticCalculator().

◆ f4

double Digikam::GeodeticCalculator::f4
protected

Referenced by GeodeticCalculator().

◆ fo

double Digikam::GeodeticCalculator::fo
protected

GPNHRI parameters computed from the ellipsoid.

f if the flattening of the referenced ellipsoid. f2, f3 and f4 are f2, f3 and f4 respectively.

Referenced by computeDestinationPoint(), computeDirection(), and GeodeticCalculator().

◆ m_azimuth

double Digikam::GeodeticCalculator::m_azimuth
protected

◆ m_destinationValid

bool Digikam::GeodeticCalculator::m_destinationValid
protected

Tell if the destination point is valid. false if long2 and lat2 need to be computed.

Referenced by computeDestinationPoint(), computeDirection(), destinationGeographicPoint(), setDestinationGeographicPoint(), setDirection(), and setStartingGeographicPoint().

◆ m_directionValid

bool Digikam::GeodeticCalculator::m_directionValid
protected

Tell if the azimuth and the distance are valids. false if distance and azimuth need to be computed.

Referenced by azimuth(), computeDestinationPoint(), computeDirection(), orthodromicDistance(), setDestinationGeographicPoint(), setDirection(), and setStartingGeographicPoint().

◆ m_distance

double Digikam::GeodeticCalculator::m_distance
protected

The distance and azimuth (in radians) from the starting point (long1, lat1) to the destination point (long2, lat2).

Referenced by checkOrthodromicDistance(), computeDestinationPoint(), computeDirection(), orthodromicDistance(), and setDirection().

◆ m_eccentricitySquared

double Digikam::GeodeticCalculator::m_eccentricitySquared
protected

The eccentricity squared of the referenced ellipsoid.

Referenced by computeDirection(), GeodeticCalculator(), and meridianArcLengthRadians().

◆ m_ellipsoid

Ellipsoid Digikam::GeodeticCalculator::m_ellipsoid
protected

The encapsulated ellipsoid.

Referenced by checkOrthodromicDistance(), ellipsoid(), and GeodeticCalculator().

◆ m_lat1

double Digikam::GeodeticCalculator::m_lat1
protected

The (latitude, longitude) coordinate of the first point in radians. This point is set by setStartingGeographicPoint.

Referenced by checkOrthodromicDistance(), computeDestinationPoint(), computeDirection(), and setStartingGeographicPoint().

◆ m_lat2

double Digikam::GeodeticCalculator::m_lat2
protected

The (latitude, longitude) coordinate of the destination point in radians. This point is set by setDestinationGeographicPoint.

Referenced by checkOrthodromicDistance(), computeDestinationPoint(), computeDirection(), destinationGeographicPoint(), and setDestinationGeographicPoint().

◆ m_long1

double Digikam::GeodeticCalculator::m_long1
protected

◆ m_long2

◆ m_maxOrthodromicDistance

double Digikam::GeodeticCalculator::m_maxOrthodromicDistance
protected

The maximum orthodromic distance that could be calculated onto the referenced ellipsoid.

Referenced by checkOrthodromicDistance(), and GeodeticCalculator().

◆ m_semiMajorAxis

double Digikam::GeodeticCalculator::m_semiMajorAxis
protected

The semi major axis of the referenced ellipsoid.

Referenced by computeDestinationPoint(), computeDirection(), GeodeticCalculator(), and meridianArcLengthRadians().

◆ m_semiMinorAxis

double Digikam::GeodeticCalculator::m_semiMinorAxis
protected

The semi minor axis of the referenced ellipsoid.

Referenced by computeDirection(), and GeodeticCalculator().

◆ T1

double Digikam::GeodeticCalculator::T1
protected

Parameters computed from the ellipsoid.

Referenced by computeDirection(), and GeodeticCalculator().

◆ T2

double Digikam::GeodeticCalculator::T2
protected

◆ T4

double Digikam::GeodeticCalculator::T4
protected

◆ T6

double Digikam::GeodeticCalculator::T6
protected

◆ TOLERANCE_0

double Digikam::GeodeticCalculator::TOLERANCE_0
protected

Tolerance factors from the strictest (TOLERANCE_0) to the most relax one (TOLERANCE_3).

Referenced by computeDirection(), GeodeticCalculator(), and meridianArcLengthRadians().

◆ TOLERANCE_1

double Digikam::GeodeticCalculator::TOLERANCE_1
protected

◆ TOLERANCE_2

double Digikam::GeodeticCalculator::TOLERANCE_2
protected

◆ TOLERANCE_3

double Digikam::GeodeticCalculator::TOLERANCE_3
protected

◆ TOLERANCE_CHECK

double Digikam::GeodeticCalculator::TOLERANCE_CHECK
protected

Tolerance factor for assertions. It has no impact on computed values.

Referenced by checkOrthodromicDistance(), and GeodeticCalculator().


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