3 // Copyright (c) 2017 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/strategies/disjoint.hpp>
33 #include <boost/geometry/strategies/geographic/azimuth.hpp>
34 #include <boost/geometry/strategies/geographic/parameters.hpp>
37 namespace boost { namespace geometry { namespace strategy { namespace disjoint
40 // NOTE: This may be temporary place for this or corresponding strategy
41 // It seems to be more appropriate to implement the opposite of it
42 // e.g. intersection::segment_box because in disjoint() algorithm
43 // other strategies that are used are intersection and covered_by strategies.
46 typename FormulaPolicy = strategy::andoyer,
47 typename Spheroid = srs::spheroid<double>,
48 typename CalculationType = void
50 struct segment_box_geographic
53 typedef Spheroid model_type;
55 inline segment_box_geographic()
59 explicit inline segment_box_geographic(Spheroid const& spheroid)
60 : m_spheroid(spheroid)
63 template <typename Segment, typename Box>
64 struct point_in_geometry_strategy
65 : services::default_strategy
67 typename point_type<Segment>::type,
72 template <typename Segment, typename Box>
73 static inline typename point_in_geometry_strategy<Segment, Box>::type
74 get_point_in_geometry_strategy()
76 typedef typename point_in_geometry_strategy<Segment, Box>::type strategy_type;
78 return strategy_type();
81 template <typename Segment, typename Box>
82 inline bool apply(Segment const& segment, Box const& box) const
84 geometry::strategy::azimuth::geographic
89 > azimuth_geographic(m_spheroid);
91 return geometry::detail::disjoint::disjoint_segment_box_sphere_or_spheroid
92 <geographic_tag>::apply(segment, box, azimuth_geographic);
100 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
106 template <typename Linear, typename Box, typename LinearTag>
107 struct default_strategy<Linear, Box, LinearTag, box_tag, 1, 2,
108 geographic_tag, geographic_tag>
110 typedef segment_box_geographic<> type;
113 template <typename Box, typename Linear, typename LinearTag>
114 struct default_strategy<Box, Linear, box_tag, LinearTag, 2, 1,
115 geographic_tag, geographic_tag>
117 typedef segment_box_geographic<> type;
121 } // namespace services
124 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
127 }}}} // namespace boost::geometry::strategy::disjoint
130 #endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_DISJOINT_SEGMENT_BOX_HPP