// 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>
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
: 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(...) {}
}
}
+ 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(); }
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
: 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(...) {}
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(); }