Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING

Macro to register a multi_linestring.

Description

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

Synopsis

#define BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING(MultiLineString)

Parameters

Name

Description

MultiLineString

multi_linestring type to be registered

Header

#include <boost/geometry/geometries/register/multi_linestring.hpp>

Example

Show the use of the macro BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING

#include <iostream>

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
#include <boost/geometry/geometries/register/multi_linestring.hpp>

typedef boost::geometry::model::linestring
    <
        boost::tuple<float, float>
    > linestring_type;

BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING(std::deque<linestring_type>)

int main()
{
    // Normal usage of std::
    std::deque<linestring_type> lines(2);
    boost::geometry::read_wkt("LINESTRING(0 0,1 1)", lines[0]);
    boost::geometry::read_wkt("LINESTRING(2 2,3 3)", lines[1]);

    // Usage of Boost.Geometry
    std::cout << "LENGTH: "  << boost::geometry::length(lines) << std::endl;

    return 0;
}

Output:

LENGTH: 2.82843

PrevUpHomeNext