Subject: AW: [ggl] Re: rtree ?
From: Adam Wulkiewicz (adam.wulkiewicz)
Date: 2011-12-02 12:22:37
Bernhard Schmitz wrote:
> Hi Adam,
> attached is a very simple test that demonstrates the problem. I know that making a box out of a point does not make any sense, but I have the problem with other objects as well.
>> -----Urspr?ngliche Nachricht-----
>> Von: Adam Wulkiewicz [mailto:adam.wulkiewicz_at_[hidden]]
>> Gesendet: Freitag, 2. Dezember 2011 12:55
>> An: Generic Geometry Library Discussion
>> Cc: Bernhard Schmitz
>> Betreff: Re: [ggl] Re: rtree ?
>> Bernhard wrote:
>>> Adam Wulkiewicz wrote
>>>> Ok, I've improved it and added nearest neighbor query description. I
>>>> should have done it earlier. Feel free to report errors, ambiguities
>>>> etc. I hope that using of the rtree will be simpler task now.
>>> Hi Adam,
>>> thanks for the documentation, it is helping me a lot.
>>> However, right now I have the problem, that I can only insert as many
>>> objects as the first parameter of the splitting algorithm parameter. So,
>>> with your usual example of index::linear<32, 8>, I can insert exactly 32
>>> objects. If I add more, size() will return the total number of objects I
>>> inserted, but only the first 32 will be found by a query.
>>> Is this a huge bug, or intentional? Or am I doing something wrong?
>>> I noticed that upon insertion, the translator is only called by the
>>> INDEX_ASSERT, and nowhere else.
>> The tree should return all of the objects. Could you please send the code?
Ok, the problem is with passing reference to temporary object. If
translator is returning Indexable instead of Indexable const&, temporary
object was created.
I fixed it by explicitly defining Translator's result type instead of
just indexable's type. Now your translator should look like this:
typedef BGCartesianBox result_type;
result_type operator()(BGCartesianSegment const& seg) const
If someone has better idea how to distinguish between resulting types
I'm open to suggestions.
Btw, maby it would be better to use std::pair<Box, Segment> and default
Translator. Or even store segments in some vector and use std::pair<Box,
size_t>. The r-tree wouldn't be forced to calculate envelopes each time
it want something from the Value.
Geometry list run by mateusz at loskot.net