]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/geometry/strategies/spherical/distance_cross_track.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / geometry / strategies / spherical / distance_cross_track.hpp
index db029dff909cf824981cb8509595de4fab9d2096..439de0d03cf36cddca60cb2eab24fcfaa66f4bc7 100644 (file)
@@ -2,11 +2,12 @@
 
 // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
 
-// This file was modified by Oracle on 2014-2017.
-// Modifications copyright (c) 2014-2017, Oracle and/or its affiliates.
+// This file was modified by Oracle on 2014-2019.
+// Modifications copyright (c) 2014-2019, Oracle and/or its affiliates.
 
 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
 
 // Use, modification and distribution is subject to the Boost Software License,
 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 #include <boost/geometry/core/radian_access.hpp>
 #include <boost/geometry/core/tags.hpp>
 
+#include <boost/geometry/formulas/spherical.hpp>
+
 #include <boost/geometry/strategies/distance.hpp>
 #include <boost/geometry/strategies/concepts/distance_concept.hpp>
 #include <boost/geometry/strategies/spherical/distance_haversine.hpp>
+#include <boost/geometry/strategies/spherical/point_in_point.hpp>
+#include <boost/geometry/strategies/spherical/intersection.hpp>
 
 #include <boost/geometry/util/math.hpp>
 #include <boost/geometry/util/promote_floating_point.hpp>
@@ -326,6 +331,28 @@ template
 class cross_track
 {
 public :
+    typedef within::spherical_point_point equals_point_point_strategy_type;
+
+    typedef intersection::spherical_segments
+        <
+            CalculationType
+        > relate_segment_segment_strategy_type;
+
+    static inline relate_segment_segment_strategy_type get_relate_segment_segment_strategy()
+    {
+        return relate_segment_segment_strategy_type();
+    }
+
+    typedef within::spherical_winding
+        <
+            void, void, CalculationType
+        > point_in_geometry_strategy_type;
+
+    static inline point_in_geometry_strategy_type get_point_in_geometry_strategy()
+    {
+        return point_in_geometry_strategy_type();
+    }
+
     template <typename Point, typename PointOfSegment>
     struct return_type
         : promote_floating_point
@@ -352,12 +379,6 @@ public :
         : m_strategy(s)
     {}
 
-    //TODO: apply a more general strategy getter
-    inline Strategy get_distance_strategy() const
-    {
-        return m_strategy;
-    }
-
     // It might be useful in the future
     // to overload constructor with strategy info.
     // crosstrack(...) {}
@@ -473,6 +494,12 @@ public :
         }
     }
 
+    template <typename T1, typename T2>
+    inline radius_type vertical_or_meridian(T1 lat1, T2 lat2) const
+    {
+        return m_strategy.radius() * (lat1 - lat2);
+    }
+
     inline typename Strategy::radius_type radius() const
     { return m_strategy.radius(); }
 
@@ -505,6 +532,28 @@ template
 class cross_track
 {
 public :
+    typedef within::spherical_point_point equals_point_point_strategy_type;
+
+    typedef intersection::spherical_segments
+        <
+            CalculationType
+        > relate_segment_segment_strategy_type;
+
+    static inline relate_segment_segment_strategy_type get_relate_segment_segment_strategy()
+    {
+        return relate_segment_segment_strategy_type();
+    }
+
+    typedef within::spherical_winding
+        <
+            void, void, CalculationType
+        > point_in_geometry_strategy_type;
+
+    static inline point_in_geometry_strategy_type get_point_in_geometry_strategy()
+    {
+        return point_in_geometry_strategy_type();
+    }
+
     template <typename Point, typename PointOfSegment>
     struct return_type
         : promote_floating_point
@@ -531,12 +580,6 @@ public :
         : m_strategy(s)
     {}
 
-    //TODO: apply a more general strategy getter
-    inline Strategy get_distance_strategy() const
-    {
-        return m_strategy;
-    }
-
     // It might be useful in the future
     // to overload constructor with strategy info.
     // crosstrack(...) {}
@@ -569,6 +612,12 @@ public :
         return c * radius();
     }
 
+    template <typename T1, typename T2>
+    inline radius_type vertical_or_meridian(T1 lat1, T2 lat2) const
+    {
+        return m_strategy.radius() * (lat1 - lat2);
+    }
+
     inline typename Strategy::radius_type radius() const
     { return m_strategy.radius(); }