---------- Rtrees -- ---------- A wrapper around another model, which provides efficient geospatial queries, like finding the smaller enclosing rectangle for all the items, or all the items within a given region. The items are stored in the base model, and the Rtree model adds an extra data structure on top of it to speed up the queries. When new items are added to the model, Refresh_Layout must be called to refresh the internal cache (but this should always be done in any case to refresh the display of links for instance).
Wrapping a model in a Rtree means that the speed of displaying the canvas (and more importantly scrolling it) now depends on the number of items on the screen, not the total number of items in the model). As a result, it is possible to have models with hundreds of thousands of items.
type Base_Model_Record is new Canvas_Model_Record with private;
The underlying implementation of the model (which for instance provides support for Add and Remove), and for which the Rtree is used as a wrapper.
function Bounding_Box
(Self : not null access Rtree_Model_Record;
Margin : Model_Coordinate := 0.0)
return Model_Rectangle
procedure For_Each_Item
(Self : not null access Rtree_Model_Record;
Callback : not null access procedure
(Item : not null access Abstract_Item_Record'Class);
Selected_Only : Boolean := False;
Filter : Item_Kind_Filter := Kind_Any;
In_Area : Model_Rectangle := No_Rectangle)
procedure Gtk_New (Self : out Rtree_Model)
Create a new Rtree model.
procedure Initialize
(Self : not null access Rtree_Model_Record'Class)
Create a new Rtree model.
procedure Refresh_Layout
(Self : not null access Rtree_Model_Record;
Send_Signal : Boolean := True)
type Rtree_Model is access all Rtree_Model_Record'Class;
type Rtree_Model_Record is new Base_Model_Record with private;
function Toplevel_Item_At
(Self : not null access Rtree_Model_Record;
Point : Model_Point;
Context : Draw_Context) return Abstract_Item