| Home | Libraries | People | FAQ | More

##### BOOST_GEOMETRY_REGISTER_MULTI_POLYGON

Macro to register a multi_polygon.

###### Description

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

###### Synopsis

    #define BOOST_GEOMETRY_REGISTER_MULTI_POLYGON(MultiPolygon)

###### Parameters

Name | Description
--- | ---
MultiPolygon | multi_polygon type to be registered

###### Header

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

###### Example

Show the use of the macro BOOST_GEOMETRY_REGISTER_MULTI_POLYGON

    #include <iostream>

    #include <boost/geometry.hpp>
    #include <boost/geometry/geometries/polygon.hpp>
    #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
    #include <boost/geometry/geometries/register/multi_polygon.hpp>

    using polygon_type = boost::geometry::model::polygon
        <
            boost::tuple<float, float>
        >;

    BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
    BOOST_GEOMETRY_REGISTER_MULTI_POLYGON(std::vector<polygon_type>)

    int main()
    {
        // Normal usage of std::
        std::vector<polygon_type> polygons(2);
        boost::geometry::read_wkt("POLYGON((0 0,0 1,1 1,1 0,0 0))", polygons[0]);
        boost::geometry::read_wkt("POLYGON((3 0,3 1,4 1,4 0,3 0))", polygons[1]);

        // Usage of Boost.Geometry
        std::cout << "AREA: "  << boost::geometry::area(polygons) << std::endl;

        return 0;
    }

Output:

    AREA: 2