mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-28 05:22:22 +00:00
Merge branch 'develop' into bg-prepare
This commit is contained in:
@@ -40,6 +40,7 @@ test-suite boost-geometry-algorithms
|
||||
[ run is_valid.cpp : : : : algorithms_is_valid ]
|
||||
[ run is_valid_failure.cpp : : : : algorithms_is_valid_failure ]
|
||||
[ run is_valid_geo.cpp : : : : algorithms_is_valid_geo ]
|
||||
[ run line_interpolate.cpp : : : : algorithms_line_interpolate ]
|
||||
[ run make.cpp : : : : algorithms_make ]
|
||||
[ run maximum_gap.cpp : : : : algorithms_maximum_gap ]
|
||||
[ run num_geometries.cpp : : : : algorithms_num_geometries ]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
#
|
||||
# Copyright (c) 2011-2013 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
# Copyright (c) 2011-2019 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
#
|
||||
# Use, modification and distribution is subject to the Boost Software License,
|
||||
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -17,6 +17,7 @@ test-suite boost-geometry-algorithms-buffer
|
||||
[ run buffer.cpp : : : : algorithms_buffer ]
|
||||
[ run buffer_with_strategies.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE : algorithms_buffer_with_strategies ]
|
||||
[ run buffer_point.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE : algorithms_buffer_point ]
|
||||
[ run buffer_point_geo.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE : algorithms_buffer_point_geo ]
|
||||
[ run buffer_linestring.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE : algorithms_buffer_linestring ]
|
||||
[ run buffer_ring.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE : algorithms_buffer_ring ]
|
||||
[ run buffer_polygon.cpp : : : <define>BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE : algorithms_buffer_polygon ]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2007-2019 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
||||
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include <boost/variant/variant.hpp>
|
||||
|
||||
#include <geometry_test_common.hpp>
|
||||
#include "geometry_test_common.hpp"
|
||||
|
||||
#include <boost/geometry/algorithms/buffer.hpp>
|
||||
#include <boost/geometry/algorithms/equals.hpp>
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include <boost/geometry/geometries/point.hpp>
|
||||
#include <boost/geometry/geometries/box.hpp>
|
||||
#include <test_common/test_point.hpp>
|
||||
#include "test_common/test_point.hpp"
|
||||
|
||||
|
||||
template <typename P>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2014-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2014-2019 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <test_buffer.hpp>
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
|
||||
template <typename MultiPolygon>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
|
||||
@@ -11,7 +11,7 @@
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <test_buffer.hpp>
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
#include <boost/geometry/algorithms/buffer.hpp>
|
||||
#include <boost/geometry/core/coordinate_type.hpp>
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include <boost/geometry/geometries/point.hpp>
|
||||
#include <boost/geometry/geometries/box.hpp>
|
||||
#include <test_common/test_point.hpp>
|
||||
#include "test_common/test_point.hpp"
|
||||
|
||||
|
||||
static std::string const simplex = "LINESTRING(0 0,4 5)";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
|
||||
@@ -11,7 +11,7 @@
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <test_buffer.hpp>
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
static std::string const simplex = "MULTILINESTRING((0 0,4 5),(5 4,10 0))";
|
||||
static std::string const two_bends = "MULTILINESTRING((0 0,4 5,7 4,10 6),(1 5,5 9,8 6))";
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <test_buffer.hpp>
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
static std::string const simplex = "MULTIPOINT((5 5),(7 7))";
|
||||
static std::string const three = "MULTIPOINT((5 8),(9 8),(7 11))";
|
||||
@@ -68,12 +68,9 @@ void test_all()
|
||||
grid_a, join, end_flat,
|
||||
distance_strategy(0.5), side_strategy, point_strategy, 7.0);
|
||||
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
test_with_custom_strategies<multi_point_type, polygon>("grid_a54",
|
||||
grid_a, join, end_flat,
|
||||
distance_strategy(0.54), side_strategy, point_strategy, 7.819);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
test_with_custom_strategies<multi_point_type, polygon>("mysql_report_2015_02_25_1_800",
|
||||
@@ -83,14 +80,21 @@ void test_all()
|
||||
115057490003226.125, ut_settings(1.0));
|
||||
|
||||
{
|
||||
typename bg::strategy::area::services::default_strategy
|
||||
<
|
||||
typename bg::cs_tag<P>::type
|
||||
>::type area_strategy;
|
||||
|
||||
multi_point_type g;
|
||||
bg::read_wkt(mysql_report_3, g);
|
||||
test_buffer<polygon>("mysql_report_3", g,
|
||||
bg::model::multi_polygon<polygon> buffered;
|
||||
test_buffer<polygon>("mysql_report_3", buffered, g,
|
||||
bg::strategy::buffer::join_round(36),
|
||||
bg::strategy::buffer::end_round(36),
|
||||
distance_strategy(1),
|
||||
side_strategy,
|
||||
bg::strategy::buffer::point_circle(36),
|
||||
area_strategy,
|
||||
1, 0, 3.12566719800474635, ut_settings(1.0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
|
||||
@@ -11,7 +11,7 @@
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <test_buffer.hpp>
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
|
||||
static std::string const simplex
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <test_buffer.hpp>
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
|
||||
static std::string const simplex = "POINT(5 5)";
|
||||
|
||||
40
test/algorithms/buffer/buffer_point_geo.cpp
Normal file
40
test/algorithms/buffer/buffer_point_geo.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
// Boost.Geometry
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2018-2019 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include "test_buffer_geo.hpp"
|
||||
|
||||
static std::string const simplex = "POINT(4.9 52.0)";
|
||||
|
||||
template <bool Clockwise, typename PointType>
|
||||
void test_point()
|
||||
{
|
||||
typedef bg::model::polygon<PointType, Clockwise> polygon;
|
||||
|
||||
bg::strategy::buffer::join_miter join_miter;
|
||||
bg::strategy::buffer::end_flat end_flat;
|
||||
|
||||
// NOTE: for now do not test with a radius less than 2 meter, because is not precise yet (in double)
|
||||
test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 70.7107, 5.0, ut_settings(0.1, false, 8));
|
||||
test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 76.5437, 5.0, ut_settings(0.1, false, 16));
|
||||
test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 78.0363, 5.0, ut_settings(0.1, false, 32));
|
||||
|
||||
// The more points used for the buffer, the more the area approaches 10*PI square meters
|
||||
test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 282.8430, 10.0, ut_settings(0.1, false, 8));
|
||||
test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 306.1471, 10.0, ut_settings(0.1, false, 16));
|
||||
test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 312.1450, 10.0, ut_settings(0.1, false, 32));
|
||||
test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 314.0960, 10.0, ut_settings(0.1, false, 180));
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_point<true, bg::model::point<double, 2, bg::cs::geographic<bg::degree> > >();
|
||||
test_point<true, bg::model::point<long double, 2, bg::cs::geographic<bg::degree> > >();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2012-2019 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016.
|
||||
// Modifications copyright (c) 2016, Oracle and/or its affiliates.
|
||||
@@ -11,7 +11,7 @@
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <test_buffer.hpp>
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
|
||||
static std::string const simplex
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2017-2019 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <test_buffer.hpp>
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
// Short test verifying behavior of explicit ring_type (polygon without holes)
|
||||
// The test buffer_polygon.cpp contains all other tests, also for rings.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2015-2019 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <geometry_test_common.hpp>
|
||||
#include "geometry_test_common.hpp"
|
||||
|
||||
#include <boost/geometry/algorithms/buffer.hpp>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test Helper
|
||||
|
||||
// Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2010-2019 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// This file was modified by Oracle on 2016-2017.
|
||||
// Modifications copyright (c) 2016-2017, Oracle and/or its affiliates.
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <iomanip>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <geometry_test_common.hpp>
|
||||
#include "geometry_test_common.hpp"
|
||||
|
||||
#include <boost/geometry/algorithms/envelope.hpp>
|
||||
#include <boost/geometry/algorithms/area.hpp>
|
||||
@@ -54,8 +54,8 @@
|
||||
const double same_distance = -999;
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
# include <test_buffer_svg.hpp>
|
||||
# include <test_buffer_svg_per_turn.hpp>
|
||||
# include "test_buffer_svg.hpp"
|
||||
# include "test_buffer_svg_per_turn.hpp"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -100,11 +100,13 @@ struct ut_settings
|
||||
double tolerance;
|
||||
bool test_validity;
|
||||
bool test_area;
|
||||
int points_per_circle;
|
||||
|
||||
explicit ut_settings(double tol = 0.01, bool val = true)
|
||||
explicit ut_settings(double tol = 0.01, bool val = true, int points = 88)
|
||||
: tolerance(tol)
|
||||
, test_validity(val)
|
||||
, test_area(true)
|
||||
, points_per_circle(points)
|
||||
{}
|
||||
|
||||
static inline ut_settings ignore_validity()
|
||||
@@ -133,14 +135,18 @@ template
|
||||
typename DistanceStrategy,
|
||||
typename SideStrategy,
|
||||
typename PointStrategy,
|
||||
typename AreaStrategy,
|
||||
typename Geometry
|
||||
>
|
||||
void test_buffer(std::string const& caseid, Geometry const& geometry,
|
||||
void test_buffer(std::string const& caseid,
|
||||
bg::model::multi_polygon<GeometryOut>& buffered,
|
||||
Geometry const& geometry,
|
||||
JoinStrategy const& join_strategy,
|
||||
EndStrategy const& end_strategy,
|
||||
DistanceStrategy const& distance_strategy,
|
||||
SideStrategy const& side_strategy,
|
||||
PointStrategy const& point_strategy,
|
||||
AreaStrategy const& area_strategy,
|
||||
int expected_count,
|
||||
int expected_holes_count,
|
||||
double expected_area,
|
||||
@@ -226,6 +232,7 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
|
||||
<
|
||||
typename bg::cs_tag<Geometry>::type
|
||||
>::type strategy_type;
|
||||
typedef typename strategy_type::envelope_strategy_type envelope_strategy_type;
|
||||
|
||||
// Enlarge the box to get a proper rescale policy
|
||||
bg::buffer(envelope, envelope, distance_strategy.max_distance(join_strategy, end_strategy));
|
||||
@@ -234,8 +241,9 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
|
||||
rescale_policy_type rescale_policy
|
||||
= bg::get_rescale_policy<rescale_policy_type>(envelope);
|
||||
|
||||
bg::model::multi_polygon<GeometryOut> buffered;
|
||||
envelope_strategy_type envelope_strategy;
|
||||
|
||||
buffered.clear();
|
||||
bg::detail::buffer::buffer_inserter<GeometryOut>(geometry,
|
||||
std::back_inserter(buffered),
|
||||
distance_strategy,
|
||||
@@ -272,7 +280,7 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
|
||||
|
||||
bg::model::box<point_type> envelope_output;
|
||||
bg::assign_values(envelope_output, 0, 0, 1, 1);
|
||||
bg::envelope(buffered, envelope_output);
|
||||
bg::envelope(buffered, envelope_output, envelope_strategy);
|
||||
|
||||
// std::cout << caseid << std::endl;
|
||||
// std::cout << "INPUT: " << bg::wkt(geometry) << std::endl;
|
||||
@@ -305,7 +313,7 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
|
||||
|
||||
if (settings.test_area)
|
||||
{
|
||||
typename bg::default_area_result<GeometryOut>::type area = bg::area(buffered);
|
||||
typename bg::default_area_result<GeometryOut>::type area = bg::area(buffered, area_strategy);
|
||||
double const difference = area - expected_area;
|
||||
BOOST_CHECK_MESSAGE
|
||||
(
|
||||
@@ -360,7 +368,7 @@ template
|
||||
typename PointStrategy,
|
||||
typename Geometry
|
||||
>
|
||||
void test_buffer(std::string const& caseid, Geometry const& geometry,
|
||||
void test_buffer(std::string const& caseid, bg::model::multi_polygon<GeometryOut>& buffered, Geometry const& geometry,
|
||||
JoinStrategy const& join_strategy,
|
||||
EndStrategy const& end_strategy,
|
||||
DistanceStrategy const& distance_strategy,
|
||||
@@ -369,8 +377,14 @@ void test_buffer(std::string const& caseid, Geometry const& geometry,
|
||||
double expected_area,
|
||||
ut_settings const& settings = ut_settings())
|
||||
{
|
||||
test_buffer<GeometryOut>(caseid, geometry,
|
||||
typename bg::strategy::area::services::default_strategy
|
||||
<
|
||||
typename bg::cs_tag<Geometry>::type
|
||||
>::type area_strategy;
|
||||
|
||||
test_buffer<GeometryOut>(caseid, buffered, geometry,
|
||||
join_strategy, end_strategy, distance_strategy, side_strategy, point_strategy,
|
||||
area_strategy,
|
||||
-1, -1, expected_area, settings);
|
||||
}
|
||||
|
||||
@@ -396,7 +410,6 @@ void test_one(std::string const& caseid, std::string const& wkt,
|
||||
bg::read_wkt(wkt, g);
|
||||
bg::correct(g);
|
||||
|
||||
|
||||
#ifdef BOOST_GEOMETRY_CHECK_WITH_POSTGIS
|
||||
std::cout
|
||||
<< (counter > 0 ? "union " : "")
|
||||
@@ -411,7 +424,7 @@ void test_one(std::string const& caseid, std::string const& wkt,
|
||||
|
||||
|
||||
bg::strategy::buffer::side_straight side_strategy;
|
||||
bg::strategy::buffer::point_circle circle_strategy(88);
|
||||
bg::strategy::buffer::point_circle circle_strategy(settings.points_per_circle);
|
||||
|
||||
bg::strategy::buffer::distance_asymmetric
|
||||
<
|
||||
@@ -420,10 +433,17 @@ void test_one(std::string const& caseid, std::string const& wkt,
|
||||
bg::math::equals(distance_right, same_distance)
|
||||
? distance_left : distance_right);
|
||||
|
||||
typename bg::strategy::area::services::default_strategy
|
||||
<
|
||||
typename bg::cs_tag<Geometry>::type
|
||||
>::type area_strategy;
|
||||
|
||||
bg::model::multi_polygon<GeometryOut> buffered;
|
||||
test_buffer<GeometryOut>
|
||||
(caseid, g,
|
||||
(caseid, buffered, g,
|
||||
join_strategy, end_strategy,
|
||||
distance_strategy, side_strategy, circle_strategy,
|
||||
area_strategy,
|
||||
expected_count, expected_holes_count, expected_area,
|
||||
settings);
|
||||
|
||||
@@ -439,9 +459,10 @@ void test_one(std::string const& caseid, std::string const& wkt,
|
||||
> sym_distance_strategy(distance_left);
|
||||
|
||||
test_buffer<GeometryOut>
|
||||
(caseid + "_sym", g,
|
||||
(caseid + "_sym", buffered, g,
|
||||
join_strategy, end_strategy,
|
||||
sym_distance_strategy, side_strategy, circle_strategy,
|
||||
area_strategy,
|
||||
expected_count, expected_holes_count, expected_area,
|
||||
settings);
|
||||
|
||||
@@ -492,8 +513,10 @@ void test_with_custom_strategies(std::string const& caseid,
|
||||
bg::read_wkt(wkt, g);
|
||||
bg::correct(g);
|
||||
|
||||
bg::model::multi_polygon<GeometryOut> buffered;
|
||||
|
||||
test_buffer<GeometryOut>
|
||||
(caseid, g,
|
||||
(caseid, buffered, g,
|
||||
join_strategy, end_strategy,
|
||||
distance_strategy, side_strategy, point_strategy,
|
||||
expected_area, settings);
|
||||
|
||||
83
test/algorithms/buffer/test_buffer_geo.hpp
Normal file
83
test/algorithms/buffer/test_buffer_geo.hpp
Normal file
@@ -0,0 +1,83 @@
|
||||
// Boost.Geometry
|
||||
// Unit Test Helper
|
||||
|
||||
// Copyright (c) 2018-2019 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_BUFFER_GEO_HPP
|
||||
#define BOOST_GEOMETRY_TEST_BUFFER_GEO_HPP
|
||||
|
||||
#include "test_buffer.hpp"
|
||||
|
||||
template
|
||||
<
|
||||
typename Geometry,
|
||||
typename GeometryOut,
|
||||
typename JoinStrategy,
|
||||
typename EndStrategy
|
||||
>
|
||||
void test_one_geo(std::string const& caseid,
|
||||
std::string const& wkt,
|
||||
JoinStrategy const& join_strategy, EndStrategy const& end_strategy,
|
||||
int expected_count, int expected_holes_count, double expected_area,
|
||||
double distance_left, ut_settings settings = ut_settings(),
|
||||
double distance_right = same_distance)
|
||||
{
|
||||
Geometry input_geometry;
|
||||
bg::read_wkt(wkt, input_geometry);
|
||||
bg::correct(input_geometry);
|
||||
|
||||
bg::strategy::buffer::side_straight side_strategy;
|
||||
bg::strategy::buffer::distance_asymmetric
|
||||
<
|
||||
typename bg::coordinate_type<Geometry>::type
|
||||
> distance_strategy(distance_left,
|
||||
bg::math::equals(distance_right, same_distance)
|
||||
? distance_left : distance_right);
|
||||
|
||||
// Use the appropriate strategy for geographic points
|
||||
bg::strategy::buffer::geographic_point_circle<> circle_strategy(settings.points_per_circle);
|
||||
|
||||
// Use Thomas strategy to calculate geographic area, because it is
|
||||
// the most precise (unless scale of buffer is only around 1 meter)
|
||||
bg::strategy::area::geographic
|
||||
<
|
||||
bg::strategy::thomas, 5,
|
||||
bg::srs::spheroid<long double>, long double
|
||||
> area_strategy;
|
||||
|
||||
bg::model::multi_polygon<GeometryOut> buffer;
|
||||
|
||||
test_buffer<GeometryOut>
|
||||
(caseid, buffer, input_geometry,
|
||||
join_strategy, end_strategy,
|
||||
distance_strategy, side_strategy, circle_strategy,
|
||||
area_strategy,
|
||||
expected_count, expected_holes_count, expected_area,
|
||||
settings);
|
||||
}
|
||||
|
||||
template
|
||||
<
|
||||
typename Geometry,
|
||||
typename GeometryOut,
|
||||
typename JoinStrategy,
|
||||
typename EndStrategy
|
||||
>
|
||||
void test_one_geo(std::string const& caseid, std::string const& wkt,
|
||||
JoinStrategy const& join_strategy, EndStrategy const& end_strategy,
|
||||
double expected_area,
|
||||
double distance_left, ut_settings const& settings = ut_settings(),
|
||||
double distance_right = same_distance)
|
||||
{
|
||||
test_one_geo<Geometry, GeometryOut>(caseid, wkt, join_strategy, end_strategy,
|
||||
-1 ,-1, expected_area,
|
||||
distance_left, settings, distance_right);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -177,9 +177,7 @@ private :
|
||||
<< "/" << bg::operation_char(it->operations[1].operation);
|
||||
out << " "
|
||||
<< (it->count_on_offsetted > 0 ? "b" : "") // b: offsetted border
|
||||
#if ! defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
|
||||
<< (it->count_within_near_offsetted > 0 ? "n" : "")
|
||||
#endif
|
||||
<< (it->count_within > 0 ? "w" : "")
|
||||
<< (it->count_on_helper > 0 ? "h" : "")
|
||||
<< (it->count_on_multi > 0 ? "m" : "")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test Helper
|
||||
|
||||
// Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2010-2019 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
#include <test_buffer_svg.hpp>
|
||||
#include "test_buffer_svg.hpp"
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
|
||||
template <typename Point>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
|
||||
//
|
||||
// This file was modified by Oracle on 2017.
|
||||
// Modifications copyright (c) 2017 Oracle and/or its affiliates.
|
||||
// This file was modified by Oracle on 2017, 2018.
|
||||
// Modifications copyright (c) 2017-2018 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,
|
||||
@@ -65,7 +65,12 @@ struct ovelaps_box
|
||||
template <typename Box, typename InputItem>
|
||||
static inline bool apply(Box const& box, InputItem const& item)
|
||||
{
|
||||
return ! bg::detail::disjoint::disjoint_box_box(box, item.box);
|
||||
typename bg::strategy::disjoint::services::default_strategy
|
||||
<
|
||||
Box, Box
|
||||
>::type strategy;
|
||||
|
||||
return ! bg::detail::disjoint::disjoint_box_box(box, item.box, strategy);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -58,7 +58,8 @@ ps_distance(std::string const& wkt1,
|
||||
|
||||
template <typename Strategy_pp, typename Strategy_ps>
|
||||
void test_distance_point_segment(Strategy_pp const& strategy_pp,
|
||||
Strategy_ps const& strategy_ps)
|
||||
Strategy_ps const& strategy_ps,
|
||||
bool WGS84)
|
||||
{
|
||||
|
||||
#ifdef BOOST_GEOMETRY_TEST_DEBUG
|
||||
@@ -97,16 +98,19 @@ void test_distance_point_segment(Strategy_pp const& strategy_pp,
|
||||
"SEGMENT(2 0,3 0)",
|
||||
pp_distance("POINT(3 0)", "POINT(3.5 3)", strategy_pp),
|
||||
strategy_ps, true, true);
|
||||
tester::apply("p-s-07",
|
||||
"POINT(15 80)",
|
||||
"SEGMENT(10 15,30 15)",
|
||||
7204174.8264546748,
|
||||
strategy_ps, true, true);
|
||||
tester::apply("p-s-08",
|
||||
"POINT(15 10)",
|
||||
"SEGMENT(10 15,30 15)",
|
||||
571412.71247283253,
|
||||
strategy_ps, true, true);
|
||||
if(WGS84)
|
||||
{
|
||||
tester::apply("p-s-07",
|
||||
"POINT(15 80)",
|
||||
"SEGMENT(10 15,30 15)",
|
||||
7204174.8264546748,
|
||||
strategy_ps, true, true);
|
||||
tester::apply("p-s-08",
|
||||
"POINT(15 10)",
|
||||
"SEGMENT(10 15,30 15)",
|
||||
571412.71247283253,
|
||||
strategy_ps, true, true);
|
||||
}
|
||||
tester::apply("p-s-09",
|
||||
"POINT(5 10)",
|
||||
"SEGMENT(10 15,30 15)",
|
||||
@@ -624,9 +628,10 @@ void test_distance_multipoint_segment(Strategy_pp const& strategy_pp,
|
||||
//===========================================================================
|
||||
|
||||
template <typename Strategy_pp, typename Strategy_ps>
|
||||
void test_all_pl_l(Strategy_pp pp_strategy, Strategy_ps ps_strategy)
|
||||
void test_all_pl_l(Strategy_pp pp_strategy, Strategy_ps ps_strategy,
|
||||
bool WGS84 = true)
|
||||
{
|
||||
test_distance_point_segment(pp_strategy, ps_strategy);
|
||||
test_distance_point_segment(pp_strategy, ps_strategy, WGS84);
|
||||
test_distance_point_linestring(pp_strategy, ps_strategy);
|
||||
test_distance_point_multilinestring(pp_strategy, ps_strategy);
|
||||
test_distance_linestring_multipoint(pp_strategy, ps_strategy);
|
||||
@@ -642,6 +647,10 @@ BOOST_AUTO_TEST_CASE( test_all_pointlike_linear )
|
||||
test_all_pl_l(thomas_pp(), thomas_ps());
|
||||
test_all_pl_l(andoyer_pp(), andoyer_ps());
|
||||
|
||||
// test with different spheroid
|
||||
stype spheroid(6372000, 6370000);
|
||||
test_all_pl_l(andoyer_pp(spheroid), andoyer_ps(spheroid), false);
|
||||
|
||||
test_distance_point_segment_no_thomas(vincenty_pp(), vincenty_ps());
|
||||
//test_distance_point_segment_no_thomas(thomas_pp(), thomas_ps());
|
||||
test_distance_point_segment_no_thomas(andoyer_pp(), andoyer_ps());
|
||||
|
||||
@@ -935,4 +935,9 @@ BOOST_AUTO_TEST_CASE( test_all_areal_areal )
|
||||
test_all_ar_ar<geo_point>(vincenty_pp(), vincenty_ps(), vincenty_bb(), vincenty_sb());
|
||||
test_all_ar_ar<geo_point>(thomas_pp(), thomas_ps(), thomas_bb(), thomas_sb());
|
||||
test_all_ar_ar<geo_point>(andoyer_pp(), andoyer_ps(), andoyer_bb(), andoyer_sb());
|
||||
|
||||
// test with different spheroid
|
||||
stype spheroid(6372000, 6370000);
|
||||
test_all_ar_ar<geo_point>(andoyer_pp(spheroid), andoyer_ps(spheroid),
|
||||
andoyer_bb(spheroid), andoyer_sb(spheroid));
|
||||
}
|
||||
|
||||
@@ -63,11 +63,9 @@ void test_distance_point_ring(Strategy_pp const& strategy_pp,
|
||||
template
|
||||
<
|
||||
typename Point,
|
||||
typename Strategy_pp,
|
||||
typename Strategy_ps
|
||||
>
|
||||
void test_distance_multipoint_ring(Strategy_pp const& strategy_pp,
|
||||
Strategy_ps const& strategy_ps)
|
||||
void test_distance_multipoint_ring(Strategy_ps const& strategy_ps)
|
||||
{
|
||||
|
||||
#ifdef BOOST_GEOMETRY_TEST_DEBUG
|
||||
@@ -649,7 +647,7 @@ void test_all_pl_ar(Strategy_pp pp_strategy,
|
||||
Strategy_pb pb_strategy)
|
||||
{
|
||||
test_distance_point_ring<Point>(pp_strategy, ps_strategy);
|
||||
test_distance_multipoint_ring<Point>(pp_strategy, ps_strategy);
|
||||
test_distance_multipoint_ring<Point>(ps_strategy);
|
||||
|
||||
test_distance_point_polygon<Point>(pp_strategy, ps_strategy);
|
||||
test_distance_multipoint_polygon<Point>(pp_strategy, ps_strategy);
|
||||
@@ -682,4 +680,8 @@ BOOST_AUTO_TEST_CASE( test_all_pointlike_areal )
|
||||
test_all_pl_ar<geo_point>(vincenty_pp(), vincenty_ps(), vincenty_pb());
|
||||
test_all_pl_ar<geo_point>(thomas_pp(), thomas_ps(), thomas_pb());
|
||||
test_all_pl_ar<geo_point>(andoyer_pp(), andoyer_ps(), andoyer_pb());
|
||||
|
||||
// test with different spheroid
|
||||
stype spheroid(6372000, 6370000);
|
||||
test_all_pl_ar<geo_point>(andoyer_pp(spheroid), andoyer_ps(spheroid), andoyer_pb(spheroid));
|
||||
}
|
||||
|
||||
@@ -117,4 +117,6 @@ BOOST_AUTO_TEST_CASE( test_all_pointlike_pointlike )
|
||||
test_all_pl_pl<geo_point>(vincenty_pp());
|
||||
test_all_pl_pl<geo_point>(thomas_pp());
|
||||
test_all_pl_pl<geo_point>(andoyer_pp());
|
||||
|
||||
test_all_pl_pl<geo_point>(andoyer_pp(stype(5000000,6000000)));
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2015-2017, Oracle and/or its affiliates.
|
||||
// Copyright (c) 2015-2018, Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
@@ -65,14 +65,29 @@ struct test_envelope<FormulaPolicy, bg::geographic_tag>
|
||||
static inline void apply(Geometry& geometry,
|
||||
Box& detected)
|
||||
{
|
||||
bg::strategy::envelope::geographic_segment
|
||||
<
|
||||
FormulaPolicy,
|
||||
bg::srs::spheroid<double>,
|
||||
double
|
||||
> envelope_geographic_segment_strategy;
|
||||
typedef bg::strategy::envelope::spherical_point point_strategy_t;
|
||||
typedef bg::strategy::envelope::spherical_multipoint multi_point_strategy_t;
|
||||
typedef bg::strategy::envelope::spherical_box box_strategy_t;
|
||||
typedef bg::strategy::envelope::geographic<FormulaPolicy, bg::srs::spheroid<double>, double> strategy_t;
|
||||
|
||||
bg::envelope(geometry, detected, envelope_geographic_segment_strategy);
|
||||
typename boost::mpl::if_c
|
||||
<
|
||||
boost::is_same<typename bg::tag<Geometry>::type, bg::point_tag>::value,
|
||||
point_strategy_t,
|
||||
typename boost::mpl::if_c
|
||||
<
|
||||
boost::is_same<typename bg::tag<Geometry>::type, bg::multi_point_tag>::value,
|
||||
multi_point_strategy_t,
|
||||
typename boost::mpl::if_c
|
||||
<
|
||||
boost::is_same<typename bg::tag<Geometry>::type, bg::box_tag>::value,
|
||||
box_strategy_t,
|
||||
strategy_t
|
||||
>::type
|
||||
>::type
|
||||
>::type strategy;
|
||||
|
||||
bg::envelope(geometry, detected, strategy);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2014-2015, Oracle and/or its affiliates.
|
||||
// Copyright (c) 2014-2018, Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
@@ -874,6 +874,9 @@ inline void test_open_multipolygons()
|
||||
test::apply("mpg09",
|
||||
"MULTIPOLYGON(((0 0,10 0,10 10,0 10)),((0 0,9 1,9 2)))",
|
||||
false);
|
||||
test::apply("mpg09_2",
|
||||
"MULTIPOLYGON(((0 0,5 1,10 0,10 10,0 10)),((1 1,9 1,9 2)))",
|
||||
false);
|
||||
|
||||
// one polygon inside another and boundaries not touching
|
||||
test::apply("mpg10",
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2015, Oracle and/or its affiliates.
|
||||
// Copyright (c) 2015-2018, Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Licensed under the Boost Software License version 1.0.
|
||||
// http://www.boost.org/users/license.html
|
||||
@@ -851,6 +852,9 @@ void test_open_multipolygons()
|
||||
test::apply("mpg09",
|
||||
"MULTIPOLYGON(((0 0,10 0,10 10,0 10)),((0 0,9 1,9 2)))",
|
||||
bg::failure_intersecting_interiors);
|
||||
test::apply("mpg09_2",
|
||||
"MULTIPOLYGON(((0 0,5 1,10 0,10 10,0 10)),((1 1,9 1,9 2)))",
|
||||
bg::failure_intersecting_interiors);
|
||||
|
||||
// one polygon inside another and boundaries not touching
|
||||
test::apply("mpg10",
|
||||
|
||||
365
test/algorithms/line_interpolate.cpp
Normal file
365
test/algorithms/line_interpolate.cpp
Normal file
@@ -0,0 +1,365 @@
|
||||
// Boost.Geometry
|
||||
// Unit Test
|
||||
|
||||
// Copyright (c) 2018, Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
|
||||
|
||||
// Licensed under the Boost Software License version 1.0.
|
||||
// http://www.boost.org/users/license.html
|
||||
|
||||
|
||||
#include <geometry_test_common.hpp>
|
||||
|
||||
#include <boost/geometry.hpp>
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/line_interpolate.hpp>
|
||||
#include <boost/geometry/algorithms/length.hpp>
|
||||
|
||||
#include <boost/geometry/iterators/segment_iterator.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#include <boost/geometry/io/wkt/wkt.hpp>
|
||||
|
||||
template <typename P, typename Tag = typename bg::tag<P>::type>
|
||||
struct check_points: bg::not_implemented<Tag>
|
||||
{};
|
||||
|
||||
template <typename P>
|
||||
struct check_points<P, bg::point_tag>
|
||||
{
|
||||
static void apply(P const& p0, P const& p1)
|
||||
{
|
||||
double p00 = bg::get<0>(p0);
|
||||
double p10 = bg::get<0>(p1);
|
||||
|
||||
BOOST_CHECK_CLOSE(p00, p10, 0.001);
|
||||
|
||||
double p01 = bg::get<1>(p0);
|
||||
double p11 = bg::get<1>(p1);
|
||||
|
||||
BOOST_CHECK_CLOSE(p01, p11, 0.001);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename P>
|
||||
struct check_points<P, bg::multi_point_tag>
|
||||
{
|
||||
template <typename Range>
|
||||
static void apply(Range const& r0, Range const& r1)
|
||||
{
|
||||
|
||||
typedef typename boost::range_iterator<Range const>::type iterator_t;
|
||||
typedef typename boost::range_value<Range const>::type point_t;
|
||||
|
||||
BOOST_CHECK_EQUAL(boost::size(r0), boost::size(r1));
|
||||
|
||||
for (iterator_t it0 = boost::begin(r0), it1 = boost::begin(r1);
|
||||
it0 < boost::end(r0); it0++, it1++)
|
||||
{
|
||||
check_points<point_t>::apply(*it0, *it1);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
template <typename G, typename P, typename S>
|
||||
inline void test(std::string const& wkt1,
|
||||
double fraction,
|
||||
std::string const& wkt2,
|
||||
S str)
|
||||
{
|
||||
G g;
|
||||
bg::read_wkt(wkt1, g);
|
||||
|
||||
P o;
|
||||
bg::read_wkt(wkt2, o);
|
||||
|
||||
P p1;
|
||||
bg::line_interpolate(g, fraction * bg::length(g), p1, str);
|
||||
check_points<P>::apply(p1, o);
|
||||
|
||||
}
|
||||
|
||||
template <typename G, typename P>
|
||||
inline void test(std::string const& wkt1,
|
||||
double fraction,
|
||||
std::string const& wkt2)
|
||||
{
|
||||
G g;
|
||||
bg::read_wkt(wkt1, g);
|
||||
|
||||
P o;
|
||||
bg::read_wkt(wkt2, o);
|
||||
|
||||
P p1;
|
||||
bg::line_interpolate(g, fraction * bg::length(g), p1);
|
||||
check_points<P>::apply(p1, o);
|
||||
}
|
||||
|
||||
template <typename G, typename P>
|
||||
inline void test_distance(std::string const& wkt1,
|
||||
double distance,
|
||||
std::string const& wkt2)
|
||||
{
|
||||
G g;
|
||||
bg::read_wkt(wkt1, g);
|
||||
|
||||
P o;
|
||||
bg::read_wkt(wkt2, o);
|
||||
|
||||
P p1;
|
||||
bg::line_interpolate(g, distance, p1);
|
||||
check_points<P>::apply(p1, o);
|
||||
}
|
||||
|
||||
template <typename G, typename P, typename S>
|
||||
inline void test_distance(std::string const& wkt1,
|
||||
double distance,
|
||||
std::string const& wkt2,
|
||||
S str)
|
||||
{
|
||||
G g;
|
||||
bg::read_wkt(wkt1, g);
|
||||
|
||||
P o;
|
||||
bg::read_wkt(wkt2, o);
|
||||
|
||||
P p1;
|
||||
bg::line_interpolate(g, distance, p1, str);
|
||||
check_points<P>::apply(p1, o);
|
||||
}
|
||||
|
||||
std::string const s = "SEGMENT(1 1, 2 2)";
|
||||
std::string const l1 = "LINESTRING(1 1, 2 1, 2 2, 1 2, 1 3)";
|
||||
std::string const l2 = "LINESTRING(0 2, 5 2, 5 1, 20 1)";
|
||||
std::string const l00 = "LINESTRING()";
|
||||
std::string const l01 = "LINESTRING(1 1)";
|
||||
std::string const l02 = "LINESTRING(1 1, 1 1)";
|
||||
|
||||
void test_car_edge_cases()
|
||||
{
|
||||
typedef bg::model::point<double, 2, bg::cs::cartesian> P;
|
||||
typedef bg::model::multi_point<P> MP;
|
||||
typedef bg::model::linestring<P> LS;
|
||||
|
||||
//negative input distance
|
||||
test_distance<LS,P>(l1, -1, "POINT(1 1)");
|
||||
test_distance<LS,MP>(l1, -1, "MULTIPOINT((1 1))");
|
||||
|
||||
//input distance longer than total length
|
||||
test_distance<LS,P>(l1, 5, "POINT(1 3)");
|
||||
test_distance<LS,MP>(l1, 5, "MULTIPOINT((1 3))");
|
||||
|
||||
//linestring with only one point
|
||||
test_distance<LS,P>(l01, 1, "POINT(1 1)");
|
||||
test_distance<LS,MP>(l01, 1, "MULTIPOINT((1 1))");
|
||||
|
||||
//linestring with two same points
|
||||
test_distance<LS,P>(l02, 1, "POINT(1 1)");
|
||||
test_distance<LS,MP>(l02, 1, "MULTIPOINT((1 1))");
|
||||
|
||||
//empty linestring
|
||||
try
|
||||
{
|
||||
test_distance<LS,P>(l00, 1, "POINT(1 1)");
|
||||
}
|
||||
catch(bg::empty_input_exception const& )
|
||||
{
|
||||
return;
|
||||
}
|
||||
BOOST_CHECK_MESSAGE(false, "A empty_input_exception should have been thrown" );
|
||||
}
|
||||
|
||||
void test_car()
|
||||
{
|
||||
typedef bg::model::point<double, 2, bg::cs::cartesian> P;
|
||||
typedef bg::model::multi_point<P> MP;
|
||||
typedef bg::model::segment<P> S;
|
||||
typedef bg::model::linestring<P> LS;
|
||||
|
||||
test<S,P>(s, 0, "POINT(1 1)");
|
||||
test<S,P>(s, 0.5, "POINT(1.5 1.5)");
|
||||
test<S,P>(s, 1, "POINT(2 2)");
|
||||
|
||||
test<LS,P>(l1, 0, "POINT(1 1)");
|
||||
test<LS,P>(l1, 0.1, "POINT(1.4 1)");
|
||||
test<LS,P>(l1, 0.2, "POINT(1.8 1)");
|
||||
test<LS,P>(l1, 0.3, "POINT(2 1.2)");
|
||||
test<LS,P>(l1, 0.4, "POINT(2 1.6)");
|
||||
test<LS,P>(l1, 0.5, "POINT(2 2)");
|
||||
test<LS,P>(l1, 0.6, "POINT(1.6 2)");
|
||||
test<LS,P>(l1, 0.7, "POINT(1.2 2)");
|
||||
test<LS,P>(l1, 0.8, "POINT(1 2.2)");
|
||||
test<LS,P>(l1, 0.9, "POINT(1 2.6)");
|
||||
test<LS,P>(l1, 1, "POINT(1 3)");
|
||||
|
||||
test<LS,MP>(l1, 0, "MULTIPOINT((1 1))");
|
||||
//(1 3) missing due to floating point round off errors
|
||||
test<LS,MP>(l1, 0.1, "MULTIPOINT((1.4 1)(1.8 1)(2 1.2)(2 1.6)(2 2)(1.6 2)\
|
||||
(1.2 2)(1 2.2)(1 2.6))");
|
||||
//(1 3) is not missing if you directly pass the distance
|
||||
test_distance<LS,MP>(l1, 0.4, "MULTIPOINT((1.4 1)(1.8 1)(2 1.2)(2 1.6)(2 2)(1.6 2)\
|
||||
(1.2 2)(1 2.2)(1 2.6)(1 3))");
|
||||
test<LS,MP>(l1, 0.2, "MULTIPOINT((1.8 1)(2 1.6)(1.6 2)(1 2.2))");//(1 3) missing
|
||||
test<LS,MP>(l1, 0.4, "MULTIPOINT((2 1.6)(1 2.2))");
|
||||
test<LS,MP>(l1, 0.5, "MULTIPOINT((2 2)(1 3))");
|
||||
test<LS,MP>(l1, 0.6, "MULTIPOINT((1.6 2))");
|
||||
test<LS,MP>(l1, 1, "MULTIPOINT((1 3))");
|
||||
}
|
||||
|
||||
void test_sph()
|
||||
{
|
||||
typedef bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > P;
|
||||
typedef bg::model::multi_point<P> MP;
|
||||
typedef bg::model::segment<P> S;
|
||||
typedef bg::model::linestring<P> LS;
|
||||
|
||||
test<S,P>(s, 0, "POINT(1 1)");
|
||||
test<S,P>(s, 0.5, "POINT(1.4998857365615981 1.5000570914791198)");
|
||||
test<S,P>(s, 1, "POINT(2 2)");
|
||||
|
||||
test<LS,P>(l1, 0, "POINT(1 1)");
|
||||
test<LS,P>(l1, 0.1, "POINT(1.39998476912905323 1.0000365473536286)");
|
||||
test<LS,P>(l1, 0.2, "POINT(1.79996953825810646 1.0000243679448551)");
|
||||
test<LS,P>(l1, 0.3, "POINT(2 1.1999238595669637)");
|
||||
test<LS,P>(l1, 0.4, "POINT(2 1.5998477098527744)");
|
||||
test<LS,P>(l1, 0.5, "POINT(2 1.9997715601390484)");
|
||||
test<LS,P>(l1, 0.6, "POINT(1.6000609543036084 2.0000730473928678)");
|
||||
test<LS,P>(l1, 0.7, "POINT(1.1998933176222553 2.0000486811516014)");
|
||||
test<LS,P>(l1, 0.8, "POINT(1 2.2001522994279883)");
|
||||
test<LS,P>(l1, 0.9, "POINT(1 2.6000761497139444)");
|
||||
test<LS,P>(l1, 1, "POINT(1 3)");
|
||||
|
||||
test<LS,MP>(l1, 0, "MULTIPOINT((1 1))");
|
||||
test<LS,MP>(l1, 0.1, "MULTIPOINT((1.39998476912905323 1.0000365473536286)\
|
||||
(1.79996953825810646 1.0000243679448551)\
|
||||
(2 1.1999238595669637)\
|
||||
(2 1.5998477098527744)\
|
||||
(2 1.9997715601385837)\
|
||||
(1.6000609543036084 2.0000730473928678)\
|
||||
(1.1998933176222553 2.0000486811516014)\
|
||||
(1 2.2001522994279883)\
|
||||
(1 2.6000761497139444)\
|
||||
)");//(1,3)
|
||||
test<LS,MP>(l1, 0.2, "MULTIPOINT((1.79996953825810646 1.0000243679448551)\
|
||||
(2 1.5998477098527744)\
|
||||
(1.6000609543036084 2.0000730473928678)\
|
||||
(1 2.2001522994279883)\
|
||||
)");//(1,3)
|
||||
test<LS,MP>(l1, 0.4, "MULTIPOINT((2 1.5998477098527744)(1 2.2001522994279883))");
|
||||
test<LS,MP>(l1, 0.5, "MULTIPOINT((2 1.9997715601385837)(1 3))");
|
||||
test<LS,MP>(l1, 0.6, "MULTIPOINT((1.6000609543036084 2.0000730473928678))");
|
||||
test<LS,MP>(l1, 1, "MULTIPOINT((1 3))");
|
||||
|
||||
test<LS,MP>(l2, 0.3, "MULTIPOINT((5.3014893312120446 1.0006787676128222)\
|
||||
(11.600850053156366 1.0085030143490989)\
|
||||
(17.9002174825842 1.0041514208039872))");
|
||||
|
||||
}
|
||||
|
||||
template <typename Strategy>
|
||||
void test_sph(Strategy str)
|
||||
{
|
||||
typedef bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > P;
|
||||
typedef bg::model::segment<P> S;
|
||||
|
||||
test_distance<S,P>(s, 0, "POINT(1 1)", str);
|
||||
test_distance<S,P>(s, 0.01, "POINT(1.4051065077123643 1.405268220524982)");
|
||||
test_distance<S,P>(s, 0.01, "POINT(1.0040505023484179 1.0040529633262307)", str);
|
||||
test_distance<S,P>(s, 1, "POINT(1.4051065077123015 1.405268220524919)", str);
|
||||
test_distance<S,P>(s, 1, "POINT(2 2)");
|
||||
test_distance<S,P>(s, 10, "POINT(2 2)");
|
||||
}
|
||||
|
||||
template <typename Strategy>
|
||||
void test_geo(Strategy str)
|
||||
{
|
||||
typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree> > P;
|
||||
typedef bg::model::multi_point<P> MP;
|
||||
typedef bg::model::segment<P> S;
|
||||
typedef bg::model::linestring<P> LS;
|
||||
|
||||
test<S,P>(s, 0, "POINT(1 1)", str);
|
||||
test<S,P>(s, 0.5, "POINT(1.4998780900539985 1.5000558288006378)", str);
|
||||
test<S,P>(s, 1, "POINT(2 2)", str);
|
||||
|
||||
test<LS,P>(l1, 0, "POINT(1 1)", str);
|
||||
test<LS,P>(l1, 0.1, "POINT(1.3986445638301882 1.0000367522730751)", str);
|
||||
test<LS,P>(l1, 0.2, "POINT(1.79728912766037641 1.0000247772611039)", str);
|
||||
test<LS,P>(l1, 0.3, "POINT(2 1.1972285554368427)", str);
|
||||
test<LS,P>(l1, 0.4, "POINT(2 1.598498298996567)", str);
|
||||
test<LS,P>(l1, 0.5, "POINT(2 1.9997664696834965)", str);
|
||||
test<LS,P>(l1, 0.6, "POINT(1.6013936980010324 2.0000734568388099)", str);
|
||||
test<LS,P>(l1, 0.7, "POINT(1.2025664628960846 2.0000494983098767)", str);
|
||||
test<LS,P>(l1, 0.8, "POINT(1 2.1974612279909937)", str);
|
||||
test<LS,P>(l1, 0.9, "POINT(1 2.5987263175375022)", str);
|
||||
test<LS,P>(l1, 1, "POINT(1 3)", str);
|
||||
|
||||
test<LS,MP>(l1, 0, "MULTIPOINT((1 1))", str);
|
||||
|
||||
//adnoyer is missing the last point in the following cases
|
||||
// of linestrings due to inaccuracy
|
||||
if (!boost::is_same<Strategy, bg::strategy::line_interpolate::geographic
|
||||
<bg::strategy::andoyer> >::value)
|
||||
{
|
||||
test<LS,MP>(l1, 0.1, "MULTIPOINT((1.3986445638301882 1.0000367522730751)\
|
||||
(1.79728912766037641 1.0000247772582571)\
|
||||
(2 1.1972285554368427)\
|
||||
(2 1.598498298996567)\
|
||||
(2 1.9997664696834965)\
|
||||
(1.6013936980010324 2.0000734568388099)\
|
||||
(1.2025664628960846 2.0000495003440779)\
|
||||
(1 2.1974612279909937)\
|
||||
(1 2.5987263175375022)\
|
||||
(1 3))", str);
|
||||
|
||||
test<LS,MP>(l1, 0.2, "MULTIPOINT((1.79728912766037641 1.0000247772613331)\
|
||||
(2 1.598498298996567)\
|
||||
(1.6013936980010324 2.0000734568388099)\
|
||||
(1 2.1974612279909937)\
|
||||
(1 3))", str);
|
||||
}
|
||||
test<LS,MP>(l1, 0.4, "MULTIPOINT((2 1.598498298996567)(1 2.1974612279909937))", str);
|
||||
test<LS,MP>(l1, 0.5, "MULTIPOINT((2 1.9997664696834965)(1 3))", str);
|
||||
test<LS,MP>(l1, 0.6, "MULTIPOINT((1.6013936980010324 2.0000734568388099))", str);
|
||||
test<LS,MP>(l1, 1, "MULTIPOINT((1 3))", str);
|
||||
|
||||
test<LS,MP>(l2, 0.3, "MULTIPOINT((5.306157814 1.0006937303)\
|
||||
(11.60351281 1.0085614548123072)\
|
||||
(17.90073492 1.004178475142552))", str);
|
||||
}
|
||||
|
||||
template <typename Strategy>
|
||||
void test_geo_non_standard_spheroid(Strategy str)
|
||||
{
|
||||
typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree> > P;
|
||||
typedef bg::model::segment<P> S;
|
||||
|
||||
test<S,P>(s, 0, "POINT(1 1)", str);
|
||||
test<S,P>(s, 0.5, "POINT(1.5127731436886724 1.5129021873759412)", str);
|
||||
test<S,P>(s, 1, "POINT(2 2)", str);
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_car();
|
||||
test_car_edge_cases();
|
||||
|
||||
test_sph();
|
||||
test_sph(bg::strategy::line_interpolate::spherical<>(100));
|
||||
|
||||
typedef typename bg::srs::spheroid<double> stype;
|
||||
|
||||
test_geo(bg::strategy::line_interpolate::geographic<bg::strategy::andoyer>());
|
||||
test_geo(bg::strategy::line_interpolate::geographic<bg::strategy::thomas>());
|
||||
test_geo(bg::strategy::line_interpolate::geographic<bg::strategy::vincenty>());
|
||||
|
||||
test_geo_non_standard_spheroid(bg::strategy::line_interpolate::geographic
|
||||
<bg::strategy::vincenty>(stype(5000000,6000000)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include <geometry_test_common.hpp>
|
||||
|
||||
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/intersection.hpp>
|
||||
@@ -30,6 +30,32 @@
|
||||
#endif
|
||||
|
||||
|
||||
// For test purposes, returns the point specified in the constructor
|
||||
template <typename Point>
|
||||
struct sub_range_from_points
|
||||
{
|
||||
typedef Point point_type;
|
||||
|
||||
sub_range_from_points(Point const& i, Point const& j, Point const& k)
|
||||
{
|
||||
m_points[0] = i;
|
||||
m_points[1] = j;
|
||||
m_points[2] = k;
|
||||
}
|
||||
|
||||
static inline bool is_first_segment() { return false; }
|
||||
static inline bool is_last_segment() { return false; }
|
||||
|
||||
static inline std::size_t size() { return 3; }
|
||||
|
||||
inline Point const& at(std::size_t index) const
|
||||
{
|
||||
return m_points[index % 3];
|
||||
}
|
||||
|
||||
private :
|
||||
boost::array<Point, 3> m_points;
|
||||
};
|
||||
|
||||
template <typename P, typename T>
|
||||
void test_with_point(std::string const& caseid,
|
||||
@@ -65,13 +91,12 @@ void test_with_point(std::string const& caseid,
|
||||
tp_vector info;
|
||||
strategy_type strategy;
|
||||
rescale_policy_type rescale_policy;
|
||||
sub_range_from_points<P> sub_range_p(pi, pj, pk);
|
||||
sub_range_from_points<P> sub_range_q(qi, qj, qk);
|
||||
bg::detail::overlay::get_turn_info
|
||||
<
|
||||
bg::detail::overlay::assign_null_policy
|
||||
>::apply(pi, pj, pk, qi, qj, qk,
|
||||
false, false, false, false, // dummy parameters
|
||||
model, strategy, rescale_policy, std::back_inserter(info));
|
||||
|
||||
>::apply(sub_range_p, sub_range_q, model, strategy, rescale_policy, std::back_inserter(info));
|
||||
|
||||
if (info.size() == 0)
|
||||
{
|
||||
|
||||
@@ -1323,6 +1323,18 @@ static std::string pie_7_2_1_0_15[2] =
|
||||
"MULTIPOLYGON(((2500 2500,2791 3586,3062 3474,2500 2500)),((2500 2500,3474 3062,3586 2791,3625 2500,3586 2208,3474 1937,3295 1704,3062 1525,2791 1413,2499 1375,2208 1413,1937 1525,1704 1704,1525 1937,1413 2208,1375 2500,2500 2500)))"
|
||||
};
|
||||
|
||||
static std::string case_precision_m1[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((0 0,0 4,2 4,2 3,4 3,4 0,0 0)))",
|
||||
"MULTIPOLYGON(((-1 -1,-1 8,2 8,2 7,2 3,4.0000005 2.9999995,4 7,4 8,8 8,8 -1,-1 -1)))"
|
||||
};
|
||||
|
||||
static std::string case_precision_m2[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((0 0,0 4,2 4,2 3,4 3,4 0,0 0)),((3 6,3 7.5,4.5 7.5,4.5 6,3 6)))",
|
||||
"MULTIPOLYGON(((-1 -1,-1 8,8 8,8 -1,-1 -1),(2 7,2 3,4.0000005 2.9999995,4 7,2 7)))"
|
||||
};
|
||||
|
||||
// Case, not literally on this list but derived, to mix polygon/multipolygon in call to difference
|
||||
static std::string ggl_list_20111025_vd[4] =
|
||||
{
|
||||
@@ -1361,6 +1373,16 @@ static std::string ggl_list_20140212_sybren[2] =
|
||||
"MULTIPOLYGON(((0.4951091661995328 0.6614133543986973,0.495396 0.625263,0.50092 0.6492750000000001,0.494964 0.679709,0.477258 0.698703,0.4951091661995328 0.6614133543986973)),((0.452167 0.706562,0.433379 0.696888,0.442673 0.65792,0.464729 0.671387,0.452167 0.706562)))"
|
||||
};
|
||||
|
||||
static std::string mail_2019_01_21_johan[4] =
|
||||
{
|
||||
// Contains a, b, both a and b (should have been merged), c (clip)
|
||||
"MULTIPOLYGON(((1.2036811113357544 0.7535473108291626,1.1699721813201904 0.7535473108291626,1.1699721813201904 0.7663263082504272,1.2033243179321289 0.7672826647758484,1.2036811113357544 0.7535473108291626)))",
|
||||
"MULTIPOLYGON(((1.2036811113357544 0.7535473108291626,1.2038091421127319 0.7486215233802795,1.1713759899139404 0.7495520114898682,1.1713759899139404 0.7535472512245178,1.2036811113357544 0.7535473108291626)))",
|
||||
"MULTIPOLYGON(((1.2036811113357544 0.7535473108291626,1.1699721813201904 0.7535473108291626,1.1699721813201904 0.7663263082504272,1.2033243179321289 0.7672826647758484,1.2036811113357544 0.7535473108291626)),"
|
||||
"((1.2036811113357544 0.7535473108291626,1.2038091421127319 0.7486215233802795,1.1713759899139404 0.7495520114898682,1.1713759899139404 0.7535472512245178,1.2036811113357544 0.7535473108291626)))",
|
||||
"MULTIPOLYGON(((0 0,2 0,2 2,0 2,0 0)))"
|
||||
};
|
||||
|
||||
static std::string ticket_9081[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((0.5489109414010371 0.5774835110050927,0.4099611282054447 0.4644351568071598,0.4294011278595494 0.4843224236729239,0.4205359995313906 0.5115225580860201,0.4441572412013468 0.5184999851878852,0.5489109414010371 0.5774835110050927)),((0.562085028126843 0.5882018328808966,0.5644349663154944 0.591180348361206,0.568218114394707 0.5970364466647042,0.5838690879677763 0.6212632646137447,0.5873787029417971 0.6412877041753083,0.468699602592386 0.5866280231830688,0.4171010902425981 0.5220616039851281,0.4059124592966251 0.5563907478354578,0.3909547828925878 0.6022841397455458,0.520859401226844 0.9508041627246925,0.8595233008819849 0.8301950132755517,0.562085028126843 0.5882018328808966)))",
|
||||
|
||||
@@ -373,9 +373,6 @@ void test_overlay(std::string const& caseid,
|
||||
<< "_" << string_from_type<typename bg::coordinate_type<Geometry>::type>::name()
|
||||
<< (ccw ? "_ccw" : "")
|
||||
<< (open ? "_open" : "")
|
||||
#if defined(BOOST_GEOMETRY_NO_SELF_TURNS)
|
||||
<< "_no_self"
|
||||
#endif
|
||||
#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
<< "_no_rob"
|
||||
#endif
|
||||
|
||||
@@ -700,6 +700,88 @@ static std::string dz_4[2] = {
|
||||
"POLYGON((20.486696243286133 60.650150299072266,24.282432556152344 49.304500579833984,34.362251281738281 55.748767852783203,30.764263153076172 44.3388671875,42.706855773925781 43.627620697021484,33.089447021484375 36.511661529541016,42.333145141601563 28.916570663452148,30.369846343994141 28.81260871887207,33.383872985839844 17.234743118286133,23.644252777099609 24.182485580444336,19.277351379394531 13.044195175170898,15.48161506652832 24.389842987060547,5.40179443359375 17.945577621459961,8.9997835159301758 29.355476379394531,-2.9428071975708008 30.06672477722168,6.6745977401733398 37.182682037353516,-2.5690991878509521 44.777774810791016,9.394200325012207 44.881736755371094,6.3801741600036621 56.459602355957031,16.119794845581055 49.511859893798828,20.486696243286133 60.650150299072266))"
|
||||
};
|
||||
|
||||
static std::string case_precision_1[2] =
|
||||
{
|
||||
"POLYGON((0 0,0 4,2 4,2 3,4 3,4 0,0 0))",
|
||||
"POLYGON((2 7,4 7,4.000005 2.99999,2 3,2 7))"
|
||||
};
|
||||
|
||||
static std::string case_precision_2[2] =
|
||||
{
|
||||
"POLYGON((0 0,0 4,2 4,2 3,4 3,4 0,0 0))",
|
||||
"POLYGON((2 7,4 7,4 2.999995,2 3,2 7))"
|
||||
};
|
||||
|
||||
static std::string case_precision_3[2] =
|
||||
{
|
||||
"POLYGON((0 0,0 4,2 4,2 3,4 3,4 0,0 0))",
|
||||
"POLYGON((2 7,4 7,4.0000001 2.99999995,2 3,2 7))"
|
||||
};
|
||||
|
||||
static std::string case_precision_4[2] =
|
||||
{
|
||||
"POLYGON((0 0,0 4,2 4,2 3,4 3,4 0,0 0))",
|
||||
"POLYGON((2 7,4 7,4 3.00000001,2 3,2 7))"
|
||||
};
|
||||
|
||||
static std::string case_precision_5[2] =
|
||||
{
|
||||
"POLYGON((0 0,0 4,2 4,2 3,4 3,4 0,0 0))",
|
||||
"POLYGON((2 7,4 7,4 3,2.0000005 2.9999995,2 7))"
|
||||
};
|
||||
|
||||
static std::string case_precision_6[2] =
|
||||
{
|
||||
"POLYGON((0 0,0 4,2 4,2 3,4 3,4 0,0 0))",
|
||||
"POLYGON((-1 -1,-1 8,2 8,2 7,2 3,4.0000005 2.9999995,4 7,4 8,8 8,8 -1,-1 -1))"
|
||||
};
|
||||
|
||||
static std::string case_precision_7[2] =
|
||||
{
|
||||
// Needs larger margin for sectionalize (long double only)
|
||||
"POLYGON((0 0,0 4,2 4,2 3,4 3,4 0,0 0))",
|
||||
"POLYGON((2 7,4 7,4 3.00000002,2 3,2 7))"
|
||||
};
|
||||
|
||||
static std::string case_precision_8[2] =
|
||||
{
|
||||
"POLYGON((0 0,0 4,2 4,2 3,4 3,4 0,0 0))",
|
||||
"POLYGON((-1 -1,-1 8,8 8,8 -1,-1 -1),(2 7,2 3,4.00000006 3.00000009,4 7,2 7))"
|
||||
};
|
||||
|
||||
static std::string case_precision_9[2] =
|
||||
{
|
||||
"POLYGON((0 0,0 4,2 4,2 3,4 3,4 0,0 0))",
|
||||
"POLYGON((-1 -1,-1 8,8 8,8 -1,-1 -1),(2 7,2 3,3.99999 2.999995,4 7,2 7))"
|
||||
};
|
||||
|
||||
static std::string case_precision_10[2] =
|
||||
{
|
||||
// Needs 1.0e-5 for threshold in double
|
||||
"POLYGON((0 0,0 4,2 4,2 3,4 3,4 0,0 0))",
|
||||
"POLYGON((-1 -1,-1 8,8 8,8 -1,-1 -1),(2 7,2 3,4.000006 2.999991,4 7,2 7))"
|
||||
};
|
||||
|
||||
static std::string case_precision_11[2] =
|
||||
{
|
||||
// Needs ~0.5 for threshold in side_by_generic_form
|
||||
"POLYGON((0 0,0 4,2 4,2 3,4 3,4 0,0 0))",
|
||||
"POLYGON((-1 -1,-1 8,8 8,8 -1,-1 -1),(2 7,2 3,4.00000000000000089 2.99999999999999201,4 7,2 7))"
|
||||
};
|
||||
|
||||
static std::string case_precision_12[2] =
|
||||
{
|
||||
// Needs threshold for threshold a2
|
||||
"POLYGON((0 0,0 4,2 4,2 3,4 3,4 0,0 0))",
|
||||
"POLYGON((1 1,2.99999999999999731e-12 1.00000000001,2.99999999999999731e-12 3.00000000001,1 3,1 1))"
|
||||
};
|
||||
|
||||
static std::string case_precision_13[2] =
|
||||
{
|
||||
// Needs threshold for threshold a2
|
||||
"POLYGON((0 0,0 4,2 4,2 3,4 3,4 0,0 0))",
|
||||
"POLYGON((1 1,9.99999999999999912e-06 1,9.99999999999999912e-06 3,1 3,1 1))"
|
||||
};
|
||||
|
||||
// ticket_17 is keyholed, so has a hole formed by an deliberate intersection
|
||||
// This will fail the intersection/traversal process
|
||||
|
||||
@@ -41,14 +41,6 @@
|
||||
( #caseid, caseid[0], caseid[1], clips1, -1, area1, clips2, -1, area2, \
|
||||
clips3, -1, area1 + area2)
|
||||
|
||||
#if defined(BOOST_GEOMETRY_NO_SELF_TURNS)
|
||||
#define TEST_DIFFERENCE_IGNORE(caseid, clips1, area1, clips2, area2, clips3) \
|
||||
{ ut_settings ignore_validity; ignore_validity.test_validity = false; \
|
||||
(test_one<polygon, polygon, polygon>) \
|
||||
( #caseid, caseid[0], caseid[1], clips1, -1, area1, clips2, -1, area2, \
|
||||
clips3, -1, area1 + area2, ignore_validity); }
|
||||
#endif
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
@@ -63,6 +55,11 @@ void test_all()
|
||||
sym_settings.sym_difference = false;
|
||||
#endif
|
||||
|
||||
ut_settings ignore_validity_settings;
|
||||
#ifndef BOOST_GEOMETRY_TEST_INCLUDE_FAILING_TESTS
|
||||
ignore_validity_settings.test_validity = false;
|
||||
#endif
|
||||
|
||||
test_one<polygon, polygon, polygon>("simplex_normal",
|
||||
simplex_normal[0], simplex_normal[1],
|
||||
3, 12, 2.52636706856656,
|
||||
@@ -156,12 +153,14 @@ void test_all()
|
||||
test_one<polygon, polygon, polygon>("intersect_holes_intersect_and_disjoint",
|
||||
intersect_holes_intersect_and_disjoint[0], intersect_holes_intersect_and_disjoint[1],
|
||||
2, 16, 15.75,
|
||||
3, 17, 6.75);
|
||||
3, 17, 6.75,
|
||||
ignore_validity_settings);
|
||||
|
||||
test_one<polygon, polygon, polygon>("intersect_holes_intersect_and_touch",
|
||||
intersect_holes_intersect_and_touch[0], intersect_holes_intersect_and_touch[1],
|
||||
3, 21, 16.25,
|
||||
3, 17, 6.25);
|
||||
3, 17, 6.25,
|
||||
ignore_validity_settings);
|
||||
|
||||
{
|
||||
ut_settings settings = sym_settings;
|
||||
@@ -186,7 +185,8 @@ void test_all()
|
||||
test_one<polygon, polygon, polygon>("intersect_holes_intersect",
|
||||
intersect_holes_intersect[0], intersect_holes_intersect[1],
|
||||
2, 16, 15.75,
|
||||
2, 12, 5.75);
|
||||
2, 12, 5.75,
|
||||
ignore_validity_settings);
|
||||
|
||||
test_one<polygon, polygon, polygon>(
|
||||
"case4", case_4[0], case_4[1],
|
||||
@@ -296,15 +296,17 @@ void test_all()
|
||||
|
||||
// Isovist - the # output polygons differ per compiler/pointtype, (very) small
|
||||
// rings might be discarded. We check area only
|
||||
|
||||
// SQL Server gives: 0.279121891701124 and 224.889211358929
|
||||
// PostGIS gives: 0.279121991127244 and 224.889205853156
|
||||
// No robustness gives: 0.279121991127106 and 224.825363749290
|
||||
|
||||
test_one<polygon, polygon, polygon>("isovist",
|
||||
isovist1[0], isovist1[1],
|
||||
-1, -1, 0.279132,
|
||||
-1, -1, 224.8892,
|
||||
settings);
|
||||
}
|
||||
// SQL Server gives: 0.279121891701124 and 224.889211358929
|
||||
// PostGIS gives: 0.279121991127244 and 224.889205853156
|
||||
// No robustness gives: 0.279121991127106 and 224.825363749290
|
||||
|
||||
#ifdef BOOST_GEOMETRY_TEST_INCLUDE_FAILING_TESTS
|
||||
test_one<polygon, polygon, polygon>("geos_1",
|
||||
@@ -536,32 +538,14 @@ void test_all()
|
||||
5, 27, 1.6701714);
|
||||
***/
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(mysql_21977775,
|
||||
2, 160.856568913, 2, 92.3565689126, 4);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(mysql_21977775,
|
||||
1, 160.856568913, 2, 92.3565689126, 3);
|
||||
#endif
|
||||
|
||||
TEST_DIFFERENCE(mysql_21977775, 2, 160.856568913, 2, 92.3565689126, 4);
|
||||
TEST_DIFFERENCE(mysql_21965285, 1, 92.0, 1, 14.0, 1);
|
||||
|
||||
TEST_DIFFERENCE(mysql_23023665_1, 1, 92.0, 1, 142.5, 2);
|
||||
TEST_DIFFERENCE(mysql_23023665_2, 1, 96.0, 1, 16.0, 2);
|
||||
TEST_DIFFERENCE(mysql_23023665_3, 1, 225.0, 1, 66.0, 2);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(mysql_23023665_5, 2, 165.23735, 2, 105.73735, 4);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(mysql_23023665_5, 1, 165.23735, 2, 105.73735, 3);
|
||||
#endif
|
||||
|
||||
TEST_DIFFERENCE(mysql_23023665_6, 2, 105.68756, 3, 10.18756, 5);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(mysql_23023665_13, 3, 99.74526, 3, 37.74526, 6);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(mysql_23023665_13, 2, 99.74526, 3, 37.74526, 5);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -588,11 +572,7 @@ void test_specific()
|
||||
1, 4, 6731652.0);
|
||||
|
||||
// Generates spikes, both a-b and b-a
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(ticket_11676, 2, 2537992.5, 2, 294963.5, 3);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(ticket_11676, 1, 2537992.5, 2, 294963.5, 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -104,11 +104,7 @@ void test_areal()
|
||||
TEST_DIFFERENCE(case_125_multi, 1, 0.25, 2, 0.400, 3);
|
||||
|
||||
// A should have 3 clips, B should have 5 clips
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_126_multi, 4, 16.0, 5, 27.0, 9);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_126_multi, 3, 16.0, 4, 27.0, 7);
|
||||
#endif
|
||||
|
||||
{
|
||||
ut_settings settings;
|
||||
@@ -155,16 +151,7 @@ void test_areal()
|
||||
ut_settings settings;
|
||||
settings.percentage = 0.001;
|
||||
|
||||
// This testcase is actually different for all combinations
|
||||
#if defined(BOOST_GEOMETRY_NO_SELF_TURNS) || defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
settings.test_validity = false;
|
||||
#endif
|
||||
|
||||
#if ! defined(BOOST_GEOMETRY_NO_SELF_TURNS) || defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
TEST_DIFFERENCE_WITH(0, 1, ggl_list_20120221_volker, 2, 7962.66, 2, 2775258.93, 4);
|
||||
#else
|
||||
TEST_DIFFERENCE_WITH(0, 1, ggl_list_20120221_volker, 2, 7962.66, 1, 2775258.93, 3);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
@@ -175,23 +162,26 @@ void test_areal()
|
||||
TEST_DIFFERENCE_WITH(0, 1, bug_21155501, 1, 3.758937, 1, 1.7763568394002505e-15, 2);
|
||||
}
|
||||
#else
|
||||
// With no-robustness this one misses one of the outputs
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_9081",
|
||||
ticket_9081[0], ticket_9081[1],
|
||||
{
|
||||
// With no-robustness this one misses one of the outputs
|
||||
ut_settings settings;
|
||||
settings.percentage = 0.001; // tolerance
|
||||
#if !defined(BOOST_GEOMETRY_NO_ROBUSTNESS) && !defined(BOOST_GEOMETRY_TEST_INCLUDE_FAILING_TESTS)
|
||||
settings.test_validity = false;
|
||||
#endif
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_9081",
|
||||
ticket_9081[0], ticket_9081[1],
|
||||
2, 28, 0.0907392476356186, 4, 25, 0.126018011439877,
|
||||
4, 42, 0.0907392476356186 + 0.126018011439877,
|
||||
tolerance(0.001));
|
||||
settings);
|
||||
}
|
||||
|
||||
// With rescaling, A is invalid (this is a robustness problem) and the other
|
||||
// output is discarded because of zero (rescaled) area
|
||||
TEST_DIFFERENCE_IGNORE(bug_21155501, 1, 3.758937, 0, 0.0, 1);
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(ticket_12503, 46, 920.625, 4, 7.625, 50);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(ticket_12503, 45, 920.625, 3, 7.625, 48);
|
||||
#endif
|
||||
|
||||
// Areas and #clips correspond with POSTGIS (except sym case)
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_101_multi",
|
||||
@@ -226,11 +216,7 @@ void test_areal()
|
||||
|
||||
// Areas correspond with POSTGIS,
|
||||
// #clips in PostGIS is 11,11,5 but should most probably be be 12,12,6
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_1, 12, 26.0, 12, 24.0, 6);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_1, 11, 26.0, 12, 24.0, 5);
|
||||
#endif
|
||||
|
||||
// Areas and #clips correspond with POSTGIS
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_2",
|
||||
@@ -248,17 +234,8 @@ void test_areal()
|
||||
|
||||
// 4, input is not valid
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_5, 16, 22.0, 12, 27.0, 10);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_5, 15, 22.0, 11, 27.0, 8);
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_6, 7, 3.5, 3, 1.5, 9);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_6, 6, 3.5, 3, 1.5, 8);
|
||||
#endif
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_7",
|
||||
case_recursive_boxes_7[0], case_recursive_boxes_7[1],
|
||||
@@ -294,13 +271,8 @@ void test_areal()
|
||||
TEST_DIFFERENCE(case_recursive_boxes_13, 4, 4.75, 3, 5.5, 3);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_14, 3, 2.0, 4, 2.5, 5);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_15, 3, 3.0, 2, 2.5, 3);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_16, 8, 6.5, 3, 5.5, 9);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_17, 10, 7.75, 7, 5.5, 13);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_16, 7, 6.5, 3, 5.5, 8);
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_17, 9, 7.75, 6, 5.5, 11);
|
||||
#endif
|
||||
TEST_DIFFERENCE(case_recursive_boxes_18, 2, 1.0, 1, 1.5, 3);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_19, 2, 1.0, 2, 1.5, 3);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_20, 2, 1.0, 0, 0.0, 2);
|
||||
@@ -319,11 +291,7 @@ void test_areal()
|
||||
TEST_DIFFERENCE(case_recursive_boxes_31, 2, 2.0, 1, 0.5, 2);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_32, 2, 2.75, 2, 1.25, 2);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_33, 4, 3.0, 3, 6.0, 4);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_34, 7, 7.25, 1, 0.5, 8);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_34, 5, 7.25, 1, 0.5, 6);
|
||||
#endif
|
||||
TEST_DIFFERENCE(case_recursive_boxes_35, 5, 1.75, 5, 2.75, 10);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_36, 2, 1.0, 2, 1.5, 3);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_37, 3, 2.5, 2, 4.25, 2);
|
||||
@@ -332,104 +300,48 @@ void test_areal()
|
||||
TEST_DIFFERENCE(case_recursive_boxes_40, 11, 14.0, 9, 13.0, 11);
|
||||
|
||||
TEST_DIFFERENCE(case_recursive_boxes_41, 1, 0.5, 1, 0.5, 2);
|
||||
#ifdef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
// 42.a Fails with self-turns
|
||||
TEST_DIFFERENCE(case_recursive_boxes_42, 1, 1.0, 4, 4.0, 5);
|
||||
#endif
|
||||
TEST_DIFFERENCE(case_recursive_boxes_43, 1, 0.5, 3, 2.0, 4);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_44, 3, 5.0, 0, 0.0, 3);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_45, 6, 20.0, 7, 20.0, 3);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_46, 4, 14.0, 5, 12.0, 5);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_47, 4, 10.0, 7, 11.0, 1);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_48, 0, 0.0, 1, 9.0, 1);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_49, 10, 22.0, 10, 17.0, 11);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_49, 9, 22.0, 10, 17.0, 10);
|
||||
#endif
|
||||
TEST_DIFFERENCE(case_recursive_boxes_50, 14, 21.0, 16, 21.0, 14);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_51, 14, 25.0, 12, 31.0, 7);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_52, 13, 30.0, 15, 25.0, 8);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_52, 13, 30.0, 15, 25.0, 8);
|
||||
#endif
|
||||
TEST_DIFFERENCE(case_recursive_boxes_53, 6, 3.5, 4, 1.5, 9);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_54, 6, 6.5, 8, 6.0, 7);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_55, 4, 5.5, 6, 7.75, 4);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_56, 4, 4.5, 5, 2.75, 6);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_56, 4, 4.5, 5, 2.75, 6);
|
||||
#endif
|
||||
TEST_DIFFERENCE(case_recursive_boxes_57, 5, 3.75, 9, 6.5, 10);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_58, 4, 2.25, 6, 3.75, 7);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_59, 8, 6.5, 7, 7.0, 12);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_59, 8, 6.5, 6, 7.0, 11);
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_60, 6, 5.25, 7, 5.25, 11);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_60, 5, 5.25, 5, 5.25, 8);
|
||||
#endif
|
||||
TEST_DIFFERENCE(case_recursive_boxes_61, 2, 1.5, 6, 2.0, 7);
|
||||
#if defined(BOOST_GEOMETRY_TEST_INCLUDE_FAILING_TESTS)
|
||||
// Misses one triangle
|
||||
TEST_DIFFERENCE(case_recursive_boxes_62, 5, 5.0, 11, 5.75, 12);
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_63, 9, 10.5, 5, 27.75, 4);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_63, 6, 10.5, 5, 27.75, 2);
|
||||
#endif
|
||||
|
||||
TEST_DIFFERENCE(case_recursive_boxes_64, 6, 2.75, 7, 4.5, 11);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_65, 6, 4.25, 7, 3.0, 13);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_65, 4, 4.25, 7, 3.0, 11);
|
||||
#endif
|
||||
|
||||
TEST_DIFFERENCE(case_recursive_boxes_66, 5, 4.75, 7, 4.0, 9);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_67, 7, 6.25, 9, 6.0, 10);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_68, 10, 6.5, 9, 6.5, 7);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_69, 5, 6.25, 5, 6.75, 8);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_70, 5, 2.0, 8, 4.5, 11);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_70, 5, 2.0, 6, 4.5, 9);
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_71, 7, 8.25, 7, 5.75, 8);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_71, 6, 8.25, 7, 5.75, 7);
|
||||
#endif
|
||||
|
||||
TEST_DIFFERENCE(case_recursive_boxes_72, 6, 6.5, 7, 4.0, 10);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_73, 4, 1.75, 5, 4.0, 8);
|
||||
|
||||
TEST_DIFFERENCE(case_recursive_boxes_74, 3, 3.00, 3, 1.5, 5);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_75, 7, 4.5, 4, 2.0, 11);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_75, 5, 4.5, 4, 2.0, 9);
|
||||
#endif
|
||||
|
||||
TEST_DIFFERENCE(case_recursive_boxes_76, 7, 3.75, 4, 2.5, 9);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_77, 4, 3.75, 7, 6.25, 8);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_78, 11, 5.5, 8, 4.5, 14);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_79, 2, 1.25, 6, 4.5, 8);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_79, 2, 1.25, 5, 4.5, 7);
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
TEST_DIFFERENCE(case_recursive_boxes_80, 1, 0.5, 2, 0.75, 2);
|
||||
@@ -440,12 +352,7 @@ void test_areal()
|
||||
#endif
|
||||
|
||||
TEST_DIFFERENCE(case_recursive_boxes_81, 3, 5.0, 6, 6.75, 6);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE(case_recursive_boxes_82, 5, 7.25, 7, 4.5, 8);
|
||||
#else
|
||||
TEST_DIFFERENCE_IGNORE(case_recursive_boxes_82, 5, 7.25, 6, 4.5, 7);
|
||||
#endif
|
||||
TEST_DIFFERENCE(case_recursive_boxes_83, 9, 5.25, 8, 5.25, 12);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_84, 4, 8.0, 7, 9.0, 4);
|
||||
#ifdef BOOST_GEOMETRY_NO_ROBUSTNESS
|
||||
@@ -456,6 +363,11 @@ void test_areal()
|
||||
TEST_DIFFERENCE(case_recursive_boxes_87, 4, 2.0, 4, 2.5, 8);
|
||||
TEST_DIFFERENCE(case_recursive_boxes_88, 3, 4.75, 5, 6.75, 4);
|
||||
|
||||
// Output of A can be 0 or 1 polygons (with a very small area)
|
||||
TEST_DIFFERENCE(case_precision_m1, -1, 0.0, 1, 57.0, -1);
|
||||
// Output of A can be 1 or 2 polygons (one with a very small area)
|
||||
TEST_DIFFERENCE(case_precision_m2, -1, 1.0, 1, 57.75, -1);
|
||||
|
||||
{
|
||||
ut_settings sym_settings;
|
||||
#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
@@ -509,25 +421,9 @@ void test_specific_areal()
|
||||
|
||||
ut_settings settings;
|
||||
settings.remove_spikes = true;
|
||||
#if defined(BOOST_GEOMETRY_NO_SELF_TURNS)
|
||||
settings.sym_difference = false;
|
||||
settings.test_validity = false;
|
||||
#endif
|
||||
|
||||
std::string a_min_b =
|
||||
TEST_DIFFERENCE_WITH(0, 1, ticket_12751, 1, 2781965.0, 1, 597.0, 2);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE_WITH(0, 1, ticket_12751, 1, 2781965.0, 1, 597.0, 2);
|
||||
TEST_DIFFERENCE_WITH(2, 3, ticket_12751, 2, 2537992.5, 2, 294963.5, 3);
|
||||
#else
|
||||
|
||||
// Testing consistency of testcase itself
|
||||
boost::ignore_unused(a_min_b);
|
||||
// BOOST_CHECK_EQUAL(a_min_b, ticket_12751[2]);
|
||||
|
||||
TEST_DIFFERENCE_WITH(2, 3, ticket_12751, 1, 2537992.5, 2, 294963.5, 3);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
@@ -536,13 +432,7 @@ void test_specific_areal()
|
||||
ut_settings settings;
|
||||
settings.remove_spikes = true;
|
||||
settings.sym_difference = false;
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_DIFFERENCE_WITH(0, 1, ticket_12752, 3, 2776692.0, 3, 7893.0, 2);
|
||||
#else
|
||||
// If self-intersections are not tested, result is not valid
|
||||
settings.test_validity = false;
|
||||
TEST_DIFFERENCE_WITH(0, 1, ticket_12752, 3, 2776692.0, 3, 7893.0, 6);
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
@@ -559,12 +449,7 @@ void test_specific_areal()
|
||||
{
|
||||
ut_settings settings;
|
||||
settings.sym_difference = false;
|
||||
#ifdef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
settings.test_validity = false;
|
||||
TEST_DIFFERENCE_WITH(0, 1, ticket_9942, 3, 7427491.5, 4, 131506, 4);
|
||||
#else
|
||||
TEST_DIFFERENCE_WITH(0, 1, ticket_9942, 4, 7427727.5, 4, 131506, 4);
|
||||
#endif
|
||||
TEST_DIFFERENCE_WITH(0, 1, ticket_9942a, 2, 412676.5, 2, 76779.5, 4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,9 +105,6 @@ void difference_output(std::string const& caseid, G1 const& g1, G2 const& g2, Ou
|
||||
<< string_from_type<coordinate_type>::name()
|
||||
<< (ccw ? "_ccw" : "")
|
||||
<< (open ? "_open" : "")
|
||||
#if defined(BOOST_GEOMETRY_NO_SELF_TURNS)
|
||||
<< "_no_self"
|
||||
#endif
|
||||
#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
<< "_no_rob"
|
||||
#endif
|
||||
@@ -273,7 +270,15 @@ std::string test_difference(std::string const& caseid, G1 const& g1, G2 const& g
|
||||
);
|
||||
}
|
||||
|
||||
BOOST_CHECK_CLOSE(area, expected_area, settings.percentage);
|
||||
if (expected_area > 0)
|
||||
{
|
||||
BOOST_CHECK_CLOSE(area, expected_area, settings.percentage);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Compare 0 with 0 or a very small detected area
|
||||
BOOST_CHECK_LE(area, settings.percentage);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -46,12 +46,15 @@ BOOST_GEOMETRY_REGISTER_LINESTRING_TEMPLATED(std::vector)
|
||||
(test_one<Polygon, Polygon, Polygon>) \
|
||||
( #caseid, caseid[0], caseid[1], clips, points, area)
|
||||
|
||||
#if defined(BOOST_GEOMETRY_NO_SELF_TURNS)
|
||||
#define TEST_INTERSECTION_IGNORE(caseid, clips, points, area) \
|
||||
{ ut_settings ignore_validity; ignore_validity.test_validity = false; \
|
||||
(test_one<Polygon, Polygon, Polygon>) \
|
||||
( #caseid, caseid[0], caseid[1], clips, points, area, ignore_validity); }
|
||||
#endif
|
||||
#define TEST_INTERSECTION_REV(caseid, clips, points, area) \
|
||||
(test_one<Polygon, Polygon, Polygon>) \
|
||||
( #caseid "_rev", caseid[1], caseid[0], clips, points, area)
|
||||
|
||||
#define TEST_INTERSECTION_WITH(caseid, index1, index2, \
|
||||
clips, points, area, settings) \
|
||||
(test_one<Polygon, Polygon, Polygon>) \
|
||||
( #caseid #index1 "_" #index2, caseid[index1], caseid[index2], \
|
||||
clips, points, area, settings)
|
||||
|
||||
template <typename Polygon>
|
||||
void test_areal()
|
||||
@@ -197,8 +200,7 @@ void test_areal()
|
||||
// In most cases: 0 (no intersection)
|
||||
// In some cases: 1.430511474609375e-05 (clang/gcc on Xubuntu using b2)
|
||||
// In some cases: 5.6022983000000002e-05 (powerpc64le-gcc-6-0)
|
||||
test_one<Polygon, Polygon, Polygon>("geos_2",
|
||||
geos_2[0], geos_2[1],
|
||||
test_one<Polygon, Polygon, Polygon>("geos_2", geos_2[0], geos_2[1],
|
||||
0, 0, 6.0e-5, ut_settings(-1.0)); // -1 denotes: compare with <=
|
||||
|
||||
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
@@ -276,12 +278,12 @@ void test_areal()
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_8652", ticket_8652[0], ticket_8652[1],
|
||||
1, 4, 0.0003);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_8310a", ticket_8310a[0], ticket_8310a[1],
|
||||
1, 5, 0.3843747);
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_8310b", ticket_8310b[0], ticket_8310b[1],
|
||||
1, 5, 0.3734379);
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_8310c", ticket_8310c[0], ticket_8310c[1],
|
||||
1, 5, 0.4689541);
|
||||
TEST_INTERSECTION(ticket_8310a, 1, 5, 0.3843747);
|
||||
TEST_INTERSECTION(ticket_8310b, 1, 5, 0.3734379);
|
||||
TEST_INTERSECTION(ticket_8310c, 1, 5, 0.4689541);
|
||||
TEST_INTERSECTION_REV(ticket_8310a, 1, 5, 0.3843747);
|
||||
TEST_INTERSECTION_REV(ticket_8310b, 1, 5, 0.3734379);
|
||||
TEST_INTERSECTION_REV(ticket_8310c, 1, 5, 0.4689541);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_9081_15",
|
||||
ticket_9081_15[0], ticket_9081_15[1],
|
||||
@@ -296,7 +298,7 @@ void test_areal()
|
||||
// mingw 5.6022954e-5
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_10108_b",
|
||||
ticket_10108_b[0], ticket_10108_b[1],
|
||||
0, 0, 5.6022983e-5);
|
||||
0, 0, 5.6022983e-5, ut_settings(-1.0));
|
||||
#endif
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_10747_a",
|
||||
@@ -355,14 +357,39 @@ void test_areal()
|
||||
|
||||
TEST_INTERSECTION(case_105, 1, 34, 76.0);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_INTERSECTION(case_precision_1, 0, 0, 0.0);
|
||||
TEST_INTERSECTION(case_precision_2, 0, 0, 0.0);
|
||||
TEST_INTERSECTION(case_precision_3, 0, 0, 0.0);
|
||||
TEST_INTERSECTION(case_precision_4, 0, 0, 0.0);
|
||||
TEST_INTERSECTION(case_precision_5, 0, 0, 0.0);
|
||||
TEST_INTERSECTION(case_precision_6, 1, -1, 14.0);
|
||||
TEST_INTERSECTION(case_precision_7, 0, -1, 0.0);
|
||||
TEST_INTERSECTION(case_precision_8, 1, -1, 14.0);
|
||||
TEST_INTERSECTION(case_precision_9, 1, -1, 14.0);
|
||||
TEST_INTERSECTION(case_precision_10, 1, -1, 14.0);
|
||||
TEST_INTERSECTION(case_precision_11, 1, -1, 14.0);
|
||||
|
||||
TEST_INTERSECTION_REV(case_precision_1, 0, 0, 0.0);
|
||||
TEST_INTERSECTION_REV(case_precision_2, 0, 0, 0.0);
|
||||
TEST_INTERSECTION_REV(case_precision_3, 0, 0, 0.0);
|
||||
TEST_INTERSECTION_REV(case_precision_4, 0, 0, 0.0);
|
||||
TEST_INTERSECTION_REV(case_precision_5, 0, 0, 0.0);
|
||||
TEST_INTERSECTION_REV(case_precision_6, 1, -1, 14.0);
|
||||
TEST_INTERSECTION_REV(case_precision_7, 0, -1, 0.0);
|
||||
TEST_INTERSECTION_REV(case_precision_8, 1, -1, 14.0);
|
||||
TEST_INTERSECTION_REV(case_precision_9, 1, -1, 14.0);
|
||||
TEST_INTERSECTION_REV(case_precision_10, 1, -1, 14.0);
|
||||
TEST_INTERSECTION_REV(case_precision_11, 1, -1, 14.0);
|
||||
{
|
||||
ut_settings settings(0.01);
|
||||
TEST_INTERSECTION_WITH(case_precision_12, 0, 1, 1, -1, 2.0, settings);
|
||||
TEST_INTERSECTION_WITH(case_precision_13, 0, 1, 1, -1, 2.0, settings);
|
||||
TEST_INTERSECTION_WITH(case_precision_12, 1, 0, 1, -1, 2.0, settings);
|
||||
TEST_INTERSECTION_WITH(case_precision_13, 1, 0, 1, -1, 2.0, settings);
|
||||
}
|
||||
|
||||
TEST_INTERSECTION(case_106, 2, -1, 3.5);
|
||||
TEST_INTERSECTION(case_107, 3, -1, 3.0);
|
||||
#else
|
||||
TEST_INTERSECTION_IGNORE(case_106, 0, -1, 3.5);
|
||||
TEST_INTERSECTION_IGNORE(case_107, 0, -1, 3.0);
|
||||
#endif
|
||||
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("mysql_21964049",
|
||||
mysql_21964049[0], mysql_21964049[1],
|
||||
@@ -377,12 +404,7 @@ void test_areal()
|
||||
mysql_21965285_b_inv[1],
|
||||
2, -1, 183.71376870369406);
|
||||
|
||||
// Needs self-intersections to solve validity
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_INTERSECTION(mysql_23023665_6, 2, 0, 11.812440191387557);
|
||||
#else
|
||||
TEST_INTERSECTION_IGNORE(mysql_23023665_6, 1, -1, 11.812440191387557);
|
||||
#endif
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("mysql_23023665_10",
|
||||
mysql_23023665_10[0], mysql_23023665_10[1],
|
||||
@@ -890,7 +912,6 @@ int test_main(int, char* [])
|
||||
test_all<bg::model::d2::point_xy<ttmath_big> >();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// Commented, because exception is now disabled:
|
||||
// test_exception<bg::model::d2::point_xy<double> >();
|
||||
@@ -918,6 +939,7 @@ int test_main(int, char* [])
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
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
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -32,6 +32,10 @@
|
||||
(test_one<Polygon, MultiPolygon, MultiPolygon>) \
|
||||
( #caseid, caseid[0], caseid[1], clips, points, area)
|
||||
|
||||
#define TEST_INTERSECTION_REV(caseid, clips, points, area) \
|
||||
(test_one<Polygon, MultiPolygon, MultiPolygon>) \
|
||||
( #caseid "_rev", caseid[1], caseid[0], clips, points, area)
|
||||
|
||||
#define TEST_INTERSECTION_IGNORE(caseid, clips, points, area) \
|
||||
{ ut_settings ignore_validity; ignore_validity.test_validity = false; \
|
||||
(test_one<Polygon, MultiPolygon, MultiPolygon>) \
|
||||
@@ -146,11 +150,7 @@ void test_areal()
|
||||
TEST_INTERSECTION(case_123_multi, 3, 13, 1.875);
|
||||
TEST_INTERSECTION(case_124_multi, 2, 13, 2.0625);
|
||||
TEST_INTERSECTION(case_125_multi, 3, 17, 2.1);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_INTERSECTION(case_126_multi, 5, 27, 9.0);
|
||||
#else
|
||||
TEST_INTERSECTION_IGNORE(case_126_multi, 3, 23, 9.0);
|
||||
#endif
|
||||
TEST_INTERSECTION(case_127_multi, 3, 19, 24.0);
|
||||
TEST_INTERSECTION(case_128_multi, 2, 26, 75.5);
|
||||
TEST_INTERSECTION(case_129_multi, 1, 20, 20.5);
|
||||
@@ -167,11 +167,7 @@ void test_areal()
|
||||
TEST_INTERSECTION(case_140_multi, 2, 23, 40.546875);
|
||||
TEST_INTERSECTION(case_141_multi, 3, -1, 74.5);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_INTERSECTION(case_recursive_boxes_1, 10, 89, 47.0);
|
||||
#else
|
||||
TEST_INTERSECTION_IGNORE(case_recursive_boxes_1, 8, 97, 47.0);
|
||||
#endif
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_2",
|
||||
case_recursive_boxes_2[0], case_recursive_boxes_2[1],
|
||||
@@ -180,11 +176,7 @@ void test_areal()
|
||||
case_recursive_boxes_3[0], case_recursive_boxes_3[1],
|
||||
19, 84, 12.5); // Area from SQL Server
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_INTERSECTION_IGNORE(case_recursive_boxes_4, 13, 158, 67.0);
|
||||
#else
|
||||
TEST_INTERSECTION_IGNORE(case_recursive_boxes_4, 8, 178, 67.0);
|
||||
#endif
|
||||
|
||||
// Fixed by replacing handle_tangencies in less_by_segment_ratio sort order
|
||||
// Should contain 6 output polygons
|
||||
@@ -312,40 +304,18 @@ void test_areal()
|
||||
TEST_INTERSECTION(case_recursive_boxes_60, 8, -1, 10.0);
|
||||
TEST_INTERSECTION(case_recursive_boxes_61, 2, -1, 20.0);
|
||||
TEST_INTERSECTION(case_recursive_boxes_62, 9, -1, 10.5);
|
||||
|
||||
TEST_INTERSECTION(case_recursive_boxes_63, 11, -1, 5.75);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_INTERSECTION(case_recursive_boxes_64, 5, -1, 17.25);
|
||||
#else
|
||||
TEST_INTERSECTION_IGNORE(case_recursive_boxes_64, 4, -1, 17.25);
|
||||
#endif
|
||||
TEST_INTERSECTION(case_recursive_boxes_65, 3, -1, 17.25);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_INTERSECTION(case_recursive_boxes_66, 4, -1, 16.0);
|
||||
#else
|
||||
TEST_INTERSECTION_IGNORE(case_recursive_boxes_66, 2, -1, 16.0);
|
||||
#endif
|
||||
|
||||
TEST_INTERSECTION(case_recursive_boxes_67, 5, -1, 2.5);
|
||||
TEST_INTERSECTION(case_recursive_boxes_68, 8, -1, 9.5);
|
||||
TEST_INTERSECTION(case_recursive_boxes_69, 6, -1, 3.25);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_INTERSECTION(case_recursive_boxes_70, 6, -1, 18.5);
|
||||
#else
|
||||
// Misses a necessary self-turn and therefore a ring
|
||||
TEST_INTERSECTION_IGNORE(case_recursive_boxes_70, 3, -1, 18.0);
|
||||
#endif
|
||||
|
||||
TEST_INTERSECTION(case_recursive_boxes_71, 3, -1, 1.75);
|
||||
TEST_INTERSECTION(case_recursive_boxes_72, 8, -1, 4.5);
|
||||
TEST_INTERSECTION(case_recursive_boxes_73, 3, -1, 18.5);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_INTERSECTION(case_recursive_boxes_74, 3, -1, 20.25);
|
||||
#else
|
||||
TEST_INTERSECTION_IGNORE(case_recursive_boxes_74, 2, -1, 20.25);
|
||||
#endif
|
||||
|
||||
TEST_INTERSECTION(case_recursive_boxes_75, 5, -1, 16.75);
|
||||
TEST_INTERSECTION(case_recursive_boxes_76, 2, -1, 18.25);
|
||||
TEST_INTERSECTION(case_recursive_boxes_77, 5, -1, 3.5);
|
||||
@@ -353,12 +323,7 @@ void test_areal()
|
||||
TEST_INTERSECTION(case_recursive_boxes_79, 5, -1, 9.0);
|
||||
TEST_INTERSECTION(case_recursive_boxes_80, 1, -1, 0.25);
|
||||
TEST_INTERSECTION(case_recursive_boxes_81, 5, -1, 3.75);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_INTERSECTION(case_recursive_boxes_82, 5, -1, 8.5);
|
||||
#else
|
||||
TEST_INTERSECTION_IGNORE(case_recursive_boxes_82, 3, -1, 8.5);
|
||||
#endif
|
||||
|
||||
TEST_INTERSECTION(case_recursive_boxes_83, 5, -1, 10.25);
|
||||
TEST_INTERSECTION(case_recursive_boxes_84, 1, -1, 0.5);
|
||||
#ifdef BOOST_GEOMETRY_NO_ROBUSTNESS
|
||||
@@ -368,6 +333,17 @@ void test_areal()
|
||||
TEST_INTERSECTION(case_recursive_boxes_87, 0, -1, 0.0);
|
||||
TEST_INTERSECTION(case_recursive_boxes_88, 4, -1, 3.5);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_ROBUSTNESS
|
||||
TEST_INTERSECTION(case_precision_m1, 1, -1, 14.0);
|
||||
TEST_INTERSECTION(case_precision_m2, 2, -1, 15.25);
|
||||
TEST_INTERSECTION_REV(case_precision_m1, 1, -1, 14.0);
|
||||
TEST_INTERSECTION_REV(case_precision_m2, 2, -1, 15.25);
|
||||
#else
|
||||
// Validity: false positives (very small triangles looking like a line)
|
||||
TEST_INTERSECTION_IGNORE(case_precision_m1, 1, -1, 14.0);
|
||||
TEST_INTERSECTION_IGNORE(case_precision_m2, 2, -1, 15.25);
|
||||
#endif
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_a",
|
||||
ggl_list_20120915_h2[0], ggl_list_20120915_h2[1],
|
||||
2, 10, 6.0); // Area from SQL Server
|
||||
@@ -379,6 +355,11 @@ void test_areal()
|
||||
ticket_9081[0], ticket_9081[1],
|
||||
2, 10, 0.0019812556);
|
||||
|
||||
// Should generate output, even for <float>
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("mail_2019_01_21_johan",
|
||||
mail_2019_01_21_johan[2], mail_2019_01_21_johan[3],
|
||||
2, -1, 0.0005889587);
|
||||
|
||||
// qcc-arm reports 1.7791215549400884e-14
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_11018",
|
||||
ticket_11018[0], ticket_11018[1],
|
||||
@@ -397,12 +378,7 @@ void test_areal()
|
||||
mysql_23023665_7[0], mysql_23023665_7[1],
|
||||
2, 11, 9.80505786783);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_INTERSECTION(mysql_23023665_12, 2, 0, 11.812440191387557);
|
||||
#else
|
||||
TEST_INTERSECTION_IGNORE(mysql_23023665_12, 1, -1, 11.812440191387557);
|
||||
#endif
|
||||
|
||||
TEST_INTERSECTION(mysql_regression_1_65_2017_08_31, 2, -1, 29.9022122);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,15 @@ check_result(
|
||||
double const detected_length_or_area = boost::numeric_cast<double>(length_or_area);
|
||||
if (settings.percentage > 0.0)
|
||||
{
|
||||
BOOST_CHECK_CLOSE(detected_length_or_area, expected_length_or_area, settings.percentage);
|
||||
if (expected_length_or_area > 0)
|
||||
{
|
||||
BOOST_CHECK_CLOSE(detected_length_or_area, expected_length_or_area, settings.percentage);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Compare 0 with 0 or a very small detected area
|
||||
BOOST_CHECK_LE(detected_length_or_area, settings.percentage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -248,9 +256,6 @@ typename bg::default_area_result<G1>::type test_intersection(std::string const&
|
||||
<< string_from_type<CalculationType>::name()
|
||||
<< (ccw ? "_ccw" : "")
|
||||
<< (open ? "_open" : "")
|
||||
#if defined(BOOST_GEOMETRY_NO_SELF_TURNS)
|
||||
<< "_no_self"
|
||||
#endif
|
||||
#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
<< "_no_rob"
|
||||
#endif
|
||||
|
||||
@@ -223,9 +223,6 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2,
|
||||
<< string_from_type<coordinate_type>::name()
|
||||
<< (ccw ? "_ccw" : "")
|
||||
<< (open ? "_open" : "")
|
||||
#if defined(BOOST_GEOMETRY_NO_SELF_TURNS)
|
||||
<< "_no_self"
|
||||
#endif
|
||||
#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
<< "_no_rob"
|
||||
#endif
|
||||
|
||||
@@ -26,6 +26,14 @@
|
||||
#include <boost/geometry/geometries/point_xy.hpp>
|
||||
|
||||
|
||||
#define TEST_UNION(caseid, clips, holes, points, area) \
|
||||
(test_one<Polygon, Polygon, Polygon>) \
|
||||
( #caseid, caseid[0], caseid[1], clips, holes, points, area)
|
||||
|
||||
#define TEST_UNION_REV(caseid, clips, holes, points, area) \
|
||||
(test_one<Polygon, Polygon, Polygon>) \
|
||||
( #caseid "_rev", caseid[1], caseid[0], clips, holes, points, area)
|
||||
|
||||
|
||||
template <typename Ring, typename Polygon>
|
||||
void test_areal()
|
||||
@@ -247,6 +255,34 @@ void test_areal()
|
||||
test_one<Polygon, Polygon, Polygon>("108",
|
||||
case_108[0], case_108[1], 1, 0, 13, 5.0);
|
||||
|
||||
TEST_UNION(case_precision_1, 1, 0, -1, 22.0);
|
||||
TEST_UNION(case_precision_2, 1, 0, -1, 22.0);
|
||||
TEST_UNION(case_precision_3, 1, 0, -1, 22.0);
|
||||
TEST_UNION(case_precision_4, 1, 0, -1, 22.0);
|
||||
TEST_UNION(case_precision_5, 1, 0, -1, 22.0);
|
||||
TEST_UNION(case_precision_6, 1, 0, -1, 71.0);
|
||||
TEST_UNION(case_precision_7, 1, 0, -1, 22.0);
|
||||
TEST_UNION(case_precision_8, 1, 1, -1, 73.0);
|
||||
TEST_UNION(case_precision_9, 1, 1, -1, 73.0);
|
||||
TEST_UNION(case_precision_10, 1, 1, -1, 73.0);
|
||||
TEST_UNION(case_precision_11, 1, 1, -1, 73.0);
|
||||
TEST_UNION(case_precision_12, 1, 0, -1, 14.0);
|
||||
TEST_UNION(case_precision_13, 1, 0, -1, 14.0);
|
||||
|
||||
TEST_UNION_REV(case_precision_1, 1, 0, -1, 22.0);
|
||||
TEST_UNION_REV(case_precision_2, 1, 0, -1, 22.0);
|
||||
TEST_UNION_REV(case_precision_3, 1, 0, -1, 22.0);
|
||||
TEST_UNION_REV(case_precision_4, 1, 0, -1, 22.0);
|
||||
TEST_UNION_REV(case_precision_5, 1, 0, -1, 22.0);
|
||||
TEST_UNION_REV(case_precision_6, 1, 0, -1, 71.0);
|
||||
TEST_UNION_REV(case_precision_7, 1, 0, -1, 22.0);
|
||||
TEST_UNION_REV(case_precision_8, 1, 1, -1, 73.0);
|
||||
TEST_UNION_REV(case_precision_9, 1, 1, -1, 73.0);
|
||||
TEST_UNION_REV(case_precision_10, 1, 1, -1, 73.0);
|
||||
TEST_UNION_REV(case_precision_11, 1, 1, -1, 73.0);
|
||||
TEST_UNION_REV(case_precision_12, 1, 0, -1, 14.0);
|
||||
TEST_UNION_REV(case_precision_13, 1, 0, -1, 14.0);
|
||||
|
||||
/*
|
||||
test_one<Polygon, Polygon, Polygon>(102,
|
||||
simplex_normal[0], simplex_reversed[1],
|
||||
@@ -342,22 +378,23 @@ void test_areal()
|
||||
ticket_5103[0], ticket_5103[1],
|
||||
1, 0, 25, 2515271327070.5);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_8310a", ticket_8310a[0], ticket_8310a[1],
|
||||
1, 0, 5, 10.5000019595);
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_8310b", ticket_8310b[0], ticket_8310b[1],
|
||||
1, 0, 5, 10.5000019595);
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_8310c", ticket_8310c[0], ticket_8310c[1],
|
||||
1, 0, 5, 10.5000019595);
|
||||
TEST_UNION(ticket_8310a, 1, 0, 5, 10.5000019595);
|
||||
TEST_UNION(ticket_8310b, 1, 0, 5, 10.5000019595);
|
||||
TEST_UNION(ticket_8310c, 1, 0, 5, 10.5000019595);
|
||||
TEST_UNION_REV(ticket_8310a, 1, 0, 5, 10.5000019595);
|
||||
TEST_UNION_REV(ticket_8310b, 1, 0, 5, 10.5000019595);
|
||||
TEST_UNION_REV(ticket_8310c, 1, 0, 5, 10.5000019595);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_9081_15",
|
||||
ticket_9081_15[0], ticket_9081_15[1],
|
||||
1, 0, 10, 0.0403425433);
|
||||
1, 0, -1, 0.0403425433);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_9563", ticket_9563[0], ticket_9563[1],
|
||||
1, 0, 13, 150.0);
|
||||
|
||||
// Float result is OK but a bit larger
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_9756", ticket_9756[0], ticket_9756[1],
|
||||
1, 0, 10, 1289.08374);
|
||||
1, 0, 10, if_typed<ct, float>(1291.5469, 1289.08374));
|
||||
|
||||
#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_10108_a", ticket_10108_a[0], ticket_10108_a[1],
|
||||
@@ -373,7 +410,7 @@ void test_areal()
|
||||
#endif
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_10866", ticket_10866[0], ticket_10866[1],
|
||||
1, 0, 14, 332760303.5);
|
||||
1, 0, 14, if_typed<ct, float>(332752493.0, 332760303.5));
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("ticket_11725", ticket_11725[0], ticket_11725[1],
|
||||
1, 1, 10, 7.5);
|
||||
@@ -398,17 +435,17 @@ void test_areal()
|
||||
// Robustness issues, followed out buffer-robustness-tests, test them also reverse
|
||||
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_f", buffer_rt_f[0], buffer_rt_f[1],
|
||||
1, 0, 15, 4.60853);
|
||||
1, 0, -1, 4.60853);
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_f_rev", buffer_rt_f[1], buffer_rt_f[0],
|
||||
1, 0, 15, 4.60853);
|
||||
1, 0, -1, 4.60853);
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_g", buffer_rt_g[0], buffer_rt_g[1],
|
||||
1, 0, if_typed<ct, float>(16, 11), 16.571);
|
||||
1, 0, -1, 16.571);
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_g_rev", buffer_rt_g[1], buffer_rt_g[0],
|
||||
1, 0, if_typed<ct, float>(16, 11), 16.571);
|
||||
1, 0, -1, 16.571);
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_i", buffer_rt_i[0], buffer_rt_i[1],
|
||||
1, 0, if_typed<ct, float>(11, 13), 13.6569);
|
||||
1, 0, -1, 13.6569);
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_i_rev", buffer_rt_i[1], buffer_rt_i[0],
|
||||
1, 0, 13, 13.6569);
|
||||
1, 0, -1, 13.6569);
|
||||
#endif
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_j", buffer_rt_j[0], buffer_rt_j[1],
|
||||
@@ -429,23 +466,23 @@ void test_areal()
|
||||
1, 0, 9, 19.4852);
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_m2", buffer_rt_m2[0], buffer_rt_m2[1],
|
||||
1, 0, 12, 21.4853);
|
||||
1, 0, -1, 21.4853);
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_m2_rev", buffer_rt_m2[1], buffer_rt_m2[0],
|
||||
1, 0, 15, 21.4853);
|
||||
|
||||
#if ! defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_q", buffer_rt_q[0], buffer_rt_q[1],
|
||||
1, 0, if_typed<ct, float>(16, 12), 18.5710);
|
||||
1, 0, -1, 18.5710);
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_q_rev", buffer_rt_q[1], buffer_rt_q[0],
|
||||
1, 0, if_typed<ct, float>(16, 12), 18.5710);
|
||||
1, 0, -1, 18.5710);
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_r", buffer_rt_r[0], buffer_rt_r[1],
|
||||
1, 0, if_typed<ct, float>(18, 14), 21.07612);
|
||||
1, 0, -1, 21.07612);
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_r_rev", buffer_rt_r[1], buffer_rt_r[0],
|
||||
1, 0, if_typed<ct, float>(18, 14), 21.07612);
|
||||
1, 0, -1, 21.07612);
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_t", buffer_rt_t[0], buffer_rt_t[1],
|
||||
1, 0, 9, 15.6569);
|
||||
1, 0, -1, 15.6569);
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_rt_t_rev", buffer_rt_t[1], buffer_rt_t[0],
|
||||
1, 0, 10, 15.6569);
|
||||
1, 0, -1, 15.6569);
|
||||
#endif
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("buffer_mp1", buffer_mp1[0], buffer_mp1[1],
|
||||
|
||||
@@ -130,11 +130,7 @@ void test_areal()
|
||||
case_108_multi[0], case_108_multi[1],
|
||||
1, 1, 20, 22.75);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_UNION(case_109_multi, 1, 2, 14, 1400);
|
||||
#else
|
||||
TEST_UNION_IGNORE(case_109_multi, 1, 1, 14, 1400);
|
||||
#endif
|
||||
|
||||
// Should have 9 holes, they are all separate and touching
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_110_multi",
|
||||
@@ -183,11 +179,7 @@ void test_areal()
|
||||
TEST_UNION(case_125_multi, 1, 0, 9, 2.75);
|
||||
TEST_UNION(case_126_multi, 1, 2, 27, 52.0);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_UNION(case_131_multi, 1, 2, 15, 14.0);
|
||||
#else
|
||||
TEST_UNION_IGNORE(case_131_multi, 1, 1, 15, 14.0);
|
||||
#endif
|
||||
|
||||
// SQL Server returns: MULTIPOLYGON (((4 4, 5.5 4.5, 6 6, 4.5 5.5, 4 4)), ((2 2, 3.5 2.5, 4 4, 2.5 3.5, 2 2)), ((0 0, 8 0, 8 8, 0 8, 0 0), (2 2, 2 4, 4 4, 4 6, 6 6, 6 4, 4 4, 4 2, 2 2)))
|
||||
// Which is one self-connected hole with two island polygons in both parts, basically identical to what Boost.Geometry delivers
|
||||
@@ -221,11 +213,7 @@ void test_areal()
|
||||
case_recursive_boxes_4[0], case_recursive_boxes_4[1],
|
||||
1, 2, 26, 96.75);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_UNION(case_recursive_boxes_5, 3, 10, 98, 70.0);
|
||||
#else
|
||||
TEST_UNION_IGNORE(case_recursive_boxes_5, 3, 9, 115, 70.0);
|
||||
#endif
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_6",
|
||||
case_recursive_boxes_6[0], case_recursive_boxes_6[1],
|
||||
@@ -264,10 +252,7 @@ void test_areal()
|
||||
// to break regions at self-intersection points (postponed)
|
||||
|
||||
TEST_UNION_IGNORE(case_recursive_boxes_12_invalid, 5, 0, -1, 6.0);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
// Only apply it with self-turns. Without them a whole part is missed
|
||||
TEST_UNION_IGNORE(case_recursive_boxes_13_invalid, 2, 0, -1, 10.25);
|
||||
#endif
|
||||
TEST_UNION_IGNORE(case_recursive_boxes_14_invalid, 4, 0, -1, 4.5);
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_15",
|
||||
@@ -346,42 +331,17 @@ void test_areal()
|
||||
TEST_UNION(case_recursive_boxes_46, 1, 4, 51, 33.0);
|
||||
TEST_UNION(case_recursive_boxes_47, 1, 0, -1, 22.0);
|
||||
TEST_UNION(case_recursive_boxes_48, 1, 1, -1, 10.0);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_UNION(case_recursive_boxes_49, 1, 3, -1, 59.0);
|
||||
#else
|
||||
TEST_UNION_IGNORE(case_recursive_boxes_49, 1, 2, -1, 59.0);
|
||||
#endif
|
||||
|
||||
TEST_UNION(case_recursive_boxes_50, 7, 4, -1, 68.0);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_UNION(case_recursive_boxes_51, 2, 6, -1, 75.0);
|
||||
#else
|
||||
TEST_UNION_IGNORE(case_recursive_boxes_51, 2, 5, -1, 75.0);
|
||||
#endif
|
||||
|
||||
TEST_UNION(case_recursive_boxes_52, 2, 6, -1, 77.0);
|
||||
TEST_UNION(case_recursive_boxes_53, 1, 1, -1, 24.75);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_UNION(case_recursive_boxes_54, 1, 2, -1, 22.5);
|
||||
#else
|
||||
TEST_UNION_IGNORE(case_recursive_boxes_54, 1, 1, -1, 22.5);
|
||||
#endif
|
||||
|
||||
TEST_UNION(case_recursive_boxes_55, 3, 1, -1, 15.5);
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_UNION(case_recursive_boxes_56, 5, 1, -1, 7.75);
|
||||
#else
|
||||
TEST_UNION_IGNORE(case_recursive_boxes_56, 5, 0, -1, 7.75);
|
||||
#endif
|
||||
TEST_UNION(case_recursive_boxes_57, 3, 4, -1, 19.75);
|
||||
TEST_UNION(case_recursive_boxes_58, 6, 1, -1, 6.25);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
// If there are no self-turns, an interior ring is missed
|
||||
TEST_UNION(case_recursive_boxes_59, 1, 3, -1, 21.75);
|
||||
#endif
|
||||
|
||||
TEST_UNION(case_recursive_boxes_60, 3, 0, -1, 20.5);
|
||||
TEST_UNION(case_recursive_boxes_61, 1, 1, -1, 23.5);
|
||||
TEST_UNION(case_recursive_boxes_62, 2, 3, -1, 21.25);
|
||||
@@ -431,14 +391,22 @@ void test_areal()
|
||||
ggl_list_20140212_sybren[0], ggl_list_20140212_sybren[1],
|
||||
2, 0, 16, 0.002471626);
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_9081",
|
||||
ticket_9081[0], ticket_9081[1],
|
||||
#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
3,
|
||||
#else
|
||||
4,
|
||||
{
|
||||
ut_settings settings;
|
||||
#if !defined(BOOST_GEOMETRY_NO_ROBUSTNESS) && !defined(BOOST_GEOMETRY_TEST_INCLUDE_FAILING_TESTS)
|
||||
settings.test_validity = false;
|
||||
#endif
|
||||
0, 31, 0.2187385);
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_9081",
|
||||
ticket_9081[0], ticket_9081[1],
|
||||
#if defined(BOOST_GEOMETRY_NO_ROBUSTNESS)
|
||||
3,
|
||||
#else
|
||||
4,
|
||||
#endif
|
||||
0, 31, 0.2187385,
|
||||
settings);
|
||||
}
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("ticket_10803",
|
||||
ticket_10803[0], ticket_10803[1],
|
||||
@@ -460,17 +428,11 @@ void test_areal()
|
||||
|
||||
TEST_UNION(ticket_12503, 42, 1, -1, 945.625);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_UNION(mysql_23023665_7, 1, 1, -1, 99.19494);
|
||||
#else
|
||||
TEST_UNION_IGNORE(mysql_23023665_7, 1, 0, -1, 99.19494);
|
||||
#endif
|
||||
// Generates two polygons, which should (without rescaling) be merged into one
|
||||
TEST_UNION(mail_2019_01_21_johan, 2, 0, -1, 0.00058896);
|
||||
|
||||
#ifndef BOOST_GEOMETRY_NO_SELF_TURNS
|
||||
TEST_UNION(mysql_23023665_7, 1, 1, -1, 99.19494);
|
||||
TEST_UNION(mysql_23023665_8, 1, 2, -1, 1400.0);
|
||||
#else
|
||||
TEST_UNION_IGNORE(mysql_23023665_8, 1, 1, -1, 1400.0);
|
||||
#endif
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("mysql_23023665_9",
|
||||
mysql_23023665_9[0], mysql_23023665_9[1],
|
||||
|
||||
@@ -2,7 +2,12 @@
|
||||
|
||||
// Copyright (c) 2018 Yaghyavardhan Singh Khangarot, Hyderabad, India.
|
||||
|
||||
// Contributed and/or modified by Yaghyavardhan Singh Khangarot, as part of Google Summer of Code 2018 program.
|
||||
// Contributed and/or modified by Yaghyavardhan Singh Khangarot,
|
||||
// as part of Google Summer of Code 2018 program.
|
||||
|
||||
// This file was modified by Oracle on 2018.
|
||||
// Modifications copyright (c) 2018 Oracle and/or its affiliates.
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -13,6 +18,8 @@
|
||||
#include <boost/geometry/geometries/linestring.hpp>
|
||||
#include <boost/geometry/geometries/point_xy.hpp>
|
||||
#include <boost/geometry/geometries/polygon.hpp>
|
||||
#include <boost/geometry/geometries/multi_linestring.hpp>
|
||||
#include <boost/geometry/geometries/multi_point.hpp>
|
||||
|
||||
#include "test_hausdorff_distance.hpp"
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// This file was modified by Oracle on 2014, 2015, 2017.
|
||||
// Modifications copyright (c) 2014-2017 Oracle and/or its affiliates.
|
||||
// This file was modified by Oracle on 2014, 2015, 2017, 2019.
|
||||
// Modifications copyright (c) 2014-2019 Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <geometry_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/covered_by.hpp>
|
||||
#include <boost/geometry/algorithms/within.hpp>
|
||||
#include <boost/geometry/core/ring_type.hpp>
|
||||
#include <boost/geometry/geometries/ring.hpp>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
|
||||
// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
|
||||
|
||||
// This file was modified by Oracle on 2014, 2015, 2016.
|
||||
// Modifications copyright (c) 2014-2016 Oracle and/or its affiliates.
|
||||
// This file was modified by Oracle on 2014, 2015, 2016, 2018.
|
||||
// Modifications copyright (c) 2014-2018 Oracle and/or its affiliates.
|
||||
|
||||
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
|
||||
|
||||
@@ -109,7 +109,7 @@ void test_strategy()
|
||||
box_type b0(point_type(0, 0), point_type(5, 0));
|
||||
|
||||
bool r = bg::within(p, b,
|
||||
bg::strategy::within::point_in_box<point_type, box_type>());
|
||||
bg::strategy::within::cartesian_point_box());
|
||||
BOOST_CHECK_EQUAL(r, true);
|
||||
|
||||
r = bg::within(b, b,
|
||||
@@ -121,7 +121,7 @@ void test_strategy()
|
||||
BOOST_CHECK_EQUAL(r, false);
|
||||
|
||||
r = bg::within(p, b,
|
||||
bg::strategy::within::point_in_box_by_side<point_type, box_type>());
|
||||
bg::strategy::within::point_in_box_by_side<>());
|
||||
BOOST_CHECK_EQUAL(r, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Geometry
|
||||
|
||||
// Copyright (c) 2016 Oracle and/or its affiliates.
|
||||
// Copyright (c) 2016-2018 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,
|
||||
@@ -19,7 +19,7 @@ void test_point_box_by_side()
|
||||
// Test spherical boxes
|
||||
// See also http://www.gcmap.com/mapui?P=1E45N-19E45N-19E55N-1E55N-1E45N,10E55.1N,10E45.1N
|
||||
typedef bg::model::box<Point> box_t;
|
||||
bg::strategy::within::point_in_box_by_side<Point, box_t> by_side;
|
||||
bg::strategy::within::point_in_box_by_side<> by_side;
|
||||
box_t box;
|
||||
bg::read_wkt("POLYGON((1 45,19 55))", box);
|
||||
BOOST_CHECK_EQUAL(bg::within(Point(10, 55.1), box, by_side), true);
|
||||
|
||||
Reference in New Issue
Block a user