digiKam Developer Documentation: Digikam::GeodeticCalculator Class Reference

| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Digikam::GeodeticCalculator Class Reference

## Public Member Functions
| GeodeticCalculator (const Ellipsoid &e=Ellipsoid::WGS84())
| Performs geodetic calculations on an ellipsoid.
double | azimuth ()
| Returns the azimuth.
bool | 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.
bool | computeDestinationPoint ()
| Computes the destination point from the starting point, the azimuth and the orthodromic distance.
bool | computeDirection ()
| Computes the azimuth and orthodromic distance from the startingGeographicPoint starting point and the destinationGeographicPoint destination point.
QPointF | destinationGeographicPoint ()
bool | destinationGeographicPoint (double *longitude, double *latitude)
| Returns the destination point.
Ellipsoid | ellipsoid () const
| Returns the referenced ellipsoid.
double | meridianArcLength (double latitude1, double latitude2)
| Calculates the meridian arc length between two points in the same meridian in the referenced ellipsoid.
double | meridianArcLengthRadians (double P1, double P2)
| Calculates the meridian arc length between two points in the same meridian in the referenced ellipsoid.
double | orthodromicDistance ()
| Returns the orthodromic distance.
void | setDestinationGeographicPoint (double longitude, double latitude)
| Set the destination point in geographic coordinates.
void | setDirection (double azimuth, double distance)
| Set the azimuth and the distance from the startingGeographicPoint starting point.
void | setStartingGeographicPoint (double longitude, double latitude)
| Set the starting point in geographic coordinates.

## Protected Member Functions
double | castToAngleRange (const double alpha)
bool | checkAzimuth (double *azimuth)
| Checks the azimuth validity.
bool | checkLatitude (double *latitude)
| Checks the latitude validity.
bool | checkLongitude (double *longitude)
| Checks the longitude validity.
bool | checkOrthodromicDistance (const double distance)
| Checks the orthodromic distance validity.

## Protected Attributes
double | a01 = 0.0
| Parameters computed from the ellipsoid.
double | a02 = 0.0
double | a03 = 0.0
double | a21 = 0.0
double | a22 = 0.0
double | a23 = 0.0
double | a42 = 0.0
double | a43 = 0.0
double | a63 = 0.0
double | f = 0.0
double | f2 = 0.0
double | f3 = 0.0
double | f4 = 0.0
double | fo = 0.0
| GPNHRI parameters computed from the ellipsoid.
double | m_A = 0.0
| GPNARC parameters computed from the ellipsoid.
double | m_azimuth = 0.0
double | m_B = 0.0
double | m_C = 0.0
double | m_D = 0.0
bool | m_destinationValid = false
| Tell if the destination point is valid.
bool | m_directionValid = false
| Tell if the azimuth and the distance are valids.
double | m_distance = 0.0
| The distance and azimuth (in radians) from the starting point (long1, lat1) to the destination point (long2, lat2).
double | m_E = 0.0
double | m_eccentricitySquared = 0.0
| The eccentricity squared of the referenced ellipsoid.
Ellipsoid | m_ellipsoid
| The encapsulated ellipsoid.
double | m_F = 0.0
double | m_lat1 = 0.0
| The (latitude, longitude) coordinate of the first point in radians.
double | m_lat2 = 0.0
| The (latitude, longitude) coordinate of the destination point in radians.
double | m_long1 = 0.0
double | m_long2 = 0.0
double | m_maxOrthodromicDistance = 0.0
| The maximum orthodromic distance that could be calculated onto the referenced ellipsoid.
double | m_semiMajorAxis = 0.0
| The semi major axis of the referenced ellipsoid.
double | m_semiMinorAxis = 0.0
| The semi minor axis of the referenced ellipsoid.
double | m_TOLERANCE_0 = 5.0e-15
| Tolerance factors from the strictest (`TOLERANCE_0`) to the most relax one (`TOLERANCE_3`).
double | m_TOLERANCE_1 = 5.0e-14
double | m_TOLERANCE_2 = 5.0e-13
double | m_TOLERANCE_3 = 7.0e-3
double | m_TOLERANCE_CHECK = 1E-8
| Tolerance factor for assertions.
double | T1 = 1.0
| Parameters computed from the ellipsoid.
double | T2 = 0.0
double | T4 = 0.0
double | T6 = 0.0

## Constructor & Destructor Documentation

## ◆ GeodeticCalculator()

Digikam::GeodeticCalculator::GeodeticCalculator | ( | const Ellipsoid & | e = `Ellipsoid::WGS84()` | ) |
| explicit

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.

## Member Function Documentation

## ◆ azimuth()

double Digikam::GeodeticCalculator::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°.

## ◆ checkAzimuth()

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

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

  azimuth | The azimuth value in decimal degrees.

## ◆ checkLatitude()

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

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

  latitude | The latitude value in decimal degrees.

## ◆ checkLongitude()

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

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

  longitude | The longitude value in decimal degrees.

## ◆ checkOrthodromicDistance()

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

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

Parameters

  distance | The orthodromic distance value.

## ◆ computeDirection()

bool Digikam::GeodeticCalculator::computeDirection | ( |  | ) |

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

## ◆ destinationGeographicPoint()

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

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.

## ◆ meridianArcLength()

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

Parameters

  latitude1 | The latitude of the first point (in decimal degrees).
  latitude2 | The latitude of the second point (in decimal degrees).

Returns
  Returned the meridian arc length between latitude1 and latitude2

## ◆ meridianArcLengthRadians()

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

Parameters

  P1 | The latitude of the first point (in radians).
  P2 | The latitude of the second point (in radians).

Returns
  Returned the meridian arc length between P1 and P2

## ◆ orthodromicDistance()

double Digikam::GeodeticCalculator::orthodromicDistance | ( |  | ) |

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.

## ◆ setDestinationGeographicPoint()

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

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

  longitude | The longitude in decimal degrees between -180 and +180°
  latitude | The latitude in decimal degrees between -90 and +90°

## ◆ setDirection()

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

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

  azimuth | The azimuth in decimal degrees from -180° to 180°.
  distance | The orthodromic distance in the same units as the ellipsoid axis.

## ◆ setStartingGeographicPoint()

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

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

Parameters

  longitude | The longitude in decimal degrees between -180 and +180°
  latitude | The latitude in decimal degrees between -90 and +90°

## Member Data Documentation

## ◆ fo

double Digikam::GeodeticCalculator::fo = 0.0
| protected

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

## ◆ m_destinationValid

bool Digikam::GeodeticCalculator::m_destinationValid = false
| protected

`false` if long2 and lat2 need to be computed.

## ◆ m_directionValid

bool Digikam::GeodeticCalculator::m_directionValid = false
| protected

`false` if distance and azimuth need to be computed.

## ◆ m_lat1

double Digikam::GeodeticCalculator::m_lat1 = 0.0
| protected

This point is set by setStartingGeographicPoint.

## ◆ m_lat2

double Digikam::GeodeticCalculator::m_lat2 = 0.0
| protected

This point is set by setDestinationGeographicPoint.

## ◆ m_TOLERANCE_CHECK

double Digikam::GeodeticCalculator::m_TOLERANCE_CHECK = 1E-8
| protected

It has no impact on computed values.