| Home | Libraries | People | FAQ | More

##### BOOST_GEOMETRY_REGISTER_RING

Macro to register a ring.

###### Description

The macro BOOST_GEOMETRY_REGISTER_RING registers a ring such that it is recognized by Boost.Geometry and that Boost.Geometry functionality can used with the specified type. The ring may contain template parameters, which must be specified then.

###### Synopsis

    #define BOOST_GEOMETRY_REGISTER_RING(Ring)

###### Parameters

Name | Description
--- | ---
Ring | ring type to be registered

###### Header

`#include <boost/geometry/geometries/register/ring.hpp>`

###### Example

Show the use of the macro BOOST_GEOMETRY_REGISTER_RING

    #include <iostream>

    #include <boost/geometry.hpp>
    #include <boost/geometry/geometries/point_xy.hpp>
    #include <boost/geometry/geometries/register/ring.hpp>

    typedef boost::geometry::model::d2::point_xy<double> point_2d;

    BOOST_GEOMETRY_REGISTER_RING(std::vector<point_2d>)

    int main()
    {
        // Normal usage of std::
        std::vector<point_2d> ring;
        ring.push_back(point_2d(1, 1));
        ring.push_back(point_2d(2, 2));
        ring.push_back(point_2d(2, 1));

        // Usage of Boost.Geometry
        boost::geometry::correct(ring);
        std::cout << "Area: "  << boost::geometry::area(ring) << std::endl;
        std::cout << "WKT: "  << boost::geometry::wkt(ring) << std::endl;

        return 0;
    }

| The magic: adapt vector to Boost.Geometry Ring Concept

Output:

    Area: 0.5
    WKT: POLYGON((1 1,2 2,2 1,1 1))