Hi Eric.

On 26/05/2015 03:22 μμ, Eric MSP Veith wrote:
Hi Menelaos,

On Tuesday 26 May 2015 15:09:39, Menelaos Karavelas 
<menelaos.karavelas@gmail.com> wrote:
xample, dereferrencing returns a value rather than a
reference).

What is your linestring's value type and reference type? In the
implementation of the segment iterator it is assumed that, when
dereferrencing an iterator on the points of the linestring, a reference
(or const reference) is returned. If your linestring iterator returns
point values then this could indeed be a problem.
My linestring iterator indeed returns "Value" and not "Value &" when 
dereferencing. This is the code:


Value dereference() const
{
    assert(m_currentPointIndex < m_collection->getNumPoints());

    OGRPoint point;
    m_collection->getPoint(m_currentPointIndex, &point);
    return point;
}


As you might guess from the invocation, the OGR API only allows "copy-out" 
access to the points of a linestring, no reference.

I just checked the header of the OGRPoint class and saw that there's no 
OGRPoint(const OGRPoint &p) copy constructor defined. Meh, I guess I have the 
culprint now.

What would you advise as the best course of action --- a wrapper class? (I've 
solid C++ skills, but am by no means an expert, and therefore grateful for 
hints regarding the best solution.)

Could you please replace boost/geometry/iterators/detail/segment_iterator/value_type.hpp with the attached file.
It should work in your setting. If it does I will submit a patch (it will go under review, etc.) so that you can have the correct version in the develop branch and the next BG release.

- m.

Thanks
	Eric


_______________________________________________
Geometry mailing list
Geometry@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/geometry