Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78683 - in trunk/libs/geometry/test/multi: . algorithms
From: barend.gehrels_at_[hidden]
Date: 2012-05-27 10:47:19


Author: barendgehrels
Date: 2012-05-27 10:47:19 EDT (Sun, 27 May 2012)
New Revision: 78683
URL: http://svn.boost.org/trac/boost/changeset/78683

Log:
[geometry] added test for multi/disjoint (with case to be fixed)
Added:
   trunk/libs/geometry/test/multi/algorithms/multi_disjoint.cpp (contents, props changed)
   trunk/libs/geometry/test/multi/algorithms/multi_disjoint.vcproj (contents, props changed)
Text files modified:
   trunk/libs/geometry/test/multi/algorithms/Jamfile.v2 | 1 +
   trunk/libs/geometry/test/multi/multi_tests.sln | 6 ++++++
   2 files changed, 7 insertions(+), 0 deletions(-)

Modified: trunk/libs/geometry/test/multi/algorithms/Jamfile.v2
==============================================================================
--- trunk/libs/geometry/test/multi/algorithms/Jamfile.v2 (original)
+++ trunk/libs/geometry/test/multi/algorithms/Jamfile.v2 2012-05-27 10:47:19 EDT (Sun, 27 May 2012)
@@ -17,6 +17,7 @@
     [ run multi_correct.cpp ]
     [ run multi_covered_by.cpp ]
     [ run multi_difference.cpp ]
+ [ run multi_disjoint.cpp ]
     [ run multi_distance.cpp ]
     [ run multi_envelope.cpp ]
     [ run multi_equals.cpp ]

Added: trunk/libs/geometry/test/multi/algorithms/multi_disjoint.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/multi/algorithms/multi_disjoint.cpp 2012-05-27 10:47:19 EDT (Sun, 27 May 2012)
@@ -0,0 +1,118 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2012 Barend Gehrels, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <iostream>
+#include <string>
+
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/disjoint.hpp>
+#include <boost/geometry/io/wkt/read.hpp>
+#include <boost/geometry/multi/io/wkt/read.hpp>
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp>
+#include <boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp>
+#include <boost/geometry/multi/algorithms/detail/point_on_border.hpp>
+#include <boost/geometry/multi/algorithms/within.hpp>
+#include <boost/geometry/multi/core/closure.hpp>
+#include <boost/geometry/multi/core/geometry_id.hpp>
+#include <boost/geometry/multi/core/ring_type.hpp>
+#include <boost/geometry/multi/views/detail/range_type.hpp>
+
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+
+#include <test_common/test_point.hpp>
+
+#include <algorithms/test_relate.hpp>
+
+
+template <typename G1, typename G2>
+void test_disjoint(std::string const& id,
+ std::string const& wkt1,
+ std::string const& wkt2, bool expected)
+{
+ G1 g1;
+ bg::read_wkt(wkt1, g1);
+
+ G2 g2;
+ bg::read_wkt(wkt2, g2);
+
+ bool detected = bg::disjoint(g1, g2);
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "disjoint: " << id
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::multi_polygon<polygon> mp;
+
+ test_disjoint<mp, mp>("",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ false);
+
+ // True disjoint
+ test_disjoint<mp, mp>("",
+ "MULTIPOLYGON(((0 0,0 4,4 4,4 0,0 0)))",
+ "MULTIPOLYGON(((6 6,6 10,10 10,10 6,6 6)))",
+ true);
+
+ // Touch -> not disjoint
+ test_disjoint<mp, mp>("",
+ "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)))",
+ "MULTIPOLYGON(((5 5,5 10,10 10,10 5,5 5)))",
+ false);
+
+ // Not disjoint but no IP's
+ test_disjoint<mp, mp>("no_ips",
+ "MULTIPOLYGON(((2 2,2 8,8 8,8 2,2 2)),((20 0,20 10,30 10,30 0,20 0)))",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((22 2,28 2,28 8,22 8,22 2)))",
+ false);
+
+ // Not disjoint and not inside each other (in first ring) but wrapped (in second rings)
+ // TODO: fix this case
+ //test_disjoint<mp, mp>("no_ips2",
+ // "MULTIPOLYGON(((2 2,2 8,8 8,8 2,2 2)),((20 0,20 10,30 10,30 0,20 0)))",
+ // "MULTIPOLYGON(((2 12,2 18,8 18,8 12,2 12)),((22 2,28 2,28 8,22 8,22 2)))",
+ // false);
+}
+
+int test_main(int, char* [])
+{
+ //test_all<bg::model::d2::point_xy<float> >();
+ test_all<bg::model::d2::point_xy<double> >();
+
+#ifdef HAVE_TTMATH
+ test_all<bg::model::d2::point_xy<ttmath_big> >();
+#endif
+
+ return 0;
+}
+
+
+/*
+with viewy as
+(
+select geometry::STGeomFromText('MULTIPOLYGON(((2 2,2 8,8 8,8 2,2 2)),((20 0,20 10,30 10,30 0,20 0)))',0) as p
+ , geometry::STGeomFromText('MULTIPOLYGON(((2 12,2 18,8 18,8 12,2 12)),((22 2,28 2,28 8,22 8,22 2)))',0) as q
+)
+ select p from viewy union all select q from viewy
+-- select p.STDisjoint(q) from viewy
+*/
\ No newline at end of file

Added: trunk/libs/geometry/test/multi/algorithms/multi_disjoint.vcproj
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/multi/algorithms/multi_disjoint.vcproj 2012-05-27 10:47:19 EDT (Sun, 27 May 2012)
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="multi_disjoint"
+ ProjectGUID="{5DEA6558-9DF7-42D4-AF10-4D6D8BB7EAD1}"
+ RootNamespace="multi_disjoint"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\multi_disjoint"
+ 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)\multi_disjoint"
+ 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=".\multi_disjoint.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Modified: trunk/libs/geometry/test/multi/multi_tests.sln
==============================================================================
--- trunk/libs/geometry/test/multi/multi_tests.sln (original)
+++ trunk/libs/geometry/test/multi/multi_tests.sln 2012-05-27 10:47:19 EDT (Sun, 27 May 2012)
@@ -46,6 +46,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_convert", "algorithms\multi_convert.vcproj", "{21B7EF55-23C3-4FD2-9F2F-FD8F0F3FE167}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_disjoint", "algorithms\multi_disjoint.vcproj", "{5DEA6558-9DF7-42D4-AF10-4D6D8BB7EAD1}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -144,6 +146,10 @@
                 {21B7EF55-23C3-4FD2-9F2F-FD8F0F3FE167}.Debug|Win32.Build.0 = Debug|Win32
                 {21B7EF55-23C3-4FD2-9F2F-FD8F0F3FE167}.Release|Win32.ActiveCfg = Release|Win32
                 {21B7EF55-23C3-4FD2-9F2F-FD8F0F3FE167}.Release|Win32.Build.0 = Release|Win32
+ {5DEA6558-9DF7-42D4-AF10-4D6D8BB7EAD1}.Debug|Win32.ActiveCfg = Debug|Win32
+ {5DEA6558-9DF7-42D4-AF10-4D6D8BB7EAD1}.Debug|Win32.Build.0 = Debug|Win32
+ {5DEA6558-9DF7-42D4-AF10-4D6D8BB7EAD1}.Release|Win32.ActiveCfg = Release|Win32
+ {5DEA6558-9DF7-42D4-AF10-4D6D8BB7EAD1}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk