Boost logo

Geometry :

Subject: Re: [geometry] Integrating OGR library with Boost.Geometry
From: Eric MSP Veith (eveith_at_[hidden])
Date: 2015-05-22 07:08:27


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...?

Thanks,
                Eric



Geometry list run by mateusz at loskot.net