Boost logo

Geometry :

Subject: Re: [geometry] Using Boost.Geometry with a legacy class hierarchy
From: Barend Gehrels (barend_at_[hidden])
Date: 2012-02-11 13:00:43

Hi Mats,

On 11-2-2012 12:34, Mats Taraldsvik wrote:
> Hi,
> I'm trying to figure out how to adapt our legacy objects to boost
> geometry. The first goal is to be able to extract the WKT from every
> type of object.
> (I am eventually going to use pointers, which is why I chose to adapt
> the point similarly to the pointer-to-point example)
> I think I've managed to adapt QPoint and QLineString, because the
> result of the program is a correct WKT. However, if there are better
> ways of defining a boost range for this purpose, I would love to hear
> about it. (None of my functions are named "range_value", and since the
> documentation states "The type defined by the metafunction
> |range_value<...>::type| must fulfill the Point Concept
> <>",
> I guess there is a better way...?)

OK I see. Notice also
and x01_qt_example.cpp in the same folder, but maybe you did already.

As far as I can see this is correct. I did not compile it but you have done.

The range_value meta-function is (AFAIK) automatically provided, as long
as you adapt it properly to the range concept, and so to see you did.
Maybe we should include that in the docs.

> The next step is to adapt the QRing class. I need to create a single
> iterator sequence that loops all of the linestrings contained in the
> QRing::lines directly, but -- especially since I'm not sure if the
> boost.range part of QLineString is done correctly -- I don't know the
> right way to do it. Could you give me any pointers?

So the linestring is done correctly, and the ring gets, in general, an
equal implementation because they are similar w.r.t. ranges etc.

What I don't understand is looping over linestrings contain in
QRing::lines. But maybe I don't understand QRing::lines well. Basically
Boost.Geometry's ring is a vector of points, which happen to form a
closed polygon (without holes). So it is similar to a linestring.

Regards, Barend

Geometry list run by mateusz at