|
Geometry : |
Subject: Re: [geometry] Integrating OGR library with Boost.Geometry
From: Menelaos Karavelas (menelaos.karavelas_at_[hidden])
Date: 2015-05-22 08:24:32
Hi Eric.
On 22/05/2015 02:08 μμ, Eric MSP Veith wrote:
> Hello again,
>
> On Friday 22 May 2015 10:39:41, Eric MSP Veith <eveith_at_[hidden]> wrote:
>>> Please make sure that you have correctly defined the specializations
>>> required by Boost.Range. It seems that you are missing the
>>> range_mutable_iterator specialization. See
>>> http://www.boost.org/doc/libs/1_58_0/libs/range/doc/html/range/reference/e
>>> xt ending.html for the details.
>> Doesn't range_mutable_iterator mean that the return type of the iterator's
>> dereference operator is a modifiable reference? If so, I cannot do this due
>> to the OGRLineString's API. :-/
>>
>> Please correct me if I'm mistaken here; I'm by no means an expert in C++
>> STL- conformant iterator design.
> while I'm still not clear on the implications of range_mutable_iterator, I
> added the following specialization to my code:
>
> namespace boost {
> template <>
> struct range_mutable_iterator<OGRLineString>
> {
> typedef Winzent::Simulation::boost::OGRLineStringIterator type;
> };
> }
>
> From what I can see, this will make the range_mutable_iterator concept usable
> with my adapter. I checked that BOOST_FOREACH (...) { ... } works for an
> OGRLineString; it successfully iterates over all points. However...
>
>>> Another thing: would it be possible to also try with boost 1.58? It
>>> would be helpful to know if the problem persists there.
>> Just upgraded to Boost 1.58.0. I used a different machine to make sure there
>> are no leftovers that interfer on the original machine. Same problem,
>> sadly.
>>>> QCOMPARE(
>>>>
>>>> bg::distance(bls1, bls2),
>>>> bg::distance(*ls1, *ls2));
>>>>
>>>> QCOMPARE(
>>>>
>>>> bg::distance(*ls1, *ls2),
>>>> ls1->Distance(ls2));
>>> Which one(s) of the three tests above fail? All of them? Just the second?
>> These two both fail. From that I conclude that (a) the OGRPoint adapter to
>> Boost.Geometry works, since I can successfully use bg::distance with my
>> `typedef bg::model::linestring<OGRPoint> boostLinestring` linestring.
>> However, the OGRLineString version uses my iterator code and fails. So the
>> only bug that can be found here is most probably in my own iterator code.
> I'm still getting this error (copied from the second QCOMPARE, the first one
> yields the same result, just with other parameters):
>
> FAIL! : BoostOGRLineStringAdapterTest::testGeometryMultiLineString() Compared
> doubles are not the same (fuzzy compare)
> Actual (bg::distance(*ls1, *ls2)): 0
> Expected (ls1->Distance(ls2)) : 18,3848
>
> Any ideas on how I can start debugging...?
Could you please try the attached program with your geometries?
Basically, what I am asking is that you change the typedefs for
point_type and linestring_type to indicate your geometries. Then give it
a try.
I want to make sure that point and segment iterator for your linestrings
work correctly. If they do then we can see what needs to be done next.
- m.
> Thanks,
> Eric
>
>
> _______________________________________________
> Geometry mailing list
> Geometry_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/geometry
Geometry list run by mateusz at loskot.net