File indexing completed on 2025-10-16 08:28:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef BOOST_GEOMETRY_CORE_CLOSURE_HPP
0020 #define BOOST_GEOMETRY_CORE_CLOSURE_HPP
0021
0022 #include <boost/range/value_type.hpp>
0023
0024 #include <boost/geometry/core/ring_type.hpp>
0025 #include <boost/geometry/core/static_assert.hpp>
0026 #include <boost/geometry/core/tag.hpp>
0027 #include <boost/geometry/core/tags.hpp>
0028 #include <boost/geometry/util/type_traits_std.hpp>
0029
0030 namespace boost { namespace geometry
0031 {
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049 enum closure_selector
0050 {
0051
0052
0053 open = 0,
0054
0055 closed = 1,
0056
0057
0058 closure_undertermined = -1
0059 };
0060
0061 namespace traits
0062 {
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073 template <typename G>
0074 struct closure
0075 {
0076 static const closure_selector value = closed;
0077 };
0078
0079
0080 }
0081
0082
0083 #ifndef DOXYGEN_NO_DETAIL
0084 namespace core_detail { namespace closure
0085 {
0086
0087 struct closed
0088 {
0089 static const closure_selector value = geometry::closed;
0090 };
0091
0092
0093
0094
0095 template <closure_selector Closure>
0096 struct minimum_ring_size {};
0097
0098 template <>
0099 struct minimum_ring_size<geometry::closed>
0100 : std::integral_constant<std::size_t, 4>
0101 {};
0102
0103 template <>
0104 struct minimum_ring_size<geometry::open>
0105 : std::integral_constant<std::size_t, 3>
0106 {};
0107
0108
0109 }}
0110 #endif
0111
0112
0113
0114 #ifndef DOXYGEN_NO_DISPATCH
0115 namespace core_dispatch
0116 {
0117
0118 template <typename Tag, typename Geometry>
0119 struct closure
0120 {
0121 BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
0122 "Not implemented for this Geometry type.",
0123 Geometry);
0124 };
0125
0126 template <typename Box>
0127 struct closure<point_tag, Box> : public core_detail::closure::closed {};
0128
0129 template <typename Box>
0130 struct closure<box_tag, Box> : public core_detail::closure::closed {};
0131
0132 template <typename Box>
0133 struct closure<segment_tag, Box> : public core_detail::closure::closed {};
0134
0135 template <typename LineString>
0136 struct closure<linestring_tag, LineString>
0137 : public core_detail::closure::closed {};
0138
0139
0140 template <typename Ring>
0141 struct closure<ring_tag, Ring>
0142 {
0143 static const closure_selector value
0144 = geometry::traits::closure<Ring>::value;
0145 };
0146
0147
0148 template <typename Polygon>
0149 struct closure<polygon_tag, Polygon>
0150 {
0151 static const closure_selector value = core_dispatch::closure
0152 <
0153 ring_tag,
0154 typename ring_type<polygon_tag, Polygon>::type
0155 >::value ;
0156 };
0157
0158 template <typename MultiPoint>
0159 struct closure<multi_point_tag, MultiPoint>
0160 : public core_detail::closure::closed {};
0161
0162 template <typename MultiLinestring>
0163 struct closure<multi_linestring_tag, MultiLinestring>
0164 : public core_detail::closure::closed {};
0165
0166
0167 template <typename MultiPolygon>
0168 struct closure<multi_polygon_tag, MultiPolygon>
0169 {
0170 static const closure_selector value = core_dispatch::closure
0171 <
0172 polygon_tag,
0173 typename boost::range_value<MultiPolygon>::type
0174 >::value ;
0175 };
0176
0177 }
0178 #endif
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189 template <typename Geometry>
0190 struct closure
0191 : std::integral_constant
0192 <
0193 closure_selector,
0194 core_dispatch::closure
0195 <
0196 tag_t<Geometry>,
0197 util::remove_cptrref_t<Geometry>
0198 >::value
0199 >
0200 {};
0201
0202 #ifndef BOOST_NO_CXX17_INLINE_VARIABLES
0203 template <typename Geometry>
0204 inline constexpr closure_selector closure_v = closure<Geometry>::value;
0205 #endif
0206
0207
0208 #ifndef DOXYGEN_NO_DETAIL
0209 namespace detail
0210 {
0211
0212 template <typename Geometry>
0213 using minimum_ring_size = core_detail::closure::minimum_ring_size
0214 <
0215 geometry::closure<Geometry>::value
0216 >;
0217
0218
0219 }
0220 #endif
0221
0222
0223 }}
0224
0225
0226 #endif