[test] Adapt tests to new interfaces of various utilities in the library.

default_strategy services, partition, get_turns, strategies.
This commit is contained in:
Adam Wulkiewicz 2017-01-28 04:09:49 +01:00
parent cd14e16b0c
commit bc77e1255e
16 changed files with 177 additions and 118 deletions

View File

@ -3,8 +3,8 @@
// Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2016.
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
// This file was modified by Oracle on 2016-2017.
// Modifications copyright (c) 2016-2017, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
@ -97,8 +97,10 @@ template<> struct EndTestProperties<boost::geometry::strategy::buffer::end_flat>
template <typename Geometry, typename RescalePolicy>
std::size_t count_self_ips(Geometry const& geometry, RescalePolicy const& rescale_policy)
template <typename Geometry, typename Strategy, typename RescalePolicy>
std::size_t count_self_ips(Geometry const& geometry,
Strategy const& strategy,
RescalePolicy const& rescale_policy)
{
typedef typename bg::point_type<Geometry>::type point_type;
typedef bg::detail::overlay::turn_info
@ -113,7 +115,7 @@ std::size_t count_self_ips(Geometry const& geometry, RescalePolicy const& rescal
bg::self_turns
<
bg::detail::overlay::assign_null_policy
>(geometry, rescale_policy, turns, policy);
>(geometry, strategy, rescale_policy, turns, policy);
return turns.size();
}
@ -217,10 +219,15 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
typedef typename bg::point_type<Geometry>::type point_type;
typedef typename bg::rescale_policy_type<point_type>::type
rescale_policy_type;
typedef typename bg::strategy::intersection::services::default_strategy
<
typename bg::cs_tag<Geometry>::type
>::type strategy_type;
// Enlarge the box to get a proper rescale policy
bg::buffer(envelope, envelope, distance_strategy.max_distance(join_strategy, end_strategy));
strategy_type strategy;
rescale_policy_type rescale_policy
= bg::get_rescale_policy<rescale_policy_type>(envelope);
@ -233,6 +240,7 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
join_strategy,
end_strategy,
point_strategy,
strategy,
rescale_policy,
visitor);
@ -262,6 +270,7 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
bg::model::box<point_type> envelope_output;
bg::assign_values(envelope_output, 0, 0, 1, 1);
bg::envelope(buffered, envelope_output);
rescale_policy_type rescale_policy_output
= bg::get_rescale_policy<rescale_policy_type>(envelope_output);
@ -316,7 +325,7 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
try
{
bool has_self_ips = bg::detail::overlay::has_self_intersections(
buffered, rescale_policy_output, false);
buffered, strategy, rescale_policy_output, false);
// Be sure resulting polygon does not contain
// self-intersections
BOOST_CHECK_MESSAGE
@ -372,9 +381,9 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
{
std::size_t count = 0;
if (bg::detail::overlay::has_self_intersections(buffered,
rescale_policy_output, false))
strategy, rescale_policy_output, false))
{
count = count_self_ips(buffered, rescale_policy_output);
count = count_self_ips(buffered, strategy, rescale_policy_output);
}
*self_ip_count += count;

View File

