Boost logo

Geometry :

Subject: Re: [geometry] one more variation to "transform"/"convert"/"for_each_point"
From: Bruno Lalande (bruno.lalande_at_[hidden])
Date: 2012-02-16 11:34:38


Hi Barend,

With such an iterator alone you cannot achieve this. Unless you have also
> information when one polygon stops and another starts, when an interior
> ring stops and another starts, etc. But that is information you normally
> don't have for iterators.
>

Yep, maybe I didn't detail enough, but in my idea this would obviously come
with some begin/end functions overloaded for each geometry.

However, we can't just overload boost::begin()/end() on the geometries
themselves because we need 2 types of iterations: per-point and
per-segment. We could use our own functions but it's not standard and it
makes my range-based example above simply unfeasible (ranges need the
standard begin()/end() functions).

So the obvious solution seems to be to propose views.

MyPolygon p;
for_each(points_view(p), do_something_with_polygon_points);
for_each(segments_view(p), do_something_with_polygon_segments);
etc...

Does that address your concern?

Regards
Bruno



Geometry list run by mateusz at loskot.net