File indexing completed on 2025-01-18 09:36:45
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_GEOMETRY_STRATEGIES_ENVELOPE_GEOGRAPHIC_HPP
0011 #define BOOST_GEOMETRY_STRATEGIES_ENVELOPE_GEOGRAPHIC_HPP
0012
0013
0014 #include <type_traits>
0015
0016 #include <boost/geometry/strategy/geographic/envelope.hpp> // Not used, for backward compatibility
0017 #include <boost/geometry/strategy/geographic/envelope_range.hpp>
0018 #include <boost/geometry/strategy/geographic/envelope_segment.hpp>
0019
0020 #include <boost/geometry/strategies/envelope/spherical.hpp>
0021 #include <boost/geometry/strategies/expand/geographic.hpp>
0022
0023
0024 namespace boost { namespace geometry
0025 {
0026
0027 namespace strategies { namespace envelope
0028 {
0029
0030 template
0031 <
0032 typename FormulaPolicy = strategy::andoyer,
0033 typename Spheroid = srs::spheroid<double>,
0034 typename CalculationType = void
0035 >
0036 class geographic
0037 : public strategies::expand::geographic<FormulaPolicy, Spheroid, CalculationType>
0038 {
0039 using base_t = strategies::expand::geographic<FormulaPolicy, Spheroid, CalculationType>;
0040
0041 public:
0042 geographic() = default;
0043
0044 explicit geographic(Spheroid const& spheroid)
0045 : base_t(spheroid)
0046 {}
0047
0048 template <typename Geometry, typename Box>
0049 static auto envelope(Geometry const&, Box const&,
0050 util::enable_if_point_t<Geometry> * = nullptr)
0051 {
0052 return strategy::envelope::spherical_point();
0053 }
0054
0055 template <typename Geometry, typename Box>
0056 static auto envelope(Geometry const&, Box const&,
0057 util::enable_if_multi_point_t<Geometry> * = nullptr)
0058 {
0059 return strategy::envelope::spherical_multipoint();
0060 }
0061
0062 template <typename Geometry, typename Box>
0063 static auto envelope(Geometry const&, Box const&,
0064 util::enable_if_box_t<Geometry> * = nullptr)
0065 {
0066 return strategy::envelope::spherical_box();
0067 }
0068
0069 template <typename Geometry, typename Box>
0070 auto envelope(Geometry const&, Box const&,
0071 util::enable_if_segment_t<Geometry> * = nullptr) const
0072 {
0073 return strategy::envelope::geographic_segment
0074 <
0075 FormulaPolicy, Spheroid, CalculationType
0076 >(base_t::m_spheroid);
0077 }
0078
0079 template <typename Geometry, typename Box>
0080 auto envelope(Geometry const&, Box const&,
0081 util::enable_if_linestring_t<Geometry> * = nullptr) const
0082 {
0083 return strategy::envelope::geographic_linestring
0084 <
0085 FormulaPolicy, Spheroid, CalculationType
0086 >(base_t::m_spheroid);
0087 }
0088
0089 template <typename Geometry, typename Box>
0090 auto envelope(Geometry const&, Box const&,
0091 std::enable_if_t
0092 <
0093 util::is_ring<Geometry>::value
0094 || util::is_polygon<Geometry>::value
0095 > * = nullptr) const
0096 {
0097 return strategy::envelope::geographic_ring
0098 <
0099 FormulaPolicy, Spheroid, CalculationType
0100 >(base_t::m_spheroid);
0101 }
0102
0103 template <typename Geometry, typename Box>
0104 auto envelope(Geometry const&, Box const&,
0105 std::enable_if_t
0106 <
0107 util::is_multi_linestring<Geometry>::value
0108 || util::is_multi_polygon<Geometry>::value
0109 || util::is_geometry_collection<Geometry>::value
0110 > * = nullptr) const
0111 {
0112 return strategy::envelope::spherical_boxes();
0113 }
0114 };
0115
0116
0117 namespace services
0118 {
0119
0120 template <typename Geometry, typename Box>
0121 struct default_strategy<Geometry, Box, geographic_tag>
0122 {
0123 using type = strategies::envelope::geographic<>;
0124 };
0125
0126
0127 template <typename FP, typename S, typename CT>
0128 struct strategy_converter<strategy::envelope::geographic_segment<FP, S, CT> >
0129 {
0130 static auto get(strategy::envelope::geographic_segment<FP, S, CT> const& s)
0131 {
0132 return strategies::envelope::geographic<FP, S, CT>(s.model());
0133 }
0134 };
0135
0136 template <typename FP, typename S, typename CT>
0137 struct strategy_converter<strategy::envelope::geographic<FP, S, CT> >
0138 {
0139 static auto get(strategy::envelope::geographic<FP, S, CT> const& s)
0140 {
0141 return strategies::envelope::geographic<FP, S, CT>(s.model());
0142 }
0143 };
0144
0145 }
0146
0147 }}
0148
0149 }}
0150
0151 #endif