Boost logo

Geometry :

Subject: [ggl] Deriving from model::point<> and using distance(); seeing NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE,
From: Barend Gehrels (barend)
Date: 2011-07-24 18:56:03


Hi Eric,

On 24-7-2011 22:43, Eric Fowler wrote:
> I wish to derive a class from a point<> type that can use either
> cartesian or spherical or geographic coordinates.
>
> When I pass a derived point type to the distance() function, I am
> horrified to get a long error that flags my type.
>
> What am I doing wrong? Do I need a traits class? What's going on here?
> The code and error follow. I am using VC++ 8.0.

Yes, you need to specialize traits classes for your point type. Template
specializations don't accept derived classes.

For this, the BOOST_GEOMETRY_REGISTER macro's are convenient: they can
define the necessary traits for you in one line. That is, in general,
easier than do it by hand.

But... in your case, you create a generic point yourself, so you will
have to implement the traits specializations...

Regards, Barend


Geometry list run by mateusz at loskot.net