Chris@16: // Boost.Geometry (aka GGL, Generic Geometry Library) Chris@16: Chris@16: // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. Chris@16: // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. Chris@16: // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. Chris@16: Chris@16: // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library Chris@16: // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. Chris@16: Chris@16: // Use, modification and distribution is subject to the Boost Software License, Chris@16: // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_GEOMETRY_ALGORITHMS_MAKE_HPP Chris@16: #define BOOST_GEOMETRY_ALGORITHMS_MAKE_HPP Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost { namespace geometry Chris@16: { Chris@16: Chris@16: #ifndef DOXYGEN_NO_DETAIL Chris@16: namespace detail { namespace make Chris@16: { Chris@16: Chris@16: /*! Chris@16: \brief Construct a geometry Chris@16: \ingroup make Chris@16: \tparam Geometry \tparam_geometry Chris@16: \tparam Range \tparam_range_point Chris@16: \param range \param_range_point Chris@16: \return The constructed geometry, here: a linestring or a ring Chris@16: Chris@16: \qbk{distinguish, with a range} Chris@16: \qbk{ Chris@16: [heading Example] Chris@16: [make_with_range] [make_with_range_output] Chris@16: Chris@16: [heading See also] Chris@16: \* [link geometry.reference.algorithms.assign.assign_points assign] Chris@16: } Chris@16: */ Chris@16: template Chris@16: inline Geometry make_points(Range const& range) Chris@16: { Chris@16: concept::check(); Chris@16: Chris@16: Geometry geometry; Chris@16: geometry::append(geometry, range); Chris@16: return geometry; Chris@16: } Chris@16: Chris@16: }} // namespace detail::make Chris@16: #endif // DOXYGEN_NO_DETAIL Chris@16: Chris@16: /*! Chris@16: \brief Construct a geometry Chris@16: \ingroup make Chris@16: \details Chris@16: \note It does not work with array-point types, like int[2] Chris@16: \tparam Geometry \tparam_geometry Chris@16: \tparam Type \tparam_numeric to specify the coordinates Chris@16: \param c1 \param_x Chris@16: \param c2 \param_y Chris@16: \return The constructed geometry, here: a 2D point Chris@16: Chris@16: \qbk{distinguish, 2 coordinate values} Chris@16: \qbk{ Chris@16: [heading Example] Chris@16: [make_2d_point] [make_2d_point_output] Chris@16: Chris@16: [heading See also] Chris@16: \* [link geometry.reference.algorithms.assign.assign_values_3_2_coordinate_values assign] Chris@16: } Chris@16: */ Chris@16: template Chris@16: inline Geometry make(Type const& c1, Type const& c2) Chris@16: { Chris@16: concept::check(); Chris@16: Chris@16: Geometry geometry; Chris@16: dispatch::assign Chris@16: < Chris@16: typename tag::type, Chris@16: Geometry, Chris@16: geometry::dimension::type::value Chris@16: >::apply(geometry, c1, c2); Chris@16: return geometry; Chris@16: } Chris@16: Chris@16: /*! Chris@16: \brief Construct a geometry Chris@16: \ingroup make Chris@16: \tparam Geometry \tparam_geometry Chris@16: \tparam Type \tparam_numeric to specify the coordinates Chris@16: \param c1 \param_x Chris@16: \param c2 \param_y Chris@16: \param c3 \param_z Chris@16: \return The constructed geometry, here: a 3D point Chris@16: Chris@16: \qbk{distinguish, 3 coordinate values} Chris@16: \qbk{ Chris@16: [heading Example] Chris@16: [make_3d_point] [make_3d_point_output] Chris@16: Chris@16: [heading See also] Chris@16: \* [link geometry.reference.algorithms.assign.assign_values_4_3_coordinate_values assign] Chris@16: } Chris@16: */ Chris@16: template Chris@16: inline Geometry make(Type const& c1, Type const& c2, Type const& c3) Chris@16: { Chris@16: concept::check(); Chris@16: Chris@16: Geometry geometry; Chris@16: dispatch::assign Chris@16: < Chris@16: typename tag::type, Chris@16: Geometry, Chris@16: geometry::dimension::type::value Chris@16: >::apply(geometry, c1, c2, c3); Chris@16: return geometry; Chris@16: } Chris@16: Chris@16: template Chris@16: inline Geometry make(Type const& c1, Type const& c2, Type const& c3, Type const& c4) Chris@16: { Chris@16: concept::check(); Chris@16: Chris@16: Geometry geometry; Chris@16: dispatch::assign Chris@16: < Chris@16: typename tag::type, Chris@16: Geometry, Chris@16: geometry::dimension::type::value Chris@16: >::apply(geometry, c1, c2, c3, c4); Chris@16: return geometry; Chris@16: } Chris@16: Chris@16: Chris@16: Chris@16: Chris@16: Chris@16: /*! Chris@16: \brief Construct a box with inverse infinite coordinates Chris@16: \ingroup make Chris@16: \details The make_inverse function initializes a 2D or 3D box with large coordinates, the Chris@16: min corner is very large, the max corner is very small. This is useful e.g. in combination Chris@16: with the expand function, to determine the bounding box of a series of geometries. Chris@16: \tparam Geometry \tparam_geometry Chris@16: \return The constructed geometry, here: a box Chris@16: Chris@16: \qbk{ Chris@16: [heading Example] Chris@16: [make_inverse] [make_inverse_output] Chris@16: Chris@16: [heading See also] Chris@16: \* [link geometry.reference.algorithms.assign.assign_inverse assign_inverse] Chris@16: } Chris@16: */ Chris@16: template Chris@16: inline Geometry make_inverse() Chris@16: { Chris@16: concept::check(); Chris@16: Chris@16: Geometry geometry; Chris@16: dispatch::assign_inverse Chris@16: < Chris@16: typename tag::type, Chris@16: Geometry Chris@16: >::apply(geometry); Chris@16: return geometry; Chris@16: } Chris@16: Chris@16: /*! Chris@16: \brief Construct a geometry with its coordinates initialized to zero Chris@16: \ingroup make Chris@16: \details The make_zero function initializes a 2D or 3D point or box with coordinates of zero Chris@16: \tparam Geometry \tparam_geometry Chris@16: \return The constructed and zero-initialized geometry Chris@16: */ Chris@16: template Chris@16: inline Geometry make_zero() Chris@16: { Chris@16: concept::check(); Chris@16: Chris@16: Geometry geometry; Chris@16: dispatch::assign_zero Chris@16: < Chris@16: typename tag::type, Chris@16: Geometry Chris@16: >::apply(geometry); Chris@16: return geometry; Chris@16: } Chris@16: Chris@16: }} // namespace boost::geometry Chris@16: Chris@16: #endif // BOOST_GEOMETRY_ALGORITHMS_MAKE_HPP