/usr/include/boost/geometry/strategies
Edit: /usr/include/boost/geometry/strategies/normalize.hpp (8399B)
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2015-2018, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
#ifndef BOOST_GEOMETRY_STRATEGIES_NORMALIZE_HPP
#define BOOST_GEOMETRY_STRATEGIES_NORMALIZE_HPP
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace boost { namespace geometry
{
namespace strategy { namespace normalize
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
struct do_nothing
{
template
static inline void apply(GeometryIn const&, GeometryOut&)
{
}
};
template
struct assign_loop
{
template
static inline void apply(CoordinateType const& longitude,
CoordinateType const& latitude,
PointIn const& point_in,
PointOut& point_out)
{
geometry::set(point_out, boost::numeric_cast
<
typename coordinate_type::type
>(geometry::get(point_in)));
assign_loop
<
Dimension + 1, DimensionCount
>::apply(longitude, latitude, point_in, point_out);
}
};
template
struct assign_loop
{
template
static inline void apply(CoordinateType const&,
CoordinateType const&,
PointIn const&,
PointOut&)
{
}
};
template
struct assign_loop<0, DimensionCount>
{
template
static inline void apply(CoordinateType const& longitude,
CoordinateType const& latitude,
PointIn const& point_in,
PointOut& point_out)
{
geometry::set<0>(point_out, boost::numeric_cast
<
typename coordinate_type::type
>(longitude));
assign_loop
<
1, DimensionCount
>::apply(longitude, latitude, point_in, point_out);
}
};
template
struct assign_loop<1, DimensionCount>
{
template
static inline void apply(CoordinateType const& longitude,
CoordinateType const& latitude,
PointIn const& point_in,
PointOut& point_out)
{
geometry::set<1>(point_out, boost::numeric_cast
<
typename coordinate_type::type
>(latitude));
assign_loop
<
2, DimensionCount
>::apply(longitude, latitude, point_in, point_out);
}
};
template
struct normalize_point
{
static inline void apply(PointIn const& point_in, PointOut& point_out)
{
typedef typename coordinate_type::type in_coordinate_type;
in_coordinate_type longitude = geometry::get<0>(point_in);
in_coordinate_type latitude = geometry::get<1>(point_in);
math::normalize_spheroidal_coordinates
<
typename geometry::detail::cs_angular_units::type,
IsEquatorial,
in_coordinate_type
>(longitude, latitude);
assign_loop
<
0, dimension::value
>::apply(longitude, latitude, point_in, point_out);
}
};
template
class normalize_box
{
template
static inline void apply_to_coordinates(CoordinateInType& lon_min,
CoordinateInType& lat_min,
CoordinateInType& lon_max,
CoordinateInType& lat_max,
BoxIn const& box_in,
BoxOut& box_out)
{
geometry::detail::indexed_point_view p_min_out(box_out);
assign_loop
<
0, dimension::value
>::apply(lon_min,
lat_min,
geometry::detail::indexed_point_view
<
BoxIn const, min_corner
>(box_in),
p_min_out);
geometry::detail::indexed_point_view p_max_out(box_out);
assign_loop
<
0, dimension::value
>::apply(lon_max,
lat_max,
geometry::detail::indexed_point_view
<
BoxIn const, max_corner
>(box_in),
p_max_out);
}
public:
static inline void apply(BoxIn const& box_in, BoxOut& box_out)
{
typedef typename coordinate_type::type in_coordinate_type;
in_coordinate_type lon_min = geometry::get(box_in);
in_coordinate_type lat_min = geometry::get(box_in);
in_coordinate_type lon_max = geometry::get(box_in);
in_coordinate_type lat_max = geometry::get(box_in);
math::normalize_spheroidal_box_coordinates
<
typename geometry::detail::cs_angular_units::type,
IsEquatorial,
in_coordinate_type
>(lon_min, lat_min, lon_max, lat_max);
apply_to_coordinates
<
typename geometry::detail::cs_angular_units::type,
typename geometry::detail::cs_angular_units::type
>(lon_min, lat_min, lon_max, lat_max, box_in, box_out);
}
};
} // namespace detail
#endif // DOXYGEN_NO_DETAIL
struct cartesian_point
: detail::do_nothing
{};
struct cartesian_box
: detail::do_nothing
{};
struct spherical_point
{
template
static inline void apply(PointIn const& point_in, PointOut& point_out)
{
detail::normalize_point
<
PointIn, PointOut,
boost::mpl::not_
<
boost::is_same
<
typename cs_tag::type,
spherical_polar_tag
>
>::value
>::apply(point_in, point_out);
}
};
struct spherical_box
{
template
static inline void apply(BoxIn const& box_in, BoxOut& box_out)
{
detail::normalize_box
<
BoxIn, BoxOut,
boost::mpl::not_
<
boost::is_same
<
typename cs_tag::type,
spherical_polar_tag
>
>::value
>::apply(box_in, box_out);
}
};
}} // namespace strategy::normalize
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_STRATEGIES_NORMALIZE_HPP