Chris@16: // Boost.Geometry (aka GGL, Generic Geometry Library) Chris@16: Chris@16: // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. Chris@16: // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. Chris@16: // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. Chris@16: Chris@16: // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library Chris@16: // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. Chris@16: Chris@16: // Use, modification and distribution is subject to the Boost Software License, Chris@16: // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: Chris@16: #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_LINESTRING_CONCEPT_HPP Chris@16: #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_LINESTRING_CONCEPT_HPP Chris@16: Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: Chris@16: Chris@16: namespace boost { namespace geometry { namespace concept Chris@16: { Chris@16: Chris@16: Chris@16: /*! Chris@16: \brief Linestring concept Chris@16: \ingroup concepts Chris@16: \par Formal definition: Chris@16: The linestring concept is defined as following: Chris@16: - there must be a specialization of traits::tag defining linestring_tag as type Chris@16: - it must behave like a Boost.Range Chris@16: - it must implement a std::back_insert_iterator Chris@16: - either by implementing push_back Chris@16: - or by specializing std::back_insert_iterator Chris@16: Chris@16: \note to fulfill the concepts, no traits class has to be specialized to Chris@16: define the point type. Chris@16: Chris@16: \par Example: Chris@16: Chris@16: A custom linestring, defining the necessary specializations to fulfill to the concept. Chris@16: Chris@16: Suppose that the following linestring is defined: Chris@16: \dontinclude doxygen_5.cpp Chris@16: \skip custom_linestring1 Chris@16: \until }; Chris@16: Chris@16: It can then be adapted to the concept as following: Chris@16: \dontinclude doxygen_5.cpp Chris@16: \skip adapt custom_linestring1 Chris@16: \until }} Chris@16: Chris@16: \note Chris@16: - There is also the registration macro BOOST_GEOMETRY_REGISTER_LINESTRING Chris@16: - For registration of std::vector

(and deque, and list) it is enough to Chris@16: include the header-file geometries/adapted/std_as_linestring.hpp. That registers Chris@16: a vector as a linestring (so it cannot be registered as a linear ring then, Chris@16: in the same source code). Chris@16: Chris@16: Chris@16: */ Chris@16: Chris@16: template Chris@16: class Linestring Chris@16: { Chris@16: #ifndef DOXYGEN_NO_CONCEPT_MEMBERS Chris@16: typedef typename point_type::type point_type; Chris@16: Chris@16: BOOST_CONCEPT_ASSERT( (concept::Point) ); Chris@16: BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); Chris@16: Chris@16: public : Chris@16: Chris@16: BOOST_CONCEPT_USAGE(Linestring) Chris@16: { Chris@16: Geometry* ls = 0; Chris@16: traits::clear::apply(*ls); Chris@16: traits::resize::apply(*ls, 0); Chris@16: point_type* point = 0; Chris@16: traits::push_back::apply(*ls, *point); Chris@16: } Chris@16: #endif Chris@16: }; Chris@16: Chris@16: Chris@16: /*! Chris@16: \brief Linestring concept (const version) Chris@16: \ingroup const_concepts Chris@16: \details The ConstLinestring concept check the same as the Linestring concept, Chris@16: but does not check write access. Chris@16: */ Chris@16: template Chris@16: class ConstLinestring Chris@16: { Chris@16: #ifndef DOXYGEN_NO_CONCEPT_MEMBERS Chris@16: typedef typename point_type::type point_type; Chris@16: Chris@16: BOOST_CONCEPT_ASSERT( (concept::ConstPoint) ); Chris@16: //BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); Chris@16: // Relaxed the concept. Chris@16: BOOST_CONCEPT_ASSERT( (boost::ForwardRangeConcept) ); Chris@16: Chris@16: Chris@16: public : Chris@16: Chris@16: BOOST_CONCEPT_USAGE(ConstLinestring) Chris@16: { Chris@16: } Chris@16: #endif Chris@16: }; Chris@16: Chris@16: }}} // namespace boost::geometry::concept Chris@16: Chris@16: Chris@16: #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_LINESTRING_CONCEPT_HPP