FlatCityBuf C++ reader 0.8.0
Native C++17 reader for FlatCityBuf, the cloud-optimized CityJSON format
Loading...
Searching...
No Matches
rtree_builder.hpp
Go to the documentation of this file.
1#pragma once
2
3#ifdef FCB_WITH_JSON
4
5# include <fcb/packed_rtree.hpp>
6
7# include <cstdint>
8# include <vector>
9
10namespace fcb {
11
18std::uint32_t hilbert(std::uint32_t x, std::uint32_t y);
19
25std::uint32_t hilbert_bbox(const NodeItem& r, std::uint32_t hilbert_max, const NodeItem& extent);
26
30void hilbert_sort(std::vector<NodeItem>& items, const NodeItem& extent);
31
37NodeItem calc_extent(const std::vector<NodeItem>& nodes);
38
49std::vector<NodeItem> build_packed_rtree(const std::vector<NodeItem>& nodes, const NodeItem& extent,
50 std::uint16_t node_size);
51
55std::vector<std::uint8_t> encode_packed_rtree(const std::vector<NodeItem>& tree);
56
57} // namespace fcb
58
59#endif // FCB_WITH_JSON
void hilbert_sort(std::vector< NodeItem > &items, const NodeItem &extent)
Sorts items in place by descending Hilbert index (the item furthest along the curve first) – a STABLE...
std::vector< std::uint8_t > encode_packed_rtree(const std::vector< NodeItem > &tree)
Serializes every node in tree (as returned by build_packed_rtree) in array order, 40 bytes each.
std::vector< NodeItem > build_packed_rtree(const std::vector< NodeItem > &nodes, const NodeItem &extent, std::uint16_t node_size)
Builds the full flat packed-R-tree node array (leaves first in nodes's own order at the array's tail ...
NodeItem calc_extent(const std::vector< NodeItem > &nodes)
The bbox union of every item, via repeated NodeItem::expand starting from NodeItem::empty(0).
std::uint32_t hilbert_bbox(const NodeItem &r, std::uint32_t hilbert_max, const NodeItem &extent)
A NodeItem's Hilbert index: its bbox center, scaled into [0, hilbert_max] against extent,...
std::uint32_t hilbert(std::uint32_t x, std::uint32_t y)
The Hilbert curve index of point (x, y) on a 65536x65536 grid (16 bits per axis).
std::uint64_t node_size
Definition stree.cpp:167