cesium-native 0.50.0
Loading...
Searching...
No Matches
GeoJsonObjectTypes.h
1#pragma once
2
3#include <CesiumGeometry/AxisAlignedBox.h>
4#include <CesiumUtility/JsonValue.h>
5#include <CesiumVectorData/Library.h>
6#include <CesiumVectorData/VectorStyle.h>
7
8#include <glm/vec3.hpp>
9
10#include <memory>
11#include <variant>
12#include <vector>
13
14namespace CesiumVectorData {
15
19enum class GeoJsonObjectType : uint8_t {
20 Point = 0,
21 MultiPoint = 1,
22 LineString = 2,
23 MultiLineString = 3,
24 Polygon = 4,
25 MultiPolygon = 5,
26 GeometryCollection = 6,
27 Feature = 7,
28 FeatureCollection = 8
29};
30
35
43 static constexpr GeoJsonObjectType TYPE = GeoJsonObjectType::Point;
44
48 glm::dvec3 coordinates;
49
53 std::optional<CesiumGeometry::AxisAlignedBox> boundingBox = std::nullopt;
54
64
69 std::optional<VectorStyle> style = std::nullopt;
70};
71
79 static constexpr GeoJsonObjectType TYPE = GeoJsonObjectType::MultiPoint;
80
84 std::vector<glm::dvec3> coordinates;
85
89 std::optional<CesiumGeometry::AxisAlignedBox> boundingBox = std::nullopt;
90
100
105 std::optional<VectorStyle> style = std::nullopt;
106};
107
116 static constexpr GeoJsonObjectType TYPE = GeoJsonObjectType::LineString;
117
121 std::vector<glm::dvec3> coordinates;
122
126 std::optional<CesiumGeometry::AxisAlignedBox> boundingBox = std::nullopt;
127
137
142 std::optional<VectorStyle> style = std::nullopt;
143};
144
153 static constexpr GeoJsonObjectType TYPE = GeoJsonObjectType::MultiLineString;
154
159 std::vector<std::vector<glm::dvec3>> coordinates;
160
164 std::optional<CesiumGeometry::AxisAlignedBox> boundingBox = std::nullopt;
165
175
180 std::optional<VectorStyle> style = std::nullopt;
181};
182
192 static constexpr GeoJsonObjectType TYPE = GeoJsonObjectType::Polygon;
193
204 std::vector<std::vector<glm::dvec3>> coordinates;
205
209 std::optional<CesiumGeometry::AxisAlignedBox> boundingBox = std::nullopt;
210
220
225 std::optional<VectorStyle> style = std::nullopt;
226};
227
235 static constexpr GeoJsonObjectType TYPE = GeoJsonObjectType::MultiPolygon;
236
242 std::vector<std::vector<std::vector<glm::dvec3>>> coordinates;
243
247 std::optional<CesiumGeometry::AxisAlignedBox> boundingBox = std::nullopt;
248
258
263 std::optional<VectorStyle> style = std::nullopt;
264};
265
266struct GeoJsonObject;
267
274 static constexpr GeoJsonObjectType TYPE =
275 GeoJsonObjectType::GeometryCollection;
276
281 std::vector<GeoJsonObject> geometries;
282
287 std::optional<CesiumGeometry::AxisAlignedBox> boundingBox = std::nullopt;
288
298
303 std::optional<VectorStyle> style = std::nullopt;
304};
305
312 GeoJsonFeature() = default;
314 GeoJsonFeature(GeoJsonFeature&& rhs) noexcept = default;
329 std::variant<std::monostate, std::string, int64_t>&& id,
330 std::unique_ptr<GeoJsonObject>&& geometry,
331 std::optional<CesiumUtility::JsonValue::Object>&& properties,
332 std::optional<CesiumGeometry::AxisAlignedBox>&& boundingBox,
337 GeoJsonFeature& operator=(GeoJsonFeature&& rhs) noexcept = default;
338
340 static constexpr GeoJsonObjectType TYPE = GeoJsonObjectType::Feature;
341
346 std::variant<std::monostate, std::string, int64_t> id = std::monostate();
347
351 std::unique_ptr<GeoJsonObject> geometry;
352
358 std::optional<CesiumUtility::JsonValue::Object> properties;
359
363 std::optional<CesiumGeometry::AxisAlignedBox> boundingBox = std::nullopt;
364
374
379 std::optional<VectorStyle> style = std::nullopt;
380};
381
388 static constexpr GeoJsonObjectType TYPE =
389 GeoJsonObjectType::FeatureCollection;
390
394 std::vector<GeoJsonObject> features;
395
400 std::optional<CesiumGeometry::AxisAlignedBox> boundingBox = std::nullopt;
401
411
416 std::optional<VectorStyle> style = std::nullopt;
417};
418
423using GeoJsonObjectVariant = std::variant<
433} // namespace CesiumVectorData
std::map< std::string, JsonValue > Object
The type to represent an Object JSON value.
Definition JsonValue.h:73
Classes for loading vector data such as GeoJSON.
std::string_view geoJsonObjectTypeToString(GeoJsonObjectType type)
Returns the name of a GeoJsonObjectType value.
std::variant< GeoJsonPoint, GeoJsonMultiPoint, GeoJsonLineString, GeoJsonMultiLineString, GeoJsonPolygon, GeoJsonMultiPolygon, GeoJsonGeometryCollection, GeoJsonFeature, GeoJsonFeatureCollection > GeoJsonObjectVariant
Every possible object that can be specified in a GeoJSON document.
GeoJsonObjectType
A type of object in GeoJson data.
A FeatureCollection represents any number of GeoJsonFeature objects.
std::vector< GeoJsonObject > features
The GeoJsonFeature objects contained in this FeatureCollection.
static constexpr GeoJsonObjectType TYPE
The GeoJsonObjectType for a FeatureCollection.
std::optional< CesiumGeometry::AxisAlignedBox > boundingBox
The bounding box associated with this GeoJsonFeatureCollection value, if any.
std::optional< VectorStyle > style
The style to apply to this object as well as any child object. If not set, the style of any parent ob...
CesiumUtility::JsonValue::Object foreignMembers
Any members specified on this object that are not part of the specification for this object.
A GeoJsonFeature object represents a spatially bounded "thing." It is a collection of information tha...
std::optional< VectorStyle > style
The style to apply to this object as well as any child object. If not set, the style of any parent ob...
GeoJsonFeature(const GeoJsonFeature &rhs)
Copy constructor.
CesiumUtility::JsonValue::Object foreignMembers
Any members specified on this object that are not part of the specification for this object.
std::optional< CesiumUtility::JsonValue::Object > properties
The set of additional properties specified on this Feature, if any.
GeoJsonFeature(std::variant< std::monostate, std::string, int64_t > &&id, std::unique_ptr< GeoJsonObject > &&geometry, std::optional< CesiumUtility::JsonValue::Object > &&properties, std::optional< CesiumGeometry::AxisAlignedBox > &&boundingBox, CesiumUtility::JsonValue::Object &&foreignMembers)
Creates a new GeoJsonFeature with the given values.
GeoJsonFeature & operator=(const GeoJsonFeature &rhs)
Copy assignment operator.
GeoJsonFeature()=default
Default constructor.
static constexpr GeoJsonObjectType TYPE
The GeoJsonObjectType for a Feature.
GeoJsonFeature & operator=(GeoJsonFeature &&rhs) noexcept=default
Move assignment operator.
std::optional< CesiumGeometry::AxisAlignedBox > boundingBox
The bounding box associated with this Feature value, if any.
GeoJsonFeature(GeoJsonFeature &&rhs) noexcept=default
Move constructor.
std::unique_ptr< GeoJsonObject > geometry
The GeoJsonGeometryObject associated with this Feature, if any.
A GeometryCollection represents any number of GeoJsonObject objects.
std::optional< VectorStyle > style
The style to apply to this object as well as any child object. If not set, the style of any parent ob...
static constexpr GeoJsonObjectType TYPE
The GeoJsonObjectType for a GeometryCollection.
std::vector< GeoJsonObject > geometries
The GeoJsonObject values contained in this GeometryCollection.
std::optional< CesiumGeometry::AxisAlignedBox > boundingBox
The bounding box associated with this GeometryCollection value, if any.
CesiumUtility::JsonValue::Object foreignMembers
Any members specified on this object that are not part of the specification for this object.
A LineString geometry object.
std::vector< glm::dvec3 > coordinates
The list of Cartographic coordinates making up this LineString.
std::optional< CesiumGeometry::AxisAlignedBox > boundingBox
The bounding box associated with this LineString value, if any.
static constexpr GeoJsonObjectType TYPE
The GeoJsonObjectType for a LineString.
std::optional< VectorStyle > style
The style to apply to this object as well as any child object. If not set, the style of any parent ob...
CesiumUtility::JsonValue::Object foreignMembers
Any members specified on this object that are not part of the specification for this object.
A MultiLineString geometry object.
CesiumUtility::JsonValue::Object foreignMembers
Any members specified on this object that are not part of the specification for this object.
std::vector< std::vector< glm::dvec3 > > coordinates
The list of Cartographic coordinates making up this MultiLineString.
std::optional< VectorStyle > style
The style to apply to this object as well as any child object. If not set, the style of any parent ob...
std::optional< CesiumGeometry::AxisAlignedBox > boundingBox
The bounding box associated with this MultiLineString value, if any.
static constexpr GeoJsonObjectType TYPE
The GeoJsonObjectType for a MultiLineString.
A MultiPoint geometry object.
std::optional< VectorStyle > style
The style to apply to this object as well as any child object. If not set, the style of any parent ob...
static constexpr GeoJsonObjectType TYPE
The GeoJsonObjectType for a MultiPoint.
std::optional< CesiumGeometry::AxisAlignedBox > boundingBox
The bounding box associated with this MultiPoint value, if any.
CesiumUtility::JsonValue::Object foreignMembers
Any members specified on this object that are not part of the specification for this object.
std::vector< glm::dvec3 > coordinates
The list of Cartographic coordinates for this MultiPoint.
A 'MultiPolygon' geometry object.
std::vector< std::vector< std::vector< glm::dvec3 > > > coordinates
The list of Polygons making up this MultiPolygon. Each entry has equivalent rules to the coordinates ...
std::optional< VectorStyle > style
The style to apply to this object as well as any child object. If not set, the style of any parent ob...
CesiumUtility::JsonValue::Object foreignMembers
Any members specified on this object that are not part of the specification for this object.
static constexpr GeoJsonObjectType TYPE
The GeoJsonObjectType for a MultiPolygon.
std::optional< CesiumGeometry::AxisAlignedBox > boundingBox
The bounding box associated with this MultiPolygon value, if any.
An object in a GeoJSON document.
static constexpr GeoJsonObjectType TYPE
The GeoJsonObjectType for a Point.
std::optional< CesiumGeometry::AxisAlignedBox > boundingBox
The bounding box associated with this Point value, if any.
CesiumUtility::JsonValue::Object foreignMembers
Any members specified on this object that are not part of the specification for this object.
glm::dvec3 coordinates
The Cartographic coordinates for this Point.
std::optional< VectorStyle > style
The style to apply to this object as well as any child object. If not set, the style of any parent ob...
std::optional< CesiumGeometry::AxisAlignedBox > boundingBox
The bounding box associated with this Polygon value, if any.
std::vector< std::vector< glm::dvec3 > > coordinates
The list of linear rings making up this Polygon, each one defined by a set of four or more Cartograph...
static constexpr GeoJsonObjectType TYPE
The GeoJsonObjectType for a Polygon.
CesiumUtility::JsonValue::Object foreignMembers
Any members specified on this object that are not part of the specification for this object.
std::optional< VectorStyle > style
The style to apply to this object as well as any child object. If not set, the style of any parent ob...