File indexing completed on 2025-01-18 09:35:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_IS_VALID_HPP
0016 #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_IS_VALID_HPP
0017
0018 #include <cstddef>
0019
0020 #include <boost/geometry/core/access.hpp>
0021 #include <boost/geometry/core/coordinate_dimension.hpp>
0022 #include <boost/geometry/core/static_assert.hpp>
0023
0024 namespace boost { namespace geometry { namespace index { namespace detail {
0025
0026 namespace dispatch {
0027
0028 template <typename Box,
0029 std::size_t Dimension = geometry::dimension<Box>::value>
0030 struct is_valid_box
0031 {
0032 static inline bool apply(Box const& b)
0033 {
0034 return is_valid_box<Box, Dimension - 1>::apply(b) &&
0035 ( get<min_corner, Dimension - 1>(b) <= get<max_corner, Dimension - 1>(b) );
0036 }
0037 };
0038
0039 template <typename Box>
0040 struct is_valid_box<Box, 1>
0041 {
0042 static inline bool apply(Box const& b)
0043 {
0044 return get<min_corner, 0>(b) <= get<max_corner, 0>(b);
0045 }
0046 };
0047
0048 template <typename Indexable,
0049 typename Tag = typename geometry::tag<Indexable>::type>
0050 struct is_valid
0051 {
0052 BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
0053 "Not implemented for this Indexable type.",
0054 Indexable, Tag);
0055 };
0056
0057 template <typename Indexable>
0058 struct is_valid<Indexable, point_tag>
0059 {
0060 static inline bool apply(Indexable const&)
0061 {
0062 return true;
0063 }
0064 };
0065
0066 template <typename Indexable>
0067 struct is_valid<Indexable, box_tag>
0068 {
0069 static inline bool apply(Indexable const& b)
0070 {
0071 return dispatch::is_valid_box<Indexable>::apply(b);
0072 }
0073 };
0074
0075 template <typename Indexable>
0076 struct is_valid<Indexable, segment_tag>
0077 {
0078 static inline bool apply(Indexable const&)
0079 {
0080 return true;
0081 }
0082 };
0083
0084 }
0085
0086 template <typename Indexable>
0087 inline bool is_valid(Indexable const& b)
0088 {
0089
0090
0091
0092 return dispatch::is_valid<Indexable>::apply(b);
0093 }
0094
0095 }}}}
0096
0097 #endif