Boost logo

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-24 18:06:42


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.

Eric

//-------------------------------------------------------
#include "stdafx.h"
using namespace boost;
using namespace boost::geometry;

template<typename CoordinateType, typename CoordinateSystem = cs::cartesian>
class POS : public boost::geometry::model::point<CoordinateType, 2,
CoordinateSystem>
{
public:
POS(CoordinateType const& a, CoordinateType const& b):point(a, b){};
 bool bDummy;
};

int _tmain(int argc, _TCHAR* argv[])
{
POS<double, boost::geometry::cs::cartesian> pa(0,179.9999);
 POS<double, boost::geometry::cs::cartesian> pb(0,-179.9999);

distance(pa, pb); // <<<=========THIS LINE CHOKES=========

return 0;
}

------ Build started: Project: DelaunayDriver, Configuration: Debug Win32
------
Compiling...
DelaunayDriver.cpp
c:\boost_1_47_0\boost\geometry\core\point_type.hpp(47) : error C2664:
'boost::mpl::assertion_failed' : cannot convert parameter 1 from
'boost::mpl::failed ************(__thiscall
boost::geometry::traits::point_type<Geometry>::NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE::*
***********)(boost::mpl::assert_::types<T1>)' to
'boost::mpl::assert<false>::type'
        with
        [
            Geometry=POS<double,boost::geometry::cs::cartesian>,
            T1=POS<double,boost::geometry::cs::cartesian>
        ]
        No constructor could take the source type, or constructor overload
resolution was ambiguous
        c:\boost_1_47_0\boost\geometry\core\point_type.hpp(64) : see
reference to class template instantiation
'boost::geometry::traits::point_type<Geometry>' being compiled
        with
        [
            Geometry=POS<double,boost::geometry::cs::cartesian>
        ]
        c:\boost_1_47_0\boost\geometry\core\point_type.hpp(123) : see
reference to class template instantiation
'boost::geometry::core_dispatch::point_type<Tag,Geometry>' being compiled
        with
        [
            Tag=void,
            Geometry=POS<double,boost::geometry::cs::cartesian>
        ]

c:\boost_1_47_0\boost\geometry\strategies\default_distance_result.hpp(40) :
see reference to class template instantiation
'boost::geometry::point_type<Geometry>' being compiled
        with
        [
            Geometry=POS<double,boost::geometry::cs::cartesian>
        ]
        c:\documents and settings\eric\my documents\visual studio
2008\projects\shuttle\delaunaydriver\delaunaydriver\delaunaydriver.cpp(29) :
see reference to class template instantiation
'boost::geometry::default_distance_result<Geometry1,Geometry2>' being
compiled
        with
        [
            Geometry1=POS<double,boost::geometry::cs::cartesian>,
            Geometry2=POS<double,boost::geometry::cs::cartesian>
        ]
c:\boost_1_47_0\boost\geometry\core\point_type.hpp(47) : error C2866:
'boost::geometry::traits::point_type<Geometry>::mpl_assertion_in_line_36' :
a const static data member of a managed type must be initialized at the
point of declaration
        with
        [
            Geometry=POS<double,boost::geometry::cs::cartesian>
        ]
c:\boost_1_47_0\boost\geometry\core\point_type.hpp(64) : error C2039: 'type'
: is not a member of 'boost::geometry::traits::point_type<Geometry>'
        with
        [
            Geometry=POS<double,boost::geometry::cs::cartesian>
        ]
c:\boost_1_47_0\boost\geometry\core\point_type.hpp(65) : error C3203: 'type'
: unspecialized class template can't be used as a template argument for
template parameter 'T', expected a real type
c:\boost_1_47_0\boost\geometry\core\point_type.hpp(65) : error C2955:
'boost::type' : use of class template requires template argument list
        c:\boost_1_47_0\boost\type.hpp(14) : see declaration of
'boost::type'
c:\boost_1_47_0\boost\geometry\core\point_type.hpp(65) : error C2955:
'boost::remove_const' : use of class template requires template argument
list
        c:\boost_1_47_0\boost\type_traits\remove_const.hpp(73) : see
declaration of 'boost::remove_const'
c:\boost_1_47_0\boost\geometry\strategies\default_distance_result.hpp(43) :
error C2146: syntax error : missing ';' before identifier 'type'
c:\boost_1_47_0\boost\geometry\strategies\default_distance_result.hpp(43) :
error C3254: 'boost::geometry::default_distance_result<Geometry1,Geometry2>'
: class contains explicit override 'type' but does not derive from an
interface that contains the function declaration
        with
        [
            Geometry1=POS<double,boost::geometry::cs::cartesian>,
            Geometry2=POS<double,boost::geometry::cs::cartesian>
        ]
c:\boost_1_47_0\boost\geometry\strategies\default_distance_result.hpp(43) :
error C2838: 'type' : illegal qualified name in member declaration
c:\boost_1_47_0\boost\geometry\strategies\default_distance_result.hpp(43) :
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
c:\boost_1_47_0\boost\geometry\strategies\default_distance_result.hpp(43) :
error C2602:
'boost::geometry::default_distance_result<Geometry1,Geometry2>::type' is not
a member of a base class of
'boost::geometry::default_distance_result<Geometry1,Geometry2>'
        with
        [
            Geometry1=POS<double,boost::geometry::cs::cartesian>,
            Geometry2=POS<double,boost::geometry::cs::cartesian>
        ]

c:\boost_1_47_0\boost\geometry\strategies\default_distance_result.hpp(43) :
see declaration of
'boost::geometry::default_distance_result<Geometry1,Geometry2>::type'
        with
         [
            Geometry1=POS<double,boost::geometry::cs::cartesian>,
            Geometry2=POS<double,boost::geometry::cs::cartesian>
        ]
c:\boost_1_47_0\boost\geometry\strategies\default_distance_result.hpp(43) :
error C2868:
'boost::geometry::default_distance_result<Geometry1,Geometry2>::type' :
illegal syntax for using-declaration; expected qualified-name
        with
        [
            Geometry1=POS<double,boost::geometry::cs::cartesian>,
            Geometry2=POS<double,boost::geometry::cs::cartesian>
        ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/ggl/attachments/20110724/0f7b4e8b/attachment.html


Geometry list run by mateusz at loskot.net