Boost logo

Geometry :

Subject: [ggl] compile error with a custom linestring
From: Vishnu (vrang3)
Date: 2011-05-06 18:07:37


I have a compiler error on MSVC 2008 using boost-geometry-0.9.0. The error
appears to be due to my creating a custom linestring that isn't being
recognized as a geometry. I'm wondering whether someone can give me a more
specific pointer on what needs to be added to fix this.

First, the error:

D:\boost_1_46_1\boost/geometry/algorithms/expand.hpp(308) : error C2039:
'apply' : is not a member of 'boost::geometry::dispatch::ex
pand<Tag,BoxOut,Geometry,StrategyLess,StrategyGreater>'
        with
        [
            Tag=boost::geometry::linestring_tag,
            BoxOut=Box2D,
            Geometry=LineString2DWithID,
           
StrategyLess=boost::geometry::strategy::compare::default_strategy,
           
StrategyGreater=boost::geometry::strategy::compare::default_strategy
        ]
        .\plybld.cpp(183) : see reference to function template instantiation
'void boost::geometry::expand<Box2D,LineString2DWithID>
(Box &,const Geometry &)' being compiled
        with
        [
            Box=Box2D,
            Geometry=LineString2DWithID
        ]
D:\boost_1_46_1\boost/geometry/algorithms/expand.hpp(308) : error C3861:
'apply': identifier not found
NMAKE : fatal error U1077: '"E:\Program Files\Microsoft Visual Studio
9.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.

The custom linestring depends on a custom point, Point2D, registered thus:

BOOST_GEOMETRY_REGISTER_POINT_2D(Point2D, double, cs::cartesian, x(), y())

The custom linestring itself is defined and registered in this way:

struct LineString2DWithID : std::vector<Point2D>
{
        LineString2DWithID(unsigned int the_id) : id(the_id)
        {
        }

  LineString2DWithID() : id(0)
        {
        }

        unsigned int id;
        
};

// Register the linestring
BOOST_GEOMETRY_REGISTER_LINESTRING(LineString2DWithID)

The custom linestring is used in this manner:

void extendLines(double lineExtensionDistance,
        vector<LineString2DWithID> & lines)
{
        ...

        for (size_t i = 0; i < numLines; i++) {
                boost::geometry::expand(box, lines[i]);
                //size_t numPoints = lines[i].size();
                //for (size_t j = 0; j < numPoints; j++) {
                // boost::geometry::expand(box, lines[i][j]);
                //}
        }
        ...

}

The compiler error disappears if I pass a custom point into the
boost::geometry::expand() function:

        for (size_t i = 0; i < numLines; i++) {
                //boost::geometry::expand(box, lines[i]);
                size_t numPoints = lines[i].size();
                for (size_t j = 0; j < numPoints; j++) {
                        boost::geometry::expand(box, lines[i][j]);
                }
        }

--
View this message in context: http://boost-geometry.203548.n3.nabble.com/compile-error-with-a-custom-linestring-tp2909233p2909233.html
Sent from the Boost Geometry mailing list archive at Nabble.com.

Geometry list run by mateusz at loskot.net