@ -1,6 +1,11 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
//
// This file was modified by Oracle on 2017.
// Modifications copyright (c) 2017 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
//
// 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)
@ -143,8 +148,8 @@ void test_boxes(std::string const& wkt_box_list, double expected_area, int expec
box_visitor<Box> visitor;
bg::partition
<
Box, get_box, ovelaps_box
>::apply(boxes, visitor, 1);
Box
>::apply(boxes, visitor, get_box(), ovelaps_box(), 1);
BOOST_CHECK_CLOSE(visitor.area, expected_area, 0.001);
BOOST_CHECK_EQUAL(visitor.count, expected_count);
@ -221,8 +226,9 @@ void test_points(std::string const& wkt1, std::string const& wkt2, int expected_
point_visitor visitor;
bg::partition
<
bg::model::box<point_item>, get_point, ovelaps_point
>::apply(mp1, mp2, visitor, 1);
bg::model::box<point_item>
>::apply(mp1, mp2, visitor, get_point(), ovelaps_point(),
get_point(), ovelaps_point(), 1);
BOOST_CHECK_EQUAL(visitor.count, expected_count);
}
@ -369,12 +375,10 @@ void test_many_points(int seed, int size, int count)
bg::partition
<
bg::model::box<point_item>,
get_point, ovelaps_point,
get_point, ovelaps_point,
bg::detail::partition::include_all_policy,
bg::detail::partition::include_all_policy,
box_visitor_type
>::apply(mp1, mp2, visitor, 2, box_visitor);
bg::detail::partition::include_all_policy
>::apply(mp1, mp2, visitor, get_point(), ovelaps_point(),
get_point(), ovelaps_point(), 2, box_visitor);
BOOST_CHECK_EQUAL(visitor.count, expected_count);
@ -479,12 +483,10 @@ void test_many_boxes(int seed, int size, int count)
bg::partition
<
box_type,
get_box, ovelaps_box,
get_box, ovelaps_box,
bg::detail::partition::include_all_policy,
bg::detail::partition::include_all_policy,
partition_box_visitor_type
>::apply(boxes, visitor, 2, partition_box_visitor);
bg::detail::partition::include_all_policy
>::apply(boxes, visitor, get_box(), ovelaps_box(),
2, partition_box_visitor);
BOOST_CHECK_EQUAL(visitor.count, expected_count);
BOOST_CHECK_CLOSE(visitor.area, expected_area, 0.001);
@ -549,12 +551,10 @@ void test_two_collections(int seed1, int seed2, int size, int count)
bg::partition
<
box_type,
get_box, ovelaps_box,
get_box, ovelaps_box,
bg::detail::partition::include_all_policy,
bg::detail::partition::include_all_policy,
partition_box_visitor_type
>::apply(boxes1, boxes2, visitor, 2, partition_box_visitor);
bg::detail::partition::include_all_policy
>::apply(boxes1, boxes2, visitor, get_box(), ovelaps_box(),
get_box(), ovelaps_box(), 2, partition_box_visitor);
BOOST_CHECK_EQUAL(visitor.count, expected_count);
BOOST_CHECK_CLOSE(visitor.area, expected_area, 0.001);
@ -617,23 +617,19 @@ void test_heterogenuous_collections(int seed1, int seed2, int size, int count)
bg::partition
<
box_type,
get_point, ovelaps_point,
get_box, ovelaps_box,
bg::detail::partition::include_all_policy,
bg::detail::partition::include_all_policy,
partition_box_visitor_type
>::apply(points, boxes, visitor1, 2, partition_box_visitor);
bg::detail::partition::include_all_policy
>::apply(points, boxes, visitor1, get_point(), ovelaps_point(),
get_box(), ovelaps_box(), 2, partition_box_visitor);
reversed_point_in_box_visitor visitor2;
bg::partition
<
box_type,
get_box, ovelaps_box,
get_point, ovelaps_point,
bg::detail::partition::include_all_policy,
bg::detail::partition::include_all_policy,
partition_box_visitor_type
>::apply(boxes, points, visitor2, 2, partition_box_visitor);
bg::detail::partition::include_all_policy
>::apply(boxes, points, visitor2, get_box(), ovelaps_box(),
get_point(), ovelaps_point(), 2, partition_box_visitor);
BOOST_CHECK_EQUAL(visitor1.count, expected_count);
BOOST_CHECK_EQUAL(visitor2.count, expected_count);

View File

@ -3,6 +3,10 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017.
// Modifications copyright (c) 2017, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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)
@ -42,6 +46,11 @@ void test_with_point(std::string const& caseid,
P qj = bg::make<P>(qj_x, qj_y);
P qk = bg::make<P>(qk_x, qk_y);
typedef typename bg::strategy::intersection::services::default_strategy
<
typename bg::cs_tag<P>::type
>::type strategy_type;
typedef typename bg::detail::no_rescale_policy rescale_policy_type;
typedef bg::detail::overlay::turn_info
@ -52,13 +61,14 @@ void test_with_point(std::string const& caseid,
typedef std::vector<turn_info> tp_vector;
turn_info model;
tp_vector info;
strategy_type strategy;
rescale_policy_type rescale_policy;
bg::detail::overlay::get_turn_info
<
bg::detail::overlay::assign_null_policy
>::apply(pi, pj, pk, qi, qj, qk,
false, false, false, false, // dummy parameters
model, rescale_policy, std::back_inserter(info));
model, strategy, rescale_policy, std::back_inserter(info));
if (info.size() == 0)

View File

@ -5,6 +5,10 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2017.
// Modifications copyright (c) 2017, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -59,9 +63,17 @@ struct test_get_turns
G1 const& g1, G2 const& g2, double /*precision*/)
{
typedef typename bg::point_type<G2>::type point_type;
typedef typename bg::strategy::intersection::services::default_strategy
<
typename bg::cs_tag<G1>::type
>::type strategy_type;
typedef typename bg::rescale_policy_type<point_type>::type
rescale_policy_type;
strategy_type strategy;
rescale_policy_type rescale_policy
= bg::get_rescale_policy<rescale_policy_type>(g1, g2);
@ -74,7 +86,10 @@ struct test_get_turns
bg::detail::get_turns::no_interrupt_policy policy;
bg::get_turns<false, false, bg::detail::overlay::assign_null_policy>(g1, g2, rescale_policy, turns, policy);
bg::get_turns
<
false, false, bg::detail::overlay::assign_null_policy
>(g1, g2, strategy, rescale_policy, turns, policy);
BOOST_CHECK_MESSAGE(
expected_count == boost::size(turns),

View File

@ -3,6 +3,10 @@
// Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017.
// Modifications copyright (c) 2017, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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)
@ -359,6 +363,13 @@ void test_overlay(std::string const& caseid,
OverlayType
> overlay;
typedef typename bg::strategy::intersection::services::default_strategy
<
typename bg::cs_tag<Geometry>::type
>::type strategy_type;
strategy_type strategy;
typedef typename bg::rescale_overlay_policy_type
<
Geometry,
@ -368,15 +379,6 @@ void test_overlay(std::string const& caseid,
rescale_policy_type robust_policy
= bg::get_rescale_policy<rescale_policy_type>(g1, g2);
typedef bg::intersection_strategies
<
typename bg::cs_tag<Geometry>::type,
Geometry,
Geometry,
typename bg::point_type<Geometry>::type,
rescale_policy_type
> strategy;
#if defined(TEST_WITH_SVG)
map_visitor<svg_mapper> visitor(mapper);
#else
@ -385,7 +387,7 @@ void test_overlay(std::string const& caseid,
Geometry result;
overlay::apply(g1, g2, robust_policy, std::back_inserter(result),
strategy(), visitor);
strategy, visitor);
BOOST_CHECK_CLOSE(bg::area(result), expected_area, 0.001);
BOOST_CHECK_MESSAGE((bg::num_interior_rings(result) == expected_hole_count),

View File

@ -5,6 +5,10 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2017.
// Modifications copyright (c) 2017, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -51,6 +55,10 @@ static void test_self_intersection_points(std::string const& case_id,
{
typedef typename bg::point_type<Geometry>::type point_type;
//typedef typename bg::rescale_policy_type<point_type>::type rescale_policy_type;
typedef typename bg::strategy::intersection::services::default_strategy
<
typename bg::cs_tag<Geometry>::type
>::type strategy_type;
typedef bg::detail::no_rescale_policy rescale_policy_type;
typedef bg::detail::overlay::turn_info
<
@ -63,7 +71,7 @@ static void test_self_intersection_points(std::string const& case_id,
std::vector<turn_info> turns;
strategy_type strategy;
rescale_policy_type rescale_policy
;
// = bg::get_rescale_policy<rescale_policy_type>(geometry);
@ -73,7 +81,7 @@ static void test_self_intersection_points(std::string const& case_id,
bg::self_turns
<
bg::detail::overlay::assign_null_policy
>(geometry, rescale_policy, turns, policy);
>(geometry, strategy, rescale_policy, turns, policy);
typedef typename bg::coordinate_type<Geometry>::type ct;

View File

@ -3,6 +3,10 @@
// Copyright (c) 2016 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017.
// Modifications copyright (c) 2017, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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)
@ -104,7 +108,7 @@ template
std::size_t apply_overlay(std::string const& case_id,
Geometry1 const& geometry1, Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
Strategy const& )
Strategy const& strategy)
{
using namespace boost::geometry;
@ -135,7 +139,7 @@ std::size_t apply_overlay(std::string const& case_id,
<
Reverse1, Reverse2,
detail::overlay::assign_null_policy
>(geometry1, geometry2, robust_policy, turns, policy);
>(geometry1, geometry2, strategy, robust_policy, turns, policy);
typename Strategy::side_strategy_type side_strategy;
cluster_type clusters;
@ -185,18 +189,16 @@ void test_sort_by_side(std::string const& case_id,
rescale_policy_type robust_policy
= bg::get_rescale_policy<rescale_policy_type>(g1, g2);
typedef bg::intersection_strategies
<
typename bg::cs_tag<Geometry>::type,
Geometry,
Geometry,
typename bg::point_type<Geometry>::type,
rescale_policy_type
> strategy;
typedef typename bg::strategy::intersection::services::default_strategy
<
typename bg::cs_tag<Geometry>::type
>::type strategy_type;
strategy_type strategy;
std::size_t open_count = apply_overlay<OverlayType, false, false, false, geometry_out>(case_id, g1, g2,
robust_policy,
strategy());
strategy);
BOOST_CHECK_MESSAGE(open_count == expected_open_count,
" caseid=" << case_id

View File

@ -4,8 +4,8 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014, 2016.
// Modifications copyright (c) 2014-2016 Oracle and/or its affiliates.
// This file was modified by Oracle on 2014, 2016, 2017.
// Modifications copyright (c) 2014-2017 Oracle and/or its affiliates.
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -123,10 +123,18 @@ void check_geometry_range(Geometry1 const& g1,
std::string const& wkt2,
Expected const& expected)
{
typedef typename bg::strategy::intersection::services::default_strategy
<
typename bg::cs_tag<Geometry1>::type
>::type strategy_type;
typedef bg::detail::no_rescale_policy robust_policy_type;
typedef typename bg::point_type<Geometry2>::type point_type;
typedef typename bg::segment_ratio_type<point_type, robust_policy_type>::type segment_ratio_type;
typedef typename bg::segment_ratio_type
<
point_type, robust_policy_type
>::type segment_ratio_type;
typedef bg::detail::overlay::turn_info
<
@ -144,16 +152,21 @@ void check_geometry_range(Geometry1 const& g1,
std::vector<turn_info> turns;
interrupt_policy_t interrupt_policy;
strategy_type strategy;
robust_policy_type robust_policy;
// Don't switch the geometries
typedef bg::detail::get_turns::get_turn_info_type<Geometry1, Geometry2, assign_policy_t> turn_policy_t;
typedef bg::detail::get_turns::get_turn_info_type
<
Geometry1, Geometry2, assign_policy_t
> turn_policy_t;
bg::dispatch::get_turns
<
typename bg::tag<Geometry1>::type, typename bg::tag<Geometry2>::type,
Geometry1, Geometry2, false, false,
turn_policy_t
>::apply(0, g1, 1, g2, robust_policy, turns, interrupt_policy);
>::apply(0, g1, 1, g2, strategy, robust_policy, turns, interrupt_policy);
bool ok = boost::size(expected) == turns.size();

View File

@ -4,6 +4,11 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017.
// Modifications copyright (c) 2017 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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)
@ -17,14 +22,13 @@
#include <boost/variant/variant.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/algorithms/covered_by.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/io/wkt/read.hpp>
#include <boost/geometry/strategies/strategies.hpp>
template <typename Geometry1, typename Geometry2>
void check_geometry(Geometry1 const& geometry1,

View File

@ -4,15 +4,15 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014, 2015.
// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// This file was modified by Oracle on 2014, 2015, 2017.
// Modifications copyright (c) 2014-2017 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// 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)
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
#ifndef BOOST_GEOMETRY_TEST_WITHIN_HPP
#define BOOST_GEOMETRY_TEST_WITHIN_HPP
@ -21,23 +21,13 @@
#include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/within.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/io/wkt/read.hpp>
#include <boost/geometry/strategies/cartesian/point_in_box.hpp>
#include <boost/geometry/strategies/cartesian/box_in_box.hpp>
#include <boost/geometry/strategies/agnostic/point_in_point.hpp>
#include <boost/geometry/strategies/agnostic/point_in_box_by_side.hpp>
#include <boost/geometry/strategies/agnostic/point_in_poly_winding.hpp>
#include <boost/geometry/strategies/agnostic/relate.hpp>
#include <boost/geometry/algorithms/within.hpp>
#include <boost/geometry/strategies/strategies.hpp>
template <typename Geometry1, typename Geometry2>
void check_geometry(Geometry1 const& geometry1,

View File

@ -72,6 +72,11 @@ struct check_turn_less
static inline void apply(Geometry1 const& geometry1,
Geometry2 const& geometry2)
{
typedef typename bg::strategy::intersection::services::default_strategy
<
typename bg::cs_tag<Geometry1>::type
>::type strategy_type;
typedef bg::detail::no_rescale_policy robust_policy_type;
typedef bg::detail::relate::turns::get_turns
@ -94,7 +99,8 @@ struct check_turn_less
bg::detail::get_turns::no_interrupt_policy interrupt_policy;
get_turns_type::apply(turns, geometry1, geometry2,
interrupt_policy, robust_policy_type());
interrupt_policy,
strategy_type(), robust_policy_type());
typedef bg::detail::turns::less_seg_fraction_other_op<> turn_less_type;

View File

@ -175,17 +175,12 @@ typename bg::default_area_result<G1>::type test_intersection(std::string const&
if (! settings.debug)
{
// Check _inserter behaviour with stratey
typedef bg::intersection_strategies
typedef typename bg::strategy::intersection::services::default_strategy
<
typename bg::cs_tag<point_type>::type,
G1,
G2,
point_type,
typename bg::rescale_policy_type<point_type>::type,
CalculationType
> strategy;
typename bg::cs_tag<point_type>::type
>::type strategy_type;
result_type clip;
bg::detail::intersection::intersection_insert<OutputType>(g1, g2, std::back_inserter(clip), strategy());
bg::detail::intersection::intersection_insert<OutputType>(g1, g2, std::back_inserter(clip), strategy_type());
}
typename bg::default_area_result<G1>::type length_or_area = 0;

View File

@ -1,7 +1,7 @@
// Boost.Geometry
// Unit Test
// Copyright (c) 2016 Oracle and/or its affiliates.
// Copyright (c) 2016-2017 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -29,7 +29,8 @@
#include <boost/geometry/io/svg/svg_mapper.hpp>
#include <boost/geometry/io/svg/write.hpp>
#include <boost/geometry/strategies/cartesian/area_surveyor.hpp>
#include <boost/geometry/strategies/strategies.hpp>
template <typename R, typename T>
inline void push_back_square(R & rng, T const& mi, T const& ma)

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2014-2016, Oracle and/or its affiliates.
// Copyright (c) 2014-2017, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -52,9 +52,12 @@
#include <boost/geometry/iterators/point_iterator.hpp>
#include <boost/geometry/iterators/point_reverse_iterator.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <test_common/with_pointer.hpp>
#include <test_geometries/copy_on_dereference_geometries.hpp>
namespace bg = ::boost::geometry;
namespace ba = ::boost::assign;

View File

@ -5,6 +5,9 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2017, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -85,19 +88,21 @@ static void test_segment_intersection(std::string const& case_id,
>::type
> result_type;
typedef bg::policies::relate::segments_intersection_points
<
result_type
> points_policy_type;
// Get the intersection point (or two points)
result_type is
= bg::strategy::intersection::relate_cartesian_segments
<
bg::policies::relate::segments_intersection_points<result_type>
>::apply(s12, s34, rescale_policy, p1, p2, p3, p4);
= bg::strategy::intersection::relate_cartesian_segments<>
::apply(s12, s34, points_policy_type(), rescale_policy, p1, p2, p3, p4);
// Get just a character for Left/Right/intersects/etc, purpose is more for debugging
bg::policies::relate::direction_type dir
= bg::strategy::intersection::relate_cartesian_segments
<
bg::policies::relate::segments_direction
>::apply(s12, s34, rescale_policy, p1, p2, p3, p4);
= bg::strategy::intersection::relate_cartesian_segments<>
::apply(s12, s34, bg::policies::relate::segments_direction(),
rescale_policy, p1, p2, p3, p4);
std::size_t expected_count =
check(is, 0, expected_x1, expected_y1)
@ -143,12 +148,15 @@ static void test_segment_ratio(std::string const& case_id,
ratio_type
> result_type;
typedef bg::policies::relate::segments_intersection_points
<
result_type
> points_policy_type;
// Get the intersection point (or two points)
result_type is
= bg::strategy::intersection::relate_cartesian_segments
<
bg::policies::relate::segments_intersection_points<result_type>
>::apply(s12, s34, rescale_policy, p1, p2, p3, p4);
= bg::strategy::intersection::relate_cartesian_segments<>
::apply(s12, s34, points_policy_type(), rescale_policy, p1, p2, p3, p4);
ratio_type expected_a1(expected_pair_a1.first, expected_pair_a1.second);
ratio_type expected_a2(expected_pair_a2.first, expected_pair_a2.second);

View File

@ -1,7 +1,7 @@
// Boost.Geometry
// Unit Test
// Copyright (c) 2016, Oracle and/or its affiliates.
// Copyright (c) 2016-2017, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
@ -57,14 +57,11 @@ void test_spherical_strategy_one(S1 const& s1, S2 const& s2, char m, std::size_t
>,
bg::policies::relate::segments_direction
> policy_t;
typedef bg::strategy::intersection::relate_spherical_segments
<
policy_t
> strategy_t;
typedef typename strategy_t::return_type return_type;
typedef bg::strategy::intersection::relate_spherical_segments<> strategy_t;
typedef typename policy_t::return_type return_type;
// NOTE: robust policy is currently ignored
return_type res = strategy_t::apply(s1, s2, 0);
return_type res = strategy_t::apply(s1, s2, policy_t(), 0);
size_t const res_count = boost::get<0>(res).count;
char const res_method = boost::get<1>(res).how;