linestring.hpp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
  4. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
  5. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  6. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  7. // Use, modification and distribution is subject to the Boost Software License,
  8. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. #ifndef BOOST_GEOMETRY_GEOMETRIES_LINESTRING_HPP
  11. #define BOOST_GEOMETRY_GEOMETRIES_LINESTRING_HPP
  12. #include <memory>
  13. #include <vector>
  14. #include <boost/concept/assert.hpp>
  15. #include <boost/range.hpp>
  16. #include <boost/geometry/core/tag.hpp>
  17. #include <boost/geometry/core/tags.hpp>
  18. #include <boost/geometry/geometries/concepts/point_concept.hpp>
  19. namespace boost { namespace geometry
  20. {
  21. namespace model
  22. {
  23. /*!
  24. \brief A linestring (named so by OGC) is a collection (default a vector) of points.
  25. \ingroup geometries
  26. \tparam Point \tparam_point
  27. \tparam Container \tparam_container
  28. \tparam Allocator \tparam_allocator
  29. \qbk{before.synopsis,
  30. [heading Model of]
  31. [link geometry.reference.concepts.concept_linestring Linestring Concept]
  32. }
  33. */
  34. template
  35. <
  36. typename Point,
  37. template<typename,typename> class Container = std::vector,
  38. template<typename> class Allocator = std::allocator
  39. >
  40. class linestring : public Container<Point, Allocator<Point> >
  41. {
  42. BOOST_CONCEPT_ASSERT( (concept::Point<Point>) );
  43. typedef Container<Point, Allocator<Point> > base_type;
  44. public :
  45. /// \constructor_default{linestring}
  46. inline linestring()
  47. : base_type()
  48. {}
  49. /// \constructor_begin_end{linestring}
  50. template <typename Iterator>
  51. inline linestring(Iterator begin, Iterator end)
  52. : base_type(begin, end)
  53. {}
  54. };
  55. } // namespace model
  56. #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
  57. namespace traits
  58. {
  59. template
  60. <
  61. typename Point,
  62. template<typename,typename> class Container,
  63. template<typename> class Allocator
  64. >
  65. struct tag<model::linestring<Point, Container, Allocator> >
  66. {
  67. typedef linestring_tag type;
  68. };
  69. } // namespace traits
  70. #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
  71. }} // namespace boost::geometry
  72. #endif // BOOST_GEOMETRY_GEOMETRIES_LINESTRING_HPP