Question

I'm trying (and failing) to implement the Polygon Concept in Boost.Geometry. I've successfully got a Point and Ring concept working:

typedef QVector<QVector2D> Contour;
BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET(QVector2D, float,
    boost::geometry::cs::cartesian, x, y, setX, setY)
BOOST_GEOMETRY_REGISTER_RING(Contour)

Now I am trying to define a Polygon class as:

class Polygon
{
public:
    typedef QVector2D point_type;
    typedef Contour ring_type;
    typedef QVector<Contour> inner_container_type;

    Contour const& outer() const { return _outer; }
    QVector<Contour> const& inners() const { return _inners; }

    Contour& outer() { return _outer; }
    QVector<Contour>& inners() { return _inners; }
private:
    Contour _outer;    
    QVector<Contour> _inners;
};

I know I need to add the polygon tag to this class, but I can't find any clear examples of doing that, and the errors I'm getting suggest more problems. If anyone can provide a link to a working example of implementing the concept, I think I could figure out my issues from there.

Was it helpful?

Solution

The best reference to do this is in the documentation:

http://www.boost.org/doc/libs/1_54_0/libs/geometry/doc/html/geometry/examples.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top