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 // This file was modified by Oracle on 2021.
0008 // Modifications copyright (c) 2021, Oracle and/or its affiliates.
0009 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0010 
0011 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0012 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0013 
0014 // Use, modification and distribution is subject to the Boost Software License,
0015 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0016 // http://www.boost.org/LICENSE_1_0.txt)
0017 
0018 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_ASSIGN_INDEXED_POINT_HPP
0019 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ASSIGN_INDEXED_POINT_HPP
0020 
0021 
0022 #include <cstddef>
0023 
0024 #include <boost/numeric/conversion/cast.hpp>
0025 
0026 #include <boost/geometry/core/access.hpp>
0027 #include <boost/geometry/core/coordinate_type.hpp>
0028 #include <boost/geometry/geometries/concepts/check.hpp>
0029 #include <boost/geometry/util/algorithm.hpp>
0030 
0031 
0032 namespace boost { namespace geometry
0033 {
0034 
0035 #ifndef DOXYGEN_NO_DETAIL
0036 namespace detail
0037 {
0038 
0039 /*!
0040 \brief Assign a box or segment with the value of a point
0041 \ingroup assign
0042 \tparam Index indicates which box-corner, min_corner (0) or max_corner (1)
0043     or which point of segment (0/1)
0044 \tparam Point \tparam_point
0045 \tparam Geometry \tparam_box_or_segment
0046 \param point \param_point
0047 \param geometry \param_box_or_segment
0048 
0049 \qbk{
0050 [heading Example]
0051 [assign_point_to_index] [assign_point_to_index_output]
0052 }
0053 */
0054 template <std::size_t Index, typename Geometry, typename Point>
0055 inline void assign_point_to_index(Point const& point, Geometry& geometry)
0056 {
0057     concepts::check<Point const>();
0058     concepts::check<Geometry>();
0059 
0060     detail::for_each_dimension<Geometry>([&](auto dimension)
0061     {
0062         geometry::set<Index, dimension>(geometry,
0063             boost::numeric_cast
0064                 <
0065                     typename coordinate_type<Geometry>::type
0066                 >(geometry::get<dimension>(point)));
0067     });
0068 }
0069 
0070 
0071 /*!
0072 \brief Assign a point with a point of a box or segment
0073 \ingroup assign
0074 \tparam Index indicates which box-corner, min_corner (0) or max_corner (1)
0075     or which point of segment (0/1)
0076 \tparam Geometry \tparam_box_or_segment
0077 \tparam Point \tparam_point
0078 \param geometry \param_box_or_segment
0079 \param point \param_point
0080 
0081 \qbk{
0082 [heading Example]
0083 [assign_point_from_index] [assign_point_from_index_output]
0084 }
0085 */
0086 template <std::size_t Index, typename Point, typename Geometry>
0087 inline void assign_point_from_index(Geometry const& geometry, Point& point)
0088 {
0089     concepts::check<Geometry const>();
0090     concepts::check<Point>();
0091 
0092     detail::for_each_dimension<Geometry>([&](auto dimension)
0093     {
0094         geometry::set<dimension>(point,
0095             boost::numeric_cast
0096                 <
0097                     typename coordinate_type<Point>::type
0098                 >(geometry::get<Index, dimension>(geometry)));
0099     });
0100 }
0101 
0102 
0103 } // namespace detail
0104 #endif // DOXYGEN_NO_DETAIL
0105 
0106 
0107 }} // namespace boost::geometry
0108 
0109 
0110 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ASSIGN_INDEXED_POINT_HPP