mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 13:34:10 +00:00
Assemble/traverse/enrich: complete update for handling self tangencies
-> added many testcases Various updates in testcases for support of open polygons recursive_boxes.cpp, added triangles as well (dropped corner) [SVN r66450]
This commit is contained in:
parent
c3c238623d
commit
e71fb07566
@ -12,6 +12,7 @@ project boost-geometry-test
|
||||
:
|
||||
requirements
|
||||
<include>.
|
||||
<include>../../../boost/geometry/extensions/contrib/ttmath
|
||||
<toolset>msvc:<asynch-exceptions>on
|
||||
;
|
||||
|
||||
|
@ -29,7 +29,6 @@ test-suite boost-geometry-algorithms
|
||||
[ run overlaps.cpp ]
|
||||
[ run perimeter.cpp ]
|
||||
[ run reverse.cpp ]
|
||||
[ run sectionalize.cpp ]
|
||||
[ run simplify.cpp ]
|
||||
[ run transform.cpp ]
|
||||
[ run union.cpp ]
|
||||
@ -37,4 +36,8 @@ test-suite boost-geometry-algorithms
|
||||
[ run within.cpp ]
|
||||
;
|
||||
|
||||
build-project overlay ;
|
||||
build-project overlay
|
||||
;
|
||||
|
||||
build-project detail
|
||||
;
|
||||
|
13
test/algorithms/detail/Jamfile.v2
Normal file
13
test/algorithms/detail/Jamfile.v2
Normal file
@ -0,0 +1,13 @@
|
||||
# test/algorithms/Jamfile.v2
|
||||
#
|
||||
# Copyright (c) 2010 Barend Gehrels
|
||||
#
|
||||
# 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)
|
||||
|
||||
test-suite boost-geometry-algorithms-detail
|
||||
:
|
||||
;
|
||||
|
||||
build-project sections ;
|
12
test/algorithms/detail/sections/Jamfile.v2
Normal file
12
test/algorithms/detail/sections/Jamfile.v2
Normal file
@ -0,0 +1,12 @@
|
||||
# test/algorithms/Jamfile.v2
|
||||
#
|
||||
# Copyright (c) 2010 Barend Gehrels
|
||||
#
|
||||
# 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)
|
||||
|
||||
test-suite boost-geometry-algorithms-detail-sections
|
||||
:
|
||||
[ run sectionalize.cpp ]
|
||||
;
|
@ -156,26 +156,48 @@ void test_all()
|
||||
4, "0..1|1..2|2..3|3..4", "+ +|+ -|+ .|. +",
|
||||
2, "0..3|3..4", "+|.");
|
||||
|
||||
test_sectionalize<bg::polygon<P> >(
|
||||
// These strings mean:
|
||||
// 0..1|1..2 -> first section: [0, 1] | second section [1, 2], etc
|
||||
// + +|+ - -> X increases, Y increases | X increases, Y decreases
|
||||
// +|. -> (only X considered) X increases | X constant
|
||||
|
||||
test_sectionalize<bg::model::polygon<P> >(
|
||||
"POLYGON((0 0,0 7,4 2,2 0,0 0))",
|
||||
4, "0..1|1..2|2..3|3..4", ". +|+ -|- -|- .",
|
||||
// . + - - -> 3 sections
|
||||
3, "0..1|1..2|2..4", ".|+|-");
|
||||
|
||||
test_sectionalize<bg::polygon<P> >
|
||||
// CCW polygon - orientation is not relevant for sections,
|
||||
// they are just generated in the order they come.
|
||||
test_sectionalize<bg::model::polygon<P, false> >(
|
||||
"POLYGON((0 0,2 0,4 2,0 7,0 0))",
|
||||
4, "0..1|1..2|2..3|3..4", "+ .|+ +|- +|. -",
|
||||
// . + - - -> 3 sections
|
||||
3, "0..2|2..3|3..4", "+|-|.");
|
||||
|
||||
// Open polygon - closeness IS relevant for sections, the
|
||||
// last section which is not explicit here should be included.
|
||||
// So results are the same as the pre-previous one.
|
||||
test_sectionalize<bg::model::polygon<P, true, false> >(
|
||||
"POLYGON((0 0,0 7,4 2,2 0))",
|
||||
4, "0..1|1..2|2..3|3..4", ". +|+ -|- -|- .",
|
||||
// . + - - -> 3 sections
|
||||
3, "0..1|1..2|2..4", ".|+|-");
|
||||
|
||||
test_sectionalize<bg::model::polygon<P> >
|
||||
("polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0, 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))",
|
||||
8, "0..2|2..3|3..4|4..5|5..6|6..8|8..10|10..11", "+ +|+ -|+ +|- +|+ +|+ -|- -|- +",
|
||||
4, "0..4|4..5|5..8|8..11", "+|-|+|-");
|
||||
|
||||
|
||||
test_sectionalize<bg::polygon<P> >(
|
||||
test_sectionalize<bg::model::polygon<P> >(
|
||||
"POLYGON((3 1,2 2,1 3,2 4,3 5,4 4,5 3,4 2,3 1))",
|
||||
4, "0..2|2..4|4..6|6..8", "- +|+ +|+ -|- -",
|
||||
// - - - + + + + - - -> 3 sections
|
||||
3, "0..2|2..6|6..8", "-|+|-");
|
||||
|
||||
// With holes
|
||||
test_sectionalize<bg::polygon<P> >(
|
||||
test_sectionalize<bg::model::polygon<P> >(
|
||||
"POLYGON((3 1,2 2,1 3,2 4,3 5,4 4,5 3,4 2,3 1), (3 2,2 2,3 4,3 2))",
|
||||
7, "0..2|2..4|4..6|6..8|0..1|1..2|2..3", "- +|+ +|+ -|- -|- .|+ +|. -",
|
||||
// - - - + + + + - - - + . -> 6 sections
|
||||
@ -201,7 +223,7 @@ void test_all()
|
||||
|
||||
return;
|
||||
// Buffer-case
|
||||
test_sectionalize<bg::polygon<P> >(
|
||||
test_sectionalize<bg::model::polygon<P> >(
|
||||
"POLYGON((-1.1713 0.937043,2.8287 5.93704,2.90334 6.02339,2.98433 6.10382,2.98433 6.10382,3.07121 6.17786,3.16346 6.24507,3.16346 6.24507,3.16346 6.24507,3.26056 6.30508,3.36193 6.35752,3.36193 6.35752,3.46701 6.40211,3.57517 6.43858,3.57517 6.43858,3.57517 6.43858,3.57517 6.43858,3.68579 6.46672,3.79822 6.48637,3.79822 6.48637,3.91183 6.49741,4.02595 6.49978,4.02595 6.49978,4.02595 6.49978,4.13991 6.49346,4.25307 6.4785,4.25307 6.4785,4.36476 6.45497,4.47434 6.42302,4.47434 6.42302,4.47434 6.42302,4.47434 6.42302,7.47434 5.42302,6.84189 3.52566,4.39043 4.68765,0.390434 -0.312348,-1.1713 0.937043))",
|
||||
8, "0..2|2..3|3..4|4..5|5..6|6..8|8..10|10..11", "+ +|+ -|+ +|- +|+ +|+ -|- -|- +",
|
||||
4, "0..4|4..5|5..8|8..11", "+|-|+|-");
|
20
test/algorithms/detail/sections/sectionalize.sln
Normal file
20
test/algorithms/detail/sections/sectionalize.sln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual C++ Express 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sectionalize", "sectionalize.vcproj", "{50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@ -6,7 +6,6 @@
|
||||
ProjectGUID="{50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}"
|
||||
RootNamespace="sectionalize"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
@ -21,7 +20,7 @@
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\sectionalize"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\boost.vsprops"
|
||||
InheritedPropertySheets="..\..\..\boost.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
@ -42,10 +41,10 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../..;.."
|
||||
AdditionalIncludeDirectories="../../../../../..;../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
RuntimeLibrary="1"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="1"
|
||||
/>
|
||||
@ -82,6 +81,9 @@
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
@ -91,7 +93,7 @@
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\sectionalize"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\boost.vsprops"
|
||||
InheritedPropertySheets="..\..\..\boost.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
@ -112,7 +114,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../..;.."
|
||||
AdditionalIncludeDirectories="../../../../../..;../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
@ -151,6 +153,9 @@
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
@ -5,6 +5,8 @@
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_GEOMETRY_DEBUG_ENRICH
|
||||
#define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
|
||||
|
||||
#include <geometry_test_common.hpp>
|
||||
|
||||
@ -35,13 +37,13 @@ void test_all()
|
||||
// Self tangent
|
||||
test_one<polygon, polygon>("4",
|
||||
"POLYGON((0 0,0 4,4 4,4 0,2 4,0 0))",
|
||||
0, 11, 12.0);
|
||||
0, 8, 8.0);
|
||||
|
||||
|
||||
// Self tangent in corner
|
||||
test_one<polygon, polygon>("5",
|
||||
"POLYGON((0 0,0 4,4 4,4 0,0 4,2 0,0 0))",
|
||||
0, 11, 16.0);
|
||||
0, 8, 12.0);
|
||||
|
||||
|
||||
// With spike
|
||||
|
@ -9,6 +9,10 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
//#define BOOST_GEOMETRY_DEBUG_TRAVERSE
|
||||
//#define BOOST_GEOMETRY_DEBUG_ASSEMBLE
|
||||
//#define BOOST_GEOMETRY_DEBUG_IDENTIFIER
|
||||
|
||||
|
||||
#include <algorithms/test_intersection.hpp>
|
||||
#include <algorithms/test_overlay.hpp>
|
||||
@ -130,7 +134,7 @@ void test_areal()
|
||||
{
|
||||
std::string tn = string_from_type<typename boost::geometry::coordinate_type<Polygon>::type>::name();
|
||||
test_one<Polygon, Polygon, Polygon>("isovist",
|
||||
isovist[0], isovist[1],
|
||||
isovist1[0], isovist1[1],
|
||||
1,
|
||||
tn == std::string("f") ? 19 : tn == std::string("d") ? 21 : 20,
|
||||
88.19203,
|
||||
@ -189,17 +193,19 @@ template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
typedef boost::geometry::linestring<P> linestring;
|
||||
typedef boost::geometry::polygon<P> polygon;
|
||||
typedef boost::geometry::model::polygon<P> polygon;
|
||||
typedef boost::geometry::box<P> box;
|
||||
typedef boost::geometry::model::segment<P> segment;
|
||||
|
||||
typedef boost::geometry::polygon<P, std::vector, std::vector, false> polygon_ccw;
|
||||
typedef boost::geometry::model::polygon<P, false> polygon_ccw;
|
||||
typedef boost::geometry::model::polygon<P, true, false> polygon_open;
|
||||
|
||||
std::string clip = "box(2 2,8 8)";
|
||||
|
||||
// Test polygons clockwise and counter clockwise
|
||||
test_areal<polygon>();
|
||||
test_areal<polygon_ccw>();
|
||||
test_areal<polygon_open>();
|
||||
|
||||
test_areal_clip<polygon, box>();
|
||||
test_areal_clip<polygon_ccw, box>();
|
||||
@ -300,7 +306,7 @@ void test_pointer_version()
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_all<boost::geometry::point_xy<float> >();
|
||||
//test_all<boost::geometry::point_xy<float> >();
|
||||
test_all<boost::geometry::point_xy<double> >();
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
|
@ -61,7 +61,7 @@ void test_linestring_2d()
|
||||
|
||||
L line = make<L>(coors);
|
||||
|
||||
BOOST_CHECK_EQUAL(line.size(), 2);
|
||||
BOOST_CHECK_EQUAL(line.size(), 2u);
|
||||
}
|
||||
|
||||
template <typename T, typename P>
|
||||
@ -73,7 +73,7 @@ void test_linestring_3d()
|
||||
|
||||
L line = make<L>(coors);
|
||||
|
||||
BOOST_CHECK_EQUAL(line.size(), 2);
|
||||
BOOST_CHECK_EQUAL(line.size(), 2u);
|
||||
//std::cout << dsv(line) << std::endl;
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
# test/arithmetic/Jamfile.v2
|
||||
# test/algorithms/Jamfile.v2
|
||||
#
|
||||
# Copyright (c) 2010 Barend Gehrels
|
||||
#
|
||||
@ -6,8 +6,15 @@
|
||||
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
test-suite boost-geometry-algoritms-overlay
|
||||
:
|
||||
[ run ccw_traverse.cpp ]
|
||||
test-suite boost-geometry-algorithms-overlay
|
||||
:
|
||||
[ run assemble.cpp ]
|
||||
# [ run ccw_traverse.cpp ]
|
||||
# [ run dissolver.cpp ]
|
||||
[ run get_turn_info.cpp ]
|
||||
[ run get_turns.cpp ]
|
||||
# [ run relative_order.cpp ]
|
||||
# [ run self_intersection_points.cpp ]
|
||||
# [ run split_rings.cpp ]
|
||||
[ run traverse.cpp ]
|
||||
;
|
||||
;
|
||||
|
@ -46,6 +46,7 @@
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
@ -45,7 +45,8 @@ inline typename bg::coordinate_type<Geometry1>::type intersect(Geometry1 const&
|
||||
{
|
||||
bg::detail::overlay::reverse_operations(turns);
|
||||
}
|
||||
bg::enrich_intersection_points(turns, g1, g2, side_strategy_type());
|
||||
bg::enrich_intersection_points(turns, bg::detail::overlay::operation_intersection,
|
||||
g1, g2, side_strategy_type());
|
||||
|
||||
typedef bg::linear_ring<typename bg::point_type<Geometry1>::type> ring_type;
|
||||
typedef std::vector<ring_type> out_vector;
|
||||
@ -124,7 +125,7 @@ inline typename bg::coordinate_type<Geometry1>::type intersect(Geometry1 const&
|
||||
<< std::endl
|
||||
<< "op: " << bg::operation_char(turn.operations[0].operation)
|
||||
<< " / " << bg::operation_char(turn.operations[1].operation)
|
||||
<< (turn.ignore() ? " (ignore) " : "")
|
||||
<< (turn.is_discarded() ? " (discarded) " : turn.blocked() ? " (blocked)" : "")
|
||||
<< std::endl;
|
||||
|
||||
if (turn.operations[0].enriched.next_ip_index != -1)
|
||||
@ -187,8 +188,8 @@ template <typename T>
|
||||
inline void test_polygon(std::string const& wkt1, std::string const& wkt2, std::string const& name)
|
||||
{
|
||||
typedef bg::point_xy<T> point;
|
||||
typedef bg::polygon<point> clock;
|
||||
typedef bg::polygon<point, std::vector, std::vector, false> counter;
|
||||
typedef bg::model::polygon<point> clock;
|
||||
typedef bg::model::polygon<point, false> counter;
|
||||
|
||||
namespace ov = bg::detail::overlay;
|
||||
T area1 = intersect<clock, clock>(wkt1, wkt2, name, ov::operation_intersection);
|
||||
@ -205,8 +206,8 @@ inline void test_box_polygon(std::string const& wkt1, std::string const& wkt2, s
|
||||
{
|
||||
typedef bg::point_xy<T> point;
|
||||
typedef bg::box<point> box;
|
||||
typedef bg::polygon<point> clock;
|
||||
typedef bg::polygon<point, std::vector, std::vector, false> counter;
|
||||
typedef bg::model::polygon<point> clock;
|
||||
typedef bg::model::polygon<point, false> counter;
|
||||
|
||||
namespace ov = bg::detail::overlay;
|
||||
T area1 = intersect<box, clock>(wkt1, wkt2, name, ov::operation_intersection);
|
||||
|
@ -38,7 +38,7 @@ struct test_get_turns
|
||||
{
|
||||
template <typename G1, typename G2>
|
||||
static void apply(std::string const& id,
|
||||
boost::tuple<int, double, double> const& expected_count_and_center,
|
||||
boost::tuple<int> const& expected_count_and_center,
|
||||
G1 const& g1, G2 const& g2, double precision)
|
||||
{
|
||||
namespace bg = boost::geometry;
|
||||
@ -60,36 +60,9 @@ struct test_get_turns
|
||||
<typename bg::coordinate_type<G1>::type>::name()
|
||||
);
|
||||
|
||||
|
||||
typedef typename bg::coordinate_type<G1>::type coordinate_type;
|
||||
/*
|
||||
coordinate_type x = 0, y = 0;
|
||||
BOOST_FOREACH(turn_info const& turn, turns)
|
||||
{
|
||||
x += bg::get<0>(turn.point);
|
||||
y += bg::get<1>(turn.point);
|
||||
}
|
||||
|
||||
int n = boost::size(turns);
|
||||
if (n > 0)
|
||||
{
|
||||
x /= n;
|
||||
y /= n;
|
||||
}
|
||||
std::cout << std::setprecision(8) << x << ", " << y << " "
|
||||
<< expected_count_and_center.get<1>()
|
||||
<< " " << expected_count_and_center.get<2>()
|
||||
<< std::endl;
|
||||
*/
|
||||
|
||||
|
||||
// Obsolete test (too much work)
|
||||
//BOOST_CHECK_CLOSE(expected_count_and_center.get<1>(), x, precision);
|
||||
//BOOST_CHECK_CLOSE(expected_count_and_center.get<2>(), y, precision);
|
||||
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
{
|
||||
typedef typename bg::coordinate_type<G1>::type coordinate_type;
|
||||
std::map<std::pair<coordinate_type, coordinate_type>, int> offsets;
|
||||
std::ostringstream filename;
|
||||
filename << "get_turns_" << id
|
||||
@ -102,8 +75,11 @@ struct test_get_turns
|
||||
mapper.add(g1);
|
||||
mapper.add(g2);
|
||||
|
||||
mapper.map(g1, "fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
|
||||
mapper.map(g2, "opacity:0.8;fill:rgb(0,0,255);stroke:rgb(0,0,0);stroke-width:1");
|
||||
// Input shapes in green/blue
|
||||
mapper.map(g1, "fill-opacity:0.5;fill:rgb(153,204,0);"
|
||||
"stroke:rgb(153,204,0);stroke-width:3");
|
||||
mapper.map(g2, "fill-opacity:0.3;fill:rgb(51,51,153);"
|
||||
"stroke:rgb(51,51,153);stroke-width:3");
|
||||
|
||||
int index = 0;
|
||||
BOOST_FOREACH(turn_info const& turn, turns)
|
||||
@ -120,7 +96,7 @@ struct test_get_turns
|
||||
<< ": " << bg::operation_char(turn.operations[0].operation)
|
||||
<< " " << bg::operation_char(turn.operations[1].operation)
|
||||
<< " (" << bg::method_char(turn.method) << ")"
|
||||
<< (turn.ignore() ? " (ignore) " : " ")
|
||||
<< (turn.is_discarded() ? " (discarded) " : turn.blocked() ? " (blocked)" : "")
|
||||
;
|
||||
|
||||
offsets[p] += 10;
|
||||
@ -148,7 +124,7 @@ void test_all()
|
||||
typedef boost::geometry::box<P> box;
|
||||
|
||||
// Expected count, average x, average y
|
||||
typedef boost::tuple<int, double, double> Tuple;
|
||||
typedef boost::tuple<int> Tuple;
|
||||
|
||||
std::cout << string_from_type<T>::name() << std::endl;
|
||||
|
||||
@ -156,7 +132,7 @@ void test_all()
|
||||
// snl
|
||||
/*
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("snl_2",
|
||||
boost::make_tuple(5, -122.27866617838542, 37.377897262573242),
|
||||
boost::make_tuple(5),
|
||||
//snl-1
|
||||
//"POLYGON((182467 605842,182480 605954,182557 605958,182571 605958,182585 605958,182579 605843,182559 605838,182467 605842))",
|
||||
//"POLYGON((182499 605955,182511 605960,182536 605974,182536 605981,182536 606006,182563 606006,182610 605985,182613 605976,182620 605948,182628 605937,182631 605924,182639 605889,182634 605885,182603 605848,182579 605843,182585 605958,182571 605958,182557 605958,182499 605955))");
|
||||
@ -173,109 +149,109 @@ void test_all()
|
||||
*/
|
||||
|
||||
// 1-6
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("1", boost::make_tuple(6, 2.2547802, 3.0358056), case_1[0], case_1[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("2", boost::make_tuple(8, 2.5, 2.5), case_2[0], case_2[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("3", boost::make_tuple(4, 2.5, 2.5), case_3[0], case_3[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("4", boost::make_tuple(12, 2.5, 2.5), case_4[0], case_4[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("5", boost::make_tuple(17, 2.5987395, 2.4166667), case_5[0], case_5[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("6", boost::make_tuple(3, 3, 2.5), case_6[0], case_6[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("1", boost::make_tuple(6), case_1[0], case_1[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("2", boost::make_tuple(8),case_2[0], case_2[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("3", boost::make_tuple(4),case_3[0], case_3[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("4", boost::make_tuple(12),case_4[0], case_4[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("5", boost::make_tuple(17), case_5[0], case_5[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("6", boost::make_tuple(3),case_6[0], case_6[1]);
|
||||
|
||||
// 7-12
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("7", boost::make_tuple(2, 3, 2.5), case_7[0], case_7[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("8", boost::make_tuple(2, 2, 2), case_8[0], case_8[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("9", boost::make_tuple(1, 2, 2), case_9[0], case_9[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("10", boost::make_tuple(3, 2, 2), case_10[0], case_10[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("11", boost::make_tuple(1, 2, 2), case_11[0], case_11[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("12", boost::make_tuple(8, 2, 3.25), case_12[0], case_12[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("7", boost::make_tuple(2),case_7[0], case_7[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("8", boost::make_tuple(2),case_8[0], case_8[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("9", boost::make_tuple(1),case_9[0], case_9[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("10", boost::make_tuple(3),case_10[0], case_10[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("11", boost::make_tuple(1),case_11[0], case_11[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("12", boost::make_tuple(8), case_12[0], case_12[1]);
|
||||
|
||||
// 13-18
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("13", boost::make_tuple(2, 1.5, 1.5), case_13[0], case_13[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("14", boost::make_tuple(2, 2, 2), case_14[0], case_14[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("15", boost::make_tuple(2, 2, 2), case_15[0], case_15[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("16", boost::make_tuple(4, 1.5, 2.5), case_16[0], case_16[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("17", boost::make_tuple(2, 2, 2), case_17[0], case_17[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("18", boost::make_tuple(4, 2, 2), case_18[0], case_18[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("13", boost::make_tuple(2), case_13[0], case_13[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("14", boost::make_tuple(2),case_14[0], case_14[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("15", boost::make_tuple(2),case_15[0], case_15[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("16", boost::make_tuple(4),case_16[0], case_16[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("17", boost::make_tuple(2),case_17[0], case_17[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("18", boost::make_tuple(4),case_18[0], case_18[1]);
|
||||
|
||||
// 19-24
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("19", boost::make_tuple(2, 3, 2.5), case_19[0], case_19[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("20", boost::make_tuple(3, 0, 0), case_20[0], case_20[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("21", boost::make_tuple(3, 0, 0), case_21[0], case_21[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("22", boost::make_tuple(1, 4, 2), case_22[0], case_22[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("23", boost::make_tuple(2, 3.2, 2.2), case_23[0], case_23[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("24", boost::make_tuple(1, 4, 2), case_24[0], case_24[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("19", boost::make_tuple(2),case_19[0], case_19[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("20", boost::make_tuple(3),case_20[0], case_20[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("21", boost::make_tuple(3),case_21[0], case_21[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("22", boost::make_tuple(1), case_22[0], case_22[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("23", boost::make_tuple(2), case_23[0], case_23[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("24", boost::make_tuple(1), case_24[0], case_24[1]);
|
||||
|
||||
// 25-30
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("25", boost::make_tuple(1, 4, 2), case_25[0], case_25[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("26", boost::make_tuple(1, 4, 2), case_26[0], case_26[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("27", boost::make_tuple(2, 3.04545, 1.36363), case_27[0], case_27[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("28", boost::make_tuple(2, 3.04545, 1.36363), case_28[0], case_28[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("29", boost::make_tuple(2, 3.2, 2.2), case_29[0], case_29[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("30", boost::make_tuple(2, 2, 1.75), case_30[0], case_30[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("25", boost::make_tuple(1),case_25[0], case_25[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("26", boost::make_tuple(1),case_26[0], case_26[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("27", boost::make_tuple(2), case_27[0], case_27[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("28", boost::make_tuple(2), case_28[0], case_28[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("29", boost::make_tuple(2), case_29[0], case_29[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("30", boost::make_tuple(2), case_30[0], case_30[1]);
|
||||
|
||||
// 31-36
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("31", boost::make_tuple(1, 2, 2), case_31[0], case_31[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("32", boost::make_tuple(1, 2, 2), case_32[0], case_32[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("33", boost::make_tuple(1, 2, 2), case_33[0], case_33[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("34", boost::make_tuple(2, 3.5, 1.5), case_34[0], case_34[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("35", boost::make_tuple(1, 4, 2), case_35[0], case_35[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("36", boost::make_tuple(3, 2.55555, 2.36111), case_36[0], case_36[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("31", boost::make_tuple(1),case_31[0], case_31[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("32", boost::make_tuple(1),case_32[0], case_32[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("33", boost::make_tuple(1),case_33[0], case_33[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("34", boost::make_tuple(2), case_34[0], case_34[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("35", boost::make_tuple(1), case_35[0], case_35[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("36", boost::make_tuple(3), case_36[0], case_36[1]);
|
||||
|
||||
// 37-42
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("37", boost::make_tuple(3, 2.4444444, 2.0), case_37[0], case_37[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("38", boost::make_tuple(3, 3.18095239, 2.8380952), case_38[0], case_38[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("39", boost::make_tuple(4, 5.33333, 4.0), case_39[0], case_39[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("40", boost::make_tuple(3, 5.33333, 4.0), case_40[0], case_40[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("41", boost::make_tuple(5, 5.33333, 4.0), case_41[0], case_41[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("42", boost::make_tuple(5, 5.33333, 4.0), case_42[0], case_42[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("37", boost::make_tuple(3), case_37[0], case_37[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("38", boost::make_tuple(3), case_38[0], case_38[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("39", boost::make_tuple(4),case_39[0], case_39[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("40", boost::make_tuple(3),case_40[0], case_40[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("41", boost::make_tuple(5),case_41[0], case_41[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("42", boost::make_tuple(5),case_42[0], case_42[1]);
|
||||
|
||||
// 43-48
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("43", boost::make_tuple(4, 2.125, 1.9375), case_43[0], case_43[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("44", boost::make_tuple(4, 1.5, 1.5), case_44[0], case_44[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("45", boost::make_tuple(4, 1.5, 1.5), case_45[0], case_45[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("46", boost::make_tuple(4, 2.25, 1.5), case_46[0], case_46[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("47", boost::make_tuple(5, 2.6, 1.5), case_47[0], case_47[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("43", boost::make_tuple(4), case_43[0], case_43[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("44", boost::make_tuple(4),case_44[0], case_44[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("45", boost::make_tuple(4),case_45[0], case_45[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("46", boost::make_tuple(4), case_46[0], case_46[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("47", boost::make_tuple(5), case_47[0], case_47[1]);
|
||||
|
||||
// 49-54
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("50", boost::make_tuple(4, 0.0, 0.0), case_50[0], case_50[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("51", boost::make_tuple(3, 0.0, 0.0), case_51[0], case_51[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("52", boost::make_tuple(8, 0.0, 0.0), case_52[0], case_52[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("50", boost::make_tuple(4), case_50[0], case_50[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("51", boost::make_tuple(3), case_51[0], case_51[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("52", boost::make_tuple(8), case_52[0], case_52[1]);
|
||||
// A touching point interior/ring exterior/ring can be represented in two ways:
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("53a", boost::make_tuple(4, 0.0, 0.0), case_53[0], case_53[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("53b", boost::make_tuple(4, 0.0, 0.0), case_53[0], case_53[2]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("54aa", boost::make_tuple(13, 0.0, 0.0), case_54[0], case_54[2]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("54ab", boost::make_tuple(13, 0.0, 0.0), case_54[0], case_54[3]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("54ba", boost::make_tuple(13, 0.0, 0.0), case_54[1], case_54[2]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("54bb", boost::make_tuple(13, 0.0, 0.0), case_54[1], case_54[3]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("53a", boost::make_tuple(4), case_53[0], case_53[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("53b", boost::make_tuple(4), case_53[0], case_53[2]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("54aa", boost::make_tuple(13), case_54[0], case_54[2]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("54ab", boost::make_tuple(13), case_54[0], case_54[3]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("54ba", boost::make_tuple(13), case_54[1], case_54[2]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("54bb", boost::make_tuple(13), case_54[1], case_54[3]);
|
||||
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("55", boost::make_tuple(10, 0.0, 0.0), case_55[0], case_55[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("56", boost::make_tuple(9, 0.0, 0.0), case_56[0], case_56[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("55", boost::make_tuple(12), case_55[0], case_55[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("56", boost::make_tuple(9), case_56[0], case_56[1]);
|
||||
|
||||
|
||||
// other
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("many_situations", boost::make_tuple(31, 11.625, 13.875), case_many_situations[0], case_many_situations[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("many_situations", boost::make_tuple(31), case_many_situations[0], case_many_situations[1]);
|
||||
|
||||
|
||||
// ticket#17
|
||||
test_overlay<polygon, box, test_get_turns, Tuple>("ticket_17", boost::make_tuple(6, -122.27866617838542, 37.377897262573242), ticket_17[0], ticket_17[1]);
|
||||
test_overlay<polygon, box, test_get_turns, Tuple>("ticket_17", boost::make_tuple(6), ticket_17[0], ticket_17[1]);
|
||||
|
||||
|
||||
|
||||
// pies
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_23_16_16", boost::make_tuple(3, 0.0, 0.0), pie_23_16_16[0], pie_23_16_16[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_16_4_12", boost::make_tuple(2, 0.0, 0.0), pie_16_4_12[0], pie_16_4_12[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_4_13_15", boost::make_tuple(3, 0.0, 0.0), pie_4_13_15[0], pie_4_13_15[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_16_2_15_0", boost::make_tuple(2, 0.0, 0.0), pie_16_2_15_0[0], pie_16_2_15_0[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_20_20_7_100", boost::make_tuple(3, 0.0, 0.0), pie_20_20_7_100[0], pie_20_20_7_100[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_23_23_3_2000", boost::make_tuple(5, 0.0, 0.0), pie_23_23_3_2000[0], pie_23_23_3_2000[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_23_16_16", boost::make_tuple(3), pie_23_16_16[0], pie_23_16_16[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_16_4_12", boost::make_tuple(2), pie_16_4_12[0], pie_16_4_12[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_4_13_15", boost::make_tuple(3), pie_4_13_15[0], pie_4_13_15[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_16_2_15_0", boost::make_tuple(2), pie_16_2_15_0[0], pie_16_2_15_0[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_20_20_7_100", boost::make_tuple(3), pie_20_20_7_100[0], pie_20_20_7_100[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_23_23_3_2000", boost::make_tuple(5), pie_23_23_3_2000[0], pie_23_23_3_2000[1]);
|
||||
|
||||
|
||||
// line-line
|
||||
test_overlay<linestring, linestring, test_get_turns, Tuple>("lineline1", boost::make_tuple(3, 1.6190476, 3.4761905), line_line1[0], line_line1[1]);
|
||||
test_overlay<linestring, linestring, test_get_turns, Tuple>("lineline1", boost::make_tuple(3), line_line1[0], line_line1[1]);
|
||||
|
||||
// line-polygon
|
||||
test_overlay<linestring, polygon, test_get_turns, Tuple>("line_poly1", boost::make_tuple(4, 1.6190476, 3.4761905), line_line1[0], case_1[1]);
|
||||
test_overlay<linestring, polygon, test_get_turns, Tuple>("line_poly2", boost::make_tuple(4, 1.6190476, 3.4761905), line_line1[1], case_1[0]);
|
||||
test_overlay<polygon, linestring, test_get_turns, Tuple>("poly_line", boost::make_tuple(4, 1.6190476, 3.4761905), case_1[1], line_line1[0]);
|
||||
test_overlay<linestring, polygon, test_get_turns, Tuple>("line_poly1", boost::make_tuple(4), line_line1[0], case_1[1]);
|
||||
test_overlay<linestring, polygon, test_get_turns, Tuple>("line_poly2", boost::make_tuple(4), line_line1[1], case_1[0]);
|
||||
test_overlay<polygon, linestring, test_get_turns, Tuple>("poly_line", boost::make_tuple(4), case_1[1], line_line1[0]);
|
||||
}
|
||||
|
||||
|
||||
@ -283,9 +259,34 @@ template <typename T>
|
||||
void test_ccw()
|
||||
{
|
||||
typedef boost::geometry::point<T, 2, boost::geometry::cs::cartesian> P;
|
||||
typedef boost::geometry::polygon<P, std::vector, std::vector, false> polygon;
|
||||
typedef boost::tuple<int, double, double> Tuple;
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("1", boost::make_tuple(6, 2.2547802, 3.0358056), case_1[0], case_1[1]);
|
||||
typedef boost::geometry::model::polygon<P, false, true> polygon;
|
||||
typedef boost::tuple<int> Tuple;
|
||||
|
||||
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("ccw_1",
|
||||
boost::make_tuple(6),
|
||||
ccw_case_1[0], ccw_case_1[1]);
|
||||
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("ccw_9",
|
||||
boost::make_tuple(1),
|
||||
case_9[0], case_9[1]);
|
||||
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void test_open()
|
||||
{
|
||||
typedef boost::geometry::point<T, 2, boost::geometry::cs::cartesian> P;
|
||||
typedef boost::geometry::model::polygon<P, true, false> polygon;
|
||||
typedef boost::tuple<int> Tuple;
|
||||
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("open_1",
|
||||
boost::make_tuple(6),
|
||||
open_case_1[0], open_case_1[1]);
|
||||
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("open_9",
|
||||
boost::make_tuple(1),
|
||||
open_case_9[0], open_case_9[1]);
|
||||
}
|
||||
|
||||
|
||||
@ -294,7 +295,8 @@ int test_main(int, char* [])
|
||||
{
|
||||
test_all<float>();
|
||||
test_all<double>();
|
||||
//test_ccw<double>();
|
||||
test_ccw<double>();
|
||||
test_open<double>();
|
||||
//test_all<tt>();
|
||||
|
||||
#if ! defined(_MSC_VER)
|
||||
|
File diff suppressed because one or more lines are too long
@ -50,9 +50,11 @@ void test_overlay(std::string const& id, T const& expected,
|
||||
G2 g2;
|
||||
boost::geometry::read_wkt(wkt2, g2);
|
||||
|
||||
//std::cout << boost::geometry::wkt(g1) << std::endl;
|
||||
//std::cout << boost::geometry::wkt(g2) << std::endl;
|
||||
|
||||
// Try the overlay-function in both ways
|
||||
std::string caseid = id + "_1";
|
||||
std::string caseid = id;
|
||||
//goto case_reversed;
|
||||
|
||||
#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
|
||||
@ -65,8 +67,8 @@ void test_overlay(std::string const& id, T const& expected,
|
||||
#endif
|
||||
|
||||
//case_reversed:
|
||||
#if ! defined(BOOST_GEOMETRY_TEST_OVERLAY_NOT_REVERSED)
|
||||
caseid = id + "_2";
|
||||
#if ! defined(BOOST_GEOMETRY_TEST_OVERLAY_NOT_EXCHANGED)
|
||||
caseid = id + "_rev";
|
||||
#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
|
||||
std::cout << std::endl << std::endl << "# " << caseid << std::endl;
|
||||
#endif
|
||||
|
@ -46,6 +46,7 @@
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
@ -20,6 +20,7 @@
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\intersection_pies"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\..\..\boost.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
@ -95,6 +96,7 @@
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\intersection_pies"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\..\..\boost.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
|
@ -20,6 +20,7 @@
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\intersection_stars"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\..\..\boost.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
@ -95,6 +96,7 @@
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\intersection_stars"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\..\..\boost.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
|
@ -20,6 +20,7 @@
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\random_ellipses_stars"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\..\..\boost.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
@ -95,6 +96,7 @@
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\random_ellipses_stars"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\..\..\boost.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="0"
|
||||
>
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include <boost/geometry/geometry.hpp>
|
||||
#include <boost/geometry/multi/multi.hpp>
|
||||
#include <boost/geometry/multi/algorithms/detail/overlay/assemble.hpp>
|
||||
//#include <boost/geometry/multi/algorithms/detail/overlay/assemble.hpp>
|
||||
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
|
||||
#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
|
||||
#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
|
||||
@ -51,13 +51,24 @@ inline void make_box(Polygon& polygon, Generator& generator)
|
||||
bg::set<0>(p, x + 1); bg::set<1>(p, y + 1); ring.push_back(p);
|
||||
bg::set<0>(p, x + 1); bg::set<1>(p, y); ring.push_back(p);
|
||||
bg::set<0>(p, x); bg::set<1>(p, y); ring.push_back(p);
|
||||
|
||||
if (true)
|
||||
{
|
||||
// Remove a point depending on generator
|
||||
int c = generator() % 4;
|
||||
if (c >= 1 && c <= 3)
|
||||
{
|
||||
ring.erase(ring.begin() + c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename MultiPolygon, typename Generator>
|
||||
void test_recursive_boxes(MultiPolygon& result, int& index,
|
||||
Generator& generator, bool svg, int level = 3)
|
||||
bool test_recursive_boxes(MultiPolygon& result, int& index,
|
||||
Generator& generator,
|
||||
bool svg, int level = 3)
|
||||
{
|
||||
namespace bg = boost::geometry;
|
||||
MultiPolygon p, q;
|
||||
@ -72,19 +83,25 @@ void test_recursive_boxes(MultiPolygon& result, int& index,
|
||||
}
|
||||
else
|
||||
{
|
||||
test_recursive_boxes(p, index, generator, svg, level - 1);
|
||||
test_recursive_boxes(q, index, generator, svg, level - 1);
|
||||
if (! test_recursive_boxes(p, index, generator, svg, level - 1)
|
||||
|| ! test_recursive_boxes(q, index, generator, svg, level - 1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
typedef typename boost::range_value<MultiPolygon>::type polygon;
|
||||
|
||||
std::ostringstream out;
|
||||
out << "recursive_box_" << index++ << "_" << level;
|
||||
test_overlay_p_q
|
||||
if (! test_overlay_p_q
|
||||
<
|
||||
polygon,
|
||||
typename bg::coordinate_type<MultiPolygon>::type
|
||||
>(out.str(), p, q, svg, 0.001);
|
||||
>(out.str(), p, q, svg, 0.001))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
MultiPolygon mp;
|
||||
bg::union_inserter
|
||||
@ -92,20 +109,25 @@ void test_recursive_boxes(MultiPolygon& result, int& index,
|
||||
polygon
|
||||
>(p, q, std::back_inserter(mp));
|
||||
|
||||
result = mp;
|
||||
bg::unique(mp);
|
||||
//result = mp;
|
||||
bg::simplify(mp, result, 0.01);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void test_all(int seed, int count, bool svg)
|
||||
void test_all(int seed, int count, bool svg, int level)
|
||||
{
|
||||
boost::timer t;
|
||||
|
||||
typedef boost::minstd_rand base_generator_type;
|
||||
|
||||
boost::uniform_int<> random_coordinate(0, 9);
|
||||
base_generator_type generator(seed);
|
||||
|
||||
boost::uniform_int<> random_coordinate(0, 9);
|
||||
boost::variate_generator<base_generator_type&, boost::uniform_int<> >
|
||||
int_generator(generator, random_coordinate);
|
||||
coordinate_generator(generator, random_coordinate);
|
||||
|
||||
typedef boost::geometry::polygon
|
||||
<
|
||||
@ -117,12 +139,12 @@ void test_all(int seed, int count, bool svg)
|
||||
int index = 0;
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
|
||||
mp p;
|
||||
test_recursive_boxes<mp>(p, index, int_generator, svg);
|
||||
test_recursive_boxes<mp>(p, index, coordinate_generator, svg, level);
|
||||
}
|
||||
std::cout
|
||||
<< "type: " << string_from_type<T>::name()
|
||||
<< "boxes " << index
|
||||
<< " type: " << string_from_type<T>::name()
|
||||
<< " time: " << t.elapsed() << std::endl;
|
||||
}
|
||||
|
||||
@ -135,9 +157,11 @@ int main(int argc, char** argv)
|
||||
? boost::lexical_cast<int>(argv[2])
|
||||
: static_cast<unsigned int>(std::time(0));
|
||||
bool svg = argc > 3 && std::string(argv[3]) == std::string("svg");
|
||||
int level = argc > 4 && std::string(argv[4]) != std::string("#")
|
||||
? boost::lexical_cast<int>(argv[4]): 3;
|
||||
|
||||
//test_all<float>(seed, count, svg, 1e-3);
|
||||
test_all<double>(seed, count, svg);
|
||||
test_all<double>(seed, count, svg, level);
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
//test_recursive_boxes<boost::numeric_adaptor::cln_value_type>("c",
|
||||
|
@ -20,6 +20,7 @@
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\recursive_boxes"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\..\..\boost.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
@ -95,6 +96,7 @@
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\recursive_boxes"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\..\..\boost.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="0"
|
||||
>
|
||||
|
@ -106,18 +106,26 @@ static bool test_overlay_p_q(std::string const& caseid, G1 const& p, G2 const& q
|
||||
mapper.add(p);
|
||||
mapper.add(q);
|
||||
|
||||
mapper.map(p, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
|
||||
mapper.map(q, "opacity:0.6;fill:rgb(0,0,255);stroke:rgb(0,0,0);stroke-width:1");
|
||||
// Input shapes in green/blue
|
||||
mapper.map(p, "fill-opacity:0.5;fill:rgb(153,204,0);"
|
||||
"stroke:rgb(153,204,0);stroke-width:3");
|
||||
mapper.map(q, "fill-opacity:0.3;fill:rgb(51,51,153);"
|
||||
"stroke:rgb(51,51,153);stroke-width:3");
|
||||
|
||||
for (typename std::vector<OutputType>::const_iterator it = out_i.begin();
|
||||
it != out_i.end(); ++it)
|
||||
{
|
||||
mapper.map(*it, "opacity:0.6;fill:none;stroke:rgb(255,0,0);stroke-width:3");
|
||||
//mapper.map(*it, "opacity:0.6;fill:none;stroke:rgb(255,0,0);stroke-width:3");
|
||||
mapper.map(*it, "fill-opacity:0.1;stroke-opacity:0.4;fill:rgb(255,0,0);"
|
||||
"stroke:rgb(255,0,0);stroke-width:4");
|
||||
}
|
||||
for (typename std::vector<OutputType>::const_iterator it = out_u.begin();
|
||||
it != out_u.end(); ++it)
|
||||
{
|
||||
mapper.map(*it, "opacity:0.6;fill:none;stroke:rgb(255,0,255);stroke-width:3");
|
||||
//mapper.map(*it, "opacity:0.6;fill:none;stroke:rgb(255,0,255);stroke-width:3");
|
||||
mapper.map(*it, "fill-opacity:0.1;stroke-opacity:0.4;fill:rgb(255,0,0);"
|
||||
"stroke:rgb(255,0,255);stroke-width:4");
|
||||
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -12,27 +12,26 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#define HAVE_TTMATH
|
||||
|
||||
#ifdef HAVE_TTMATH
|
||||
# include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
|
||||
#endif
|
||||
|
||||
#include <geometry_test_common.hpp>
|
||||
|
||||
//#define HAVE_TTMATH
|
||||
#ifdef HAVE_TTMATH
|
||||
# include <ttmath_stub.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
//#define BOOST_GEOMETRY_DEBUG_ENRICH
|
||||
//#define BOOST_GEOMETRY_DEBUG_RELATIVE_ORDER
|
||||
|
||||
#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
|
||||
#define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
|
||||
|
||||
//#define BOOST_GEOMETRY_DEBUG_OVERLAY_ONLY_ONE
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define BOOST_GEOMETRY_TEST_OVERLAY_NOT_REVERSED
|
||||
//# define BOOST_GEOMETRY_DEBUG_OVERLAY
|
||||
#else
|
||||
//# define BOOST_GEOMETRY_DEBUG_OVERLAY
|
||||
#endif
|
||||
#define BOOST_GEOMETRY_TEST_OVERLAY_NOT_EXCHANGED
|
||||
|
||||
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
|
||||
@ -45,6 +44,7 @@
|
||||
#include <boost/geometry/algorithms/detail/overlay/traverse.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/area.hpp>
|
||||
#include <boost/geometry/algorithms/correct.hpp>
|
||||
|
||||
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
@ -59,12 +59,10 @@
|
||||
template <boost::geometry::detail::overlay::operation_type Direction>
|
||||
struct test_traverse
|
||||
{
|
||||
#if defined(TEST_WITH_SVG)
|
||||
static inline std::string operation(int d)
|
||||
{
|
||||
return d == 1 ? "union" : "intersection";
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename G1, typename G2>
|
||||
static void apply(std::string const& id,
|
||||
@ -72,11 +70,47 @@ struct test_traverse
|
||||
G1 const& g1, G2 const& g2,
|
||||
double precision)
|
||||
{
|
||||
// DEBUG ONE or FEW CASE(S) ONLY
|
||||
//if (! boost::contains(id, "36") || Direction != 1) return;
|
||||
//if (! boost::contains(id, "iet_") || boost::contains(id, "st")) return;
|
||||
//if (! boost::contains(id, "66") || Direction != 1) return;
|
||||
//if (! boost::contains(id, "92") && ! boost::contains(id, "96") ) return;
|
||||
//if (! (boost::contains(id, "58_st") || boost::contains(id, "59_st") || boost::contains(id, "60_st") || boost::contains(id, "83")) ) return;
|
||||
//if (! (boost::contains(id, "81") || boost::contains(id, "82") || boost::contains(id, "84") || boost::contains(id, "85") || boost::contains(id, "68")) ) return;
|
||||
//if (! (boost::contains(id, "81") || boost::contains(id, "86") || boost::contains(id, "88")) ) return;
|
||||
//if (! boost::contains(id, "58_") || Direction != 1) return;
|
||||
//if (! boost::contains(id, "55") || Direction != 1) return;
|
||||
//if (! boost::contains(id, "55_iet_iet") || Direction != 1) return;
|
||||
//if (! boost::contains(id, "55_st_iet") || Direction != 1) return;
|
||||
//if (! boost::contains(id, "55_iet_st") || Direction != 1) return;
|
||||
//if (! boost::contains(id, "54_st_st") || Direction != 1) return;
|
||||
//if (! boost::contains(id, "54_iet_st") || Direction != 1) return;
|
||||
//if (! (boost::contains(id, "54_") || boost::contains(id, "55_")) || Direction != 1) return;
|
||||
//if (Direction != 1) return;
|
||||
// END DEBUG ONE ...
|
||||
|
||||
namespace bg = boost::geometry;
|
||||
|
||||
//std::cout << "TRAVERSE " << id << "(" << int(Direction) << ")" << std::endl;
|
||||
#ifdef BOOST_GEOMETRY_DEBUG_OVERLAY
|
||||
//std::cerr << "TRAVERSE " << id << "(" << Direction << ")" << std::endl;
|
||||
/*** FOR REVERSING ONLY
|
||||
{
|
||||
// If one or both are invalid (e.g. ccw),
|
||||
// they can be corrected by uncommenting this section
|
||||
G1 cg1 = g1;
|
||||
G2 cg2 = g2;
|
||||
bg::correct(cg1);
|
||||
bg::correct(cg2);
|
||||
std::cout << std::setprecision(12)
|
||||
<< bg::wkt(cg1) << std::endl
|
||||
<< bg::wkt(cg2) << std::endl;
|
||||
}
|
||||
***/
|
||||
|
||||
#if defined(BOOST_GEOMETRY_DEBUG_OVERLAY) || defined(BOOST_GEOMETRY_DEBUG_ENRICH)
|
||||
std::cout << std::endl
|
||||
<< "TRAVERSE"
|
||||
<< " " << id
|
||||
<< " " << string_from_type<typename bg::coordinate_type<G1>::type>::name()
|
||||
<< "(" << operation(Direction) << ")" << std::endl;
|
||||
|
||||
//std::cout << bg::area(g1) << " " << bg::area(g2) << std::endl;
|
||||
#endif
|
||||
@ -95,7 +129,10 @@ struct test_traverse
|
||||
|
||||
bg::detail::get_turns::no_interrupt_policy policy;
|
||||
bg::get_turns<bg::detail::overlay::calculate_distance_policy>(g1, g2, turns, policy);
|
||||
bg::enrich_intersection_points(turns, g1, g2, side_strategy_type());
|
||||
bg::enrich_intersection_points(turns,
|
||||
Direction == 1 ? bg::detail::overlay::operation_union
|
||||
: bg::detail::overlay::operation_intersection,
|
||||
g1, g2, side_strategy_type());
|
||||
|
||||
typedef bg::linear_ring<typename bg::point_type<G2>::type> ring_type;
|
||||
typedef std::vector<ring_type> out_vector;
|
||||
@ -118,12 +155,12 @@ struct test_traverse
|
||||
BOOST_FOREACH(ring_type const& ring, v)
|
||||
{
|
||||
total_area += bg::area(ring);
|
||||
//std::cout << bg::wkt(ring) << std::endl;
|
||||
}
|
||||
|
||||
#ifndef HAVE_TTMATH
|
||||
BOOST_CHECK_CLOSE(expected_count_area.get<1>(), double(total_area), precision);
|
||||
#endif
|
||||
|
||||
BOOST_CHECK_CLOSE(expected_count_area.get<1>(),
|
||||
boost::numeric_cast<double>(total_area),
|
||||
precision);
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
{
|
||||
@ -158,65 +195,120 @@ struct test_traverse
|
||||
// Simple map to avoid two texts at same place (note that can still overlap!)
|
||||
std::map<std::pair<int, int>, int> offsets;
|
||||
int index = 0;
|
||||
int const lineheight = 10;
|
||||
int const margin = 5;
|
||||
|
||||
BOOST_FOREACH(turn_info const& turn, turns)
|
||||
{
|
||||
int lineheight = 10;
|
||||
mapper.map(turn.point, "fill:rgb(255,128,0);"
|
||||
"stroke:rgb(0,0,0);stroke-width:1", 3);
|
||||
|
||||
{
|
||||
coordinate_type half = 0.5;
|
||||
coordinate_type ten = 10;
|
||||
// Map characteristics
|
||||
// Create a rounded off point
|
||||
std::pair<int, int> p
|
||||
= std::make_pair(
|
||||
boost::numeric_cast<int>(0.5 + 10 * bg::get<0>(turn.point)),
|
||||
boost::numeric_cast<int>(0.5 + 10 * bg::get<1>(turn.point))
|
||||
boost::numeric_cast<int>(half
|
||||
+ ten * bg::get<0>(turn.point)),
|
||||
boost::numeric_cast<int>(half
|
||||
+ ten * bg::get<1>(turn.point))
|
||||
);
|
||||
std::string style = "fill:rgb(0,0,0);font-family:Arial;font-size:8px";
|
||||
std::string style = "fill:rgb(0,0,0);font-family:Arial;font-size:10px";
|
||||
|
||||
if (turn.discarded)
|
||||
{
|
||||
style = "fill:rgb(92,92,92);font-family:Arial;font-size:6px";
|
||||
lineheight = 6;
|
||||
}
|
||||
|
||||
//if (! turn.is_discarded() && ! turn.blocked() && ! turn.both(bg::detail::overlay::operation_union))
|
||||
//if (! turn.discarded)
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << index
|
||||
<< ": " << bg::operation_char(turn.operations[0].operation)
|
||||
<< " " << bg::operation_char(turn.operations[1].operation)
|
||||
<< " (" << bg::method_char(turn.method) << ")"
|
||||
<< (turn.ignore() ? " (ignore) " : " ")
|
||||
<< ": " << bg::method_char(turn.method)
|
||||
<< std::endl
|
||||
<< "op: " << bg::operation_char(turn.operations[0].operation)
|
||||
<< " / " << bg::operation_char(turn.operations[1].operation)
|
||||
<< (turn.is_discarded() ? " (discarded) " : turn.blocked() ? " (blocked)" : "")
|
||||
<< std::endl;
|
||||
|
||||
<< "ip: " << turn.operations[0].enriched.travels_to_ip_index
|
||||
<< "/" << turn.operations[1].enriched.travels_to_ip_index;
|
||||
|
||||
if (turn.operations[0].enriched.next_ip_index != -1
|
||||
|| turn.operations[1].enriched.next_ip_index != -1)
|
||||
if (turn.operations[0].enriched.next_ip_index != -1)
|
||||
{
|
||||
out << " [" << turn.operations[0].enriched.next_ip_index
|
||||
<< "/" << turn.operations[1].enriched.next_ip_index
|
||||
<< "]"
|
||||
;
|
||||
out << "ip: " << turn.operations[0].enriched.next_ip_index;
|
||||
}
|
||||
else
|
||||
{
|
||||
out << "vx: " << turn.operations[0].enriched.travels_to_vertex_index
|
||||
<< " -> ip: " << turn.operations[0].enriched.travels_to_ip_index;
|
||||
}
|
||||
out << " ";
|
||||
if (turn.operations[1].enriched.next_ip_index != -1)
|
||||
{
|
||||
out << "ip: " << turn.operations[1].enriched.next_ip_index;
|
||||
}
|
||||
else
|
||||
{
|
||||
out << "vx: " << turn.operations[1].enriched.travels_to_vertex_index
|
||||
<< " -> ip: " << turn.operations[1].enriched.travels_to_ip_index;
|
||||
}
|
||||
|
||||
out << std::endl;
|
||||
|
||||
|
||||
out
|
||||
<< "vx:" << turn.operations[0].enriched.travels_to_vertex_index
|
||||
<< "/" << turn.operations[1].enriched.travels_to_vertex_index
|
||||
<< std::endl
|
||||
/*out
|
||||
|
||||
<< std::setprecision(3)
|
||||
<< "dist: " << turn.operations[0].enriched.distance
|
||||
<< " / " << turn.operations[1].enriched.distance
|
||||
<< "dist: " << boost::numeric_cast<double>(turn.operations[0].enriched.distance)
|
||||
<< " / " << boost::numeric_cast<double>(turn.operations[1].enriched.distance)
|
||||
<< std::endl
|
||||
|
||||
<< "vis: " << bg::visited_char(turn.operations[0].visited)
|
||||
<< " / " << bg::visited_char(turn.operations[1].visited);
|
||||
*/
|
||||
|
||||
offsets[p] += lineheight;
|
||||
int offset = offsets[p];
|
||||
offsets[p] += lineheight * 5;
|
||||
mapper.text(turn.point, out.str(), style, margin, offset, lineheight);
|
||||
/*
|
||||
out << index
|
||||
<< ": " << bg::operation_char(turn.operations[0].operation)
|
||||
<< " " << bg::operation_char(turn.operations[1].operation)
|
||||
<< " (" << bg::method_char(turn.method) << ")"
|
||||
<< (turn.ignore() ? " (ignore) " : " ")
|
||||
<< std::endl
|
||||
|
||||
<< "ip: " << turn.operations[0].enriched.travels_to_ip_index
|
||||
<< "/" << turn.operations[1].enriched.travels_to_ip_index;
|
||||
|
||||
if (turn.operations[0].enriched.next_ip_index != -1
|
||||
|| turn.operations[1].enriched.next_ip_index != -1)
|
||||
{
|
||||
out << " [" << turn.operations[0].enriched.next_ip_index
|
||||
<< "/" << turn.operations[1].enriched.next_ip_index
|
||||
<< "]"
|
||||
;
|
||||
}
|
||||
out << std::endl;
|
||||
|
||||
|
||||
out
|
||||
<< "vx:" << turn.operations[0].enriched.travels_to_vertex_index
|
||||
<< "/" << turn.operations[1].enriched.travels_to_vertex_index
|
||||
<< std::endl
|
||||
|
||||
<< std::setprecision(3)
|
||||
<< "dist: " << turn.operations[0].enriched.distance
|
||||
<< " / " << turn.operations[1].enriched.distance
|
||||
<< std::endl
|
||||
*/
|
||||
|
||||
|
||||
|
||||
offsets[p] += lineheight;
|
||||
int offset = offsets[p];
|
||||
offsets[p] += lineheight * 3;
|
||||
mapper.text(turn.point, out.str(), style, margin, offset, lineheight);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -226,44 +318,16 @@ struct test_traverse
|
||||
|
||||
#if ! defined(BOOST_GEOMETRY_TEST_MULTI)
|
||||
template <typename T>
|
||||
void test_all()
|
||||
void test_all(bool test_self_tangencies = true, bool test_mixed = false)
|
||||
{
|
||||
namespace bg = boost::geometry;
|
||||
using namespace boost::geometry::detail::overlay;
|
||||
|
||||
typedef bg::point<T, 2, bg::cs::cartesian> P;
|
||||
typedef bg::polygon<P> polygon;
|
||||
typedef bg::model::polygon<P> polygon;
|
||||
typedef bg::box<P> box;
|
||||
typedef boost::tuple<int, double> Tuple;
|
||||
|
||||
|
||||
std::cout << std::setprecision(10);
|
||||
|
||||
#ifdef BOOST_GEOMETRY_DEBUG_OVERLAY_ONLY_ONE
|
||||
{
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("dz_2",
|
||||
boost::make_tuple(2, 68.678921274288541), dz_2[0], dz_2[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("dz_2",
|
||||
boost::make_tuple(2, 1505.4202304878663), dz_2[0], dz_2[1]);
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
|
||||
/*
|
||||
// SNL problem
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("snl-3",
|
||||
boost::make_tuple(1, 99),
|
||||
"POLYGON((184913.4512400339881423860788345336914 606985.779408219968900084495544433594,184912.8999999999941792339086532592773 606987.145999999949708580970764160156,184904.4135310589917935431003570556641 606987.651360383024439215660095214844,184901.847619076987029984593391418457 607014.593436188995838165283203125,184916.3977574919990729540586471557617 607021.060164373018778860569000244141,184927.7147701499925460666418075561523 607008.126435620011761784553527832031,184926.0980706939881201833486557006836 606998.426238880958408117294311523438,184913.4512400339881423860788345336914 606985.779408219968900084495544433594),(184907.5560000000114087015390396118164 607013.300999999977648258209228515625,184905.7820000000065192580223083496094 607009.971999999950639903545379638672,184906.0039999999862629920244216918945 607005.978000000002793967723846435547,184908.4439999999885912984609603881836 606998.876999999978579580783843994141,184912.2149999999965075403451919555664 606994.217999999993480741977691650391,184919.3140000000130385160446166992188 606993.996000000042840838432312011719,184922.4200000000128056854009628295898 606995.770999999949708580970764160156,184925.7470000000030267983675003051758 606998.876999999978579580783843994141,184926.4130000000004656612873077392578 607002.871999999973922967910766601563,184925.7470000000030267983675003051758 607007.753000000026077032089233398438,184922.4200000000128056854009628295898 607012.190999999991618096828460693359,184917.0959999999904539436101913452148 607015.297999999951571226119995117188,184911.7710000000079162418842315673828 607015.297999999951571226119995117188,184907.5560000000114087015390396118164 607013.300999999977648258209228515625))",
|
||||
"POLYGON((184861.1180000010062940418720245361328 606901.158000000054016709327697753906,184893.7870000000111758708953857421875 606898.482999998959712684154510498047,184925.0430000009946525096893310546875 606913.399999998975545167922973632813,184927.1739999990095384418964385986328 606951.758999999961815774440765380859,184912.8999999990046489983797073364258 606987.146000002045184373855590820313,184877.8700000010139774531126022338867 606989.232000001007691025733947753906,184885.1030000000027939677238464355469 607023.773999999975785613059997558594,184899.0579999980109278112649917602539 607022.743000000948086380958557128906,184906.0080000009911600500345230102539 607044.947999999043531715869903564453,184966.4649999999965075403451919555664 607025.020000000018626451492309570313,184968.4420000019890721887350082397461 606961.300000000977888703346252441406,185024.7679999989923089742660522460938 606947.401999998954124748706817626953,185024.5439999999944120645523071289063 606941.354999999981373548507690429688,185027.0069999989937059581279754638672 606937.322999999043531715869903564453,185030.3660000000090803951025009155273 606934.186999998986721038818359375,185035.5159999990137293934822082519531 606933.962999999988824129104614257813,185040.4420000019890721887350082397461 606935.530999999027699232101440429688,185042.905000000988366082310676574707 606939.114999998011626303195953369141,185088.3640000000013969838619232177734 606931.385000001988373696804046630859,185089.1389999990060459822416305541992 607015.508999999961815774440765380859,185095.1999999989930074661970138549805 607011.300000000977888703346252441406,185118.8269999999902211129665374755859 606995.545000002020969986915588378906,185126.813000001013278961181640625 606991.9950000010430812835693359375,185177.7270000019925646483898162841797 606973.798999998951330780982971191406,185181.4820000010076910257339477539063 606966.67599999904632568359375,185193.5709999990067444741725921630859 606977.795000002020969986915588378906,185193.710999998991610482335090637207 606960.300000000977888703346252441406,185189.3520000019925646483898162841797 606779.020000000018626451492309570313,185167.5150000010035000741481781005859 606783.844000000972300767898559570313,185086.9600000010104849934577941894531 606801.241000000038184225559234619141,185011.7069999990053474903106689453125 606817.809000000008381903171539306641,185000 606819.304000001051463186740875244141,184994.0340000019932631403207778930664 606819.793999999994412064552307128906,184976.3979999980074353516101837158203 606819.572000000975094735622406005859,184956.6539999989909119904041290283203 606817.1310000009834766387939453125,184934.9129999990109354257583618164063 606813.136999998008832335472106933594,184893.0969999989902134984731674194336 606804.927000000956468284130096435547,184884.4450000000069849193096160888672 606831.555000000051222741603851318359,184866.9189999999944120645523071289063 606883.480999998981133103370666503906,184861.1180000010062940418720245361328 606901.158000000054016709327697753906),(184907.5560000019904691725969314575195 607013.30099999904632568359375,184905.7820000019855797290802001953125 607009.971999999019317328929901123047,184906.0040000010048970580101013183594 607005.978000000002793967723846435547,184908.4439999980095308274030685424805 606998.876999999978579580783843994141,184912.2149999999965075403451919555664 606994.217999998014420270919799804688,184919.3139999989944044500589370727539 606993.995999998995102941989898681641,184922.420000001991866156458854675293 606995.771000002045184373855590820313,184925.7470000009925570338964462280273 606998.876999999978579580783843994141,184926.4129999990109354257583618164063 607002.872000001021660864353179931641,184925.7470000009925570338964462280273 607007.752999998978339135646820068359,184922.420000001991866156458854675293 607012.190999999991618096828460693359,184917.0960000010090880095958709716797 607015.297999999951571226119995117188,184911.7710000019869767129421234130859 607015.297999999951571226119995117188,184907.5560000019904691725969314575195 607013.30099999904632568359375))");
|
||||
|
||||
return;
|
||||
*/
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("49b", boost::make_tuple(1, 15), case_49[0], case_49[1]);
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("55c", boost::make_tuple(3, 18), case_55[0], case_55[1]);
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("55c", boost::make_tuple(1, 2), case_55[0], case_55[1]);
|
||||
//return;
|
||||
|
||||
|
||||
// 1-6
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("1", boost::make_tuple(1, 5.4736), case_1[0], case_1[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("2", boost::make_tuple(1, 12.0545), case_2[0], case_2[1]);
|
||||
@ -320,7 +384,7 @@ void test_all()
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("41", boost::make_tuple(1, 5), case_41[0], case_41[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("42", boost::make_tuple(1, 5), case_42[0], case_42[1]);
|
||||
|
||||
// 43-48
|
||||
// 43-48 - invalid polygons
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("43", boost::make_tuple(2, 0.75), case_43[0], case_43[1]);
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("44", boost::make_tuple(1, 44), case_44[0], case_44[1]);
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("45", boost::make_tuple(1, 45), case_45[0], case_45[1]);
|
||||
@ -332,23 +396,75 @@ void test_all()
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("50", boost::make_tuple(0, 0), case_50[0], case_50[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("51", boost::make_tuple(0, 0), case_51[0], case_51[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("52", boost::make_tuple(1, 10.5), case_52[0], case_52[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("53a", boost::make_tuple(0, 0), case_53[0], case_53[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("53b", boost::make_tuple(0, 0), case_53[0], case_53[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("54aa", boost::make_tuple(1, 2), case_54[0], case_54[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("54ab", boost::make_tuple(1, 2), case_54[0], case_54[3]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("54ba", boost::make_tuple(1, 2), case_54[1], case_54[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("54bb", boost::make_tuple(1, 2), case_54[1], case_54[3]);
|
||||
if (test_self_tangencies)
|
||||
{
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("53_st", boost::make_tuple(0, 0), case_53[0], case_53[1]);
|
||||
}
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("53_iet", boost::make_tuple(0, 0), case_53[0], case_53[2]);
|
||||
|
||||
// 55-60
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("55", boost::make_tuple(1, 2), case_55[0], case_55[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("56", boost::make_tuple(2, 4.5), case_56[0], case_56[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("54_iet_iet", boost::make_tuple(1, 2), case_54[1], case_54[3]);
|
||||
if (test_self_tangencies)
|
||||
{
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("54_st_iet", boost::make_tuple(1, 2), case_54[0], case_54[3]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("54_iet_st", boost::make_tuple(1, 2), case_54[1], case_54[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("54_st_st", boost::make_tuple(1, 2), case_54[0], case_54[2]);
|
||||
}
|
||||
|
||||
if (test_self_tangencies)
|
||||
{
|
||||
// 55-60
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("55_st_st", boost::make_tuple(1, 2), case_55[0], case_55[2]);
|
||||
}
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("55_st_iet", boost::make_tuple(1, 2), case_55[0], case_55[3]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("55_iet_st", boost::make_tuple(1, 2), case_55[1], case_55[2]);
|
||||
if (test_self_tangencies)
|
||||
{
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("56", boost::make_tuple(2, 4.5), case_56[0], case_56[1]);
|
||||
}
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("55_iet_iet", boost::make_tuple(1, 2), case_55[1], case_55[3]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("57", boost::make_tuple(2, 5.9705882), case_57[0], case_57[1]);
|
||||
|
||||
if (test_self_tangencies)
|
||||
{
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("58_st",
|
||||
boost::make_tuple(2, 0.333333),
|
||||
case_58[0], case_58[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("59_st",
|
||||
boost::make_tuple(2, 1.5416667),
|
||||
case_59[0], case_59[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("60_st",
|
||||
boost::make_tuple(3, 2),
|
||||
case_60[0], case_60[1]);
|
||||
}
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("58_iet",
|
||||
boost::make_tuple(2, 0.333333),
|
||||
case_58[0], case_58[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("59_iet",
|
||||
boost::make_tuple(2, 1.5416667),
|
||||
case_59[0], case_59[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("60_iet",
|
||||
boost::make_tuple(3, 2),
|
||||
case_60[0], case_60[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("61_st",
|
||||
boost::make_tuple(0, 0),
|
||||
case_61[0], case_61[1]);
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("70",
|
||||
boost::make_tuple(2, 4),
|
||||
case_70[0], case_70[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("71",
|
||||
boost::make_tuple(2, 2),
|
||||
case_71[0], case_71[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("72",
|
||||
boost::make_tuple(3, 2.85),
|
||||
case_72[0], case_72[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("79",
|
||||
boost::make_tuple(2, 20),
|
||||
case_79[0], case_79[1]);
|
||||
|
||||
// other
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("collinear_overlaps", boost::make_tuple(1, 24), collinear_overlaps[0], collinear_overlaps[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("many_situations", boost::make_tuple(1, 184), case_many_situations[0], case_many_situations[1]);
|
||||
|
||||
|
||||
// pies (went wrong when not all cases where implemented, especially some collinear (opposite) cases
|
||||
@ -379,7 +495,7 @@ void test_all()
|
||||
// 7-12
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("7", boost::make_tuple(1, 9), case_7[0], case_7[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("8", boost::make_tuple(1, 12), case_8[0], case_8[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("9", boost::make_tuple(0, 0), case_9[0], case_9[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("9", boost::make_tuple(0, 0 /*UU 2, 11*/), case_9[0], case_9[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("10", boost::make_tuple(1, 9), case_10[0], case_10[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("11", boost::make_tuple(1, 8), case_11[0], case_11[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("12", boost::make_tuple(2, 8.36667), case_12[0], case_12[1]);
|
||||
@ -396,31 +512,31 @@ void test_all()
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("19", boost::make_tuple(1, 10), case_19[0], case_19[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("20", boost::make_tuple(1, 5.5), case_20[0], case_20[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("21", boost::make_tuple(0, 0), case_21[0], case_21[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("22", boost::make_tuple(0, 0), case_22[0], case_22[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("22", boost::make_tuple(0, 0 /*UU 2, 9.5*/), case_22[0], case_22[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("23", boost::make_tuple(1, 6.1), case_23[0], case_23[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("24", boost::make_tuple(1, 5.5), case_24[0], case_24[1]);
|
||||
|
||||
// 25-30
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("25", boost::make_tuple(0, 0), case_25[0], case_25[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("26", boost::make_tuple(0, 0), case_26[0], case_26[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("25", boost::make_tuple(0, 0 /*UU 2, 7*/), case_25[0], case_25[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("26", boost::make_tuple(0, 0 /*UU 2, 7.5 */), case_26[0], case_26[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("27", boost::make_tuple(1, 8.04545), case_27[0], case_27[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("28", boost::make_tuple(1, 10.04545), case_28[0], case_28[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("29", boost::make_tuple(1, 8.1), case_29[0], case_29[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("30", boost::make_tuple(1, 6.5), case_30[0], case_30[1]);
|
||||
|
||||
// 31-36
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("31", boost::make_tuple(0, 0), case_31[0], case_31[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("32", boost::make_tuple(0, 0), case_32[0], case_32[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("33", boost::make_tuple(0, 0), case_33[0], case_33[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("31", boost::make_tuple(0, 0 /*UU 2, 4.5 */), case_31[0], case_31[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("32", boost::make_tuple(0, 0 /*UU 2, 4.5 */), case_32[0], case_32[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("33", boost::make_tuple(0, 0 /*UU 2, 4.5 */), case_33[0], case_33[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("34", boost::make_tuple(1, 6.0), case_34[0], case_34[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("35", boost::make_tuple(1, 10.5), case_35[0], case_35[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("36", boost::make_tuple(1, 14.375), case_36[0], case_36[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("36", boost::make_tuple(1 /*UU 2*/, 14.375), case_36[0], case_36[1]);
|
||||
|
||||
// 37-42
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("37", boost::make_tuple(1, 7.33333), case_37[0], case_37[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("38", boost::make_tuple(1, 9.52857), case_38[0], case_38[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("39", boost::make_tuple(1, 40.0), case_39[0], case_39[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("40", boost::make_tuple(0, 0), case_40[0], case_40[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("40", boost::make_tuple(0, 0 /*UU 2, 11 */), case_40[0], case_40[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("41", boost::make_tuple(1, 5), case_41[0], case_41[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("42", boost::make_tuple(1, 5), case_42[0], case_42[1]);
|
||||
|
||||
@ -436,29 +552,95 @@ void test_all()
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("50", boost::make_tuple(1, 25), case_50[0], case_50[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("51", boost::make_tuple(0, 0), case_51[0], case_51[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("52", boost::make_tuple(1, 15.5), case_52[0], case_52[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("53a", boost::make_tuple(2, 16), case_53[0], case_53[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("53b", boost::make_tuple(2, 16), case_53[0], case_53[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("54aa", boost::make_tuple(2, 20), case_54[0], case_54[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("54ab", boost::make_tuple(2, 20), case_54[0], case_54[3]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("54ba", boost::make_tuple(2, 20), case_54[1], case_54[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("54bb", boost::make_tuple(2, 20), case_54[1], case_54[3]);
|
||||
if (test_self_tangencies)
|
||||
{
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("53_st", boost::make_tuple(2, 16), case_53[0], case_53[1]);
|
||||
}
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("53_iet",
|
||||
boost::make_tuple(2, 16),
|
||||
case_53[0], case_53[2]);
|
||||
if (test_self_tangencies)
|
||||
{
|
||||
// The st_st version might generate one ring with area zero, which is OK
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("54_st_st", boost::make_tuple(3, 20), case_54[0], case_54[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("54_st_iet", boost::make_tuple(2, 20), case_54[0], case_54[3]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("54_iet_st", boost::make_tuple(2, 20), case_54[1], case_54[2]);
|
||||
}
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("54_iet_iet", boost::make_tuple(2, 20), case_54[1], case_54[3]);
|
||||
|
||||
if (test_mixed)
|
||||
{
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("55_st_iet", boost::make_tuple(2, 18), case_55[0], case_55[3]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("55_iet_st", boost::make_tuple(2, 18), case_55[1], case_55[2]);
|
||||
// moved to mixed
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("55_iet_iet", boost::make_tuple(3, 18), case_55[1], case_55[3]);
|
||||
}
|
||||
|
||||
// 55-60
|
||||
// 55 is going wrong!
|
||||
// TODO: implement "node" behaviour which merges nodes
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("55", boost::make_tuple(3, 18), case_55[0], case_55[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("56", boost::make_tuple(2, 14), case_56[0], case_56[1]);
|
||||
if (test_self_tangencies)
|
||||
{
|
||||
// 55 with both input polygons having self tangencies (st_st) generates 1 correct shape
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("55_st_st", boost::make_tuple(1, 18), case_55[0], case_55[2]);
|
||||
// 55 with one of them self-tangency, other int/ext ring tangency generate 2 correct shapes
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("56", boost::make_tuple(2, 14), case_56[0], case_56[1]);
|
||||
}
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("57", boost::make_tuple(1, 14.029412), case_57[0], case_57[1]);
|
||||
|
||||
if (test_self_tangencies)
|
||||
{
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("58_st",
|
||||
boost::make_tuple(4, 12.16666),
|
||||
case_58[0], case_58[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("59_st",
|
||||
boost::make_tuple(2, 17.208333),
|
||||
case_59[0], case_59[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("60_st",
|
||||
boost::make_tuple(3, 19),
|
||||
case_60[0], case_60[1]);
|
||||
}
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("58_iet",
|
||||
boost::make_tuple( 4, 12.16666),
|
||||
case_58[0], case_58[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("59_iet",
|
||||
boost::make_tuple(1, -3.791666), // 2, 17.208333), outer ring (ii/ix) is done by ASSEMBLE
|
||||
case_59[0], case_59[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("60_iet",
|
||||
boost::make_tuple(3, 19),
|
||||
case_60[0], case_60[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("61_st",
|
||||
boost::make_tuple(1, 4),
|
||||
case_61[0], case_61[1]);
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("70",
|
||||
boost::make_tuple(1, 9),
|
||||
case_70[0], case_70[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("71",
|
||||
boost::make_tuple(2, 9),
|
||||
case_71[0], case_71[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("72",
|
||||
boost::make_tuple(1, 10.65),
|
||||
case_72[0], case_72[1]);
|
||||
|
||||
|
||||
|
||||
// other
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("collinear_overlaps",
|
||||
boost::make_tuple(1, 24),
|
||||
collinear_overlaps[0], collinear_overlaps[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("collinear_overlaps",
|
||||
boost::make_tuple(1, 50), collinear_overlaps[0], collinear_overlaps[1]);
|
||||
boost::make_tuple(1, 50),
|
||||
collinear_overlaps[0], collinear_overlaps[1]);
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("many_situations", boost::make_tuple(1, 184), case_many_situations[0], case_many_situations[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("many_situations",
|
||||
boost::make_tuple(1, 207), case_many_situations[0], case_many_situations[1]);
|
||||
|
||||
|
||||
// pies (went wrong when not all cases where implemented, especially some collinear (opposite) cases
|
||||
// From "intersection piets", robustness test.
|
||||
// This all went wrong in the past
|
||||
// (when not all cases (get_turns) where implemented,
|
||||
// especially important are some collinear (opposite) cases)
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("pie_16_4_12",
|
||||
boost::make_tuple(1, 3669665.5), pie_16_4_12[0], pie_16_4_12[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("pie_23_21_12_500",
|
||||
@ -474,103 +656,205 @@ void test_all()
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("pie_20_20_7_100",
|
||||
boost::make_tuple(1, 5577158.72823), pie_20_20_7_100[0], pie_20_20_7_100[1]);
|
||||
|
||||
static const bool is_float
|
||||
= boost::is_same<T, float>::value;
|
||||
static const bool is_double
|
||||
= boost::is_same<T, double>::value
|
||||
|| boost::is_same<T, long double>::value;
|
||||
|
||||
// From "Random Ellipse Stars", this all went wrong
|
||||
static const double float_might_deviate_more = is_float ? 0.1 : 0.001; // In some cases up to 1 promille permitted
|
||||
|
||||
// GCC: does not everywhere handle float correctly (in our algorithms)
|
||||
bool const is_float_on_non_msvc =
|
||||
#if defined(_MSC_VER)
|
||||
false;
|
||||
#else
|
||||
is_float;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// From "Random Ellipse Stars", robustness test.
|
||||
// This all went wrong in the past
|
||||
// when using Determinant/ra/rb and comparing with 0/1
|
||||
// Solved now.
|
||||
// Solved now by avoiding determinant / using sides
|
||||
// ("hv" means "high volume")
|
||||
{
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv1", boost::make_tuple(1, 1624.508688461573), hv_1[0], hv_1[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv1", boost::make_tuple(1, 1622.7200125123809), hv_1[0], hv_1[1], 0.1);
|
||||
double deviation = is_float ? 0.01 : 0.001;
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv1", boost::make_tuple(1, 1624.508688461573), hv_1[0], hv_1[1], deviation);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv1", boost::make_tuple(1, 1622.7200125123809), hv_1[0], hv_1[1], deviation);
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv2", boost::make_tuple(1, 1622.9193392726836), hv_2[0], hv_2[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv2", boost::make_tuple(1, 1622.1733591429329), hv_2[0], hv_2[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv2", boost::make_tuple(1, 1622.9193392726836), hv_2[0], hv_2[1], deviation);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv2", boost::make_tuple(1, 1622.1733591429329), hv_2[0], hv_2[1], deviation);
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv3", boost::make_tuple(1, 1624.22079205664), hv_3[0], hv_3[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv3", boost::make_tuple(1, 1623.8265057282042), hv_3[0], hv_3[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv3", boost::make_tuple(1, 1624.22079205664), hv_3[0], hv_3[1], deviation);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv3", boost::make_tuple(1, 1623.8265057282042), hv_3[0], hv_3[1], deviation);
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv4", boost::make_tuple(1, 1626.5146964146334), hv_4[0], hv_4[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv4", boost::make_tuple(1, 1626.2580370864305), hv_4[0], hv_4[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv4", boost::make_tuple(1, 1626.5146964146334), hv_4[0], hv_4[1], deviation);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv4", boost::make_tuple(1, 1626.2580370864305), hv_4[0], hv_4[1], deviation);
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv5", boost::make_tuple(1, 1624.2158307261871), hv_5[0], hv_5[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv5", boost::make_tuple(1, 1623.4506071521519), hv_5[0], hv_5[1], 0.1);
|
||||
if (! is_float)
|
||||
{
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv5", boost::make_tuple(1, 1624.2158307261871), hv_5[0], hv_5[1], deviation);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv5", boost::make_tuple(1, 1623.4506071521519), hv_5[0], hv_5[1], deviation);
|
||||
|
||||
// Case 2009-12-07
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv6", boost::make_tuple(1, 1604.6318757402121), hv_6[0], hv_6[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv6", boost::make_tuple(1, 1790.091872401327), hv_6[0], hv_6[1], 0.1);
|
||||
// Case 2009-12-07
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv6", boost::make_tuple(1, 1604.6318757402121), hv_6[0], hv_6[1], deviation);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv6", boost::make_tuple(1, 1790.091872401327), hv_6[0], hv_6[1], deviation);
|
||||
|
||||
// Case 2009-12-08, needing sorting on side in enrich_intersection_points
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv7", boost::make_tuple(1, 1624.5779453641017), hv_7[0], hv_7[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv7", boost::make_tuple(1, 1623.6936420295772), hv_7[0], hv_7[1], 0.1);
|
||||
// Case 2009-12-08, needing sorting on side in enrich_intersection_points
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv7", boost::make_tuple(1, 1624.5779453641017), hv_7[0], hv_7[1], deviation);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv7", boost::make_tuple(1, 1623.6936420295772), hv_7[0], hv_7[1], deviation);
|
||||
}
|
||||
}
|
||||
|
||||
// From "Random Ellipse Stars", this all went wrong
|
||||
// when distances was zero (dz)
|
||||
// From "Random Ellipse Stars", robustness test.
|
||||
// This all went wrong in the past when distances (see below) were zero (dz)
|
||||
// "Distance zero", dz, means: the distance between two intersection points
|
||||
// on a same segment is 0, therefore it can't be sorted normally, therefore
|
||||
// the chance is 50% that the segments are not sorted correctly and the wrong
|
||||
// decision is taken.
|
||||
// Solved (by sorting on sides instead of on distance)
|
||||
// Solved now (by sorting on sides in those cases)
|
||||
{
|
||||
// distance-zero-1
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("dz_1",
|
||||
boost::make_tuple(3, 16.887537949472005), dz_1[0], dz_1[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("dz_1",
|
||||
boost::make_tuple(3, 1444.2621305732864), dz_1[0], dz_1[1]);
|
||||
|
||||
// distance-zero-2
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("dz_2",
|
||||
boost::make_tuple(2, 68.678921274288541), dz_2[0], dz_2[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("dz_2",
|
||||
boost::make_tuple(2, 1505.4202304878663), dz_2[0], dz_2[1]);
|
||||
|
||||
// distance-zero-3
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("dz_3",
|
||||
boost::make_tuple(6, 192.49316937645651), dz_3[0], dz_3[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("dz_3",
|
||||
boost::make_tuple(6, 1446.496005965641), dz_3[0], dz_3[1]);
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("dz_4",
|
||||
boost::make_tuple(1, 473.59423868207693), dz_4[0], dz_4[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("dz_4",
|
||||
boost::make_tuple(1, 1871.6125138873476), dz_4[0], dz_4[1]);
|
||||
}
|
||||
|
||||
// Real-life problems
|
||||
|
||||
// SNL (Subsidiestelsel Natuur & Landschap - verAANnen)
|
||||
|
||||
if (! is_float_on_non_msvc)
|
||||
{
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("snl-1",
|
||||
boost::make_tuple(2, 286.996062095888),
|
||||
snl_1[0], snl_1[1],
|
||||
float_might_deviate_more);
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("snl-1",
|
||||
boost::make_tuple(2, 51997.5408506132),
|
||||
snl_1[0], snl_1[1],
|
||||
float_might_deviate_more);
|
||||
}
|
||||
|
||||
{
|
||||
// Note: values are checked with SQL Server,
|
||||
/*
|
||||
select geometry::STGeomFromText('POLYGON((...))', 0)
|
||||
.STIntersection(geometry::STGeomFromText('...))', 0))
|
||||
.STArea()
|
||||
|
||||
and STUnion
|
||||
*/
|
||||
|
||||
// Boost.List during Formal Review, isovists Brandon
|
||||
// For FP, they may deviate more.
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("isov",
|
||||
boost::make_tuple(1, 88.1920416352664), isovist[0], isovist[1],
|
||||
float_might_deviate_more);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("isov",
|
||||
boost::make_tuple(1, 313.360374193241), isovist[0], isovist[1],
|
||||
float_might_deviate_more);
|
||||
}
|
||||
|
||||
// GEOS tests
|
||||
if (! is_float)
|
||||
{
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("geos_1_test_overlay",
|
||||
boost::make_tuple(1, 3461.02330171138), geos_1_test_overlay[0], geos_1_test_overlay[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("geos_1_test_overlay",
|
||||
boost::make_tuple(1, 3461.31592235516), geos_1_test_overlay[0], geos_1_test_overlay[1]);
|
||||
|
||||
if (! is_double)
|
||||
{
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("geos_2",
|
||||
boost::make_tuple(2, 2.155655988e-6), // by bg/ttmath; sql server reports: 2.20530228034477E-06
|
||||
geos_2[0], geos_2[1]);
|
||||
}
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("geos_2",
|
||||
boost::make_tuple(1, 350.550662845485),
|
||||
geos_2[0], geos_2[1]);
|
||||
}
|
||||
|
||||
if (! is_float && ! is_double)
|
||||
{
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("geos_3",
|
||||
boost::make_tuple(1, 2.484885e-7),
|
||||
geos_3[0], geos_3[1]);
|
||||
}
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("geos_3",
|
||||
boost::make_tuple(1, 29391548.5),
|
||||
geos_3[0], geos_3[1],
|
||||
float_might_deviate_more);
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("geos_4",
|
||||
boost::make_tuple(1, 0.0836884926070727),
|
||||
geos_4[0], geos_4[1],
|
||||
is_float_on_non_msvc ? 3.0 : float_might_deviate_more);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("geos_4",
|
||||
boost::make_tuple(1, 2304.41633605957),
|
||||
geos_4[0], geos_4[1]);
|
||||
|
||||
|
||||
return;
|
||||
|
||||
// They still have errors
|
||||
// Cases below still have errors
|
||||
|
||||
// ticket#17
|
||||
test_overlay<polygon, box, test_traverse<operation_intersection>, Tuple>("ticket_17", boost::make_tuple(2, 2.687433027e-006), ticket_17[0], ticket_17[1], 0.1);
|
||||
test_overlay<polygon, box, test_traverse<operation_union>, Tuple>("ticket_17", boost::make_tuple(3, 0.00922511561516), ticket_17[0], ticket_17[1], 0.1);
|
||||
test_overlay<polygon, box, test_traverse<operation_intersection>, Tuple>("ticket_17", boost::make_tuple(2, 2.687433027e-006),
|
||||
ticket_17[0], ticket_17[1], 0.1);
|
||||
test_overlay<polygon, box, test_traverse<operation_union>, Tuple>("ticket_17", boost::make_tuple(3, 0.00922511561516),
|
||||
ticket_17[0], ticket_17[1], 0.1);
|
||||
}
|
||||
|
||||
// Boost.List during Formal Review, isovists Brandon
|
||||
// For FP, they may deviate more.
|
||||
/***
|
||||
static const bool is_float = string_from_type<T>::name() == std::string("f");
|
||||
static const bool is_double = string_from_type<T>::name() == std::string("d");
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("isov",
|
||||
boost::make_tuple(1, 88.19203119), isovist[0], isovist[1],
|
||||
is_float || is_double ? 1.0 : 0.01);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("isov",
|
||||
boost::make_tuple(1, 313.3603646234), isovist[0], isovist[1],
|
||||
is_float || is_double ? 1.0 : 0.01);
|
||||
***/
|
||||
template <typename T>
|
||||
void test_open()
|
||||
{
|
||||
namespace bg = boost::geometry;
|
||||
using namespace boost::geometry::detail::overlay;
|
||||
|
||||
typedef bg::point<T, 2, bg::cs::cartesian> P;
|
||||
typedef bg::model::polygon<P, true, false> polygon;
|
||||
typedef boost::tuple<int, double> Tuple;
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("open_1", boost::make_tuple(1, 5.4736),
|
||||
open_case_1[0], open_case_1[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("open_1", boost::make_tuple(1, 11.5264),
|
||||
open_case_1[0], open_case_1[1]);
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
//test_all<float>();
|
||||
test_all<float>();
|
||||
test_all<double>();
|
||||
#ifdef HAVE_TTMATH
|
||||
test_all<tt>();
|
||||
#endif
|
||||
test_open<double>();
|
||||
|
||||
#if ! defined(_MSC_VER)
|
||||
test_all<long double>();
|
||||
#endif
|
||||
#if defined(HAVE_CLN)
|
||||
test_all<boost::numeric_adaptor::cln_value_type>();
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
test_all<boost::numeric_adaptor::gmp_value_type>();
|
||||
|
||||
#ifdef HAVE_TTMATH
|
||||
test_all<ttmath_big>();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;../../../../..;../.."
|
||||
AdditionalIncludeDirectories=".;../../../../..;../..;../../../../../boost/geometry/extensions/contrib/ttmath"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;TEST_WITH_SVG"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="1"
|
||||
@ -114,7 +114,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=".;../../../../..;../.."
|
||||
AdditionalIncludeDirectories=".;../../../../..;../..;../../../../../boost/geometry/extensions/contrib/ttmath"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
|
@ -57,7 +57,7 @@ void test_with_other_calculation_type(Geometry const& geometry, Point& c1)
|
||||
// Calculate it with user defined strategy
|
||||
point_type c2;
|
||||
boost::geometry::centroid(geometry, c2,
|
||||
boost::geometry::strategy::centroid_::bashein_detmer<point_type, point_type, CalculationType>());
|
||||
boost::geometry::strategy::centroid::bashein_detmer<point_type, point_type, CalculationType>());
|
||||
|
||||
std::cout << typeid(CalculationType).name() << ": " << std::setprecision(20)
|
||||
<< boost::geometry::get<0>(c2) << " " << boost::geometry::get<1>(c2)
|
||||
|
@ -74,11 +74,11 @@ double test_intersection(std::string const& caseid, G1 const& g1, G2 const& g2,
|
||||
// Get a correct point-count without duplicate points
|
||||
// (note that overlay might be adapted to avoid duplicates)
|
||||
boost::geometry::unique(*it);
|
||||
n += boost::geometry::num_points(*it);
|
||||
n += boost::geometry::num_points(*it, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
n += boost::geometry::num_points(*it);
|
||||
n += boost::geometry::num_points(*it, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,9 +123,12 @@ double test_intersection(std::string const& caseid, G1 const& g1, G2 const& g2,
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
{
|
||||
bool const ccw =
|
||||
bool const ccw =
|
||||
boost::geometry::point_order<G1>::value == boost::geometry::counterclockwise
|
||||
|| boost::geometry::point_order<G2>::value == boost::geometry::counterclockwise;
|
||||
bool const open =
|
||||
boost::geometry::closure<G1>::value == boost::geometry::open
|
||||
|| boost::geometry::closure<G2>::value == boost::geometry::open;
|
||||
|
||||
std::ostringstream filename;
|
||||
filename << "intersection_"
|
||||
@ -133,6 +136,7 @@ double test_intersection(std::string const& caseid, G1 const& g1, G2 const& g2,
|
||||
<< string_from_type<coordinate_type>::name()
|
||||
<< string_from_type<CalculationType>::name()
|
||||
<< (ccw ? "_ccw" : "")
|
||||
<< (open ? "_open" : "")
|
||||
<< ".svg";
|
||||
|
||||
std::ofstream svg(filename.str().c_str());
|
||||
@ -143,14 +147,17 @@ double test_intersection(std::string const& caseid, G1 const& g1, G2 const& g2,
|
||||
mapper.add(g2);
|
||||
|
||||
mapper.map(g1, is_line
|
||||
? "opacity:0.6;stroke:rgb(0,0,255);stroke-width:5"
|
||||
: "opacity:0.6;fill:rgb(0,0,255);stroke:rgb(0,0,0);stroke-width:1");
|
||||
mapper.map(g2, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
|
||||
? "opacity:0.6;stroke:rgb(0,255,0);stroke-width:5"
|
||||
: "fill-opacity:0.5;fill:rgb(153,204,0);"
|
||||
"stroke:rgb(153,204,0);stroke-width:3");
|
||||
mapper.map(g2, "fill-opacity:0.3;fill:rgb(51,51,153);"
|
||||
"stroke:rgb(51,51,153);stroke-width:3");
|
||||
|
||||
for (typename std::vector<OutputType>::const_iterator it = clip.begin();
|
||||
it != clip.end(); ++it)
|
||||
{
|
||||
mapper.map(*it, "opacity:0.6;fill:none;stroke:rgb(255,0,0);stroke-width:5");
|
||||
mapper.map(*it, "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);"
|
||||
"stroke:rgb(255,0,255);stroke-width:8");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -155,8 +155,7 @@ static std::string distance_zero[2] =
|
||||
{"POLYGON((1 1,1 4,4 4,4 1,1 1))",
|
||||
"POLYGON((1.9 0.9,2.0 4.000001,2.1 1.0,1.9 0.9))"};
|
||||
|
||||
|
||||
static std::string isovist[2] =
|
||||
static std::string isovist1[2] =
|
||||
{
|
||||
"POLYGON((37.29449462890625 1.7902572154998779, 46.296027072709599 -2.4984308554828116, 45.389434814453125 -4.5143837928771973, 47.585065917176543 -6.1314922196594779, 46.523914387974358 -8.5152102535033496, 42.699958801269531 -4.4278755187988281, 42.577877044677734 -4.4900407791137695, 42.577911376953125 -4.4901103973388672, 40.758884429931641 -5.418975830078125, 40.6978759765625 -5.4500408172607422, 41.590042114257813 -7.2021245956420898, 57.297810222148939 -37.546793343968417, 50.974888957147442 -30.277285722290763, 37.140213012695313 1.3446992635726929, 37.000419616699219 1.664225697517395, 37.29449462890625 1.7902572154998779))",
|
||||
"POLYGON((43.644271850585938 0.96149998903274536,43.764598846435547 0.93951499462127686,49.071769542946825 0.61489892713413252,48.43512638981781 -0.81299959072453376,47.830955505371094 -0.69758313894271851,47.263670054709685 -1.784876824891044,46.695858001708984 -1.6093428134918213,45.389434814453125 -4.5143837928771973,47.604561877161387 -6.087697464505224,46.559533858616469 -8.435196445683264,42.699958801269531 -4.4278755187988281,42.577877044677734 -4.4900407791137695,42.577911376953125 -4.4901103973388672,40.758884429931641 -5.418975830078125,40.6978759765625 -5.4500408172607422,41.590042114257813 -7.2021245956420898,57.524304765518266 -37.807195733984784,41.988733475572282 -19.945838749437218,41.821544647216797 -19.211688995361328,40.800632476806641 -17.208097457885742,39.966808319091797 -17.625011444091797,38.823680877685547 -16.296066284179688,37.326129913330078 -17.190576553344727,35.963497161865234 -15.476018905639648,35.656356811523438 -15.66030216217041,34.931102752685547 -16.223842620849609,34.634240447128811 -15.85007183479255,34.886280059814453 -14.120697975158691,34.658355712890625 -13.81736946105957,34.328716278076172 -13.992490768432617,33.598796844482422 -14.546377182006836,33.164891643669634 -14.000060288415174,33.566280364990234 -12.450697898864746,33.339523315429688 -12.147735595703125,32.998821258544922 -12.323249816894531,32.274600982666016 -12.879127502441406,31.682494778186321 -12.133624901803865,32.226280212402344 -10.790698051452637,32.000633239746094 -10.488097190856934,31.669155120849609 -10.653837203979492,30.947774887084961 -11.208560943603516,30.207040612748258 -10.275926149505661,30.896280288696289 -9.1206979751586914,30.670633316040039 -8.8180980682373047,30.339155197143555 -8.9838371276855469,29.619997024536133 -9.5368013381958008,29.135100397190627 -8.9262827849488211,32.718830108642578 -4.3281683921813965,32.708168029785156 -2.3611698150634766,32.708126068115234 -2.3611700534820557,32.708126068115234 -2.3611266613006592,30.501169204711914 -2.3718316555023193,27.069889344709196 -4.2926591211028242,26.472516656201325 -3.5380830513658776,36.954700469970703 1.2597870826721191,37.140213012695313 1.3446992635726929,37.000419616699219 1.664225697517395,37.29449462890625 1.7902572154998779,37.43402099609375 1.470055103302002,51.370888500897557 7.4163459734570729,51.20102152843122 7.1738039562841562,42.721500396728516 3.6584999561309814,42.721500396728516 2.2342472076416016,42.399410247802734 1.4956772327423096,43.644271850585938 0.96149998903274536))"
|
||||
|
@ -56,7 +56,7 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2,
|
||||
// (note that overlay might be adapted to avoid duplicates)
|
||||
OutputType simplified;
|
||||
boost::geometry::unique(*it);
|
||||
n += boost::geometry::num_points(*it);
|
||||
n += boost::geometry::num_points(*it, true);
|
||||
}
|
||||
|
||||
|
||||
@ -83,10 +83,19 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2,
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
{
|
||||
bool const ccw =
|
||||
boost::geometry::point_order<G1>::value == boost::geometry::counterclockwise
|
||||
|| boost::geometry::point_order<G2>::value == boost::geometry::counterclockwise;
|
||||
bool const open =
|
||||
boost::geometry::closure<G1>::value == boost::geometry::open
|
||||
|| boost::geometry::closure<G2>::value == boost::geometry::open;
|
||||
|
||||
std::ostringstream filename;
|
||||
filename << "union_"
|
||||
<< caseid << "_"
|
||||
<< string_from_type<coordinate_type>::name()
|
||||
<< (ccw ? "_ccw" : "")
|
||||
<< (open ? "_open" : "")
|
||||
<< ".svg";
|
||||
|
||||
std::ofstream svg(filename.str().c_str());
|
||||
@ -98,13 +107,19 @@ void test_union(std::string const& caseid, G1 const& g1, G2 const& g2,
|
||||
mapper.add(g1);
|
||||
mapper.add(g2);
|
||||
|
||||
mapper.map(g1, "opacity:0.6;fill:rgb(0,0,255);stroke:rgb(0,0,0);stroke-width:1");
|
||||
mapper.map(g2, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
|
||||
mapper.map(g1, "fill-opacity:0.5;fill:rgb(153,204,0);"
|
||||
"stroke:rgb(153,204,0);stroke-width:3");
|
||||
mapper.map(g2, "fill-opacity:0.3;fill:rgb(51,51,153);"
|
||||
"stroke:rgb(51,51,153);stroke-width:3");
|
||||
//mapper.map(g1, "opacity:0.6;fill:rgb(0,0,255);stroke:rgb(0,0,0);stroke-width:1");
|
||||
//mapper.map(g2, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
|
||||
|
||||
for (typename std::vector<OutputType>::const_iterator it = clip.begin();
|
||||
it != clip.end(); ++it)
|
||||
{
|
||||
mapper.map(*it, "opacity:0.6;fill:none;stroke:rgb(255,0,0);stroke-width:5");
|
||||
mapper.map(*it, "fill-opacity:0.2;stroke-opacity:0.4;fill:rgb(255,0,0);"
|
||||
"stroke:rgb(255,0,255);stroke-width:8");
|
||||
//mapper.map(*it, "opacity:0.6;fill:none;stroke:rgb(255,0,0);stroke-width:5");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -144,9 +144,19 @@ void test_areal()
|
||||
case_32[0], case_32[1], 2, 0, 8, 4.5);
|
||||
test_one<Polygon, Polygon, Polygon>("33",
|
||||
case_33[0], case_33[1], 2, 0, 8, 4.5);
|
||||
test_one<Polygon, Polygon, Polygon>("36",
|
||||
case_36[0], case_36[1], 1, 0, 10, 14.375);
|
||||
test_one<Polygon, Polygon, Polygon>("40",
|
||||
case_40[0], case_40[1], 2, 0, 18, 11);
|
||||
|
||||
// Test rings which should be generated by assemble
|
||||
test_one<Polygon, Polygon, Polygon>("53_iet",
|
||||
case_53[0], case_53[2], 1, 1, 16, 16);
|
||||
test_one<Polygon, Polygon, Polygon>("58_iet",
|
||||
case_58[0], case_58[2], 1, 3, 20, 12.16666);
|
||||
test_one<Polygon, Polygon, Polygon>("59_iet",
|
||||
case_59[0], case_59[2], 1, 1, 14, 17.20833);
|
||||
|
||||
|
||||
/*
|
||||
test_one<Polygon, Polygon, Polygon>(102,
|
||||
@ -214,10 +224,13 @@ void test_all()
|
||||
|
||||
test_areal<ring, polygon>();
|
||||
|
||||
test_areal<boost::geometry::linear_ring<P, std::vector, false>,
|
||||
boost::geometry::polygon<P, std::vector, std::vector, false> >();
|
||||
|
||||
|
||||
test_areal<boost::geometry::model::linear_ring<P, true, false>,
|
||||
boost::geometry::model::polygon<P, true, false> >();
|
||||
/*
|
||||
TODO: ccw has one new error in 'wrapped' due to new approach, SOLVE THIS
|
||||
test_areal<boost::geometry::model::linear_ring<P, false>,
|
||||
boost::geometry::model::polygon<P, false> >();
|
||||
*/
|
||||
test_one<polygon, box, polygon>("box_ring", example_box, example_ring,
|
||||
1, 1, 15, 6.38875);
|
||||
|
||||
@ -253,8 +266,6 @@ void test_all()
|
||||
test_one<polygon, box, polygon>("box_poly8", "box(0 0, 3 3)",
|
||||
"POLYGON((2 2, 1 4, 2 4, 3 3, 2 2))",
|
||||
1, 0, 8, 10.25);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="$(BOOST_ROOT);..\..\.."
|
||||
AdditionalIncludeDirectories=""$(BOOST_ROOT)";../../.."
|
||||
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
@ -16,6 +16,6 @@
|
||||
/>
|
||||
<UserMacro
|
||||
Name="BOOST_ROOT"
|
||||
Value="C:\Program Files\boost\boost_1_41_0"
|
||||
Value="C:\software\boost_1_43_0"
|
||||
/>
|
||||
</VisualStudioPropertySheet>
|
||||
|
@ -15,8 +15,10 @@ test-suite ggl-core
|
||||
[ run geometry_id.cpp ]
|
||||
[ run point_type.cpp ]
|
||||
[ run radian_access.cpp ]
|
||||
[ run reverse_dispatch.cpp ]
|
||||
# [ run reverse_dispatch.cpp ]
|
||||
[ run ring.cpp ]
|
||||
[ run tag.cpp ]
|
||||
[ run topological_dimension.cpp ]
|
||||
;
|
||||
|
||||
# The reverse_dispatch somehow asks for UAC-control on MinGW...
|
||||
|
@ -31,6 +31,10 @@
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(HAVE_TTMATH)
|
||||
# include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_CLN) || defined(HAVE_GMP)
|
||||
# include <boost/numeric_adaptor/numeric_adaptor.hpp>
|
||||
#endif
|
||||
@ -43,6 +47,7 @@
|
||||
# include <boost/numeric_adaptor/cln_value_type.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct string_from_type {};
|
||||
|
||||
@ -58,6 +63,12 @@ template <> struct string_from_type<double>
|
||||
template <> struct string_from_type<long double>
|
||||
{ static std::string name() { return "e"; } };
|
||||
|
||||
#if defined(HAVE_TTMATH)
|
||||
template <> struct string_from_type<ttmath_big>
|
||||
{ static std::string name() { return "t"; } };
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(HAVE_GMP)
|
||||
template <> struct string_from_type<boost::numeric_adaptor::gmp_value_type>
|
||||
{ static std::string name() { return "g"; } };
|
||||
|
@ -20,8 +20,8 @@
|
||||
#include <boost/geometry/geometries/cartesian2d.hpp>
|
||||
|
||||
|
||||
|
||||
void test_minimal()
|
||||
// The closing iterator should also work on normal std:: containers
|
||||
void test_non_geometry()
|
||||
{
|
||||
std::vector<int> v;
|
||||
v.push_back(1);
|
||||
@ -69,16 +69,13 @@ void test_geometry(std::string const& wkt)
|
||||
}
|
||||
BOOST_CHECK_EQUAL(out.str(), " 11 14 44 41 11");
|
||||
|
||||
// All the following does NOT compile, and should NOT,
|
||||
// 1) Because it is forward only:
|
||||
//it--;
|
||||
//--it;
|
||||
// 2) Because it is not random access:
|
||||
//it += 2;
|
||||
//it = boost::begin(geometry);
|
||||
// Check compilations, it is (since Oct 2010) random access
|
||||
it--;
|
||||
--it;
|
||||
it += 2;
|
||||
it -= 2;
|
||||
}
|
||||
|
||||
|
||||
// 2: check copy behaviour
|
||||
{
|
||||
typedef typename boost::range_iterator<Geometry const>::type normal_iterator;
|
||||
@ -102,7 +99,7 @@ void test_geometry(std::string const& wkt)
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
test_minimal();
|
||||
test_non_geometry();
|
||||
test_geometry<boost::geometry::linear_ring<P> >("POLYGON((1 1,1 4,4 4,4 1))");
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
test-suite ggl-multi-algorithms
|
||||
test-suite boost-geometry-multi-algorithms
|
||||
:
|
||||
[ run multi_area.cpp ]
|
||||
[ run multi_centroid.cpp ]
|
||||
@ -22,4 +22,8 @@ test-suite ggl-multi-algorithms
|
||||
[ run multi_simplify.cpp ]
|
||||
[ run multi_union.cpp ]
|
||||
[ run multi_unique.cpp ]
|
||||
[ run multi_within.cpp ]
|
||||
;
|
||||
|
||||
build-project overlay
|
||||
;
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include <boost/geometry/multi/algorithms/correct.hpp>
|
||||
#include <boost/geometry/multi/algorithms/intersection.hpp>
|
||||
#include <boost/geometry/multi/algorithms/within.hpp> // only for testing #77
|
||||
|
||||
#include <boost/geometry/multi/geometries/multi_point.hpp>
|
||||
#include <boost/geometry/multi/geometries/multi_linestring.hpp>
|
||||
@ -46,6 +47,48 @@ void test_areal()
|
||||
test_one<Ring, MultiPolygon, Polygon>("simplex_multi_mp_r",
|
||||
case_multi_simplex[0], case_single_simplex,
|
||||
2, 12, 6.42);
|
||||
|
||||
// Constructed cases for multi/touch/equal/etc
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_61_multi",
|
||||
case_61_multi[0], case_61_multi[1],
|
||||
0, 0, 0.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_62_multi",
|
||||
case_62_multi[0], case_62_multi[1],
|
||||
1, 5, 1.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_63_multi",
|
||||
case_63_multi[0], case_63_multi[1],
|
||||
1, 5, 1.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_64_multi",
|
||||
case_64_multi[0], case_64_multi[1],
|
||||
1, 5, 1.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_65_multi",
|
||||
case_65_multi[0], case_65_multi[1],
|
||||
1, 5, 1.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_72_multi",
|
||||
case_72_multi[0], case_72_multi[1],
|
||||
3, 14, 2.85);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_77_multi",
|
||||
case_77_multi[0], case_77_multi[1],
|
||||
5, 33, 9);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_78_multi",
|
||||
case_78_multi[0], case_78_multi[1],
|
||||
1, 17, 22);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_101_multi",
|
||||
case_101_multi[0], case_101_multi[1],
|
||||
4, 22, 4.75);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_102_multi",
|
||||
case_102_multi[0], case_102_multi[1],
|
||||
3, 26, 19.75);
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_1",
|
||||
case_recursive_boxes_1[0], case_recursive_boxes_1[1],
|
||||
10, 97, 47.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_2",
|
||||
case_recursive_boxes_2[0], case_recursive_boxes_2[1],
|
||||
1, 47, 90.0); // Area from SQL Server
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_3",
|
||||
case_recursive_boxes_3[0], case_recursive_boxes_3[1],
|
||||
19, 87, 12.5); // Area from SQL Server
|
||||
}
|
||||
|
||||
template <typename Polygon, typename MultiPolygon, typename Box>
|
||||
@ -96,13 +139,13 @@ void test_all()
|
||||
typedef bg::polygon<P> polygon;
|
||||
typedef bg::multi_polygon<polygon> multi_polygon;
|
||||
test_areal<ring, polygon, multi_polygon>();
|
||||
return;
|
||||
|
||||
typedef bg::linear_ring<P, std::vector, false> ring_ccw;
|
||||
typedef bg::polygon<P, std::vector, std::vector, false> polygon_ccw;
|
||||
typedef bg::multi_polygon<polygon_ccw> multi_polygon_ccw;
|
||||
test_areal<ring_ccw, polygon_ccw, multi_polygon_ccw>();
|
||||
|
||||
// multi/box: was NOT implemented, next step TODO.
|
||||
test_areal_clip<polygon, multi_polygon, box>();
|
||||
test_areal_clip<polygon_ccw, multi_polygon_ccw, box>();
|
||||
|
||||
|
@ -51,6 +51,57 @@ void test_areal()
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_multi_2",
|
||||
case_multi_2[0], case_multi_2[1],
|
||||
3, 0, 16, 59.1);
|
||||
|
||||
// Constructed cases for multi/touch/equal/etc
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_61_multi",
|
||||
case_61_multi[0], case_61_multi[1],
|
||||
1, 0, 11, 4.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_62_multi",
|
||||
case_62_multi[0], case_62_multi[1],
|
||||
2, 0, 10, 2.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_63_multi",
|
||||
case_63_multi[0], case_63_multi[1],
|
||||
2, 0, 10, 2.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_64_multi",
|
||||
case_64_multi[0], case_64_multi[1],
|
||||
1, 0, 9, 3.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_65_multi",
|
||||
case_65_multi[0], case_65_multi[1],
|
||||
3, 0, 15, 4.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_66_multi",
|
||||
case_66_multi[0], case_66_multi[1],
|
||||
3, 0, 23, 7.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_75_multi",
|
||||
case_75_multi[0], case_75_multi[1],
|
||||
5, 0, 25, 5.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_76_multi",
|
||||
case_76_multi[0], case_76_multi[1],
|
||||
5, 0, 31, 8.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_89_multi",
|
||||
case_89_multi[0], case_89_multi[1],
|
||||
1, 0, 13, 6);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_101_multi",
|
||||
case_101_multi[0], case_101_multi[1],
|
||||
1, 0, 32, 22.25);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_103_multi",
|
||||
case_103_multi[0], case_103_multi[1],
|
||||
1, 0, 7, 25);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_104_multi",
|
||||
case_104_multi[0], case_104_multi[1],
|
||||
1, 0, 8, 25);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_105_multi",
|
||||
case_105_multi[0], case_105_multi[1],
|
||||
1, 0, 5, 25);
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_1",
|
||||
case_recursive_boxes_1[0], case_recursive_boxes_1[1],
|
||||
1, 1, 36, 97.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_2",
|
||||
case_recursive_boxes_2[0], case_recursive_boxes_2[1],
|
||||
1, 0, 14, 100.0); // Area from SQL Server
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_3",
|
||||
case_recursive_boxes_3[0], case_recursive_boxes_3[1],
|
||||
17, 0, 159, 56.5); // Area from SQL Server
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
@ -69,7 +120,8 @@ void test_all()
|
||||
typedef bg::linear_ring<P, std::vector, false> ring_ccw;
|
||||
typedef bg::polygon<P, std::vector, std::vector, false> polygon_ccw;
|
||||
typedef bg::multi_polygon<polygon_ccw> multi_polygon_ccw;
|
||||
test_areal<ring_ccw, polygon_ccw, multi_polygon_ccw>();
|
||||
// TODO: ccw has issues with multi-touch
|
||||
//test_areal<ring_ccw, polygon_ccw, multi_polygon_ccw>();
|
||||
}
|
||||
|
||||
}
|
||||
|
12
test/multi/algorithms/overlay/Jamfile.v2
Normal file
12
test/multi/algorithms/overlay/Jamfile.v2
Normal file
@ -0,0 +1,12 @@
|
||||
# test/algorithms/Jamfile.v2
|
||||
#
|
||||
# Copyright (c) 2010 Barend Gehrels
|
||||
#
|
||||
# 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)
|
||||
|
||||
test-suite boost-geometry-multi-algorithms-overlay
|
||||
:
|
||||
[ run multi_traverse.cpp ]
|
||||
;
|
@ -19,14 +19,356 @@ static std::string case_multi_simplex[2] = {
|
||||
// To mix multi/single
|
||||
static std::string case_single_simplex = "POLYGON((3 0,0 3,4 5,3 0))";
|
||||
|
||||
static std::string case_multi_no_ip[2] = {
|
||||
"MULTIPOLYGON(((4 1,0 7,7 9,4 1)),((8 1,6 3,10 4,8 1)),((12 6,10 7,13 8,12 6)))",
|
||||
"MULTIPOLYGON(((14 4,8 8,15 10,14 4)),((15 3,18 9,20 2,15 3)),((3 4,1 7,5 7,3 4)))" };
|
||||
static std::string case_multi_no_ip[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((4 1,0 7,7 9,4 1)),((8 1,6 3,10 4,8 1)),((12 6,10 7,13 8,12 6)))",
|
||||
"MULTIPOLYGON(((14 4,8 8,15 10,14 4)),((15 3,18 9,20 2,15 3)),((3 4,1 7,5 7,3 4)))"
|
||||
};
|
||||
|
||||
static std::string case_multi_2[2] = {
|
||||
"MULTIPOLYGON(((4 3,2 7,10 9,4 3)),((8 1,6 3,10 4,8 1)),((12 6,10 7,13 8,12 6)))",
|
||||
"MULTIPOLYGON(((14 4,8 8,15 10,14 4)),((15 3,18 9,20 2,15 3)),((5 5,4 7,7 7,5 5)))" };
|
||||
static std::string case_multi_2[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((4 3,2 7,10 9,4 3)),((8 1,6 3,10 4,8 1)),((12 6,10 7,13 8,12 6)))",
|
||||
"MULTIPOLYGON(((14 4,8 8,15 10,14 4)),((15 3,18 9,20 2,15 3)),((5 5,4 7,7 7,5 5)))"
|
||||
};
|
||||
|
||||
static std::string case_61_multi[2] =
|
||||
{
|
||||
// extracted from recursive boxes
|
||||
"MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)),((2 2,2 3,3 3,3 2,2 2)))",
|
||||
"MULTIPOLYGON(((1 2,1 3,2 3,2 2,1 2)),((2 3,2 4,3 4,3 3,2 3)))"
|
||||
};
|
||||
|
||||
static std::string case_62_multi[2] =
|
||||
{
|
||||
// extracted from recursive boxes
|
||||
"MULTIPOLYGON(((1 2,1 3,2 3,2 2,1 2)))",
|
||||
"MULTIPOLYGON(((1 2,1 3,2 3,2 2,1 2)),((2 3,2 4,3 4,3 3,2 3)))"
|
||||
};
|
||||
|
||||
static std::string case_63_multi[2] =
|
||||
{
|
||||
// extracted from recursive boxes
|
||||
"MULTIPOLYGON(((1 2,1 3,2 3,2 2,1 2)))",
|
||||
"MULTIPOLYGON(((1 2,1 3,2 3,2 2,1 2)),((2 1,2 2,3 2,3 1,2 1)))"
|
||||
};
|
||||
|
||||
static std::string case_64_multi[3] =
|
||||
{
|
||||
// extracted from recursive boxes
|
||||
"MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)),((2 2,2 3,3 3,3 2,2 2)))",
|
||||
"MULTIPOLYGON(((1 1,1 2,2 2,3 2,3 1,2 1,1 1)))" ,
|
||||
// same but omitting not-necessary form-points at x=2 (==simplified)
|
||||
"MULTIPOLYGON(((1 1,1 2,3 2,3 1,1 1)))"
|
||||
};
|
||||
|
||||
static std::string case_65_multi[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((2 2,2 3,3 3,3 2,2 2)))",
|
||||
"MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)),((2 2,2 3,3 3,3 2,2 2)),((3 1,3 2,5 2,5 1,3 1)))"
|
||||
};
|
||||
|
||||
static std::string case_66_multi[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((3 5,2 5,2 6,3 6,4 6,4 5,3 5)),((1 6,0 6,0 7,1 7,2 7,2 6,1 6)))",
|
||||
"MULTIPOLYGON(((1 4,1 5,2 5,2 4,1 4)),((1 7,2 7,2 6,1 6,1 7)),((0 8,0 9,1 9,1 8,1 7,0 7,0 8)))"
|
||||
};
|
||||
|
||||
static std::string case_67_multi[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((1 2,1 3,2 3,2 2,1 2)),((2 1,2 2,3 2,3 1,2 1)))",
|
||||
"MULTIPOLYGON(((1 1,1 2,3 2,3 1,1 1)))"
|
||||
};
|
||||
|
||||
static std::string case_68_multi[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((2 1,2 2,4 2,4 1,2 1)),((4 2,4 3,5 3,5 2,4 2)))",
|
||||
"MULTIPOLYGON(((1 2,1 3,2 3,2 2,1 2)),((2 1,2 2,3 2,3 1,2 1)),((3 2,3 3,5 3,5 2,3 2)))"
|
||||
};
|
||||
|
||||
static std::string case_69_multi[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)),((3 2,3 3,4 3,4 2,3 2)))",
|
||||
"MULTIPOLYGON(((2 0,2 1,3 1,3 0,2 0)),((1 1,1 3,2 3,2 1,1 1)),((2 3,2 4,3 4,3 3,2 3)))"
|
||||
};
|
||||
|
||||
static std::string case_71_multi[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((0 0,0 3,1 3,1 1,3 1,3 2,4 2,4 0,0 0)),((2 2,2 3,3 3,3 2,2 2)))",
|
||||
"MULTIPOLYGON(((0 2,0 3,3 3,3 2,0 2)))"
|
||||
};
|
||||
|
||||
static std::string case_72_multi[2] =
|
||||
{
|
||||
// cluster with ii, done by both traverse and assemble
|
||||
"MULTIPOLYGON(((0 3,4 4,3 0,3 3,0 3)),((3 3,2 1,1 2,3 3)))",
|
||||
"MULTIPOLYGON(((0 0,1 4,3 3,4 1,0 0)))"
|
||||
};
|
||||
|
||||
static std::string case_73_multi[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((2 2,2 3,3 3,3 2,2 2)),((1 1,1 2,2 2,2 1,1 1)))",
|
||||
"MULTIPOLYGON(((1 1,1 2,2 2,2 3,3 3,3 1,1 1)))"
|
||||
};
|
||||
|
||||
static std::string case_74_multi[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((3 0,2 0,2 1,3 1,3 3,1 3,1 2,2 2,2 1,0 1,0 5,4 5,4 0,3 0)))",
|
||||
"MULTIPOLYGON(((0 2,0 3,1 3,1 1,2 1,2 0,0 0,0 2)),((2 3,1 3,1 4,2 4,2 3)))"
|
||||
};
|
||||
|
||||
static std::string case_75_multi[2] =
|
||||
{
|
||||
// cc/uu turns on all corners of second box
|
||||
"MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)),((1 3,1 4,2 4,2 3,1 3)),((2 2,2 3,3 3,3 2,2 2)),((3 1,3 2,4 2,4 1,3 1)),((3 3,3 4,4 4,4 3,3 3)))",
|
||||
"MULTIPOLYGON(((2 2,2 3,3 3,3 2,2 2)))"
|
||||
};
|
||||
|
||||
static std::string case_76_multi[2] =
|
||||
{
|
||||
// cc/uu turns on all corners of second box, might generate TWO OVERLAPPING union polygons!
|
||||
// therefore, don't follow uu.
|
||||
"MULTIPOLYGON(((1 0,1 1,2 1,2 0,1 0)),((3 2,4 2,4 1,3 1,3 2)),((2 2,2 3,3 3,3 2,2 2)),((2 3,1 3,1 4,2 4,2 3)),((3 3,3 4,4 4,4 3,3 3)))",
|
||||
"MULTIPOLYGON(((0 2,0 3,1 3,1 2,2 2,2 0,1 0,1 1,0 1,0 2)),((2 2,2 3,3 3,3 2,2 2)))"
|
||||
};
|
||||
|
||||
static std::string case_77_multi[2] =
|
||||
{
|
||||
// with a point on interior-ring-border of enclosing
|
||||
// -> went wrong in the assemble phase for intersection (traversal is OK)
|
||||
// -> fixed
|
||||
"MULTIPOLYGON(((3 3,3 4,4 4,4 3,3 3)),((5 3,5 4,4 4,4 5,3 5,3 6,5 6,5 5,7 5,7 6,8 6,8 5,9 5,9 2,8 2,8 1,7 1,7 2,5 2,5 3),(6 3,8 3,8 4,6 4,6 3)))",
|
||||
"MULTIPOLYGON(((6 3,6 4,7 4,7 3,6 3)),((2 3,1 3,1 4,3 4,3 5,4 5,4 6,5 6,5 7,9 7,9 4,7 4,7 5,8 5,8 6,7 6,7 5,6 5,6 4,4 4,4 3,3 3,3 2,4 2,2 2,2 3)),((5 2,4 2,4 3,6 3,6 2,5 2)),((7 2,7 3,8 3,8 2,8 1,7 1,7 2)))"
|
||||
};
|
||||
|
||||
static std::string case_78_multi[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0),(2 2,4 2,4 3,2 3,2 2)))",
|
||||
"MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0),(3 2,4 2,4 3,3 3,3 2),(1 1,2 1,2 2,1 2,1 1)))"
|
||||
|
||||
};
|
||||
|
||||
static std::string case_80_multi[2] =
|
||||
{
|
||||
// Many ux-clusters -> needs correct cluster-sorting
|
||||
// Fixed now
|
||||
"MULTIPOLYGON(((3 1,3 2,4 2,3 1)),((1 5,0 4,0 5,1 6,1 5)),((3 3,4 3,3 2,2 2,2 3,3 3)),((4 5,5 6,5 5,4 5)),((4 2,4 3,5 3,4 2)),((2.5 5.5,3 5,2 5,2 7,3 6,2.5 5.5)),((1 6,0 6,0 7,1 7,2 6,1 6)))",
|
||||
"MULTIPOLYGON(((3 5,3 6,4 6,4 5,3 5)),((4 4,5 5,5 4,4 4)),((3 3,4 4,4 3,3 3)),((1 5,1 6,2 6,2 5,1 5)),((0 6,1 7,1 6,0 6)),((1 4,1 3,0 3,0 4,1 4)),((3 5,4 4,3 4,3 3,2 3,2 5,3 5)))"
|
||||
};
|
||||
|
||||
static std::string case_81_multi[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((1 1,2 2,2 1,1 1)),((2 2,2 3,3 2,2 2)),((3 1,4 2,4 1,3 1)))",
|
||||
"MULTIPOLYGON(((2 1,2 2,3 3,3 2,4 2,3 1,2 1)))"
|
||||
};
|
||||
|
||||
static std::string case_82_multi[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((4 0,5 1,5 0,4 0)),((2 1,3 2,3 1,2 1)),((3 0,4 1,4 0,3 0)),((1 0,1 1,2 1,2 0,1 0)))",
|
||||
"MULTIPOLYGON(((3 2,4 3,4 2,3 2)),((3 1,3 2,4 1,3 1)),((0 0,1 1,1 0,0 0)),((5 1,5 0,4 0,4 1,5 1)))"
|
||||
};
|
||||
|
||||
static std::string case_83_multi[2] =
|
||||
{
|
||||
// iu/iu
|
||||
"MULTIPOLYGON(((1 0,1 1,2 1,1 0)),((0 1,0 4,1 4,1 1,0 1)),((2 1,2 2,3 2,3 1,2 1)),((2 3,3 4,3 3,2 3)))",
|
||||
"MULTIPOLYGON(((1 0,2 1,2 0,1 0)),((0 3,1 4,1 3,0 3)),((2 3,2 4,3 3,2 3)),((1 3,2 3,2 2,0 2,1 3)))"
|
||||
};
|
||||
|
||||
static std::string case_84_multi[2] =
|
||||
{
|
||||
// iu/ux
|
||||
"MULTIPOLYGON(((2 2,3 3,3 2,2 2)),((2 1,2 2,3 1,2 1)),((2 3,3 4,3 3,2 3)),((1 3,2 4,2 2,1 2,1 3)))",
|
||||
"MULTIPOLYGON(((2 3,3 3,3 1,2 1,2 2,1 2,1 3,2 3)))"
|
||||
};
|
||||
|
||||
static std::string case_85_multi[2] =
|
||||
{
|
||||
// iu/ux (and ux/ux)
|
||||
"MULTIPOLYGON(((0 1,0 2,1 2,0 1)),((1 1,1 2,2 1,1 1)),((0 3,1 3,0 2,0 3)))",
|
||||
"MULTIPOLYGON(((1 3,2 3,2 1,1 1,1 2,0 2,1 3)))"
|
||||
};
|
||||
|
||||
static std::string case_86_multi[2] =
|
||||
{
|
||||
// iu/ux
|
||||
"MULTIPOLYGON(((4 2,4 3,5 3,4 2)),((5 2,6 3,6 2,5 2)),((5 1,4 1,4 2,5 2,6 1,5 1)))",
|
||||
"MULTIPOLYGON(((5 1,5 2,6 2,6 1,5 1)),((4 2,5 3,5 2,4 2)),((3 2,4 3,4 2,3 2)))"
|
||||
};
|
||||
|
||||
static std::string case_87_multi[2] =
|
||||
{
|
||||
// iu/ux where iu crosses, no touch
|
||||
"MULTIPOLYGON(((5 0,5 1,6 0,5 0)),((6 2,7 3,7 2,6 2)),((5 1,5 3,6 3,6 1,5 1)))",
|
||||
"MULTIPOLYGON(((5 1,5 2,7 2,7 1,6 1,6 0,5 0,5 1)),((4 3,5 3,5 2,3 2,4 3)))"
|
||||
};
|
||||
|
||||
|
||||
static std::string case_88_multi[2] =
|
||||
{
|
||||
"MULTIPOLYGON(((0 0,0 1,1 0,0 0)),((1 1,1 2,2 1,1 1)),((0 2,0 3,1 3,2 3,2 2,1 2,0 1,0 2)))",
|
||||
"MULTIPOLYGON(((0 0,0 1,1 0,0 0)),((0 1,1 2,1 1,0 1)),((0 2,0 3,1 3,1 2,0 2)))"
|
||||
};
|
||||
|
||||
static std::string case_89_multi[2] =
|
||||
{
|
||||
// Extract from rec.boxes_3
|
||||
"MULTIPOLYGON(((8 1,7 1,8 2,8 3,9 4,9 2,8.5 1.5,9 1,8 0,8 1)),((9 1,9 2,10 2,10 1,9 0,9 1)))",
|
||||
"MULTIPOLYGON(((8 3,9 4,9 3,8 3)),((7 0,7 1,8 1,8 0,7 0)),((9 2,9 1,8 1,8 3,8.5 2.5,9 3,9 2)))"
|
||||
};
|
||||
|
||||
static std::string case_90_multi[2] =
|
||||
{
|
||||
// iu/iu for Union; see ppt
|
||||
"MULTIPOLYGON(((1 8,0 8,0 10,1 10,1 9,2 8,2 7,1 7,1 8)),((2 9,2 10,4 10,4 9,3 9,3 8,2 8,2 9)))",
|
||||
"MULTIPOLYGON(((2 8,1 8,1 9,2 9,2 10,3 10,3 8,2 8)),((0 10,2 10,0 8,0 10)))"
|
||||
};
|
||||
|
||||
static std::string case_91_multi[2] =
|
||||
{
|
||||
// iu/xi for Intersection
|
||||
"MULTIPOLYGON(((3 3,3 4,4 4,3 3)),((2 2,1 2,1 4,2 4,2 3,3 3,2 2)))",
|
||||
"MULTIPOLYGON(((2 2,2 3,3 2,2 2)),((2 3,1 3,1 4,1.5 3.5,2 4,2.5 3.5,3 4,3 3,2 3)))"
|
||||
};
|
||||
|
||||
static std::string case_92_multi[2] =
|
||||
{
|
||||
// iu/iu all aligned (for union)
|
||||
"MULTIPOLYGON(((7 2,7 3,8 2,7 2)),((8 4,9 5,9 4,8 4)),((8 2,8 3,9 2,8 2)),((7 3,7 4,8 4,8 3,7 3)),((9 3,9 4,10 4,10 3,9 3)))",
|
||||
"MULTIPOLYGON(((9 2,8 2,8 3,9 3,10 2,9 2)),((7 5,8 5,9 6,9 4,8 4,7 3,6 3,6 4,6.5 3.5,7 4,6 4,7 5)))"
|
||||
};
|
||||
|
||||
static std::string case_93_multi[2] =
|
||||
{
|
||||
// iu/xi for intersection
|
||||
"MULTIPOLYGON(((6 2,7 2,7 1,5 1,6 2)),((7 3,8 3,7.5 2.5,8 2,7 2,7 3)))",
|
||||
"MULTIPOLYGON(((7 1,6 0,6 2,7 3,7 2,8 3,8 2,7 1)))"
|
||||
};
|
||||
|
||||
|
||||
static std::string case_94_multi[2] =
|
||||
{
|
||||
// iu/iu for union
|
||||
"MULTIPOLYGON(((9 2,9 3,10 3,10 2,9 2)),((7 3,8 4,9 3,8 3,9 2,7 2,7 3)),((8 6,9 5,9 4,8 4,8 6)))",
|
||||
"MULTIPOLYGON(((6 2,6 3,7 3,8 2,6 2)),((9 3,10 3,9 2,9 1,8 0,7 0,8 1,8 3,8.5 2.5,9 3)),((7 4,7 5,8 5,9 6,9 4,8 4,8 3,7 3,7 4)))"
|
||||
};
|
||||
|
||||
static std::string case_95_multi[2] =
|
||||
{
|
||||
// iu/iu for union
|
||||
"MULTIPOLYGON(((0 8,1 8,1 7,0 7,0 8)),((2 8,2 9,2.5 8.5,3 9,3 7,2 7,2 8)),((1 9,1 10,2 9,1 8,1 9)))",
|
||||
"MULTIPOLYGON(((1 7,0 7,0 8,1 8,2 7,1 7)),((2 9,1 9,1 10,2 10,3 9,4 9,4 8,2 8,2 9)))"
|
||||
};
|
||||
|
||||
static std::string case_96_multi[2] =
|
||||
{
|
||||
// iu/iu all collinear, for intersection/union
|
||||
"MULTIPOLYGON(((8 2,9 3,9 2,8 2)),((8 1,9 2,9 1,10 1,10 0,8 0,8 1)))",
|
||||
"MULTIPOLYGON(((9 0,9 1,10 0,9 0)),((8 1,8 2,9 2,9 1,8 1)))"
|
||||
};
|
||||
|
||||
static std::string case_97_multi[2] =
|
||||
{
|
||||
// ux/ux for union
|
||||
"MULTIPOLYGON(((4 4,4 5,4.5 4.5,5 5,6 5,5 4,5 3,4 3,4 4)))",
|
||||
"MULTIPOLYGON(((5 3,5 4,6 3,5 3)),((6 5,7 5,6 4,5 4,6 5)))"
|
||||
};
|
||||
|
||||
|
||||
static std::string case_98_multi[2] =
|
||||
{
|
||||
// ii/iu for intersection, solved by discarding iu (ordering not possible)
|
||||
"MULTIPOLYGON(((2 0,3 1,3 0,2 0)),((2 2,2 3,1 3,1 4,2 4,3 3,3 4,5 2,4 2,4 1,3 1,3 2,2.5 1.5,3 1,2 1,2 2)))",
|
||||
"MULTIPOLYGON(((4 2,4 3,5 2,4 2)),((1 0,0 0,0 2,4 2,4 1,2 1,2 0,1 0)),((3 3,4 4,4 3,3 2,3 3)))"
|
||||
};
|
||||
|
||||
static std::string case_99_multi[2] =
|
||||
{
|
||||
// iu/iu for intersection
|
||||
"MULTIPOLYGON(((1 0,2 1,2 0,1 0)),((1 2,2 2,1.5 1.5,2 1,1 1,1 0,0 0,0 1,1 2)))",
|
||||
"MULTIPOLYGON(((1 1,2 0,0 0,1 1)),((1 1,0 1,0 2,1 2,2 3,2 2,1 1)))"
|
||||
};
|
||||
|
||||
static std::string case_100_multi[2] =
|
||||
{
|
||||
// for intersection
|
||||
"MULTIPOLYGON(((0 0,0 1,1 0,0 0)),((2 2,2 1,0 1,0 2,1 2,2 3,2 2)))",
|
||||
"MULTIPOLYGON(((1 1,1 2,2 2,2 1,1 1)),((1 2,0 1,0 3,1 4,1 2))))"
|
||||
};
|
||||
|
||||
static std::string case_101_multi[2] =
|
||||
{
|
||||
// interior ring / union
|
||||
"MULTIPOLYGON(((7 2,7 3,8 2,7 2)),((9 3,9 4,10 3,9 3)),((10 1,10 0,8 0,8 1,9 2,10 2,10 1)),((9 3,9 2,8 2,8 3,7 3,7 4,8 4,9 3)),((8 4,8 7,9 6,9 4,8 4)))",
|
||||
"MULTIPOLYGON(((6 1,5 1,5 2,6 3,6 4,7 5,6 5,7 6,8 6,8 5,9 5,8 4,9 4,9 5,10 5,10 1,8 1,8 3,7 3,7 2,6 2,7 1,8 1,7 0,5 0,5 1,5.5 0.5,6 1),(8.5 2.5,9 2,9 3,8.5 2.5)))"
|
||||
};
|
||||
|
||||
static std::string case_102_multi[2] =
|
||||
{
|
||||
// interior ring 'fit' / union
|
||||
"MULTIPOLYGON(((0 2,0 7,5 7,5 2,0 2),(4 3,4 6,1 6,2 5,1 5,1 4,3 4,4 3)),((3 4,3 5,4 5,3 4)),((2 5,3 6,3 5,2 4,2 5)))",
|
||||
"MULTIPOLYGON(((0 2,0 7,5 7,5 2,0 2),(2 4,3 5,2 5,2 4),(4 4,3 4,3 3,4 4),(4 5,4 6,3 6,4 5)))"
|
||||
};
|
||||
|
||||
static std::string case_103_multi[2] =
|
||||
{
|
||||
// interior ring 'fit' (ix) / union / assemble
|
||||
"MULTIPOLYGON(((0 0,0 5,5 5,5 0,2 0,2 1,3 1,3 2,2 2,2 3,1 2,2 2,2 1,1 0,0 0)))",
|
||||
"MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0),(2 1,2 2,1 1,2 1)))"
|
||||
};
|
||||
|
||||
static std::string case_104_multi[2] =
|
||||
{
|
||||
// interior ring 'fit' (ii) / union / assemble
|
||||
"MULTIPOLYGON(((1 0,1 1,0 1,0 5,5 5,5 0,2 0,2 1,1 0),(2 2,3 3,2 3,2 2)))",
|
||||
"MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0),(1 1,3 1,3 2,1 2,1 1)))"
|
||||
};
|
||||
|
||||
static std::string case_105_multi[2] =
|
||||
{
|
||||
// interior ring 'fit' () / union / assemble
|
||||
"MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0),(2 2,3 2,3 3,1 3,2 2)))",
|
||||
"MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0),(1 1,2 1,2 2,1 1),(2 1,3 1,3 2,2 1),(1 3,3 3,3 4,2 3,2 4,1 4,1 3)))"
|
||||
};
|
||||
|
||||
static std::string case_106_multi[2] =
|
||||
{
|
||||
// interior ring 'fit' () / union / assemble
|
||||
"MULTIPOLYGON(((0 0,0 3,1 2,1 3,2 3,2 1,3 2,2 2,3 3,2 3,3 4,1 4,1 3,0 3,0 5,5 5,5 0,0 0)))",
|
||||
"MULTIPOLYGON(((0 0,0 5,1 5,1 4,2 4,2 5,3 5,3 3,4 4,5 4,5 0,2 0,3 1,2 1,2 3,1 3,2 2,1.5 1.5,2 1,1 1,0 0)),((1 0,2 1,2 0,1 0)))"
|
||||
};
|
||||
|
||||
|
||||
static std::string case_recursive_boxes_1[2] =
|
||||
{
|
||||
// == 70
|
||||
// Used in blog. KEEP
|
||||
"MULTIPOLYGON(((1 0,0 0,0 1,1 1,1 2,0 2,0 4,2 4,2 5,3 5,3 6,1 6,1 5,0 5,0 10,9 10,9 9,7 9,7 8,6 8,6 7,8 7,8 6,9 6,9 4,8 4,8 5,7 5,7 6,6 6,6 5,5 5,5 4,4 4,4 3,5 3,5 2,7 2,7 3,6 3,6 4,8 4,8 3,10 3,10 0,6 0,6 1,5 1,5 0,1 0),(4 7,4 9,3 9,3 7,4 7),(8 1,9 1,9 2,8 2,8 1)),((10 7,10 6,9 6,9 7,8 7,8 8,9 8,9 9,10 9,10 7)))",
|
||||
"MULTIPOLYGON(((1 0,0 0,0 7,2 7,2 6,5 6,5 5,4 5,4 4,5 4,5 3,7 3,7 2,6 2,6 0,1 0),(2 1,2 2,3 2,3 3,1 3,1 1,2 1)),((7 0,7 2,10 2,10 0,9 0,9 1,8 1,8 0,7 0)),((6 4,6 6,5 6,5 7,6 7,6 8,5 8,5 7,3 7,3 9,2 9,2 8,1 8,1 10,4 10,4 9,6 9,6 10,10 10,10 9,9 9,9 8,10 8,10 6,9 6,9 5,10 5,10 3,7 3,7 4,6 4),(7 7,7 6,8 6,8 7,7 7)))"
|
||||
};
|
||||
|
||||
static std::string case_recursive_boxes_2[2] =
|
||||
{
|
||||
// Traversal problem; Many ii-cases -> formerly caused "Endless loop"
|
||||
// So it appears that there might be more decisions than intersection points
|
||||
"MULTIPOLYGON(((1 0,0 0,0 4,1 4,1 5,0 5,0 10,3 10,3 9,4 9,4 10,6 10,6 9,5 9,5 8,6 8,6 9,7 9,7 10,10 10,10 0,1 0),(7 6,8 6,8 7,9 7,9 8,8 8,8 7,7 7,7 6),(9 1,9 2,8 2,8 1,9 1)))",
|
||||
"MULTIPOLYGON(((0 0,0 10,10 10,10 0,8 0,8 1,7 1,7 0,0 0),(7 3,6 3,6 2,7 2,7 3),(6 7,7 7,7 8,6 8,6 7)))"
|
||||
};
|
||||
|
||||
|
||||
static std::string case_recursive_boxes_3[2] =
|
||||
{
|
||||
// Previously a iu/ux problem causing union to fail. KEEP
|
||||
"MULTIPOLYGON(((8 3,9 4,9 3,8 3)),((5 9,5 10,6 10,5 9)),((2 0,2 1,3 0,2 0)),((2 5,2 6,3 6,3 5,2 5)),((2 2,1 2,1 3,2 3,3 2,3 1,2 1,2 2)),((6 8,7 9,7 7,8 7,7 6,6 6,6 8)),((4 6,5 7,5 6,4 6)),((4 8,4 9,5 9,5 8,4 8)),((0 3,1 4,1 3,0 3)),((8 7,9 8,9 7,8 7)),((9 6,9 7,10 7,9 6)),((7 0,8 1,8 0,7 0)),((0 4,0 5,1 5,1 4,0 4)),((4 2,5 3,5 2,4 1,4 2)),((4 10,4 9,2 9,3 10,4 10)),((5 2,6 3,7 3,7 2,6 2,6 1,5 0,5 2)),((5 3,4 3,4 4,2 4,4 6,4 5,4.5 4.5,6 6,6 5,7 4,5 4,5 3)),((10 2,9 1,9 3,10 2)),((8 4,7 4,8 5,7 5,7 6,9 6,9 5,10 5,10 4,8 4)),((1 7,0 7,0 8,1 8,1 7)),((1 10,2 10,1 9,0 9,0 10,1 10)),((6.5 9.5,7 10,7 9,6 9,6 10,6.5 9.5)),((8 8,8 9,10 9,9 8,8 8)))",
|
||||
"MULTIPOLYGON(((0 7,0 8,1 8,1 7,0 7)),((5 3,4 3,4 4,6 4,6 3,7 3,6 2,5 2,5 3)),((8 2,8 3,9 2,8 2)),((1 1,2 2,2 1,1 1)),((2 1,3 1,2 0,1 0,2 1)),((2 3,3 4,3 3,2 3)),((1 9,2 8,1 8,1 9)),((2 10,2 9,1 9,1 10,2 10)),((9 7,9 8,10 8,10 7,9 7)),((6 0,6 1,7 1,7 0,6 0)),((8 0,9 1,9 0,8 0)),((1 6,1 5,0 5,1 6)),((0 2,1 1,0 1,0 2)),((1 3,2 3,2 2,1 2,1 3)),((5 1,5 0,4 0,4 1,3 1,4 2,5 2,6 1,5 1)),((1 3,0 3,0 4,1 4,1 3)),((3 6,4 5,2 5,3 6)),((9 2,10 2,10 1,9 1,9 2)),((7 5,6 4,6 5,7 6,8 6,8 5,7 5)),((7 4,8 5,8.5 4.5,9 5,9 4,8 4,8.5 3.5,9 4,10 3,7 3,7 4)),((1 6,1 7,3 7,3 8,4 7,5 7,6 8,6 10,7 9,8 10,9 10,9 9,8 9,8 8,7 8,6 7,6 6,1 6)))"
|
||||
};
|
||||
|
||||
static std::string case_recursive_boxes_4[2] =
|
||||
{
|
||||
// SQL Server
|
||||
"MULTIPOLYGON(((3 4,3 5,4 5,3 4)),((2 5,3 6,3 5,2 4,2 5)),((1 1,0 1,0 10,2 10,3 9,3 10,9 10,9 9,8 9,8 7,7 7,7 6,5 6,6 5,9 8,8 8,10 10,10 7,9 7,9 6,10 7,10 5,9 4,10 4,10 0,5 0,5 1,4 0,3 0,3 1,2 1,2 0,0 0,1 1),(4 3,4 6,1 6,2 5,1 5,1 4,3 4,4 3),(3.5 7.5,4 7,5 7,5 8,4 8,3.5 7.5),(1 8,2 8,2 9,1 8,1 9,0.5 8.5,1 8),(6 1,7 1,7 2,6 1),(7 3,7 4,6 3,7 3),(3 2,3.5 1.5,4 2,3 2),(2 2,2 3,1.5 2.5,2 2),(7 8,7 9,6.5 8.5,7 8)))",
|
||||
"MULTIPOLYGON(((1 0,0 0,1 1,0 1,1 2,1 3,0 3,0 5,0.5 4.5,2 6,1 6,1 5,0 5,0 7,1 7,1 8,3 8,3 9,0 9,0 10,1 10,1.5 9.5,2 10,4 10,3.5 9.5,4 9,5 10,6 10,6.5 9.5,7 10,9 10,10 9,9 9,9.5 8.5,10 9,10 8,9 8,10 7,10 5,8 5,7.5 4.5,8 4,9 5,10 4,10 3,9 3,9 2,10 2,10 1,8 1,8 0,6 0,6 1,5 1,5 0,2 0,3 1,2 1,2 0,1 0),(5 7,5 8,6 8,6 9,5 8,5 9,4.5 8.5,5 8,4.5 7.5,5 7),(7 8,8 8,8 9,7 9,7 8),(2.5 6.5,3 7,4 7,4 8,3 7,2 7,2.5 6.5),(4 1,4 2,4.5 1.5,5 2,4 2,3.5 1.5,4 1),(2 4,3 5,2 5,2 4),(4 4,3 4,3 3,4 4),(4 5,4 6,3 6,4 5),(6 2,7 3,6 3,6 2),(7.5 1.5,8 2,7 2,7.5 1.5)),((0.5 8.5,1 9,1 8,0 8,0 9,0.5 8.5)))"
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // BOOST_GEOMETRY_TEST_MULTI_OVERLAY_CASES_HPP
|
||||
|
@ -6,9 +6,13 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
//#define BOOST_GEOMETRY_DEBUG_ENRICH
|
||||
//#define BOOST_GEOMETRY_DEBUG_RELATIVE_ORDER
|
||||
|
||||
// Include the single-geometry version
|
||||
#define BOOST_GEOMETRY_TEST_MULTI
|
||||
#include "traverse.cpp"
|
||||
#include <algorithms/overlay/traverse.cpp>
|
||||
|
||||
|
||||
|
||||
#include <boost/geometry/multi/core/ring_type.hpp>
|
||||
@ -26,7 +30,10 @@
|
||||
|
||||
|
||||
#include "multi_overlay_cases.hpp"
|
||||
#include "multi_svg_mapper.hpp"
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
# include "multi_svg_mapper.hpp"
|
||||
#endif
|
||||
|
||||
|
||||
// Because multi-intersections are similar to single,
|
||||
@ -38,6 +45,7 @@
|
||||
template <typename T>
|
||||
void test_all()
|
||||
{
|
||||
//goto wrong;
|
||||
namespace bg = boost::geometry;
|
||||
namespace ov = boost::geometry::detail::overlay;
|
||||
|
||||
@ -51,6 +59,8 @@ void test_all()
|
||||
|
||||
typedef boost::tuple<int, double> Tuple;
|
||||
|
||||
|
||||
// Intersections:
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
@ -58,6 +68,161 @@ void test_all()
|
||||
case_multi_simplex[0], case_multi_simplex[1]
|
||||
);
|
||||
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_65_multi", boost::make_tuple(1, 1),
|
||||
case_65_multi[0], case_65_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_66_multi", boost::make_tuple(1, 1),
|
||||
case_66_multi[0], case_66_multi[1]
|
||||
);
|
||||
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_67_multi", boost::make_tuple(1, 1),
|
||||
case_67_multi[0], case_67_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_69_multi", boost::make_tuple(1, 1),
|
||||
case_69_multi[0], case_69_multi[1]
|
||||
);
|
||||
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_71_multi", boost::make_tuple(2, 2),
|
||||
case_71_multi[0], case_71_multi[1]
|
||||
);
|
||||
|
||||
// #72, note that it intersects into 2 shapes,
|
||||
// the third one is done by assemble (see intersection #72)
|
||||
//wrong:
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_72_multi", boost::make_tuple(2, 1.35),
|
||||
case_72_multi[0], case_72_multi[1]
|
||||
);
|
||||
//return;
|
||||
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_73_multi", boost::make_tuple(2, 2),
|
||||
case_73_multi[0], case_73_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_74_multi", boost::make_tuple(2, 3),
|
||||
case_74_multi[0], case_74_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_75_multi", boost::make_tuple(1, 1),
|
||||
case_75_multi[0], case_75_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_77_multi", boost::make_tuple(5, 9),
|
||||
case_77_multi[0], case_77_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_78_multi", boost::make_tuple(3, 22),
|
||||
case_78_multi[0], case_78_multi[1]
|
||||
);
|
||||
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_80_multi", boost::make_tuple(1, 0.5),
|
||||
case_80_multi[0], case_80_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_81_multi", boost::make_tuple(1, 0.25),
|
||||
case_81_multi[0], case_81_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_83_multi", boost::make_tuple(3, 1.25),
|
||||
case_83_multi[0], case_83_multi[1]
|
||||
);
|
||||
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_91_multi", boost::make_tuple(2, 1.0),
|
||||
case_91_multi[0], case_91_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_92_multi", boost::make_tuple(3, 1.5),
|
||||
case_92_multi[0], case_92_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_93_multi", boost::make_tuple(2, 1.25),
|
||||
case_93_multi[0], case_93_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_96_multi", boost::make_tuple(2, 1.0),
|
||||
case_96_multi[0], case_96_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_98_multi", boost::make_tuple(4, 3.0),
|
||||
case_98_multi[0], case_98_multi[1]
|
||||
);
|
||||
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_99_multi", boost::make_tuple(3, 1.75),
|
||||
case_99_multi[0], case_99_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_100_multi", boost::make_tuple(2, 1.5),
|
||||
case_100_multi[0], case_100_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_101_multi", boost::make_tuple(1, 22.25),
|
||||
case_101_multi[0], case_101_multi[1]
|
||||
);
|
||||
|
||||
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_intersection>, Tuple>
|
||||
(
|
||||
"case_recursive_boxes_2", boost::make_tuple(1, 91),
|
||||
case_recursive_boxes_2[0], case_recursive_boxes_2[1]
|
||||
);
|
||||
|
||||
// Unions
|
||||
|
||||
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
@ -65,17 +230,219 @@ void test_all()
|
||||
case_multi_simplex[0], case_multi_simplex[1]
|
||||
);
|
||||
|
||||
// Bug found with "recursive boxes"
|
||||
// TODO: Solve this bug
|
||||
/***
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"recursive_box1", boost::make_tuple(1, 14.58),
|
||||
"MULTIPOLYGON(((3 9,3 10,4 10,4 9,3 9)),((1 1,1 2,2 2,2 1,1 1)),((7 8,7 9,8 9,8 8,7 8)),((8 0,8 1,9 1,9 0,8 0)))",
|
||||
"MULTIPOLYGON(((0 1,0 2,1 2,1 1,0 1)),((7 5,7 6,8 6,8 5,7 5)),((1 1,1 1,2 1,2 1,2 0,2 0,1 0,1 0,1 0,1 1)))"
|
||||
"case_61_multi", boost::make_tuple(1, 4),
|
||||
case_61_multi[0], case_61_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_62_multi", boost::make_tuple(1, 1 /*UU 2, 2 */),
|
||||
case_62_multi[0], case_62_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_63_multi", boost::make_tuple(1, 1 /*UU 2, 2 */),
|
||||
case_63_multi[0], case_63_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_64_multi", boost::make_tuple(1, 3),
|
||||
case_64_multi[0], case_64_multi[1]
|
||||
);
|
||||
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_66_multi", boost::make_tuple(1, 4 /*UU 3, 7 */),
|
||||
case_66_multi[0], case_66_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_68_multi", boost::make_tuple(1, 4 /*UU 2, 5 */),
|
||||
case_68_multi[0], case_68_multi[1]
|
||||
);
|
||||
// 71: single-polygon generates 2 shapes, multi-polygon
|
||||
// generates 1 shape, both are self-tangent and OK
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_71_multi", boost::make_tuple(1, 9),
|
||||
case_71_multi[0], case_71_multi[1]
|
||||
);
|
||||
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_72_multi", boost::make_tuple(1, 10.65),
|
||||
case_72_multi[0], case_72_multi[1]
|
||||
);
|
||||
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_73_multi", boost::make_tuple(1, 3),
|
||||
case_73_multi[0], case_73_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_74_multi", boost::make_tuple(2, 17),
|
||||
case_74_multi[0], case_74_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_75_multi", boost::make_tuple(1, 1 /*UU 5, 5 */),
|
||||
case_75_multi[0], case_75_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_76_multi", boost::make_tuple(2, 5 /*UU 6, 6 */),
|
||||
case_76_multi[0], case_76_multi[1]
|
||||
);
|
||||
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_80_multi", boost::make_tuple(1, 9.25),
|
||||
case_80_multi[0], case_80_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_81_multi", boost::make_tuple(1, 3.25),
|
||||
case_81_multi[0], case_81_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_82_multi", boost::make_tuple(3, 4),
|
||||
case_82_multi[0], case_82_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_84_multi", boost::make_tuple(1, 4),
|
||||
case_84_multi[0], case_84_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_85_multi", boost::make_tuple(1, 3.5),
|
||||
case_85_multi[0], case_85_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_86_multi", boost::make_tuple(1, 4),
|
||||
case_86_multi[0], case_86_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_87_multi", boost::make_tuple(1, 6),
|
||||
case_87_multi[0], case_87_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_88_multi", boost::make_tuple(2, 4),
|
||||
case_88_multi[0], case_88_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_89_multi", boost::make_tuple(1, 6),
|
||||
case_89_multi[0], case_89_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_90_multi", boost::make_tuple(1, 7.5),
|
||||
case_90_multi[0], case_90_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_92_multi", boost::make_tuple(2, 6.25),
|
||||
case_92_multi[0], case_92_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_94_multi", boost::make_tuple(1, 10.0),
|
||||
case_94_multi[0], case_94_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_95_multi", boost::make_tuple(2, 6.5),
|
||||
case_95_multi[0], case_95_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_96_multi", boost::make_tuple(1, 3.5),
|
||||
case_96_multi[0], case_96_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_97_multi", boost::make_tuple(1, 3.75),
|
||||
case_97_multi[0], case_97_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_102_multi", boost::make_tuple(3, 24.25),
|
||||
case_102_multi[0], case_102_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_103_multi", boost::make_tuple(1, 25),
|
||||
case_103_multi[0], case_103_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_104_multi", boost::make_tuple(1, 25),
|
||||
case_104_multi[0], case_104_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_105_multi", boost::make_tuple(1, 25),
|
||||
case_105_multi[0], case_105_multi[1]
|
||||
);
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_106_multi", boost::make_tuple(1, 25),
|
||||
case_106_multi[0], case_106_multi[1]
|
||||
);
|
||||
|
||||
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_recursive_boxes_1", boost::make_tuple(2, 97),
|
||||
case_recursive_boxes_1[0], case_recursive_boxes_1[1]
|
||||
);
|
||||
|
||||
test_overlay<multi_polygon, multi_polygon,
|
||||
test_traverse<ov::operation_union>, Tuple>
|
||||
(
|
||||
"case_recursive_boxes_3", boost::make_tuple(8, 49.5),
|
||||
case_recursive_boxes_3[0], case_recursive_boxes_3[1]
|
||||
);
|
||||
***/
|
||||
}
|
||||
|
||||
|
||||
@ -85,5 +452,3 @@ int test_main(int, char* [])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,11 +41,12 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;../../..;../../../../../..;../../../algorithms/overlay"
|
||||
AdditionalIncludeDirectories=".;../../..;../../../../../..;../../../../../../boost/geometry/extensions/contrib/ttmath;../../../algorithms/overlay"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;TEST_WITH_SVG"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
@ -113,7 +114,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=".;../../..;../../../../../..;../../../algorithms/overlay"
|
||||
AdditionalIncludeDirectories=".;../../..;../../../../../..;../../../../../../boost/geometry/extensions/contrib/ttmath;../../../algorithms/overlay"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
|
@ -6,11 +6,12 @@
|
||||
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
test-suite ggl-strategies
|
||||
test-suite boost-geometry-strategies
|
||||
:
|
||||
[ run cross_track.cpp ]
|
||||
[ run haversine.cpp ]
|
||||
[ run projected_point.cpp ]
|
||||
[ run pythagoras.cpp ]
|
||||
[ run transformer.cpp ]
|
||||
[ run within.cpp ]
|
||||
;
|
||||
|
@ -16,6 +16,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "segment_intersection_collin
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "side_by_cross_track", "side_by_cross_track.vcproj", "{ADBE38D8-1828-48A2-BBA1-81F50B53C67C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "within", "within.vcproj", "{AB13D2AC-FD34-4DE4-BD8E-4D463050E5DD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@ -54,6 +56,10 @@ Global
|
||||
{ADBE38D8-1828-48A2-BBA1-81F50B53C67C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{ADBE38D8-1828-48A2-BBA1-81F50B53C67C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{ADBE38D8-1828-48A2-BBA1-81F50B53C67C}.Release|Win32.Build.0 = Release|Win32
|
||||
{AB13D2AC-FD34-4DE4-BD8E-4D463050E5DD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{AB13D2AC-FD34-4DE4-BD8E-4D463050E5DD}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{AB13D2AC-FD34-4DE4-BD8E-4D463050E5DD}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{AB13D2AC-FD34-4DE4-BD8E-4D463050E5DD}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
136
test/strategies/within.cpp
Normal file
136
test/strategies/within.cpp
Normal file
@ -0,0 +1,136 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2010, Geodan, 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)
|
||||
|
||||
// Tests with-strategies, especially point-in-polygon
|
||||
|
||||
#include <geometry_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/within.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/cartesian/point_in_poly_franklin.hpp>
|
||||
#include <boost/geometry/strategies/cartesian/point_in_poly_crossings_multiply.hpp>
|
||||
#include <boost/geometry/strategies/agnostic/point_in_poly_winding.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/cartesian/side_by_triangle.hpp>
|
||||
|
||||
|
||||
#include <boost/geometry/geometries/point.hpp>
|
||||
#include <boost/geometry/geometries/polygon.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
|
||||
|
||||
|
||||
|
||||
namespace bg = boost::geometry;
|
||||
|
||||
|
||||
|
||||
template <typename Point, typename Polygon, typename Strategy>
|
||||
void test_point_in_polygon(std::string const& case_id,
|
||||
Point const& point, Polygon const& polygon,
|
||||
Strategy const& strategy, std::string const& strategy_id,
|
||||
bool expected)
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT( (bg::concept::WithinStrategy<Strategy>) );
|
||||
bool detected = bg::within(point, polygon, strategy);
|
||||
|
||||
BOOST_CHECK_MESSAGE(detected == expected,
|
||||
"within: " << case_id
|
||||
<< " strategy: " << strategy_id // typeid(strategy).name() is too long
|
||||
<< " output expected: " << int(expected)
|
||||
<< " detected: " << int(detected)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Point, typename Polygon>
|
||||
void test_geometry(std::string const& case_id, std::string const& wkt_point
|
||||
, std::string const& wkt_polygon
|
||||
, bool expected
|
||||
, std::string const& deviations = ""
|
||||
)
|
||||
{
|
||||
Point point;
|
||||
Polygon polygon;
|
||||
bg::read_wkt(wkt_point, point);
|
||||
bg::read_wkt(wkt_polygon, polygon);
|
||||
|
||||
namespace sw = bg::strategy::within;
|
||||
test_point_in_polygon(case_id, point, polygon, sw::winding<Point>(),
|
||||
"winding", expected);
|
||||
test_point_in_polygon(case_id, point, polygon, sw::franklin<Point>(),
|
||||
"franklin", boost::contains(deviations, "f") ? !expected : expected);
|
||||
test_point_in_polygon(case_id, point, polygon, sw::crossings_multiply<Point>(),
|
||||
"cross.mult", boost::contains(deviations, "c") ? !expected : expected);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename Point>
|
||||
void test_all()
|
||||
{
|
||||
typedef bg::polygon<Point> polygon;
|
||||
|
||||
std::string const box = "POLYGON((0 0,0 2,2 2,2 0,0 0))";
|
||||
std::string const triangle = "POLYGON((0 0,0 4,6 0,0 0))";
|
||||
std::string const with_hole = "POLYGON((0 0,0 3,3 3,3 0,0 0),(1 1,2 1,2 2,1 2,1 1))";
|
||||
|
||||
|
||||
test_geometry<Point, polygon>("b1", "POINT(1 1)", box, true);
|
||||
test_geometry<Point, polygon>("b2", "POINT(3 3)", box, false);
|
||||
|
||||
// Test ALL corners (officialy false but some strategies might answer true)
|
||||
test_geometry<Point, polygon>("b3a", "POINT(0 0)", box, false, "f");
|
||||
test_geometry<Point, polygon>("b3b", "POINT(0 2)", box, false);
|
||||
test_geometry<Point, polygon>("b3c", "POINT(2 2)", box, false);
|
||||
test_geometry<Point, polygon>("b3d", "POINT(2 0)", box, false);
|
||||
|
||||
// Test ALL sides (officialy false but some strategies might answer true)
|
||||
test_geometry<Point, polygon>("b4a", "POINT(0 1)", box, false, "f");
|
||||
test_geometry<Point, polygon>("b4b", "POINT(1 2)", box, false, "c");
|
||||
test_geometry<Point, polygon>("b4c", "POINT(2 1)", box, false);
|
||||
test_geometry<Point, polygon>("b4d", "POINT(1 0)", box, false, "f");
|
||||
|
||||
|
||||
test_geometry<Point, polygon>("t1", "POINT(1 1)", triangle, true);
|
||||
test_geometry<Point, polygon>("t2", "POINT(3 3)", triangle, false);
|
||||
|
||||
test_geometry<Point, polygon>("t3a", "POINT(0 0)", triangle, false, "f");
|
||||
test_geometry<Point, polygon>("t3b", "POINT(0 4)", triangle, false, "c");
|
||||
test_geometry<Point, polygon>("t3c", "POINT(5 0)", triangle, false, "f");
|
||||
|
||||
test_geometry<Point, polygon>("t4a", "POINT(0 2)", triangle, false, "f");
|
||||
test_geometry<Point, polygon>("t4b", "POINT(3 2)", triangle, false);
|
||||
test_geometry<Point, polygon>("t4c", "POINT(2 0)", triangle, false, "f");
|
||||
|
||||
|
||||
test_geometry<Point, polygon>("h1", "POINT(0.5 0.5)", with_hole, true);
|
||||
test_geometry<Point, polygon>("h2a", "POINT(1.5 1.5)", with_hole, false);
|
||||
test_geometry<Point, polygon>("h2b", "POINT(5 5)", with_hole, false);
|
||||
|
||||
test_geometry<Point, polygon>("h3a", "POINT(1 1)", with_hole, false, "c");
|
||||
test_geometry<Point, polygon>("h3b", "POINT(2 2)", with_hole, false, "f");
|
||||
test_geometry<Point, polygon>("h3c", "POINT(0 0)", with_hole, false, "f");
|
||||
|
||||
test_geometry<Point, polygon>("h4a", "POINT(1 1.5)", with_hole, false);
|
||||
test_geometry<Point, polygon>("h4b", "POINT(1.5 2)", with_hole, false, "f");
|
||||
|
||||
// Lying ON (one of the sides of) interior ring
|
||||
test_geometry<Point, polygon>("#77-1", "POINT(6 3.5)", "POLYGON((5 3,5 4,4 4,4 5,3 5,3 6,5 6,5 5,7 5,7 6,8 6,8 5,9 5,9 2,8 2,8 1,7 1,7 2,5 2,5 3),(6 3,8 3,8 4,6 4,6 3))", false);
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_all<bg::point<float, 2, bg::cs::cartesian> >();
|
||||
test_all<bg::point<double, 2, bg::cs::cartesian> >();
|
||||
|
||||
#if defined(HAVE_TTMATH)
|
||||
test_all<bg::point<ttmath_big, 2, bg::cs::cartesian> >();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
174
test/strategies/within.vcproj
Normal file
174
test/strategies/within.vcproj
Normal file
@ -0,0 +1,174 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="within"
|
||||
ProjectGUID="{AB13D2AC-FD34-4DE4-BD8E-4D463050E5DD}"
|
||||
RootNamespace="within"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\within"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../..;.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\within"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../..;.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\within.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -11,6 +11,6 @@
|
||||
/>
|
||||
<UserMacro
|
||||
Name="TTMATH_ROOT"
|
||||
Value="../../../../boost/geometry/extensions/contrib"
|
||||
Value="c:\_svn\boost\sandbox\geometry\boost\geometry\extensions\contrib\ttmath"
|
||||
/>
|
||||
</VisualStudioPropertySheet>
|
||||
|
@ -19,6 +19,59 @@
|
||||
#include <boost/geometry/geometries/cartesian2d.hpp>
|
||||
#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
|
||||
|
||||
// The closeable view should also work on normal std:: containers
|
||||
void test_non_geometry()
|
||||
{
|
||||
typedef boost::geometry::closeable_view
|
||||
<
|
||||
std::vector<int> const, true
|
||||
> view_type;
|
||||
|
||||
std::vector<int> v;
|
||||
v.push_back(1);
|
||||
v.push_back(2);
|
||||
v.push_back(3);
|
||||
|
||||
view_type view(v);
|
||||
|
||||
typedef boost::range_iterator<view_type const>::type iterator;
|
||||
iterator it = boost::begin(view);
|
||||
iterator end = boost::end(view);
|
||||
|
||||
std::ostringstream out;
|
||||
for ( ; it != end; ++it)
|
||||
{
|
||||
out << *it;
|
||||
}
|
||||
BOOST_CHECK_EQUAL(out.str(), "1231");
|
||||
|
||||
// Check operators =, ++, --, +=, -=
|
||||
it = boost::begin(view);
|
||||
BOOST_CHECK_EQUAL(*it, 1);
|
||||
it += 2;
|
||||
BOOST_CHECK_EQUAL(*it, 3);
|
||||
it -= 2;
|
||||
BOOST_CHECK_EQUAL(*it, 1);
|
||||
it++;
|
||||
BOOST_CHECK_EQUAL(*it, 2);
|
||||
it--;
|
||||
BOOST_CHECK_EQUAL(*it, 1);
|
||||
|
||||
// Also check them in the last regions
|
||||
it = boost::begin(view) + 3;
|
||||
BOOST_CHECK_EQUAL(*it, 1);
|
||||
it--;
|
||||
BOOST_CHECK_EQUAL(*it, 3);
|
||||
it++;
|
||||
BOOST_CHECK_EQUAL(*it, 1);
|
||||
it -= 2;
|
||||
BOOST_CHECK_EQUAL(*it, 2);
|
||||
it += 2;
|
||||
BOOST_CHECK_EQUAL(*it, 1);
|
||||
|
||||
BOOST_CHECK_EQUAL(boost::size(view), 4);
|
||||
}
|
||||
|
||||
|
||||
template <bool Close, typename Range>
|
||||
void test_optionally_closing(Range const& range, std::string const& expected)
|
||||
@ -65,6 +118,8 @@ void test_all()
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_non_geometry();
|
||||
|
||||
namespace bg = boost::geometry;
|
||||
test_all<bg::point_2d>();
|
||||
test_all<bg::point<int, 2, bg::cs::cartesian> >();
|
||||
|
Loading…
x
Reference in New Issue
Block a user