Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:05

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2015, Oracle and/or its affiliates.
0004 
0005 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
0006 
0007 // Distributed under the Boost Software License, Version 1.0.
0008 // (See accompanying file LICENSE_1_0.txt or copy at
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 
0011 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_TRANSFORM_UNITS_HPP
0012 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_TRANSFORM_UNITS_HPP
0013 
0014 #include <cstddef>
0015 
0016 #include <boost/geometry/core/tag.hpp>
0017 #include <boost/geometry/core/tags.hpp>
0018 
0019 #include <boost/geometry/strategies/strategy_transform.hpp>
0020 
0021 #include <boost/geometry/views/detail/indexed_point_view.hpp>
0022 #include <boost/geometry/views/detail/two_dimensional_view.hpp>
0023 
0024 #include <boost/geometry/algorithms/not_implemented.hpp>
0025 #include <boost/geometry/algorithms/transform.hpp>
0026 
0027 
0028 namespace boost { namespace geometry
0029 {
0030 
0031 #ifndef DOXYGEN_NO_DETAIL
0032 namespace detail { namespace envelope
0033 {
0034 
0035 
0036 template
0037 <
0038     typename GeometryIn,
0039     typename GeometryOut,
0040     typename TagIn = typename tag<GeometryIn>::type,
0041     typename TagOut = typename tag<GeometryOut>::type
0042 >
0043 struct transform_units_impl
0044     : not_implemented<TagIn, TagOut>
0045 {};
0046 
0047 template <typename PointIn, typename PointOut>
0048 struct transform_units_impl<PointIn, PointOut, point_tag, point_tag>
0049 {
0050     static inline void apply(PointIn const& point_in, PointOut& point_out)
0051     {
0052         detail::two_dimensional_view<PointIn const> view_in(point_in);
0053         detail::two_dimensional_view<PointOut> view_out(point_out);
0054 
0055         geometry::transform(view_in, view_out);
0056     }
0057 };
0058 
0059 template <typename BoxIn, typename BoxOut>
0060 struct transform_units_impl<BoxIn, BoxOut, box_tag, box_tag>
0061 {
0062     template <std::size_t Index>
0063     static inline void apply(BoxIn const& box_in, BoxOut& box_out)
0064     {
0065         typedef detail::indexed_point_view<BoxIn const, Index> view_in_type;
0066         typedef detail::indexed_point_view<BoxOut, Index> view_out_type;
0067 
0068         view_in_type view_in(box_in);
0069         view_out_type view_out(box_out);
0070 
0071         transform_units_impl
0072             <
0073                 view_in_type, view_out_type
0074             >::apply(view_in, view_out);
0075     }
0076 
0077     static inline void apply(BoxIn const& box_in, BoxOut& box_out)
0078     {
0079         apply<min_corner>(box_in, box_out);
0080         apply<max_corner>(box_in, box_out);
0081     }
0082 };
0083 
0084 
0085 // Short utility to transform the units of the first two coordinates of
0086 // geometry_in to the units of geometry_out
0087 template <typename GeometryIn, typename GeometryOut>
0088 inline void transform_units(GeometryIn const& geometry_in,
0089                             GeometryOut& geometry_out)
0090 {
0091     transform_units_impl
0092         <
0093             GeometryIn, GeometryOut
0094         >::apply(geometry_in, geometry_out);
0095 }
0096 
0097 
0098 }} // namespace detail::envelope
0099 #endif // DOXYGEN_NO_DETAIL
0100 
0101 }} // namespace boost:geometry
0102 
0103 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_TRANSFORM_UNITS_HPP