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