Boost logo

Geometry :

Subject: [ggl] spacial index construction interface
From: Adam Wulkiewicz (adam.wulkiewicz)
Date: 2011-02-17 20:44:20


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.

Regards,
Adam


Geometry list run by mateusz at loskot.net