multi_point_concept.hpp 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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_CONCEPTS_MULTI_POINT_CONCEPT_HPP
  11. #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POINT_CONCEPT_HPP
  12. #include <boost/concept_check.hpp>
  13. #include <boost/range/concepts.hpp>
  14. #include <boost/range/metafunctions.hpp>
  15. #include <boost/geometry/geometries/concepts/point_concept.hpp>
  16. namespace boost { namespace geometry { namespace concepts
  17. {
  18. /*!
  19. \brief MultiPoint concept
  20. \ingroup concepts
  21. \par Formal definition:
  22. The multi point concept is defined as following:
  23. - there must be a specialization of traits::tag defining multi_point_tag as type
  24. - it must behave like a Boost.Range
  25. - its range value must fulfil the Point concept
  26. */
  27. template <typename Geometry>
  28. class MultiPoint
  29. {
  30. #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
  31. typedef typename boost::range_value<Geometry>::type point_type;
  32. BOOST_CONCEPT_ASSERT( (concepts::Point<point_type>) );
  33. BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
  34. public :
  35. BOOST_CONCEPT_USAGE(MultiPoint)
  36. {
  37. Geometry* mp = 0;
  38. traits::clear<Geometry>::apply(*mp);
  39. traits::resize<Geometry>::apply(*mp, 0);
  40. point_type* point = 0;
  41. traits::push_back<Geometry>::apply(*mp, *point);
  42. }
  43. #endif
  44. };
  45. /*!
  46. \brief concept for multi-point (const version)
  47. \ingroup const_concepts
  48. */
  49. template <typename Geometry>
  50. class ConstMultiPoint
  51. {
  52. #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
  53. typedef typename boost::range_value<Geometry>::type point_type;
  54. BOOST_CONCEPT_ASSERT( (concepts::ConstPoint<point_type>) );
  55. BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
  56. public :
  57. BOOST_CONCEPT_USAGE(ConstMultiPoint)
  58. {
  59. }
  60. #endif
  61. };
  62. }}} // namespace boost::geometry::concepts
  63. #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POINT_CONCEPT_HPP