File indexing completed on 2025-01-18 09:36:51
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_STRATEGY_CARTESIAN_EXPAND_POINT_HPP
0023 #define BOOST_GEOMETRY_STRATEGY_CARTESIAN_EXPAND_POINT_HPP
0024
0025 #include <cstddef>
0026 #include <functional>
0027
0028 #include <boost/geometry/core/access.hpp>
0029 #include <boost/geometry/core/coordinate_dimension.hpp>
0030 #include <boost/geometry/core/coordinate_system.hpp>
0031 #include <boost/geometry/core/coordinate_type.hpp>
0032 #include <boost/geometry/core/tags.hpp>
0033
0034 #include <boost/geometry/util/select_coordinate_type.hpp>
0035
0036 #include <boost/geometry/strategy/expand.hpp>
0037
0038 namespace boost { namespace geometry
0039 {
0040
0041 namespace strategy { namespace expand
0042 {
0043
0044 #ifndef DOXYGEN_NO_DETAIL
0045 namespace detail
0046 {
0047
0048 template <std::size_t Dimension, std::size_t DimensionCount>
0049 struct point_loop
0050 {
0051 template <typename Box, typename Point>
0052 static inline void apply(Box& box, Point const& source)
0053 {
0054 typedef typename select_coordinate_type
0055 <
0056 Point, Box
0057 >::type coordinate_type;
0058
0059 std::less<coordinate_type> less;
0060 std::greater<coordinate_type> greater;
0061
0062 coordinate_type const coord = get<Dimension>(source);
0063
0064 if (less(coord, get<min_corner, Dimension>(box)))
0065 {
0066 set<min_corner, Dimension>(box, coord);
0067 }
0068
0069 if (greater(coord, get<max_corner, Dimension>(box)))
0070 {
0071 set<max_corner, Dimension>(box, coord);
0072 }
0073
0074 point_loop<Dimension + 1, DimensionCount>::apply(box, source);
0075 }
0076 };
0077
0078
0079 template <std::size_t DimensionCount>
0080 struct point_loop<DimensionCount, DimensionCount>
0081 {
0082 template <typename Box, typename Point>
0083 static inline void apply(Box&, Point const&) {}
0084 };
0085
0086
0087 }
0088 #endif
0089
0090
0091 struct cartesian_point
0092 {
0093 template <typename Box, typename Point>
0094 static void apply(Box & box, Point const& point)
0095 {
0096 expand::detail::point_loop
0097 <
0098 0, dimension<Point>::value
0099 >::apply(box, point);
0100 }
0101 };
0102
0103
0104 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0105
0106 namespace services
0107 {
0108
0109 template <typename CalculationType>
0110 struct default_strategy<point_tag, cartesian_tag, CalculationType>
0111 {
0112 typedef cartesian_point type;
0113 };
0114
0115
0116 }
0117
0118 #endif
0119
0120
0121 }}
0122
0123 }}
0124
0125 #endif