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