File indexing completed on 2025-01-18 09:35:06
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INDEXED_HPP
0023 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_EXPAND_INDEXED_HPP
0024
0025 #include <cstddef>
0026 #include <functional>
0027
0028 #include <boost/geometry/core/access.hpp>
0029 #include <boost/geometry/core/tags.hpp>
0030
0031 #include <boost/geometry/util/select_coordinate_type.hpp>
0032
0033 #include <boost/geometry/algorithms/dispatch/expand.hpp>
0034
0035
0036 namespace boost { namespace geometry
0037 {
0038
0039 #ifndef DOXYGEN_NO_DETAIL
0040 namespace detail { namespace expand
0041 {
0042
0043
0044 template
0045 <
0046 std::size_t Index,
0047 std::size_t Dimension, std::size_t DimensionCount
0048 >
0049 struct indexed_loop
0050 {
0051 template <typename Box, typename Geometry>
0052 static inline void apply(Box& box, Geometry const& source)
0053 {
0054 typedef typename select_coordinate_type
0055 <
0056 Box,
0057 Geometry
0058 >::type coordinate_type;
0059
0060 coordinate_type const coord = get<Index, Dimension>(source);
0061
0062 std::less<coordinate_type> less;
0063 std::greater<coordinate_type> greater;
0064
0065 if (less(coord, get<min_corner, Dimension>(box)))
0066 {
0067 set<min_corner, Dimension>(box, coord);
0068 }
0069
0070 if (greater(coord, get<max_corner, Dimension>(box)))
0071 {
0072 set<max_corner, Dimension>(box, coord);
0073 }
0074
0075 indexed_loop
0076 <
0077 Index, Dimension + 1, DimensionCount
0078 >::apply(box, source);
0079 }
0080 };
0081
0082
0083 template <std::size_t Index, std::size_t DimensionCount>
0084 struct indexed_loop
0085 <
0086 Index, DimensionCount, DimensionCount
0087 >
0088 {
0089 template <typename Box, typename Geometry>
0090 static inline void apply(Box&, Geometry const&) {}
0091 };
0092
0093
0094
0095
0096 template <std::size_t Dimension, std::size_t DimensionCount>
0097 struct expand_indexed
0098 {
0099 template <typename Box, typename Geometry>
0100 static inline void apply(Box& box, Geometry const& geometry)
0101 {
0102 indexed_loop
0103 <
0104 0, Dimension, DimensionCount
0105 >::apply(box, geometry);
0106
0107 indexed_loop
0108 <
0109 1, Dimension, DimensionCount
0110 >::apply(box, geometry);
0111 }
0112 };
0113
0114
0115 }}
0116 #endif
0117
0118
0119 }}
0120
0121 #endif