RBushBase<T> constructor

RBushBase<T>({
  1. int maxEntries = 9,
  2. required RBushBox toBBox(
    1. T item
    ),
  3. required MinXYGetter<T> getMinX,
  4. required MinXYGetter<T> getMinY,
})

Constructs a new r-tree with items of type T. Each leaf would have at most maxEntries items.

Use load to bulk load items into this tree, or insert to append one by one. After that use search and knn for searching inside the tree.

Specify toBBox, getMinX, and getMinY to extract needed information from objects of type T. Alternatively, see RBush class for a simpler option.

Implementation

RBushBase(
    {int maxEntries = 9,
    required this.toBBox,
    required this.getMinX,
    required this.getMinY})
    : _maxEntries = max(4, maxEntries),
      _minEntries = max(2, (max(4, maxEntries) * 0.4).ceil()),
      data = _RBushNode<T>([]);