File indexing completed on 2025-07-01 08:16:32
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/util/is_inverse_spheroidal_coordinates.hpp>
0042
0043 #include <boost/geometry/views/detail/indexed_point_view.hpp>
0044
0045 namespace boost { namespace geometry
0046 {
0047
0048
0049 #ifndef DOXYGEN_NO_DETAIL
0050 namespace detail { namespace envelope
0051 {
0052
0053 template
0054 <
0055 std::size_t Index,
0056 std::size_t DimensionCount
0057 >
0058 struct envelope_indexed_box_on_spheroid
0059 {
0060 template <typename BoxIn, typename BoxOut>
0061 static inline void apply(BoxIn const& box_in, BoxOut& mbr)
0062 {
0063
0064
0065
0066 detail::indexed_point_view<BoxIn const, Index> box_in_corner(box_in);
0067 detail::indexed_point_view<BoxOut, Index> mbr_corner(mbr);
0068
0069
0070 transform_units(box_in_corner, mbr_corner);
0071
0072
0073 detail::conversion::point_to_point
0074 <
0075 detail::indexed_point_view<BoxIn const, Index>,
0076 detail::indexed_point_view<BoxOut, Index>,
0077 2,
0078 DimensionCount
0079 >::apply(box_in_corner, mbr_corner);
0080 }
0081 };
0082
0083 struct envelope_box_on_spheroid
0084 {
0085 template <typename BoxIn, typename BoxOut>
0086 static inline void apply(BoxIn const& box_in, BoxOut& mbr)
0087 {
0088
0089 typename helper_geometry<BoxIn>::type box_in_normalized;
0090 geometry::convert(box_in, box_in_normalized);
0091
0092 if (! is_inverse_spheroidal_coordinates(box_in))
0093 {
0094 strategy::normalize::spherical_box::apply(box_in, box_in_normalized);
0095 }
0096
0097 geometry::detail::envelope::envelope_indexed_box_on_spheroid
0098 <
0099 min_corner, dimension<BoxIn>::value
0100 >::apply(box_in_normalized, mbr);
0101
0102 geometry::detail::envelope::envelope_indexed_box_on_spheroid
0103 <
0104 max_corner, dimension<BoxIn>::value
0105 >::apply(box_in_normalized, mbr);
0106 }
0107 };
0108
0109 }}
0110 #endif
0111
0112
0113 namespace strategy { namespace expand
0114 {
0115
0116 #ifndef DOXYGEN_NO_DETAIL
0117 namespace detail
0118 {
0119
0120 struct box_on_spheroid
0121 {
0122 template <typename BoxOut, typename BoxIn>
0123 static inline void apply(BoxOut& box_out, BoxIn const& box_in)
0124 {
0125
0126 BoxOut mbrs[2];
0127 geometry::detail::envelope::envelope_box_on_spheroid::apply(box_in, mbrs[0]);
0128 geometry::detail::envelope::envelope_box_on_spheroid::apply(box_out, mbrs[1]);
0129
0130
0131 geometry::detail::envelope::envelope_range_of_boxes::apply(mbrs, box_out);
0132 }
0133 };
0134
0135
0136 }
0137 #endif
0138
0139
0140 struct spherical_box
0141 : detail::box_on_spheroid
0142 {};
0143
0144
0145 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0146
0147 namespace services
0148 {
0149
0150 template <typename CalculationType>
0151 struct default_strategy<box_tag, spherical_equatorial_tag, CalculationType>
0152 {
0153 typedef spherical_box type;
0154 };
0155
0156 template <typename CalculationType>
0157 struct default_strategy<box_tag, spherical_polar_tag, CalculationType>
0158 {
0159 typedef spherical_box type;
0160 };
0161
0162 template <typename CalculationType>
0163 struct default_strategy<box_tag, geographic_tag, CalculationType>
0164 {
0165 typedef spherical_box type;
0166 };
0167
0168 }
0169
0170 #endif
0171
0172
0173 }}
0174
0175 }}
0176
0177 #endif