Gtkada.Canvas_View.Rtrees

Entities

Tagged Types

Constants

Subprograms

Description

This package provides a R-Tree datastructure. This is an efficient data structure for geospatial queries, like find all objects within a given rectangle. See algorithm in http://www-db.deis.unibo.it/courses/SI-LS/papers/Gut84.pdf

Bounding_Box

function Bounding_Box (Self : Rtree) return Model_Rectangle

Return the minimal rectangle that encloses all the elements in the tree

Parameters
Self
Return Value

Clear

procedure Clear (Self : in out Rtree)

Remove all nodes from the tree. The objects are not destroyed.

Parameters
Self

Default_Max_Children

Default_Max_Children : constant Positive := 6;

Default_Min_Children

Default_Min_Children : constant Positive := 3;

Dump_Debug

procedure Dump_Debug (Self : Rtree)

Debug: print the tree.

Parameters
Self

Find

function Find
   (Self : Rtree; Rect : Model_Rectangle)
   return Items_Lists.List

Find all the objects that intersect with the given rectangle.

Parameters
Self
Rect
Return Value

For_Each_Object

procedure For_Each_Object
   (Self     : Rtree;
    Callback : not null access procedure
       (Item : not null access Abstract_Item_Record'Class);
    In_Area  : Model_Rectangle := No_Rectangle)

Executes Callback for each item in the given area (or in the whole tree)

Parameters
Self
Callback
In_Area

Insert

procedure Insert
   (Self : in out Rtree;
    Item : not null access Abstract_Item_Record'Class)

Add a new item to the tree. The object must already have a position.

Parameters
Self
Item

Is_Empty

function Is_Empty (Self : Rtree) return Boolean

Whether the rtree is empty

Parameters
Self
Return Value

Rtree

type Rtree (Min_Children, Max_Children : Positive) is tagged private;

A data structure for storing geospatial information. It splits the space into cells that contain a maximum number of objects, and makes it easy to find out objects within a given region. Min_Children is the minimum number of children in a cell before it is merged with a sibling cell. Max_Children is the maximum number of children in a cell before it is split.

Record fields
Min_Children
Max_Children