Boost logo

Boost Users :

Subject: Re: [Boost-users] [geometry] Buffer multi-linestring with different distances
From: Barend Gehrels (barend_at_[hidden])
Date: 2015-03-26 13:34:13


Hi Renato,

Renato Silveira schreef op 26-3-2015 om 4:01:
> Is it possible to buffer a multi-linestring where each linestring has
> his own distance to buffer?
>
> Something like this:
> http://docs.qgis.org/2.2/en/_images/variable_buffer.png
>
> Thank you in advance

Yes this is, somehow, possible, with some reservations.

The design of the library allows doing these kind of things. But for
this specific problem it is not yet convenient, and requires point
comparisons. In case of linestrings, if they intersect (like in your
example), that might cause some problems.

You can create your own distance-strategy. In that strategy, in the
apply method, you should check the two input points. Depending on which
input linestring the points are part of, you could specify another distance.
See for example the file buffer_distance_symmetric.hpp , which contains
the default symmetric distance strategy. Using that as a starting point,
you might experiment.

I did not test this myself. Please report if it works or if there are
problems.

This will be enhanced in a future release.

Regards, Barend


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net