ring_concept.hpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
  3. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
  4. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
  5. // This file was modified by Oracle on 2020.
  6. // Modifications copyright (c) 2020 Oracle and/or its affiliates.
  7. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  8. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  9. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  10. // Use, modification and distribution is subject to the Boost Software License,
  11. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  12. // http://www.boost.org/LICENSE_1_0.txt)
  13. #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_RING_CONCEPT_HPP
  14. #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_RING_CONCEPT_HPP
  15. #include <boost/concept_check.hpp>
  16. #include <boost/range/concepts.hpp>
  17. #include <boost/geometry/core/access.hpp>
  18. #include <boost/geometry/core/mutable_range.hpp>
  19. #include <boost/geometry/core/point_type.hpp>
  20. #include <boost/geometry/geometries/concepts/point_concept.hpp>
  21. namespace boost { namespace geometry { namespace concepts
  22. {
  23. /*!
  24. \brief ring concept
  25. \ingroup concepts
  26. \par Formal definition:
  27. The ring concept is defined as following:
  28. - there must be a specialization of traits::tag defining ring_tag as type
  29. - it must behave like a Boost.Range
  30. - there can optionally be a specialization of traits::point_order defining the
  31. order or orientation of its points, clockwise or counterclockwise.
  32. - it must implement a std::back_insert_iterator
  33. (This is the same as the for the concept Linestring, and described there)
  34. \note to fulfill the concepts, no traits class has to be specialized to
  35. define the point type.
  36. */
  37. template <typename Geometry>
  38. class Ring
  39. {
  40. #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
  41. typedef typename point_type<Geometry>::type point_type;
  42. BOOST_CONCEPT_ASSERT( (concepts::Point<point_type>) );
  43. BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
  44. public :
  45. BOOST_CONCEPT_USAGE(Ring)
  46. {
  47. Geometry* ring = 0;
  48. traits::clear<Geometry>::apply(*ring);
  49. traits::resize<Geometry>::apply(*ring, 0);
  50. point_type* point = 0;
  51. traits::push_back<Geometry>::apply(*ring, *point);
  52. }
  53. #endif
  54. };
  55. /*!
  56. \brief (linear) ring concept (const version)
  57. \ingroup const_concepts
  58. \details The ConstLinearRing concept check the same as the Geometry concept,
  59. but does not check write access.
  60. */
  61. template <typename Geometry>
  62. class ConstRing
  63. {
  64. #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
  65. typedef typename point_type<Geometry>::type point_type;
  66. BOOST_CONCEPT_ASSERT( (concepts::ConstPoint<point_type>) );
  67. BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
  68. public :
  69. BOOST_CONCEPT_USAGE(ConstRing)
  70. {
  71. }
  72. #endif
  73. };
  74. }}} // namespace boost::geometry::concepts
  75. #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_RING_CONCEPT_HPP