Boost logo

Geometry :

Subject: [ggl] ease the creation of custom geometry type
From: Barend Gehrels (barend)
Date: 2011-09-03 10:34:09


Hi zsj,

On 30-8-2011 10:59, zzsj wrote:
> hi, list
> With the help of adaption macros, some of the custom geometries can be easily used with ggl. But for other cases, you have to specialize all the traits classes of the concept, which could be less convenient and ill-formed.
> For lots of my cases, I found the need for adapting custom geometry by an intrusive way.
>
> for example :
>
> if we have :
>
> template<typename Geometry>
> struct tag{
> typedef Geometry::tag type;
> };
>
> I can just place the corresponding tag typedef in my custom geometry class;
>
> and also:
>
> template<typename Geometry, std::size_t Dimension, typename Enable = void>
> struct access
> {
> typedef boost::geometry::coordinate_type<Geometry>::type ctype;
>
> static ctype get(Geometry const& g)
> {
> return g.get<Dimension>();
> }
>
> static void set(Geometry& g, ctype const& value)
> {
> g.set<Dimension>(value);
> }
> };
>
>
> With the intrusive way, user can place all the stuff in one class, and implicitly make his geometry ggl-awarable;
>

Yes but... at an early point we decided that also legacy points should
be supported, and adaption should (therefore) be done non intrusively.
However, this way might be added as an additional functionality. But
then AFAIC it still needs a macro or something to enable it.

Regards, Barend


Geometry list run by mateusz at loskot.net