cesium-native  0.41.0
CesiumGeospatial::GeographicProjection Class Referencefinal

A map projection where longitude and latitude are mapped using an Ellipsoid. More...

#include <CesiumGeospatial/GeographicProjection.h>

Public Member Functions

 GeographicProjection (const Ellipsoid &ellipsoid CESIUM_DEFAULT_ELLIPSOID) noexcept
 Constructs a new instance. More...
 
const EllipsoidgetEllipsoid () const noexcept
 Gets the Ellipsoid.
 
glm::dvec3 project (const Cartographic &cartographic) const noexcept
 Converts geodedic ellipsoid coordinates to geographic coordinates. More...
 
CesiumGeometry::Rectangle project (const CesiumGeospatial::GlobeRectangle &rectangle) const noexcept
 Projects a globe rectangle to geographic coordinates. More...
 
Cartographic unproject (const glm::dvec2 &projectedCoordinates) const noexcept
 Converts geographic coordinates to geodetic ellipsoid coordinates. More...
 
Cartographic unproject (const glm::dvec3 &projectedCoordinates) const noexcept
 Converts geographic coordinates to geodetic ellipsoid coordinates. More...
 
CesiumGeospatial::GlobeRectangle unproject (const CesiumGeometry::Rectangle &rectangle) const noexcept
 Unprojects a geographic rectangle to the globe. More...
 
bool operator== (const GeographicProjection &rhs) const noexcept
 Returns true if two projections (i.e. their ellipsoids) are equal.
 
bool operator!= (const GeographicProjection &rhs) const noexcept
 Returns true if two projections (i.e. their ellipsoids) are not equal.
 

Static Public Member Functions

static constexpr CesiumGeometry::Rectangle computeMaximumProjectedRectangle (const Ellipsoid &ellipsoid CESIUM_DEFAULT_ELLIPSOID) noexcept
 Computes the maximum rectangle that can be covered with this projection. More...
 

Static Public Attributes

static constexpr GlobeRectangle MAXIMUM_GLOBE_RECTANGLE
 The maximum bounding rectangle of the geographic projection, ranging from -PI to PI radians longitude and from -PI/2 to +PI/2 radians latitude. More...
 

Detailed Description

A map projection where longitude and latitude are mapped using an Ellipsoid.

The longitude and latitude are linearly mapped to X and Y by multiplying them (in radians) by the Ellipsoid::getMaximumRadius(). This projection is commonly known as geographic, equirectangular, equidistant cylindrical, or plate carrée. It is also known as EPSG:4326.

See also
WebMercatorProjection

Definition at line 27 of file GeographicProjection.h.

Constructor & Destructor Documentation

◆ GeographicProjection()

CesiumGeospatial::GeographicProjection::GeographicProjection ( const Ellipsoid &ellipsoid  CESIUM_DEFAULT_ELLIPSOID)
noexcept

Constructs a new instance.

Parameters
ellipsoidThe Ellipsoid.

Member Function Documentation

◆ computeMaximumProjectedRectangle()

static constexpr CesiumGeometry::Rectangle CesiumGeospatial::GeographicProjection::computeMaximumProjectedRectangle ( const Ellipsoid &ellipsoid  CESIUM_DEFAULT_ELLIPSOID)
inlinestaticconstexprnoexcept

Computes the maximum rectangle that can be covered with this projection.

Parameters
ellipsoidThe Ellipsoid. Default value: Ellipsoid::WGS84.
Returns
The rectangle

Definition at line 48 of file GeographicProjection.h.

◆ project() [1/2]

glm::dvec3 CesiumGeospatial::GeographicProjection::project ( const Cartographic cartographic) const
noexcept

Converts geodedic ellipsoid coordinates to geographic coordinates.

Converts geodetic ellipsoid coordinates, in radians, to the equivalent geographic X, Y, Z coordinates expressed in meters. The height is copied unmodified to the z coordinate.

Parameters
cartographicThe geodetic coordinates in radians.
Returns
The equivalent geographic X, Y, Z coordinates, in meters.

◆ project() [2/2]

CesiumGeometry::Rectangle CesiumGeospatial::GeographicProjection::project ( const CesiumGeospatial::GlobeRectangle rectangle) const
noexcept

Projects a globe rectangle to geographic coordinates.

This is done by projecting the southwest and northeast corners.

Parameters
rectangleThe globe rectangle to project.
Returns
The projected rectangle.

◆ unproject() [1/3]

CesiumGeospatial::GlobeRectangle CesiumGeospatial::GeographicProjection::unproject ( const CesiumGeometry::Rectangle rectangle) const
noexcept

Unprojects a geographic rectangle to the globe.

This is done by unprojecting the southwest and northeast corners.

Parameters
rectangleThe rectangle to unproject.
Returns
The unprojected rectangle.

◆ unproject() [2/3]

Cartographic CesiumGeospatial::GeographicProjection::unproject ( const glm::dvec2 &  projectedCoordinates) const
noexcept

Converts geographic coordinates to geodetic ellipsoid coordinates.

Converts geographic X and Y coordinates, expressed in meters, to a Cartographic containing geodetic ellipsoid coordinates. The height is set to 0.0.

Parameters
projectedCoordinatesThe geographic projected coordinates to unproject.
Returns
The equivalent cartographic coordinates.

◆ unproject() [3/3]

Cartographic CesiumGeospatial::GeographicProjection::unproject ( const glm::dvec3 &  projectedCoordinates) const
noexcept

Converts geographic coordinates to geodetic ellipsoid coordinates.

Converts geographic X, Y coordinates, expressed in meters, to a Cartographic containing geodetic ellipsoid coordinates. The Z coordinate is copied unmodified to the height.

Parameters
projectedCoordinatesThe geographic projected coordinates to unproject, with height (z) in meters.
Returns
The equivalent cartographic coordinates.

Member Data Documentation

◆ MAXIMUM_GLOBE_RECTANGLE

constexpr GlobeRectangle CesiumGeospatial::GeographicProjection::MAXIMUM_GLOBE_RECTANGLE
staticconstexpr
Initial value:
= GlobeRectangle(
static constexpr double PiOverTwo
pi divded by two
Definition: Math.h:90
static constexpr double OnePi
pi
Definition: Math.h:80

The maximum bounding rectangle of the geographic projection, ranging from -PI to PI radians longitude and from -PI/2 to +PI/2 radians latitude.

Definition at line 34 of file GeographicProjection.h.


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