assign_indexed_point.hpp 2.6 KB

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