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