cesium-native  0.41.0
CartographicPolygon.h
1 #pragma once
2 
3 #include "GlobeRectangle.h"
4 #include "Library.h"
5 
6 #include <glm/vec2.hpp>
7 
8 #include <optional>
9 #include <string>
10 #include <vector>
11 
12 namespace CesiumGeospatial {
13 
24 class CESIUMGEOSPATIAL_API CartographicPolygon final {
25 public:
33  CartographicPolygon(const std::vector<glm::dvec2>& polygon);
34 
41  constexpr const std::vector<glm::dvec2>& getVertices() const {
42  return this->_vertices;
43  }
44 
52  constexpr const std::vector<uint32_t>& getIndices() const {
53  return this->_indices;
54  }
55 
62  constexpr const std::optional<CesiumGeospatial::GlobeRectangle>&
64  return this->_boundingRectangle;
65  }
66 
77  const CesiumGeospatial::GlobeRectangle& rectangle,
78  const std::vector<CesiumGeospatial::CartographicPolygon>&
79  cartographicPolygons) noexcept;
80 
91  const CesiumGeospatial::GlobeRectangle& rectangle,
92  const std::vector<CesiumGeospatial::CartographicPolygon>&
93  cartographicPolygons) noexcept;
94 
95 private:
96  std::vector<glm::dvec2> _vertices;
97  std::vector<uint32_t> _indices;
98  std::optional<CesiumGeospatial::GlobeRectangle> _boundingRectangle;
99 };
100 
101 } // namespace CesiumGeospatial
A 2D polygon expressed as a list of longitude/latitude coordinates in radians.
static bool rectangleIsOutsidePolygons(const CesiumGeospatial::GlobeRectangle &rectangle, const std::vector< CesiumGeospatial::CartographicPolygon > &cartographicPolygons) noexcept
Determines whether a globe rectangle is completely outside all the polygons in a list.
CartographicPolygon(const std::vector< glm::dvec2 > &polygon)
Constructs a 2D polygon that can be rasterized onto Tileset objects.
constexpr const std::vector< uint32_t > & getIndices() const
Returns the triangulated indices representing a triangle decomposition of the polygon....
constexpr const std::vector< glm::dvec2 > & getVertices() const
Returns the longitude-latitude vertices that define the perimeter of the selected polygon.
constexpr const std::optional< CesiumGeospatial::GlobeRectangle > & getBoundingRectangle() const
Returns a GlobeRectangle that represents the bounding rectangle of the polygon.
static bool rectangleIsWithinPolygons(const CesiumGeospatial::GlobeRectangle &rectangle, const std::vector< CesiumGeospatial::CartographicPolygon > &cartographicPolygons) noexcept
Determines whether a globe rectangle is completely inside any of the polygons in a list.
A two-dimensional, rectangular region on a globe, specified using longitude and latitude coordinates....
Classes for geospatial computations in Cesium.