1 | // Boost.Geometry (aka GGL, Generic Geometry Library) |
2 | |
3 | // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. |
4 | // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. |
5 | // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. |
6 | |
7 | // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library |
8 | // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. |
9 | |
10 | // Use, modification and distribution is subject to the Boost Software License, |
11 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
12 | // http://www.boost.org/LICENSE_1_0.txt) |
13 | |
14 | #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_ASSIGN_INDEXED_POINT_HPP |
15 | #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ASSIGN_INDEXED_POINT_HPP |
16 | |
17 | |
18 | #include <cstddef> |
19 | |
20 | #include <boost/geometry/geometries/concepts/check.hpp> |
21 | #include <boost/geometry/algorithms/detail/assign_values.hpp> |
22 | |
23 | |
24 | namespace boost { namespace geometry |
25 | { |
26 | |
27 | #ifndef DOXYGEN_NO_DETAIL |
28 | namespace detail |
29 | { |
30 | |
31 | /*! |
32 | \brief Assign a box or segment with the value of a point |
33 | \ingroup assign |
34 | \tparam Index indicates which box-corner, min_corner (0) or max_corner (1) |
35 | or which point of segment (0/1) |
36 | \tparam Point \tparam_point |
37 | \tparam Geometry \tparam_box_or_segment |
38 | \param point \param_point |
39 | \param geometry \param_box_or_segment |
40 | |
41 | \qbk{ |
42 | [heading Example] |
43 | [assign_point_to_index] [assign_point_to_index_output] |
44 | } |
45 | */ |
46 | template <std::size_t Index, typename Geometry, typename Point> |
47 | inline void assign_point_to_index(Point const& point, Geometry& geometry) |
48 | { |
49 | concept::check<Point const>(); |
50 | concept::check<Geometry>(); |
51 | |
52 | detail::assign::assign_point_to_index |
53 | < |
54 | Geometry, Point, Index, 0, dimension<Geometry>::type::value |
55 | >::apply(point, geometry); |
56 | } |
57 | |
58 | |
59 | /*! |
60 | \brief Assign a point with a point of a box or segment |
61 | \ingroup assign |
62 | \tparam Index indicates which box-corner, min_corner (0) or max_corner (1) |
63 | or which point of segment (0/1) |
64 | \tparam Geometry \tparam_box_or_segment |
65 | \tparam Point \tparam_point |
66 | \param geometry \param_box_or_segment |
67 | \param point \param_point |
68 | |
69 | \qbk{ |
70 | [heading Example] |
71 | [assign_point_from_index] [assign_point_from_index_output] |
72 | } |
73 | */ |
74 | template <std::size_t Index, typename Point, typename Geometry> |
75 | inline void assign_point_from_index(Geometry const& geometry, Point& point) |
76 | { |
77 | concept::check<Geometry const>(); |
78 | concept::check<Point>(); |
79 | |
80 | detail::assign::assign_point_from_index |
81 | < |
82 | Geometry, Point, Index, 0, dimension<Geometry>::type::value |
83 | >::apply(geometry, point); |
84 | } |
85 | |
86 | |
87 | } // namespace detail |
88 | #endif // DOXYGEN_NO_DETAIL |
89 | |
90 | |
91 | }} // namespace boost::geometry |
92 | |
93 | |
94 | #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ASSIGN_INDEXED_POINT_HPP |
95 | |