[test] Drop library dependencies in tests.

If possible drop type_traits, mpl, typeof, foreach, assign.
Rearrange some includes.
This commit is contained in:
Adam Wulkiewicz 2021-07-01 22:26:05 +02:00
parent ad74f51fe1
commit 08f7e66f79
102 changed files with 1255 additions and 1492 deletions

View File

@ -73,13 +73,13 @@ void test_all()
("POLYGON((1 0,0 1,-1 0,0 -1,1 0))", 2); ("POLYGON((1 0,0 1,-1 0,0 -1,1 0))", 2);
typedef typename bg::coordinate_type<P>::type coord_type; typedef typename bg::coordinate_type<P>::type coord_type;
if (BOOST_GEOMETRY_CONDITION((boost::is_same<coord_type, double>::value))) if (BOOST_GEOMETRY_CONDITION((std::is_same<coord_type, double>::value)))
{ {
test_geometry<bg::model::polygon<P, false, false> > test_geometry<bg::model::polygon<P, false, false> >
("POLYGON((100000001 100000000, 100000000 100000001, \ ("POLYGON((100000001 100000000, 100000000 100000001, \
99999999 100000000, 100000000 99999999))", 2); 99999999 100000000, 100000000 99999999))", 2);
} }
else if (BOOST_GEOMETRY_CONDITION((boost::is_same<coord_type, float>::value))) else if (BOOST_GEOMETRY_CONDITION((std::is_same<coord_type, float>::value)))
{ {
test_geometry<bg::model::polygon<P, false, false> > test_geometry<bg::model::polygon<P, false, false> >
("POLYGON((100001 100000, 100000 100001, \ ("POLYGON((100001 100000, 100000 100001, \

View File

@ -6,9 +6,8 @@
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2015, 2016, 2017. // This file was modified by Oracle on 2015-2021.
// Modifications copyright (c) 2015-2017, Oracle and/or its affiliates. // Modifications copyright (c) 2015-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -430,7 +429,7 @@ void test_spherical_geo()
/*if (polar) /*if (polar)
{ {
// Create colatitudes (measured from pole) // Create colatitudes (measured from pole)
BOOST_FOREACH(pt& p, aurha) for (pt& p : aurha)
{ {
bg::set<1>(p, ct(90) - bg::get<1>(p)); bg::set<1>(p, ct(90) - bg::get<1>(p));
} }

View File

@ -3,8 +3,8 @@
// Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2016. // This file was modified by Oracle on 2016-2021.
// Modifications copyright (c) 2016, Oracle and/or its affiliates. // Modifications copyright (c) 2016-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -128,7 +128,7 @@ void test_all()
ut_settings const settings; ut_settings const settings;
ut_settings const specific_settings ut_settings const specific_settings
= BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, long double>::value)) = BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, long double>::value))
? ut_settings(0.02) : settings; ? ut_settings(0.02) : settings;
// Simplex (join-type is not relevant) // Simplex (join-type is not relevant)
@ -258,7 +258,7 @@ void test_all()
test_one<linestring, polygon>("mysql_report_2015_04_01", mysql_report_2015_04_01, join_round(32), end_round(32), 632.234, d100); test_one<linestring, polygon>("mysql_report_2015_04_01", mysql_report_2015_04_01, join_round(32), end_round(32), 632.234, d100);
} }
if (! BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, float>::value))) if (! BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, float>::value)))
{ {
ut_settings settings; ut_settings settings;
settings.tolerance = 0.1; settings.tolerance = 0.1;
@ -313,7 +313,7 @@ void test_all()
27862.733459829971, 27862.733459829971,
5.9518403867035365); 5.9518403867035365);
if (BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, double>::value))) if (BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, double>::value)))
{ {
test_one<linestring, polygon>("mysql_report_2015_09_08a", mysql_report_2015_09_08a, join_round32, end_round32, 0.0, 1.0); test_one<linestring, polygon>("mysql_report_2015_09_08a", mysql_report_2015_09_08a, join_round32, end_round32, 0.0, 1.0);
test_one<linestring, polygon>("mysql_report_2015_09_08b", mysql_report_2015_09_08b, join_round32, end_round32, 0.0, 1099511627778.0); test_one<linestring, polygon>("mysql_report_2015_09_08b", mysql_report_2015_09_08b, join_round32, end_round32, 0.0, 1099511627778.0);
@ -390,7 +390,7 @@ template <bool Clockwise, typename P>
void test_invalid() void test_invalid()
{ {
typedef typename bg::coordinate_type<P>::type coor_type; typedef typename bg::coordinate_type<P>::type coor_type;
if (! BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, double>::value))) if (! BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, double>::value)))
{ {
return; return;
} }

View File

@ -3,6 +3,10 @@
// Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -425,7 +429,7 @@ void test_aimes()
typedef bg::model::polygon<P> polygon; typedef bg::model::polygon<P> polygon;
typedef typename bg::coordinate_type<P>::type coor_type; typedef typename bg::coordinate_type<P>::type coor_type;
if (BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, float>::value))) if (BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, float>::value)))
{ {
std::cout << "This unit test can't be tested with float," std::cout << "This unit test can't be tested with float,"
<< " the coordinate values are too small." << std::endl; << " the coordinate values are too small." << std::endl;

View File

@ -3,8 +3,8 @@
// Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2016. // This file was modified by Oracle on 2016-2021.
// Modifications copyright (c) 2016, Oracle and/or its affiliates. // Modifications copyright (c) 2016-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -141,7 +141,7 @@ void test_all()
test_one<multi_linestring_type, polygon>("mikado4_small", mikado4, join_round32, end_flat, 1930.785, 10.0); test_one<multi_linestring_type, polygon>("mikado4_small", mikado4, join_round32, end_flat, 1930.785, 10.0);
} }
if (! BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, float>::value))) if (! BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, float>::value)))
{ {
// Coordinates in one linestring vary so much that // Coordinates in one linestring vary so much that
// length = geometry::math::sqrt(dx * dx + dy * dy); returns a value of inf for length // length = geometry::math::sqrt(dx * dx + dy * dy); returns a value of inf for length

View File

@ -3,8 +3,8 @@
// Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2016. // This file was modified by Oracle on 2016-2021.
// Modifications copyright (c) 2016, Oracle and/or its affiliates. // Modifications copyright (c) 2016-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -657,7 +657,7 @@ void test_all()
join_round32, end_round32, 0.0, -10.0); join_round32, end_round32, 0.0, -10.0);
// Check cases with extreme coordinates on assertions // Check cases with extreme coordinates on assertions
if (BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, double>::value))) if (BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, double>::value)))
{ {
test_one<multi_polygon_type, polygon_type>("mysql_report_2015_07_05_1", test_one<multi_polygon_type, polygon_type>("mysql_report_2015_07_05_1",
mysql_report_2015_07_05_1, mysql_report_2015_07_05_1,

View File

@ -3,8 +3,8 @@
// Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2016, 2019. // This file was modified by Oracle on 2016-2021.
// Modifications copyright (c) 2016, Oracle and/or its affiliates. // Modifications copyright (c) 2016-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -535,7 +535,7 @@ void test_all()
test_one<polygon_type, polygon_type>("italy_part2_5", italy_part2, test_one<polygon_type, polygon_type>("italy_part2_5", italy_part2,
join_round, end_flat, {12496082120, 12496082124}, 5 * 1000.0); join_round, end_flat, {12496082120, 12496082124}, 5 * 1000.0);
if (! BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, float>::value))) if (! BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, float>::value)))
{ {
ut_settings settings; ut_settings settings;
settings.set_test_validity(false); settings.set_test_validity(false);
@ -571,7 +571,7 @@ void test_all()
test_one<polygon_type, polygon_type>("ticket_10398_1_25", ticket_10398_1, join_miter, end_flat, 246.7329, -2.5); test_one<polygon_type, polygon_type>("ticket_10398_1_25", ticket_10398_1, join_miter, end_flat, 246.7329, -2.5);
} }
if (! BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, float>::value))) if (! BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, float>::value)))
{ {
// Test issue 369 as reported (1.15e-3) and some variants // Test issue 369 as reported (1.15e-3) and some variants
// Use high tolerance because output areas are very small // Use high tolerance because output areas are very small
@ -590,7 +590,7 @@ void test_all()
test_one<polygon_type, polygon_type>("issue_369_1000", issue_369, jr, er, 7.881e-10, distance / 1000.0, specific); test_one<polygon_type, polygon_type>("issue_369_1000", issue_369, jr, er, 7.881e-10, distance / 1000.0, specific);
} }
if (! BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, float>::value))) if (! BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, float>::value)))
{ {
// Test issue 555 as reported (-0.000001) and some variants // Test issue 555 as reported (-0.000001) and some variants
bg::strategy::buffer::join_round jr(180); bg::strategy::buffer::join_round jr(180);
@ -639,7 +639,7 @@ void test_all()
mysql_report_2015_02_17_3, mysql_report_2015_02_17_3,
join_round32, end_round32, 64.0, -1.0); join_round32, end_round32, 64.0, -1.0);
if (BOOST_GEOMETRY_CONDITION((boost::is_same<coor_type, double>::value))) if (BOOST_GEOMETRY_CONDITION((std::is_same<coor_type, double>::value)))
{ {
// These extreme testcases, containing huge coordinate differences // These extreme testcases, containing huge coordinate differences
// and huge buffer distances, are to verify assertions. // and huge buffer distances, are to verify assertions.

View File

@ -24,7 +24,6 @@
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>
#include <boost/foreach.hpp>
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
#include <expectation_limits.hpp> #include <expectation_limits.hpp>
@ -161,12 +160,12 @@ void test_buffer(std::string const& caseid,
typedef typename bg::tag<Geometry>::type tag; typedef typename bg::tag<Geometry>::type tag;
// TODO use something different here: // TODO use something different here:
std::string type = boost::is_same<tag, bg::polygon_tag>::value ? "poly" std::string type = std::is_same<tag, bg::polygon_tag>::value ? "poly"
: boost::is_same<tag, bg::linestring_tag>::value ? "line" : std::is_same<tag, bg::linestring_tag>::value ? "line"
: boost::is_same<tag, bg::point_tag>::value ? "point" : std::is_same<tag, bg::point_tag>::value ? "point"
: boost::is_same<tag, bg::multi_polygon_tag>::value ? "multipoly" : std::is_same<tag, bg::multi_polygon_tag>::value ? "multipoly"
: boost::is_same<tag, bg::multi_linestring_tag>::value ? "multiline" : std::is_same<tag, bg::multi_linestring_tag>::value ? "multiline"
: boost::is_same<tag, bg::multi_point_tag>::value ? "multipoint" : std::is_same<tag, bg::multi_point_tag>::value ? "multipoint"
: "" : ""
; ;
@ -184,8 +183,8 @@ void test_buffer(std::string const& caseid,
std::string end_name = EndTestProperties<EndStrategy>::name(); std::string end_name = EndTestProperties<EndStrategy>::name();
if ( BOOST_GEOMETRY_CONDITION(( if ( BOOST_GEOMETRY_CONDITION((
boost::is_same<tag, bg::point_tag>::value std::is_same<tag, bg::point_tag>::value
|| boost::is_same<tag, bg::multi_point_tag>::value )) ) || std::is_same<tag, bg::multi_point_tag>::value )) )
{ {
join_name.clear(); join_name.clear();
} }

View File

@ -3,8 +3,8 @@
// Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2020. // This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020 Oracle and/or its affiliates. // Modifications copyright (c) 2020-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -28,8 +28,8 @@
# endif # endif
#endif #endif
#include <boost/foreach.hpp>
#include <boost/geometry/io/svg/svg_mapper.hpp> #include <boost/geometry/io/svg/svg_mapper.hpp>
#include <boost/geometry/algorithms/buffer.hpp>
#include <boost/geometry/algorithms/intersection.hpp> #include <boost/geometry/algorithms/intersection.hpp>
@ -116,8 +116,7 @@ private :
std::map<point_type, int, bg::less<point_type> > offsets; std::map<point_type, int, bg::less<point_type> > offsets;
for (typename boost::range_iterator<Turns const>::type it = for (auto it = boost::begin(turns); it != boost::end(turns); ++it)
boost::begin(turns); it != boost::end(turns); ++it)
{ {
if (m_zoom && bg::disjoint(it->point, m_alternate_box)) if (m_zoom && bg::disjoint(it->point, m_alternate_box))
{ {
@ -192,9 +191,7 @@ private :
typedef typename boost::range_value<OffsettedRings const>::type ring_type; typedef typename boost::range_value<OffsettedRings const>::type ring_type;
typedef typename bg::point_type<ring_type>::type point_type; typedef typename bg::point_type<ring_type>::type point_type;
for(typename boost::range_iterator<Pieces const>::type it = boost::begin(pieces); for (auto it = boost::begin(pieces); it != boost::end(pieces); ++it)
it != boost::end(pieces);
++it)
{ {
const piece_type& piece = *it; const piece_type& piece = *it;
bg::segment_identifier seg_id = piece.first_seg_id; bg::segment_identifier seg_id = piece.first_seg_id;
@ -274,8 +271,7 @@ private :
template <typename TraversedRings> template <typename TraversedRings>
inline void map_traversed_rings(TraversedRings const& traversed_rings) inline void map_traversed_rings(TraversedRings const& traversed_rings)
{ {
for(typename boost::range_iterator<TraversedRings const>::type it for (auto it = boost::begin(traversed_rings); it != boost::end(traversed_rings); ++it)
= boost::begin(traversed_rings); it != boost::end(traversed_rings); ++it)
{ {
m_mapper.map(*it, "opacity:0.4;fill:none;stroke:rgb(0,255,0);stroke-width:2"); m_mapper.map(*it, "opacity:0.4;fill:none;stroke:rgb(0,255,0);stroke-width:2");
} }
@ -284,8 +280,7 @@ private :
template <typename OffsettedRings> template <typename OffsettedRings>
inline void map_offsetted_rings(OffsettedRings const& offsetted_rings) inline void map_offsetted_rings(OffsettedRings const& offsetted_rings)
{ {
for(typename boost::range_iterator<OffsettedRings const>::type it for (auto it = boost::begin(offsetted_rings); it != boost::end(offsetted_rings); ++it)
= boost::begin(offsetted_rings); it != boost::end(offsetted_rings); ++it)
{ {
if (it->discarded()) if (it->discarded())
{ {
@ -349,14 +344,7 @@ public :
void map_input_output(Mapper& mapper, Geometry const& geometry, void map_input_output(Mapper& mapper, Geometry const& geometry,
GeometryBuffer const& buffered, bool negative) GeometryBuffer const& buffered, bool negative)
{ {
bool const areal = boost::is_same bool const areal = bg::util::is_areal<Geometry>::value;
<
typename bg::tag_cast
<
typename bg::tag<Geometry>::type,
bg::areal_tag
>::type, bg::areal_tag
>::type::value;
if (m_zoom) if (m_zoom)
{ {
@ -385,7 +373,7 @@ public :
bg::detail::overlay::assign_null_policy bg::detail::overlay::assign_null_policy
>(geometry, strategy, rescale_policy, turns, policy); >(geometry, strategy, rescale_policy, turns, policy);
BOOST_FOREACH(turn_info const& turn, turns) for (turn_info const& turn : turns)
{ {
mapper.map(turn.point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1", 3); mapper.map(turn.point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1", 3);
} }

View File

@ -2,6 +2,11 @@
// Unit Test Helper // Unit Test Helper
// Copyright (c) 2010-2019 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2010-2019 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -132,7 +137,7 @@ public :
return; return;
} }
BOOST_FOREACH(pair_type const& p, points) for (pair_type const& p : points)
{ {
mappers.push_back(new mapper_visitor<Point>(complete_caseid, p.second, p.first)); mappers.push_back(new mapper_visitor<Point>(complete_caseid, p.second, p.first));
} }

View File

@ -5,9 +5,8 @@
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014, 2015. // This file was modified by Oracle on 2014-2021.
// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -91,7 +90,7 @@ void test_2d()
coord_type m = (std::numeric_limits<coord_type>::max)(); coord_type m = (std::numeric_limits<coord_type>::max)();
bg::append(ls, P(coord_type(m), coord_type(-m))); bg::append(ls, P(coord_type(m), coord_type(-m)));
bg::append(ls, P(coord_type(0.0001), coord_type(0.000))); bg::append(ls, P(coord_type(0.0001), coord_type(0.000)));
if (BOOST_GEOMETRY_CONDITION((boost::is_same<typename bg::coordinate_type<P>::type, double>::value))) if (BOOST_GEOMETRY_CONDITION((std::is_same<typename bg::coordinate_type<P>::type, double>::value)))
{ {
// for doubles the INF is detected and the calculation stopped // for doubles the INF is detected and the calculation stopped
// currently for Geometries for which the centroid can't be calculated // currently for Geometries for which the centroid can't be calculated

View File

@ -2,6 +2,10 @@
// Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -9,8 +13,6 @@
#ifndef BOOST_GEOMETRY_TEST_CHECK_VALIDITY_HPP #ifndef BOOST_GEOMETRY_TEST_CHECK_VALIDITY_HPP
#define BOOST_GEOMETRY_TEST_CHECK_VALIDITY_HPP #define BOOST_GEOMETRY_TEST_CHECK_VALIDITY_HPP
#include <boost/foreach.hpp>
#include <boost/geometry/algorithms/is_valid.hpp> #include <boost/geometry/algorithms/is_valid.hpp>
template<typename Geometry, typename G1, typename G2> template<typename Geometry, typename G1, typename G2>
@ -64,7 +66,7 @@ struct check_validity<Geometry, void>
std::string& message) std::string& message)
{ {
typedef typename boost::range_value<Geometry>::type single_type; typedef typename boost::range_value<Geometry>::type single_type;
BOOST_FOREACH(single_type const& element, geometry) for (single_type const& element : geometry)
{ {
if (! is_output_valid(element, case_id, g1, g2, message)) if (! is_output_valid(element, case_id, g1, g2, message))
{ {

View File

@ -6,9 +6,8 @@
// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
// Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2013-2014 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014, 2017. // This file was modified by Oracle on 2014-2021.
// Modifications copyright (c) 2014-2017, Oracle and/or its affiliates. // Modifications copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -22,9 +21,6 @@
#include <sstream> #include <sstream>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_same.hpp>
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/comparable_distance.hpp> #include <boost/geometry/algorithms/comparable_distance.hpp>
@ -188,8 +184,8 @@ struct test_variant_different_default_strategy
variant_type v1, v2; variant_type v1, v2;
BOOST_MPL_ASSERT(( BOOST_GEOMETRY_STATIC_ASSERT(
boost::is_same (std::is_same
< <
typename bg::comparable_distance_result typename bg::comparable_distance_result
< <
@ -199,8 +195,8 @@ struct test_variant_different_default_strategy
< <
point_type, point_type, bg::default_strategy point_type, point_type, bg::default_strategy
>::type >::type
> >::value),
)); "Unexpected result type");
// Default strategy // Default strategy
v1 = point; v1 = point;
@ -261,27 +257,27 @@ struct test_variant_same_default_strategy
variant_type v1, v2; variant_type v1, v2;
BOOST_MPL_ASSERT(( BOOST_GEOMETRY_STATIC_ASSERT(
boost::is_same (std::is_same
< <
typename bg::comparable_distance_result typename bg::comparable_distance_result
< <
variant_type, variant_type, bg::default_strategy variant_type, variant_type, bg::default_strategy
>::type, >::type,
ExpectedResultType ExpectedResultType
> >::value),
)); "Unexpected result type");
BOOST_MPL_ASSERT(( BOOST_GEOMETRY_STATIC_ASSERT(
boost::is_same (std::is_same
< <
typename bg::comparable_distance_result typename bg::comparable_distance_result
< <
point_type, point_type, bg::default_strategy point_type, point_type, bg::default_strategy
>::type, >::type,
ExpectedResultType ExpectedResultType
> >::value),
)); "Unexpected result type");
// Default strategy // Default strategy
v1 = point; v1 = point;
@ -352,27 +348,27 @@ struct test_variant_with_strategy
strategy_type strategy; strategy_type strategy;
BOOST_MPL_ASSERT(( BOOST_GEOMETRY_STATIC_ASSERT(
boost::is_same (std::is_same
< <
typename bg::comparable_distance_result typename bg::comparable_distance_result
< <
variant_type, variant_type, strategy_type variant_type, variant_type, strategy_type
>::type, >::type,
ExpectedResultType ExpectedResultType
> >::value),
)); "Unexpected result type");
BOOST_MPL_ASSERT(( BOOST_GEOMETRY_STATIC_ASSERT(
boost::is_same (std::is_same
< <
typename bg::comparable_distance_result typename bg::comparable_distance_result
< <
segment_type, linestring_type, strategy_type segment_type, linestring_type, strategy_type
>::type, >::type,
ExpectedResultType ExpectedResultType
> >::value),
)); "Unexpected result type");
// Passed strategy // Passed strategy
v1 = seg; v1 = seg;
@ -422,7 +418,7 @@ struct test_variant_with_strategy
} }
}; };
template <typename T, bool IsIntergral = boost::is_integral<T>::value> template <typename T, bool IsIntergral = std::is_integral<T>::value>
struct check_result struct check_result
{ {
template <typename ExpectedResult> template <typename ExpectedResult>
@ -459,23 +455,24 @@ struct test_variant_boxes
variant_type v1 = box1, v2 = box2; variant_type v1 = box1, v2 = box2;
typedef typename boost::mpl::if_c typedef typename std::conditional
< <
boost::is_float<T>::value, std::is_floating_point<T>::value,
double, double,
typename bg::util::detail::default_integral::type typename bg::util::detail::default_integral::type
>::type expected_result_type; >::type expected_result_type;
BOOST_MPL_ASSERT(( BOOST_GEOMETRY_STATIC_ASSERT(
boost::is_same (std::is_same
< <
typename bg::comparable_distance_result typename bg::comparable_distance_result
< <
variant_type, variant_type, bg::default_strategy variant_type, variant_type, bg::default_strategy
>::type, >::type,
expected_result_type expected_result_type
> >::value),
)); "Unexpected result type"
);
// Default strategy // Default strategy
check_result<T>::apply(bg::comparable_distance(v1, v2), check_result<T>::apply(bg::comparable_distance(v1, v2),
@ -491,7 +488,7 @@ struct test_variant_boxes
int test_main(int, char* []) int test_main(int, char* [])
{ {
test_double_result_from_integer<int>(); test_double_result_from_integer<int>();
test_double_result_from_integer<boost::long_long_type>(); test_double_result_from_integer<long long>();
test_all<bg::model::d2::point_xy<float> >(); test_all<bg::model::d2::point_xy<float> >();
test_all<bg::model::d2::point_xy<double> >(); test_all<bg::model::d2::point_xy<double> >();

View File

@ -1,6 +1,6 @@
// Boost.Geometry // Boost.Geometry
// Copyright (c) 2016 Oracle and/or its affiliates. // Copyright (c) 2016-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -82,12 +82,12 @@ void test_box_box()
template <typename P> template <typename P>
void test_point_polygon() void test_point_polygon()
{ {
typename boost::mpl::if_ std::conditional_t
< <
boost::is_same<typename bg::cs_tag<P>::type, bg::geographic_tag>, std::is_same<typename bg::cs_tag<P>::type, bg::geographic_tag>::value,
bg::strategy::within::geographic_winding<P>, bg::strategy::within::geographic_winding<P>,
bg::strategy::within::spherical_winding<P> bg::strategy::within::spherical_winding<P>
>::type s; > s;
typedef bg::model::polygon<P> poly; typedef bg::model::polygon<P> poly;

View File

@ -1,8 +1,7 @@
// Boost.Geometry // Boost.Geometry
// Unit Test // Unit Test
// Copyright (c) 2019, Oracle and/or its affiliates. // Copyright (c) 2019-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
@ -89,7 +88,7 @@ inline void test_one(std::string const& ring_wkt, bg::order_selector expected)
std::rotate(boost::begin(ring), boost::begin(ring) + 1, boost::end(ring)); std::rotate(boost::begin(ring), boost::begin(ring) + 1, boost::end(ring));
// it seems that area method doesn't work for invalid "opened" polygons // it seems that area method doesn't work for invalid "opened" polygons
//if (! boost::is_same<cs_tag, bg::geographic_tag>::value) //if (! std::is_same<cs_tag, bg::geographic_tag>::value)
{ {
P p = bg::range::front(ring); P p = bg::range::front(ring);
bg::range::push_back(ring, p); bg::range::push_back(ring, p);

View File

@ -3,8 +3,8 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// //
// This file was modified by Oracle on 2017, 2018. // This file was modified by Oracle on 2017-2021.
// Modifications copyright (c) 2017-2018 Oracle and/or its affiliates. // Modifications copyright (c) 2017-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// //
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -15,19 +15,20 @@
#include <algorithms/test_overlay.hpp> #include <algorithms/test_overlay.hpp>
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/detail/partition.hpp>
#include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
#include <boost/geometry/algorithms/intersects.hpp>
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/geometries/multi_point.hpp> #include <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/register/point.hpp> #include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/algorithms/detail/partition.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#if defined(TEST_WITH_SVG) #if defined(TEST_WITH_SVG)
# include <boost/geometry/io/svg/svg_mapper.hpp> # include <boost/geometry/io/svg/svg_mapper.hpp>
#endif #endif
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/random/linear_congruential.hpp> #include <boost/random/linear_congruential.hpp>
#include <boost/random/uniform_int.hpp> #include <boost/random/uniform_int.hpp>
@ -151,7 +152,7 @@ void test_boxes(std::string const& wkt_box_list, double expected_area, int expec
std::vector<sample> boxes; std::vector<sample> boxes;
int index = 1; int index = 1;
BOOST_FOREACH(std::string const& wkt, wkt_boxes) for (std::string const& wkt : wkt_boxes)
{ {
boxes.push_back(sample(index++, wkt)); boxes.push_back(sample(index++, wkt));
} }
@ -229,10 +230,10 @@ void test_points(std::string const& wkt1, std::string const& wkt2, int expected_
bg::read_wkt(wkt2, mp2); bg::read_wkt(wkt2, mp2);
int id = 1; int id = 1;
BOOST_FOREACH(point_item& p, mp1) for (point_item& p : mp1)
{ p.id = id++; } { p.id = id++; }
id = 1; id = 1;
BOOST_FOREACH(point_item& p, mp2) for (point_item& p : mp2)
{ p.id = id++; } { p.id = id++; }
point_visitor visitor; point_visitor visitor;
@ -352,9 +353,9 @@ void test_many_points(int seed, int size, int count)
// Test equality in quadratic loop // Test equality in quadratic loop
int expected_count = 0; int expected_count = 0;
BOOST_FOREACH(point_item const& item1, mp1) for (point_item const& item1 : mp1)
{ {
BOOST_FOREACH(point_item const& item2, mp2) for (point_item const& item2 : mp2)
{ {
if (bg::equals(item1, item2)) if (bg::equals(item1, item2))
{ {
@ -395,11 +396,11 @@ void test_many_points(int seed, int size, int count)
BOOST_CHECK_EQUAL(visitor.count, expected_count); BOOST_CHECK_EQUAL(visitor.count, expected_count);
#if defined(TEST_WITH_SVG) #if defined(TEST_WITH_SVG)
BOOST_FOREACH(point_item const& item, mp1) for (point_item const& item : mp1)
{ {
mapper.map(item, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1", 8); mapper.map(item, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1", 8);
} }
BOOST_FOREACH(point_item const& item, mp2) for (point_item const& item : mp2)
{ {
mapper.map(item, "fill:rgb(0,128,255);stroke:rgb(0,0,100);stroke-width:1", 4); mapper.map(item, "fill:rgb(0,128,255);stroke:rgb(0,0,100);stroke-width:1", 4);
} }
@ -447,9 +448,9 @@ void test_many_boxes(int seed, int size, int count)
// Test equality in quadratic loop // Test equality in quadratic loop
int expected_count = 0; int expected_count = 0;
double expected_area = 0.0; double expected_area = 0.0;
BOOST_FOREACH(box_item<box_type> const& item1, boxes) for (box_item<box_type> const& item1 : boxes)
{ {
BOOST_FOREACH(box_item<box_type> const& item2, boxes) for (box_item<box_type> const& item2 : boxes)
{ {
if (item1.id < item2.id) if (item1.id < item2.id)
{ {
@ -478,7 +479,7 @@ void test_many_boxes(int seed, int size, int count)
p.x = size + 1; p.y = size + 1; mapper.add(p); p.x = size + 1; p.y = size + 1; mapper.add(p);
} }
BOOST_FOREACH(box_item<box_type> const& item, boxes) for (box_item<box_type> const& item : boxes)
{ {
mapper.map(item.box, "opacity:0.6;fill:rgb(50,50,210);stroke:rgb(0,0,0);stroke-width:1"); mapper.map(item.box, "opacity:0.6;fill:rgb(50,50,210);stroke:rgb(0,0,0);stroke-width:1");
} }
@ -515,9 +516,9 @@ void test_two_collections(int seed1, int seed2, int size, int count)
// Get expectations in quadratic loop // Get expectations in quadratic loop
int expected_count = 0; int expected_count = 0;
double expected_area = 0.0; double expected_area = 0.0;
BOOST_FOREACH(box_item<box_type> const& item1, boxes1) for (box_item<box_type> const& item1 : boxes1)
{ {
BOOST_FOREACH(box_item<box_type> const& item2, boxes2) for (box_item<box_type> const& item2 : boxes2)
{ {
if (bg::intersects(item1.box, item2.box)) if (bg::intersects(item1.box, item2.box))
{ {
@ -543,11 +544,11 @@ void test_two_collections(int seed1, int seed2, int size, int count)
p.x = size + 1; p.y = size + 1; mapper.add(p); p.x = size + 1; p.y = size + 1; mapper.add(p);
} }
BOOST_FOREACH(box_item<box_type> const& item, boxes1) for (box_item<box_type> const& item : boxes1)
{ {
mapper.map(item.box, "opacity:0.6;fill:rgb(50,50,210);stroke:rgb(0,0,0);stroke-width:1"); mapper.map(item.box, "opacity:0.6;fill:rgb(50,50,210);stroke:rgb(0,0,0);stroke-width:1");
} }
BOOST_FOREACH(box_item<box_type> const& item, boxes2) for (box_item<box_type> const& item : boxes2)
{ {
mapper.map(item.box, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1"); mapper.map(item.box, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
} }
@ -584,9 +585,9 @@ void test_heterogenuous_collections(int seed1, int seed2, int size, int count)
// Get expectations in quadratic loop // Get expectations in quadratic loop
int expected_count = 0; int expected_count = 0;
BOOST_FOREACH(point_item const& point, points) for (point_item const& point : points)
{ {
BOOST_FOREACH(box_item<box_type> const& box_item, boxes) for (box_item<box_type> const& box_item : boxes)
{ {
if (bg::within(point, box_item.box)) if (bg::within(point, box_item.box))
{ {
@ -609,11 +610,11 @@ void test_heterogenuous_collections(int seed1, int seed2, int size, int count)
p.x = size + 1; p.y = size + 1; mapper.add(p); p.x = size + 1; p.y = size + 1; mapper.add(p);
} }
BOOST_FOREACH(point_item const& point, points) for (point_item const& point : points)
{ {
mapper.map(point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1", 8); mapper.map(point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1", 8);
} }
BOOST_FOREACH(box_item<box_type> const& item, boxes) for (box_item<box_type> const& item : boxes)
{ {
mapper.map(item.box, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1"); mapper.map(item.box, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
} }

View File

@ -11,7 +11,7 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#include <iostream>
#include <string> #include <string>
#define BOOST_GEOMETRY_UNIT_TEST_SECTIONALIZE #define BOOST_GEOMETRY_UNIT_TEST_SECTIONALIZE
@ -58,7 +58,7 @@ void test_sectionalize(std::string const /*caseid*/, Geometry const& geometry, s
view_type const view_type const
>::type range_iterator; >::type range_iterator;
BOOST_FOREACH(typename sections::value_type const& sec, s) for (typename sections::value_type const& sec : s)
{ {
cview_type cview(bg::range_by_section(geometry, sec)); cview_type cview(bg::range_by_section(geometry, sec));
view_type view(cview); view_type view(cview);

View File

@ -5,8 +5,8 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2020. // This file was modified by Oracle on 2020-2021.
// Modifications copyright (c) 2020, Oracle and/or its affiliates. // Modifications copyright (c) 2020-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -102,7 +102,7 @@ void test_sectionalize(std::string const& caseid, G const& g, std::size_t sectio
// Check if sections are consecutive and consistent // Check if sections are consecutive and consistent
int previous_index = -1; int previous_index = -1;
BOOST_FOREACH(typename sections::value_type const& sec, s) for (typename sections::value_type const& sec : s)
{ {
if (sec.begin_index > 0) if (sec.begin_index > 0)
{ {

View File

@ -1,8 +1,7 @@
// Boost.Geometry // Boost.Geometry
// Unit Test // Unit Test
// Copyright (c) 2019 Oracle and/or its affiliates. // Copyright (c) 2019-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -34,14 +33,14 @@ template <typename TupleM, typename TupleS>
void test_range_values() void test_range_values()
{ {
typedef typename bgd::tupled_range_values<TupleM>::type tuple_s; typedef typename bgd::tupled_range_values<TupleM>::type tuple_s;
BOOST_CHECK_EQUAL((boost::is_same<tuple_s, TupleS>::value), true); BOOST_CHECK_EQUAL((std::is_same<tuple_s, TupleS>::value), true);
} }
template <typename TupleM, typename TupleBI> template <typename TupleM, typename TupleBI>
void test_back_inserters() void test_back_inserters()
{ {
typedef typename bgd::tupled_back_inserters<TupleM>::type tuple_bi; typedef typename bgd::tupled_back_inserters<TupleM>::type tuple_bi;
BOOST_CHECK_EQUAL((boost::is_same<tuple_bi, TupleBI>::value), true); BOOST_CHECK_EQUAL((std::is_same<tuple_bi, TupleBI>::value), true);
TupleM tup; TupleM tup;
bgd::tupled_back_inserters<TupleM>::apply(tup); bgd::tupled_back_inserters<TupleM>::apply(tup);

View File

@ -5,6 +5,9 @@
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2021 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 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -20,8 +23,6 @@
#include "test_distance.hpp" #include "test_distance.hpp"
#include <boost/array.hpp> #include <boost/array.hpp>
#include <boost/mpl/if.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/point_xy.hpp>
@ -81,7 +82,9 @@ void test_distance_point()
BOOST_CONCEPT_ASSERT( (bg::concepts::PointDistanceStrategy<taxicab_distance, P, P>) ); BOOST_CONCEPT_ASSERT( (bg::concepts::PointDistanceStrategy<taxicab_distance, P, P>) );
typedef typename services::return_type<taxicab_distance, P, P>::type cab_return_type; typedef typename services::return_type<taxicab_distance, P, P>::type cab_return_type;
BOOST_MPL_ASSERT((boost::is_same<cab_return_type, typename bg::coordinate_type<P>::type>)); BOOST_GEOMETRY_STATIC_ASSERT(
(std::is_same<cab_return_type, typename bg::coordinate_type<P>::type>::value),
"Unexpected result type");
taxicab_distance tcd; taxicab_distance tcd;
cab_return_type d = bg::distance(p1, p2, tcd); cab_return_type d = bg::distance(p1, p2, tcd);
@ -412,8 +415,8 @@ void test_large_integers()
bg::read_wkt(a, da); bg::read_wkt(a, da);
bg::read_wkt(b, db); bg::read_wkt(b, db);
BOOST_AUTO(idist, bg::distance(ia, ib)); auto const idist = bg::distance(ia, ib);
BOOST_AUTO(ddist, bg::distance(da, db)); auto const ddist = bg::distance(da, db);
BOOST_CHECK_MESSAGE(std::abs(idist - ddist) < 0.1, BOOST_CHECK_MESSAGE(std::abs(idist - ddist) < 0.1,
"within<a double> different from within<an int>"); "within<a double> different from within<an int>");
@ -431,8 +434,8 @@ void test_large_integers()
bg::read_wkt(a, da); bg::read_wkt(a, da);
bg::read_wkt(b, db); bg::read_wkt(b, db);
BOOST_AUTO(idist, bg::distance(ia, ib)); auto const idist = bg::distance(ia, ib);
BOOST_AUTO(ddist, bg::distance(da, db)); auto const ddist = bg::distance(da, db);
BOOST_CHECK_MESSAGE(std::abs(idist - ddist) < 0.1, BOOST_CHECK_MESSAGE(std::abs(idist - ddist) < 0.1,
"within<a double> different from within<an int>"); "within<a double> different from within<an int>");
@ -457,16 +460,16 @@ void test_variant()
variant_type v1, v2; variant_type v1, v2;
BOOST_MPL_ASSERT(( BOOST_GEOMETRY_STATIC_ASSERT(
boost::is_same (std::is_same
< <
typename bg::distance_result typename bg::distance_result
< <
variant_type, variant_type, bg::default_strategy variant_type, variant_type, bg::default_strategy
>::type, >::type,
double double
> >::value),
)); "Unexpected result type");
// Default strategy // Default strategy
v1 = point; v1 = point;

View File

@ -1,8 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test // Unit Test
// Copyright (c) 2014-2020 Oracle and/or its affiliates. // Copyright (c) 2014-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -15,8 +14,6 @@
#include <iterator> #include <iterator>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/or.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/range/value_type.hpp> #include <boost/range/value_type.hpp>
@ -46,17 +43,13 @@ struct distance_from_bg
{ {
template <typename G> template <typename G>
struct use_distance_from_bg struct use_distance_from_bg
{ : util::bool_constant
typedef typename boost::mpl::or_
< <
boost::is_same<typename tag<G>::type, point_tag>, std::is_same<typename tag<G>::type, point_tag>::value
typename boost::mpl::or_ || std::is_same<typename tag<G>::type, segment_tag>::value
< || std::is_same<typename tag<G>::type, box_tag>::value
boost::is_same<typename tag<G>::type, segment_tag>, >
boost::is_same<typename tag<G>::type, box_tag> {};
>::type
>::type type;
};
template <typename Geometry1, typename Geometry2, typename Strategy> template <typename Geometry1, typename Geometry2, typename Strategy>
static inline static inline
@ -65,8 +58,10 @@ struct distance_from_bg
Geometry2 const& geometry2, Geometry2 const& geometry2,
Strategy const& strategy) Strategy const& strategy)
{ {
BOOST_MPL_ASSERT((typename use_distance_from_bg<Geometry1>::type)); BOOST_GEOMETRY_STATIC_ASSERT((use_distance_from_bg<Geometry1>::value),
BOOST_MPL_ASSERT((typename use_distance_from_bg<Geometry2>::type)); "Unexpected kind of Geometry1");
BOOST_GEOMETRY_STATIC_ASSERT((use_distance_from_bg<Geometry2>::value),
"Unexpected kind of Geometry1");
return geometry::distance(geometry1, geometry2, strategy); return geometry::distance(geometry1, geometry2, strategy);
} }

View File

@ -1,25 +1,24 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test // Unit Test
// Copyright (c) 2017-2020 Oracle and/or its affiliates. // Copyright (c) 2017-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
#ifdef BOOST_GEOMETRY_TEST_DEBUG
#include <iostream> #include <iostream>
#endif
#include <string>
#ifndef BOOST_TEST_MODULE #ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_distance_geographic_linear_areal #define BOOST_TEST_MODULE test_distance_geographic_linear_areal
#endif #endif
#include <boost/type_traits/is_same.hpp>
#include <boost/test/included/unit_test.hpp> #include <boost/test/included/unit_test.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include "test_distance_geo_common.hpp" #include "test_distance_geo_common.hpp"
//#include "test_empty_geometry.hpp" //#include "test_empty_geometry.hpp"

View File

@ -1,8 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test // Unit Test
// Copyright (c) 2017-2020 Oracle and/or its affiliates. // Copyright (c) 2017-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -13,11 +12,7 @@
#define BOOST_TEST_MODULE test_distance_geographic_areal_areal #define BOOST_TEST_MODULE test_distance_geographic_areal_areal
#endif #endif
#include <boost/type_traits/is_same.hpp>
#include <boost/test/included/unit_test.hpp> #include <boost/test/included/unit_test.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include "test_distance_geo_common.hpp" #include "test_distance_geo_common.hpp"
#include "test_empty_geometry.hpp" #include "test_empty_geometry.hpp"

View File

@ -1,25 +1,22 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test // Unit Test
// Copyright (c) 2017-2020 Oracle and/or its affiliates. // Copyright (c) 2017-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
#ifdef BOOST_GEOMETRY_TEST_DEBUG
#include <iostream> #include <iostream>
#endif
#ifndef BOOST_TEST_MODULE #ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_distance_geographic_linear_areal #define BOOST_TEST_MODULE test_distance_geographic_linear_areal
#endif #endif
#include <boost/type_traits/is_same.hpp>
#include <boost/test/included/unit_test.hpp> #include <boost/test/included/unit_test.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include "test_distance_geo_common.hpp" #include "test_distance_geo_common.hpp"
#include "test_empty_geometry.hpp" #include "test_empty_geometry.hpp"

View File

@ -1,25 +1,22 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test // Unit Test
// Copyright (c) 2018-2020 Oracle and/or its affiliates. // Copyright (c) 2018-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
#ifdef BOOST_GEOMETRY_TEST_DEBUG
#include <iostream> #include <iostream>
#endif
#ifndef BOOST_TEST_MODULE #ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_distance_geographic_linear_linear #define BOOST_TEST_MODULE test_distance_geographic_linear_linear
#endif #endif
#include <boost/type_traits/is_same.hpp>
#include <boost/test/included/unit_test.hpp> #include <boost/test/included/unit_test.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include "test_distance_geo_common.hpp" #include "test_distance_geo_common.hpp"
#include "test_empty_geometry.hpp" #include "test_empty_geometry.hpp"

View File

@ -1,25 +1,22 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test // Unit Test
// Copyright (c) 2017-2020, Oracle and/or its affiliates. // Copyright (c) 2017-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
#ifdef BOOST_GEOMETRY_TEST_DEBUG
#include <iostream> #include <iostream>
#endif
#ifndef BOOST_TEST_MODULE #ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_distance_geographic_pointlike_areal #define BOOST_TEST_MODULE test_distance_geographic_pointlike_areal
#endif #endif
#include <boost/type_traits/is_same.hpp>
#include <boost/test/included/unit_test.hpp> #include <boost/test/included/unit_test.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include "test_distance_geo_common.hpp" #include "test_distance_geo_common.hpp"
#include "test_empty_geometry.hpp" #include "test_empty_geometry.hpp"

View File

@ -1,8 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test // Unit Test
// Copyright (c) 2014-2017, Oracle and/or its affiliates. // Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -16,28 +15,16 @@
#include <string> #include <string>
#include <boost/math/special_functions/fpclassify.hpp> #include <boost/math/special_functions/fpclassify.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/geometry/geometries/point.hpp> #include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/algorithms/comparable_distance.hpp>
#include <boost/geometry/geometries/segment.hpp> #include <boost/geometry/algorithms/num_interior_rings.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/polygon.hpp> #include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/wkt/write.hpp> #include <boost/geometry/io/wkt/write.hpp>
#include <boost/geometry/io/dsv/write.hpp> #include <boost/geometry/io/dsv/write.hpp>
#include <boost/geometry/algorithms/num_interior_rings.hpp>
#include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/algorithms/comparable_distance.hpp>
#include <boost/geometry/strategies/strategies.hpp> #include <boost/geometry/strategies/strategies.hpp>
#include <from_wkt.hpp> #include <from_wkt.hpp>
@ -207,11 +194,11 @@ private:
Strategy, G1, G2 Strategy, G1, G2
>::type distance_result_from_strategy; >::type distance_result_from_strategy;
static const bool same_regular = boost::is_same static const bool same_regular = std::is_same
< <
default_distance_result, default_distance_result,
distance_result_from_strategy distance_result_from_strategy
>::type::value; >::value;
BOOST_CHECK( same_regular ); BOOST_CHECK( same_regular );
@ -231,11 +218,11 @@ private:
G2 G2
>::type comparable_distance_result_from_strategy; >::type comparable_distance_result_from_strategy;
static const bool same_comparable = boost::is_same static const bool same_comparable = std::is_same
< <
default_comparable_distance_result, default_comparable_distance_result,
comparable_distance_result_from_strategy comparable_distance_result_from_strategy
>::type::value; >::value;
BOOST_CHECK( same_comparable ); BOOST_CHECK( same_comparable );

View File

@ -1,9 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test // Unit Test
// Copyright (c) 2016-2017, Oracle and/or its affiliates. // Copyright (c) 2016-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
@ -14,29 +14,18 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <boost/mpl/assert.hpp> #include <boost/geometry/algorithms/distance.hpp>
#include <boost/type_traits/is_integral.hpp> #include <boost/geometry/algorithms/num_interior_rings.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/geometry/geometries/point.hpp> #include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/segment.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/wkt/write.hpp> #include <boost/geometry/io/wkt/write.hpp>
#include <boost/geometry/io/dsv/write.hpp> #include <boost/geometry/io/dsv/write.hpp>
#include <boost/geometry/algorithms/num_interior_rings.hpp>
#include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/strategies/strategies.hpp> #include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/util/condition.hpp>
#include <from_wkt.hpp> #include <from_wkt.hpp>
#include <string_from_type.hpp> #include <string_from_type.hpp>
@ -229,7 +218,7 @@ template <typename Tag> struct dispatch
}; };
// Specialization for segments // Specialization for segments
template <> struct dispatch<boost::geometry::segment_tag> template <> struct dispatch<bg::segment_tag>
{ {
template <typename Segment> template <typename Segment>
static inline Segment swap(Segment const& s) static inline Segment swap(Segment const& s)
@ -259,7 +248,7 @@ template <> struct dispatch<boost::geometry::segment_tag>
}; };
// Specialization for boxes // Specialization for boxes
template <> struct dispatch<boost::geometry::box_tag> template <> struct dispatch<bg::box_tag>
{ {
template <typename T> template <typename T>
static inline T swap(T const& t) static inline T swap(T const& t)
@ -283,7 +272,7 @@ template <> struct dispatch<boost::geometry::box_tag>
// Specialization for points // Specialization for points
template <> struct dispatch<boost::geometry::point_tag> template <> struct dispatch<bg::point_tag>
{ {
template <typename T> template <typename T>
static inline T swap(T const& t) static inline T swap(T const& t)
@ -412,11 +401,11 @@ struct test_distance_of_geometries<Geometry1, Geometry2, 0, 0>
Strategy, Geometry1, Geometry2 Strategy, Geometry1, Geometry2
>::type distance_result_from_strategy; >::type distance_result_from_strategy;
static const bool same_regular = boost::is_same static const bool same_regular = std::is_same
< <
default_distance_result, default_distance_result,
distance_result_from_strategy distance_result_from_strategy
>::type::value; >::value;
BOOST_CHECK(same_regular); BOOST_CHECK(same_regular);
@ -482,12 +471,12 @@ struct test_distance_of_geometries<Geometry1, Geometry2, 0, 0>
{ {
Geometry1 g1 = dispatch Geometry1 g1 = dispatch
< <
typename boost::geometry::tag<Geometry1>::type typename bg::tag<Geometry1>::type
>::swap(geometry1); >::swap(geometry1);
Geometry2 g2 = dispatch Geometry2 g2 = dispatch
< <
typename boost::geometry::tag<Geometry2>::type typename bg::tag<Geometry2>::type
>::swap(geometry2); >::swap(geometry2);
// check distance with given strategy // check distance with given strategy
@ -510,12 +499,12 @@ struct test_distance_of_geometries<Geometry1, Geometry2, 0, 0>
{ {
Geometry1 g1 = dispatch Geometry1 g1 = dispatch
< <
typename boost::geometry::tag<Geometry1>::type typename bg::tag<Geometry1>::type
>::mirror(geometry1); >::mirror(geometry1);
Geometry2 g2 = dispatch Geometry2 g2 = dispatch
< <
typename boost::geometry::tag<Geometry2>::type typename bg::tag<Geometry2>::type
>::mirror(geometry2); >::mirror(geometry2);
// check distance with given strategy // check distance with given strategy

View File

@ -1,8 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test // Unit Test
// Copyright (c) 2014-2017, Oracle and/or its affiliates. // Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -12,31 +11,21 @@
#ifndef BOOST_GEOMETRY_TEST_DISTANCE_SE_COMMON_HPP #ifndef BOOST_GEOMETRY_TEST_DISTANCE_SE_COMMON_HPP
#define BOOST_GEOMETRY_TEST_DISTANCE_SE_COMMON_HPP #define BOOST_GEOMETRY_TEST_DISTANCE_SE_COMMON_HPP
#ifdef BOOST_GEOMETRY_TEST_DEBUG
#include <iostream> #include <iostream>
#endif
#include <string> #include <string>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/segment.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/wkt/write.hpp>
#include <boost/geometry/io/dsv/write.hpp>
#include <boost/geometry/algorithms/num_interior_rings.hpp> #include <boost/geometry/algorithms/num_interior_rings.hpp>
#include <boost/geometry/algorithms/distance.hpp> #include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/algorithms/comparable_distance.hpp> #include <boost/geometry/algorithms/comparable_distance.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/io/wkt/write.hpp>
#include <boost/geometry/io/dsv/write.hpp>
#include <boost/geometry/strategies/strategies.hpp> #include <boost/geometry/strategies/strategies.hpp>
#include <from_wkt.hpp> #include <from_wkt.hpp>
@ -192,11 +181,11 @@ struct test_distance_of_geometries<Geometry1, Geometry2, 0, 0>
Strategy, Geometry1, Geometry2 Strategy, Geometry1, Geometry2
>::type distance_result_from_strategy; >::type distance_result_from_strategy;
static const bool same_regular = boost::is_same static const bool same_regular = std::is_same
< <
default_distance_result, default_distance_result,
distance_result_from_strategy distance_result_from_strategy
>::type::value; >::value;
BOOST_CHECK(same_regular); BOOST_CHECK(same_regular);
@ -212,11 +201,11 @@ struct test_distance_of_geometries<Geometry1, Geometry2, 0, 0>
Geometry2 Geometry2
>::type comparable_distance_result_from_strategy; >::type comparable_distance_result_from_strategy;
static const bool same_comparable = boost::is_same static const bool same_comparable = std::is_same
< <
default_comparable_distance_result, default_comparable_distance_result,
comparable_distance_result_from_strategy comparable_distance_result_from_strategy
>::type::value; >::value;
BOOST_CHECK( same_comparable ); BOOST_CHECK( same_comparable );

View File

@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test // Unit Test
// Copyright (c) 2015-2020, Oracle and/or its affiliates. // Copyright (c) 2015-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@ -22,34 +22,24 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <geometry_test_common.hpp>
#include <from_wkt.hpp>
#include <boost/numeric/conversion/bounds.hpp> #include <boost/numeric/conversion/bounds.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp> #include <from_wkt.hpp>
#include <boost/geometry/core/tag.hpp> #include <geometry_test_common.hpp>
#include <boost/geometry/core/tags.hpp> #include "test_envelope_expand_on_spheroid.hpp"
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/io/dsv/write.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/algorithms/convert.hpp> #include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/envelope.hpp> #include <boost/geometry/algorithms/envelope.hpp>
#include <boost/geometry/algorithms/reverse.hpp> #include <boost/geometry/algorithms/reverse.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/index/detail/algorithms/is_valid.hpp> #include <boost/geometry/index/detail/algorithms/is_valid.hpp>
#include <boost/geometry/io/dsv/write.hpp>
#include "test_envelope_expand_on_spheroid.hpp" #include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/util/condition.hpp>
//TEMP #include <boost/geometry/util/type_traits.hpp>
#include <boost/geometry/strategies/envelope/geographic.hpp>
#include <boost/geometry/strategies/envelope/spherical.hpp>
template <typename FormulaPolicy, typename CS_Tag> template <typename FormulaPolicy, typename CS_Tag>
@ -74,22 +64,22 @@ struct test_envelope<FormulaPolicy, bg::geographic_tag>
typedef bg::strategy::envelope::spherical_box box_strategy_t; typedef bg::strategy::envelope::spherical_box box_strategy_t;
typedef bg::strategy::envelope::geographic<FormulaPolicy, bg::srs::spheroid<double>, double> strategy_t; typedef bg::strategy::envelope::geographic<FormulaPolicy, bg::srs::spheroid<double>, double> strategy_t;
typename boost::mpl::if_c std::conditional_t
< <
boost::is_same<typename bg::tag<Geometry>::type, bg::point_tag>::value, std::is_same<typename bg::tag<Geometry>::type, bg::point_tag>::value,
point_strategy_t, point_strategy_t,
typename boost::mpl::if_c std::conditional_t
< <
boost::is_same<typename bg::tag<Geometry>::type, bg::multi_point_tag>::value, std::is_same<typename bg::tag<Geometry>::type, bg::multi_point_tag>::value,
multi_point_strategy_t, multi_point_strategy_t,
typename boost::mpl::if_c std::conditional_t
< <
boost::is_same<typename bg::tag<Geometry>::type, bg::box_tag>::value, std::is_same<typename bg::tag<Geometry>::type, bg::box_tag>::value,
box_strategy_t, box_strategy_t,
strategy_t strategy_t
>::type >
>::type >
>::type strategy; > strategy;
bg::envelope(geometry, detected, strategy); bg::envelope(geometry, detected, strategy);
} }
@ -327,26 +317,16 @@ public:
// test the reverse of a geometry if it is either linear or ring // test the reverse of a geometry if it is either linear or ring
template <typename Geometry, typename Tag = typename bg::tag<Geometry>::type> template <typename Geometry>
struct test_reverse_geometry struct test_reverse_geometry
{ {
static bool const is_linear = static bool const is_linear = bg::util::is_linear<Geometry>::value;
boost::is_same<Tag, bg::segment_tag>::value
|| boost::is_same<Tag, bg::linestring_tag>::value
|| boost::is_same<Tag, bg::multi_linestring_tag>::value;
// currently disable rings // currently disable rings
static bool const is_ring = false; static bool const is_ring = false;
// static bool const is_ring = boost::is_same<Tag, bg::ring_tag>::value; // static bool const is_ring = bg::util::is_ring<Geometry>::value;
typedef typename boost::mpl::if_c static bool const value = (is_linear || is_ring);
<
is_linear || is_ring,
boost::true_type,
boost::false_type
>::type type;
static bool const value = type::value;
}; };
template template

View File

@ -1,8 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test // Unit Test
// Copyright (c) 2015-2020, Oracle and/or its affiliates. // Copyright (c) 2015-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -17,41 +16,32 @@
#include <boost/test/included/unit_test.hpp> #include <boost/test/included/unit_test.hpp>
#include <cstddef> #include <cstddef>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
#include <from_wkt.hpp> #include <from_wkt.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/views/detail/indexed_point_view.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/io/dsv/write.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/algorithms/assign.hpp> #include <boost/geometry/algorithms/assign.hpp>
#include <boost/geometry/algorithms/envelope.hpp> #include <boost/geometry/algorithms/envelope.hpp>
#include <boost/geometry/algorithms/expand.hpp> #include <boost/geometry/algorithms/expand.hpp>
#include <boost/geometry/algorithms/make.hpp> #include <boost/geometry/algorithms/make.hpp>
#include <boost/geometry/algorithms/transform.hpp> #include <boost/geometry/algorithms/transform.hpp>
#include "test_envelope_expand_on_spheroid.hpp" #include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
// TEMP #include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/strategies/envelope/geographic.hpp>
#include <boost/geometry/strategies/envelope/spherical.hpp> #include <boost/geometry/io/dsv/write.hpp>
#include <boost/geometry/strategies/expand/geographic.hpp> #include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/strategies/expand/spherical.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/views/detail/indexed_point_view.hpp>
#include "test_envelope_expand_on_spheroid.hpp"
class test_expand_on_spheroid class test_expand_on_spheroid
@ -353,7 +343,7 @@ public:
basic_tester basic_tester
< <
boost::is_same std::is_same
< <
typename bg::tag<Geometry>::type, typename bg::tag<Geometry>::type,
bg::box_tag bg::box_tag
@ -1070,7 +1060,7 @@ void test_expand_make_inverse()
typedef bg::model::segment<point_type> segment_type; typedef bg::model::segment<point_type> segment_type;
typedef test_expand_on_spheroid tester; typedef test_expand_on_spheroid tester;
box_type box = boost::geometry::make_inverse<box_type>(); box_type box = bg::make_inverse<box_type>();
tester::apply("bi01", tester::apply("bi01",
box, box,

View File

@ -2,6 +2,11 @@
// Unit Test // Unit Test
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -28,13 +33,13 @@ struct check_result
template <typename Box> template <typename Box>
struct check_result<Box, 2> struct check_result<Box, 2>
{ {
typedef typename bg::coordinate_type<Box>::type ctype; using ctype = typename bg::coordinate_type<Box>::type;
typedef typename boost::mpl::if_ using type = std::conditional_t
< <
boost::is_arithmetic<ctype>, (std::is_integral<ctype>::value || std::is_floating_point<ctype>::value),
double, double,
ctype ctype
>::type type; >;
static void apply(Box const& b, const type& x1, const type& y1, const type& /*z1*/, static void apply(Box const& b, const type& x1, const type& y1, const type& /*z1*/,
const type& x2, const type& y2, const type& /*z2*/) const type& x2, const type& y2, const type& /*z2*/)
@ -50,13 +55,13 @@ struct check_result<Box, 2>
template <typename Box> template <typename Box>
struct check_result<Box, 3> struct check_result<Box, 3>
{ {
typedef typename bg::coordinate_type<Box>::type ctype; using ctype = typename bg::coordinate_type<Box>::type;
typedef typename boost::mpl::if_ using type = std::conditional_t
< <
boost::is_arithmetic<ctype>, (std::is_integral<ctype>::value || std::is_floating_point<ctype>::value),
double, double,
ctype ctype
>::type type; >;
static void apply(Box const& b, const type& x1, const type& y1, const type& z1, static void apply(Box const& b, const type& x1, const type& y1, const type& z1,
const type& x2, const type& y2, const type& z2) const type& x2, const type& y2, const type& z2)

View File

@ -1,8 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test // Unit Test
// Copyright (c) 2015-2017, Oracle and/or its affiliates. // Copyright (c) 2015-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -18,8 +17,6 @@
#include <cstddef> #include <cstddef>
#include <iostream> #include <iostream>
#include <boost/type_traits/is_same.hpp>
#include <boost/geometry/core/access.hpp> #include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp> #include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/cs.hpp> #include <boost/geometry/core/cs.hpp>
@ -66,7 +63,7 @@ struct rng
template <typename Units> template <typename Units>
char const* units2string() char const* units2string()
{ {
if (BOOST_GEOMETRY_CONDITION((boost::is_same<Units, bg::degree>::value))) if (BOOST_GEOMETRY_CONDITION((std::is_same<Units, bg::degree>::value)))
{ {
return "degrees"; return "degrees";
} }

View File

@ -3,9 +3,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2013-2020. // This file was modified by Oracle on 2013-2021.
// Modifications copyright (c) 2013-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2013-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -14,8 +13,6 @@
#include "test_equals.hpp" #include "test_equals.hpp"
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/point_xy.hpp>
@ -59,7 +56,8 @@ void test_segment_segment()
template <typename P> template <typename P>
void test_linestring_linestring() void test_linestring_linestring()
{ {
typedef bgm::linestring<P> ls; using coord_t = typename bg::coordinate_type<P>::type;
using ls = bgm::linestring<P>;
test_geometry<ls, ls>("ls2d_1", "LINESTRING(1 1, 3 3)", "LINESTRING(3 3, 1 1)", true); test_geometry<ls, ls>("ls2d_1", "LINESTRING(1 1, 3 3)", "LINESTRING(3 3, 1 1)", true);
test_geometry<ls, ls>("ls2d_2", "LINESTRING(1 1, 3 3, 2 5)", "LINESTRING(1 1, 2 2, 3 3, 2 5)", true); test_geometry<ls, ls>("ls2d_2", "LINESTRING(1 1, 3 3, 2 5)", "LINESTRING(1 1, 2 2, 3 3, 2 5)", true);
@ -82,8 +80,7 @@ void test_linestring_linestring()
test_geometry<ls, ls>("ls2d_overl_ring2", "LINESTRING(0 0,5 0,5 5,0 5,0 0)", "LINESTRING(5 5,5 0,0 0,0 5,5 5,5 0)", true); test_geometry<ls, ls>("ls2d_overl_ring2", "LINESTRING(0 0,5 0,5 5,0 5,0 0)", "LINESTRING(5 5,5 0,0 0,0 5,5 5,5 0)", true);
// https://svn.boost.org/trac/boost/ticket/10904 // https://svn.boost.org/trac/boost/ticket/10904
if ( BOOST_GEOMETRY_CONDITION( if ( BOOST_GEOMETRY_CONDITION(std::is_floating_point<coord_t>::value) )
boost::is_floating_point<typename bg::coordinate_type<ls>::type>::value ) )
{ {
test_geometry<ls, ls>("ls2d_small1", test_geometry<ls, ls>("ls2d_small1",
"LINESTRING(5.6956521739130430148634331999347 -0.60869565217391330413931882503675,5.5 -0.50000000000000066613381477509392)", "LINESTRING(5.6956521739130430148634331999347 -0.60869565217391330413931882503675,5.5 -0.50000000000000066613381477509392)",

View File

@ -3,9 +3,8 @@
// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2019. // This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019, Oracle and/or its affiliates. // Modifications copyright (c) 2019-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -19,24 +18,22 @@
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
#include <boost/foreach.hpp>
#include <boost/geometry/algorithms/correct.hpp> #include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/intersection.hpp> #include <boost/geometry/algorithms/intersection.hpp>
#include <boost/geometry/algorithms/union.hpp> #include <boost/geometry/algorithms/union.hpp>
#include <boost/geometry/algorithms/difference.hpp> #include <boost/geometry/algorithms/difference.hpp>
#include <boost/geometry/algorithms/intersects.hpp> #include <boost/geometry/algorithms/intersects.hpp>
#include <boost/geometry/algorithms/within.hpp> #include <boost/geometry/algorithms/within.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/io/wkt/read.hpp> #include <boost/geometry/io/wkt/read.hpp>
#include <boost/geometry/io/wkt/write.hpp> #include <boost/geometry/io/wkt/write.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#if defined(TEST_WITH_SVG) #if defined(TEST_WITH_SVG)
@ -60,19 +57,19 @@ inline void test_assemble(std::string const& id, Geometry const& p, Geometry con
type area_i = 0, area_u = 0, area_d1 = 0, area_d2 = 0; type area_i = 0, area_u = 0, area_d1 = 0, area_d2 = 0;
BOOST_FOREACH(Geometry const& g, u) for (Geometry const& g : u)
{ {
area_u += bg::area(g); area_u += bg::area(g);
} }
BOOST_FOREACH(Geometry const& g, i) for (Geometry const& g : i)
{ {
area_i += bg::area(g); area_i += bg::area(g);
} }
BOOST_FOREACH(Geometry const& g, d1) for (Geometry const& g : d1)
{ {
area_d1 += bg::area(g); area_d1 += bg::area(g);
} }
BOOST_FOREACH(Geometry const& g, d2) for (Geometry const& g : d2)
{ {
area_d2 += bg::area(g); area_d2 += bg::area(g);
} }
@ -111,7 +108,7 @@ inline void test_assemble(std::string const& id, Geometry const& p, Geometry con
: d2 : d2
; ;
BOOST_FOREACH(Geometry const& geometry, v) for (Geometry const& geometry : v)
{ {
mapper.map(geometry, mapper.map(geometry,
linestyle + "stroke-width:3;stroke-linejoin:round;stroke-linecap:square;stroke-dasharray:12,12;stroke:rgb(255,0,0);"); linestyle + "stroke-width:3;stroke-linejoin:round;stroke-linecap:square;stroke-dasharray:12,12;stroke:rgb(255,0,0);");
@ -123,7 +120,6 @@ inline void test_assemble(std::string const& id, Geometry const& p, Geometry con
template <typename Polygon> template <typename Polygon>
inline bool int_ok(Polygon const& poly) inline bool int_ok(Polygon const& poly)
{ {
typename bg::point_type<Polygon>::type const& pi = typename bg::point_type<Polygon>::type const& pi =
bg::interior_rings(poly)[0].front(); bg::interior_rings(poly)[0].front();

View File

@ -3,6 +3,10 @@
// Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -46,7 +50,7 @@ void test_dissolve_plusmin(std::string const& caseid, Collection const& input,
T positive_area = T(); T positive_area = T();
T negative_area = T(); T negative_area = T();
BOOST_FOREACH(geometry_type const& geometry, output) for (geometry_type const& geometry : output)
{ {
T a = bg::area(geometry); T a = bg::area(geometry);
if (a > zero) if (a > zero)
@ -74,17 +78,17 @@ void test_dissolve_plusmin(std::string const& caseid, Collection const& input,
bg::svg_mapper<point_type> mapper(svg, 500, 500); bg::svg_mapper<point_type> mapper(svg, 500, 500);
typedef typename boost::range_value<Collection>::type value_type; typedef typename boost::range_value<Collection>::type value_type;
BOOST_FOREACH(value_type const& geometry, input) for (value_type const& geometry : input)
{ {
mapper.add(geometry); mapper.add(geometry);
} }
BOOST_FOREACH(value_type const& geometry, input) for (value_type const& geometry : input)
{ {
mapper.map(geometry, mapper.map(geometry,
"opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:0.5"); "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:0.5");
} }
BOOST_FOREACH(geometry_type const& geometry, output) for (geometry_type const& geometry : output)
{ {
mapper.map(geometry, mapper.map(geometry,
bg::area(geometry) > 0 bg::area(geometry) > 0
@ -116,7 +120,7 @@ void test_geometry(std::string const& caseid, std::string const& wkt,
typedef typename boost::range_value<MultiPolygon>::type polygon_type; typedef typename boost::range_value<MultiPolygon>::type polygon_type;
typedef typename bg::ring_type<MultiPolygon>::type ring_type; typedef typename bg::ring_type<MultiPolygon>::type ring_type;
std::vector<ring_type> rings; std::vector<ring_type> rings;
BOOST_FOREACH(polygon_type const& polygon, multi_polygon) for (polygon_type const& polygon : multi_polygon)
{ {
rings.push_back(bg::exterior_ring(polygon)); rings.push_back(bg::exterior_ring(polygon));
} }

View File

@ -3,31 +3,26 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017-2020. // This file was modified by Oracle on 2017-2021.
// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#include <iostream> #include <iostream>
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
#include <boost/array.hpp> #include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp>
#include <boost/foreach.hpp> #include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
#include <boost/geometry/algorithms/intersection.hpp> #include <boost/geometry/algorithms/intersection.hpp>
#include <boost/geometry/algorithms/make.hpp> #include <boost/geometry/algorithms/make.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
#include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/point_xy.hpp>
// TEMP
#include <boost/geometry/strategies/cartesian.hpp>
#if defined(TEST_WITH_SVG) #if defined(TEST_WITH_SVG)
# include <boost/geometry/io/svg/svg_mapper.hpp> # include <boost/geometry/io/svg/svg_mapper.hpp>
#endif #endif
@ -57,7 +52,7 @@ struct sub_range_from_points
} }
private : private :
boost::array<Point, 3> m_points; Point m_points[3];
}; };
template <typename P, typename T> template <typename P, typename T>

View File

@ -5,8 +5,8 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2017. // This file was modified by Oracle on 2017-2021.
// Modifications copyright (c) 2017, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -122,7 +122,7 @@ struct test_get_turns
"stroke:rgb(51,51,153);stroke-width:3"); "stroke:rgb(51,51,153);stroke-width:3");
int index = 0; int index = 0;
BOOST_FOREACH(turn_info const& turn, turns) for (turn_info const& turn : turns)
{ {
mapper.map(turn.point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1"); mapper.map(turn.point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1");

View File

@ -5,9 +5,8 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014, 2015. // This file was modified by Oracle on 2014-2021.
// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -215,7 +214,7 @@ void test_all()
expected("muu++")); expected("muu++"));
// 29.01.2015 // 29.01.2015
if ( BOOST_GEOMETRY_CONDITION((boost::is_same<T, double>::value)) ) if ( BOOST_GEOMETRY_CONDITION((std::is_same<T, double>::value)) )
{ {
// FAILING - possibly wrong IPs // FAILING - possibly wrong IPs
test_geometry<ls, ls>("LINESTRING(3 -0.6,0 -0.9)", test_geometry<ls, ls>("LINESTRING(3 -0.6,0 -0.9)",
@ -308,7 +307,7 @@ void test_all()
// determinants. // determinants.
// See also: https://svn.boost.org/trac/boost/ticket/8379 // See also: https://svn.boost.org/trac/boost/ticket/8379
// https://github.com/boostorg/geometry/pull/259 // https://github.com/boostorg/geometry/pull/259
if ( BOOST_GEOMETRY_CONDITION((boost::is_same<T, double>::value)) ) if ( BOOST_GEOMETRY_CONDITION((std::is_same<T, double>::value)) )
{ {
test_geometry<ls, ls>("LINESTRING(0 0, 10 0, 20 1)", test_geometry<ls, ls>("LINESTRING(0 0, 10 0, 20 1)",
"LINESTRING(12 10, 13 0.3, 14 0.4, 15 0.5)", "LINESTRING(12 10, 13 0.3, 14 0.4, 15 0.5)",
@ -370,7 +369,7 @@ void test_all()
//test_geometry<ls, ls>("LINESTRING(0 0,2 2,3 3,4 4)", "LINESTRING(0 0,1 1,4 4)", "1FFF0FFF2"); //test_geometry<ls, ls>("LINESTRING(0 0,2 2,3 3,4 4)", "LINESTRING(0 0,1 1,4 4)", "1FFF0FFF2");
//if ( boost::is_same<T, double>::value ) //if ( std::is_same<T, double>::value )
//{ //{
// to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0,2.5 0,3 1)", "LINESTRING(0 0,2 0,2.5 0,3 1)", "test11.svg"); // to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0,2.5 0,3 1)", "LINESTRING(0 0,2 0,2.5 0,3 1)", "test11.svg");
// to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0,2.5 0,3 1)", "LINESTRING(3 1,2.5 0,2 0,0 0)", "test12.svg"); // to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0,2.5 0,3 1)", "LINESTRING(3 1,2.5 0,2 0,0 0)", "test12.svg");
@ -520,7 +519,7 @@ void test_all()
expected("tiu+=")("mui=+")); expected("tiu+=")("mui=+"));
// parts of boundaries taken from union A/A buffer_mp1 // parts of boundaries taken from union A/A buffer_mp1
if ( BOOST_GEOMETRY_CONDITION((boost::is_same<T, double>::value)) ) if ( BOOST_GEOMETRY_CONDITION((std::is_same<T, double>::value)) )
{ {
test_geometry<ls, ls>("LINESTRING(6.95629520146761 5.415823381635526,6.989043790736545 5.209056926535316,7 5,6.989043790736547 4.790943073464693,6.956295201467611 4.584176618364482)", test_geometry<ls, ls>("LINESTRING(6.95629520146761 5.415823381635526,6.989043790736545 5.209056926535316,7 5,6.989043790736547 4.790943073464693,6.956295201467611 4.584176618364482)",
"LINESTRING(7.415823381635519 5.043704798532389,7.209056926535308 5.010956209263453,7.000000000000001 5,6.790943073464693 5.010956209263453,6.584176618364483 5.043704798532389)", "LINESTRING(7.415823381635519 5.043704798532389,7.209056926535308 5.010956209263453,7.000000000000001 5,6.790943073464693 5.010956209263453,6.584176618364483 5.043704798532389)",

View File

@ -1,7 +1,7 @@
// Boost.Geometry // Boost.Geometry
// Unit Test // Unit Test
// Copyright (c) 2016, Oracle and/or its affiliates. // Copyright (c) 2016-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -73,7 +73,7 @@ void test_all()
"LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)", "LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)",
expected("tuu==")("ecc==")("mii++")("muu==")("mii++")("muu==")("mii++")); expected("tuu==")("ecc==")("mii++")("muu==")("mii++")("muu==")("mii++"));
if (BOOST_GEOMETRY_CONDITION((boost::is_same<T, double>::value))) if (BOOST_GEOMETRY_CONDITION((std::is_same<T, double>::value)))
{ {
test_geometry<ls, ls>("LINESTRING(-1 0,1 0,2 1.0004570537241201524198894179384922,3 2)", test_geometry<ls, ls>("LINESTRING(-1 0,1 0,2 1.0004570537241201524198894179384922,3 2)",
"LINESTRING(4 5,3 2,1 0,0 0)", "LINESTRING(4 5,3 2,1 0,0 0)",
@ -223,7 +223,7 @@ void test_all()
"LINESTRING(2 0,0 0,-10 0)", "LINESTRING(2 0,0 0,-10 0)",
expected("tiu+=")("mui=+")); expected("tiu+=")("mui=+"));
if ( BOOST_GEOMETRY_CONDITION((boost::is_same<T, double>::value)) ) if ( BOOST_GEOMETRY_CONDITION((std::is_same<T, double>::value)) )
{ {
test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)", test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)",
"LINESTRING(12 10, 12.5 -0.50051443471392, 15 0, 17.5 0.50051443471392)", "LINESTRING(12 10, 12.5 -0.50051443471392, 15 0, 17.5 0.50051443471392)",
@ -276,7 +276,7 @@ void test_all()
//test_geometry<ls, ls>("LINESTRING(0 0,2 2,3 3,4 4)", "LINESTRING(0 0,1 1,4 4)", "1FFF0FFF2"); //test_geometry<ls, ls>("LINESTRING(0 0,2 2,3 3,4 4)", "LINESTRING(0 0,1 1,4 4)", "1FFF0FFF2");
//if ( boost::is_same<T, double>::value ) //if ( std::is_same<T, double>::value )
//{ //{
// to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0,2.5 0,3 1)", "LINESTRING(0 0,2 0,2.5 0,3 1)", "test11.svg"); // to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0,2.5 0,3 1)", "LINESTRING(0 0,2 0,2.5 0,3 1)", "test11.svg");
// to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0,2.5 0,3 1)", "LINESTRING(3 1,2.5 0,2 0,0 0)", "test12.svg"); // to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0,2.5 0,3 1)", "LINESTRING(3 1,2.5 0,2 0,0 0)", "test12.svg");

View File

@ -3,8 +3,8 @@
// Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017-2020. // This file was modified by Oracle on 2017-2021.
// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -18,8 +18,6 @@
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <boost/type_traits/is_same.hpp>
#if defined(TEST_WITH_SVG) #if defined(TEST_WITH_SVG)
# include <boost/geometry/io/svg/svg_mapper.hpp> # include <boost/geometry/io/svg/svg_mapper.hpp>
#endif #endif
@ -27,8 +25,9 @@
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
#include <algorithms/check_validity.hpp> #include <algorithms/check_validity.hpp>
#include <boost/geometry.hpp> #include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp> #include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay.hpp>
#include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/geometries/geometries.hpp>
//#include <boost/geometry/extensions/algorithms/inverse.hpp> //#include <boost/geometry/extensions/algorithms/inverse.hpp>
@ -37,6 +36,8 @@
# include <boost/geometry/io/svg/svg_mapper.hpp> # include <boost/geometry/io/svg/svg_mapper.hpp>
#endif #endif
#include <boost/geometry/io/wkt/read.hpp>
#include "multi_overlay_cases.hpp" #include "multi_overlay_cases.hpp"
@ -72,7 +73,7 @@ struct map_visitor
{ {
typedef typename boost::range_value<Turns>::type turn_type; typedef typename boost::range_value<Turns>::type turn_type;
int index = 0; int index = 0;
BOOST_FOREACH(turn_type const& turn, turns) for (turn_type const& turn : turns)
{ {
switch (phase) switch (phase)
{ {
@ -129,7 +130,7 @@ struct map_visitor
{ {
typedef typename boost::range_value<Turns>::type turn_type; typedef typename boost::range_value<Turns>::type turn_type;
int index = 0; int index = 0;
BOOST_FOREACH(turn_type const& turn, turns) for (turn_type const& turn : turns)
{ {
if (turn.cluster_id >= 0) if (turn.cluster_id >= 0)
{ {

View File

@ -3,8 +3,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2017. // This file was modified by Oracle on 2017-2021.
// Modifications copyright (c) 2017, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -16,13 +16,9 @@
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
#include <boost/foreach.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp> #include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_relative_order.hpp> #include <boost/geometry/algorithms/detail/overlay/get_relative_order.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
#include <boost/geometry/algorithms/make.hpp> #include <boost/geometry/algorithms/make.hpp>
#include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/point_xy.hpp>
@ -31,8 +27,8 @@
# include <boost/geometry/io/svg/svg_mapper.hpp> # include <boost/geometry/io/svg/svg_mapper.hpp>
#endif #endif
#include <boost/geometry/strategies/side.hpp>
#include <boost/geometry/strategies/cartesian/side_by_triangle.hpp> #include <boost/geometry/strategies/cartesian/side_by_triangle.hpp>
#include <boost/geometry/strategies/side.hpp>
template <typename P, typename T> template <typename P, typename T>

View File

@ -2,8 +2,8 @@
// //
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// //
// This file was modified by Oracle on 2017-2020. // This file was modified by Oracle on 2017-2021.
// Modifications copyright (c) 2017-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2017-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// //
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -12,14 +12,10 @@
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
#include <boost/foreach.hpp> #include <initializer_list>
#include <boost/range/algorithm/copy.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/typeof/typeof.hpp>
#include <algorithms/test_overlay.hpp> #include <algorithms/test_overlay.hpp>
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/algorithms/detail/overlay/select_rings.hpp> #include <boost/geometry/algorithms/detail/overlay/select_rings.hpp>
#include <boost/geometry/algorithms/detail/overlay/assign_parents.hpp> #include <boost/geometry/algorithms/detail/overlay/assign_parents.hpp>
@ -28,18 +24,15 @@
#include <boost/geometry/io/wkt/read.hpp> #include <boost/geometry/io/wkt/read.hpp>
#include <boost/assign/list_of.hpp>
template template
< <
typename Geometry1, typename Geometry1,
typename Geometry2, typename Geometry2,
bg::overlay_type OverlayType, bg::overlay_type OverlayType,
typename RingIdVector typename RingId
> >
void test_geometry(std::string const& wkt1, std::string const& wkt2, void test_geometry(std::string const& wkt1, std::string const& wkt2,
RingIdVector const& expected_ids) std::initializer_list<RingId> const& expected_ids)
{ {
typedef bg::detail::overlay::ring_properties typedef bg::detail::overlay::ring_properties
< <
@ -68,8 +61,8 @@ void test_geometry(std::string const& wkt1, std::string const& wkt2,
if (selected.size() <= expected_ids.size()) if (selected.size() <= expected_ids.size())
{ {
BOOST_AUTO(eit, expected_ids.begin()); auto eit = expected_ids.begin();
for(typename map_type::const_iterator it = selected.begin(); it != selected.end(); ++it, ++eit) for (auto it = selected.begin(); it != selected.end(); ++it, ++eit)
{ {
bg::ring_identifier const ring_id = it->first; bg::ring_identifier const ring_id = it->first;
BOOST_CHECK_EQUAL(ring_id.source_index, eit->source_index); BOOST_CHECK_EQUAL(ring_id.source_index, eit->source_index);
@ -90,21 +83,19 @@ void test_all()
test_geometry<bg::model::polygon<P>, bg::model::polygon<P>, bg::overlay_union>( test_geometry<bg::model::polygon<P>, bg::model::polygon<P>, bg::overlay_union>(
winded[0], winded[1], winded[0], winded[1],
boost::assign::list_of { rid(0,-1,-1),
(rid(0,-1,-1)) rid(0,-1, 0),
(rid(0,-1, 0)) rid(0,-1, 1),
(rid(0,-1, 1)) rid(0,-1, 3),
(rid(0,-1, 3)) rid(1,-1, 1),
(rid(1,-1, 1)) rid(1,-1, 2) });
(rid(1,-1, 2)));
test_geometry<bg::model::polygon<P>, bg::model::polygon<P>, bg::overlay_intersection>( test_geometry<bg::model::polygon<P>, bg::model::polygon<P>, bg::overlay_intersection>(
winded[0], winded[1], winded[0], winded[1],
boost::assign::list_of { rid(0,-1, 2),
(rid(0,-1, 2)) rid(1,-1,-1),
(rid(1,-1,-1)) rid(1,-1, 0),
(rid(1,-1, 0)) rid(1,-1, 3), });
(rid(1,-1, 3)));
} }

View File

@ -5,8 +5,8 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2017-2020. // This file was modified by Oracle on 2017-2021.
// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -77,7 +77,7 @@ static void test_self_intersection_points(std::string const& case_id,
typedef typename bg::coordinate_type<Geometry>::type ct; typedef typename bg::coordinate_type<Geometry>::type ct;
ct zero = ct(); ct zero = ct();
ct x = zero, y = zero; ct x = zero, y = zero;
BOOST_FOREACH(turn_info const& turn, turns) for (turn_info const& turn : turns)
{ {
x += bg::get<0>(turn.point); x += bg::get<0>(turn.point);
y += bg::get<1>(turn.point); y += bg::get<1>(turn.point);
@ -141,7 +141,7 @@ static void test_self_intersection_points(std::string const& case_id,
mapper.map(geometry, "fill:rgb(255,255,128);stroke:rgb(0,0,0);stroke-width:1"); mapper.map(geometry, "fill:rgb(255,255,128);stroke:rgb(0,0,0);stroke-width:1");
BOOST_FOREACH(turn_info const& turn, turns) for (turn_info const& turn : turns)
{ {
mapper.map(turn.point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1"); mapper.map(turn.point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1");
} }

View File

@ -4,8 +4,8 @@
// Copyright (c) 2016 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2016 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017-2020. // This file was modified by Oracle on 2017-2021.
// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -14,11 +14,11 @@
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
#include <boost/geometry.hpp> #include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp> #include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay.hpp>
#include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/geometries/geometries.hpp>
#include <boost/assign/list_of.hpp> #include <boost/geometry/io/wkt/read.hpp>
#include <boost/foreach.hpp>
#include "multi_overlay_cases.hpp" #include "multi_overlay_cases.hpp"
@ -31,7 +31,7 @@ std::string as_string(std::vector<T> const& v)
{ {
std::stringstream out; std::stringstream out;
bool first = true; bool first = true;
BOOST_FOREACH(T const& value, v) for (T const& value : v)
{ {
out << (first ? "[" : " , ") << value; out << (first ? "[" : " , ") << value;
first = false; first = false;
@ -217,13 +217,11 @@ void test_sort_by_side(std::string const& case_id,
// Define two small macro's to avoid repetitions of testcases/names etc // Define two small macro's to avoid repetitions of testcases/names etc
#define TEST_INT(caseid, exp) { (test_sort_by_side<multi_polygon, bg::overlay_intersection>) \ #define TEST_INT(caseid, exp, ...) { (test_sort_by_side<multi_polygon, bg::overlay_intersection>) \
( #caseid "_int", caseid[0], caseid[1], exp); } ( #caseid "_int", caseid[0], caseid[1], exp, __VA_ARGS__); }
#define TEST_UNION(caseid, exp) { (test_sort_by_side<multi_polygon, bg::overlay_union>) \ #define TEST_UNION(caseid, exp, ...) { (test_sort_by_side<multi_polygon, bg::overlay_union>) \
( #caseid "_union", caseid[0], caseid[1], exp); } ( #caseid "_union", caseid[0], caseid[1], exp, __VA_ARGS__); }
using boost::assign::list_of;
template <typename T> template <typename T>
void test_all() void test_all()
@ -234,31 +232,31 @@ void test_all()
// Selection of test cases having only one cluster // Selection of test cases having only one cluster
TEST_INT(case_64_multi, list_of(1)); TEST_INT(case_64_multi, {1});
TEST_INT(case_72_multi, list_of(3)); TEST_INT(case_72_multi, {3});
TEST_INT(case_107_multi, list_of(2)); TEST_INT(case_107_multi, {2});
TEST_INT(case_123_multi, list_of(3)); TEST_INT(case_123_multi, {3});
TEST_INT(case_124_multi, list_of(3)); TEST_INT(case_124_multi, {3});
TEST_INT(case_recursive_boxes_10, list_of(2)); TEST_INT(case_recursive_boxes_10, {2});
TEST_INT(case_recursive_boxes_20, list_of(2)); TEST_INT(case_recursive_boxes_20, {2});
TEST_INT(case_recursive_boxes_21, list_of(1)); TEST_INT(case_recursive_boxes_21, {2});
TEST_INT(case_recursive_boxes_22, list_of(0)); TEST_INT(case_recursive_boxes_22, {0});
TEST_UNION(case_recursive_boxes_46, list_of(2)(1)(2)(1)(1)(2)(1)); TEST_UNION(case_recursive_boxes_46, {2, 1, 2, 1, 1, 2, 1});
TEST_UNION(case_62_multi, list_of(2)); TEST_UNION(case_62_multi, {2});
TEST_UNION(case_63_multi, list_of(2)); TEST_UNION(case_63_multi, {2});
TEST_UNION(case_64_multi, list_of(1)); TEST_UNION(case_64_multi, {1});
TEST_UNION(case_107_multi, list_of(1)); TEST_UNION(case_107_multi, {1});
TEST_UNION(case_123_multi, list_of(1)); TEST_UNION(case_123_multi, {1});
TEST_UNION(case_124_multi, list_of(1)); TEST_UNION(case_124_multi, {1});
TEST_UNION(case_recursive_boxes_10, list_of(1)); TEST_UNION(case_recursive_boxes_10, {1});
TEST_UNION(case_recursive_boxes_18, list_of(3)); TEST_UNION(case_recursive_boxes_18, {3});
TEST_UNION(case_recursive_boxes_19, list_of(3)); TEST_UNION(case_recursive_boxes_19, {3});
TEST_UNION(case_recursive_boxes_20, list_of(2)); TEST_UNION(case_recursive_boxes_20, {2});
TEST_UNION(case_recursive_boxes_21, list_of(1)); TEST_UNION(case_recursive_boxes_21, {1});
TEST_UNION(case_recursive_boxes_22, list_of(1)); TEST_UNION(case_recursive_boxes_22, {1});
TEST_UNION(case_recursive_boxes_23, list_of(3)); TEST_UNION(case_recursive_boxes_23, {3});
} }
int test_main(int, char* []) int test_main(int, char* [])

View File

@ -4,8 +4,8 @@
// Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017-2020. // This file was modified by Oracle on 2017-2021.
// Modifications copyright (c) 2017-2020, Oracle and/or its affiliates. // Modifications copyright (c) 2017-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -14,18 +14,13 @@
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/detail/overlay/sort_by_side.hpp> #include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/strategies/strategies.hpp> // for equals/within
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp> #include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp> #include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
#include <boost/geometry/algorithms/correct.hpp> #include <boost/geometry/algorithms/detail/overlay/sort_by_side.hpp>
#include <boost/geometry/algorithms/equals.hpp> #include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/foreach.hpp>
#if defined(TEST_WITH_SVG) #if defined(TEST_WITH_SVG)
#include "debug_sort_by_side_svg.hpp" #include "debug_sort_by_side_svg.hpp"
@ -40,7 +35,7 @@ std::string as_string(std::vector<T> const& v)
{ {
std::stringstream out; std::stringstream out;
bool first = true; bool first = true;
BOOST_FOREACH(T const& value, v) for (T const& value : v)
{ {
out << (first ? "[" : " , ") << value; out << (first ? "[" : " , ") << value;
first = false; first = false;
@ -268,8 +263,6 @@ void test_basic(std::string const& case_id,
expected_open_count, expected_max_rank, expected_right_count); expected_open_count, expected_max_rank, expected_right_count);
} }
using boost::assign::list_of;
template <typename T> template <typename T>
void test_all() void test_all()
{ {
@ -277,67 +270,67 @@ void test_all()
"MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)))", "MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)))",
"MULTIPOLYGON(((1 0,1 1,2 1,2 0,1, 0)))", "MULTIPOLYGON(((1 0,1 1,2 1,2 0,1, 0)))",
"POINT(1 1)", "POINT(1 0)", "POINT(1 1)", "POINT(1 0)",
2, 3, list_of(-1)(1)(-1)(1)); 2, 3, {-1, 1, -1, 1});
test_basic<T>("dup1", test_basic<T>("dup1",
"MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)))", "MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)))",
"MULTIPOLYGON(((1 0,1 1,2 1,2 0,1, 0)),((0 2,1 2,1 1,0 1,0 2)))", "MULTIPOLYGON(((1 0,1 1,2 1,2 0,1, 0)),((0 2,1 2,1 1,0 1,0 2)))",
"POINT(1 1)", "POINT(1 0)", "POINT(1 1)", "POINT(1 0)",
2, 3, list_of(-1)(1)(-1)(2)); 2, 3, {-1, 1, -1, 2});
test_basic<T>("dup2", test_basic<T>("dup2",
"MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))", "MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))",
"MULTIPOLYGON(((1 0,1 1,2 1,2 0,1, 0)))", "MULTIPOLYGON(((1 0,1 1,2 1,2 0,1, 0)))",
"POINT(1 1)", "POINT(1 0)", "POINT(1 1)", "POINT(1 0)",
2, 3, list_of(-1)(2)(-1)(1)); 2, 3, {-1, 2, -1, 1});
test_basic<T>("dup3", test_basic<T>("dup3",
"MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))", "MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))",
"MULTIPOLYGON(((1 0,1 1,2 1,2 0,1, 0)),((0 2,1 2,1 1,0 1,0 2)))", "MULTIPOLYGON(((1 0,1 1,2 1,2 0,1, 0)),((0 2,1 2,1 1,0 1,0 2)))",
"POINT(1 1)", "POINT(1 0)", "POINT(1 1)", "POINT(1 0)",
2, 3, list_of(-1)(2)(-1)(2)); 2, 3, {-1, 2, -1, 2});
test_basic<T>("threequart1", test_basic<T>("threequart1",
"MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))", "MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))",
"MULTIPOLYGON(((1 2,2 2,2 1,1 1,1 2)))", "MULTIPOLYGON(((1 2,2 2,2 1,1 1,1 2)))",
"POINT(1 1)", "POINT(1 0)", "POINT(1 1)", "POINT(1 0)",
1, 3, list_of(-1)(1)(1)(1)); 1, 3, {-1, 1, 1, 1});
test_basic<T>("threequart2", test_basic<T>("threequart2",
"MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))", "MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))",
"MULTIPOLYGON(((1 2,2 2,2 1,1 1,1 2)),((2 0,1 0,1 1,2 0)))", "MULTIPOLYGON(((1 2,2 2,2 1,1 1,1 2)),((2 0,1 0,1 1,2 0)))",
"POINT(1 1)", "POINT(1 0)", "POINT(1 1)", "POINT(1 0)",
1, 4, list_of(-1)(2)(1)(1)(1)); 1, 4, {-1, 2, 1, 1, 1});
test_basic<T>("threequart3", test_basic<T>("threequart3",
"MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))", "MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))",
"MULTIPOLYGON(((1 2,2 2,2 1,1 1,1 2)),((2 0,1 0,1 1,2 0)),((0 1,0 2,1 1,0 1)))", "MULTIPOLYGON(((1 2,2 2,2 1,1 1,1 2)),((2 0,1 0,1 1,2 0)),((0 1,0 2,1 1,0 1)))",
"POINT(1 1)", "POINT(1 0)", "POINT(1 1)", "POINT(1 0)",
1, 5, list_of(-1)(2)(1)(1)(-1)(2)); 1, 5, {-1, 2, 1, 1, -1, 2});
test_basic<T>("full1", test_basic<T>("full1",
"MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))", "MULTIPOLYGON(((0 2,1 2,1 1,0 1,0 2)),((1 0,1 1,2 1,2 0,1, 0)))",
"MULTIPOLYGON(((1 2,2 2,2 1,1 1,1 2)),((0 0,0 1,1 1,1 0,0 0)))", "MULTIPOLYGON(((1 2,2 2,2 1,1 1,1 2)),((0 0,0 1,1 1,1 0,0 0)))",
"POINT(1 1)", "POINT(1 0)", "POINT(1 1)", "POINT(1 0)",
0, 3, list_of(1)(1)(1)(1)); 0, 3, {1, 1, 1, 1});
test_basic<T>("hole1", test_basic<T>("hole1",
"MULTIPOLYGON(((0 0,0 3,2 3,2 2,3 2,3 0,0 0),(1 1,2 1,2 2,1 2,1 1)),((4 2,3 2,3 3,4 3,4 2)))", "MULTIPOLYGON(((0 0,0 3,2 3,2 2,3 2,3 0,0 0),(1 1,2 1,2 2,1 2,1 1)),((4 2,3 2,3 3,4 3,4 2)))",
"MULTIPOLYGON(((1 0,1 1,2 1,2 2,1 2,1 4,4 4,4 0,1, 0),(3 2,3 3,2 3,2 2,3 2)))", "MULTIPOLYGON(((1 0,1 1,2 1,2 2,1 2,1 4,4 4,4 0,1, 0),(3 2,3 3,2 3,2 2,3 2)))",
"POINT(1 2)", "POINT(2 2)", "POINT(1 2)", "POINT(2 2)",
1, 2, list_of(-1)(2)(1)); 1, 2, {-1, 2, 1});
test_basic<T>("hole2", test_basic<T>("hole2",
"MULTIPOLYGON(((0 0,0 3,2 3,2 2,3 2,3 0,0 0),(1 1,2 1,2 2,1 2,1 1)),((4 2,3 2,3 3,4 3,4 2)))", "MULTIPOLYGON(((0 0,0 3,2 3,2 2,3 2,3 0,0 0),(1 1,2 1,2 2,1 2,1 1)),((4 2,3 2,3 3,4 3,4 2)))",
"MULTIPOLYGON(((1 0,1 1,2 1,2 2,1 2,1 4,4 4,4 0,1, 0),(3 2,3 3,2 3,2 2,3 2)))", "MULTIPOLYGON(((1 0,1 1,2 1,2 2,1 2,1 4,4 4,4 0,1, 0),(3 2,3 3,2 3,2 2,3 2)))",
"POINT(2 2)", "POINT(2 1)", "POINT(2 2)", "POINT(2 1)",
2, 3, list_of(-1)(2)(-1)(2)); 2, 3, {-1, 2, -1, 2});
test_basic<T>("hole3", test_basic<T>("hole3",
"MULTIPOLYGON(((0 0,0 3,2 3,2 2,3 2,3 0,0 0),(1 1,2 1,2 2,1 2,1 1)),((4 2,3 2,3 3,4 3,4 2)))", "MULTIPOLYGON(((0 0,0 3,2 3,2 2,3 2,3 0,0 0),(1 1,2 1,2 2,1 2,1 1)),((4 2,3 2,3 3,4 3,4 2)))",
"MULTIPOLYGON(((1 0,1 1,2 1,2 2,1 2,1 4,4 4,4 0,1, 0),(3 2,3 3,2 3,2 2,3 2)))", "MULTIPOLYGON(((1 0,1 1,2 1,2 2,1 2,1 4,4 4,4 0,1, 0),(3 2,3 3,2 3,2 2,3 2)))",
"POINT(3 2)", "POINT(2 2)", "POINT(3 2)", "POINT(2 2)",
1, 3, list_of(-1)(2)(-1)(2)); 1, 3, {-1, 2, -1, 2});
} }

View File

@ -5,6 +5,10 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -62,7 +66,7 @@ struct test_split_rings
mapper.map(geometry, "fill:rgb(255,255,128);stroke:rgb(0,0,0);stroke-width:1"); mapper.map(geometry, "fill:rgb(255,255,128);stroke:rgb(0,0,0);stroke-width:1");
BOOST_FOREACH(ring_type const& ring, rings) for (ring_type const& ring : rings)
{ {
std::string style = "opacity:0.6;fill:rgb"; std::string style = "opacity:0.6;fill:rgb";
std::string color = bg::area(ring) > 0 ? "(255,0,0)" : "(0,0,255)"; std::string color = bg::area(ring) > 0 ? "(255,0,0)" : "(0,0,255)";

View File

@ -3,6 +3,10 @@
// Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -17,8 +21,6 @@
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <boost/type_traits/is_same.hpp>
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
@ -34,32 +36,28 @@
# define BOOST_GEOMETRY_DEBUG_IDENTIFIER # define BOOST_GEOMETRY_DEBUG_IDENTIFIER
#endif #endif
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/enrichment_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/traversal_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
#include <boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay_type.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay.hpp>
#include <boost/geometry/algorithms/detail/overlay/traverse.hpp>
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <boost/geometry/algorithms/area.hpp> #include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/correct.hpp> #include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/enrichment_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay_type.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay.hpp>
#include <boost/geometry/algorithms/detail/overlay/traversal_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/traverse.hpp>
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
#include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/io/wkt/wkt.hpp> #include <boost/geometry/io/wkt/wkt.hpp>
#if defined(TEST_WITH_SVG) #if defined(TEST_WITH_SVG)
# include <boost/geometry/io/svg/svg_mapper.hpp> # include <boost/geometry/io/svg/svg_mapper.hpp>
#endif #endif
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <boost/geometry/strategies/strategies.hpp> #include <boost/geometry/strategies/strategies.hpp>
#include <algorithms/overlay/overlay_cases.hpp> #include <algorithms/overlay/overlay_cases.hpp>
@ -143,10 +141,10 @@ struct test_traverse
//std::cout << bg::area(g1) << " " << bg::area(g2) << std::endl; //std::cout << bg::area(g1) << " " << bg::area(g2) << std::endl;
#endif #endif
typedef typename bg::strategy::side::services::default_strategy typename bg::strategy::intersection::services::default_strategy
< <
typename bg::cs_tag<G1>::type typename bg::cs_tag<G1>::type
>::type side_strategy_type; >::type strategy;
typedef typename bg::point_type<G2>::type point_type; typedef typename bg::point_type<G2>::type point_type;
typedef typename bg::rescale_policy_type<point_type>::type typedef typename bg::rescale_policy_type<point_type>::type
@ -162,15 +160,11 @@ struct test_traverse
> turn_info; > turn_info;
std::vector<turn_info> turns; std::vector<turn_info> turns;
bg::detail::overlay::operation_type const op = std::map<bg::signed_size_type, bg::detail::overlay::cluster_info> clusters;
OverlayType == bg::overlay_union
? bg::detail::overlay::operation_union
: bg::detail::overlay::operation_intersection;
bg::detail::get_turns::no_interrupt_policy policy; bg::detail::get_turns::no_interrupt_policy policy;
bg::get_turns<Reverse1, Reverse2, bg::detail::overlay::assign_null_policy>(g1, g2, rescale_policy, turns, policy); bg::get_turns<Reverse1, Reverse2, bg::detail::overlay::assign_null_policy>(g1, g2, strategy, rescale_policy, turns, policy);
bg::enrich_intersection_points<Reverse1, Reverse2, OverlayType>(turns, op, bg::enrich_intersection_points<Reverse1, Reverse2, OverlayType>(turns, clusters, g1, g2, rescale_policy, strategy);
g1, g2, rescale_policy, side_strategy_type());
typedef bg::model::ring<typename bg::point_type<G2>::type> ring_type; typedef bg::model::ring<typename bg::point_type<G2>::type> ring_type;
typedef std::vector<ring_type> out_vector; typedef std::vector<ring_type> out_vector;
@ -178,11 +172,13 @@ struct test_traverse
bg::detail::overlay::overlay_null_visitor visitor; bg::detail::overlay::overlay_null_visitor visitor;
// TODO: this function requires additional arguments
bg::detail::overlay::traverse bg::detail::overlay::traverse
< <
Reverse1, Reverse2, Reverse1, Reverse2,
G1, G2 G1, G2,
>::apply(g1, g2, op, rescale_policy, turns, v, visitor); OverlayType
>::apply(g1, g2, strategy, rescale_policy, turns, v, visitor);
// Check number of resulting rings // Check number of resulting rings
BOOST_CHECK_MESSAGE(expected_count == boost::size(v), BOOST_CHECK_MESSAGE(expected_count == boost::size(v),
@ -196,7 +192,7 @@ struct test_traverse
// Check total area of resulting rings // Check total area of resulting rings
typename bg::default_area_result<G1>::type total_area = 0; typename bg::default_area_result<G1>::type total_area = 0;
BOOST_FOREACH(ring_type const& ring, v) for (ring_type const& ring : v)
{ {
total_area += bg::area(ring); total_area += bg::area(ring);
//std::cout << bg::wkt(ring) << std::endl; //std::cout << bg::wkt(ring) << std::endl;
@ -225,7 +221,7 @@ struct test_traverse
"stroke:rgb(51,51,153);stroke-width:3"); "stroke:rgb(51,51,153);stroke-width:3");
// Traversal rings in magenta outline/red fill -> over blue/green this gives brown // Traversal rings in magenta outline/red fill -> over blue/green this gives brown
BOOST_FOREACH(ring_type const& ring, v) for (ring_type const& ring : v)
{ {
mapper.map(ring, "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);" mapper.map(ring, "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);"
"stroke:rgb(255,0,255);stroke-width:8"); "stroke:rgb(255,0,255);stroke-width:8");
@ -239,7 +235,7 @@ struct test_traverse
int index = 0; int index = 0;
int const margin = 5; int const margin = 5;
BOOST_FOREACH(turn_info const& turn, turns) for (turn_info const& turn : turns)
{ {
int lineheight = 8; int lineheight = 8;
mapper.map(turn.point, "fill:rgb(255,128,0);" mapper.map(turn.point, "fill:rgb(255,128,0);"
@ -771,8 +767,7 @@ void test_all(bool test_self_tangencies = true, bool test_mixed = false)
} }
*/ */
static const bool is_float static const bool is_float = std::is_same<T, float>::value;
= boost::is_same<T, float>::value;
static const double float_might_deviate_more = is_float ? 0.1 : 0.001; // In some cases up to 1 promille permitted static const double float_might_deviate_more = is_float ? 0.1 : 0.001; // In some cases up to 1 promille permitted

View File

@ -3,6 +3,10 @@
// Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -13,11 +17,11 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <boost/foreach.hpp>
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
#include <boost/geometry/geometry.hpp> #include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay.hpp>
#include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp> #include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/io/wkt/wkt.hpp> #include <boost/geometry/io/wkt/wkt.hpp>
@ -26,14 +30,12 @@
# include <boost/geometry/io/svg/svg_mapper.hpp> # include <boost/geometry/io/svg/svg_mapper.hpp>
#endif #endif
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp> #include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <algorithms/overlay/overlay_cases.hpp> #include <algorithms/overlay/overlay_cases.hpp>
template <typename Geometry> template <typename Geometry>
struct rev : boost::mpl::if_c<bg::point_order<Geometry>::value == bg::counterclockwise, boost::true_type, boost::false_type>::type using rev = bg::util::bool_constant<bg::point_order<Geometry>::value == bg::counterclockwise>;
{};
template <typename Geometry1, typename Geometry2> template <typename Geometry1, typename Geometry2>
inline typename bg::coordinate_type<Geometry1>::type inline typename bg::coordinate_type<Geometry1>::type
@ -89,7 +91,7 @@ intersect(Geometry1 const& g1, Geometry2 const& g2, std::string const& name,
>::apply(g1, g2, op, rescale_policy, turns, v); >::apply(g1, g2, op, rescale_policy, turns, v);
typename bg::coordinate_type<Geometry1>::type result = 0.0; typename bg::coordinate_type<Geometry1>::type result = 0.0;
BOOST_FOREACH(ring_type& ring, v) for (ring_type& ring : v)
{ {
result += bg::area(ring); result += bg::area(ring);
} }
@ -117,7 +119,7 @@ intersect(Geometry1 const& g1, Geometry2 const& g2, std::string const& name,
"stroke:rgb(51,51,153);stroke-width:3"); "stroke:rgb(51,51,153);stroke-width:3");
// Traversal rings in magenta/light yellow fill // Traversal rings in magenta/light yellow fill
BOOST_FOREACH(ring_type const& ring, v) for (ring_type const& ring : v)
{ {
mapper.map(ring, "fill-opacity:0.3;stroke-opacity:0.4;fill:rgb(255,255,0);" mapper.map(ring, "fill-opacity:0.3;stroke-opacity:0.4;fill:rgb(255,255,0);"
"stroke:rgb(255,0,255);stroke-width:8"); "stroke:rgb(255,0,255);stroke-width:8");
@ -132,7 +134,7 @@ intersect(Geometry1 const& g1, Geometry2 const& g2, std::string const& name,
int const lineheight = 10; int const lineheight = 10;
int const margin = 5; int const margin = 5;
BOOST_FOREACH(turn_info const& turn, turns) for (turn_info const& turn : turns)
{ {
mapper.map(turn.point, "fill:rgb(255,128,0);" mapper.map(turn.point, "fill:rgb(255,128,0);"
"stroke:rgb(0,0,0);stroke-width:1", 3); "stroke:rgb(0,0,0);stroke-width:1", 3);

View File

@ -6,9 +6,8 @@
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2013-2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2013-2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014, 2015. // This file was modified by Oracle on 2014-2021.
// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -101,7 +100,7 @@ void test_geometry(std::string const& case_id, Geometry const& geometry, double
// Top (red/magenta) // Top (red/magenta)
mapper.map(top_points, "stroke:rgb(255,0,0);stroke-width:2"); mapper.map(top_points, "stroke:rgb(255,0,0);stroke-width:2");
BOOST_FOREACH(intruder_type const& intruder, top_intruders) for (intruder_type const& intruder : top_intruders)
{ {
mapper.map(intruder, "stroke:rgb(255,0,255);stroke-width:2"); mapper.map(intruder, "stroke:rgb(255,0,255);stroke-width:2");
} }
@ -111,7 +110,7 @@ void test_geometry(std::string const& case_id, Geometry const& geometry, double
//// Right (blue/cyan) //// Right (blue/cyan)
// (mostly commented, makes the picture less clear) // (mostly commented, makes the picture less clear)
//mapper.map(right_points, "stroke:rgb(0,0,255);stroke-width:2"); //mapper.map(right_points, "stroke:rgb(0,0,255);stroke-width:2");
//BOOST_FOREACH(intruder_type const& intruder, right_intruders) //for (intruder_type const& intruder : right_intruders)
//{ //{
// mapper.map(intruder, "stroke:rgb(0,255,255);stroke-width:2"); // mapper.map(intruder, "stroke:rgb(0,255,255);stroke-width:2");
//} //}

View File

@ -1,7 +1,6 @@
// Boost.Geometry // Boost.Geometry
// Copyright (c) 2015 Oracle and/or its affiliates. // Copyright (c) 2015-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -14,7 +13,6 @@
#include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/point_xy.hpp>
#include <boost/range/value_type.hpp> #include <boost/range/value_type.hpp>
#include <boost/type_traits/is_same.hpp>
template <typename Container> template <typename Container>
struct pusher struct pusher
@ -125,6 +123,6 @@ struct is_nan_case_supported
{ {
typedef typename bg::coordinate_type<Geometry>::type coord_t; typedef typename bg::coordinate_type<Geometry>::type coord_t;
static const bool value = boost::is_same<coord_t, double>::value static const bool value = std::is_same<coord_t, double>::value
&& std::numeric_limits<coord_t>::has_quiet_NaN; && std::numeric_limits<coord_t>::has_quiet_NaN;
}; };

View File

@ -2,9 +2,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2013, 2014, 2015. // This file was modified by Oracle on 2013-2021.
// Modifications copyright (c) 2013-2015 Oracle and/or its affiliates. // Modifications copyright (c) 2013-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -19,8 +18,9 @@
template <typename P> template <typename P>
void test_polygon_polygon() void test_polygon_polygon()
{ {
typedef bg::model::polygon<P> poly; using coord_t = typename bg::coordinate_type<P>::type;
typedef bg::model::ring<P> ring; using poly = bg::model::polygon<P>;
using ring = bg::model::ring<P>;
// touching // touching
test_geometry<poly, poly>("POLYGON((0 0,0 10,10 10,10 0,0 0))", test_geometry<poly, poly>("POLYGON((0 0,0 10,10 10,10 0,0 0))",
@ -306,8 +306,7 @@ void test_polygon_polygon()
"212101212"); "212101212");
} }
if ( BOOST_GEOMETRY_CONDITION(( if ( BOOST_GEOMETRY_CONDITION((std::is_same<coord_t, double>::value)) )
boost::is_same<typename bg::coordinate_type<P>::type, double>::value )) )
{ {
// original - assertion for CCW // original - assertion for CCW
//"POLYGON((-0.593220338983050821113352 -8.05084745762711939676137,1.14285714285714279370154 -4,1.50731707317073171381594 1.10243902439024443751237,1.73758865248226967992196 1.37588652482269591104114,1.21739130434782616418943 -3.82608695652173924628414,2 -2,2 1.68750000000000044408921,2.35384615384615436539661 2.10769230769230775379697,2 2.16666666666666651863693,2 4,1.81967213114754100544701 2.1967213114754100544701,1.5882352941176469673934 2.2352941176470588757752,1.8148148148148146585612 5.4074074074074074403029,-0.538461538461538546940233 4.23076923076923083755219,-1.76510067114094004736558 2.89261744966443012927471,-1.64864864864864868465588 2.7567567567567570208098,-1.83962264150943455298659 2.81132075471698161805989,-1.84337349397590433142113 2.80722891566265086993326,-2.14285714285714279370154 2.85714285714285720629846,-2.11111111111111116045436 2.88888888888888883954564,-2.87234042553191448732264 3.10638297872340407579372,-2.91803278688524558859285 3.4262295081967208965068,-3.1733333333333324510761 3.26666666666666660745477,-2.99999999999999822364316 3.14285714285714234961233,-3.25490196078431326398572 3.21568627450980359938626,-3.47368421052631504153396 3.07894736842105265495206,-7.32000000000000028421709 3.72000000000000019539925,-7.54716981132075481752963 3.62264150943396234794136,-7.75 3.79166666666666651863693,-7.79999999999999982236432 3.79999999999999982236432,-7.59999999999999964472863 3.60000000000000008881784,-8.8556701030927822415606 3.06185567010309300783888,-8.82945736434108674473009 2.8914728682170549589614,-7.73333333333333339254523 2.193939393939393855959,-8 2,-5.94736842105263185942476 -1.42105263157894645686952,-5.32558139534883689947264 -0.488372093023255016142059,-5.85714285714285765038767 1.00000000000000066613381,-4.78723404255319184841255 0.319148936170212838003835,-5.32558139534883689947264 -0.488372093023255016142059,-4.74019607843137258385013 -2.12745098039215774221589,-3.17647058823529437887601 -0.705882352941176627325603,-2.93103448275862055183438 -0.862068965517241436735674,-3 -1,-4.57894736842105309904127 -2.57894736842105265495206,-4.47887323943661996850096 -2.85915492957746497637572,-7.58620689655172419918472 -5.18965517241379359347775,-7.52525252525252508206677 -5.5858585858585865224768,-4.18644067796610119813749 -3.67796610169491522412955,-3.44041450777202051369841 -5.76683937823834202873741,-3.73611111111111116045436 -6.56944444444444464181743,-2.8823529411764705621124 -7.7647058823529411242248,-2.88235294117647100620161 -7.7647058823529411242248,-0.593220338983050821113352 -8.05084745762711939676137),(1.66666666666666696272614 1.59999999999999875655021,1.43749999999999911182158 1.8750000000000002220446,0.0869565217391310429917439 2.26086956521739113057379,0.466666666666667118157363 2.60606060606060552231611,1.04878048780487764801705 2.34146341463414664474385,1.43749999999999911182158 1.8750000000000002220446,1.56756756756756754356275 1.83783783783783771781373,1.66666666666666696272614 1.59999999999999875655021))" //"POLYGON((-0.593220338983050821113352 -8.05084745762711939676137,1.14285714285714279370154 -4,1.50731707317073171381594 1.10243902439024443751237,1.73758865248226967992196 1.37588652482269591104114,1.21739130434782616418943 -3.82608695652173924628414,2 -2,2 1.68750000000000044408921,2.35384615384615436539661 2.10769230769230775379697,2 2.16666666666666651863693,2 4,1.81967213114754100544701 2.1967213114754100544701,1.5882352941176469673934 2.2352941176470588757752,1.8148148148148146585612 5.4074074074074074403029,-0.538461538461538546940233 4.23076923076923083755219,-1.76510067114094004736558 2.89261744966443012927471,-1.64864864864864868465588 2.7567567567567570208098,-1.83962264150943455298659 2.81132075471698161805989,-1.84337349397590433142113 2.80722891566265086993326,-2.14285714285714279370154 2.85714285714285720629846,-2.11111111111111116045436 2.88888888888888883954564,-2.87234042553191448732264 3.10638297872340407579372,-2.91803278688524558859285 3.4262295081967208965068,-3.1733333333333324510761 3.26666666666666660745477,-2.99999999999999822364316 3.14285714285714234961233,-3.25490196078431326398572 3.21568627450980359938626,-3.47368421052631504153396 3.07894736842105265495206,-7.32000000000000028421709 3.72000000000000019539925,-7.54716981132075481752963 3.62264150943396234794136,-7.75 3.79166666666666651863693,-7.79999999999999982236432 3.79999999999999982236432,-7.59999999999999964472863 3.60000000000000008881784,-8.8556701030927822415606 3.06185567010309300783888,-8.82945736434108674473009 2.8914728682170549589614,-7.73333333333333339254523 2.193939393939393855959,-8 2,-5.94736842105263185942476 -1.42105263157894645686952,-5.32558139534883689947264 -0.488372093023255016142059,-5.85714285714285765038767 1.00000000000000066613381,-4.78723404255319184841255 0.319148936170212838003835,-5.32558139534883689947264 -0.488372093023255016142059,-4.74019607843137258385013 -2.12745098039215774221589,-3.17647058823529437887601 -0.705882352941176627325603,-2.93103448275862055183438 -0.862068965517241436735674,-3 -1,-4.57894736842105309904127 -2.57894736842105265495206,-4.47887323943661996850096 -2.85915492957746497637572,-7.58620689655172419918472 -5.18965517241379359347775,-7.52525252525252508206677 -5.5858585858585865224768,-4.18644067796610119813749 -3.67796610169491522412955,-3.44041450777202051369841 -5.76683937823834202873741,-3.73611111111111116045436 -6.56944444444444464181743,-2.8823529411764705621124 -7.7647058823529411242248,-2.88235294117647100620161 -7.7647058823529411242248,-0.593220338983050821113352 -8.05084745762711939676137),(1.66666666666666696272614 1.59999999999999875655021,1.43749999999999911182158 1.8750000000000002220446,0.0869565217391310429917439 2.26086956521739113057379,0.466666666666667118157363 2.60606060606060552231611,1.04878048780487764801705 2.34146341463414664474385,1.43749999999999911182158 1.8750000000000002220446,1.56756756756756754356275 1.83783783783783771781373,1.66666666666666696272614 1.59999999999999875655021))"

View File

@ -1,8 +1,7 @@
// Boost.Geometry // Boost.Geometry
// Unit Test // Unit Test
// Copyright (c) 2016, Oracle and/or its affiliates. // Copyright (c) 2016-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -287,8 +286,7 @@ void test_multi_linestring_polygon()
"POLYGON((5 0,0 -5,-5 0,0 5,5 0))", "POLYGON((5 0,0 -5,-5 0,0 5,5 0))",
"1F10F0212"); "1F10F0212");
if ( BOOST_GEOMETRY_CONDITION(( if ( BOOST_GEOMETRY_CONDITION((std::is_same<coord_t, double>::value)) )
boost::is_same<coord_t, double>::value )) )
{ {
// assertion failure in 1.57 // assertion failure in 1.57
test_geometry<mls, poly>("MULTILINESTRING((-0.59322033898305082 -8.0508474576271194,-2.882352941176471 -7.7647058823529411,-2.8823529411764706 -7.7647058823529411,-3.7361111111111112 -6.5694444444444446,-3.4404145077720205 -5.766839378238342,-4.1864406779661012 -3.6779661016949152,-7.5252525252525251 -5.5858585858585865,-7.5862068965517242 -5.1896551724137936,-4.47887323943662 -2.859154929577465,-4.5789473684210531 -2.5789473684210527,-3 -1,-2.9310344827586206 -0.86206896551724144,-3.1764705882352944 -0.70588235294117663,-4.7401960784313726 -2.1274509803921577,-5.3255813953488369 -0.48837209302325502,-4.7872340425531918 0.31914893617021284,-5.8571428571428577 1.0000000000000007,-5.3255813953488369 -0.48837209302325502,-5.9473684210526319 -1.4210526315789465,-8 2,-7.7333333333333334 2.1939393939393939,-8.8294573643410867 2.891472868217055,-8.8556701030927822 3.061855670103093,-7.5999999999999996 3.6000000000000001,-7.7999999999999998 3.7999999999999998,-7.75 3.7916666666666665,-7.5471698113207548 3.6226415094339623,-7.3200000000000003 3.7200000000000002,-3.473684210526315 3.0789473684210527,-3.2549019607843133 3.2156862745098036,-2.9999999999999982 3.1428571428571423,-3.1733333333333325 3.2666666666666666,-2.9180327868852456 3.4262295081967209,-2.8723404255319145 3.1063829787234041,-2.1111111111111112 2.8888888888888888,-2.1428571428571428 2.8571428571428572,-1.8433734939759043 2.8072289156626509,-1.8396226415094346 2.8113207547169816,-1.6486486486486487 2.756756756756757,-1.76510067114094 2.8926174496644301,-0.53846153846153855 4.2307692307692308,1.8148148148148147 5.4074074074074074,1.588235294117647 2.2352941176470589,1.819672131147541 2.1967213114754101,2 4,2 2.1666666666666665,2.3538461538461544 2.1076923076923078,2 1.6875000000000004,2 -2,1.2173913043478262 -3.8260869565217392,1.7375886524822697 1.3758865248226959,1.5073170731707317 1.1024390243902444,1.1428571428571428 -4,-0.59322033898305082 -8.0508474576271194),(1.666666666666667 1.5999999999999988,1.5675675675675675 1.8378378378378377,1.4374999999999991 1.8750000000000002,1.0487804878048776 2.3414634146341466,0.46666666666666712 2.6060606060606055,0.086956521739131043 2.2608695652173911,1.4374999999999991 1.8750000000000002,1.666666666666667 1.5999999999999988))", test_geometry<mls, poly>("MULTILINESTRING((-0.59322033898305082 -8.0508474576271194,-2.882352941176471 -7.7647058823529411,-2.8823529411764706 -7.7647058823529411,-3.7361111111111112 -6.5694444444444446,-3.4404145077720205 -5.766839378238342,-4.1864406779661012 -3.6779661016949152,-7.5252525252525251 -5.5858585858585865,-7.5862068965517242 -5.1896551724137936,-4.47887323943662 -2.859154929577465,-4.5789473684210531 -2.5789473684210527,-3 -1,-2.9310344827586206 -0.86206896551724144,-3.1764705882352944 -0.70588235294117663,-4.7401960784313726 -2.1274509803921577,-5.3255813953488369 -0.48837209302325502,-4.7872340425531918 0.31914893617021284,-5.8571428571428577 1.0000000000000007,-5.3255813953488369 -0.48837209302325502,-5.9473684210526319 -1.4210526315789465,-8 2,-7.7333333333333334 2.1939393939393939,-8.8294573643410867 2.891472868217055,-8.8556701030927822 3.061855670103093,-7.5999999999999996 3.6000000000000001,-7.7999999999999998 3.7999999999999998,-7.75 3.7916666666666665,-7.5471698113207548 3.6226415094339623,-7.3200000000000003 3.7200000000000002,-3.473684210526315 3.0789473684210527,-3.2549019607843133 3.2156862745098036,-2.9999999999999982 3.1428571428571423,-3.1733333333333325 3.2666666666666666,-2.9180327868852456 3.4262295081967209,-2.8723404255319145 3.1063829787234041,-2.1111111111111112 2.8888888888888888,-2.1428571428571428 2.8571428571428572,-1.8433734939759043 2.8072289156626509,-1.8396226415094346 2.8113207547169816,-1.6486486486486487 2.756756756756757,-1.76510067114094 2.8926174496644301,-0.53846153846153855 4.2307692307692308,1.8148148148148147 5.4074074074074074,1.588235294117647 2.2352941176470589,1.819672131147541 2.1967213114754101,2 4,2 2.1666666666666665,2.3538461538461544 2.1076923076923078,2 1.6875000000000004,2 -2,1.2173913043478262 -3.8260869565217392,1.7375886524822697 1.3758865248226959,1.5073170731707317 1.1024390243902444,1.1428571428571428 -4,-0.59322033898305082 -8.0508474576271194),(1.666666666666667 1.5999999999999988,1.5675675675675675 1.8378378378378377,1.4374999999999991 1.8750000000000002,1.0487804878048776 2.3414634146341466,0.46666666666666712 2.6060606060606055,0.086956521739131043 2.2608695652173911,1.4374999999999991 1.8750000000000002,1.666666666666667 1.5999999999999988))",

View File

@ -2,9 +2,8 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2013, 2014, 2015. // This file was modified by Oracle on 2013-2021.
// Modifications copyright (c) 2013-2015 Oracle and/or its affiliates. // Modifications copyright (c) 2013-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -19,7 +18,8 @@
template <typename P> template <typename P>
void test_linestring_linestring() void test_linestring_linestring()
{ {
typedef bg::model::linestring<P> ls; using coord_t = typename bg::coordinate_type<P>::type;
using ls = bg::model::linestring<P>;
test_geometry<ls, ls>("LINESTRING(0 0, 2 2, 3 2)", "LINESTRING(0 0, 2 2, 3 2)", "1FFF0FFF2"); test_geometry<ls, ls>("LINESTRING(0 0, 2 2, 3 2)", "LINESTRING(0 0, 2 2, 3 2)", "1FFF0FFF2");
test_geometry<ls, ls>("LINESTRING(0 0,3 2)", "LINESTRING(0 0, 2 2, 3 2)", "FF1F0F1F2"); test_geometry<ls, ls>("LINESTRING(0 0,3 2)", "LINESTRING(0 0, 2 2, 3 2)", "FF1F0F1F2");
@ -185,8 +185,7 @@ void test_linestring_linestring()
// Point/Point // Point/Point
//test_geometry<ls, ls>("LINESTRING(0 0)", "LINESTRING(0 0)", "0FFFFFFF2"); //test_geometry<ls, ls>("LINESTRING(0 0)", "LINESTRING(0 0)", "0FFFFFFF2");
if ( BOOST_GEOMETRY_CONDITION( if ( BOOST_GEOMETRY_CONDITION(std::is_floating_point<coord_t>::value) )
boost::is_floating_point<typename bg::coordinate_type<ls>::type>::value ) )
{ {
// https://svn.boost.org/trac/boost/ticket/10904 // https://svn.boost.org/trac/boost/ticket/10904
// very small segments // very small segments
@ -198,8 +197,7 @@ void test_linestring_linestring()
"FF1F00102", "F0FFFF102"); // on some platforms the first Linestring may be detected as degenerated to Point "FF1F00102", "F0FFFF102"); // on some platforms the first Linestring may be detected as degenerated to Point
} }
if ( BOOST_GEOMETRY_CONDITION(( if ( BOOST_GEOMETRY_CONDITION((std::is_same<coord_t, double>::value)) )
boost::is_same<typename bg::coordinate_type<ls>::type, double>::value )) )
{ {
// detected as collinear // detected as collinear
test_geometry<ls, ls>("LINESTRING(1 -10, 3.069359e+307 3.069359e+307)", test_geometry<ls, ls>("LINESTRING(1 -10, 3.069359e+307 3.069359e+307)",
@ -247,8 +245,9 @@ void test_linestring_linestring()
template <typename P> template <typename P>
void test_linestring_multi_linestring() void test_linestring_multi_linestring()
{ {
typedef bg::model::linestring<P> ls; using coord_t = typename bg::coordinate_type<P>::type;
typedef bg::model::multi_linestring<ls> mls; using ls = bg::model::linestring<P>;
using mls = bg::model::multi_linestring<ls>;
// LS disjoint // LS disjoint
test_geometry<ls, mls>("LINESTRING(0 0,10 0)", "MULTILINESTRING((1 0,2 0),(1 1,2 1))", "101FF0102"); test_geometry<ls, mls>("LINESTRING(0 0,10 0)", "MULTILINESTRING((1 0,2 0),(1 1,2 1))", "101FF0102");
@ -347,7 +346,7 @@ void test_linestring_multi_linestring()
"10FF0F102"); // | "10FF0F102"); // |
// | // |
if ( BOOST_GEOMETRY_CONDITION(boost::is_floating_point<typename bg::coordinate_type<ls>::type>::value) ) if ( BOOST_GEOMETRY_CONDITION(std::is_floating_point<coord_t>::value) )
{ {
// related to https://svn.boost.org/trac/boost/ticket/10904 // related to https://svn.boost.org/trac/boost/ticket/10904
test_geometry<ls, mls>("LINESTRING(-2305843009213693956 4611686018427387906, -33 -92, 78 83)", test_geometry<ls, mls>("LINESTRING(-2305843009213693956 4611686018427387906, -33 -92, 78 83)",
@ -386,8 +385,9 @@ void test_linestring_multi_linestring()
template <typename P> template <typename P>
void test_multi_linestring_multi_linestring() void test_multi_linestring_multi_linestring()
{ {
typedef bg::model::linestring<P> ls; using coord_t = typename bg::coordinate_type<P>::type;
typedef bg::model::multi_linestring<ls> mls; using ls = bg::model::linestring<P>;
using mls = bg::model::multi_linestring<ls>;
test_geometry<mls, mls>("MULTILINESTRING((0 0,0 0,18 0,18 0,19 0,19 0,19 0,30 0,30 0))", test_geometry<mls, mls>("MULTILINESTRING((0 0,0 0,18 0,18 0,19 0,19 0,19 0,30 0,30 0))",
"MULTILINESTRING((0 10,5 0,20 0,20 0,30 0))", "MULTILINESTRING((0 10,5 0,20 0,20 0,30 0))",
@ -415,8 +415,7 @@ void test_multi_linestring_multi_linestring()
"MULTILINESTRING((5 5,0 5),(5 5,5 0),(10 10,10 5,5 5,5 10,10 10))", "MULTILINESTRING((5 5,0 5),(5 5,5 0),(10 10,10 5,5 5,5 10,10 10))",
"10FFFFFF2"); "10FFFFFF2");
if ( BOOST_GEOMETRY_CONDITION(( if ( BOOST_GEOMETRY_CONDITION((std::is_same<coord_t, double>::value)) )
boost::is_same<typename bg::coordinate_type<P>::type, double>::value )) )
{ {
// assertion failure in 1.57 // assertion failure in 1.57
test_geometry<mls, mls>("MULTILINESTRING((-0.59322033898305082 -8.0508474576271194,-2.882352941176471 -7.7647058823529411,-2.8823529411764706 -7.7647058823529411,-3.7361111111111112 -6.5694444444444446,-3.4404145077720205 -5.766839378238342,-4.1864406779661012 -3.6779661016949152,-7.5252525252525251 -5.5858585858585865,-7.5862068965517242 -5.1896551724137936,-4.47887323943662 -2.859154929577465,-4.5789473684210531 -2.5789473684210527,-3 -1,-2.9310344827586206 -0.86206896551724144,-3.1764705882352944 -0.70588235294117663,-4.7401960784313726 -2.1274509803921577,-5.3255813953488369 -0.48837209302325502,-4.7872340425531918 0.31914893617021284,-5.8571428571428577 1.0000000000000007,-5.3255813953488369 -0.48837209302325502,-5.9473684210526319 -1.4210526315789465,-8 2,-7.7333333333333334 2.1939393939393939,-8.8294573643410867 2.891472868217055,-8.8556701030927822 3.061855670103093,-7.5999999999999996 3.6000000000000001,-7.7999999999999998 3.7999999999999998,-7.75 3.7916666666666665,-7.5471698113207548 3.6226415094339623,-7.3200000000000003 3.7200000000000002,-3.473684210526315 3.0789473684210527,-3.2549019607843133 3.2156862745098036,-2.9999999999999982 3.1428571428571423,-3.1733333333333325 3.2666666666666666,-2.9180327868852456 3.4262295081967209,-2.8723404255319145 3.1063829787234041,-2.1111111111111112 2.8888888888888888,-2.1428571428571428 2.8571428571428572,-1.8433734939759043 2.8072289156626509,-1.8396226415094346 2.8113207547169816,-1.6486486486486487 2.756756756756757,-1.76510067114094 2.8926174496644301,-0.53846153846153855 4.2307692307692308,1.8148148148148147 5.4074074074074074,1.588235294117647 2.2352941176470589,1.819672131147541 2.1967213114754101,2 4,2 2.1666666666666665,2.3538461538461544 2.1076923076923078,2 1.6875000000000004,2 -2,1.2173913043478262 -3.8260869565217392,1.7375886524822697 1.3758865248226959,1.5073170731707317 1.1024390243902444,1.1428571428571428 -4,-0.59322033898305082 -8.0508474576271194),(1.666666666666667 1.5999999999999988,1.5675675675675675 1.8378378378378377,1.4374999999999991 1.8750000000000002,1.0487804878048776 2.3414634146341466,0.46666666666666712 2.6060606060606055,0.086956521739131043 2.2608695652173911,1.4374999999999991 1.8750000000000002,1.666666666666667 1.5999999999999988))", test_geometry<mls, mls>("MULTILINESTRING((-0.59322033898305082 -8.0508474576271194,-2.882352941176471 -7.7647058823529411,-2.8823529411764706 -7.7647058823529411,-3.7361111111111112 -6.5694444444444446,-3.4404145077720205 -5.766839378238342,-4.1864406779661012 -3.6779661016949152,-7.5252525252525251 -5.5858585858585865,-7.5862068965517242 -5.1896551724137936,-4.47887323943662 -2.859154929577465,-4.5789473684210531 -2.5789473684210527,-3 -1,-2.9310344827586206 -0.86206896551724144,-3.1764705882352944 -0.70588235294117663,-4.7401960784313726 -2.1274509803921577,-5.3255813953488369 -0.48837209302325502,-4.7872340425531918 0.31914893617021284,-5.8571428571428577 1.0000000000000007,-5.3255813953488369 -0.48837209302325502,-5.9473684210526319 -1.4210526315789465,-8 2,-7.7333333333333334 2.1939393939393939,-8.8294573643410867 2.891472868217055,-8.8556701030927822 3.061855670103093,-7.5999999999999996 3.6000000000000001,-7.7999999999999998 3.7999999999999998,-7.75 3.7916666666666665,-7.5471698113207548 3.6226415094339623,-7.3200000000000003 3.7200000000000002,-3.473684210526315 3.0789473684210527,-3.2549019607843133 3.2156862745098036,-2.9999999999999982 3.1428571428571423,-3.1733333333333325 3.2666666666666666,-2.9180327868852456 3.4262295081967209,-2.8723404255319145 3.1063829787234041,-2.1111111111111112 2.8888888888888888,-2.1428571428571428 2.8571428571428572,-1.8433734939759043 2.8072289156626509,-1.8396226415094346 2.8113207547169816,-1.6486486486486487 2.756756756756757,-1.76510067114094 2.8926174496644301,-0.53846153846153855 4.2307692307692308,1.8148148148148147 5.4074074074074074,1.588235294117647 2.2352941176470589,1.819672131147541 2.1967213114754101,2 4,2 2.1666666666666665,2.3538461538461544 2.1076923076923078,2 1.6875000000000004,2 -2,1.2173913043478262 -3.8260869565217392,1.7375886524822697 1.3758865248226959,1.5073170731707317 1.1024390243902444,1.1428571428571428 -4,-0.59322033898305082 -8.0508474576271194),(1.666666666666667 1.5999999999999988,1.5675675675675675 1.8378378378378377,1.4374999999999991 1.8750000000000002,1.0487804878048776 2.3414634146341466,0.46666666666666712 2.6060606060606055,0.086956521739131043 2.2608695652173911,1.4374999999999991 1.8750000000000002,1.666666666666667 1.5999999999999988))",

View File

@ -1,8 +1,7 @@
// Boost.Geometry // Boost.Geometry
// Unit Test // Unit Test
// Copyright (c) 2016, Oracle and/or its affiliates. // Copyright (c) 2016-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -16,7 +15,8 @@
template <typename P> template <typename P>
void test_linestring_linestring() void test_linestring_linestring()
{ {
typedef bg::model::linestring<P> ls; using coord_t = typename bg::coordinate_type<P>::type;
using ls = bg::model::linestring<P>;
test_geometry<ls, ls>("LINESTRING(0 0, 2 2, 3 2)", "LINESTRING(0 0, 2 2, 3 2)", "1FFF0FFF2"); test_geometry<ls, ls>("LINESTRING(0 0, 2 2, 3 2)", "LINESTRING(0 0, 2 2, 3 2)", "1FFF0FFF2");
test_geometry<ls, ls>("LINESTRING(0 0,3 2)", "LINESTRING(0 0, 2 2, 3 2)", "FF1F0F1F2"); test_geometry<ls, ls>("LINESTRING(0 0,3 2)", "LINESTRING(0 0, 2 2, 3 2)", "FF1F0F1F2");
@ -182,8 +182,7 @@ void test_linestring_linestring()
// Point/Point // Point/Point
//test_geometry<ls, ls>("LINESTRING(0 0)", "LINESTRING(0 0)", "0FFFFFFF2"); //test_geometry<ls, ls>("LINESTRING(0 0)", "LINESTRING(0 0)", "0FFFFFFF2");
if ( BOOST_GEOMETRY_CONDITION( if ( BOOST_GEOMETRY_CONDITION(std::is_floating_point<coord_t>::value) )
boost::is_floating_point<typename bg::coordinate_type<ls>::type>::value ) )
{ {
// https://svn.boost.org/trac/boost/ticket/10904 // https://svn.boost.org/trac/boost/ticket/10904
// very small segments // very small segments
@ -195,8 +194,7 @@ void test_linestring_linestring()
"*********"); // TODO: be more specific with the result "*********"); // TODO: be more specific with the result
} }
if ( BOOST_GEOMETRY_CONDITION(( if ( BOOST_GEOMETRY_CONDITION((std::is_same<coord_t, double>::value)) )
boost::is_same<typename bg::coordinate_type<ls>::type, double>::value )) )
{ {
// detected as collinear // detected as collinear
test_geometry<ls, ls>("LINESTRING(1 -10, 3.069359e+307 3.069359e+307)", test_geometry<ls, ls>("LINESTRING(1 -10, 3.069359e+307 3.069359e+307)",
@ -244,8 +242,9 @@ void test_linestring_linestring()
template <typename P> template <typename P>
void test_linestring_multi_linestring() void test_linestring_multi_linestring()
{ {
typedef bg::model::linestring<P> ls; using coord_t = typename bg::coordinate_type<P>::type;
typedef bg::model::multi_linestring<ls> mls; using ls = bg::model::linestring<P>;
using mls = bg::model::multi_linestring<ls>;
// LS disjoint // LS disjoint
test_geometry<ls, mls>("LINESTRING(0 0,10 0)", "MULTILINESTRING((1 0,2 0),(1 1,2 1))", "101FF0102"); test_geometry<ls, mls>("LINESTRING(0 0,10 0)", "MULTILINESTRING((1 0,2 0),(1 1,2 1))", "101FF0102");
@ -344,7 +343,7 @@ void test_linestring_multi_linestring()
"10FF0F102"); // | "10FF0F102"); // |
// | // |
if ( BOOST_GEOMETRY_CONDITION(boost::is_floating_point<typename bg::coordinate_type<ls>::type>::value) ) if ( BOOST_GEOMETRY_CONDITION(std::is_floating_point<coord_t>::value) )
{ {
// related to https://svn.boost.org/trac/boost/ticket/10904 // related to https://svn.boost.org/trac/boost/ticket/10904
test_geometry<ls, mls>("LINESTRING(-2305843009213693956 4611686018427387906, -33 -92, 78 83)", test_geometry<ls, mls>("LINESTRING(-2305843009213693956 4611686018427387906, -33 -92, 78 83)",
@ -389,8 +388,9 @@ void test_linestring_multi_linestring()
template <typename P> template <typename P>
void test_multi_linestring_multi_linestring() void test_multi_linestring_multi_linestring()
{ {
typedef bg::model::linestring<P> ls; using coord_t = typename bg::coordinate_type<P>::type;
typedef bg::model::multi_linestring<ls> mls; using ls = bg::model::linestring<P>;
using mls = bg::model::multi_linestring<ls>;
test_geometry<mls, mls>("MULTILINESTRING((0 0,0 0,18 0,18 0,19 0,19 0,19 0,30 0,30 0))", test_geometry<mls, mls>("MULTILINESTRING((0 0,0 0,18 0,18 0,19 0,19 0,19 0,30 0,30 0))",
"MULTILINESTRING((0 10,5 0,20 0,20 0,30 0))", "MULTILINESTRING((0 10,5 0,20 0,20 0,30 0))",
@ -418,8 +418,7 @@ void test_multi_linestring_multi_linestring()
"MULTILINESTRING((5 5.0190018174896416,0 5),(5 5.0190018174896416,5 0),(10 10,10 5,5 5.0190018174896416,5 10,10 10))", "MULTILINESTRING((5 5.0190018174896416,0 5),(5 5.0190018174896416,5 0),(10 10,10 5,5 5.0190018174896416,5 10,10 10))",
"10FFFFFF2"); "10FFFFFF2");
if ( BOOST_GEOMETRY_CONDITION(( if ( BOOST_GEOMETRY_CONDITION((std::is_same<coord_t, double>::value)) )
boost::is_same<typename bg::coordinate_type<P>::type, double>::value )) )
{ {
// assertion failure in 1.57 // assertion failure in 1.57
test_geometry<mls, mls>("MULTILINESTRING((-0.59322033898305082 -8.0508474576271194,-2.882352941176471 -7.7647058823529411,-2.8823529411764706 -7.7647058823529411,-3.7361111111111112 -6.5694444444444446,-3.4404145077720205 -5.766839378238342,-4.1864406779661012 -3.6779661016949152,-7.5252525252525251 -5.5858585858585865,-7.5862068965517242 -5.1896551724137936,-4.47887323943662 -2.859154929577465,-4.5789473684210531 -2.5789473684210527,-3 -1,-2.9310344827586206 -0.86206896551724144,-3.1764705882352944 -0.70588235294117663,-4.7401960784313726 -2.1274509803921577,-5.3255813953488369 -0.48837209302325502,-4.7872340425531918 0.31914893617021284,-5.8571428571428577 1.0000000000000007,-5.3255813953488369 -0.48837209302325502,-5.9473684210526319 -1.4210526315789465,-8 2,-7.7333333333333334 2.1939393939393939,-8.8294573643410867 2.891472868217055,-8.8556701030927822 3.061855670103093,-7.5999999999999996 3.6000000000000001,-7.7999999999999998 3.7999999999999998,-7.75 3.7916666666666665,-7.5471698113207548 3.6226415094339623,-7.3200000000000003 3.7200000000000002,-3.473684210526315 3.0789473684210527,-3.2549019607843133 3.2156862745098036,-2.9999999999999982 3.1428571428571423,-3.1733333333333325 3.2666666666666666,-2.9180327868852456 3.4262295081967209,-2.8723404255319145 3.1063829787234041,-2.1111111111111112 2.8888888888888888,-2.1428571428571428 2.8571428571428572,-1.8433734939759043 2.8072289156626509,-1.8396226415094346 2.8113207547169816,-1.6486486486486487 2.756756756756757,-1.76510067114094 2.8926174496644301,-0.53846153846153855 4.2307692307692308,1.8148148148148147 5.4074074074074074,1.588235294117647 2.2352941176470589,1.819672131147541 2.1967213114754101,2 4,2 2.1666666666666665,2.3538461538461544 2.1076923076923078,2 1.6875000000000004,2 -2,1.2173913043478262 -3.8260869565217392,1.7375886524822697 1.3758865248226959,1.5073170731707317 1.1024390243902444,1.1428571428571428 -4,-0.59322033898305082 -8.0508474576271194),(1.666666666666667 1.5999999999999988,1.5675675675675675 1.8378378378378377,1.4374999999999991 1.8750000000000002,1.0487804878048776 2.3414634146341466,0.46666666666666712 2.6060606060606055,0.086956521739131043 2.2608695652173911,1.4374999999999991 1.8750000000000002,1.666666666666667 1.5999999999999988))", test_geometry<mls, mls>("MULTILINESTRING((-0.59322033898305082 -8.0508474576271194,-2.882352941176471 -7.7647058823529411,-2.8823529411764706 -7.7647058823529411,-3.7361111111111112 -6.5694444444444446,-3.4404145077720205 -5.766839378238342,-4.1864406779661012 -3.6779661016949152,-7.5252525252525251 -5.5858585858585865,-7.5862068965517242 -5.1896551724137936,-4.47887323943662 -2.859154929577465,-4.5789473684210531 -2.5789473684210527,-3 -1,-2.9310344827586206 -0.86206896551724144,-3.1764705882352944 -0.70588235294117663,-4.7401960784313726 -2.1274509803921577,-5.3255813953488369 -0.48837209302325502,-4.7872340425531918 0.31914893617021284,-5.8571428571428577 1.0000000000000007,-5.3255813953488369 -0.48837209302325502,-5.9473684210526319 -1.4210526315789465,-8 2,-7.7333333333333334 2.1939393939393939,-8.8294573643410867 2.891472868217055,-8.8556701030927822 3.061855670103093,-7.5999999999999996 3.6000000000000001,-7.7999999999999998 3.7999999999999998,-7.75 3.7916666666666665,-7.5471698113207548 3.6226415094339623,-7.3200000000000003 3.7200000000000002,-3.473684210526315 3.0789473684210527,-3.2549019607843133 3.2156862745098036,-2.9999999999999982 3.1428571428571423,-3.1733333333333325 3.2666666666666666,-2.9180327868852456 3.4262295081967209,-2.8723404255319145 3.1063829787234041,-2.1111111111111112 2.8888888888888888,-2.1428571428571428 2.8571428571428572,-1.8433734939759043 2.8072289156626509,-1.8396226415094346 2.8113207547169816,-1.6486486486486487 2.756756756756757,-1.76510067114094 2.8926174496644301,-0.53846153846153855 4.2307692307692308,1.8148148148148147 5.4074074074074074,1.588235294117647 2.2352941176470589,1.819672131147541 2.1967213114754101,2 4,2 2.1666666666666665,2.3538461538461544 2.1076923076923078,2 1.6875000000000004,2 -2,1.2173913043478262 -3.8260869565217392,1.7375886524822697 1.3758865248226959,1.5073170731707317 1.1024390243902444,1.1428571428571428 -4,-0.59322033898305082 -8.0508474576271194),(1.666666666666667 1.5999999999999988,1.5675675675675675 1.8378378378378377,1.4374999999999991 1.8750000000000002,1.0487804878048776 2.3414634146341466,0.46666666666666712 2.6060606060606055,0.086956521739131043 2.2608695652173911,1.4374999999999991 1.8750000000000002,1.666666666666667 1.5999999999999988))",

View File

@ -2,8 +2,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2013, 2014, 2015, 2017. // This file was modified by Oracle on 2013-2021.
// Modifications copyright (c) 2013-2017 Oracle and/or its affiliates. // Modifications copyright (c) 2013-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -17,18 +17,11 @@
#include <boost/variant.hpp> #include <boost/variant.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/algorithms/relate.hpp> #include <boost/geometry/algorithms/relate.hpp>
#include <boost/geometry/algorithms/relation.hpp> #include <boost/geometry/algorithms/relation.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/io/wkt/read.hpp> #include <boost/geometry/io/wkt/read.hpp>
#include <boost/geometry/strategies/strategies.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_box_by_side.hpp>
namespace bgdr = bg::detail::relate; namespace bgdr = bg::detail::relate;
@ -190,7 +183,7 @@ void check_geometry(Geometry1 const& geometry1,
// brake the expected output // brake the expected output
std::string expected_interrupt = expected1; std::string expected_interrupt = expected1;
bool changed = false; bool changed = false;
BOOST_FOREACH(char & c, expected_interrupt) for (char & c : expected_interrupt)
{ {
if ( c >= '0' && c <= '9' ) if ( c >= '0' && c <= '9' )
{ {

View File

@ -3,8 +3,8 @@
// Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2015, 2016. // This file was modified by Oracle on 2015-2021.
// Modifications copyright (c) 2015-2016, Oracle and/or its affiliates. // Modifications copyright (c) 2015-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -293,7 +293,7 @@ void test_all()
1, 61, 10.2717, 1, 61, 10.2717,
1, 61, 10.2717); 1, 61, 10.2717);
if ( BOOST_GEOMETRY_CONDITION((boost::is_same<ct, double>::value)) ) if ( BOOST_GEOMETRY_CONDITION((std::is_same<ct, double>::value)) )
{ {
test_one<polygon, polygon, polygon>("buffer_mp2", test_one<polygon, polygon, polygon>("buffer_mp2",
buffer_mp2[0], buffer_mp2[1], buffer_mp2[0], buffer_mp2[1],

View File

@ -3,9 +3,8 @@
// Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2015, 2017. // This file was modified by Oracle on 2015-2021.
// Modifications copyright (c) 2015-2017, Oracle and/or its affiliates. // Modifications copyright (c) 2015-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -116,7 +115,7 @@ void test_areal_linear()
test_one_lp<LineString, LineString, Polygon>("case26", "LINESTRING(4 0,4 3,4 5,7 5)", poly_9, 2, 5, 5.0); test_one_lp<LineString, LineString, Polygon>("case26", "LINESTRING(4 0,4 3,4 5,7 5)", poly_9, 2, 5, 5.0);
test_one_lp<LineString, LineString, Polygon>("case27", "LINESTRING(4 4,4 5,5 5)", poly_9, 1, 3, 2.0); test_one_lp<LineString, LineString, Polygon>("case27", "LINESTRING(4 4,4 5,5 5)", poly_9, 1, 3, 2.0);
if (BOOST_GEOMETRY_CONDITION( (! boost::is_same<ct, float>::value)) ) if (BOOST_GEOMETRY_CONDITION( (! std::is_same<ct, float>::value)) )
{ {
// Fails for float // Fails for float
test_one_lp<LineString, LineString, Polygon>("case28", test_one_lp<LineString, LineString, Polygon>("case28",

View File

@ -1,29 +1,25 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2020, Oracle and/or its affiliates. // Copyright (c) 2020-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
#include <tuple>
#include <boost/tuple/tuple.hpp>
#include <boost/geometry/algorithms/correct.hpp> #include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/equals.hpp> #include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/algorithms/difference.hpp> #include <boost/geometry/algorithms/difference.hpp>
#include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/io/wkt/wkt.hpp> #include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/strategies/cartesian/intersection.hpp> #include <boost/geometry/util/type_traits.hpp>
#include <boost/geometry/strategies/cartesian/point_in_poly_winding.hpp>
#include <boost/geometry/strategies/cartesian/point_in_point.hpp>
#include <boost/tuple/tuple.hpp>
// TEMP
#include <boost/geometry/strategies/cartesian.hpp>
#include <boost/geometry/strategies/geographic.hpp>
#include <boost/geometry/strategies/spherical.hpp>
typedef bg::model::point<double, 2, bg::cs::cartesian> Pt; typedef bg::model::point<double, 2, bg::cs::cartesian> Pt;
@ -34,12 +30,6 @@ typedef bg::model::multi_point<Pt> MPt;
typedef bg::model::multi_linestring<Ls> MLs; typedef bg::model::multi_linestring<Ls> MLs;
typedef bg::model::multi_polygon<Po> MPo; typedef bg::model::multi_polygon<Po> MPo;
#ifdef BOOST_GEOMETRY_CXX11_TUPLE
#include <tuple>
#endif
template <typename G> template <typename G>
inline void check(std::string const& wkt1, inline void check(std::string const& wkt1,
std::string const& wkt2, std::string const& wkt2,
@ -83,8 +73,6 @@ inline void check(std::string const& wkt1,
check(wkt1, wkt2, pair.second, out_str); check(wkt1, wkt2, pair.second, out_str);
} }
#ifdef BOOST_GEOMETRY_CXX11_TUPLE
template <int I> template <int I>
inline void check(std::string const& wkt1, inline void check(std::string const& wkt1,
std::string const& wkt2, std::string const& wkt2,
@ -94,22 +82,13 @@ inline void check(std::string const& wkt1,
check(wkt1, wkt2, std::get<I>(tup), out_str); check(wkt1, wkt2, std::get<I>(tup), out_str);
} }
#endif
template <typename Geometry> template <typename Geometry>
struct out_id using out_id = std::integral_constant
: boost::mpl::if_c
< <
boost::is_base_of<bg::pointlike_tag, typename bg::tag<Geometry>::type>::value, int,
boost::mpl::int_<0>, (bg::util::is_pointlike<Geometry>::value ? 0 :
typename boost::mpl::if_c (bg::util::is_linear<Geometry>::value ? 1 : 2))
< >;
boost::is_base_of<bg::linear_tag, typename bg::tag<Geometry>::type>::value,
boost::mpl::int_<1>,
boost::mpl::int_<2>
>::type
>::type
{};
template <typename In1, typename In2, typename Tup> template <typename In1, typename In2, typename Tup>
inline void test_one(std::string const& in1_str, inline void test_one(std::string const& in1_str,
@ -403,10 +382,7 @@ int test_main(int, char* [])
{ {
test_pair<std::pair<MPt, MLs> >(); test_pair<std::pair<MPt, MLs> >();
test_tuple<boost::tuple<MPt, MLs, MPo> >(); test_tuple<boost::tuple<MPt, MLs, MPo> >();
#ifdef BOOST_GEOMETRY_CXX11_TUPLE
test_tuple<std::tuple<MPt, MLs, MPo> >(); test_tuple<std::tuple<MPt, MLs, MPo> >();
#endif
return 0; return 0;
} }

View File

@ -25,7 +25,6 @@
#include "../setop_output_type.hpp" #include "../setop_output_type.hpp"
#include <boost/core/ignore_unused.hpp> #include <boost/core/ignore_unused.hpp>
#include <boost/foreach.hpp>
#include <boost/range/algorithm/copy.hpp> #include <boost/range/algorithm/copy.hpp>
#include <boost/range/size.hpp> #include <boost/range/size.hpp>

View File

@ -5,8 +5,8 @@
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2015, 2016, 2017. // This file was modified by Oracle on 2015-2021.
// Modifications copyright (c) 2015-2017, Oracle and/or its affiliates. // Modifications copyright (c) 2015-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -941,9 +941,7 @@ int test_main(int, char* [])
test_ticket_10868<long>("MULTIPOLYGON(((33520458 6878575,33480192 14931538,31446819 18947953,30772384 19615678,30101303 19612322,30114725 16928001,33520458 6878575)))"); test_ticket_10868<long>("MULTIPOLYGON(((33520458 6878575,33480192 14931538,31446819 18947953,30772384 19615678,30101303 19612322,30114725 16928001,33520458 6878575)))");
} }
#if defined(BOOST_HAS_LONG_LONG) test_ticket_10868<long long>("MULTIPOLYGON(((33520458 6878575,33480192 14931538,31446819 18947953,30772384 19615678,30101303 19612322,30114725 16928001,33520458 6878575)))");
test_ticket_10868<boost::long_long_type>("MULTIPOLYGON(((33520458 6878575,33480192 14931538,31446819 18947953,30772384 19615678,30101303 19612322,30114725 16928001,33520458 6878575)))");
#endif
#endif #endif
#endif #endif

View File

@ -3,8 +3,8 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2016-2020. // This file was modified by Oracle on 2016-2021.
// Modifications copyright (c) 2016-2020, Oracle and/or its affiliates. // Modifications copyright (c) 2016-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -17,7 +17,6 @@
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>
#include <boost/foreach.hpp>
#include <boost/range/value_type.hpp> #include <boost/range/value_type.hpp>
#include <boost/variant/variant.hpp> #include <boost/variant/variant.hpp>
@ -31,10 +30,9 @@
#include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/io/wkt/wkt.hpp> #include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#if defined(TEST_WITH_SVG) #if defined(TEST_WITH_SVG)
# include <boost/geometry/io/svg/svg_mapper.hpp> # include <boost/geometry/io/svg/svg_mapper.hpp>
@ -73,9 +71,7 @@ void check_result(IntersectionOutput const& intersection_output,
typename bg::default_area_result<G1>::type length_or_area = 0; typename bg::default_area_result<G1>::type length_or_area = 0;
int n = 0; int n = 0;
std::size_t nholes = 0; std::size_t nholes = 0;
for (typename IntersectionOutput::const_iterator it = intersection_output.begin(); for (auto it = intersection_output.begin(); it != intersection_output.end(); ++it)
it != intersection_output.end();
++it)
{ {
if (! expected_count.empty()) if (! expected_count.empty())
{ {

View File

@ -1,6 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014-2020, Oracle and/or its affiliates. // Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -14,7 +14,6 @@
#include <limits> #include <limits>
#include <boost/range/value_type.hpp> #include <boost/range/value_type.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/geometry/geometry.hpp> #include <boost/geometry/geometry.hpp>
#include "../test_set_ops_linear_linear.hpp" #include "../test_set_ops_linear_linear.hpp"
@ -212,19 +211,8 @@ public:
Geometry2 rg2(geometry2); Geometry2 rg2(geometry2);
bg::reverse<Geometry2>(rg2); bg::reverse<Geometry2>(rg2);
typedef typename bg::tag_cast static const bool are_linear = bg::util::is_linear<Geometry1>::value
< && bg::util::is_linear<Geometry2>::value;
Geometry1, bg::linear_tag
>::type tag1_type;
typedef typename bg::tag_cast
<
Geometry2, bg::linear_tag
>::type tag2_type;
bool const are_linear
= boost::is_same<tag1_type, bg::linear_tag>::value
&& boost::is_same<tag2_type, bg::linear_tag>::value;
test_get_turns_ll_invariance<are_linear>::apply(geometry1, geometry2); test_get_turns_ll_invariance<are_linear>::apply(geometry1, geometry2);
#ifdef BOOST_GEOMETRY_TEST_DEBUG #ifdef BOOST_GEOMETRY_TEST_DEBUG

View File

@ -1,7 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014-2020, Oracle and/or its affiliates. // Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -23,7 +22,6 @@
#include <boost/range/iterator.hpp> #include <boost/range/iterator.hpp>
#include <boost/range/size.hpp> #include <boost/range/size.hpp>
#include <boost/range/value_type.hpp> #include <boost/range/value_type.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/geometry/policies/compare.hpp> #include <boost/geometry/policies/compare.hpp>
#include <boost/geometry/algorithms/equals.hpp> #include <boost/geometry/algorithms/equals.hpp>
@ -35,14 +33,9 @@ namespace bg = ::boost::geometry;
template <typename Linestring1, typename Linestring2>
struct ls_less struct ls_less
{ {
typedef typename boost::range_iterator<Linestring1 const>::type Iterator1; template <typename Linestring1, typename Linestring2>
typedef typename boost::range_iterator<Linestring2 const>::type Iterator2;
typedef bg::less<typename bg::point_type<Linestring1>::type> point_less;
bool operator()(Linestring1 const& linestring1, bool operator()(Linestring1 const& linestring1,
Linestring2 const& linestring2) const Linestring2 const& linestring2) const
{ {
@ -51,9 +44,10 @@ struct ls_less
return boost::size(linestring1) < boost::size(linestring2); return boost::size(linestring1) < boost::size(linestring2);
} }
Iterator1 it1 = boost::begin(linestring1); bg::less<typename bg::point_type<Linestring1>::type> less;
Iterator2 it2 = boost::begin(linestring2);
point_less less; auto it1 = boost::begin(linestring1);
auto it2 = boost::begin(linestring2);
for (; it1 != boost::end(linestring1); ++it1, ++it2) for (; it1 != boost::end(linestring1); ++it1, ++it2)
{ {
if (less(*it1, *it2)) if (less(*it1, *it2))
@ -70,21 +64,19 @@ struct ls_less
}; };
template <typename Linestring1, typename Linestring2>
struct ls_equal struct ls_equal
{ {
template <typename Linestring1, typename Linestring2>
bool operator()(Linestring1 const& linestring1, bool operator()(Linestring1 const& linestring1,
Linestring2 const& linestring2) const Linestring2 const& linestring2) const
{ {
ls_less<Linestring1, Linestring2> less; ls_less less;
return ! less(linestring1, linestring2) return ! less(linestring1, linestring2)
&& ! less(linestring2, linestring1); && ! less(linestring2, linestring1);
} }
}; };
template <typename Point1, typename Point2>
class pt_equal class pt_equal
{ {
private: private:
@ -106,6 +98,7 @@ private:
public: public:
pt_equal(double tolerence) : m_tolerence(tolerence) {} pt_equal(double tolerence) : m_tolerence(tolerence) {}
template <typename Point1, typename Point2>
bool operator()(Point1 const& point1, Point2 const& point2) const bool operator()(Point1 const& point1, Point2 const& point2) const
{ {
// allow for some tolerence in testing equality of points // allow for some tolerence in testing equality of points
@ -121,11 +114,6 @@ struct multilinestring_equals
template <typename MultiLinestring, bool Enable> template <typename MultiLinestring, bool Enable>
struct unique struct unique
{ {
typedef typename boost::range_value<MultiLinestring>::type Linestring;
typedef typename bg::point_type<MultiLinestring>::type point_type;
typedef ls_equal<Linestring, Linestring> linestring_equal;
typedef pt_equal<point_type, point_type> point_equal;
template <typename Range, typename EqualTo> template <typename Range, typename EqualTo>
void apply_to_range(Range& range, EqualTo const& equal_to) void apply_to_range(Range& range, EqualTo const& equal_to)
{ {
@ -139,9 +127,9 @@ struct multilinestring_equals
for (typename boost::range_iterator<MultiLinestring>::type it for (typename boost::range_iterator<MultiLinestring>::type it
= boost::begin(mls); it != boost::end(mls); ++it) = boost::begin(mls); it != boost::end(mls); ++it)
{ {
apply_to_range(*it, point_equal(tolerance)); apply_to_range(*it, pt_equal(tolerance));
} }
apply_to_range(mls, linestring_equal()); apply_to_range(mls, ls_equal());
} }
}; };
@ -159,50 +147,11 @@ struct multilinestring_equals
MultiLinestring2 const& multilinestring2, MultiLinestring2 const& multilinestring2,
double tolerance) double tolerance)
{ {
typedef typename boost::range_iterator
<
MultiLinestring1 const
>::type ls1_iterator;
typedef typename boost::range_iterator
<
MultiLinestring2 const
>::type ls2_iterator;
typedef typename boost::range_value<MultiLinestring1>::type Linestring1;
typedef typename boost::range_value<MultiLinestring2>::type Linestring2;
typedef typename boost::range_iterator
<
Linestring1 const
>::type point1_iterator;
typedef typename boost::range_iterator
<
Linestring2 const
>::type point2_iterator;
typedef ls_less<Linestring1, Linestring2> linestring_less;
typedef pt_equal
<
typename boost::range_value
<
typename boost::range_value<MultiLinestring1>::type
>::type,
typename boost::range_value
<
typename boost::range_value<MultiLinestring2>::type
>::type
> point_equal;
MultiLinestring1 mls1 = multilinestring1; MultiLinestring1 mls1 = multilinestring1;
MultiLinestring2 mls2 = multilinestring2; MultiLinestring2 mls2 = multilinestring2;
std::sort(boost::begin(mls1), boost::end(mls1), linestring_less()); std::sort(boost::begin(mls1), boost::end(mls1), ls_less());
std::sort(boost::begin(mls2), boost::end(mls2), linestring_less()); std::sort(boost::begin(mls2), boost::end(mls2), ls_less());
unique<MultiLinestring1, EnableUnique>()(mls1, tolerance); unique<MultiLinestring1, EnableUnique>()(mls1, tolerance);
unique<MultiLinestring2, EnableUnique>()(mls2, tolerance); unique<MultiLinestring2, EnableUnique>()(mls2, tolerance);
@ -212,19 +161,19 @@ struct multilinestring_equals
return false; return false;
} }
ls1_iterator it1 = boost::begin(mls1); auto it1 = boost::begin(mls1);
ls2_iterator it2 = boost::begin(mls2); auto it2 = boost::begin(mls2);
for (; it1 != boost::end(mls1); ++it1, ++it2) for (; it1 != boost::end(mls1); ++it1, ++it2)
{ {
if (boost::size(*it1) != boost::size(*it2)) if (boost::size(*it1) != boost::size(*it2))
{ {
return false; return false;
} }
point1_iterator pit1 = boost::begin(*it1); auto pit1 = boost::begin(*it1);
point2_iterator pit2 = boost::begin(*it2); auto pit2 = boost::begin(*it2);
for (; pit1 != boost::end(*it1); ++pit1, ++pit2) for (; pit1 != boost::end(*it1); ++pit1, ++pit2)
{ {
if (! point_equal(tolerance)(*pit1, *pit2)) if (! pt_equal(tolerance)(*pit1, *pit2))
{ {
return false; return false;
} }
@ -257,9 +206,7 @@ private:
convert_isolated_points_to_segments(MultiLinestring const& multilinestring, convert_isolated_points_to_segments(MultiLinestring const& multilinestring,
OutputIterator oit) OutputIterator oit)
{ {
BOOST_AUTO_TPL(it, boost::begin(multilinestring)); for (auto it = boost::begin(multilinestring) ; it != boost::end(multilinestring); ++it)
for (; it != boost::end(multilinestring); ++it)
{ {
if (boost::size(*it) == 1) if (boost::size(*it) == 1)
{ {

View File

@ -1,7 +1,6 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2014-2020, Oracle and/or its affiliates. // Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -12,30 +11,27 @@
#define BOOST_GEOMETRY_TEST_SET_OPS_POINTLIKE_HPP #define BOOST_GEOMETRY_TEST_SET_OPS_POINTLIKE_HPP
#include <boost/geometry/geometry.hpp>
namespace bg = ::boost::geometry;
#include <from_wkt.hpp> #include <from_wkt.hpp>
#include <to_svg.hpp> #include <to_svg.hpp>
#include <algorithm> #include <algorithm>
#include <fstream> #include <fstream>
#include <boost/core/ignore_unused.hpp> #include <boost/core/ignore_unused.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/range/size.hpp> #include <boost/range/size.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/geometry/policies/compare.hpp>
#include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/algorithms/union.hpp>
#include <boost/geometry/algorithms/difference.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
#include <boost/geometry/algorithms/sym_difference.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay_type.hpp> #include <boost/geometry/algorithms/detail/overlay/overlay_type.hpp>
#include <boost/geometry/algorithms/difference.hpp>
#include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
#include <boost/geometry/algorithms/sym_difference.hpp>
#include <boost/geometry/algorithms/union.hpp>
#include <boost/geometry/io/wkt/write.hpp>
#include <boost/geometry/policies/compare.hpp>
namespace bg = ::boost::geometry;
//================================================================== //==================================================================
@ -69,8 +65,7 @@ void set_operation_output(std::string const& set_op_id,
mapper.map(g2, "stroke-opacity:1;stroke:rgb(153,204,0);stroke-width:4"); mapper.map(g2, "stroke-opacity:1;stroke:rgb(153,204,0);stroke-width:4");
mapper.map(g1, "stroke-opacity:1;stroke:rgb(51,51,153);stroke-width:2"); mapper.map(g1, "stroke-opacity:1;stroke:rgb(51,51,153);stroke-width:2");
BOOST_AUTO_TPL(it, output.begin()); for (auto it = output.begin(); it != output.end(); ++it)
for (; it != output.end(); ++it)
{ {
mapper.map(*it, mapper.map(*it,
"fill:rgb(255,0,255);stroke:rgb(0,0,0);stroke-width:1", "fill:rgb(255,0,255);stroke:rgb(0,0,0);stroke-width:1",
@ -106,8 +101,8 @@ struct equals
return false; return false;
} }
BOOST_AUTO_TPL(it1, boost::begin(mp1)); auto it1 = boost::begin(mp1);
BOOST_AUTO_TPL(it2, boost::begin(mp2)); auto it2 = boost::begin(mp2);
for (; it1 != boost::end(mp1); ++it1, ++it2) for (; it1 != boost::end(mp1); ++it1, ++it2)
{ {
if ( !bg::equals(*it1, *it2) ) if ( !bg::equals(*it1, *it2) )

View File

@ -3,8 +3,8 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2015-2020. // This file was modified by Oracle on 2015-2021.
// Modifications copyright (c) 2015-2020 Oracle and/or its affiliates. // Modifications copyright (c) 2015-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -24,7 +24,6 @@
#include "../setop_output_type.hpp" #include "../setop_output_type.hpp"
#include <boost/core/ignore_unused.hpp> #include <boost/core/ignore_unused.hpp>
#include <boost/foreach.hpp>
#include <boost/range/algorithm/copy.hpp> #include <boost/range/algorithm/copy.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
@ -41,15 +40,15 @@
#include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/io/wkt/wkt.hpp> #include <boost/geometry/io/wkt/wkt.hpp>
#if defined(TEST_WITH_SVG) #if defined(TEST_WITH_SVG)
# include <boost/geometry/io/svg/svg_mapper.hpp> # include <boost/geometry/io/svg/svg_mapper.hpp>
#endif #endif
#include <boost/geometry/strategies/strategies.hpp>
struct ut_settings : public ut_base_settings struct ut_settings : public ut_base_settings
{ {
ut_settings() ut_settings()
@ -80,8 +79,7 @@ template <typename Range>
inline std::size_t num_points(Range const& rng, bool add_for_open = false) inline std::size_t num_points(Range const& rng, bool add_for_open = false)
{ {
std::size_t result = 0; std::size_t result = 0;
for (typename boost::range_iterator<Range const>::type it = boost::begin(rng); for (auto it = boost::begin(rng); it != boost::end(rng); ++it)
it != boost::end(rng); ++it)
{ {
result += bg::num_points(*it, add_for_open); result += bg::num_points(*it, add_for_open);
} }
@ -139,8 +137,7 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2,
typename bg::default_area_result<OutputType>::type area = 0; typename bg::default_area_result<OutputType>::type area = 0;
std::size_t n = 0; std::size_t n = 0;
std::size_t holes = 0; std::size_t holes = 0;
for (typename result_type::iterator it = clip.begin(); for (auto it = clip.begin(); it != clip.end(); ++it)
it != clip.end(); ++it)
{ {
area += bg::area(*it); area += bg::area(*it);
holes += bg::num_interior_rings(*it); holes += bg::num_interior_rings(*it);
@ -158,9 +155,7 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2,
typename bg::default_area_result<OutputType>::type area_inserted = 0; typename bg::default_area_result<OutputType>::type area_inserted = 0;
int index = 0; int index = 0;
for (typename result_type::iterator it = inserted.begin(); for (auto it = inserted.begin(); it != inserted.end(); ++it, ++index)
it != inserted.end();
++it, ++index)
{ {
// Skip the empty polygon created above to avoid the empty_input_exception // Skip the empty polygon created above to avoid the empty_input_exception
if (! bg::is_empty(*it)) if (! bg::is_empty(*it))

View File

@ -5,8 +5,8 @@
// Copyright (c) 2008-2016 Bruno Lalande, Paris, France. // Copyright (c) 2008-2016 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2016 Mateusz Loskot, London, UK. // Copyright (c) 2009-2016 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2016,2017. // This file was modified by Oracle on 2016-2021.
// Modifications copyright (c) 2016-2017, Oracle and/or its affiliates. // Modifications copyright (c) 2016-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -45,7 +45,7 @@ void test_areal()
typedef typename bg::coordinate_type<Polygon>::type ct; typedef typename bg::coordinate_type<Polygon>::type ct;
ut_settings ignore_validity_for_float; ut_settings ignore_validity_for_float;
if (BOOST_GEOMETRY_CONDITION((boost::is_same<ct, float>::value)) ) if (BOOST_GEOMETRY_CONDITION((std::is_same<ct, float>::value)) )
{ {
ignore_validity_for_float.set_test_validity(false); ignore_validity_for_float.set_test_validity(false);
} }

View File

@ -3,23 +3,32 @@
// Copyright (c) 2018 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2018 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#include <boost/geometry.hpp>
#include <geometry_test_common.hpp>
#include <boost/foreach.hpp>
#include <iomanip> #include <iomanip>
#include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/simplify.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/io/wkt/read.hpp>
#include <boost/geometry/io/wkt/write.hpp>
#if defined(TEST_WITH_SVG) #if defined(TEST_WITH_SVG)
# include <boost/geometry/io/svg/svg_mapper.hpp> # include <boost/geometry/io/svg/svg_mapper.hpp>
#endif #endif
template <typename MultiPolygon> template <typename MultiPolygon>
std::string read_from_file(std::string const& filename) std::string read_from_file(std::string const& filename)
{ {
@ -102,7 +111,7 @@ void test_one(std::string const& caseid, std::string const& wkt,
mapper.map(geometry, "fill-opacity:0.5;fill:rgb(153,204,0);" mapper.map(geometry, "fill-opacity:0.5;fill:rgb(153,204,0);"
"stroke:rgb(153,204,0);stroke-width:1"); "stroke:rgb(153,204,0);stroke-width:1");
BOOST_FOREACH(polygon const& pol, simplified) for (polygon const& pol : simplified)
{ {
mapper.map(pol, mapper.map(pol,
bg::area(pol) > 0 ? "fill:none;stroke:rgb(255,0,0);stroke-width:1" bg::area(pol) > 0 ? "fill:none;stroke:rgb(255,0,0);stroke-width:1"

View File

@ -5,6 +5,10 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -15,7 +19,6 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <boost/typeof/typeof.hpp>
#include <boost/variant/variant.hpp> #include <boost/variant/variant.hpp>
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
@ -71,10 +74,10 @@ void test_transform_linestring(Value value)
boost::variant<line1_type> v(line1); boost::variant<line1_type> v(line1);
line2_type expected; line2_type expected;
for (BOOST_AUTO(p, line1.begin()); p != line1.end(); ++p) for (auto it = line1.begin(); it != line1.end(); ++it)
{ {
P2 new_point; P2 new_point;
bg::assign(new_point, *p); bg::assign(new_point, *it);
bg::multiply_value(new_point, value); bg::multiply_value(new_point, value);
expected.push_back(new_point); expected.push_back(new_point);
} }

View File

@ -3,8 +3,8 @@
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014, 2015, 2016, 2017. // This file was modified by Oracle on 2014-2021.
// Modifications copyright (c) 2014-2017 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -154,19 +154,19 @@ void test_spherical_geographic()
{ {
bg::model::polygon<Point> wrangel; bg::model::polygon<Point> wrangel;
typename boost::mpl::if_ std::conditional_t
< <
boost::is_same<typename bg::cs_tag<Point>::type, bg::geographic_tag>, std::is_same<typename bg::cs_tag<Point>::type, bg::geographic_tag>::value,
bg::strategy::within::geographic_winding<Point>, bg::strategy::within::geographic_winding<Point>,
bg::strategy::within::spherical_winding<Point> bg::strategy::within::spherical_winding<Point>
>::type ws; > ws;
typename boost::mpl::if_ std::conditional_t
< <
boost::is_same<typename bg::cs_tag<Point>::type, bg::geographic_tag>, std::is_same<typename bg::cs_tag<Point>::type, bg::geographic_tag>::value,
bg::strategy::side::geographic<>, bg::strategy::side::geographic<>,
bg::strategy::side::spherical_side_formula<> bg::strategy::side::spherical_side_formula<>
>::type ss; > ss;
boost::ignore_unused(ws, ss); boost::ignore_unused(ws, ss);
@ -390,8 +390,8 @@ void test_large_integers()
void test_tickets() void test_tickets()
{ {
typedef boost::geometry::model::d2::point_xy<double> pt; typedef bg::model::d2::point_xy<double> pt;
typedef boost::geometry::model::ring<pt> ring; typedef bg::model::ring<pt> ring;
// https://svn.boost.org/trac/boost/ticket/9628 // https://svn.boost.org/trac/boost/ticket/9628
{ {
@ -408,9 +408,9 @@ void test_tickets()
pt p( -12260.669324773118, 54820.312032458634 ); pt p( -12260.669324773118, 54820.312032458634 );
//boost::geometry::correct(r); //bg::correct(r);
bool within = boost::geometry::within(p, r); bool within = bg::within(p, r);
BOOST_CHECK_EQUAL(within, false); BOOST_CHECK_EQUAL(within, false);
} }
// similar // similar
@ -423,7 +423,7 @@ void test_tickets()
pt p( -13826.0, 54820.312032458634 ); pt p( -13826.0, 54820.312032458634 );
bool within = boost::geometry::within(p, r); bool within = bg::within(p, r);
BOOST_CHECK_EQUAL(within, false); BOOST_CHECK_EQUAL(within, false);
} }
@ -433,9 +433,9 @@ void test_tickets()
ring r; ring r;
bg::read_wkt("POINT(0.1377 5.00)", p); bg::read_wkt("POINT(0.1377 5.00)", p);
bg::read_wkt("POLYGON((0.1277 4.97, 0.1277 5.00, 0.1278 4.9999999999999982, 0.1278 4.97, 0.1277 4.97))", r); bg::read_wkt("POLYGON((0.1277 4.97, 0.1277 5.00, 0.1278 4.9999999999999982, 0.1278 4.97, 0.1277 4.97))", r);
bool within = boost::geometry::within(p, r); bool within = bg::within(p, r);
BOOST_CHECK_EQUAL(within, false); BOOST_CHECK_EQUAL(within, false);
bool covered_by = boost::geometry::covered_by(p, r); bool covered_by = bg::covered_by(p, r);
BOOST_CHECK_EQUAL(covered_by, false); BOOST_CHECK_EQUAL(covered_by, false);
} }
} }

View File

@ -5,7 +5,6 @@
// This file was modified by Oracle on 2014-2021. // This file was modified by Oracle on 2014-2021.
// Modifications copyright (c) 2014-2021 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -15,8 +14,6 @@
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/geometry/core/tag.hpp> #include <boost/geometry/core/tag.hpp>
#include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/geometries/geometries.hpp>
@ -45,7 +42,7 @@ void test_geometry()
BOOST_CHECK_EQUAL(typeid(typename bg::point_type<G>::type).name(), BOOST_CHECK_EQUAL(typeid(typename bg::point_type<G>::type).name(),
typeid(Expected).name()); typeid(Expected).name());
static const bool is_same = boost::is_same<typename bg::point_type<G>::type, Expected>::value; static const bool is_same = std::is_same<typename bg::point_type<G>::type, Expected>::value;
BOOST_CHECK(is_same); BOOST_CHECK(is_same);
} }

View File

@ -3,9 +3,8 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2014. // This file was modified by Oracle on 2014-2021.
// Modifications copyright (c) 2014 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -15,8 +14,6 @@
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/geometry/core/tag.hpp> #include <boost/geometry/core/tag.hpp>
#include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/geometries/geometries.hpp>
@ -42,7 +39,7 @@ void test_geometry()
BOOST_CHECK_EQUAL(typeid(typename bg::tag<G>::type).name(), BOOST_CHECK_EQUAL(typeid(typename bg::tag<G>::type).name(),
typeid(Expected).name()); typeid(Expected).name());
static const bool is_same = boost::is_same<typename bg::tag<G>::type, Expected>::value; static const bool is_same = std::is_same<typename bg::tag<G>::type, Expected>::value;
BOOST_CHECK(is_same); BOOST_CHECK(is_same);
} }

View File

@ -4,6 +4,10 @@
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -50,7 +54,6 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/concept_check.hpp> #include <boost/concept_check.hpp>
#include <boost/core/ignore_unused.hpp> #include <boost/core/ignore_unused.hpp>
#include <boost/foreach.hpp>
#include <string_from_type.hpp> #include <string_from_type.hpp>
@ -171,14 +174,14 @@ using default_test_type = double;
template <typename CoordinateType, typename Specified, typename T> template <typename CoordinateType, typename Specified, typename T>
inline T if_typed(T value_typed, T value) inline T if_typed(T value_typed, T value)
{ {
return boost::is_same<CoordinateType, Specified>::value ? value_typed : value; return std::is_same<CoordinateType, Specified>::value ? value_typed : value;
} }
//! Compile time function for expectations depending on high precision //! Compile time function for expectations depending on high precision
template <typename CoordinateType, typename T1, typename T2> template <typename CoordinateType, typename T1, typename T2>
inline T1 const& bg_if_mp(T1 const& value_mp, T2 const& value) inline T1 const& bg_if_mp(T1 const& value_mp, T2 const& value)
{ {
return boost::is_same<CoordinateType, mp_test_type>::type::value ? value_mp : value; return std::is_same<CoordinateType, mp_test_type>::type::value ? value_mp : value;
} }
//! Macro for expectations depending on rescaling //! Macro for expectations depending on rescaling

View File

@ -1,9 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test // Unit Test
// Copyright (c) 2014, Oracle and/or its affiliates. // Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
@ -14,26 +14,24 @@
#include <boost/test/included/unit_test.hpp> #include <boost/test/included/unit_test.hpp>
#include <algorithm>
#include <cstddef> #include <cstddef>
#include <iostream> #include <iostream>
#include <iterator>
#include <list>
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <algorithm> #include <type_traits>
#include <iterator>
#include <vector> #include <vector>
#include <list>
#include <boost/core/ignore_unused.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/assign/std/vector.hpp> #include <boost/assign/std/vector.hpp>
#include <boost/assign/std/list.hpp> #include <boost/assign/std/list.hpp>
#include <boost/assign/std/set.hpp> #include <boost/core/ignore_unused.hpp>
#include <boost/geometry/iterators/flatten_iterator.hpp>
#include "test_iterator_common.hpp" #include "test_iterator_common.hpp"
#include <boost/geometry/iterators/flatten_iterator.hpp>
using namespace boost::assign; using namespace boost::assign;
@ -41,12 +39,12 @@ using namespace boost::assign;
template <typename InnerContainer> template <typename InnerContainer>
struct access_begin struct access_begin
{ {
typedef typename boost::mpl::if_ using return_type = std::conditional_t
< <
typename boost::is_const<InnerContainer>::type, std::is_const<InnerContainer>::value,
typename InnerContainer::const_iterator, typename InnerContainer::const_iterator,
typename InnerContainer::iterator typename InnerContainer::iterator
>::type return_type; >;
static inline return_type apply(InnerContainer& inner) static inline return_type apply(InnerContainer& inner)
{ {
@ -58,12 +56,12 @@ struct access_begin
template <typename InnerContainer> template <typename InnerContainer>
struct access_end struct access_end
{ {
typedef typename boost::mpl::if_ using return_type = std::conditional_t
< <
typename boost::is_const<InnerContainer>::type, std::is_const<InnerContainer>::value,
typename InnerContainer::const_iterator, typename InnerContainer::const_iterator,
typename InnerContainer::iterator typename InnerContainer::iterator
>::type return_type; >;
static inline return_type apply(InnerContainer& inner) static inline return_type apply(InnerContainer& inner)
{ {

View File

@ -3,8 +3,7 @@
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2014-2017, Oracle and/or its affiliates. // Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -28,9 +27,11 @@
#include <boost/core/ignore_unused.hpp> #include <boost/core/ignore_unused.hpp>
#include <boost/iterator/iterator_concepts.hpp> #include <boost/iterator/iterator_concepts.hpp>
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/algorithms/make.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
#include <boost/geometry/core/point_type.hpp> #include <boost/geometry/core/point_type.hpp>
@ -39,31 +40,23 @@
#include <boost/geometry/geometries/register/linestring.hpp> #include <boost/geometry/geometries/register/linestring.hpp>
#include <boost/geometry/geometries/register/multi_point.hpp> #include <boost/geometry/geometries/register/multi_point.hpp>
#include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/algorithms/make.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
#include <boost/geometry/policies/compare.hpp>
#include <boost/geometry/util/condition.hpp>
#include <boost/geometry/io/wkt/wkt.hpp> #include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/io/dsv/write.hpp> #include <boost/geometry/io/dsv/write.hpp>
#include <boost/geometry/iterators/point_iterator.hpp> #include <boost/geometry/iterators/point_iterator.hpp>
#include <boost/geometry/iterators/point_reverse_iterator.hpp> #include <boost/geometry/iterators/point_reverse_iterator.hpp>
#include <boost/geometry/policies/compare.hpp>
#include <boost/geometry/strategies/strategies.hpp> #include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/util/condition.hpp>
#include <test_common/with_pointer.hpp> #include <test_common/with_pointer.hpp>
#include <test_geometries/copy_on_dereference_geometries.hpp> #include <test_geometries/copy_on_dereference_geometries.hpp>
// At the end because of conflicts with Boost.QVM
#include <boost/assign/list_of.hpp>
namespace bg = ::boost::geometry; namespace bg = ::boost::geometry;
namespace ba = ::boost::assign;
typedef bg::model::point<double, 2, bg::cs::cartesian> point_type; typedef bg::model::point<double, 2, bg::cs::cartesian> point_type;
typedef bg::model::point<double, 3, bg::cs::cartesian> point_type_3d; typedef bg::model::point<double, 3, bg::cs::cartesian> point_type_3d;
@ -100,7 +93,7 @@ template <typename Geometry>
inline Geometry from_wkt(std::string const& wkt) inline Geometry from_wkt(std::string const& wkt)
{ {
Geometry geometry; Geometry geometry;
boost::geometry::read_wkt(wkt, geometry); bg::read_wkt(wkt, geometry);
return geometry; return geometry;
} }
@ -147,7 +140,7 @@ template
< <
typename Geometry, typename Geometry,
bool Enable = true, bool Enable = true,
bool IsConst = boost::is_const<Geometry>::value bool IsConst = std::is_const<Geometry>::value
> >
struct test_iterator_concepts struct test_iterator_concepts
{ {
@ -456,7 +449,7 @@ struct test_point_iterator_of_geometry
// testing dereferencing/assignment // testing dereferencing/assignment
bool const is_reference = boost::is_reference bool const is_reference = std::is_reference
< <
typename std::iterator_traits<point_iterator>::reference typename std::iterator_traits<point_iterator>::reference
>::value; >::value;
@ -535,7 +528,7 @@ BOOST_AUTO_TEST_CASE( test_linestring_point_iterator )
); );
tester::apply(from_wkt<L>("LINESTRING(3 3,4 4,5 5)"), tester::apply(from_wkt<L>("LINESTRING(3 3,4 4,5 5)"),
ba::tuple_list_of(3,3)(4,4)(5,5) TMP{{3,3},{4,4},{5,5}}
); );
#ifdef BOOST_GEOMETRY_TEST_DEBUG #ifdef BOOST_GEOMETRY_TEST_DEBUG
@ -568,15 +561,15 @@ BOOST_AUTO_TEST_CASE( test_polygon_point_iterator )
); );
tester::apply(from_wkt<P>("POLYGON((1 1,9 1,9 9,1 9),(5 5,6 5,6 6,5 6))"), tester::apply(from_wkt<P>("POLYGON((1 1,9 1,9 9,1 9),(5 5,6 5,6 6,5 6))"),
ba::tuple_list_of(1,1)(9,1)(9,9)(1,9)(5,5)(6,5)(6,6)(5,6) TMP{{1,1},{9,1},{9,9},{1,9},{5,5},{6,5},{6,6},{5,6}}
); );
tester::apply(from_wkt<P>("POLYGON((3 3,4 4,5 5),(),(),(),(6 6,7 7,8 8),(),(),(9 9),())"), tester::apply(from_wkt<P>("POLYGON((3 3,4 4,5 5),(),(),(),(6 6,7 7,8 8),(),(),(9 9),())"),
ba::tuple_list_of(3,3)(4,4)(5,5)(6,6)(7,7)(8,8)(9,9) TMP{{3,3},{4,4},{5,5},{6,6},{7,7},{8,8},{9,9}}
); );
tester::apply(from_wkt<P>("POLYGON((),(3 3,4 4,5 5),(),(),(6 6,7 7,8 8),(),(),(9 9),())"), tester::apply(from_wkt<P>("POLYGON((),(3 3,4 4,5 5),(),(),(6 6,7 7,8 8),(),(),(9 9),())"),
ba::tuple_list_of(3,3)(4,4)(5,5)(6,6)(7,7)(8,8)(9,9) TMP{{3,3},{4,4},{5,5},{6,6},{7,7},{8,8},{9,9}}
); );
#ifdef BOOST_GEOMETRY_TEST_DEBUG #ifdef BOOST_GEOMETRY_TEST_DEBUG
@ -605,7 +598,7 @@ BOOST_AUTO_TEST_CASE( test_multipoint_point_iterator )
); );
tester::apply(from_wkt<MP>("MULTIPOINT(3 3,4 4,5 5)"), tester::apply(from_wkt<MP>("MULTIPOINT(3 3,4 4,5 5)"),
ba::tuple_list_of(3,3)(4,4)(5,5) TMP{{3,3},{4,4},{5,5}}
); );
#ifdef BOOST_GEOMETRY_TEST_DEBUG #ifdef BOOST_GEOMETRY_TEST_DEBUG
@ -634,7 +627,7 @@ BOOST_AUTO_TEST_CASE( test_multipoint_3d_point_iterator )
); );
tester::apply(from_wkt<MP>("MULTIPOINT(3 3 3,4 4 4,5 5 5)"), tester::apply(from_wkt<MP>("MULTIPOINT(3 3 3,4 4 4,5 5 5)"),
ba::tuple_list_of(3,3,3)(4,4,4)(5,5,5) TMP{{3,3,3},{4,4,4},{5,5,5}}
); );
#ifdef BOOST_GEOMETRY_TEST_DEBUG #ifdef BOOST_GEOMETRY_TEST_DEBUG
@ -671,11 +664,11 @@ BOOST_AUTO_TEST_CASE( test_multilinestring_point_iterator )
); );
tester::apply(from_wkt<ML>("MULTILINESTRING((1 1,2 2,3 3),(3 3,4 4,5 5),(6 6))"), tester::apply(from_wkt<ML>("MULTILINESTRING((1 1,2 2,3 3),(3 3,4 4,5 5),(6 6))"),
ba::tuple_list_of(1,1)(2,2)(3,3)(3,3)(4,4)(5,5)(6,6) TMP{{1,1},{2,2},{3,3},{3,3},{4,4},{5,5},{6,6}}
); );
tester::apply(from_wkt<ML>("MULTILINESTRING((),(),(1 1,2 2,3 3),(),(),(3 3,4 4,5 5),(),(6 6),(),(),())"), tester::apply(from_wkt<ML>("MULTILINESTRING((),(),(1 1,2 2,3 3),(),(),(3 3,4 4,5 5),(),(6 6),(),(),())"),
ba::tuple_list_of(1,1)(2,2)(3,3)(3,3)(4,4)(5,5)(6,6) TMP{{1,1},{2,2},{3,3},{3,3},{4,4},{5,5},{6,6}}
); );
#ifdef BOOST_GEOMETRY_TEST_DEBUG #ifdef BOOST_GEOMETRY_TEST_DEBUG
@ -716,18 +709,18 @@ BOOST_AUTO_TEST_CASE( test_multipolygon_point_iterator )
); );
tester::apply(from_wkt<MPL>("MULTIPOLYGON(((3 3,4 4,5 5),(6 6,7 7,8 8),(9 9)),((1 1,2 2,10 10),(11 11,12 12)))"), tester::apply(from_wkt<MPL>("MULTIPOLYGON(((3 3,4 4,5 5),(6 6,7 7,8 8),(9 9)),((1 1,2 2,10 10),(11 11,12 12)))"),
ba::tuple_list_of(3,3)(4,4)(5,5)(6,6)(7,7)(8,8)(9,9)\ TMP{{3,3},{4,4},{5,5},{6,6},{7,7},{8,8},{9,9},
(1,1)(2,2)(10,10)(11,11)(12,12) {1,1},{2,2},{10,10},{11,11},{12,12}}
); );
tester::apply(from_wkt<MPL>("MULTIPOLYGON(((3 3,4 4,5 5),(),(),(),(6 6,7 7,8 8),(),(),(9 9),()),((),(1 1,2 2,10 10),(),(),(),(11 11,12 12),(),(),(13 13),()))"), tester::apply(from_wkt<MPL>("MULTIPOLYGON(((3 3,4 4,5 5),(),(),(),(6 6,7 7,8 8),(),(),(9 9),()),((),(1 1,2 2,10 10),(),(),(),(11 11,12 12),(),(),(13 13),()))"),
ba::tuple_list_of(3,3)(4,4)(5,5)(6,6)(7,7)(8,8)(9,9)\ TMP{{3,3},{4,4},{5,5},{6,6},{7,7},{8,8},{9,9},
(1,1)(2,2)(10,10)(11,11)(12,12)(13,13) {1,1},{2,2},{10,10},{11,11},{12,12},{13,13}}
); );
tester::apply(from_wkt<MPL>("MULTIPOLYGON(((3 3,4 4,5 5),(),(),(),(6 6,7 7,8 8),(),(),(9 9),()),((),(1 1,2 2,10 10),(),(),(),(11 11,12 12),(),(),(13 13),()),((),(),()))"), tester::apply(from_wkt<MPL>("MULTIPOLYGON(((3 3,4 4,5 5),(),(),(),(6 6,7 7,8 8),(),(),(9 9),()),((),(1 1,2 2,10 10),(),(),(),(11 11,12 12),(),(),(13 13),()),((),(),()))"),
ba::tuple_list_of(3,3)(4,4)(5,5)(6,6)(7,7)(8,8)(9,9)\ TMP{{3,3},{4,4},{5,5},{6,6},{7,7},{8,8},{9,9},
(1,1)(2,2)(10,10)(11,11)(12,12)(13,13) {1,1},{2,2},{10,10},{11,11},{12,12},{13,13}}
); );
#ifdef BOOST_GEOMETRY_TEST_DEBUG #ifdef BOOST_GEOMETRY_TEST_DEBUG
@ -765,8 +758,8 @@ BOOST_AUTO_TEST_CASE( test_multipoint_of_point_pointers )
typedef test_point_iterator_of_geometry<MP, TMP> tester; typedef test_point_iterator_of_geometry<MP, TMP> tester;
tester::apply(multipoint, tester::apply(multipoint,
ba::tuple_list_of(1,-1)(2,-2)(3,-3)(4,-4)(5,-5)(6,-6)\ TMP{{1,-1},{2,-2},{3,-3},{4,-4},{5,-5},{6,-6},
(7,-7)(8,-8)(9,-9), {7,-7},{8,-8},{9,-9}},
zero zero
); );
@ -807,8 +800,8 @@ BOOST_AUTO_TEST_CASE( test_linestring_of_point_pointers )
typedef test_point_iterator_of_geometry<L, TMP> tester; typedef test_point_iterator_of_geometry<L, TMP> tester;
tester::apply(linestring, tester::apply(linestring,
ba::tuple_list_of(1,-1)(2,-2)(3,-3)(4,-4)(5,-5)(6,-6)\ TMP{{1,-1},{2,-2},{3,-3},{4,-4},{5,-5},{6,-6},
(7,-7)(8,-8)(9,-9), {7,-7},{8,-8},{9,-9}},
zero zero
); );
@ -849,8 +842,8 @@ BOOST_AUTO_TEST_CASE( test_multipoint_copy_on_dereference )
tester::apply(multipoint, tester::apply(multipoint,
// from_wkt<MP>("MULTIPOINT(1 -1,2 -2,3 -3,4 -4,5 -5,6 -6, 7 -7,8 -8,9 -9)"), // from_wkt<MP>("MULTIPOINT(1 -1,2 -2,3 -3,4 -4,5 -5,6 -6, 7 -7,8 -8,9 -9)"),
ba::tuple_list_of(1,-1)(2,-2)(3,-3)(4,-4)(5,-5)(6,-6)\ TMP{{1,-1},{2,-2},{3,-3},{4,-4},{5,-5},{6,-6},
(7,-7)(8,-8)(9,-9) {7,-7},{8,-8},{9,-9}}
); );
} }
@ -875,7 +868,7 @@ BOOST_AUTO_TEST_CASE( test_linestring_copy_on_dereference )
> tester; > tester;
tester::apply(from_wkt<L>("LINESTRING(1 -1,2 -2,3 -3,4 -4,5 -5,6 -6, 7 -7,8 -8,9 -9)"), tester::apply(from_wkt<L>("LINESTRING(1 -1,2 -2,3 -3,4 -4,5 -5,6 -6, 7 -7,8 -8,9 -9)"),
ba::tuple_list_of(1,-1)(2,-2)(3,-3)(4,-4)(5,-5)(6,-6)\ TMP{{1,-1},{2,-2},{3,-3},{4,-4},{5,-5},{6,-6},
(7,-7)(8,-8)(9,-9) {7,-7},{8,-8},{9,-9}}
); );
} }

View File

@ -3,9 +3,9 @@
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// Copyright (c) 2014, Oracle and/or its affiliates. // Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
@ -23,12 +23,17 @@
#include <boost/test/included/unit_test.hpp> #include <boost/test/included/unit_test.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/concept_check.hpp> #include <boost/concept_check.hpp>
#include <boost/core/ignore_unused.hpp> #include <boost/core/ignore_unused.hpp>
#include <boost/iterator/iterator_concepts.hpp> #include <boost/iterator/iterator_concepts.hpp>
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/algorithms/num_segments.hpp>
#include <boost/geometry/core/closure.hpp>
#include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp> #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
#include <boost/geometry/geometries/register/linestring.hpp> #include <boost/geometry/geometries/register/linestring.hpp>
@ -37,25 +42,13 @@
#include <boost/geometry/io/wkt/wkt.hpp> #include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/io/dsv/write.hpp> #include <boost/geometry/io/dsv/write.hpp>
#include <boost/geometry/core/closure.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/algorithms/num_segments.hpp>
#include <boost/geometry/policies/compare.hpp>
#include <boost/geometry/iterators/segment_iterator.hpp> #include <boost/geometry/iterators/segment_iterator.hpp>
// TEMP #include <boost/geometry/policies/compare.hpp>
#include <boost/geometry/strategies/relate/cartesian.hpp>
#include <boost/geometry/strategies/relate/geographic.hpp>
#include <boost/geometry/strategies/relate/spherical.hpp>
#include <test_common/with_pointer.hpp> #include <test_common/with_pointer.hpp>
#include <test_geometries/copy_on_dereference_geometries.hpp> #include <test_geometries/copy_on_dereference_geometries.hpp>
namespace ba = ::boost::assign;
namespace bg = ::boost::geometry; namespace bg = ::boost::geometry;
namespace bgm = bg::model; namespace bgm = bg::model;
@ -87,7 +80,7 @@ template <typename Geometry>
inline Geometry from_wkt(std::string const& wkt) inline Geometry from_wkt(std::string const& wkt)
{ {
Geometry geometry; Geometry geometry;
boost::geometry::read_wkt(wkt, geometry); bg::read_wkt(wkt, geometry);
return geometry; return geometry;
} }
@ -325,22 +318,23 @@ BOOST_AUTO_TEST_CASE( test_linestring_segment_iterator )
typedef test_segment_iterator_of_geometry<G, TML> tester; typedef test_segment_iterator_of_geometry<G, TML> tester;
tester::apply(from_wkt<G>("LINESTRING(0 0,1 1,2 2,3 3,4 4)"), tester::apply(from_wkt<G>("LINESTRING(0 0,1 1,2 2,3 3,4 4)"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(1,1) ) {{0,0},{1,1}},
( ba::tuple_list_of(1,1)(2,2) ) {{1,1},{2,2}},
( ba::tuple_list_of(2,2)(3,3) ) {{2,2},{3,3}},
( ba::tuple_list_of(3,3)(4,4) ) {{3,3},{4,4}}
); });
// linestring with no points // linestring with no points
tester::apply(from_wkt<G>("LINESTRING()"), tester::apply(from_wkt<G>("LINESTRING()"),
ba::list_of<tuple_linestring_type>() TML()
); );
// linestring with a single point // linestring with a single point
tester::apply(from_wkt<G>("LINESTRING(1 0)"), tester::apply(from_wkt<G>("LINESTRING(1 0)"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(1,0)(1,0) ), {{1,0},{1,0}}
},
false false
); );
@ -365,80 +359,82 @@ BOOST_AUTO_TEST_CASE( test_ring_segment_iterator )
typedef dual_tester<CG, TML> tester; typedef dual_tester<CG, TML> tester;
tester::apply(from_wkt<OG>("POLYGON((0 0,0 10,10 10,10 0))"), tester::apply(from_wkt<OG>("POLYGON((0 0,0 10,10 10,10 0))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,10) ) {{0,0},{0,10}},
( ba::tuple_list_of(0,10)(10,10) ) {{0,10},{10,10}},
( ba::tuple_list_of(10,10)(10,0) ) {{10,10},{10,0}},
( ba::tuple_list_of(10,0)(0,0) ) {{10,0},{0,0}}
); });
// open ring with no points // open ring with no points
tester::apply(from_wkt<OG>("POLYGON(())"), tester::apply(from_wkt<OG>("POLYGON(())"),
ba::list_of<tuple_linestring_type>() TML()
); );
// open ring with a single point (one segment) // open ring with a single point (one segment)
tester::apply(from_wkt<OG>("POLYGON((0 0))"), tester::apply(from_wkt<OG>("POLYGON((0 0))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,0) ), {{0,0},{0,0}}
},
false false
); );
// open ring with a two points (two segments) // open ring with a two points (two segments)
tester::apply(from_wkt<OG>("POLYGON((0 0,0 10))"), tester::apply(from_wkt<OG>("POLYGON((0 0,0 10))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,10) ) {{0,0},{0,10}},
( ba::tuple_list_of(0,10)(0,0) ) {{0,10},{0,0}}
); });
// open ring with a three points (three segments) // open ring with a three points (three segments)
tester::apply(from_wkt<OG>("POLYGON((0 0,0 10,10 10))"), tester::apply(from_wkt<OG>("POLYGON((0 0,0 10,10 10))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,10) ) {{0,0},{0,10}},
( ba::tuple_list_of(0,10)(10,10) ) {{0,10},{10,10}},
( ba::tuple_list_of(10,10)(0,0) ) {{10,10},{0,0}}
); });
tester::apply(from_wkt<CG>("POLYGON((0 0,0 10,10 10,10 0,0 0))"), tester::apply(from_wkt<CG>("POLYGON((0 0,0 10,10 10,10 0,0 0))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,10) ) {{0,0},{0,10}},
( ba::tuple_list_of(0,10)(10,10) ) {{0,10},{10,10}},
( ba::tuple_list_of(10,10)(10,0) ) {{10,10},{10,0}},
( ba::tuple_list_of(10,0)(0,0) ) {{10,0},{0,0}}
); });
// closed ring with no points // closed ring with no points
tester::apply(from_wkt<CG>("POLYGON(())"), tester::apply(from_wkt<CG>("POLYGON(())"),
ba::list_of<tuple_linestring_type>() TML()
); );
// closed ring with a single point (one segment) // closed ring with a single point (one segment)
tester::apply(from_wkt<CG>("POLYGON((0 0))"), tester::apply(from_wkt<CG>("POLYGON((0 0))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,0) ), {{0,0},{0,0}}
},
false false
); );
// closed ring with two points (one segment) // closed ring with two points (one segment)
tester::apply(from_wkt<CG>("POLYGON((0 0,0 0))"), tester::apply(from_wkt<CG>("POLYGON((0 0,0 0))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,0) ) {{0,0},{0,0}}
); });
// closed ring with three points (two segments) // closed ring with three points (two segments)
tester::apply(from_wkt<CG>("POLYGON((0 0,0 10,0 0))"), tester::apply(from_wkt<CG>("POLYGON((0 0,0 10,0 0))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,10) ) {{0,0},{0,10}},
( ba::tuple_list_of(0,10)(0,0) ) {{0,10},{0,0}}
); });
// closed ring with four points (three segments) // closed ring with four points (three segments)
tester::apply(from_wkt<CG>("POLYGON((0 0,0 10,10 10,0 0))"), tester::apply(from_wkt<CG>("POLYGON((0 0,0 10,10 10,0 0))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,10) ) {{0,0},{0,10}},
( ba::tuple_list_of(0,10)(10,10) ) {{0,10},{10,10}},
( ba::tuple_list_of(10,10)(0,0) ) {{10,10},{0,0}}
); });
#ifdef BOOST_GEOMETRY_TEST_DEBUG #ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << std::endl << std::endl << std::endl; std::cout << std::endl << std::endl << std::endl;
@ -461,85 +457,89 @@ BOOST_AUTO_TEST_CASE( test_polygon_segment_iterator )
typedef dual_tester<CG, TML> tester; typedef dual_tester<CG, TML> tester;
tester::apply(from_wkt<OG>("POLYGON((0 0,0 10,10 10,10 0),(1 1,9 1,9 9,1 9))"), tester::apply(from_wkt<OG>("POLYGON((0 0,0 10,10 10,10 0),(1 1,9 1,9 9,1 9))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,10) ) {{0,0},{0,10}},
( ba::tuple_list_of(0,10)(10,10) ) {{0,10},{10,10}},
( ba::tuple_list_of(10,10)(10,0) ) {{10,10},{10,0}},
( ba::tuple_list_of(10,0)(0,0) ) {{10,0},{0,0}},
( ba::tuple_list_of(1,1)(9,1) ) {{1,1},{9,1}},
( ba::tuple_list_of(9,1)(9,9) ) {{9,1},{9,9}},
( ba::tuple_list_of(9,9)(1,9) ) {{9,9},{1,9}},
( ba::tuple_list_of(1,9)(1,1) ) {{1,9},{1,1}}
); });
// open polygon with no points // open polygon with no points
tester::apply(from_wkt<OG>("POLYGON(())"), tester::apply(from_wkt<OG>("POLYGON(())"),
ba::list_of<tuple_linestring_type>() TML()
); );
// open polygons with single-point rings // open polygons with single-point rings
tester::apply(from_wkt<OG>("POLYGON((0 0,0 10,10 10,10 0),(1 1))"), tester::apply(from_wkt<OG>("POLYGON((0 0,0 10,10 10,10 0),(1 1))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,10) ) {{0,0},{0,10}},
( ba::tuple_list_of(0,10)(10,10) ) {{0,10},{10,10}},
( ba::tuple_list_of(10,10)(10,0) ) {{10,10},{10,0}},
( ba::tuple_list_of(10,0)(0,0) ) {{10,0},{0,0}},
( ba::tuple_list_of(1,1)(1,1) ), {{1,1},{1,1}}
},
false false
); );
tester::apply(from_wkt<OG>("POLYGON((0 0),(1 1,9 1,9 9,1 9))"), tester::apply(from_wkt<OG>("POLYGON((0 0),(1 1,9 1,9 9,1 9))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,0) ) {{0,0},{0,0}},
( ba::tuple_list_of(1,1)(9,1) ) {{1,1},{9,1}},
( ba::tuple_list_of(9,1)(9,9) ) {{9,1},{9,9}},
( ba::tuple_list_of(9,9)(1,9) ) {{9,9},{1,9}},
( ba::tuple_list_of(1,9)(1,1) ), {{1,9},{1,1}}
},
false false
); );
tester::apply(from_wkt<CG>("POLYGON((0 0,0 10,10 10,10 0,0 0),(1 1,9 1,9 9,1 9,1 1))"), tester::apply(from_wkt<CG>("POLYGON((0 0,0 10,10 10,10 0,0 0),(1 1,9 1,9 9,1 9,1 1))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,10) ) {{0,0},{0,10}},
( ba::tuple_list_of(0,10)(10,10) ) {{0,10},{10,10}},
( ba::tuple_list_of(10,10)(10,0) ) {{10,10},{10,0}},
( ba::tuple_list_of(10,0)(0,0) ) {{10,0},{0,0}},
( ba::tuple_list_of(1,1)(9,1) ) {{1,1},{9,1}},
( ba::tuple_list_of(9,1)(9,9) ) {{9,1},{9,9}},
( ba::tuple_list_of(9,9)(1,9) ) {{9,9},{1,9}},
( ba::tuple_list_of(1,9)(1,1) ) {{1,9},{1,1}}
); });
// closed polygons with no points // closed polygons with no points
tester::apply(from_wkt<CG>("POLYGON(())"), tester::apply(from_wkt<CG>("POLYGON(())"),
ba::list_of<tuple_linestring_type>() TML()
); );
tester::apply(from_wkt<CG>("POLYGON((),())"), tester::apply(from_wkt<CG>("POLYGON((),())"),
ba::list_of<tuple_linestring_type>() TML()
); );
tester::apply(from_wkt<CG>("POLYGON((),(),())"), tester::apply(from_wkt<CG>("POLYGON((),(),())"),
ba::list_of<tuple_linestring_type>() TML()
); );
// closed polygons with single-point rings // closed polygons with single-point rings
tester::apply(from_wkt<CG>("POLYGON((0 0,0 10,10 10,10 0,0 0),(1 1))"), tester::apply(from_wkt<CG>("POLYGON((0 0,0 10,10 10,10 0,0 0),(1 1))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,10) ) {{0,0},{0,10}},
( ba::tuple_list_of(0,10)(10,10) ) {{0,10},{10,10}},
( ba::tuple_list_of(10,10)(10,0) ) {{10,10},{10,0}},
( ba::tuple_list_of(10,0)(0,0) ) {{10,0},{0,0}},
( ba::tuple_list_of(1,1)(1,1) ), {{1,1},{1,1}},
},
false false
); );
tester::apply(from_wkt<CG>("POLYGON((0 0),(1 1,9 1,9 9,1 9,1 1))"), tester::apply(from_wkt<CG>("POLYGON((0 0),(1 1,9 1,9 9,1 9,1 1))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,0) ) {{0,0},{0,0}},
( ba::tuple_list_of(1,1)(9,1) ) {{1,1},{9,1}},
( ba::tuple_list_of(9,1)(9,9) ) {{9,1},{9,9}},
( ba::tuple_list_of(9,9)(1,9) ) {{9,9},{1,9}},
( ba::tuple_list_of(1,9)(1,1) ), {{1,9},{1,1}}
},
false false
); );
@ -563,37 +563,38 @@ BOOST_AUTO_TEST_CASE( test_multi_linestring_segment_iterator )
typedef test_segment_iterator_of_geometry<G, TML> tester; typedef test_segment_iterator_of_geometry<G, TML> tester;
tester::apply(from_wkt<G>("MULTILINESTRING((0 0,1 1,2 2,3 3,4 4),(5 5,6 6,7 7,8 8),(9 9,10 10))"), tester::apply(from_wkt<G>("MULTILINESTRING((0 0,1 1,2 2,3 3,4 4),(5 5,6 6,7 7,8 8),(9 9,10 10))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(1,1) ) {{0,0},{1,1}},
( ba::tuple_list_of(1,1)(2,2) ) {{1,1},{2,2}},
( ba::tuple_list_of(2,2)(3,3) ) {{2,2},{3,3}},
( ba::tuple_list_of(3,3)(4,4) ) {{3,3},{4,4}},
( ba::tuple_list_of(5,5)(6,6) ) {{5,5},{6,6}},
( ba::tuple_list_of(6,6)(7,7) ) {{6,6},{7,7}},
( ba::tuple_list_of(7,7)(8,8) ) {{7,7},{8,8}},
( ba::tuple_list_of(9,9)(10,10) ) {{9,9},{10,10}}
); });
// empty multi-linestrings // empty multi-linestrings
tester::apply(from_wkt<G>("MULTILINESTRING()"), tester::apply(from_wkt<G>("MULTILINESTRING()"),
ba::list_of<tuple_linestring_type>() TML()
); );
tester::apply(from_wkt<G>("MULTILINESTRING(())"), tester::apply(from_wkt<G>("MULTILINESTRING(())"),
ba::list_of<tuple_linestring_type>() TML()
); );
tester::apply(from_wkt<G>("MULTILINESTRING((),())"), tester::apply(from_wkt<G>("MULTILINESTRING((),())"),
ba::list_of<tuple_linestring_type>() TML()
); );
// multi-linestring with a linestring with one point // multi-linestring with a linestring with one point
tester::apply(from_wkt<G>("MULTILINESTRING((0 0,1 1,2 2,3 3,4 4),(5 5),(9 9,10 10))"), tester::apply(from_wkt<G>("MULTILINESTRING((0 0,1 1,2 2,3 3,4 4),(5 5),(9 9,10 10))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(1,1) ) {{0,0},{1,1}},
( ba::tuple_list_of(1,1)(2,2) ) {{1,1},{2,2}},
( ba::tuple_list_of(2,2)(3,3) ) {{2,2},{3,3}},
( ba::tuple_list_of(3,3)(4,4) ) {{3,3},{4,4}},
( ba::tuple_list_of(5,5)(5,5) ) {{5,5},{5,5}},
( ba::tuple_list_of(9,9)(10,10) ), {{9,9},{10,10}}
},
false false
); );
@ -618,63 +619,63 @@ BOOST_AUTO_TEST_CASE( test_multi_polygon_segment_iterator )
typedef dual_tester<CG, TML> tester; typedef dual_tester<CG, TML> tester;
tester::apply(from_wkt<OG>("MULTIPOLYGON(((0 0,0 10,10 10,10 0),(1 1,9 1,9 9,1 9)),((20 0,20 10,30 10,30 0),(21 1,29 1,29 9,21 9)))"), tester::apply(from_wkt<OG>("MULTIPOLYGON(((0 0,0 10,10 10,10 0),(1 1,9 1,9 9,1 9)),((20 0,20 10,30 10,30 0),(21 1,29 1,29 9,21 9)))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,10) ) {{0,0},{0,10}},
( ba::tuple_list_of(0,10)(10,10) ) {{0,10},{10,10}},
( ba::tuple_list_of(10,10)(10,0) ) {{10,10},{10,0}},
( ba::tuple_list_of(10,0)(0,0) ) {{10,0},{0,0}},
( ba::tuple_list_of(1,1)(9,1) ) {{1,1},{9,1}},
( ba::tuple_list_of(9,1)(9,9) ) {{9,1},{9,9}},
( ba::tuple_list_of(9,9)(1,9) ) {{9,9},{1,9}},
( ba::tuple_list_of(1,9)(1,1) ) {{1,9},{1,1}},
( ba::tuple_list_of(20,0)(20,10) ) {{20,0},{20,10}},
( ba::tuple_list_of(20,10)(30,10) ) {{20,10},{30,10}},
( ba::tuple_list_of(30,10)(30,0) ) {{30,10},{30,0}},
( ba::tuple_list_of(30,0)(20,0) ) {{30,0},{20,0}},
( ba::tuple_list_of(21,1)(29,1) ) {{21,1},{29,1}},
( ba::tuple_list_of(29,1)(29,9) ) {{29,1},{29,9}},
( ba::tuple_list_of(29,9)(21,9) ) {{29,9},{21,9}},
( ba::tuple_list_of(21,9)(21,1) ) {{21,9},{21,1}}
); });
tester::apply(from_wkt<CG>("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(1 1,9 1,9 9,1 9,1 1)),((20 0,20 10,30 10,30 0,20 0),(21 1,29 1,29 9,21 9,21 1)))"), tester::apply(from_wkt<CG>("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(1 1,9 1,9 9,1 9,1 1)),((20 0,20 10,30 10,30 0,20 0),(21 1,29 1,29 9,21 9,21 1)))"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(0,0)(0,10) ) {{0,0},{0,10}},
( ba::tuple_list_of(0,10)(10,10) ) {{0,10},{10,10}},
( ba::tuple_list_of(10,10)(10,0) ) {{10,10},{10,0}},
( ba::tuple_list_of(10,0)(0,0) ) {{10,0},{0,0}},
( ba::tuple_list_of(1,1)(9,1) ) {{1,1},{9,1}},
( ba::tuple_list_of(9,1)(9,9) ) {{9,1},{9,9}},
( ba::tuple_list_of(9,9)(1,9) ) {{9,9},{1,9}},
( ba::tuple_list_of(1,9)(1,1) ) {{1,9},{1,1}},
( ba::tuple_list_of(20,0)(20,10) ) {{20,0},{20,10}},
( ba::tuple_list_of(20,10)(30,10) ) {{20,10},{30,10}},
( ba::tuple_list_of(30,10)(30,0) ) {{30,10},{30,0}},
( ba::tuple_list_of(30,0)(20,0) ) {{30,0},{20,0}},
( ba::tuple_list_of(21,1)(29,1) ) {{21,1},{29,1}},
( ba::tuple_list_of(29,1)(29,9) ) {{29,1},{29,9}},
( ba::tuple_list_of(29,9)(21,9) ) {{29,9},{21,9}},
( ba::tuple_list_of(21,9)(21,1) ) {{21,9},{21,1}}
); });
// test empty closed multi-polygons // test empty closed multi-polygons
tester::apply(from_wkt<CG>("MULTIPOLYGON()"), tester::apply(from_wkt<CG>("MULTIPOLYGON()"),
ba::list_of<tuple_linestring_type>() TML()
); );
tester::apply(from_wkt<CG>("MULTIPOLYGON((()))"), tester::apply(from_wkt<CG>("MULTIPOLYGON((()))"),
ba::list_of<tuple_linestring_type>() TML()
); );
tester::apply(from_wkt<CG>("MULTIPOLYGON(((),()))"), tester::apply(from_wkt<CG>("MULTIPOLYGON(((),()))"),
ba::list_of<tuple_linestring_type>() TML()
); );
tester::apply(from_wkt<CG>("MULTIPOLYGON(((),(),()))"), tester::apply(from_wkt<CG>("MULTIPOLYGON(((),(),()))"),
ba::list_of<tuple_linestring_type>() TML()
); );
tester::apply(from_wkt<CG>("MULTIPOLYGON(((),(),()),(()))"), tester::apply(from_wkt<CG>("MULTIPOLYGON(((),(),()),(()))"),
ba::list_of<tuple_linestring_type>() TML()
); );
tester::apply(from_wkt<CG>("MULTIPOLYGON(((),(),()),((),()))"), tester::apply(from_wkt<CG>("MULTIPOLYGON(((),(),()),((),()))"),
ba::list_of<tuple_linestring_type>() TML()
); );
#ifdef BOOST_GEOMETRY_TEST_DEBUG #ifdef BOOST_GEOMETRY_TEST_DEBUG
@ -711,16 +712,16 @@ BOOST_AUTO_TEST_CASE( test_linestring_of_point_pointers )
typedef test_segment_iterator_of_geometry<L, TML> tester; typedef test_segment_iterator_of_geometry<L, TML> tester;
tester::apply(linestring, tester::apply(linestring,
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(1,-1)(2,-2) ) {{1,-1},{2,-2}},
( ba::tuple_list_of(2,-2)(3,-3) ) {{2,-2},{3,-3}},
( ba::tuple_list_of(3,-3)(4,-4) ) {{3,-3},{4,-4}},
( ba::tuple_list_of(4,-4)(5,-5) ) {{4,-4},{5,-5}},
( ba::tuple_list_of(5,-5)(6,-6) ) {{5,-5},{6,-6}},
( ba::tuple_list_of(6,-6)(7,-7) ) {{6,-6},{7,-7}},
( ba::tuple_list_of(7,-7)(8,-8) ) {{7,-7},{8,-8}},
( ba::tuple_list_of(8,-8)(9,-9) ) {{8,-8},{9,-9}}
); });
for (unsigned int i = 0; i < linestring.size(); i++) for (unsigned int i = 0; i < linestring.size(); i++)
{ {
@ -744,14 +745,14 @@ BOOST_AUTO_TEST_CASE( test_linestring_copy_on_dereference )
typedef test_segment_iterator_of_geometry<L, TML> tester; typedef test_segment_iterator_of_geometry<L, TML> tester;
tester::apply(from_wkt<L>("LINESTRING(1 -1,2 -2,3 -3,4 -4,5 -5,6 -6, 7 -7,8 -8,9 -9)"), tester::apply(from_wkt<L>("LINESTRING(1 -1,2 -2,3 -3,4 -4,5 -5,6 -6, 7 -7,8 -8,9 -9)"),
ba::list_of<tuple_linestring_type> TML{
( ba::tuple_list_of(1,-1)(2,-2) ) {{1,-1},{2,-2}},
( ba::tuple_list_of(2,-2)(3,-3) ) {{2,-2},{3,-3}},
( ba::tuple_list_of(3,-3)(4,-4) ) {{3,-3},{4,-4}},
( ba::tuple_list_of(4,-4)(5,-5) ) {{4,-4},{5,-5}},
( ba::tuple_list_of(5,-5)(6,-6) ) {{5,-5},{6,-6}},
( ba::tuple_list_of(6,-6)(7,-7) ) {{6,-6},{7,-7}},
( ba::tuple_list_of(7,-7)(8,-8) ) {{7,-7},{8,-8}},
( ba::tuple_list_of(8,-8)(9,-9) ) {{8,-8},{9,-9}}
); });
} }

View File

@ -5,6 +5,10 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -15,21 +19,15 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <boost/foreach.hpp>
#include <boost/geometry/algorithms/correct.hpp> #include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/detail/recalculate.hpp> #include <boost/geometry/algorithms/detail/recalculate.hpp>
#include <boost/geometry/algorithms/length.hpp> #include <boost/geometry/algorithms/length.hpp>
#include <boost/geometry/algorithms/num_points.hpp> #include <boost/geometry/algorithms/num_points.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/iterators/point_iterator.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <boost/geometry/io/wkt/wkt.hpp> #include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/iterators/point_iterator.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
@ -94,14 +92,14 @@ static std::string simplex_large[2] =
template <bool Rescale, typename P> template <bool Rescale, typename P>
void test_rescale(std::string const& expected_normal, std::string const& expected_large) void test_rescale(std::string const& expected_normal, std::string const& expected_large)
{ {
typedef bg::model::polygon<P> polygon; using polygon = bg::model::polygon<P>;
typedef typename boost::mpl::if_c using rescale_policy_type = std::conditional_t
< <
Rescale, Rescale,
typename bg::rescale_policy_type<P>::type , typename bg::rescale_policy_type<P>::type,
bg::detail::no_rescale_policy bg::detail::no_rescale_policy
>::type rescale_policy_type; >;
test_one<rescale_policy_type, polygon, polygon>( test_one<rescale_policy_type, polygon, polygon>(
simplex_normal[0], simplex_normal[1], simplex_normal[0], simplex_normal[1],
@ -125,7 +123,7 @@ int test_main(int, char* [])
test_all<double>("-5000000 -3000000", "-5000000 -3000000"); test_all<double>("-5000000 -3000000", "-5000000 -3000000");
test_all<long double>("-5000000 -3000000", "-5000000 -3000000"); test_all<long double>("-5000000 -3000000", "-5000000 -3000000");
test_all<int>("0 1", "0 1000"); test_all<int>("0 1", "0 1000");
test_all<boost::long_long_type>("0 1", "0 1000"); test_all<long long>("0 1", "0 1000");
// test_all<short int>(); // compiles but overflows // test_all<short int>(); // compiles but overflows
return 0; return 0;

View File

@ -3,6 +3,10 @@
// Copyright (c) 2019 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2019 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -13,8 +17,6 @@
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <boost/type_traits/is_same.hpp>
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
#include <boost/geometry.hpp> #include <boost/geometry.hpp>

View File

@ -1,7 +1,12 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Robustness Test // Robustness Test
//
// Copyright (c) 2009-2020 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2009-2020 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -14,8 +19,6 @@
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include <boost/typeof/typeof.hpp>
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
// For mixing int/float // For mixing int/float
@ -274,12 +277,12 @@ static bool test_overlay_p_q(std::string const& caseid,
if (settings.also_difference) if (settings.also_difference)
{ {
for (BOOST_AUTO(it, out_d1.begin()); it != out_d1.end(); ++it) for (auto it = out_d1.begin(); it != out_d1.end(); ++it)
{ {
mapper.map(*it, mapper.map(*it,
"opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round"); "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round");
} }
for (BOOST_AUTO(it, out_d2.begin()); it != out_d2.end(); ++it) for (auto it = out_d2.begin(); it != out_d2.end(); ++it)
{ {
mapper.map(*it, mapper.map(*it,
"opacity:0.8;fill:none;stroke:rgb(255,0,255);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round"); "opacity:0.8;fill:none;stroke:rgb(255,0,255);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round");

View File

@ -2,6 +2,10 @@
// Copyright (c) 2013-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2013-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -11,23 +15,30 @@
#define CHECK_SELF_INTERSECTIONS #define CHECK_SELF_INTERSECTIONS
#define LIST_WKT #define LIST_WKT
#include <iomanip>
#include <iostream>
#include <vector>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/geometries/register/ring.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/foreach.hpp>
#include <boost/timer.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/geometry/io/svg/svg_mapper.hpp>
#include <fstream> #include <fstream>
#include <iomanip>
#include <iostream>
#include <vector>
#include <boost/algorithm/string.hpp>
#include <boost/timer.hpp>
#include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/detail/has_self_intersections.hpp>
#include <boost/geometry/algorithms/difference.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
#include <boost/geometry/algorithms/union.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/geometries/register/ring.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/svg/svg_mapper.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
namespace bg = boost::geometry;
typedef boost::geometry::model::d2::point_xy<double> pt; typedef boost::geometry::model::d2::point_xy<double> pt;
typedef boost::geometry::model::polygon<pt> polygon; typedef boost::geometry::model::polygon<pt> polygon;
@ -62,7 +73,7 @@ inline void debug_with_svg(int index, char method, Geometry const& a, Geometry c
mapper.map(a, "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:2"); mapper.map(a, "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:2");
mapper.map(b, "fill-opacity:0.3;fill:rgb(51,51,153);stroke:rgb(51,51,153);stroke-width:2"); mapper.map(b, "fill-opacity:0.3;fill:rgb(51,51,153);stroke:rgb(51,51,153);stroke-width:2");
BOOST_FOREACH(polygon const& g, output) for(polygon const& g : output)
{ {
mapper.map(g, "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round"); mapper.map(g, "opacity:0.8;fill:none;stroke:rgb(255,128,0);stroke-width:4;stroke-dasharray:1,7;stroke-linecap:round");
} }
@ -87,6 +98,14 @@ int main()
std::string wkt1, wkt2, operation; std::string wkt1, wkt2, operation;
typename bg::strategies::relate::services::default_strategy
<
multi_polygon, multi_polygon
>::type strategy;
using rescale_policy_type = typename bg::rescale_policy_type<pt>::type;
try try
{ {
@ -94,19 +113,23 @@ int main()
boost::timer t; boost::timer t;
std::vector<multi_polygon> poly_list; std::vector<multi_polygon> poly_list;
for(int i=0;i<num_orig;i++) for (int i = 0 ; i < num_orig ; i++)
{ {
multi_polygon mp; multi_polygon mp;
polygon p; polygon p;
for(int j=0;j<3;j++) for (int j = 0 ; j < 3 ; j++)
{ {
double x=(double)rand()/RAND_MAX; double x = (double)rand()/RAND_MAX;
double y=(double)rand()/RAND_MAX; double y = (double)rand()/RAND_MAX;
p.outer().push_back(pt(x,y)); p.outer().push_back(pt(x,y));
} }
boost::geometry::correct(p); bg::correct(p);
mp.push_back(p); mp.push_back(p);
boost::geometry::detail::overlay::has_self_intersections(mp);
rescale_policy_type robust_policy
= bg::get_rescale_policy<rescale_policy_type>(mp, strategy);
bg::detail::overlay::has_self_intersections(mp, strategy, robust_policy);
std::ostringstream out; std::ostringstream out;
out << "original " << poly_list.size(); out << "original " << poly_list.size();
@ -119,7 +142,7 @@ int main()
} }
for(int j=0;j<num_rounds;j++) for (int j = 0 ; j < num_rounds ; j++)
{ {
if (j % 100 == 0) { std::cout << " " << j; } if (j % 100 == 0) { std::cout << " " << j; }
pj = j; pj = j;
@ -150,9 +173,13 @@ int main()
#endif #endif
#ifdef CHECK_SELF_INTERSECTIONS #ifdef CHECK_SELF_INTERSECTIONS
rescale_policy_type robust_policy_i
= bg::get_rescale_policy<rescale_policy_type>(mp_i, strategy);
try try
{ {
boost::geometry::detail::overlay::has_self_intersections(mp_i); boost::geometry::detail::overlay::has_self_intersections(mp_i, strategy, robust_policy_i);
} }
catch(...) catch(...)
{ {
@ -162,7 +189,7 @@ int main()
std::cout << boost::geometry::wkt(mp_i) << std::endl; std::cout << boost::geometry::wkt(mp_i) << std::endl;
try try
{ {
boost::geometry::detail::overlay::has_self_intersections(mp_i); boost::geometry::detail::overlay::has_self_intersections(mp_i, strategy, robust_policy_i);
} }
catch(...) catch(...)
{ {
@ -170,9 +197,12 @@ int main()
break; break;
} }
rescale_policy_type robust_policy_d
= bg::get_rescale_policy<rescale_policy_type>(mp_d, strategy);
try try
{ {
boost::geometry::detail::overlay::has_self_intersections(mp_d); boost::geometry::detail::overlay::has_self_intersections(mp_d, strategy, robust_policy_d);
} }
catch(...) catch(...)
{ {
@ -182,9 +212,13 @@ int main()
std::cout << boost::geometry::wkt(mp_d) << std::endl; std::cout << boost::geometry::wkt(mp_d) << std::endl;
break; break;
} }
rescale_policy_type robust_policy_e
= bg::get_rescale_policy<rescale_policy_type>(mp_e, strategy);
try try
{ {
boost::geometry::detail::overlay::has_self_intersections(mp_e); boost::geometry::detail::overlay::has_self_intersections(mp_e, strategy, robust_policy_e);
} }
catch(...) catch(...)
{ {

View File

@ -3,16 +3,24 @@
// Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#include <boost/geometry.hpp> #include <iostream>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/foreach.hpp>
#include <boost/timer.hpp>
#include <fstream> #include <fstream>
#include <sstream>
#include <boost/timer.hpp>
#include <boost/geometry/algorithms/buffer.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/io/wkt/write.hpp>
#include <boost/geometry/strategies/strategies.hpp>
namespace bg = boost::geometry; namespace bg = boost::geometry;
@ -73,7 +81,7 @@ double test_growth(Geometry const& geometry, int n, int d, double distance)
typename bg::default_area_result<GeometryOut>::type area = 0; typename bg::default_area_result<GeometryOut>::type area = 0;
BOOST_FOREACH(GeometryOut const& polygon, buffered) for (GeometryOut const& polygon : buffered)
{ {
area += bg::area(polygon); area += bg::area(polygon);
} }
@ -82,7 +90,7 @@ double test_growth(Geometry const& geometry, int n, int d, double distance)
// Map input geometry in green // Map input geometry in green
mapper.map(geometry, "opacity:0.5;fill:rgb(0,128,0);stroke:rgb(0,128,0);stroke-width:10"); mapper.map(geometry, "opacity:0.5;fill:rgb(0,128,0);stroke:rgb(0,128,0);stroke-width:10");
BOOST_FOREACH(GeometryOut const& polygon, buffered) for (GeometryOut const& polygon : buffered)
{ {
mapper.map(polygon, "opacity:0.4;fill:rgb(255,255,128);stroke:rgb(0,0,0);stroke-width:3"); mapper.map(polygon, "opacity:0.4;fill:rgb(255,255,128);stroke:rgb(0,0,0);stroke-width:3");
} }

View File

@ -3,10 +3,10 @@
// Copyright (c) 2012-2020 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2012-2020 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2015. // This file was modified by Oracle on 2015-2021.
// Modifications copyright (c) 2015 Oracle and/or its affiliates. // Modifications copyright (c) 2015-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -39,8 +39,8 @@
#include <geometry_test_common.hpp> #include <geometry_test_common.hpp>
#include <geometry_to_crc.hpp> #include <geometry_to_crc.hpp>
#include <common/common_settings.hpp> #include <robustness/common/common_settings.hpp>
#include <common/make_square_polygon.hpp> #include <robustness/common/make_square_polygon.hpp>
struct buffer_settings : public common_settings struct buffer_settings : public common_settings

View File

@ -3,6 +3,10 @@
// Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -15,7 +19,6 @@
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <boost/foreach.hpp>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include <boost/random/linear_congruential.hpp> #include <boost/random/linear_congruential.hpp>
#include <boost/random/uniform_int.hpp> #include <boost/random/uniform_int.hpp>
@ -23,15 +26,21 @@
#include <boost/random/variate_generator.hpp> #include <boost/random/variate_generator.hpp>
#include <boost/timer.hpp> #include <boost/timer.hpp>
#include <boost/geometry.hpp> #include <boost/geometry/algorithms/append.hpp>
#include <boost/geometry/algorithms/buffer.hpp>
#include <boost/geometry/algorithms/covered_by.hpp>
#include <boost/geometry/algorithms/envelope.hpp>
#include <boost/geometry/algorithms/within.hpp>
#include <boost/geometry/extensions/algorithms/midpoints.hpp>
#include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/io/svg/svg_mapper.hpp> #include <boost/geometry/io/svg/svg_mapper.hpp>
#include <boost/geometry/extensions/algorithms/midpoints.hpp>
#include <common/common_settings.hpp> #include <robustness/common/common_settings.hpp>
#include <common/make_square_polygon.hpp> #include <robustness/common/make_square_polygon.hpp>
namespace bg = boost::geometry; namespace bg = boost::geometry;
@ -197,20 +206,18 @@ public :
typedef typename bg::point_type<Segment2>::type pt; typedef typename bg::point_type<Segment2>::type pt;
typedef bg::model::segment<pt> segment_type; typedef bg::model::segment<pt> segment_type;
typedef bg::strategy::intersection::relate_cartesian_segments bg::strategy::intersection::cartesian_segments<> strategy;
<
bg::policies::relate::segments_intersection_points bg::policies::relate::segments_intersection_points
< <
segment_type,
segment_type,
bg::segment_intersection_points<pt> bg::segment_intersection_points<pt>
>
> policy; > policy;
segment_type seg1, seg2; segment_type seg1, seg2;
bg::convert(m_segment, seg1); bg::convert(m_segment, seg1);
bg::convert(segment, seg2); bg::convert(segment, seg2);
bg::segment_intersection_points<pt> is = policy::apply(seg1, seg2);
// TODO: this function requires unique subranges now
bg::segment_intersection_points<pt> is = strategy.apply(seg1, seg2);
if (is.count == 2) if (is.count == 2)
{ {
@ -297,7 +304,7 @@ bool verify(std::string const& caseid, MultiPolygon const& mp, Linestring const&
bg::for_each_segment(difference, bc); bg::for_each_segment(difference, bc);
// 3) check also the mid-points from the difference to remove false positives // 3) check also the mid-points from the difference to remove false positives
BOOST_FOREACH(Linestring const& d, difference) for (Linestring const& d : difference)
{ {
Linestring difference_midpoints; Linestring difference_midpoints;
bg::midpoints(d, false, std::back_inserter(difference_midpoints)); bg::midpoints(d, false, std::back_inserter(difference_midpoints));

View File

@ -1,6 +1,6 @@
// Boost.Geometry // Boost.Geometry
// Copyright (c) 2017-2019, Oracle and/or its affiliates. // Copyright (c) 2017-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -14,6 +14,7 @@
#include <boost/geometry/core/access.hpp> #include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/radian_access.hpp> #include <boost/geometry/core/radian_access.hpp>
#include <boost/geometry/util/type_traits.hpp>
#if defined(TEST_WITH_PROJ6) #if defined(TEST_WITH_PROJ6)
#define TEST_WITH_PROJ5 #define TEST_WITH_PROJ5
@ -152,30 +153,14 @@ struct pj_transformation
forward(in_xy[i], out_xy[i]); forward(in_xy[i], out_xy[i]);
} }
template <typename In, typename Out> template <typename In, typename Out, boost::geometry::util::enable_if_point_t<In, int> = 0>
void forward(In const& in, Out & out, void forward(In const& in, Out & out) const
typename boost::enable_if_c
<
boost::is_same
<
typename boost::geometry::tag<In>::type,
boost::geometry::point_tag
>::value
>::type* dummy = 0) const
{ {
transform_point(in, out, m_from, m_to); transform_point(in, out, m_from, m_to);
} }
template <typename In, typename Out> template <typename In, typename Out, boost::geometry::util::enable_if_point_t<In, int> = 0>
void inverse(In const& in, Out & out, void inverse(In const& in, Out & out) const
typename boost::enable_if_c
<
boost::is_same
<
typename boost::geometry::tag<In>::type,
boost::geometry::point_tag
>::value
>::type* dummy = 0) const
{ {
transform_point(in, out, m_to, m_from); transform_point(in, out, m_to, m_from);
} }
@ -256,16 +241,8 @@ struct proj5_transformation
out = std::move(in); out = std::move(in);
} }
template <typename In, typename Out> template <typename In, typename Out, boost::geometry::util::enable_if_point_t<In, int> = 0>
void forward(In const& in, Out & out, void forward(In const& in, Out & out) const
typename boost::enable_if_c
<
boost::is_same
<
typename boost::geometry::tag<In>::type,
boost::geometry::point_tag
>::value
>::type* dummy = 0) const
{ {
PJ_COORD c; PJ_COORD c;
c.lp.lam = boost::geometry::get_as_radian<0>(in); c.lp.lam = boost::geometry::get_as_radian<0>(in);
@ -300,16 +277,8 @@ struct proj6_transformation
out = std::move(in); out = std::move(in);
} }
template <typename In, typename Out> template <typename In, typename Out, boost::geometry::util::enable_if_point_t<In, int> = 0>
void forward(In const& in, Out & out, void forward(In const& in, Out & out) const
typename boost::enable_if_c
<
boost::is_same
<
typename boost::geometry::tag<In>::type,
boost::geometry::point_tag
>::value
>::type* dummy = 0) const
{ {
PJ_COORD c; PJ_COORD c;
c.lp.lam = boost::geometry::get_as_radian<0>(in); c.lp.lam = boost::geometry::get_as_radian<0>(in);

View File

@ -82,8 +82,8 @@ int test_main(int, char*[])
// compile-time errors // compile-time errors
{ {
point_ll pt_ll(1, 1); //point_ll pt_ll(1, 1);
point_xy pt_xy(0, 0); //point_xy pt_xy(0, 0);
//projection<spar::parameters<int> > prj1; //projection<spar::parameters<int> > prj1;
//projection<int> prj2; //projection<int> prj2;

View File

@ -1,7 +1,7 @@
// Boost.Geometry // Boost.Geometry
// Unit Test // Unit Test
// Copyright (c) 2018, Oracle and/or its affiliates. // Copyright (c) 2018-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
@ -27,30 +27,40 @@ int test_main(int, char* [])
typedef par::o_proj<par::proj_tmerc> o_proj; typedef par::o_proj<par::proj_tmerc> o_proj;
typedef par::guam guam; typedef par::guam guam;
BOOST_MPL_ASSERT_MSG((par::detail::is_param_tr<par::detail::proj_traits>::pred<proj>::value), BOOST_GEOMETRY_STATIC_ASSERT(
PROJ, (proj)); (par::detail::is_param_tr<par::detail::proj_traits>::pred<proj>::value),
BOOST_MPL_ASSERT_MSG((!par::detail::is_param_tr<par::detail::proj_traits>::pred<int>::value), "proj", proj);
NOT_PROJ, (int)); BOOST_GEOMETRY_STATIC_ASSERT(
(!par::detail::is_param_tr<par::detail::proj_traits>::pred<int>::value),
"not proj", int);
BOOST_MPL_ASSERT_MSG((par::detail::is_param_tr<par::detail::ellps_traits>::pred<ellps>::value), BOOST_GEOMETRY_STATIC_ASSERT(
ELLPS, (ellps)); (par::detail::is_param_tr<par::detail::ellps_traits>::pred<ellps>::value),
BOOST_MPL_ASSERT_MSG((!par::detail::is_param_tr<par::detail::ellps_traits>::pred<int>::value), "ellps", ellps);
NOT_ELLPS, (int)); BOOST_GEOMETRY_STATIC_ASSERT(
(!par::detail::is_param_tr<par::detail::ellps_traits>::pred<int>::value),
"not ellps", int);
BOOST_MPL_ASSERT_MSG((par::detail::is_param_tr<par::detail::datum_traits>::pred<datum>::value), BOOST_GEOMETRY_STATIC_ASSERT(
DATUM, (datum)); (par::detail::is_param_tr<par::detail::datum_traits>::pred<datum>::value),
BOOST_MPL_ASSERT_MSG((!par::detail::is_param_tr<par::detail::datum_traits>::pred<int>::value), "datum", datum);
NOT_DATUM, (int)); BOOST_GEOMETRY_STATIC_ASSERT(
(!par::detail::is_param_tr<par::detail::datum_traits>::pred<int>::value),
"not datum", int);
BOOST_MPL_ASSERT_MSG((par::detail::is_param_t<par::o_proj>::pred<o_proj>::value), BOOST_GEOMETRY_STATIC_ASSERT(
O_PROJ, (o_proj)); (par::detail::is_param_t<par::o_proj>::pred<o_proj>::value),
BOOST_MPL_ASSERT_MSG((!par::detail::is_param_t<par::o_proj>::pred<int>::value), "o_proj", o_proj);
NOT_O_PROJ, (int)); BOOST_GEOMETRY_STATIC_ASSERT(
(!par::detail::is_param_t<par::o_proj>::pred<int>::value),
"not o_proj", int);
BOOST_MPL_ASSERT_MSG((par::detail::is_param<par::guam>::pred<guam>::value), BOOST_GEOMETRY_STATIC_ASSERT(
GUAM, (guam)); (par::detail::is_param<par::guam>::pred<guam>::value),
BOOST_MPL_ASSERT_MSG((!par::detail::is_param<par::guam>::pred<int>::value), "guam", guam);
NOT_GUAM, (int)); BOOST_GEOMETRY_STATIC_ASSERT(
(!par::detail::is_param<par::guam>::pred<int>::value),
"not guam", int);
typedef par::parameters<proj, ellps, datum, o_proj, guam> params; typedef par::parameters<proj, ellps, datum, o_proj, guam> params;
typedef par::parameters<proj, ellps> params_e; typedef par::parameters<proj, ellps> params_e;

View File

@ -1,8 +1,8 @@
// Boost.Geometry // Boost.Geometry
// Copyright (c) 2017 Oracle and/or its affiliates. // Copyright (c) 2017-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -28,8 +28,8 @@ typedef bg::strategy::vincenty vincenty_formula;
template <typename P> template <typename P>
bool non_precise_ct() bool non_precise_ct()
{ {
typedef typename bg::coordinate_type<P>::type ct; using ct = typename bg::coordinate_type<P>::type;
return boost::is_integral<ct>::value || boost::is_float<ct>::value; return std::is_integral<ct>::value || std::is_floating_point<ct>::value;
} }
template <typename P1, typename P2, typename FormulaPolicy> template <typename P1, typename P2, typename FormulaPolicy>

View File

@ -1,9 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test // Unit Test
// Copyright (c) 2014, Oracle and/or its affiliates. // Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
@ -17,10 +17,6 @@
#include <boost/test/included/unit_test.hpp> #include <boost/test/included/unit_test.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/geometry/util/calculation_type.hpp> #include <boost/geometry/util/calculation_type.hpp>
#include <boost/geometry/geometries/point.hpp> #include <boost/geometry/geometries/point.hpp>
@ -35,17 +31,12 @@ namespace bg = ::boost::geometry;
template <typename DefaultResult, typename ExpectedResult> template <typename DefaultResult, typename ExpectedResult>
struct assert_equal_types inline void assert_equal_types()
{ {
assert_equal_types() BOOST_GEOMETRY_STATIC_ASSERT(
{ (std::is_same<DefaultResult, ExpectedResult>::value),
static const bool are_same = "Wrong default distance result",
boost::is_same<DefaultResult, ExpectedResult>::type::value; DefaultResult, ExpectedResult);
BOOST_MPL_ASSERT_MSG((are_same),
WRONG_DEFAULT_DISTANCE_RESULT,
(types<DefaultResult, ExpectedResult>));
}
}; };
//========================================================================= //=========================================================================
@ -179,20 +170,20 @@ struct test_distance_result_box
template <std::size_t D, typename CoordinateSystem> template <std::size_t D, typename CoordinateSystem>
inline void test_segment_all() inline void test_segment_all()
{ {
typedef typename boost::mpl::if_ using fp_return_type = std::conditional_t
< <
typename boost::is_same<CoordinateSystem, bg::cs::cartesian>::type, std::is_same<CoordinateSystem, bg::cs::cartesian>::value,
double, double,
float float
>::type float_return_type; >;
test_distance_result_segment<short, short, D, CoordinateSystem, double>(); test_distance_result_segment<short, short, D, CoordinateSystem, double>();
test_distance_result_segment<int, int, D, CoordinateSystem, double>(); test_distance_result_segment<int, int, D, CoordinateSystem, double>();
test_distance_result_segment<int, long, D, CoordinateSystem, double>(); test_distance_result_segment<int, long, D, CoordinateSystem, double>();
test_distance_result_segment<long, long, D, CoordinateSystem, double>(); test_distance_result_segment<long, long, D, CoordinateSystem, double>();
test_distance_result_segment<int, float, D, CoordinateSystem, float_return_type>(); test_distance_result_segment<int, float, D, CoordinateSystem, fp_return_type>();
test_distance_result_segment<float, float, D, CoordinateSystem, float_return_type>(); test_distance_result_segment<float, float, D, CoordinateSystem, fp_return_type>();
test_distance_result_segment<int, double, D, CoordinateSystem, double>(); test_distance_result_segment<int, double, D, CoordinateSystem, double>();
test_distance_result_segment<double, int, D, CoordinateSystem, double>(); test_distance_result_segment<double, int, D, CoordinateSystem, double>();

View File

@ -2,7 +2,6 @@
// Unit Test // Unit Test
// Copyright (c) 2015-2021, Oracle and/or its affiliates. // Copyright (c) 2015-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -24,11 +23,20 @@
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <boost/core/ignore_unused.hpp>
#include <boost/test/included/unit_test.hpp> #include <boost/test/included/unit_test.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/geometry/algorithms/comparable_distance.hpp>
#include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/algorithms/simplify.hpp>
#include <boost/geometry/core/point_type.hpp> #include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/tags.hpp> #include <boost/geometry/core/tags.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/io/dsv/write.hpp>
#include <boost/geometry/strategies/distance.hpp> #include <boost/geometry/strategies/distance.hpp>
#include <boost/geometry/strategies/strategies.hpp> #include <boost/geometry/strategies/strategies.hpp>
@ -36,21 +44,8 @@
#include <boost/geometry/geometries/adapted/boost_tuple.hpp> #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
#include <boost/geometry/geometries/register/multi_point.hpp> #include <boost/geometry/geometries/register/multi_point.hpp>
#include <boost/geometry/algorithms/comparable_distance.hpp>
#include <boost/geometry/algorithms/equals.hpp>
#include <boost/geometry/algorithms/simplify.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/io/dsv/write.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/core/ignore_unused.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/tuple/tuple.hpp>
namespace bg = ::boost::geometry; namespace bg = ::boost::geometry;
namespace ba = ::boost::assign;
namespace services = bg::strategy::distance::services; namespace services = bg::strategy::distance::services;
typedef boost::tuple<double, double> tuple_point_type; typedef boost::tuple<double, double> tuple_point_type;
@ -91,7 +86,7 @@ template <typename Geometry>
inline Geometry from_wkt(std::string const& wkt) inline Geometry from_wkt(std::string const& wkt)
{ {
Geometry geometry; Geometry geometry;
boost::geometry::read_wkt(wkt, geometry); bg::read_wkt(wkt, geometry);
return geometry; return geometry;
} }
@ -151,14 +146,15 @@ struct equals
template <typename Geometry> template <typename Geometry>
struct test_one_case struct test_one_case
{ {
template <typename Strategy, typename Range> using point_type = typename bg::point_type<Geometry>::type;
template <typename Strategy>
static inline void apply(std::string const& case_id, static inline void apply(std::string const& case_id,
std::string const& wkt, std::string const& wkt,
double max_distance, double max_distance,
Strategy const& strategy, Strategy const& strategy,
Range const& expected_result) std::initializer_list<point_type> const& expected_result)
{ {
typedef typename bg::point_type<Geometry>::type point_type;
std::vector<point_type> result; std::vector<point_type> result;
Geometry geometry = from_wkt<Geometry>(wkt); Geometry geometry = from_wkt<Geometry>(wkt);
@ -227,7 +223,7 @@ inline void test_with_strategy(std::string label)
"LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -15,-12 5)", "LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -15,-12 5)",
10, 10,
strategy, strategy,
ba::tuple_list_of(12,-3)(4,8)(-6,-13)(-12,5) {{12,-3},{4,8},{-6,-13},{-12,5}}
); );
} }
else else
@ -236,7 +232,7 @@ inline void test_with_strategy(std::string label)
"LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -15,-12 5)", "LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -15,-12 5)",
10, 10,
strategy, strategy,
ba::tuple_list_of(12,-3)(4,8)(-6,-13)(-9,4)(0,-15)(-12,5) {{12,-3},{4,8},{-6,-13},{-9,4},{0,-15},{-12,5}}
); );
} }
} }
@ -245,21 +241,21 @@ inline void test_with_strategy(std::string label)
"LINESTRING(-6 -13,-9 4,0 -15,-12 5)", "LINESTRING(-6 -13,-9 4,0 -15,-12 5)",
10, 10,
strategy, strategy,
ba::tuple_list_of(-6,-13)(-12,5) {{-6,-13},{-12,5}}
); );
tester::apply("l03" + label, tester::apply("l03" + label,
"LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -14,-12 5)", "LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -14,-12 5)",
10, 10,
strategy, strategy,
ba::tuple_list_of(12,-3)(4,8)(-6,-13)(-12,5) {{12,-3},{4,8},{-6,-13},{-12,5}}
); );
tester::apply("l04" + label, tester::apply("l04" + label,
"LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -14,-12 5)", "LINESTRING(12 -3, 4 8,-6 -13,-9 4,0 -14,-12 5)",
14, 14,
strategy, strategy,
ba::tuple_list_of(12,-3)(-6,-13)(-12,5) {{12,-3},{-6,-13},{-12,5}}
); );
{ {
@ -306,13 +302,13 @@ inline void test_with_strategy(std::string label)
wkt, wkt,
1, 1,
strategy, strategy,
ba::tuple_list_of(0,0)(5,0)(0,-1)(5,-1)(0,-2)(5,-2)(0,-3)(5,-4)(0,0) {{0,0},{5,0},{0,-1},{5,-1},{0,-2},{5,-2},{0,-3},{5,-4},{0,0}}
); );
tester::apply("l05c1a" + label, tester::apply("l05c1a" + label,
wkt, wkt,
2, 2,
strategy, strategy,
ba::tuple_list_of(0,0)(5,0)(0,-1)(5,-1)(0,-2)(5,-4)(0,0) {{0,0},{5,0},{0,-1},{5,-1},{0,-2},{5,-4},{0,0}}
); );
} }
else else
@ -321,13 +317,13 @@ inline void test_with_strategy(std::string label)
wkt, wkt,
1, 1,
strategy, strategy,
ba::tuple_list_of(0,0)(5,0)(0,-1)(5,-1)(0,-2)(5,-2)(0,-4)(5,-4)(0,0) {{0,0},{5,0},{0,-1},{5,-1},{0,-2},{5,-2},{0,-4},{5,-4},{0,0}}
); );
tester::apply("l05c2a" + label, tester::apply("l05c2a" + label,
wkt, wkt,
2, 2,
strategy, strategy,
ba::tuple_list_of(0,0)(5,0)(0,-1)(5,-1)(0,-4)(5,-4)(0,0) {{0,0},{5,0},{0,-1},{5,-1},{0,-4},{5,-4},{0,0}}
); );
} }
} }

View File

@ -5,6 +5,10 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -19,7 +23,8 @@
# pragma warning( disable : 4101 ) # pragma warning( disable : 4101 )
#endif #endif
#include <boost/timer.hpp> // TODO move this to another non-unit test
//#include <boost/timer.hpp>
#include <boost/concept/requires.hpp> #include <boost/concept/requires.hpp>
#include <boost/concept_check.hpp> #include <boost/concept_check.hpp>
@ -289,37 +294,38 @@ void test_all_3d()
test_all_3d<P, bg::model::point<double, 3, bg::cs::cartesian> >(); test_all_3d<P, bg::model::point<double, 3, bg::cs::cartesian> >();
} }
template <typename P, typename Strategy> // TODO move this to another non-unit test
void time_compare_s(int const n) //template <typename P, typename Strategy>
{ //void time_compare_s(int const n)
boost::timer t; //{
P p1, p2; // boost::timer t;
bg::assign_values(p1, 1, 1); // P p1, p2;
bg::assign_values(p2, 2, 2); // bg::assign_values(p1, 1, 1);
Strategy strategy; // bg::assign_values(p2, 2, 2);
typename bg::strategy::distance::services::return_type<Strategy, P, P>::type s = 0; // Strategy strategy;
for (int i = 0; i < n; i++) // typename bg::strategy::distance::services::return_type<Strategy, P, P>::type s = 0;
{ // for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++) // {
{ // for (int j = 0; j < n; j++)
bg::set<0>(p2, bg::get<0>(p2) + 0.001); // {
s += strategy.apply(p1, p2); // bg::set<0>(p2, bg::get<0>(p2) + 0.001);
} // s += strategy.apply(p1, p2);
} // }
std::cout << "s: " << s << " t: " << t.elapsed() << std::endl; // }
} // std::cout << "s: " << s << " t: " << t.elapsed() << std::endl;
//}
template <typename P> //
void time_compare(int const n) //template <typename P>
{ //void time_compare(int const n)
time_compare_s<P, bg::strategy::distance::pythagoras<> >(n); //{
time_compare_s<P, bg::strategy::distance::comparable::pythagoras<> >(n); // time_compare_s<P, bg::strategy::distance::pythagoras<> >(n);
} // time_compare_s<P, bg::strategy::distance::comparable::pythagoras<> >(n);
//}
int test_main(int, char* []) int test_main(int, char* [])
{ {
test_integer<int>(true); test_integer<int>(true);
test_integer<boost::long_long_type>(true); test_integer<long long>(true);
test_integer<double>(false); test_integer<double>(false);
test_all_3d<int[3]>(); test_all_3d<int[3]>();

View File

@ -5,9 +5,8 @@
// Copyright (c) 2008-2014 Bruno Lalande, Paris, France. // Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014-2020. // This file was modified by Oracle on 2014-2021.
// Modifications copyright (c) 2014-2020, Oracle and/or its affiliates. // Modifications copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -29,7 +28,9 @@
#endif #endif
#include <boost/core/ignore_unused.hpp> #include <boost/core/ignore_unused.hpp>
#include <boost/timer.hpp>
// TODO move this to another non-unit test
//#include <boost/timer.hpp>
#include <boost/concept/requires.hpp> #include <boost/concept/requires.hpp>
#include <boost/concept_check.hpp> #include <boost/concept_check.hpp>
@ -365,8 +366,8 @@ inline void test_integer(bool check_types)
if (check_types) if (check_types)
{ {
BOOST_CHECK((boost::is_same<distance_type, double>::type::value)); BOOST_CHECK((std::is_same<distance_type, double>::type::value));
BOOST_CHECK((boost::is_same<cdistance_type, boost::long_long_type>::type::value)); BOOST_CHECK((std::is_same<cdistance_type, long long>::type::value));
} }
} }
@ -394,41 +395,43 @@ void test_all_3d()
test_all_3d<P, bg::model::point<double, 3, bg::cs::cartesian> >(); test_all_3d<P, bg::model::point<double, 3, bg::cs::cartesian> >();
} }
template <typename P, typename Strategy>
void time_compare_s(int const n)
{
typedef bg::model::box<P> box_type;
boost::timer t; // TODO move this to another non-unit test
P p; //template <typename P, typename Strategy>
box_type b; //void time_compare_s(int const n)
bg::assign_values(b, 0, 0, 1, 1); //{
bg::assign_values(p, 2, 2); // typedef bg::model::box<P> box_type;
Strategy strategy; //
typename bg::strategy::distance::services::return_type // boost::timer t;
< // P p;
Strategy, P, box_type // box_type b;
>::type s = 0; // bg::assign_values(b, 0, 0, 1, 1);
for (int i = 0; i < n; i++) // bg::assign_values(p, 2, 2);
{ // Strategy strategy;
for (int j = 0; j < n; j++) // typename bg::strategy::distance::services::return_type
{ // <
bg::set<0>(p, bg::get<0>(p) + 0.001); // Strategy, P, box_type
s += strategy.apply(p, b); // >::type s = 0;
} // for (int i = 0; i < n; i++)
} // {
std::cout << "s: " << s << " t: " << t.elapsed() << std::endl; // for (int j = 0; j < n; j++)
} // {
// bg::set<0>(p, bg::get<0>(p) + 0.001);
template <typename P> // s += strategy.apply(p, b);
inline void time_compare(int const n) // }
{ // }
time_compare_s<P, bg::strategy::distance::pythagoras_point_box<> >(n); // std::cout << "s: " << s << " t: " << t.elapsed() << std::endl;
time_compare_s //}
< //
P, bg::strategy::distance::comparable::pythagoras_point_box<> //template <typename P>
>(n); //inline void time_compare(int const n)
} //{
// time_compare_s<P, bg::strategy::distance::pythagoras_point_box<> >(n);
// time_compare_s
// <
// P, bg::strategy::distance::comparable::pythagoras_point_box<>
// >(n);
//}
@ -436,7 +439,7 @@ inline void time_compare(int const n)
BOOST_AUTO_TEST_CASE( test_integer_all ) BOOST_AUTO_TEST_CASE( test_integer_all )
{ {
test_integer<int>(true); test_integer<int>(true);
test_integer<boost::long_long_type>(true); test_integer<long long>(true);
test_integer<double>(false); test_integer<double>(false);
} }

View File

@ -5,9 +5,8 @@
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2014, 2015, 2016, 2017. // This file was modified by Oracle on 2014-2021.
// Modifications copyright (c) 2014-2017 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@ -96,8 +95,8 @@ double azimuth(double deg, double min)
template <typename P> template <typename P>
bool non_precise_ct() bool non_precise_ct()
{ {
typedef typename bg::coordinate_type<P>::type ct; using ct = typename bg::coordinate_type<P>::type;
return boost::is_integral<ct>::value || boost::is_float<ct>::value; return std::is_integral<ct>::value || std::is_floating_point<ct>::value;
} }
template <typename P1, typename P2, typename Spheroid> template <typename P1, typename P2, typename Spheroid>
@ -248,8 +247,8 @@ void test_all()
// Test fractional coordinates only for non-integral types // Test fractional coordinates only for non-integral types
if ( BOOST_GEOMETRY_CONDITION( if ( BOOST_GEOMETRY_CONDITION(
! boost::is_integral<typename bg::coordinate_type<P1>::type>::value ! std::is_integral<typename bg::coordinate_type<P1>::type>::value
&& ! boost::is_integral<typename bg::coordinate_type<P2>::type>::value ) ) && ! std::is_integral<typename bg::coordinate_type<P2>::type>::value ) )
{ {
// Flinders Peak -> Buninyong // Flinders Peak -> Buninyong
test_vincenty<P1, P2>(azimuth(144,25,29.52440), azimuth(-37,57,3.72030), test_vincenty<P1, P2>(azimuth(144,25,29.52440), azimuth(-37,57,3.72030),

View File

@ -4,10 +4,10 @@
// Copyright (c) 2008-2015 Bruno Lalande, Paris, France. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2015. // This file was modified by Oracle on 2015-2021.
// Modifications copyright (c) 2015, Oracle and/or its affiliates. // Modifications copyright (c) 2015-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@ -50,11 +50,9 @@ template <> struct string_from_type<long>
template <> struct string_from_type<boost::multiprecision::cpp_bin_float_100> template <> struct string_from_type<boost::multiprecision::cpp_bin_float_100>
{ static std::string name() { return "m"; } }; { static std::string name() { return "m"; } };
#if defined(BOOST_HAS_LONG_LONG)
// this is what g++ and clang++ use // this is what g++ and clang++ use
template <> struct string_from_type<boost::long_long_type> template <> struct string_from_type<long long>
{ static std::string name() { return "x"; } }; { static std::string name() { return "x"; } };
#endif
#if defined(BOOST_HAS_INT128) #if defined(BOOST_HAS_INT128)
// this is what g++ and clang++ use // this is what g++ and clang++ use

View File

@ -3,6 +3,11 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -60,7 +65,7 @@ template<>
struct coordinate_system<test::test_point> { typedef cs::cartesian type; }; struct coordinate_system<test::test_point> { typedef cs::cartesian type; };
template<> template<>
struct dimension<test::test_point>: boost::mpl::int_<3> {}; struct dimension<test::test_point> : std::integral_constant<int, 3> {};
template<> struct access<test::test_point, 0> template<> struct access<test::test_point, 0>
{ {

View File

@ -3,6 +3,11 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -48,7 +53,7 @@ template<> struct coordinate_type<test::test_point_xy>
template<> struct coordinate_system<test::test_point_xy> template<> struct coordinate_system<test::test_point_xy>
{ typedef cs::cartesian type; }; { typedef cs::cartesian type; };
template<> struct dimension<test::test_point_xy> : boost::mpl::int_<2> {}; template<> struct dimension<test::test_point_xy> : std::integral_constant<int, 2> {};
template<> template<>
struct access<test::test_point_xy, 0> struct access<test::test_point_xy, 0>

View File

@ -1,9 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test // Unit Test
// Copyright (c) 2014, Oracle and/or its affiliates. // Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
@ -11,8 +11,6 @@
#ifndef BOOST_GEOMETRY_TEST_TEST_GEOMETRIES_CUSTOM_LON_LAT_POINT_HPP #ifndef BOOST_GEOMETRY_TEST_TEST_GEOMETRIES_CUSTOM_LON_LAT_POINT_HPP
#define BOOST_GEOMETRY_TEST_TEST_GEOMETRIES_CUSTOM_LON_LAT_POINT_HPP #define BOOST_GEOMETRY_TEST_TEST_GEOMETRIES_CUSTOM_LON_LAT_POINT_HPP
#include <boost/mpl/int.hpp>
#include <boost/geometry/core/access.hpp> #include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp> #include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/coordinate_system.hpp> #include <boost/geometry/core/coordinate_system.hpp>
@ -51,7 +49,7 @@ struct coordinate_system<rw_lon_lat_point<CoordinateType, CoordinateSystem> >
template <typename CoordinateType, typename CoordinateSystem> template <typename CoordinateType, typename CoordinateSystem>
struct dimension<rw_lon_lat_point<CoordinateType, CoordinateSystem> > struct dimension<rw_lon_lat_point<CoordinateType, CoordinateSystem> >
: boost::mpl::int_<2> : std::integral_constant<int, 2>
{}; {};
template template
@ -109,7 +107,7 @@ struct coordinate_system<ro_lon_lat_point<CoordinateType, CoordinateSystem> >
template <typename CoordinateType, typename CoordinateSystem> template <typename CoordinateType, typename CoordinateSystem>
struct dimension<ro_lon_lat_point<CoordinateType, CoordinateSystem> > struct dimension<ro_lon_lat_point<CoordinateType, CoordinateSystem> >
: boost::mpl::int_<2> : std::integral_constant<int, 2>
{}; {};
template template

View File

@ -2,32 +2,31 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2014. // This file was modified by Oracle on 2014-2021.
// Modifications copyright (c) 2014 Oracle and/or its affiliates. // Modifications copyright (c) 2014-2021 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
#ifndef BOOST_GEOMETRY_TEST_TO_SVG_HPP #ifndef BOOST_GEOMETRY_TEST_TO_SVG_HPP
#define BOOST_GEOMETRY_TEST_TO_SVG_HPP #define BOOST_GEOMETRY_TEST_TO_SVG_HPP
#include <fstream> #include <fstream>
#include <boost/geometry/io/wkt/read.hpp>
#include <boost/geometry/io/svg/svg_mapper.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp> #include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
#include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp> #include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp>
#include <boost/geometry/algorithms/detail/overlay/traversal_info.hpp> #include <boost/geometry/algorithms/detail/overlay/traversal_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp> #include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/enrichment_info.hpp> #include <boost/geometry/algorithms/detail/overlay/enrichment_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp> #include <boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp>
#include <boost/foreach.hpp>
#include <boost/geometry/algorithms/detail/relate/turns.hpp> #include <boost/geometry/algorithms/detail/relate/turns.hpp>
#include <boost/geometry/io/svg/svg_mapper.hpp>
#include <boost/geometry/io/wkt/read.hpp>
template <typename G, typename Turns, typename Mapper> template <typename G, typename Turns, typename Mapper>
inline void turns_to_svg(Turns const& turns, Mapper & mapper, bool /*enrich*/ = false) inline void turns_to_svg(Turns const& turns, Mapper & mapper, bool /*enrich*/ = false)
{ {
@ -42,7 +41,7 @@ inline void turns_to_svg(Turns const& turns, Mapper & mapper, bool /*enrich*/ =
int index = 0; int index = 0;
int const margin = 5; int const margin = 5;
BOOST_FOREACH(turn_info const& turn, turns) for (turn_info const& turn : turns)
{ {
int lineheight = 10; int lineheight = 10;
mapper.map(turn.point, "fill:rgb(255,128,0);" mapper.map(turn.point, "fill:rgb(255,128,0);"

View File

@ -5,6 +5,10 @@
// Copyright (c) 2012 Bruno Lalande, Paris, France. // Copyright (c) 2012 Bruno Lalande, Paris, France.
// Copyright (c) 2012 Mateusz Loskot, London, UK. // Copyright (c) 2012 Mateusz Loskot, London, UK.
// This file was modified by Oracle on 2021.
// Modifications copyright (c) 2021, 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, // Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@ -58,7 +62,7 @@ void test()
std::string const caption = helper<G1, G2>(); std::string const caption = helper<G1, G2>();
BOOST_CHECK_MESSAGE((boost::is_same<type, ExpectedType>::type::value), BOOST_CHECK_MESSAGE((std::is_same<type, ExpectedType>::value),
"Failure, types do not agree;" "Failure, types do not agree;"
<< " input: " << caption << " input: " << caption
<< " defaults: " << typeid(DefaultFP).name() << " defaults: " << typeid(DefaultFP).name()
@ -88,7 +92,7 @@ void test_with_calculation_type()
std::string const caption = helper<G1, G2>(); std::string const caption = helper<G1, G2>();
BOOST_CHECK_MESSAGE((boost::is_same<type, ExpectedType>::type::value), BOOST_CHECK_MESSAGE((std::is_same<type, ExpectedType>::value),
"Failure, types do not agree;" "Failure, types do not agree;"
<< " input: " << caption << " input: " << caption
<< " calculation type: " << typeid(CalculationType).name() << " calculation type: " << typeid(CalculationType).name()
@ -114,7 +118,7 @@ void test_unary()
DefaultInt DefaultInt
>::type type; >::type type;
BOOST_CHECK_MESSAGE((boost::is_same<type, ExpectedType>::type::value), BOOST_CHECK_MESSAGE((std::is_same<type, ExpectedType>::value),
"Failure, types do not agree;" "Failure, types do not agree;"
<< " input: " << typeid(typename bg::coordinate_type<Geometry>::type).name() << " input: " << typeid(typename bg::coordinate_type<Geometry>::type).name()
<< " defaults: " << typeid(DefaultFP).name() << " defaults: " << typeid(DefaultFP).name()
@ -148,7 +152,7 @@ void test_ternary()
std::string const caption = helper3<G1, G2, G3>(); std::string const caption = helper3<G1, G2, G3>();
BOOST_CHECK_MESSAGE((boost::is_same<type, ExpectedType>::type::value), BOOST_CHECK_MESSAGE((std::is_same<type, ExpectedType>::value),
"Failure, types do not agree;" "Failure, types do not agree;"
<< " input: " << caption << " input: " << caption
<< " defaults: " << typeid(DefaultFP).name() << " defaults: " << typeid(DefaultFP).name()
@ -169,7 +173,7 @@ int test_main(int, char* [])
typedef model::point<int, 2, cs::cartesian> i; typedef model::point<int, 2, cs::cartesian> i;
typedef model::point<char, 2, cs::cartesian> c; typedef model::point<char, 2, cs::cartesian> c;
typedef model::point<short int, 2, cs::cartesian> s; typedef model::point<short int, 2, cs::cartesian> s;
typedef model::point<boost::long_long_type, 2, cs::cartesian> ll; typedef model::point<long long, 2, cs::cartesian> ll;
typedef model::point<user_defined, 2, cs::cartesian> u; typedef model::point<user_defined, 2, cs::cartesian> u;
// Calculation type "void" so // Calculation type "void" so
@ -187,11 +191,11 @@ int test_main(int, char* [])
test<c, i, double, int, int>(); test<c, i, double, int, int>();
test<c, c, double, char, char>(); test<c, c, double, char, char>();
test<c, c, double, int, int>(); test<c, c, double, int, int>();
test<i, i, double, boost::long_long_type, boost::long_long_type>(); test<i, i, double, long long, long long>();
// Even if we specify "int" as default-calculation-type, it should never go downwards. // Even if we specify "int" as default-calculation-type, it should never go downwards.
// So it will select "long long" // So it will select "long long"
test<ll, ll, double, int, boost::long_long_type>(); test<ll, ll, double, int, long long>();
// user defined // user defined
test<u, i, double, char, user_defined>(); test<u, i, double, char, user_defined>();

View File

@ -74,14 +74,14 @@ int test_main(int, char* [])
typedef bg::model::d2::point_xy<double> point_type; typedef bg::model::d2::point_xy<double> point_type;
BOOST_MPL_ASSERT(( BOOST_MPL_ASSERT((
boost::is_same< std::is_same<
bg::util::is_implemented2 bg::util::is_implemented2
< <
point_type, point_type, point_type, point_type,
bg::algorithm_archetype<point_type, point_type, bg::strategy_archetype> bg::algorithm_archetype<point_type, point_type, bg::strategy_archetype>
>::type, >::type,
boost::mpl::false_ boost::mpl::false_
> >::value
)); ));
return 0; return 0;

View File

@ -1,9 +1,9 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test // Unit Test
// Copyright (c) 2014, Oracle and/or its affiliates. // Copyright (c) 2014-2021, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Licensed under the Boost Software License version 1.0. // Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html // http://www.boost.org/users/license.html
@ -14,11 +14,11 @@
#include <cmath> #include <cmath>
#include <iostream> #include <iostream>
#include <type_traits>
#include <boost/test/included/unit_test.hpp> #include <boost/test/included/unit_test.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/type_traits/is_fundamental.hpp>
#include "number_types.hpp" #include "number_types.hpp"
@ -26,8 +26,8 @@
// otherwise the test will fail for the custom number type: // otherwise the test will fail for the custom number type:
// custom_with_global_sqrt // custom_with_global_sqrt
#include <boost/geometry/util/math.hpp>
#include <boost/geometry/algorithms/not_implemented.hpp> #include <boost/geometry/algorithms/not_implemented.hpp>
#include <boost/geometry/util/math.hpp>
namespace bg = boost::geometry; namespace bg = boost::geometry;
@ -35,68 +35,44 @@ namespace bg = boost::geometry;
// call BOOST_CHECK // call BOOST_CHECK
template <typename Argument, bool IsFundamental /* true */> template
struct check <
typename Argument, typename Result,
std::enable_if_t<std::is_fundamental<Argument>::value, int> = 0
>
inline void check(Argument const& arg, Result const& result)
{ {
template <typename Result>
static inline void apply(Argument const& arg, Result const& result)
{
BOOST_CHECK_CLOSE(static_cast<double>(bg::math::sqrt(arg)), BOOST_CHECK_CLOSE(static_cast<double>(bg::math::sqrt(arg)),
static_cast<double>(result), static_cast<double>(result),
0.00001); 0.00001);
} }
};
template
template <typename Argument> <
struct check<Argument, false> typename Argument, typename Result,
std::enable_if_t<! std::is_fundamental<Argument>::value, int> = 0
>
inline void check(Argument const& arg, Result const& result)
{ {
template <typename Result>
static inline void apply(Argument const& arg, Result const& result)
{
Result const tol(0.00001); Result const tol(0.00001);
BOOST_CHECK( bg::math::abs(bg::math::sqrt(arg) - result) < tol ); BOOST_CHECK( bg::math::abs(bg::math::sqrt(arg) - result) < tol );
} }
};
// test sqrt return type and value // test sqrt return type and value
template template <typename Argument, typename Result>
< inline void check_sqrt(Argument const& arg, Result const& result)
typename Argument,
typename ExpectedResult,
typename Result = typename bg::math::detail::square_root
<
Argument
>::return_type,
bool IsFundamental = boost::is_fundamental<Argument>::value
>
struct check_sqrt
: bg::not_implemented<Argument, Result, ExpectedResult>
{};
template <typename Argument, typename Result, bool IsFundamental>
struct check_sqrt<Argument, Result, Result, IsFundamental>
{ {
static inline void apply(Argument const& arg, Result const& result) using return_type = typename bg::math::detail::square_root<Argument>::return_type;
{ BOOST_GEOMETRY_STATIC_ASSERT((std::is_same<return_type, Result>::value), "Wrong return type");
#ifdef BOOST_GEOMETRY_TEST_DEBUG #ifdef BOOST_GEOMETRY_TEST_DEBUG
std::cout << "testing: " << typeid(Result).name() std::cout << "testing: " << typeid(Result).name()
<< " sqrt(" << typeid(Argument).name() << " sqrt(" << typeid(Argument).name()
<< ")" << std::endl; << ")" << std::endl;
#endif #endif
check<Argument, IsFundamental>::apply(arg, result); check<Argument, Result>(arg, result);
} }
};
// test cases // test cases
@ -106,24 +82,17 @@ BOOST_AUTO_TEST_CASE( test_math_sqrt_fundamental )
static const long double sqrt2L = std::sqrt(2.0L); static const long double sqrt2L = std::sqrt(2.0L);
static const float sqrt2F = std::sqrt(2.0F); static const float sqrt2F = std::sqrt(2.0F);
check_sqrt<float, float>::apply(2.0F, sqrt2F); check_sqrt<float, float>(2.0F, sqrt2F);
check_sqrt<double, double>::apply(2.0, sqrt2); check_sqrt<double, double>(2.0, sqrt2);
check_sqrt<long double, long double>::apply(2.0L, sqrt2L); check_sqrt<long double, long double>(2.0L, sqrt2L);
check_sqrt<char, double>::apply(2, sqrt2); check_sqrt<char, double>(2, sqrt2);
check_sqrt<signed char, double>::apply(2, sqrt2); check_sqrt<signed char, double>(2, sqrt2);
check_sqrt<short, double>::apply(2, sqrt2); check_sqrt<short, double>(2, sqrt2);
check_sqrt<int, double>::apply(2, sqrt2); check_sqrt<int, double>(2, sqrt2);
check_sqrt<long, double>::apply(2L, sqrt2); check_sqrt<long, double>(2L, sqrt2);
#if !defined(BOOST_NO_LONG_LONG)
check_sqrt<long long, double>::apply(2LL, sqrt2); check_sqrt<long long, double>(2LL, sqrt2);
#endif
#ifdef BOOST_HAS_LONG_LONG
check_sqrt
<
boost::long_long_type, double
>::apply(boost::long_long_type(2), sqrt2);
#endif
} }
@ -135,7 +104,7 @@ BOOST_AUTO_TEST_CASE( test_math_sqrt_custom )
static const double sqrt2 = std::sqrt(2.0); static const double sqrt2 = std::sqrt(2.0);
check_sqrt<custom1, custom1>::apply(custom1(2.0), custom1(sqrt2)); check_sqrt<custom1, custom1>(custom1(2.0), custom1(sqrt2));
check_sqrt<custom2, custom2>::apply(custom2(2.0), custom2(sqrt2)); check_sqrt<custom2, custom2>(custom2(2.0), custom2(sqrt2));
check_sqrt<custom3, custom3>::apply(custom3(2.0), custom3(sqrt2)); check_sqrt<custom3, custom3>(custom3(2.0), custom3(sqrt2));
} }

Some files were not shown because too many files have changed in this diff Show More