FlatCityBuf C++ reader 0.8.0
Native C++17 reader for FlatCityBuf, the cloud-optimized CityJSON format
Loading...
Searching...
No Matches
feature_serializer.hpp
Go to the documentation of this file.
1#pragma once
2
3#ifdef FCB_WITH_JSON
4
5# include <fcb/generated/feature_generated.h>
6# include <fcb/generated/geometry_generated.h>
7# include <fcb/generated/header_generated.h>
8# include <fcb/packed_rtree.hpp>
11
12# include <nlohmann/json.hpp>
13
14# include <array>
15# include <optional>
16# include <string>
17
18namespace fcb {
19
22struct CoType {
23 ::CityObjectType type;
24 std::optional<std::string> extension_type;
25};
26
31CoType city_object_type_from_name(const std::string& name);
32
36 ::SemanticSurfaceType type;
37 std::optional<std::string> extension_type;
38};
39
44SurfaceType semantic_surface_type_from_name(const std::string& name);
45
50::flatbuffers::Offset<::Appearance> to_appearance(::flatbuffers::FlatBufferBuilder& fbb,
51 const nlohmann::ordered_json& appearance);
52
59::flatbuffers::Offset<::Geometry> to_geometry(::flatbuffers::FlatBufferBuilder& fbb,
60 const nlohmann::ordered_json& geometry,
61 const AttributeSchema* semantic_attr_schema);
62
70::flatbuffers::Offset<::GeometryInstance>
71to_geometry_instance(::flatbuffers::FlatBufferBuilder& fbb, const nlohmann::ordered_json& geometry);
72
77::GeographicalExtent to_geographical_extent(const std::array<double, 6>& extent);
78
84::flatbuffers::Offset<::CityObject> to_city_object(::flatbuffers::FlatBufferBuilder& fbb,
85 const std::string& id,
86 const nlohmann::ordered_json& co,
87 const AttributeSchema& attr_schema,
88 const AttributeSchema* semantic_attr_schema);
89
97std::pair<::flatbuffers::Offset<::CityFeature>, NodeItem>
98to_fcb_city_feature(::flatbuffers::FlatBufferBuilder& fbb, const std::string& id,
99 const nlohmann::ordered_json& city_feature, const AttributeSchema& attr_schema,
100 const AttributeSchema* semantic_attr_schema);
101
102} // namespace fcb
103
104#endif // FCB_WITH_JSON
::flatbuffers::Offset<::CityObject > to_city_object(::flatbuffers::FlatBufferBuilder &fbb, const std::string &id, const nlohmann::ordered_json &co, const AttributeSchema &attr_schema, const AttributeSchema *semantic_attr_schema)
Builds one CityObject table: type, geographical extent, geometry (split into non-instance and Geometr...
::flatbuffers::Offset<::GeometryInstance > to_geometry_instance(::flatbuffers::FlatBufferBuilder &fbb, const nlohmann::ordered_json &geometry)
Builds a GeometryInstance table: the template index, the 4x4 transformation matrix,...
CoType city_object_type_from_name(const std::string &name)
Maps a CityJSON CityObject type string to the FlatBuffers tag.
::flatbuffers::Offset<::Appearance > to_appearance(::flatbuffers::FlatBufferBuilder &fbb, const nlohmann::ordered_json &appearance)
Builds the Appearance table (materials, textures, UV vertices, default themes) from a CityJSON appear...
::flatbuffers::Offset<::Geometry > to_geometry(::flatbuffers::FlatBufferBuilder &fbb, const nlohmann::ordered_json &geometry, const AttributeSchema *semantic_attr_schema)
Builds one Geometry table – boundaries, and whatever semantics, material and texture it carries – fro...
::GeographicalExtent to_geographical_extent(const std::array< double, 6 > &extent)
Builds a GeographicalExtent struct from a 6-element [minx,miny,minz,maxx,maxy,maxz] array.
std::map< std::string, std::pair< std::uint16_t, ::ColumnType > > AttributeSchema
Attribute schema: name -> (column index, column type).
Definition attribute.hpp:42
std::pair<::flatbuffers::Offset<::CityFeature >, NodeItem > to_fcb_city_feature(::flatbuffers::FlatBufferBuilder &fbb, const std::string &id, const nlohmann::ordered_json &city_feature, const AttributeSchema &attr_schema, const AttributeSchema *semantic_attr_schema)
Builds one CityFeature table – its CityObjects (visited in ascending id order), vertices,...
SurfaceType semantic_surface_type_from_name(const std::string &name)
Maps a CityJSON semantic surface type string to the FlatBuffers tag.
A CityObjectType tag, plus the verbatim CityJSON name when the tag is ExtensionObject (which has no s...
::CityObjectType type
std::optional< std::string > extension_type
One R-tree node entry: 4 doubles then a u64, all little-endian, 40 bytes with no padding (packed_rtre...
A SemanticSurfaceType tag, plus the verbatim CityJSON name when the tag is ExtraSemanticSurface.
::SemanticSurfaceType type
std::optional< std::string > extension_type