Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
0006 
0007 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0008 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0009 
0010 // Use, modification and distribution is subject to the Boost Software License,
0011 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0012 // http://www.boost.org/LICENSE_1_0.txt)
0013 
0014 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_CONVERT_POINT_TO_POINT_HPP
0015 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_CONVERT_POINT_TO_POINT_HPP
0016 
0017 // Note: extracted from "convert.hpp" to avoid circular references convert/append
0018 
0019 #include <cstddef>
0020 
0021 #include <boost/numeric/conversion/cast.hpp>
0022 #include <boost/geometry/core/access.hpp>
0023 #include <boost/geometry/core/coordinate_dimension.hpp>
0024 #include <boost/geometry/core/coordinate_type.hpp>
0025 
0026 
0027 namespace boost { namespace geometry
0028 {
0029 
0030 #ifndef DOXYGEN_NO_DETAIL
0031 namespace detail { namespace conversion
0032 {
0033 
0034 
0035 // TODO: Use assignment if possible.
0036 // WARNING: This utility is called in various places for a subset of dimensions.
0037 //   In such cases only some of the coordinates should be copied. Alternatively
0038 //   there should be a different utility for that called differently than
0039 //   convert_xxx, e.g. set_coordinates.
0040 
0041 template <typename Source, typename Destination, std::size_t Dimension, std::size_t DimensionCount>
0042 struct point_to_point
0043 {
0044     static inline void apply(Source const& source, Destination& destination)
0045     {
0046         typedef typename coordinate_type<Destination>::type coordinate_type;
0047 
0048         set<Dimension>(destination, boost::numeric_cast<coordinate_type>(get<Dimension>(source)));
0049         point_to_point<Source, Destination, Dimension + 1, DimensionCount>::apply(source, destination);
0050     }
0051 };
0052 
0053 template <typename Source, typename Destination, std::size_t DimensionCount>
0054 struct point_to_point<Source, Destination, DimensionCount, DimensionCount>
0055 {
0056     static inline void apply(Source const& , Destination& )
0057     {}
0058 };
0059 
0060 
0061 template <typename Source, typename Destination>
0062 inline void convert_point_to_point(Source const& source, Destination& destination)
0063 {
0064     point_to_point<Source, Destination, 0, dimension<Destination>::value>::apply(source, destination);
0065 }
0066 
0067 
0068 
0069 }} // namespace detail::conversion
0070 #endif // DOXYGEN_NO_DETAIL
0071 
0072 }} // namespace boost::geometry
0073 
0074 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_CONVERT_POINT_TO_POINT_HPP