Boost.Geometry    Boost C++ Libraries
boost::geometry::concepts::Linestring< Geometry > Class Template Reference

Linestring concept. More...

Detailed Description

template<typename Geometry>
class boost::geometry::concepts::Linestring< Geometry >

Linestring concept.

Formal definition:
The linestring concept is defined as following:
  • there must be a specialization of traits::tag defining linestring_tag as type
  • it must behave like a Boost.Range
  • it must implement a std::back_insert_iterator
    • either by implementing push_back
    • or by specializing std::back_insert_iterator
Note
to fulfill the concepts, no traits class has to be specialized to define the point type.
Example:

A custom linestring, defining the necessary specializations to fulfill to the concept.

Suppose that the following linestring is defined:

struct custom_linestring1 : std::deque<P>
{
int id;
};

It can then be adapted to the concept as following:

// adapt custom_linestring1
namespace boost { namespace geometry { namespace traits
{
template <typename P>
struct tag< custom_linestring1<P> > { typedef linestring_tag type; };
}}} // namespace boost::geometry::traits

Note
  • There is also the registration macro BOOST_GEOMETRY_REGISTER_LINESTRING
  • For registration of std::vector<P> (and deque, and list) it is enough to include the header-file geometries/adapted/std_as_linestring.hpp. That registers a vector as a linestring (so it cannot be registered as a linear ring then, in the same source code).

April 2, 2011

Copyright © 2007-2011 Barend Gehrels, Amsterdam, the Netherlands
Copyright © 2008-2011 Bruno Lalande, Paris, France
Copyright © 2009-2010 Mateusz Loskot, London, UK
Documentation is generated by Doxygen