// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2011 Bruno Lalande, Paris, France. // Copyright (c) 2009-2011 Mateusz Loskot, London, UK. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GEOMETRY_ALGORITHMS_ASSIGN_HPP #define BOOST_GEOMETRY_ALGORITHMS_ASSIGN_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace geometry { /*! \brief Assign a range of points to a linestring, ring or polygon \note The point-type of the range might be different from the point-type of the geometry \ingroup assign \tparam Geometry \tparam_geometry \tparam Range \tparam_range_point \param geometry \param_geometry \param range \param_range_point \qbk{ [heading Notes] [note Assign automatically clears the geometry before assigning (use append if you don't want that)] [heading Example] [assign_points] [assign_points_output] [heading See also] \* [link geometry.reference.algorithms.append append] } */ template inline void assign_points(Geometry& geometry, Range const& range) { concept::check(); clear(geometry); geometry::append(geometry, range, -1, 0); } /*! \brief assign to a box inverse infinite \details The assign_inverse function initialize a 2D or 3D box with large coordinates, the min corner is very large, the max corner is very small. This is a convenient starting point to collect the minimum bounding box of a geometry. \ingroup assign \tparam Geometry \tparam_geometry \param geometry \param_geometry \qbk{ [heading Example] [assign_inverse] [assign_inverse_output] [heading See also] \* [link geometry.reference.algorithms.make.make_inverse make_inverse] } */ template inline void assign_inverse(Geometry& geometry) { concept::check(); dispatch::assign_inverse < typename tag::type, Geometry >::apply(geometry); } /*! \brief assign zero values to a box, point \ingroup assign \details The assign_zero function initializes a 2D or 3D point or box with coordinates of zero \tparam Geometry \tparam_geometry \param geometry \param_geometry */ template inline void assign_zero(Geometry& geometry) { concept::check(); dispatch::assign_zero < typename tag::type, Geometry >::apply(geometry); } /*! \brief Assigns one geometry to another geometry \details The assign algorithm assigns one geometry, e.g. a BOX, to another geometry, e.g. a RING. This only if it is possible and applicable. \ingroup assign \tparam Geometry1 \tparam_geometry \tparam Geometry2 \tparam_geometry \param geometry1 \param_geometry (target) \param geometry2 \param_geometry (source) \qbk{ [heading Example] [assign] [assign_output] [heading See also] \* [link geometry.reference.algorithms.convert convert] } */ template inline void assign(Geometry1& geometry1, Geometry2 const& geometry2) { concept::check_concepts_and_equal_dimensions(); bool const same_point_order = point_order::value == point_order::value; bool const same_closure = closure::value == closure::value; BOOST_MPL_ASSERT_MSG ( same_point_order, ASSIGN_IS_NOT_SUPPORTED_FOR_DIFFERENT_POINT_ORDER , (types) ); BOOST_MPL_ASSERT_MSG ( same_closure, ASSIGN_IS_NOT_SUPPORTED_FOR_DIFFERENT_CLOSURE , (types) ); dispatch::convert < false, typename tag::type, typename tag::type, dimension::type::value, Geometry2, Geometry1 >::apply(geometry2, geometry1); } }} // namespace boost::geometry #endif // BOOST_GEOMETRY_ALGORITHMS_ASSIGN_HPP