FlatCityBuf C++ reader 0.8.0
Native C++17 reader for FlatCityBuf, the cloud-optimized CityJSON format
Loading...
Searching...
No Matches
header_serializer.hpp
Go to the documentation of this file.
1#pragma once
2
3#ifdef FCB_WITH_JSON
4
5# include <fcb/generated/extension_generated.h>
6# include <fcb/generated/header_generated.h>
7# include <fcb/layout.hpp>
10
11# include <nlohmann/json.hpp>
12
13# include <array>
14# include <optional>
15# include <string>
16# include <vector>
17
18namespace fcb {
19
25 std::uint16_t index;
26 std::uint32_t length;
27 std::uint16_t branching_factor;
28 std::uint32_t num_unique_items;
29};
30
37 bool write_index = true;
38 std::uint64_t feature_count = 0;
42 std::vector<std::pair<std::string, std::optional<std::uint16_t>>> attribute_indices;
43 std::optional<std::array<double, 6>> geographical_extent;
44};
45
49::Transform to_transform(const nlohmann::ordered_json& transform);
50
53 std::string authority;
54 std::int32_t version = 0;
55 std::int32_t code = 0;
56};
57
69std::optional<ParsedReferenceSystem> parse_reference_system(const std::string& url);
70
74::flatbuffers::Offset<::ReferenceSystem> to_reference_system(::flatbuffers::FlatBufferBuilder& fbb,
75 const ParsedReferenceSystem& ref_sys);
76
80::flatbuffers::Offset<::Extension> to_extension(::flatbuffers::FlatBufferBuilder& fbb,
81 const std::string& name, const std::string& url,
82 const std::string& version);
83
89::flatbuffers::Offset<::flatbuffers::Vector<const ::DoubleVertex*>>
90to_templates_vertices(::flatbuffers::FlatBufferBuilder& fbb,
91 const nlohmann::ordered_json& vertices_templates);
92
103 std::optional<::flatbuffers::Offset<::flatbuffers::String>> contact_name;
104 std::optional<::flatbuffers::Offset<::flatbuffers::String>> contact_type;
105 std::optional<::flatbuffers::Offset<::flatbuffers::String>> role;
106 std::optional<::flatbuffers::Offset<::flatbuffers::String>> phone;
107 std::optional<::flatbuffers::Offset<::flatbuffers::String>> email;
108 std::optional<::flatbuffers::Offset<::flatbuffers::String>> website;
109 std::optional<::flatbuffers::Offset<::flatbuffers::String>> address_thoroughfare_number;
110 std::optional<::flatbuffers::Offset<::flatbuffers::String>> address_thoroughfare_name;
111 std::optional<::flatbuffers::Offset<::flatbuffers::String>> address_locality;
112 std::optional<::flatbuffers::Offset<::flatbuffers::String>> address_postcode;
113 std::optional<::flatbuffers::Offset<::flatbuffers::String>> address_country;
114};
115PocOffsets to_point_of_contact(::flatbuffers::FlatBufferBuilder& fbb,
116 const nlohmann::ordered_json& poc);
117
142::flatbuffers::Offset<::Header>
143to_fcb_header(::flatbuffers::FlatBufferBuilder& fbb, const nlohmann::ordered_json& cj,
144 const HeaderWriterOptions& options, const AttributeSchema& attr_schema,
145 const AttributeSchema* semantic_attr_schema,
146 const std::vector<AttributeIndexInfo>* attribute_indices_info);
147
148} // namespace fcb
149
150#endif // FCB_WITH_JSON
constexpr std::uint16_t kDefaultNodeSize
Definition layout.hpp:16
::flatbuffers::Offset<::flatbuffers::Vector< const ::DoubleVertex * > > to_templates_vertices(::flatbuffers::FlatBufferBuilder &fbb, const nlohmann::ordered_json &vertices_templates)
Builds Header.templates_vertices from CityJSON's geometry-templates.vertices-templates (f64 precision...
::Transform to_transform(const nlohmann::ordered_json &transform)
Builds the Transform struct (scale + translate) from CityJSON's top-level transform member.
PocOffsets to_point_of_contact(::flatbuffers::FlatBufferBuilder &fbb, const nlohmann::ordered_json &poc)
std::map< std::string, std::pair< std::uint16_t, ::ColumnType > > AttributeSchema
Attribute schema: name -> (column index, column type).
Definition attribute.hpp:42
::flatbuffers::Offset<::ReferenceSystem > to_reference_system(::flatbuffers::FlatBufferBuilder &fbb, const ParsedReferenceSystem &ref_sys)
Builds the ReferenceSystem table from a parsed metadata.referenceSystem URL.
::flatbuffers::Offset<::Extension > to_extension(::flatbuffers::FlatBufferBuilder &fbb, const std::string &name, const std::string &url, const std::string &version)
Builds one extensions entry: only name/url/version are written (the schema document itself is never f...
std::optional< ParsedReferenceSystem > parse_reference_system(const std::string &url)
Parses a referenceSystem URL (https://www.opengis.net/def/crs/{authority}/{version}/{code},...
::flatbuffers::Offset<::Header > to_fcb_header(::flatbuffers::FlatBufferBuilder &fbb, const nlohmann::ordered_json &cj, const HeaderWriterOptions &options, const AttributeSchema &attr_schema, const AttributeSchema *semantic_attr_schema, const std::vector< AttributeIndexInfo > *attribute_indices_info)
Builds the whole Header table from the CityJSON metadata line (the first line of a CityJSONSeq: type/...
One attribute column's B+tree index metadata, as recorded in the header (AttributeIndex,...
Configuration for header writing.
std::vector< std::pair< std::string, std::optional< std::uint16_t > > > attribute_indices
(attribute name, branching factor); std::nullopt branching factor means the default.
std::optional< std::array< double, 6 > > geographical_extent
A metadata.referenceSystem URL, parsed into its OGC three-element form.
Builds the pointOfContact fields of a header from CityJSON metadata.pointOfContact.
std::optional<::flatbuffers::Offset<::flatbuffers::String > > contact_name
std::optional<::flatbuffers::Offset<::flatbuffers::String > > role
std::optional<::flatbuffers::Offset<::flatbuffers::String > > phone
std::optional<::flatbuffers::Offset<::flatbuffers::String > > website
std::optional<::flatbuffers::Offset<::flatbuffers::String > > address_postcode
std::optional<::flatbuffers::Offset<::flatbuffers::String > > email
std::optional<::flatbuffers::Offset<::flatbuffers::String > > address_thoroughfare_number
std::optional<::flatbuffers::Offset<::flatbuffers::String > > address_country
std::optional<::flatbuffers::Offset<::flatbuffers::String > > address_thoroughfare_name
std::optional<::flatbuffers::Offset<::flatbuffers::String > > contact_type
std::optional<::flatbuffers::Offset<::flatbuffers::String > > address_locality