Boost logo

Geometry :

Subject: [ggl] spacial index construction interface
From: Adam Wulkiewicz (adam.wulkiewicz)
Date: 2011-02-19 09:46:06

Adam Wulkiewicz wrote:
> Barend Gehrels wrote:
>>> index::rtree<Box> rtb;
>>> index::rtree<Point> rtp;
>>> index::rtree<UserDefinedPoint, UserDefinedTranslator> rtud;
>>> Then every method which takes Box as a parameter (e.g. find(...))
>>> should just take an arbirtary object which is adapted to the box
>>> concept. This allows us to have whatever we want in the internal
>>> structure of the rtree (arbitrary type of box).
>>> Methods like insert should take everything which translator is able to
>>> translate to some object adapted to point or box concept.
>> This all sounds very good to me. Cool!
> Done.
> The interface is slightly different (I didn't added methods templates).
> There are 3 template parameters:
> rtree<Value, Translator, Box>
> The Translator is an object that translates Value const& to some
> Point/Box const&. I've also added method:
> bool equals(Value const&, Value const&) const
> but I don't know if it's the best place for it. Default translator
> translator::def<Value> translates from:
> 1. SomePoint/SomeBox;
> 2. std::pair<T1, T2> - One of the types must be SomePoint or SomeBox;
> 3. iterator holding 1. or 2.;
> 4. smart pointer pointing on 1. or 2.;
> 5. pointer pointing on 1. or 2.;
> There is also a translator::index which handles indexed geometries in
> some container.
> The Box is the box type used by the rtree which by default is SomeBox or
> geometry::model::box<SomePoint>.
> There are a few examples in tests/rtree_native.cpp.

I've also played with nodes hierarchy in another branch. Leaves was
derived from nodes so thay had container to children nodes. I've changed
the hierarchy. Now functionality of a node is in internal_node class.
Leaves and internal nodes are derived from node class. Leaves are
smaller (by a size of std::vector) but more virtual functions have to be
used. I don't know what is better.

I've placed the code in:


Geometry list run by mateusz at