ring_concept.hpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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-2021.
  6. // Modifications copyright (c) 2020-2021 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/concept_type.hpp>
  21. #include <boost/geometry/geometries/concepts/point_concept.hpp>
  22. namespace boost { namespace geometry { namespace concepts
  23. {
  24. template <typename Geometry>
  25. class Ring
  26. {
  27. #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
  28. typedef typename point_type<Geometry>::type point_type;
  29. BOOST_CONCEPT_ASSERT( (concepts::Point<point_type>) );
  30. BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
  31. public :
  32. BOOST_CONCEPT_USAGE(Ring)
  33. {
  34. Geometry* ring = 0;
  35. traits::clear<Geometry>::apply(*ring);
  36. traits::resize<Geometry>::apply(*ring, 0);
  37. point_type* point = 0;
  38. traits::push_back<Geometry>::apply(*ring, *point);
  39. }
  40. #endif
  41. };
  42. /*!
  43. \brief (linear) ring concept (const version)
  44. \ingroup const_concepts
  45. \details The ConstLinearRing concept check the same as the Geometry concept,
  46. but does not check write access.
  47. */
  48. template <typename Geometry>
  49. class ConstRing
  50. {
  51. #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
  52. typedef typename point_type<Geometry>::type point_type;
  53. BOOST_CONCEPT_ASSERT( (concepts::ConstPoint<point_type>) );
  54. BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
  55. public :
  56. BOOST_CONCEPT_USAGE(ConstRing)
  57. {
  58. }
  59. #endif
  60. };
  61. template <typename Geometry>
  62. struct concept_type<Geometry, ring_tag>
  63. {
  64. using type = Ring<Geometry>;
  65. };
  66. template <typename Geometry>
  67. struct concept_type<Geometry const, ring_tag>
  68. {
  69. using type = ConstRing<Geometry>;
  70. };
  71. }}} // namespace boost::geometry::concepts
  72. #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_RING_CONCEPT_HPP