File indexing completed on 2025-01-18 09:36:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef BOOST_GEOMETRY_STRATEGY_SPHERICAL_EXPAND_BOX_HPP
0020 #define BOOST_GEOMETRY_STRATEGY_SPHERICAL_EXPAND_BOX_HPP
0021
0022 #include <algorithm>
0023 #include <cstddef>
0024
0025 #include <boost/geometry/core/cs.hpp>
0026 #include <boost/geometry/core/coordinate_dimension.hpp>
0027 #include <boost/geometry/core/coordinate_system.hpp>
0028 #include <boost/geometry/core/tags.hpp>
0029
0030 #include <boost/geometry/algorithms/convert.hpp>
0031 #include <boost/geometry/algorithms/detail/convert_point_to_point.hpp>
0032 #include <boost/geometry/algorithms/detail/normalize.hpp>
0033 #include <boost/geometry/algorithms/detail/envelope/transform_units.hpp>
0034 #include <boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp>
0035 #include <boost/geometry/algorithms/dispatch/envelope.hpp>
0036
0037 #include <boost/geometry/geometries/helper_geometry.hpp>
0038
0039 #include <boost/geometry/strategy/expand.hpp>
0040
0041 #include <boost/geometry/views/detail/indexed_point_view.hpp>
0042
0043 namespace boost { namespace geometry
0044 {
0045
0046
0047 #ifndef DOXYGEN_NO_DETAIL
0048 namespace detail { namespace envelope
0049 {
0050
0051 template
0052 <
0053 std::size_t Index,
0054 std::size_t DimensionCount
0055 >
0056 struct envelope_indexed_box_on_spheroid
0057 {
0058 template <typename BoxIn, typename BoxOut>
0059 static inline void apply(BoxIn const& box_in, BoxOut& mbr)
0060 {
0061
0062
0063
0064 detail::indexed_point_view<BoxIn const, Index> box_in_corner(box_in);
0065 detail::indexed_point_view<BoxOut, Index> mbr_corner(mbr);
0066
0067
0068 transform_units(box_in_corner, mbr_corner);
0069
0070
0071 detail::conversion::point_to_point
0072 <
0073 detail::indexed_point_view<BoxIn const, Index>,
0074 detail::indexed_point_view<BoxOut, Index>,
0075 2,
0076 DimensionCount
0077 >::apply(box_in_corner, mbr_corner);
0078 }
0079 };
0080
0081 struct envelope_box_on_spheroid
0082 {
0083 template <typename BoxIn, typename BoxOut>
0084 static inline void apply(BoxIn const& box_in, BoxOut& mbr)
0085 {
0086
0087 typename helper_geometry<BoxIn>::type box_in_normalized;
0088 geometry::convert(box_in, box_in_normalized);
0089
0090 if (! is_inverse_spheroidal_coordinates(box_in))
0091 {
0092 strategy::normalize::spherical_box::apply(box_in, box_in_normalized);
0093 }
0094
0095 geometry::detail::envelope::envelope_indexed_box_on_spheroid
0096 <
0097 min_corner, dimension<BoxIn>::value
0098 >::apply(box_in_normalized, mbr);
0099
0100 geometry::detail::envelope::envelope_indexed_box_on_spheroid
0101 <
0102 max_corner, dimension<BoxIn>::value
0103 >::apply(box_in_normalized, mbr);
0104 }
0105 };
0106
0107 }}
0108 #endif
0109
0110
0111 namespace strategy { namespace expand
0112 {
0113
0114 #ifndef DOXYGEN_NO_DETAIL
0115 namespace detail
0116 {
0117
0118 struct box_on_spheroid
0119 {
0120 template <typename BoxOut, typename BoxIn>
0121 static inline void apply(BoxOut& box_out, BoxIn const& box_in)
0122 {
0123
0124 BoxOut mbrs[2];
0125 geometry::detail::envelope::envelope_box_on_spheroid::apply(box_in, mbrs[0]);
0126 geometry::detail::envelope::envelope_box_on_spheroid::apply(box_out, mbrs[1]);
0127
0128
0129 geometry::detail::envelope::envelope_range_of_boxes::apply(mbrs, box_out);
0130 }
0131 };
0132
0133
0134 }
0135 #endif
0136
0137
0138 struct spherical_box
0139 : detail::box_on_spheroid
0140 {};
0141
0142
0143 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0144
0145 namespace services
0146 {
0147
0148 template <typename CalculationType>
0149 struct default_strategy<box_tag, spherical_equatorial_tag, CalculationType>
0150 {
0151 typedef spherical_box type;
0152 };
0153
0154 template <typename CalculationType>
0155 struct default_strategy<box_tag, spherical_polar_tag, CalculationType>
0156 {
0157 typedef spherical_box type;
0158 };
0159
0160 template <typename CalculationType>
0161 struct default_strategy<box_tag, geographic_tag, CalculationType>
0162 {
0163 typedef spherical_box type;
0164 };
0165
0166 }
0167
0168 #endif
0169
0170
0171 }}
0172
0173 }}
0174
0175 #endif