cesium-native  0.41.0
Projection.h
1 #pragma once
2 
3 #include "BoundingRegion.h"
4 #include "CesiumGeometry/AxisAlignedBox.h"
5 #include "CesiumGeometry/Rectangle.h"
6 #include "Ellipsoid.h"
7 #include "GeographicProjection.h"
8 #include "WebMercatorProjection.h"
9 
10 #include <glm/vec2.hpp>
11 
12 #include <variant>
13 
14 namespace CesiumGeospatial {
15 
25 typedef std::variant<GeographicProjection, WebMercatorProjection> Projection;
26 
35 glm::dvec3
36 projectPosition(const Projection& projection, const Cartographic& position);
37 
47 unprojectPosition(const Projection& projection, const glm::dvec3& position);
48 
62  const Projection& projection,
63  const GlobeRectangle& rectangle);
64 
78  const Projection& projection,
79  const CesiumGeometry::Rectangle& rectangle);
80 
94 projectRegionSimple(const Projection& projection, const BoundingRegion& region);
95 
109  const Projection& projection,
111  const CesiumGeospatial::Ellipsoid& ellipsoid CESIUM_DEFAULT_ELLIPSOID);
112 
129  const Projection& projection,
130  const CesiumGeometry::Rectangle& rectangle,
131  double maxHeight,
132  const Ellipsoid& ellipsoid CESIUM_DEFAULT_ELLIPSOID);
133 
137 const Ellipsoid& getProjectionEllipsoid(const Projection& projection);
138 
139 } // namespace CesiumGeospatial
A bounding volume specified as a longitude/latitude bounding box and a minimum and maximum height.
A position defined by longitude, latitude, and height.
Definition: Cartographic.h:12
A quadratic surface defined in Cartesian coordinates.
Definition: Ellipsoid.h:38
A two-dimensional, rectangular region on a globe, specified using longitude and latitude coordinates....
Classes for geospatial computations in Cesium.
glm::dvec3 projectPosition(const Projection &projection, const Cartographic &position)
Projects a position on the globe using the given Projection.
CesiumGeometry::Rectangle projectRectangleSimple(const Projection &projection, const GlobeRectangle &rectangle)
Projects a rectangle on the globe by simply projecting its four corners.
BoundingRegion unprojectRegionSimple(const Projection &projection, const CesiumGeometry::AxisAlignedBox &box, const CesiumGeospatial::Ellipsoid &ellipsoid CESIUM_DEFAULT_ELLIPSOID)
Unprojects a box to the globe by simply unprojecting its eight corners.
Cartographic unprojectPosition(const Projection &projection, const glm::dvec3 &position)
Unprojects a position from the globe using the given Projection.
glm::dvec2 computeProjectedRectangleSize(const Projection &projection, const CesiumGeometry::Rectangle &rectangle, double maxHeight, const Ellipsoid &ellipsoid CESIUM_DEFAULT_ELLIPSOID)
Computes the approximate real-world size, in meters, of a given projected rectangle.
const Ellipsoid & getProjectionEllipsoid(const Projection &projection)
Obtains the ellipsoid used by a Projection variant.
CesiumGeometry::AxisAlignedBox projectRegionSimple(const Projection &projection, const BoundingRegion &region)
Projects a bounding region on the globe by simply projecting its eight corners.
std::variant< GeographicProjection, WebMercatorProjection > Projection
A projection.
Definition: Projection.h:25
GlobeRectangle unprojectRectangleSimple(const Projection &projection, const CesiumGeometry::Rectangle &rectangle)
Unprojects a rectangle to the globe by simply unprojecting its four corners.
A 2D rectangle.
Definition: Rectangle.h:14