|
Geometry : |
Subject: [ggl] Deriving from model::point<> and using distance(); seeing NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE,
From: Eric Fowler (eric.fowler)
Date: 2011-07-26 06:24:14
It's beginning to sink in. My problem is that I have a point type that gets
the type of it's x, y coordinate through a template, e.g.
template<typename T>
class Point
{
T x, y;
bool bMyVar;
};
If I declare a point that is not templatized, e.g.
class Point
{
double x, y;
bool bMyVar;
};
I can easily register and use it with boost/geometry.
But can I be sure that I can use different coordinate systems? I need to be
able to switch between cartesian and geographic coordinates with ease. I can
live with just using double-precision floats.
Mind, I am just looking for the easy way, but I want to understand what I am
doing.
Eric
On Sun, Jul 24, 2011 at 2:30 PM, Barend Gehrels <barend_at_[hidden]> wrote:
> 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
>
>
>
> ______________________________**_________________
> ggl mailing list
> ggl_at_[hidden]
> http://lists.osgeo.org/**mailman/listinfo/ggl
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/ggl/attachments/20110726/dad08ebf/attachment.html
Geometry list run by mateusz at loskot.net