Deprecated copy_coordinates (=>convert)

Doc update (assign/make)

[SVN r69127]
This commit is contained in:
Barend Gehrels
2011-02-21 22:23:16 +00:00
parent 5c9e5056e6
commit bd482c32ba
26 changed files with 383 additions and 155 deletions

View File

@@ -18,9 +18,9 @@
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/algorithms/num_interior_rings.hpp>
#include <boost/geometry/algorithms/detail/convert_point_to_point.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/util/copy.hpp>
namespace boost { namespace geometry
{
@@ -37,7 +37,7 @@ struct append_point
int = 0, int = 0)
{
typename geometry::point_type<Geometry>::type copy;
copy_coordinates(point, copy);
geometry::detail::convert::convert_point_to_point(point, copy);
traits::push_back<Geometry>::apply(geometry, copy);
}
};

View File

@@ -14,6 +14,7 @@
#include <boost/concept/requires.hpp>
#include <boost/concept_check.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/if.hpp>
#include <boost/numeric/conversion/bounds.hpp>
#include <boost/numeric/conversion/cast.hpp>
@@ -28,7 +29,6 @@
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/util/copy.hpp>
#include <boost/geometry/util/for_each_coordinate.hpp>
@@ -266,6 +266,26 @@ struct assign_point_from_index
};
template <typename Geometry>
struct assign_2d_box_or_segment
{
typedef typename coordinate_type<Geometry>::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 <typename Type>
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<coordinate_type>(x1));
set<0, 1>(geometry, boost::numeric_cast<coordinate_type>(y1));
set<1, 0>(geometry, boost::numeric_cast<coordinate_type>(x2));
set<1, 1>(geometry, boost::numeric_cast<coordinate_type>(y2));
}
};
}} // namespace detail::assign
#endif // DOXYGEN_NO_DETAIL
@@ -275,7 +295,14 @@ namespace dispatch
{
template <typename GeometryTag, typename Geometry, std::size_t DimensionCount>
struct assign {};
struct assign
{
BOOST_MPL_ASSERT_MSG
(
false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
, (types<Geometry>)
);
};
template <typename Point>
struct assign<point_tag, Point, 2>
@@ -306,26 +333,13 @@ struct assign<point_tag, Point, 3>
template <typename Box>
struct assign<box_tag, Box, 2>
{
typedef typename coordinate_type<Box>::type coordinate_type;
: detail::assign::assign_2d_box_or_segment<Box>
{};
// 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 <typename T>
static inline void apply(Box& box,
T const& x1, T const& y1, T const& x2, T const& y2)
{
set<min_corner, 0>(box, boost::numeric_cast<coordinate_type>(x1));
set<min_corner, 1>(box, boost::numeric_cast<coordinate_type>(y1));
set<max_corner, 0>(box, boost::numeric_cast<coordinate_type>(x2));
set<max_corner, 1>(box, boost::numeric_cast<coordinate_type>(y2));
}
};
template <typename Segment>
struct assign<segment_tag, Segment, 2>
: detail::assign::assign_2d_box_or_segment<Segment>
{};
@@ -358,8 +372,22 @@ struct assign_inverse<box_tag, Box>
/*!
\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 <typename Geometry, typename Type>
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 <typename Geometry, typename Type>
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 <typename Geometry, typename Type>
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 <typename Geometry, typename Range>
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 <typename Geometry>
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 <typename Geometry>
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 <typename Box, typename Point>
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 <std::size_t Index, typename Geometry, typename Point>
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 <std::size_t Index, typename Point, typename Geometry>
inline void assign_point_from_index(Geometry const& geometry, Point& point)

View File

@@ -23,13 +23,14 @@
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/iterators/segment_returning_iterator.hpp>
#include <boost/geometry/strategies/centroid.hpp>
#include <boost/geometry/strategies/concepts/centroid_concept.hpp>
#include <boost/geometry/views/closeable_view.hpp>
#include <boost/geometry/util/copy.hpp>
#include <boost/geometry/util/for_each_coordinate.hpp>
@@ -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;

View File

@@ -18,6 +18,7 @@
#include <boost/geometry/algorithms/append.hpp>
#include <boost/geometry/algorithms/assign.hpp>
#include <boost/geometry/algorithms/for_each.hpp>
#include <boost/geometry/algorithms/detail/convert_point_to_point.hpp>
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
@@ -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<Tag, Tag, Dimensions, Geometry1, Geometry2>
struct convert<Tag, Tag, DimensionCount, Geometry1, Geometry2>
{
// Same geometry type -> copy coordinates from G1 to G2
// Actually: we try now to just copy it
@@ -104,22 +105,19 @@ struct convert<Tag, Tag, Dimensions, Geometry1, Geometry2>
}
};
template
<
std::size_t Dimensions,
std::size_t DimensionCount,
typename Geometry1, typename Geometry2
>
struct convert<point_tag, point_tag, Dimensions, Geometry1, Geometry2>
{
static inline void apply(Geometry1 const& source, Geometry2& destination)
{
geometry::copy_coordinates(source, destination);
}
};
struct convert<point_tag, point_tag, DimensionCount, Geometry1, Geometry2>
: detail::convert::point_to_point<Geometry1, Geometry2, 0, DimensionCount>
{};
template <std::size_t Dimensions, typename Ring1, typename Ring2>
struct convert<ring_tag, ring_tag, Dimensions, Ring1, Ring2>
template <std::size_t DimensionCount, typename Ring1, typename Ring2>
struct convert<ring_tag, ring_tag, DimensionCount, Ring1, Ring2>
{
static inline void apply(Ring1 const& source, Ring2& destination)
{
@@ -178,40 +176,40 @@ struct convert<box_tag, polygon_tag, 2, Box, Polygon>
};
template <typename Point, std::size_t Dimensions, typename Box>
struct convert<point_tag, box_tag, Dimensions, Point, Box>
template <typename Point, std::size_t DimensionCount, typename Box>
struct convert<point_tag, box_tag, DimensionCount, Point, Box>
{
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 <typename Ring, std::size_t Dimensions, typename Polygon>
struct convert<ring_tag, polygon_tag, Dimensions, Ring, Polygon>
template <typename Ring, std::size_t DimensionCount, typename Polygon>
struct convert<ring_tag, polygon_tag, DimensionCount, Ring, Polygon>
{
static inline void apply(Ring const& ring, Polygon& polygon)
{
typedef typename ring_type<Polygon>::type ring_type;
convert
<
ring_tag, ring_tag, Dimensions,
ring_tag, ring_tag, DimensionCount,
Ring, ring_type
>::apply(ring, exterior_ring(polygon));
}
};
template <typename Polygon, std::size_t Dimensions, typename Ring>
struct convert<polygon_tag, ring_tag, Dimensions, Polygon, Ring>
template <typename Polygon, std::size_t DimensionCount, typename Ring>
struct convert<polygon_tag, ring_tag, DimensionCount, Polygon, Ring>
{
static inline void apply(Polygon const& polygon, Ring& ring)
{
@@ -219,7 +217,7 @@ struct convert<polygon_tag, ring_tag, Dimensions, Polygon, Ring>
convert
<
ring_tag, ring_tag, Dimensions,
ring_tag, ring_tag, DimensionCount,
ring_type, Ring
>::apply(exterior_ring(polygon), ring);
}

View File

@@ -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 <cstddef>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace convert
{
template <typename Source, typename Destination, std::size_t Dimension, std::size_t DimensionCount>
struct point_to_point
{
static inline void apply(Source const& source, Destination& destination)
{
typedef typename coordinate_type<Destination>::type coordinate_type;
set<Dimension>(destination, boost::numeric_cast<coordinate_type>(get<Dimension>(source)));
point_to_point<Source, Destination, Dimension + 1, DimensionCount>::apply(source, destination);
}
};
template <typename Source, typename Destination, std::size_t DimensionCount>
struct point_to_point<Source, Destination, DimensionCount, DimensionCount>
{
static inline void apply(Source const& , Destination& )
{}
};
template <typename Source, typename Destination>
inline void convert_point_to_point(Source const& source, Destination& destination)
{
point_to_point<Source, Destination, 0, dimension<Destination>::value>::apply(source, destination);
}
}} // namespace detail::convert
#endif // DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_CONVERT_POINT_TO_POINT_HPP

View File

@@ -13,7 +13,8 @@
#include <boost/geometry/algorithms/append.hpp>
#include <boost/geometry/algorithms/clear.hpp>
#include <boost/geometry/util/copy.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/util/select_coordinate_type.hpp>
#include <boost/geometry/geometries/segment.hpp>
@@ -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)

View File

@@ -16,6 +16,7 @@
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/views/closeable_view.hpp>
#include <boost/geometry/views/reversible_view.hpp>
@@ -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;
}
};

View File

@@ -10,6 +10,8 @@
#include <cstddef>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
@@ -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;
}

View File

@@ -13,6 +13,7 @@
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/strategies/intersection.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
@@ -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

View File

@@ -21,6 +21,7 @@
#include <boost/geometry/core/point_order.hpp>
#include <boost/geometry/core/reverse_dispatch.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/detail/overlay/clip_linestring.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay.hpp>
@@ -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;

View File

@@ -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 <typename Geometry, typename T>
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 <typename Geometry, typename Type>
inline Geometry make(Type const& c1, Type const& c2)
{
concept::check<Geometry>();
@@ -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 <typename Geometry, typename T>
inline Geometry make(T const& c1, T const& c2, T const& c3)
template <typename Geometry, typename Type>
inline Geometry make(Type const& c1, Type const& c2, Type const& c3)
{
concept::check<Geometry>();
@@ -62,8 +85,8 @@ inline Geometry make(T const& c1, T const& c2, T const& c3)
return geometry;
}
template <typename Geometry, typename T>
inline Geometry make(T const& c1, T const& c2, T const& c3, T const& c4)
template <typename Geometry, typename Type>
inline Geometry make(Type const& c1, Type const& c2, Type const& c3, Type const& c4)
{
concept::check<Geometry>();
@@ -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 <typename Geometry, typename Range>
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 <typename Geometry>
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 <typename Geometry>
inline Geometry make_zero()

View File

@@ -27,6 +27,7 @@
#include <boost/geometry/strategies/concepts/simplify_concept.hpp>
#include <boost/geometry/algorithms/clear.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/num_interior_rings.hpp>
@@ -175,7 +176,7 @@ struct simplify<point_tag, Point, Strategy>
static inline void apply(Point const& point, Point& out,
Distance const& max_distance, Strategy const& strategy)
{
copy_coordinates(point, out);
geometry::convert(point, out);
}
};

View File

@@ -18,7 +18,6 @@
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/arithmetic/arithmetic.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/util/copy.hpp>
#include <boost/geometry/extensions/gis/latlong/detail/graticule.hpp>

View File

@@ -13,9 +13,9 @@
#include <boost/shared_ptr.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/extensions/gis/projections/factory.hpp>
#include <boost/geometry/extensions/gis/projections/parameters.hpp>
#include <boost/geometry/util/copy.hpp>
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<Cartesian, LatLong, 2,
geometry::detail::convert::point_to_point<Cartesian, LatLong, 2,
geometry::dimension<Cartesian>::value> ::copy(p1, p2);
return m_prj->inverse(p1, p2);
}

View File

@@ -12,6 +12,8 @@
#include <boost/shared_ptr.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/extensions/gis/projections/factory.hpp>
#include <boost/geometry/extensions/gis/projections/parameters.hpp>
@@ -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<LatLong, Cartesian, 2,
geometry::detail::convert::point_to_point<LatLong, Cartesian, 2,
geometry::dimension<Cartesian>::value> ::copy(p1, p2);
return m_prj->forward(p1, p2);
}

View File

@@ -12,8 +12,9 @@
#include <cstddef>
#include <boost/geometry/algorithms/assign.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/util/copy.hpp>
#include <boost/geometry/extensions/nsphere/core/tags.hpp>
#include <boost/geometry/extensions/nsphere/algorithms/assign.hpp>
@@ -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; }

View File

@@ -13,9 +13,10 @@
#include <boost/concept/assert.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/util/copy.hpp>
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; }

View File

@@ -63,7 +63,6 @@
// check includes all concepts
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/util/copy.hpp>
#include <boost/geometry/util/for_each_coordinate.hpp>
#include <boost/geometry/util/math.hpp>
#include <boost/geometry/util/select_most_precise.hpp>

View File

@@ -17,7 +17,6 @@
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/arithmetic/arithmetic.hpp>
#include <boost/geometry/strategies/centroid.hpp>
#include <boost/geometry/util/copy.hpp>
namespace boost { namespace geometry

View File

@@ -16,8 +16,9 @@
#include <boost/range.hpp>
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/strategies/distance_result.hpp>
#include <boost/geometry/util/copy.hpp>
//#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++;
}

View File

@@ -10,6 +10,7 @@
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/arithmetic/arithmetic.hpp>
#include <boost/geometry/arithmetic/dot_product.hpp>
#include <boost/geometry/core/cs.hpp>
@@ -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);

View File

@@ -18,7 +18,6 @@
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/strategies/centroid.hpp>
#include <boost/geometry/util/select_coordinate_type.hpp>
#include <boost/geometry/util/copy.hpp>
namespace boost { namespace geometry

View File

@@ -17,6 +17,7 @@
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/arithmetic/arithmetic.hpp>
#include <boost/geometry/arithmetic/dot_product.hpp>
@@ -26,7 +27,7 @@
#include <boost/geometry/strategies/cartesian/distance_pythagoras.hpp>
#include <boost/geometry/util/select_coordinate_type.hpp>
#include <boost/geometry/util/copy.hpp>
// 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);

View File

@@ -21,7 +21,6 @@
#include <boost/geometry/util/select_calculation_type.hpp>
#include <boost/geometry/util/promote_floating_point.hpp>
#include <boost/geometry/util/copy.hpp>

View File

@@ -15,11 +15,11 @@
#include <boost/numeric/conversion/cast.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/arithmetic/arithmetic.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/util/copy.hpp>
#include <boost/geometry/util/math.hpp>
#include <boost/geometry/util/select_coordinate_type.hpp>
@@ -97,7 +97,7 @@ struct copy_per_coordinate
// Defensive check, dimensions are equal, selected by specialization
assert_dimension_equal<P1, P2>();
copy_coordinates(p1, p2);
geometry::convert(p1, p2);
return true;
}
};

View File

@@ -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 <cstddef>
#include <boost/concept/requires.hpp>
@@ -50,15 +58,8 @@ struct copy_coordinates<Src, Dst, N, N>
#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 <typename Src, typename Dst>
inline void copy_coordinates(Src const& source, Dst& dest)
{