3 // Copyright (c) 2017-2019 Oracle and/or its affiliates.
5 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
6 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
8 // Use, modification and distribution is subject to the Boost Software License,
9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
12 #ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_DISJOINT_SEGMENT_BOX_HPP
13 #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_DISJOINT_SEGMENT_BOX_HPP
19 #include <boost/numeric/conversion/cast.hpp>
21 #include <boost/geometry/util/math.hpp>
22 #include <boost/geometry/util/calculation_type.hpp>
24 #include <boost/geometry/core/access.hpp>
25 #include <boost/geometry/core/tags.hpp>
26 #include <boost/geometry/core/coordinate_dimension.hpp>
27 #include <boost/geometry/core/point_type.hpp>
29 #include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
30 #include <boost/geometry/algorithms/detail/disjoint/segment_box.hpp>
32 #include <boost/geometry/srs/spheroid.hpp>
34 // TODO: spherical_point_box currently defined in the same file as cartesian
35 #include <boost/geometry/strategies/cartesian/point_in_box.hpp>
36 #include <boost/geometry/strategies/disjoint.hpp>
37 #include <boost/geometry/strategies/geographic/azimuth.hpp>
38 #include <boost/geometry/strategies/geographic/parameters.hpp>
39 #include <boost/geometry/strategies/normalize.hpp>
40 #include <boost/geometry/strategies/spherical/disjoint_box_box.hpp>
43 namespace boost { namespace geometry { namespace strategy { namespace disjoint
46 // NOTE: This may be temporary place for this or corresponding strategy
47 // It seems to be more appropriate to implement the opposite of it
48 // e.g. intersection::segment_box because in disjoint() algorithm
49 // other strategies that are used are intersection and covered_by strategies.
52 typename FormulaPolicy = strategy::andoyer,
53 typename Spheroid = srs::spheroid<double>,
54 typename CalculationType = void
56 struct segment_box_geographic
59 typedef Spheroid model_type;
61 inline segment_box_geographic()
65 explicit inline segment_box_geographic(Spheroid const& spheroid)
66 : m_spheroid(spheroid)
69 typedef covered_by::spherical_point_box disjoint_point_box_strategy_type;
71 static inline disjoint_point_box_strategy_type get_disjoint_point_box_strategy()
73 return disjoint_point_box_strategy_type();
76 template <typename Segment, typename Box>
77 inline bool apply(Segment const& segment, Box const& box) const
79 geometry::strategy::azimuth::geographic
84 > azimuth_geographic(m_spheroid);
86 return geometry::detail::disjoint::disjoint_segment_box_sphere_or_spheroid
89 >::apply(segment, box,
91 strategy::normalize::spherical_point(),
92 strategy::covered_by::spherical_point_box(),
93 strategy::disjoint::spherical_box_box());
96 Spheroid const& model() const
106 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
112 template <typename Linear, typename Box, typename LinearTag>
113 struct default_strategy<Linear, Box, LinearTag, box_tag, 1, 2,
114 geographic_tag, geographic_tag>
116 typedef segment_box_geographic<> type;
119 template <typename Box, typename Linear, typename LinearTag>
120 struct default_strategy<Box, Linear, box_tag, LinearTag, 2, 1,
121 geographic_tag, geographic_tag>
123 typedef segment_box_geographic<> type;
127 } // namespace services
130 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
133 }}}} // namespace boost::geometry::strategy::disjoint
136 #endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_DISJOINT_SEGMENT_BOX_HPP