RTree class
#include <RTree.h>

Main R-tree class providing a unified interface.

This class delegates to specialized components for building, persisting, loading, and querying R-trees. It provides a simple interface for working with R-trees at the layer level with a known coordinate system.

The class supports:

  1. Bulk loading of R-tree for better performance
  2. Memory persistence capability
  3. Efficient caching for fast lookups

Constructors, destructors, conversion operators

RTree(RTreeHelpers::CoordinateSystem coordSys) explicit
Construct an RTree with a specific coordinate system.
~RTree() defaulted

Public functions

void insert_cell(const Cell& cell)
Insert a cell into the collection for bulk loading.
void build(const std::string& base_path)
Build the RTree using bulk loading and store to disk.
void load(const std::string& base_path, size_t cache_size = 262144)
Load a previously saved RTree from file with caching.
auto query_point(const Position& pos) const -> uint64_t
Query the nearest cell for a given position.

Function documentation

RTree::RTree(RTreeHelpers::CoordinateSystem coordSys) explicit

Construct an RTree with a specific coordinate system.

Parameters
coordSys The coordinate system for this layer's cells

void RTree::insert_cell(const Cell& cell)

Insert a cell into the collection for bulk loading.

Parameters
cell Reference to the cell to insert

void RTree::build(const std::string& base_path)

Build the RTree using bulk loading and store to disk.

Parameters
base_path Path to store the R-tree

void RTree::load(const std::string& base_path, size_t cache_size = 262144)

Load a previously saved RTree from file with caching.

Parameters
base_path Path to the input file
cache_size Size of the cache in bytes (default: 256KB)

auto RTree::query_point(const Position& pos) const -> uint64_t

Query the nearest cell for a given position.

Parameters
pos The position to query
Returns Identifier (uint64_t) of the nearest cell