32#include <geometry/rtree.h>
51 const int mmin[2] = { std::min( bbox.
GetX(), bbox.
GetRight() ),
53 const int mmax[2] = { std::max( bbox.
GetX(), bbox.
GetRight() ),
56 VIEW_RTREE_BASE::Insert( mmin, mmax, aItem );
70 const int mmin[2] = { std::min( aBbox->
GetX(), aBbox->
GetRight() ),
72 const int mmax[2] = { std::max( aBbox->
GetX(), aBbox->
GetRight() ),
74 VIEW_RTREE_BASE::Remove( mmin, mmax, aItem );
79 const int mmin[2] = { INT_MIN, INT_MIN };
80 const int mmax[2] = { INT_MAX, INT_MAX };
82 VIEW_RTREE_BASE::Remove( mmin, mmax, aItem );
89 template <
class Visitor>
90 void Query(
const BOX2I& aBounds, Visitor& aVisitor )
const
92 int mmin[2] = { std::min( aBounds.
GetX(), aBounds.
GetRight() ),
94 int mmax[2] = { std::max( aBounds.
GetX(), aBounds.
GetRight() ),
104 if( aBounds == max_box )
106 mmin[0] = mmin[1] = INT_MIN;
107 mmax[0] = mmax[1] = INT_MAX;
110 VIEW_RTREE_BASE::Search( mmin, mmax, aVisitor );
constexpr void SetMaximum()
constexpr coord_type GetY() const
constexpr coord_type GetX() const
constexpr coord_type GetRight() const
constexpr coord_type GetBottom() const
An abstract base class for deriving all objects that can be added to a VIEW.
Implement an non-owning R-tree for fast spatial indexing of VIEW items.
void Insert(VIEW_ITEM *aItem, const BOX2I &bbox)
Insert an item into the tree.
void Query(const BOX2I &aBounds, Visitor &aVisitor) const
Execute a function object aVisitor for each item whose bounding box intersects with aBounds.
void Remove(VIEW_ITEM *aItem, const BOX2I *aBbox)
Remove an item from the tree.
The Cairo implementation of the graphics abstraction layer.
RTree< VIEW_ITEM *, int, 2, double > VIEW_RTREE_BASE