mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-12 05:51:47 +00:00
Remove typedefs, add closest point utilities
This commit is contained in:
parent
bd711c4f5d
commit
cdfef3c92c
@ -13,7 +13,10 @@
|
|||||||
#include <boost/concept_check.hpp>
|
#include <boost/concept_check.hpp>
|
||||||
|
|
||||||
#include <boost/geometry/algorithms/detail/throw_on_empty_input.hpp>
|
#include <boost/geometry/algorithms/detail/throw_on_empty_input.hpp>
|
||||||
|
#include <boost/geometry/algorithms/detail/closest_points/utilities.hpp>
|
||||||
|
|
||||||
#include <boost/geometry/algorithms/dispatch/closest_points.hpp>
|
#include <boost/geometry/algorithms/dispatch/closest_points.hpp>
|
||||||
|
|
||||||
#include <boost/geometry/algorithms/distance.hpp>
|
#include <boost/geometry/algorithms/distance.hpp>
|
||||||
|
|
||||||
#include <boost/geometry/core/point_type.hpp>
|
#include <boost/geometry/core/point_type.hpp>
|
||||||
@ -65,12 +68,7 @@ struct closest_points
|
|||||||
false
|
false
|
||||||
>::apply(g2, g1, shortest_seg, strategy);
|
>::apply(g2, g1, shortest_seg, strategy);
|
||||||
|
|
||||||
Segment temp;
|
detail::closest_points::swap_segment_points::apply(shortest_seg);
|
||||||
set<0,0>(temp, get<1,0>(shortest_seg));
|
|
||||||
set<0,1>(temp, get<1,1>(shortest_seg));
|
|
||||||
set<1,0>(temp, get<0,0>(shortest_seg));
|
|
||||||
set<1,1>(temp, get<0,1>(shortest_seg));
|
|
||||||
shortest_seg = temp;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -105,7 +103,7 @@ struct closest_points
|
|||||||
template <typename Strategy>
|
template <typename Strategy>
|
||||||
struct is_strategy_converter_specialized_cp
|
struct is_strategy_converter_specialized_cp
|
||||||
{
|
{
|
||||||
typedef strategies::closest_points::services::strategy_converter<Strategy> converter;
|
using converter = strategies::closest_points::services::strategy_converter<Strategy>;
|
||||||
static const bool value = ! std::is_same
|
static const bool value = ! std::is_same
|
||||||
<
|
<
|
||||||
decltype(converter::get(std::declval<Strategy>())),
|
decltype(converter::get(std::declval<Strategy>())),
|
||||||
@ -127,8 +125,8 @@ struct closest_points<Strategy, false>
|
|||||||
Segment& shortest_seg,
|
Segment& shortest_seg,
|
||||||
S const& strategy)
|
S const& strategy)
|
||||||
{
|
{
|
||||||
typedef strategies::closest_points::services::strategy_converter<Strategy> converter;
|
using converter = strategies::closest_points::services::strategy_converter<Strategy>;
|
||||||
typedef decltype(converter::get(strategy)) strategy_type;
|
using strategy_type = decltype(converter::get(strategy));
|
||||||
|
|
||||||
dispatch::closest_points
|
dispatch::closest_points
|
||||||
<
|
<
|
||||||
@ -147,11 +145,11 @@ struct closest_points<Strategy, false>
|
|||||||
Segment& shortest_seg,
|
Segment& shortest_seg,
|
||||||
S const& strategy)
|
S const& strategy)
|
||||||
{
|
{
|
||||||
typedef strategies::closest_points::services::custom_strategy_converter
|
using converter = strategies::closest_points::services::custom_strategy_converter
|
||||||
<
|
<
|
||||||
Geometry1, Geometry2, Strategy
|
Geometry1, Geometry2, Strategy
|
||||||
> converter;
|
>;
|
||||||
typedef decltype(converter::get(strategy)) strategy_type;
|
using strategy_type = decltype(converter::get(strategy));
|
||||||
|
|
||||||
dispatch::closest_points
|
dispatch::closest_points
|
||||||
<
|
<
|
||||||
@ -170,10 +168,10 @@ struct closest_points<default_strategy, false>
|
|||||||
Segment& shortest_seg,
|
Segment& shortest_seg,
|
||||||
default_strategy)
|
default_strategy)
|
||||||
{
|
{
|
||||||
typedef typename strategies::closest_points::services::default_strategy
|
using strategy_type = typename strategies::closest_points::services::default_strategy
|
||||||
<
|
<
|
||||||
Geometry1, Geometry2
|
Geometry1, Geometry2
|
||||||
>::type strategy_type;
|
>::type;
|
||||||
|
|
||||||
dispatch::closest_points
|
dispatch::closest_points
|
||||||
<
|
<
|
||||||
|
@ -50,7 +50,6 @@ namespace boost { namespace geometry
|
|||||||
namespace detail { namespace closest_points
|
namespace detail { namespace closest_points
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
template
|
template
|
||||||
<
|
<
|
||||||
typename P1, typename P2, typename Strategies,
|
typename P1, typename P2, typename Strategies,
|
||||||
@ -62,10 +61,7 @@ struct point_to_point
|
|||||||
static inline void apply(P1 const& p1, P2 const& p2,
|
static inline void apply(P1 const& p1, P2 const& p2,
|
||||||
Segment& shortest_seg, Strategies const& strategies)
|
Segment& shortest_seg, Strategies const& strategies)
|
||||||
{
|
{
|
||||||
set<0,0>(shortest_seg, get<0>(p1));
|
set_segment_from_points::apply(p1, p2, shortest_seg);
|
||||||
set<0,1>(shortest_seg, get<1>(p1));
|
|
||||||
set<1,0>(shortest_seg, get<0>(p2));
|
|
||||||
set<1,1>(shortest_seg, get<1>(p2));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
/*
|
/*
|
||||||
@ -100,13 +96,10 @@ struct point_to_segment
|
|||||||
|
|
||||||
boost::ignore_unused(strategies);
|
boost::ignore_unused(strategies);
|
||||||
|
|
||||||
auto closest_point =
|
auto closest_point = strategies.closest_points(point, segment)
|
||||||
strategies.closest_points(point, segment).apply(point, p[0], p[1]);
|
.apply(point, p[0], p[1]);
|
||||||
|
|
||||||
set<0,0>(shortest_seg, get<0>(point));
|
set_segment_from_points::apply(point, closest_point, shortest_seg);
|
||||||
set<0,1>(shortest_seg, get<1>(point));
|
|
||||||
set<1,0>(shortest_seg, get<0>(closest_point));
|
|
||||||
set<1,1>(shortest_seg, get<1>(closest_point));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
/*
|
/*
|
||||||
@ -168,47 +161,37 @@ template
|
|||||||
class point_to_range
|
class point_to_range
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
//typedef distance::strategy_t<Point, Range, Strategies> strategy_type;
|
|
||||||
|
|
||||||
typedef detail::closest_feature::point_to_point_range
|
using point_to_point_range = detail::closest_feature::point_to_point_range
|
||||||
<
|
<
|
||||||
Point, Range, Closure
|
Point, Range, Closure
|
||||||
> point_to_point_range;
|
>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//typedef distance::return_t<Point, Range, Strategies> return_type;
|
|
||||||
|
|
||||||
template <typename Segment>
|
template <typename Segment>
|
||||||
static inline void apply(Point const& point, Range const& range,
|
static inline void apply(Point const& point, Range const& range,
|
||||||
Segment& shortest_seg,
|
Segment& shortest_seg,
|
||||||
Strategies const& strategies)
|
Strategies const& strategies)
|
||||||
{
|
{
|
||||||
//if (boost::size(range) == 0)
|
if (boost::size(range) == 0)
|
||||||
//{
|
{
|
||||||
// return return_type(0);
|
set_segment_from_points::apply(point, point, shortest_seg);
|
||||||
//}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
distance::creturn_t<Point, Range, Strategies> cd_min;
|
distance::creturn_t<Point, Range, Strategies> cd_min;
|
||||||
|
|
||||||
std::pair
|
auto it_pair = point_to_point_range::apply(point,
|
||||||
<
|
boost::begin(range),
|
||||||
typename boost::range_iterator<Range const>::type,
|
boost::end(range),
|
||||||
typename boost::range_iterator<Range const>::type
|
strategies.comparable_distance(point, range),
|
||||||
> it_pair
|
cd_min);
|
||||||
= point_to_point_range::apply(point,
|
|
||||||
boost::begin(range),
|
|
||||||
boost::end(range),
|
|
||||||
strategies.comparable_distance(point, range),
|
|
||||||
cd_min);
|
|
||||||
|
|
||||||
auto closest_point =
|
auto closest_point = strategies.closest_points(point, range)
|
||||||
strategies.closest_points(point, range).apply(point, *it_pair.first, *it_pair.second);
|
.apply(point, *it_pair.first, *it_pair.second);
|
||||||
|
|
||||||
set<0,0>(shortest_seg, get<0>(point));
|
set_segment_from_points::apply(point, closest_point, shortest_seg);
|
||||||
set<0,1>(shortest_seg, get<1>(point));
|
|
||||||
set<1,0>(shortest_seg, get<0>(closest_point));
|
|
||||||
set<1,1>(shortest_seg, get<1>(closest_point));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -222,8 +205,6 @@ template
|
|||||||
>
|
>
|
||||||
struct point_to_ring
|
struct point_to_ring
|
||||||
{
|
{
|
||||||
typedef distance::return_t<Point, Ring, Strategies> return_type;
|
|
||||||
|
|
||||||
template <typename Segment>
|
template <typename Segment>
|
||||||
static inline auto apply(Point const& point,
|
static inline auto apply(Point const& point,
|
||||||
Ring const& ring,
|
Ring const& ring,
|
||||||
@ -232,10 +213,7 @@ struct point_to_ring
|
|||||||
{
|
{
|
||||||
if (within::within_point_geometry(point, ring, strategies))
|
if (within::within_point_geometry(point, ring, strategies))
|
||||||
{
|
{
|
||||||
set<0,0>(shortest_seg, get<0>(point));
|
set_segment_from_points::apply(point, point, shortest_seg);
|
||||||
set<0,1>(shortest_seg, get<1>(point));
|
|
||||||
set<1,0>(shortest_seg, get<0>(point));
|
|
||||||
set<1,1>(shortest_seg, get<1>(point));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -258,14 +236,10 @@ template
|
|||||||
>
|
>
|
||||||
class point_to_polygon
|
class point_to_polygon
|
||||||
{
|
{
|
||||||
public:
|
using per_ring = point_to_range
|
||||||
typedef distance::return_t<Point, Polygon, Strategies> return_type;
|
|
||||||
|
|
||||||
private:
|
|
||||||
typedef point_to_range
|
|
||||||
<
|
<
|
||||||
Point, typename ring_type<Polygon>::type, Closure, Strategies
|
Point, typename ring_type<Polygon>::type, Closure, Strategies
|
||||||
> per_ring;
|
>;
|
||||||
|
|
||||||
struct distance_to_interior_rings
|
struct distance_to_interior_rings
|
||||||
{
|
{
|
||||||
@ -287,10 +261,7 @@ private:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set<0,0>(shortest_seg, get<0>(point));
|
set_segment_from_points::apply(point, point, shortest_seg);
|
||||||
set<0,1>(shortest_seg, get<1>(point));
|
|
||||||
set<1,0>(shortest_seg, get<0>(point));
|
|
||||||
set<1,1>(shortest_seg, get<1>(point));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename InteriorRings, typename Segment>
|
template <typename InteriorRings, typename Segment>
|
||||||
@ -344,7 +315,7 @@ template
|
|||||||
class point_to_multigeometry
|
class point_to_multigeometry
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef detail::closest_feature::geometry_to_range geometry_to_range;
|
using geometry_to_range = detail::closest_feature::geometry_to_range;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -354,7 +325,7 @@ public:
|
|||||||
Segment& shortest_seg,
|
Segment& shortest_seg,
|
||||||
Strategies const& strategies)
|
Strategies const& strategies)
|
||||||
{
|
{
|
||||||
typedef distance::iterator_selector<MultiGeometry const> selector_type;
|
using selector_type = distance::iterator_selector<MultiGeometry const>;
|
||||||
|
|
||||||
distance::creturn_t<Point, MultiGeometry, Strategies> cd;
|
distance::creturn_t<Point, MultiGeometry, Strategies> cd;
|
||||||
|
|
||||||
@ -383,8 +354,6 @@ public:
|
|||||||
template <typename Point, typename MultiPolygon, typename Strategies>
|
template <typename Point, typename MultiPolygon, typename Strategies>
|
||||||
struct point_to_multigeometry<Point, MultiPolygon, Strategies, true>
|
struct point_to_multigeometry<Point, MultiPolygon, Strategies, true>
|
||||||
{
|
{
|
||||||
typedef distance::return_t<Point, MultiPolygon, Strategies> return_type;
|
|
||||||
|
|
||||||
template <typename Segment>
|
template <typename Segment>
|
||||||
static inline void apply(Point const& point,
|
static inline void apply(Point const& point,
|
||||||
MultiPolygon const& multipolygon,
|
MultiPolygon const& multipolygon,
|
||||||
@ -393,10 +362,7 @@ struct point_to_multigeometry<Point, MultiPolygon, Strategies, true>
|
|||||||
{
|
{
|
||||||
if (within::covered_by_point_geometry(point, multipolygon, strategies))
|
if (within::covered_by_point_geometry(point, multipolygon, strategies))
|
||||||
{
|
{
|
||||||
set<0,0>(shortest_seg, get<0>(point));
|
set_segment_from_points::apply(point, point, shortest_seg);
|
||||||
set<0,1>(shortest_seg, get<1>(point));
|
|
||||||
set<1,0>(shortest_seg, get<0>(point));
|
|
||||||
set<1,1>(shortest_seg, get<1>(point));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ namespace services
|
|||||||
template <>
|
template <>
|
||||||
struct tag<dummy_pt_pt>
|
struct tag<dummy_pt_pt>
|
||||||
{
|
{
|
||||||
typedef strategy_tag_distance_point_point type;
|
using type = strategy_tag_distance_point_point;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ struct default_strategy
|
|||||||
point_tag, point_tag, Point1, Point2, cartesian_tag, cartesian_tag
|
point_tag, point_tag, Point1, Point2, cartesian_tag, cartesian_tag
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
typedef dummy_pt_pt type;
|
using type = dummy_pt_pt;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,19 +54,19 @@ public:
|
|||||||
{
|
{
|
||||||
assert_dimension_equal<Point, PointOfSegment>();
|
assert_dimension_equal<Point, PointOfSegment>();
|
||||||
|
|
||||||
typedef typename calculation_type<Point, PointOfSegment>::type calculation_type;
|
using calculation_type = typename calculation_type<Point, PointOfSegment>::type;
|
||||||
|
|
||||||
// A projected point of points in Integer coordinates must be able to be
|
// A projected point of points in Integer coordinates must be able to be
|
||||||
// represented in FP.
|
// represented in FP.
|
||||||
typedef model::point
|
using fp_point_type = model::point
|
||||||
<
|
<
|
||||||
calculation_type,
|
calculation_type,
|
||||||
dimension<PointOfSegment>::value,
|
dimension<PointOfSegment>::value,
|
||||||
typename coordinate_system<PointOfSegment>::type
|
typename coordinate_system<PointOfSegment>::type
|
||||||
> fp_point_type;
|
>;
|
||||||
|
|
||||||
// For convenience
|
// For convenience
|
||||||
typedef fp_point_type fp_vector_type;
|
using fp_vector_type = fp_point_type;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Algorithm [p: (px,py), p1: (x1,y1), p2: (x2,y2)]
|
Algorithm [p: (px,py), p1: (x1,y1), p2: (x2,y2)]
|
||||||
@ -124,7 +124,7 @@ namespace services
|
|||||||
template <typename CalculationType, typename Strategy>
|
template <typename CalculationType, typename Strategy>
|
||||||
struct tag<projected_point<CalculationType, Strategy> >
|
struct tag<projected_point<CalculationType, Strategy> >
|
||||||
{
|
{
|
||||||
typedef strategy_tag_distance_point_segment type;
|
using type = strategy_tag_distance_point_segment;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -135,11 +135,11 @@ struct default_strategy
|
|||||||
cartesian_tag, cartesian_tag, Strategy
|
cartesian_tag, cartesian_tag, Strategy
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
typedef typename default_strategy
|
using type = typename default_strategy
|
||||||
<
|
<
|
||||||
point_tag, segment_tag, Point, PointOfSegment,
|
point_tag, segment_tag, Point, PointOfSegment,
|
||||||
cartesian_tag, cartesian_tag, Strategy
|
cartesian_tag, cartesian_tag, Strategy
|
||||||
>::type type;
|
>::type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,107 +30,33 @@ namespace bg = boost::geometry;
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
// point types
|
// point types
|
||||||
|
|
||||||
typedef bg::model::point<double, 2, bg::cs::cartesian> car_point;
|
using car_point = bg::model::point<double, 2, bg::cs::cartesian>;
|
||||||
|
|
||||||
typedef bg::model::point
|
using sph_point = bg::model::point
|
||||||
<
|
<
|
||||||
double, 2,
|
double, 2,
|
||||||
bg::cs::spherical_equatorial<bg::degree>
|
bg::cs::spherical_equatorial<bg::degree>
|
||||||
> sph_point;
|
>;
|
||||||
|
|
||||||
typedef bg::model::point
|
using geo_point = bg::model::point
|
||||||
<
|
<
|
||||||
double, 2,
|
double, 2,
|
||||||
bg::cs::geographic<bg::degree>
|
bg::cs::geographic<bg::degree>
|
||||||
> geo_point;
|
>;
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
// cartesian strategies
|
using cartesian = bg::strategies::closest_points::cartesian<double>;
|
||||||
|
|
||||||
// pt-pt
|
//using spherical = bg::strategy::closest_points::spherical<double>;
|
||||||
typedef bg::strategies::closest_points::cartesian<double> cartesian;
|
|
||||||
|
|
||||||
// pt-seg
|
//using = bg::strategy::closest_points::geographic
|
||||||
//typedef bg::strategies::closest_points::cartesian<double> cartesian_ps;
|
// <bg::strategy::andoyer> andoyer;
|
||||||
/*
|
//using = bg::strategy::closest_points::geographic
|
||||||
// pt-box
|
// <bg::strategy::thomas> thomas;
|
||||||
typedef bg::strategy::closest_points::cartesian_point_box<double> cartesian_pb;
|
//using = bg::strategy::closest_points::geographic
|
||||||
|
// <bg::strategy::vincenty> vincenty;
|
||||||
|
|
||||||
// box-box
|
|
||||||
typedef bg::strategy::closest_points::cartesian_box_box<double> cartesian_bb;
|
|
||||||
|
|
||||||
// seg-box
|
|
||||||
typedef bg::strategy::closest_points::cartesian_segment_box<double> cartesian_sb;
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
// spherical strategies
|
|
||||||
|
|
||||||
// pt-pt
|
|
||||||
typedef bg::strategy::closest_points::spherical
|
|
||||||
<double> spherical_pp;
|
|
||||||
|
|
||||||
// pt-seg
|
|
||||||
typedef bg::strategy::closest_points::cross_track
|
|
||||||
<double> spherical_ps;
|
|
||||||
|
|
||||||
// pt-box
|
|
||||||
typedef bg::strategy::closest_points::cross_track_point_box
|
|
||||||
<double> spherical_pb;
|
|
||||||
|
|
||||||
// box-box
|
|
||||||
typedef bg::strategy::closest_points::cross_track_box_box
|
|
||||||
<double> spherical_bb;
|
|
||||||
|
|
||||||
// box-box
|
|
||||||
typedef bg::strategy::closest_points::spherical_segment_box
|
|
||||||
<double> spherical_sb;
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
// geographic strategies
|
|
||||||
|
|
||||||
// pt-pt
|
|
||||||
typedef bg::strategy::closest_points::geographic
|
|
||||||
<bg::strategy::andoyer> andoyer_pp;
|
|
||||||
typedef bg::strategy::closest_points::geographic
|
|
||||||
<bg::strategy::thomas> thomas_pp;
|
|
||||||
typedef bg::strategy::closest_points::geographic
|
|
||||||
<bg::strategy::vincenty> vincenty_pp;
|
|
||||||
|
|
||||||
// pt-seg
|
|
||||||
typedef bg::strategy::closest_points::geographic_cross_track
|
|
||||||
<bg::strategy::andoyer> andoyer_ps;
|
|
||||||
typedef bg::strategy::closest_points::geographic_cross_track
|
|
||||||
<bg::strategy::thomas> thomas_ps;
|
|
||||||
typedef bg::strategy::closest_points::geographic_cross_track
|
|
||||||
<bg::strategy::vincenty> vincenty_ps;
|
|
||||||
|
|
||||||
//pt-box
|
|
||||||
typedef bg::strategy::closest_points::geographic_cross_track_point_box
|
|
||||||
<bg::strategy::andoyer> andoyer_pb;
|
|
||||||
typedef bg::strategy::closest_points::geographic_cross_track_point_box
|
|
||||||
<bg::strategy::thomas> thomas_pb;
|
|
||||||
typedef bg::strategy::closest_points::geographic_cross_track_point_box
|
|
||||||
<bg::strategy::vincenty> vincenty_pb;
|
|
||||||
|
|
||||||
//box-box
|
|
||||||
typedef bg::strategy::closest_points::geographic_cross_track_box_box
|
|
||||||
<bg::strategy::andoyer> andoyer_bb;
|
|
||||||
typedef bg::strategy::closest_points::geographic_cross_track_box_box
|
|
||||||
<bg::strategy::thomas> thomas_bb;
|
|
||||||
typedef bg::strategy::closest_points::geographic_cross_track_box_box
|
|
||||||
<bg::strategy::vincenty> vincenty_bb;
|
|
||||||
|
|
||||||
//segment-box
|
|
||||||
typedef bg::strategy::closest_points::geographic_segment_box
|
|
||||||
<bg::strategy::andoyer> andoyer_sb;
|
|
||||||
typedef bg::strategy::closest_points::geographic_segment_box
|
|
||||||
<bg::strategy::thomas> thomas_sb;
|
|
||||||
typedef bg::strategy::closest_points::geographic_segment_box
|
|
||||||
<bg::strategy::vincenty> vincenty_sb;
|
|
||||||
*/
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
template <typename Segment>
|
template <typename Segment>
|
||||||
@ -353,7 +279,7 @@ struct test_geometry
|
|||||||
bool swap_geometries = true,
|
bool swap_geometries = true,
|
||||||
bool default_strategy = false)
|
bool default_strategy = false)
|
||||||
{
|
{
|
||||||
typedef typename bg::cs_tag<Geometry1>::type CS_tag;
|
using CS_tag = typename bg::cs_tag<Geometry1>::type;
|
||||||
|
|
||||||
Geometry1 geometry1;
|
Geometry1 geometry1;
|
||||||
bg::read_wkt(wkt1, geometry1);
|
bg::read_wkt(wkt1, geometry1);
|
||||||
|
@ -28,11 +28,11 @@ void test_closest_points_point_polygon_or_ring(Strategies const& strategies)
|
|||||||
std::cout << "point/polygon or ring closest_points tests" << std::endl;
|
std::cout << "point/polygon or ring closest_points tests" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bg::model::segment<Point> Segment;
|
using Segment = bg::model::segment<Point>;
|
||||||
typedef bg::model::ring<Point> Ring;
|
using Ring = bg::model::ring<Point>;
|
||||||
typedef bg::model::polygon<Point> Polygon;
|
using Polygon = bg::model::polygon<Point>;
|
||||||
|
|
||||||
typedef test_geometry<Point, Ring, Segment> tester;
|
using tester = test_geometry<Point, Ring, Segment>;
|
||||||
|
|
||||||
tester::apply("POINT(1 1)",
|
tester::apply("POINT(1 1)",
|
||||||
"POLYGON((0 0,1 0,0 1,0 0))",
|
"POLYGON((0 0,1 0,0 1,0 0))",
|
||||||
@ -46,7 +46,7 @@ void test_closest_points_point_polygon_or_ring(Strategies const& strategies)
|
|||||||
"SEGMENT(0.4 0.4,0.4 0.4)",
|
"SEGMENT(0.4 0.4,0.4 0.4)",
|
||||||
strategies);
|
strategies);
|
||||||
|
|
||||||
typedef test_geometry<Point, Polygon, Segment> tester2;
|
using tester2 = test_geometry<Point, Polygon, Segment>;
|
||||||
|
|
||||||
tester2::apply("POINT(1 1)",
|
tester2::apply("POINT(1 1)",
|
||||||
"POLYGON((0 0,1 0,0 1,0 0))",
|
"POLYGON((0 0,1 0,0 1,0 0))",
|
||||||
@ -94,9 +94,9 @@ void test_closest_points_point_box(Strategies const& strategies)
|
|||||||
std::cout << "point/box closest_points tests" << std::endl;
|
std::cout << "point/box closest_points tests" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bg::model::segment<Point> Segment;
|
using Segment = bg::model::segment<Point>;
|
||||||
typedef bg::model::box<Point> Box;
|
using Box = bg::model::box<Point>;
|
||||||
typedef test_geometry<Point, Box, Segment> tester;
|
using tester = test_geometry<Point, Box, Segment>;
|
||||||
|
|
||||||
//all 8 possible placements of point around box
|
//all 8 possible placements of point around box
|
||||||
tester::apply("POINT(5 25)",
|
tester::apply("POINT(5 25)",
|
||||||
@ -165,10 +165,10 @@ void test_closest_points_point_multi_polygon(Strategies const& strategies)
|
|||||||
std::cout << "point/multi-polygon closest_points tests" << std::endl;
|
std::cout << "point/multi-polygon closest_points tests" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bg::model::segment<Point> Segment;
|
using Segment = bg::model::segment<Point>;
|
||||||
typedef bg::model::polygon<Point> Polygon;
|
using Polygon = bg::model::polygon<Point>;
|
||||||
typedef bg::model::multi_polygon<Polygon> MultiPolygon;
|
using MultiPolygon = bg::model::multi_polygon<Polygon>;
|
||||||
typedef test_geometry<Point, MultiPolygon, Segment> tester;
|
using tester = test_geometry<Point, MultiPolygon, Segment>;
|
||||||
|
|
||||||
tester::apply("POINT(1 1)",
|
tester::apply("POINT(1 1)",
|
||||||
"MULTIPOLYGON(((0 0,1 0,0 1,0 0)),\
|
"MULTIPOLYGON(((0 0,1 0,0 1,0 0)),\
|
||||||
@ -204,11 +204,11 @@ void test_closest_points_multi_point_polygon_or_ring(Strategies const& strategie
|
|||||||
std::cout << "multi-point/polygon or ring closest_points tests" << std::endl;
|
std::cout << "multi-point/polygon or ring closest_points tests" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bg::model::segment<Point> Segment;
|
using Segment = bg::model::segment<Point>;
|
||||||
typedef bg::model::multi_point<Point> MultiPoint;
|
using MultiPoint = bg::model::multi_point<Point>;
|
||||||
typedef bg::model::ring<Point> Ring;
|
using Ring = bg::model::ring<Point>;
|
||||||
typedef bg::model::polygon<Point> Polygon;
|
using Polygon = bg::model::polygon<Point>;
|
||||||
typedef test_geometry<MultiPoint, Ring, Segment> tester;
|
using tester = test_geometry<MultiPoint, Ring, Segment>;
|
||||||
|
|
||||||
tester::apply("MULTIPOINT((2 1),(1 1))",
|
tester::apply("MULTIPOINT((2 1),(1 1))",
|
||||||
"POLYGON((0 0,1 0,0 1,0 0))",
|
"POLYGON((0 0,1 0,0 1,0 0))",
|
||||||
@ -229,7 +229,7 @@ void test_closest_points_multi_point_polygon_or_ring(Strategies const& strategie
|
|||||||
"SEGMENT(0.01 0.01,0.01 0.01)",
|
"SEGMENT(0.01 0.01,0.01 0.01)",
|
||||||
strategies);
|
strategies);
|
||||||
|
|
||||||
typedef test_geometry<MultiPoint, Polygon, Segment> tester2;
|
using tester2 = test_geometry<MultiPoint, Polygon, Segment>;
|
||||||
|
|
||||||
tester2::apply("MULTIPOINT((2 1),(1 1))",
|
tester2::apply("MULTIPOINT((2 1),(1 1))",
|
||||||
"POLYGON((0 0,1 0,0 1,0 0))",
|
"POLYGON((0 0,1 0,0 1,0 0))",
|
||||||
@ -257,11 +257,11 @@ void test_closest_points_multi_point_multi_polygon(Strategies const& strategies)
|
|||||||
std::cout << "multi-point/multi-polygon closest_points tests" << std::endl;
|
std::cout << "multi-point/multi-polygon closest_points tests" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bg::model::segment<Point> Segment;
|
using Segment = bg::model::segment<Point>;
|
||||||
typedef bg::model::multi_point<Point> MultiPoint;
|
using MultiPoint = bg::model::multi_point<Point>;
|
||||||
typedef bg::model::polygon<Point> Polygon;
|
using Polygon = bg::model::polygon<Point>;
|
||||||
typedef bg::model::multi_polygon<Polygon> MultiPolygon;
|
using MultiPolygon = bg::model::multi_polygon<Polygon>;
|
||||||
typedef test_geometry<MultiPoint, MultiPolygon, Segment> tester;
|
using tester = test_geometry<MultiPoint, MultiPolygon, Segment>;
|
||||||
|
|
||||||
tester::apply("MULTIPOINT((2 1),(1 1))",
|
tester::apply("MULTIPOINT((2 1),(1 1))",
|
||||||
"MULTIPOLYGON(((0 0,1 0,0 1,0 0)),\
|
"MULTIPOLYGON(((0 0,1 0,0 1,0 0)),\
|
||||||
@ -295,10 +295,10 @@ void test_closest_points_multi_point_box(Strategies const& strategies)
|
|||||||
std::cout << "multi-point/box closest_points tests" << std::endl;
|
std::cout << "multi-point/box closest_points tests" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bg::model::segment<Point> Segment;
|
using Segment = bg::model::segment<Point>;
|
||||||
typedef bg::model::box<Point> Box;
|
using Box = bg::model::box<Point>;
|
||||||
typedef bg::model::multi_point<Point> MultiPoint;
|
using MultiPoint = bg::model::multi_point<Point>;
|
||||||
typedef test_geometry<MultiPoint, Box, Segment> tester;
|
using tester = test_geometry<MultiPoint, Box, Segment>;
|
||||||
|
|
||||||
tester::apply("MULTIPOINT(5 25,0 0,0 20)",
|
tester::apply("MULTIPOINT(5 25,0 0,0 20)",
|
||||||
"BOX(10 10,20 20)",
|
"BOX(10 10,20 20)",
|
||||||
|
@ -29,8 +29,8 @@ void test_closest_points_point_segment(Strategies const& strategies)
|
|||||||
std::cout << "point/segment closest_points tests" << std::endl;
|
std::cout << "point/segment closest_points tests" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bg::model::segment<Point> Segment;
|
using Segment = bg::model::segment<Point>;
|
||||||
typedef test_geometry<Point, Segment, Segment> tester;
|
using tester = test_geometry<Point, Segment, Segment>;
|
||||||
|
|
||||||
tester::apply("POINT(1 1)",
|
tester::apply("POINT(1 1)",
|
||||||
"SEGMENT(0 1,1 0)",
|
"SEGMENT(0 1,1 0)",
|
||||||
@ -65,8 +65,8 @@ void test_closest_points_point_segment_diff_spheroid(Strategies const& strategie
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bg::model::segment<Point> Segment;
|
using Segment = bg::model::segment<Point>;
|
||||||
typedef test_geometry<Point, Segment, Segment> tester;
|
using tester = test_geometry<Point, Segment, Segment>;
|
||||||
|
|
||||||
tester::apply("POINT(1 1)",
|
tester::apply("POINT(1 1)",
|
||||||
"SEGMENT(0 1,1 0)",
|
"SEGMENT(0 1,1 0)",
|
||||||
@ -90,9 +90,9 @@ void test_closest_points_point_linestring(Strategies const& strategies)
|
|||||||
std::cout << "point/linestring closest_points tests" << std::endl;
|
std::cout << "point/linestring closest_points tests" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bg::model::linestring<Point> Linestring;
|
using Linestring = bg::model::linestring<Point>;
|
||||||
typedef bg::model::segment<Point> Segment;
|
using Segment = bg::model::segment<Point>;
|
||||||
typedef test_geometry<Point, Linestring, Segment> tester;
|
using tester = test_geometry<Point, Linestring, Segment>;
|
||||||
|
|
||||||
tester::apply("POINT(1 1)",
|
tester::apply("POINT(1 1)",
|
||||||
"LINESTRING(3 2, 1 3, 0 3, 0 1, 1 0, 0 0)",
|
"LINESTRING(3 2, 1 3, 0 3, 0 1, 1 0, 0 0)",
|
||||||
@ -124,10 +124,10 @@ void test_closest_points_point_multi_linestring(Strategies const& strategies)
|
|||||||
std::cout << "point/multi_linestring closest_points tests" << std::endl;
|
std::cout << "point/multi_linestring closest_points tests" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bg::model::linestring<Point> Linestring;
|
using Linestring = bg::model::linestring<Point>;
|
||||||
typedef bg::model::multi_linestring<Linestring> MultiLinestring;
|
using MultiLinestring = bg::model::multi_linestring<Linestring>;
|
||||||
typedef bg::model::segment<Point> Segment;
|
using Segment = bg::model::segment<Point>;
|
||||||
typedef test_geometry<Point, MultiLinestring, Segment> tester;
|
using tester = test_geometry<Point, MultiLinestring, Segment>;
|
||||||
|
|
||||||
tester::apply("POINT(1 1)",
|
tester::apply("POINT(1 1)",
|
||||||
"MULTILINESTRING((3 2, 1 3, 0 3, 0 1, 1 0, 0 0),(2 0,3 1,4 0))",
|
"MULTILINESTRING((3 2, 1 3, 0 3, 0 1, 1 0, 0 0),(2 0,3 1,4 0))",
|
||||||
@ -159,9 +159,9 @@ void test_closest_points_multi_point_segment(Strategies const& strategies)
|
|||||||
std::cout << "multi point/segment closest_points tests" << std::endl;
|
std::cout << "multi point/segment closest_points tests" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bg::model::multi_point<Point> MultiPoint;
|
using MultiPoint = bg::model::multi_point<Point>;
|
||||||
typedef bg::model::segment<Point> Segment;
|
using Segment = bg::model::segment<Point>;
|
||||||
typedef test_geometry<MultiPoint, Segment, Segment> tester;
|
using tester = test_geometry<MultiPoint, Segment, Segment>;
|
||||||
|
|
||||||
tester::apply("MULTIPOINT((2 0),(1 1),(1 2))",
|
tester::apply("MULTIPOINT((2 0),(1 1),(1 2))",
|
||||||
"SEGMENT(0 1,1 0)",
|
"SEGMENT(0 1,1 0)",
|
||||||
@ -193,10 +193,10 @@ void test_closest_points_multi_point_linestring(Strategies const& strategies)
|
|||||||
std::cout << "multi point/linestring closest_points tests" << std::endl;
|
std::cout << "multi point/linestring closest_points tests" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bg::model::multi_point<Point> MultiPoint;
|
using MultiPoint = bg::model::multi_point<Point>;
|
||||||
typedef bg::model::linestring<Point> Linestring;
|
using Linestring = bg::model::linestring<Point>;
|
||||||
typedef bg::model::segment<Point> Segment;
|
using Segment = bg::model::segment<Point>;
|
||||||
typedef test_geometry<MultiPoint, Linestring, Segment> tester;
|
using tester = test_geometry<MultiPoint, Linestring, Segment>;
|
||||||
|
|
||||||
tester::apply("MULTIPOINT((2 0),(1 1),(3 0))",
|
tester::apply("MULTIPOINT((2 0),(1 1),(3 0))",
|
||||||
"LINESTRING(4 2,3 2, 1 3, 0 3, 0 1, 1 0, 0 0)",
|
"LINESTRING(4 2,3 2, 1 3, 0 3, 0 1, 1 0, 0 0)",
|
||||||
@ -228,11 +228,11 @@ void test_closest_points_multi_point_multi_linestring(Strategies const& strategi
|
|||||||
std::cout << "multi point/multi linestring closest_points tests" << std::endl;
|
std::cout << "multi point/multi linestring closest_points tests" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bg::model::multi_point<Point> MultiPoint;
|
using MultiPoint = bg::model::multi_point<Point>;
|
||||||
typedef bg::model::linestring<Point> Linestring;
|
using Linestring = bg::model::linestring<Point>;
|
||||||
typedef bg::model::multi_linestring<Linestring> MultiLinestring;
|
using MultiLinestring = bg::model::multi_linestring<Linestring>;
|
||||||
typedef bg::model::segment<Point> Segment;
|
using Segment = bg::model::segment<Point>;
|
||||||
typedef test_geometry<MultiPoint, MultiLinestring, Segment> tester;
|
using tester = test_geometry<MultiPoint, MultiLinestring, Segment>;
|
||||||
|
|
||||||
tester::apply("MULTIPOINT((5 0),(1 1),(6 0))",
|
tester::apply("MULTIPOINT((5 0),(1 1),(6 0))",
|
||||||
"MULTILINESTRING((3 2, 1 3, 0 3, 0 1, 1 0, 0 0),(2 0,3 1,4 0))",
|
"MULTILINESTRING((3 2, 1 3, 0 3, 0 1, 1 0, 0 0),(2 0,3 1,4 0))",
|
||||||
@ -284,7 +284,7 @@ BOOST_AUTO_TEST_CASE( test_all_pointlike_linear )
|
|||||||
//test_all_pl_l<geo_point>(thomas_ps());
|
//test_all_pl_l<geo_point>(thomas_ps());
|
||||||
//test_all_pl_l<geo_point>(vincenty_ps());
|
//test_all_pl_l<geo_point>(vincenty_ps());
|
||||||
|
|
||||||
//typedef bg::srs::spheroid<double> stype;
|
//using = bg::srs::spheroid<double> stype;
|
||||||
|
|
||||||
//test_closest_points_point_segment_diff_spheroid<geo_point>
|
//test_closest_points_point_segment_diff_spheroid<geo_point>
|
||||||
// (andoyer_ps(stype(5000000,6000000)));
|
// (andoyer_ps(stype(5000000,6000000)));
|
||||||
|
@ -28,8 +28,8 @@ void test_closest_points_point_point(Strategies const& strategies)
|
|||||||
std::cout << "point/point closest_points tests" << std::endl;
|
std::cout << "point/point closest_points tests" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bg::model::segment<Point> Segment;
|
using Segment = bg::model::segment<Point>;
|
||||||
typedef test_geometry<Point, Point, Segment> tester;
|
using tester = test_geometry<Point, Point, Segment>;
|
||||||
|
|
||||||
tester::apply("POINT(1 1)",
|
tester::apply("POINT(1 1)",
|
||||||
"POINT(0 0)",
|
"POINT(0 0)",
|
||||||
@ -53,9 +53,9 @@ void test_closest_points_point_multi_point(Strategies const& strategies)
|
|||||||
std::cout << "point/multi-point closest_points tests" << std::endl;
|
std::cout << "point/multi-point closest_points tests" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bg::model::segment<Point> Segment;
|
using Segment = bg::model::segment<Point>;
|
||||||
typedef bg::model::multi_point<Point> MultiPoint;
|
using MultiPoint = bg::model::multi_point<Point>;
|
||||||
typedef test_geometry<Point, MultiPoint, Segment> tester;
|
using tester = test_geometry<Point, MultiPoint, Segment>;
|
||||||
|
|
||||||
tester::apply("POINT(0 0)",
|
tester::apply("POINT(0 0)",
|
||||||
"MULTIPOINT((1 1),(2 0),(0 1),(2 1))",
|
"MULTIPOINT((1 1),(2 0),(0 1),(2 1))",
|
||||||
@ -79,9 +79,9 @@ void test_closest_points_multi_point_multi_point(Strategies const& strategies)
|
|||||||
std::cout << "multi-point/multi-point closest_points tests" << std::endl;
|
std::cout << "multi-point/multi-point closest_points tests" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bg::model::segment<Point> Segment;
|
using Segment = bg::model::segment<Point>;
|
||||||
typedef bg::model::multi_point<Point> MultiPoint;
|
using MultiPoint = bg::model::multi_point<Point>;
|
||||||
typedef test_geometry<MultiPoint, MultiPoint, Segment> tester;
|
using tester = test_geometry<MultiPoint, MultiPoint, Segment>;
|
||||||
|
|
||||||
tester::apply("MULTIPOINT((-1 -1),(0 0))",
|
tester::apply("MULTIPOINT((-1 -1),(0 0))",
|
||||||
"MULTIPOINT((1 1),(2 0),(0 1),(2 1))",
|
"MULTIPOINT((1 1),(2 0),(0 1),(2 1))",
|
||||||
@ -97,10 +97,10 @@ void test_closest_points_multi_point_multi_point(Strategies const& strategies)
|
|||||||
template <typename Point, typename Strategies>
|
template <typename Point, typename Strategies>
|
||||||
void test_variant(Strategies const& strategies)
|
void test_variant(Strategies const& strategies)
|
||||||
{
|
{
|
||||||
typedef Point point_type;
|
using point_type = Point;
|
||||||
typedef bg::model::segment<point_type> segment_type;
|
using segment_type = bg::model::segment<point_type>;
|
||||||
typedef bg::model::multi_point<point_type> mp_type;
|
using mp_type = bg::model::multi_point<point_type>;
|
||||||
typedef boost::variant<point_type, mp_type> variant_type;
|
using variant_type = boost::variant<point_type, mp_type>;
|
||||||
|
|
||||||
point_type point1;
|
point_type point1;
|
||||||
bg::read_wkt("POINT(1 3)", point1);
|
bg::read_wkt("POINT(1 3)", point1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user