/usr/include/boost/geometry/strategies/geographic
Edit: /usr/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp (7147B)
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2017-2018, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, 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
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_DISTANCE_CROSS_TRACK_BOX_BOX_HPP
#define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_DISTANCE_CROSS_TRACK_BOX_BOX_HPP
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace boost { namespace geometry
{
namespace strategy { namespace distance
{
/*!
\brief Strategy functor for distance point to box calculation
\ingroup strategies
\details Class which calculates the distance of a point to a box, for
points and boxes on a sphere or globe
\tparam CalculationType \tparam_calculation
\tparam Strategy underlying point-segment distance strategy, defaults
to cross track
\qbk{
[heading See also]
[link geometry.reference.algorithms.distance.distance_3_with_strategy distance (with strategy)]
}
*/
template
<
typename FormulaPolicy = strategy::andoyer,
typename Spheroid = srs::spheroid,
typename CalculationType = void
>
class geographic_cross_track_box_box
{
public:
// point-point strategy getters
struct distance_pp_strategy
{
typedef geographic type;
};
// point-segment strategy getters
struct distance_ps_strategy
{
typedef geographic_cross_track
<
FormulaPolicy,
Spheroid,
CalculationType
> type;
};
template
struct return_type : services::return_type
<
typename distance_ps_strategy::type,
typename point_type::type,
typename point_type::type
>
{};
//constructor
explicit geographic_cross_track_box_box(Spheroid const& spheroid = Spheroid())
: m_spheroid(spheroid)
{}
template
inline typename return_type::type
apply(Box1 const& box1, Box2 const& box2) const
{
/*
#if !defined(BOOST_MSVC)
BOOST_CONCEPT_ASSERT
(
(concepts::PointSegmentDistanceStrategy
<
Strategy,
typename point_type::type,
typename point_type::type
>)
);
#endif
*/
typedef typename return_type::type return_type;
return details::cross_track_box_box_generic
::apply(box1, box2,
typename distance_pp_strategy::type(m_spheroid),
typename distance_ps_strategy::type(m_spheroid));
}
private :
Spheroid m_spheroid;
};
#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
namespace services
{
template
struct tag >
{
typedef strategy_tag_distance_box_box type;
};
template
struct return_type, Box1, Box2>
: geographic_cross_track_box_box
<
Strategy, Spheroid, CalculationType
>::template return_type
{};
template
struct return_type, Box1, Box2>
: geographic_cross_track_box_box
<
Strategy, Spheroid
>::template return_type
{};
template
struct return_type, Box1, Box2>
: geographic_cross_track_box_box
<
Strategy
>::template return_type
{};
template
struct comparable_type >
{
typedef geographic_cross_track_box_box
<
typename comparable_type::type, Spheroid, CalculationType
> type;
};
template
struct get_comparable >
{
public:
static inline geographic_cross_track_box_box
apply(geographic_cross_track_box_box const& str)
{
return str;
}
};
template
struct result_from_distance
<
geographic_cross_track_box_box, Box1, Box2
>
{
private:
typedef geographic_cross_track_box_box this_strategy;
typedef typename this_strategy::template return_type
<
Box1, Box2
>::type return_type;
public:
template
static inline return_type apply(this_strategy const& strategy,
T const& distance)
{
result_from_distance
<
Strategy,
typename point_type::type,
typename point_type::type
>::apply(strategy, distance);
}
};
template
struct default_strategy
<
box_tag, box_tag, Box1, Box2,
geographic_tag, geographic_tag
>
{
typedef geographic_cross_track_box_box<> type;
};
} // namespace services
#endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
}} // namespace strategy::distance
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_DISTANCE_CROSS_TRACK_BOX_BOX_HPP