From bd482c32bac8932377cfafa340c169db12f00e0f Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Mon, 21 Feb 2011 22:23:16 +0000 Subject: [PATCH] Deprecated copy_coordinates (=>convert) Doc update (assign/make) [SVN r69127] --- include/boost/geometry/algorithms/append.hpp | 4 +- include/boost/geometry/algorithms/assign.hpp | 209 +++++++++++++----- .../boost/geometry/algorithms/centroid.hpp | 7 +- include/boost/geometry/algorithms/convert.hpp | 44 ++-- .../detail/convert_point_to_point.hpp | 63 ++++++ .../detail/overlay/clip_linestring.hpp | 7 +- .../detail/overlay/copy_segment_point.hpp | 3 +- .../overlay/get_intersection_points.hpp | 4 +- .../detail/overlay/get_turn_info.hpp | 13 +- .../algorithms/intersection_inserter.hpp | 5 +- include/boost/geometry/algorithms/make.hpp | 109 ++++++--- .../boost/geometry/algorithms/simplify.hpp | 3 +- .../extensions/gis/latlong/point_ll.hpp | 1 - .../project_inverse_transformer.hpp | 4 +- .../gis/projections/project_transformer.hpp | 4 +- .../extensions/nsphere/geometries/nsphere.hpp | 5 +- include/boost/geometry/geometries/box.hpp | 7 +- include/boost/geometry/geometry.hpp | 1 - .../strategies/cartesian/centroid_average.hpp | 1 - .../agnostic/simplify_douglas_peucker.hpp | 5 +- .../geometry/strategies/buffer_join_round.hpp | 5 +- .../cartesian/centroid_bashein_detmer.hpp | 1 - .../cartesian/distance_projected_point.hpp | 9 +- .../cartesian/distance_pythagoras.hpp | 1 - .../strategies/strategy_transform.hpp | 4 +- include/boost/geometry/util/copy.hpp | 19 +- 26 files changed, 383 insertions(+), 155 deletions(-) create mode 100644 include/boost/geometry/algorithms/detail/convert_point_to_point.hpp diff --git a/include/boost/geometry/algorithms/append.hpp b/include/boost/geometry/algorithms/append.hpp index 188a242b1..96c4ee1cd 100644 --- a/include/boost/geometry/algorithms/append.hpp +++ b/include/boost/geometry/algorithms/append.hpp @@ -18,9 +18,9 @@ #include #include +#include #include -#include namespace boost { namespace geometry { @@ -37,7 +37,7 @@ struct append_point int = 0, int = 0) { typename geometry::point_type::type copy; - copy_coordinates(point, copy); + geometry::detail::convert::convert_point_to_point(point, copy); traits::push_back::apply(geometry, copy); } }; diff --git a/include/boost/geometry/algorithms/assign.hpp b/include/boost/geometry/algorithms/assign.hpp index 4551ac02c..7fe7a44e8 100644 --- a/include/boost/geometry/algorithms/assign.hpp +++ b/include/boost/geometry/algorithms/assign.hpp @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -28,7 +29,6 @@ #include -#include #include @@ -266,6 +266,26 @@ struct assign_point_from_index }; +template +struct assign_2d_box_or_segment +{ + typedef typename coordinate_type::type coordinate_type; + + // Here we assign 4 coordinates to a box of segment + // -> Most logical is: x1,y1,x2,y2 + // In case the user reverses x1/x2 or y1/y2, for a box, we could reverse them (THAT IS NOT IMPLEMENTED) + + template + static inline void apply(Geometry& geometry, + Type const& x1, Type const& y1, Type const& x2, Type const& y2) + { + set<0, 0>(geometry, boost::numeric_cast(x1)); + set<0, 1>(geometry, boost::numeric_cast(y1)); + set<1, 0>(geometry, boost::numeric_cast(x2)); + set<1, 1>(geometry, boost::numeric_cast(y2)); + } +}; + }} // namespace detail::assign #endif // DOXYGEN_NO_DETAIL @@ -275,7 +295,14 @@ namespace dispatch { template -struct assign {}; +struct assign +{ + BOOST_MPL_ASSERT_MSG + ( + false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE + , (types) + ); +}; template struct assign @@ -306,26 +333,13 @@ struct assign template struct assign -{ - typedef typename coordinate_type::type coordinate_type; + : detail::assign::assign_2d_box_or_segment +{}; - // Here we assign 4 coordinates to a box. - // -> Most logical is: x1,y1,x2,y2 - // In case the user reverses x1/x2 or y1/y2, we could reverse them (THAT IS NOT IMPLEMENTED) - - // Note also comment in util/assign_box_corner -> - // ("Most logical is LOWER, UPPER and sub-order LEFT, RIGHT") - // (That is assigning 4 points from a box. So lower-left, lower-right, upper-left, upper-right) - template - static inline void apply(Box& box, - T const& x1, T const& y1, T const& x2, T const& y2) - { - set(box, boost::numeric_cast(x1)); - set(box, boost::numeric_cast(y1)); - set(box, boost::numeric_cast(x2)); - set(box, boost::numeric_cast(y2)); - } -}; +template +struct assign + : detail::assign::assign_2d_box_or_segment +{}; @@ -358,8 +372,22 @@ struct assign_inverse /*! - \brief assign two values to a 2D point - \ingroup assign +\brief Assign two coordinates to a geometry (usually a 2D point) +\ingroup assign +\tparam Geometry \tparam_geometry +\tparam Type \tparam_numeric to specify the coordinates +\param geometry \param_geometry +\param c1 \param_x +\param c2 \param_y + +\qbk{distinguish, 2 coordinate values} +\qbk{ +[heading Example] +[assign_2d_point] [assign_2d_point_output] + +[heading See also] +\* [link geometry.reference.algorithms.make.make_2_2_coordinate_values make] +} */ template inline void assign(Geometry& geometry, Type const& c1, Type const& c2) @@ -375,8 +403,23 @@ inline void assign(Geometry& geometry, Type const& c1, Type const& c2) } /*! - \brief assign three values to a 3D point [or the center + radius to a circle] - \ingroup assign +\brief Assign three values to a geometry (usually a 3D point) +\ingroup assign +\tparam Geometry \tparam_geometry +\tparam Type \tparam_numeric to specify the coordinates +\param geometry \param_geometry +\param c1 \param_x +\param c2 \param_y +\param c3 \param_z + +\qbk{distinguish, 3 coordinate values} +\qbk{ +[heading Example] +[assign_3d_point] [assign_3d_point_output] + +[heading See also] +\* [link geometry.reference.algorithms.make.make_3_3_coordinate_values make] +} */ template inline void assign(Geometry& geometry, @@ -393,8 +436,17 @@ inline void assign(Geometry& geometry, } /*! - \brief assign center + radius to a sphere [for extension] - \ingroup assign +\brief Assign four values to a geometry (usually a box or segment) +\ingroup assign +\tparam Geometry \tparam_geometry +\tparam Type \tparam_numeric to specify the coordinates +\param geometry \param_geometry +\param c1 First coordinate (usually x1) +\param c2 Second coordinate (usually y1) +\param c3 Third coordinate (usually x2) +\param c4 Fourth coordinate (usually y2) + +\qbk{distinguish, 4 coordinate values} */ template inline void assign(Geometry& geometry, @@ -412,9 +464,22 @@ inline void assign(Geometry& 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 +\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{distinguish, with a range} +\qbk{ +[heading Example] +[assign_with_range] [assign_with_range_output] + +[heading See also] +\* [link geometry.reference.algorithms.make.make_1_with_a_range make] +} */ template inline void assign(Geometry& geometry, Range const& range) @@ -427,11 +492,21 @@ inline void assign(Geometry& geometry, Range const& range) /*! - \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 +\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] +} */ template inline void assign_inverse(Geometry& geometry) @@ -446,10 +521,12 @@ inline void assign_inverse(Geometry& 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 the geometry type +\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) @@ -465,10 +542,22 @@ inline void assign_zero(Geometry& geometry) /*! - \brief Assign the 4 points of a 2D box - \ingroup assign - \note The order is crucial. Most logical is LOWER, UPPER and sub-order LEFT, RIGHT - so this is how it is implemented. +\brief Assign the four points of a 2D box +\ingroup assign +\note The order is crucial. Most logical is LOWER, UPPER and sub-order LEFT, RIGHT + so this is how it is implemented. +\tparam Box \tparam_box +\tparam Point \tparam_point +\param box \param_box +\param lower_left point being assigned to lower left coordinates of the box +\param lower_right point being assigned to lower right coordinates of the box +\param upper_left point being assigned to upper left coordinates of the box +\param upper_right point being assigned to upper right coordinates of the box + +\qbk{ +[heading Example] +[assign_box_corners] [assign_box_corners_output] +} */ template inline void assign_box_corners(Box const& box, @@ -491,10 +580,19 @@ inline void assign_box_corners(Box const& box, /*! - \brief Assign a box or segment with the value of a point - \ingroup assign - \tparam Index indicates which box-corner, min_corner (0) or max_corner (1) - or which point of segment (0/1) +\brief Assign a box or segment with the value of a point +\ingroup assign +\tparam Index indicates which box-corner, min_corner (0) or max_corner (1) + or which point of segment (0/1) +\tparam Point \tparam_point +\tparam Geometry \tparam_box_or_segment +\param point \param_point +\param geometry \param_box_or_segment + +\qbk{ +[heading Example] +[assign_point_to_index] [assign_point_to_index_output] +} */ template inline void assign_point_to_index(Point const& point, Geometry& geometry) @@ -510,10 +608,19 @@ inline void assign_point_to_index(Point const& point, Geometry& geometry) /*! - \brief Assign a point with a point of a box or segment - \ingroup assign - \tparam Index indicates which box-corner, min_corner (0) or max_corner (1) - or which point of segment (0/1) +\brief Assign a point with a point of a box or segment +\ingroup assign +\tparam Index indicates which box-corner, min_corner (0) or max_corner (1) + or which point of segment (0/1) +\tparam Geometry \tparam_box_or_segment +\tparam Point \tparam_point +\param geometry \param_box_or_segment +\param point \param_point + +\qbk{ +[heading Example] +[assign_point_from_index] [assign_point_from_index_output] +} */ template inline void assign_point_from_index(Geometry const& geometry, Point& point) diff --git a/include/boost/geometry/algorithms/centroid.hpp b/include/boost/geometry/algorithms/centroid.hpp index 3e961ef26..68e65dff5 100644 --- a/include/boost/geometry/algorithms/centroid.hpp +++ b/include/boost/geometry/algorithms/centroid.hpp @@ -23,13 +23,14 @@ #include #include +#include #include #include #include #include #include #include -#include + #include @@ -77,7 +78,7 @@ struct centroid_point static inline void apply(Point const& point, PointCentroid& centroid, Strategy const&) { - copy_coordinates(point, centroid); + geometry::convert(point, centroid); } }; @@ -157,7 +158,7 @@ inline bool range_ok(Range const& range, Point& centroid) else // if (n == 1) { // Take over the first point in a "coordinate neutral way" - copy_coordinates(*boost::begin(range), centroid); + geometry::convert(*boost::begin(range), centroid); return false; } return true; diff --git a/include/boost/geometry/algorithms/convert.hpp b/include/boost/geometry/algorithms/convert.hpp index 5cd61a0d8..96457cacf 100644 --- a/include/boost/geometry/algorithms/convert.hpp +++ b/include/boost/geometry/algorithms/convert.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -80,7 +81,7 @@ namespace dispatch template < typename Tag1, typename Tag2, - std::size_t Dimensions, + std::size_t DimensionCount, typename Geometry1, typename Geometry2 > struct convert @@ -91,10 +92,10 @@ struct convert template < typename Tag, - std::size_t Dimensions, + std::size_t DimensionCount, typename Geometry1, typename Geometry2 > -struct convert +struct convert { // Same geometry type -> copy coordinates from G1 to G2 // Actually: we try now to just copy it @@ -104,22 +105,19 @@ struct convert } }; + template < - std::size_t Dimensions, + std::size_t DimensionCount, typename Geometry1, typename Geometry2 > -struct convert -{ - static inline void apply(Geometry1 const& source, Geometry2& destination) - { - geometry::copy_coordinates(source, destination); - } -}; +struct convert + : detail::convert::point_to_point +{}; -template -struct convert +template +struct convert { static inline void apply(Ring1 const& source, Ring2& destination) { @@ -178,40 +176,40 @@ struct convert }; -template -struct convert +template +struct convert { static inline void apply(Point const& point, Box& box) { detail::convert::point_to_box < - Point, Box, min_corner, 0, Dimensions + Point, Box, min_corner, 0, DimensionCount >::apply(point, box); detail::convert::point_to_box < - Point, Box, max_corner, 0, Dimensions + Point, Box, max_corner, 0, DimensionCount >::apply(point, box); } }; -template -struct convert +template +struct convert { static inline void apply(Ring const& ring, Polygon& polygon) { typedef typename ring_type::type ring_type; convert < - ring_tag, ring_tag, Dimensions, + ring_tag, ring_tag, DimensionCount, Ring, ring_type >::apply(ring, exterior_ring(polygon)); } }; -template -struct convert +template +struct convert { static inline void apply(Polygon const& polygon, Ring& ring) { @@ -219,7 +217,7 @@ struct convert convert < - ring_tag, ring_tag, Dimensions, + ring_tag, ring_tag, DimensionCount, ring_type, Ring >::apply(exterior_ring(polygon), ring); } diff --git a/include/boost/geometry/algorithms/detail/convert_point_to_point.hpp b/include/boost/geometry/algorithms/detail/convert_point_to_point.hpp new file mode 100644 index 000000000..a2e9e6cdc --- /dev/null +++ b/include/boost/geometry/algorithms/detail/convert_point_to_point.hpp @@ -0,0 +1,63 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// +// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands. +// Copyright Bruno Lalande 2008, 2009 +// 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_DETAIL_CONVERT_POINT_TO_POINT_HPP +#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_CONVERT_POINT_TO_POINT_HPP + +// Note: extracted from "convert.hpp" to avoid circular references convert/append + +#include + +#include +#include +#include +#include + + +namespace boost { namespace geometry +{ + +#ifndef DOXYGEN_NO_DETAIL +namespace detail { namespace convert +{ + + +template +struct point_to_point +{ + static inline void apply(Source const& source, Destination& destination) + { + typedef typename coordinate_type::type coordinate_type; + + set(destination, boost::numeric_cast(get(source))); + point_to_point::apply(source, destination); + } +}; + +template +struct point_to_point +{ + static inline void apply(Source const& , Destination& ) + {} +}; + + +template +inline void convert_point_to_point(Source const& source, Destination& destination) +{ + point_to_point::value>::apply(source, destination); +} + + + +}} // namespace detail::convert +#endif // DOXYGEN_NO_DETAIL + +}} // namespace boost::geometry + +#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_CONVERT_POINT_TO_POINT_HPP diff --git a/include/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp b/include/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp index 94c0d5916..573b72396 100644 --- a/include/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/clip_linestring.hpp @@ -13,7 +13,8 @@ #include #include -#include +#include + #include #include @@ -180,8 +181,8 @@ OutputIterator clip_range_with_box(Box const& b, Range const& range, ++previous, ++vertex) { point_type p1, p2; - copy_coordinates(*previous, p1); - copy_coordinates(*vertex, p2); + geometry::convert(*previous, p1); + geometry::convert(*vertex, p2); // Clip the segment. Five situations: // 1. Segment is invisible, finish line if any (shouldn't occur) diff --git a/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp b/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp index afc24e067..69ec0c14b 100644 --- a/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -69,7 +70,7 @@ struct copy_segment_point_range rview_type view(cview); - geometry::copy_coordinates(*(boost::begin(view) + index), point); + geometry::convert(*(boost::begin(view) + index), point); return true; } }; diff --git a/include/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp b/include/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp index bb43a28e9..239d5f6a9 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp @@ -10,6 +10,8 @@ #include + +#include #include @@ -61,7 +63,7 @@ struct get_turn_without_info { TurnInfo tp; - copy_coordinates(result.template get<0>().intersections[i], tp.point); + geometry::convert(result.template get<0>().intersections[i], tp.point); *out++ = tp; } diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp index 50a911300..e094d9ad0 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp @@ -13,6 +13,7 @@ #include #include +#include #include @@ -92,7 +93,7 @@ struct touch_interior : public base_turn_handler DirInfo const& dir_info) { ti.method = method_touch_interior; - copy_coordinates(intersection_info.intersections[0], ti.point); + geometry::convert(intersection_info.intersections[0], ti.point); // Both segments of q touch segment p somewhere in its interior // 1) We know: if q comes from LEFT or RIGHT @@ -211,7 +212,7 @@ struct touch : public base_turn_handler DirInfo const& dir_info) { ti.method = method_touch; - copy_coordinates(intersection_info.intersections[0], ti.point); + geometry::convert(intersection_info.intersections[0], ti.point); int const side_qi_p1 = dir_info.sides.template get<1, 0>(); int const side_qk_p1 = SideStrategy::apply(pi, pj, qk); @@ -399,7 +400,7 @@ struct equal : public base_turn_handler { ti.method = method_equal; // Copy the SECOND intersection point - copy_coordinates(intersection_info.intersections[1], ti.point); + geometry::convert(intersection_info.intersections[1], ti.point); int const side_pk_q2 = SideStrategy::apply(qj, qk, pk); int const side_pk_p = SideStrategy::apply(pi, pj, pk); @@ -481,7 +482,7 @@ struct collinear : public base_turn_handler DirInfo const& dir_info) { ti.method = method_collinear; - copy_coordinates(intersection_info.intersections[1], ti.point); + geometry::convert(intersection_info.intersections[1], ti.point); int const arrival = dir_info.arrival[0]; // Should not be 0, this is checked before @@ -580,7 +581,7 @@ private : // If P arrives within Q, set info on P (which is done above, index=0), // this turn-info belongs to the second intersection point, index=1 // (see e.g. figure CLO1) - copy_coordinates(intersection_info.intersections[1 - Index], tp.point); + geometry::convert(intersection_info.intersections[1 - Index], tp.point); return true; } @@ -656,7 +657,7 @@ struct crosses : public base_turn_handler DirInfo const& dir_info) { ti.method = method_crosses; - copy_coordinates(intersection_info.intersections[0], ti.point); + geometry::convert(intersection_info.intersections[0], ti.point); // In all casees: // If Q crosses P from left to right diff --git a/include/boost/geometry/algorithms/intersection_inserter.hpp b/include/boost/geometry/algorithms/intersection_inserter.hpp index ae49c4a63..732b7b9cc 100644 --- a/include/boost/geometry/algorithms/intersection_inserter.hpp +++ b/include/boost/geometry/algorithms/intersection_inserter.hpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -63,7 +64,7 @@ struct intersection_segment_segment_point for (std::size_t i = 0; i < is.count; i++) { PointOut p; - geometry::copy_coordinates(is.intersections[i], p); + geometry::convert(is.intersections[i], p); *out++ = p; } return out; @@ -93,7 +94,7 @@ struct intersection_linestring_linestring_point it = boost::begin(turns); it != boost::end(turns); ++it) { PointOut p; - geometry::copy_coordinates(it->point, p); + geometry::convert(it->point, p); *out++ = p; } return out; diff --git a/include/boost/geometry/algorithms/make.hpp b/include/boost/geometry/algorithms/make.hpp index 426a5b88a..5ab9d8698 100644 --- a/include/boost/geometry/algorithms/make.hpp +++ b/include/boost/geometry/algorithms/make.hpp @@ -17,18 +17,27 @@ namespace boost { namespace geometry { /*! - \brief Make a geometry - \ingroup make - \details the Generic Geometry Library uses concepts for all its geometries. Therefore it does not rely - on constructors. The "make" functions are object generators creating geometries. There are overloads - with two, three, four or six values, which are implemented depending on the geometry specified. - \note It does not work with array-point types, like int[2] - \tparam G the geometry type - \tparam T the coordinate type - \return the geometry - */ -template -inline Geometry make(T const& c1, T const& c2) +\brief Construct a geometry +\ingroup make +\details +\note It does not work with array-point types, like int[2] +\tparam Geometry \tparam_geometry +\tparam Type \tparam_numeric to specify the coordinates +\param c1 \param_x +\param c2 \param_y +\return The constructed geometry, here: a 2D point + +\qbk{distinguish, 2 coordinate values} +\qbk{ +[heading Example] +[make_2d_point] [make_2d_point_output] + +[heading See also] +\* [link geometry.reference.algorithms.assign.assign_3_2_coordinate_values assign] +} +*/ +template +inline Geometry make(Type const& c1, Type const& c2) { concept::check(); @@ -43,12 +52,26 @@ inline Geometry make(T const& c1, T const& c2) } /*! - \brief Make a geometry - \ingroup make - \return a 3D point +\brief Construct a geometry +\ingroup make +\tparam Geometry \tparam_geometry +\tparam Type \tparam_numeric to specify the coordinates +\param c1 \param_x +\param c2 \param_y +\param c3 \param_z +\return The constructed geometry, here: a 3D point + +\qbk{distinguish, 3 coordinate values} +\qbk{ +[heading Example] +[make_3d_point] [make_3d_point_output] + +[heading See also] +\* [link geometry.reference.algorithms.assign.assign_4_3_coordinate_values assign] +} */ -template -inline Geometry make(T const& c1, T const& c2, T const& c3) +template +inline Geometry make(Type const& c1, Type const& c2, Type const& c3) { concept::check(); @@ -62,8 +85,8 @@ inline Geometry make(T const& c1, T const& c2, T const& c3) return geometry; } -template -inline Geometry make(T const& c1, T const& c2, T const& c3, T const& c4) +template +inline Geometry make(Type const& c1, Type const& c2, Type const& c3, Type const& c4) { concept::check(); @@ -79,6 +102,23 @@ inline Geometry make(T const& c1, T const& c2, T const& c3, T const& c4) +/*! +\brief Construct a geometry +\ingroup make +\tparam Geometry \tparam_geometry +\tparam Range \tparam_range_point +\param range \param_range_point +\return The constructed geometry, here: a linestring or a linear ring + +\qbk{distinguish, with a range} +\qbk{ +[heading Example] +[make_with_range] [make_with_range_output] + +[heading See also] +\* [link geometry.reference.algorithms.assign.assign_2_with_a_range assign] +} + */ template inline Geometry make(Range const& range) { @@ -91,12 +131,21 @@ inline Geometry make(Range const& range) /*! - \brief Create a box with inverse infinite coordinates - \ingroup make - \details The make_inverse function initialize a 2D or 3D box with large coordinates, the - min corner is very large, the max corner is very small - \tparam Geometry the geometry type - \return the box +\brief Construct a box with inverse infinite coordinates +\ingroup make +\details The make_inverse function initializes a 2D or 3D box with large coordinates, the + min corner is very large, the max corner is very small. This is useful e.g. in combination + with the combine function, to determine the bounding box of a series of geometries. +\tparam Geometry \tparam_geometry +\return The constructed geometry, here: a box + +\qbk{ +[heading Example] +[make_inverse] [make_inverse_output] + +[heading See also] +\* [link geometry.reference.algorithms.assign.assign_inverse assign] +} */ template inline Geometry make_inverse() @@ -113,11 +162,11 @@ inline Geometry make_inverse() } /*! - \brief Create a geometry with "zero" coordinates - \ingroup make - \details The make_zero function initializes a 2D or 3D point or box with coordinates of zero - \tparam Geometry the geometry type - \return the geometry +\brief Construct a geometry with its coordinates initialized to zero +\ingroup make +\details The make_zero function initializes a 2D or 3D point or box with coordinates of zero +\tparam Geometry \tparam_geometry +\return The constructed and zero-initialized geometry */ template inline Geometry make_zero() diff --git a/include/boost/geometry/algorithms/simplify.hpp b/include/boost/geometry/algorithms/simplify.hpp index 965fba09c..9994fffbc 100644 --- a/include/boost/geometry/algorithms/simplify.hpp +++ b/include/boost/geometry/algorithms/simplify.hpp @@ -27,6 +27,7 @@ #include #include +#include #include @@ -175,7 +176,7 @@ struct simplify static inline void apply(Point const& point, Point& out, Distance const& max_distance, Strategy const& strategy) { - copy_coordinates(point, out); + geometry::convert(point, out); } }; diff --git a/include/boost/geometry/extensions/gis/latlong/point_ll.hpp b/include/boost/geometry/extensions/gis/latlong/point_ll.hpp index dad431f27..c54fe6d33 100644 --- a/include/boost/geometry/extensions/gis/latlong/point_ll.hpp +++ b/include/boost/geometry/extensions/gis/latlong/point_ll.hpp @@ -18,7 +18,6 @@ #include #include #include -#include #include diff --git a/include/boost/geometry/extensions/gis/projections/project_inverse_transformer.hpp b/include/boost/geometry/extensions/gis/projections/project_inverse_transformer.hpp index b0d0b5caa..bdef6ceca 100644 --- a/include/boost/geometry/extensions/gis/projections/project_inverse_transformer.hpp +++ b/include/boost/geometry/extensions/gis/projections/project_inverse_transformer.hpp @@ -13,9 +13,9 @@ #include #include +#include #include #include -#include namespace boost { namespace geometry { namespace projection @@ -60,7 +60,7 @@ struct project_inverse_transformer { // Latlong (LL -> XY) will be projected, rest will be copied. // So first copy third or higher dimensions - geometry::detail::copy::copy_coordinates::value> ::copy(p1, p2); return m_prj->inverse(p1, p2); } diff --git a/include/boost/geometry/extensions/gis/projections/project_transformer.hpp b/include/boost/geometry/extensions/gis/projections/project_transformer.hpp index 2ca832392..c2eaa5b65 100644 --- a/include/boost/geometry/extensions/gis/projections/project_transformer.hpp +++ b/include/boost/geometry/extensions/gis/projections/project_transformer.hpp @@ -12,6 +12,8 @@ #include +#include +#include #include #include @@ -50,7 +52,7 @@ struct project_transformer { // Latlong (LatLong -> Cartesian) will be projected, rest will be copied. // So first copy third or higher dimensions - geometry::detail::copy::copy_coordinates::value> ::copy(p1, p2); return m_prj->forward(p1, p2); } diff --git a/include/boost/geometry/extensions/nsphere/geometries/nsphere.hpp b/include/boost/geometry/extensions/nsphere/geometries/nsphere.hpp index 86ce539d7..805c07c3a 100644 --- a/include/boost/geometry/extensions/nsphere/geometries/nsphere.hpp +++ b/include/boost/geometry/extensions/nsphere/geometries/nsphere.hpp @@ -12,8 +12,9 @@ #include #include +#include #include -#include + #include #include @@ -57,7 +58,7 @@ public: nsphere(P const& center, T const& radius) : m_radius(radius) { - copy_coordinates(center, m_center); + geometry::convert(center, m_center); } inline P const& center() const { return m_center; } diff --git a/include/boost/geometry/geometries/box.hpp b/include/boost/geometry/geometries/box.hpp index 9d1909a42..f64a9324d 100644 --- a/include/boost/geometry/geometries/box.hpp +++ b/include/boost/geometry/geometries/box.hpp @@ -13,9 +13,10 @@ #include +#include #include -#include + namespace boost { namespace geometry { @@ -51,8 +52,8 @@ public: */ inline box(Point const& min_corner, Point const& max_corner) { - copy_coordinates(min_corner, m_min_corner); - copy_coordinates(max_corner, m_max_corner); + geometry::convert(min_corner, m_min_corner); + geometry::convert(max_corner, m_max_corner); } inline Point const& min_corner() const { return m_min_corner; } diff --git a/include/boost/geometry/geometry.hpp b/include/boost/geometry/geometry.hpp index e7c1a2e2d..163450dd3 100644 --- a/include/boost/geometry/geometry.hpp +++ b/include/boost/geometry/geometry.hpp @@ -63,7 +63,6 @@ // check includes all concepts #include -#include #include #include #include diff --git a/include/boost/geometry/multi/strategies/cartesian/centroid_average.hpp b/include/boost/geometry/multi/strategies/cartesian/centroid_average.hpp index d15dad55a..dd8d3ca93 100644 --- a/include/boost/geometry/multi/strategies/cartesian/centroid_average.hpp +++ b/include/boost/geometry/multi/strategies/cartesian/centroid_average.hpp @@ -17,7 +17,6 @@ #include #include #include -#include namespace boost { namespace geometry diff --git a/include/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp b/include/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp index 7198a7d88..6f54b2bd9 100644 --- a/include/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp +++ b/include/boost/geometry/strategies/agnostic/simplify_douglas_peucker.hpp @@ -16,8 +16,9 @@ #include #include +#include #include -#include + //#define GL_DEBUG_DOUGLAS_PEUCKER @@ -203,7 +204,7 @@ public : { // copy-coordinates does not work because OutputIterator // does not model Point (??) - //geometry::copy_coordinates(it->p, *out); + //geometry::convert(it->p, *out); *out = it->p; out++; } diff --git a/include/boost/geometry/strategies/buffer_join_round.hpp b/include/boost/geometry/strategies/buffer_join_round.hpp index 6b76ff494..eb7eb5978 100644 --- a/include/boost/geometry/strategies/buffer_join_round.hpp +++ b/include/boost/geometry/strategies/buffer_join_round.hpp @@ -10,6 +10,7 @@ +#include #include #include #include @@ -44,7 +45,7 @@ struct join_round2 static inline Vector create_vector(Point1 const& p1, Point2 const& p2) { Vector v; - copy_coordinates(p1, v); + geometry::convert(p1, v); subtract_point(v, p2); return v; } @@ -104,7 +105,7 @@ struct join_round2 PointOut projected_point; multiply_value(v, b); - copy_coordinates(vertex, projected_point); + geometry::convert(vertex, projected_point); add_point(projected_point, v); coordinate_type projected_distance = geometry::distance(projected_point, mid_point); diff --git a/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp b/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp index 19ced4bae..36be796e3 100644 --- a/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp +++ b/include/boost/geometry/strategies/cartesian/centroid_bashein_detmer.hpp @@ -18,7 +18,6 @@ #include #include #include -#include namespace boost { namespace geometry diff --git a/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp b/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp index 44ca6c7d7..e7ad7ab9d 100644 --- a/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp +++ b/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -26,7 +27,7 @@ #include #include -#include + // Helper geometries @@ -126,8 +127,8 @@ public : // For consistency we define w also in FP fp_vector_type v, w; - copy_coordinates(p2, v); - copy_coordinates(p, w); + geometry::convert(p2, v); + geometry::convert(p, w); subtract_point(v, p1); subtract_point(w, p1); @@ -157,7 +158,7 @@ public : >::apply(strategy); fp_point_type projected; - copy_coordinates(p1, projected); + geometry::convert(p1, projected); multiply_value(v, b); add_point(projected, v); diff --git a/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp b/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp index 845eea270..9162516ec 100644 --- a/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp +++ b/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp @@ -21,7 +21,6 @@ #include #include -#include diff --git a/include/boost/geometry/strategies/strategy_transform.hpp b/include/boost/geometry/strategies/strategy_transform.hpp index 79650cb72..612f1cc2c 100644 --- a/include/boost/geometry/strategies/strategy_transform.hpp +++ b/include/boost/geometry/strategies/strategy_transform.hpp @@ -15,11 +15,11 @@ #include +#include #include #include #include -#include #include #include @@ -97,7 +97,7 @@ struct copy_per_coordinate // Defensive check, dimensions are equal, selected by specialization assert_dimension_equal(); - copy_coordinates(p1, p2); + geometry::convert(p1, p2); return true; } }; diff --git a/include/boost/geometry/util/copy.hpp b/include/boost/geometry/util/copy.hpp index 926a09c05..77f41c703 100644 --- a/include/boost/geometry/util/copy.hpp +++ b/include/boost/geometry/util/copy.hpp @@ -9,6 +9,14 @@ #ifndef BOOST_GEOMETRY_UTIL_COPY_HPP #define BOOST_GEOMETRY_UTIL_COPY_HPP +#if defined(BOOST_MSVC_FULL_VER) +#pragma message ("copy_coordinates is deprecated. Use 'convert'") +#else +#warning "copy_coordinates is deprecated. Use 'convert'" +#endif + + + #include #include @@ -50,15 +58,8 @@ struct copy_coordinates #endif // DOXYGEN_NO_DETAIL -/*! - \brief Copies coordinates from source to destination point - \ingroup assign - \details The function copy_coordinates copies coordinates from one point to another point. - Source point and destination point might be of different types. - \param source Source point - \param dest Destination point - \note If destination type differs from source type, they must have the same coordinate count - */ +// Deprecated! +// This is the same as "convert", but this is specific to point, convert is more generic template inline void copy_coordinates(Src const& source, Dst& dest) {