Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81957 - trunk/libs/geometry/test/multi/algorithms
From: barend.gehrels_at_[hidden]
Date: 2012-12-14 17:31:20


Author: barendgehrels
Date: 2012-12-14 17:31:19 EST (Fri, 14 Dec 2012)
New Revision: 81957
URL: http://svn.boost.org/trac/boost/changeset/81957

Log:
[geometry] added combinations point/ring, point/polygon, point/multi_polygon for disjoint and intersects (unit tests, multi)
Added:
   trunk/libs/geometry/test/multi/algorithms/multi_intersects.cpp (contents, props changed)
Text files modified:
   trunk/libs/geometry/test/multi/algorithms/Jamfile.v2 | 1 +
   trunk/libs/geometry/test/multi/algorithms/multi_disjoint.cpp | 34 ++++++++++++++++++++++++++++++++++
   2 files changed, 35 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-12-14 17:31:19 EST (Fri, 14 Dec 2012)
@@ -23,6 +23,7 @@
     [ run multi_equals.cpp ]
     [ run multi_for_each.cpp ]
     [ run multi_intersection.cpp ]
+ [ run multi_intersects.cpp ]
     [ run multi_length.cpp ]
     [ run multi_num_geometries.cpp ]
     [ run multi_num_interior_rings.cpp ]

Modified: trunk/libs/geometry/test/multi/algorithms/multi_disjoint.cpp
==============================================================================
--- trunk/libs/geometry/test/multi/algorithms/multi_disjoint.cpp (original)
+++ trunk/libs/geometry/test/multi/algorithms/multi_disjoint.cpp 2012-12-14 17:31:19 EST (Fri, 14 Dec 2012)
@@ -22,6 +22,7 @@
 #include <boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp>
 #include <boost/geometry/multi/algorithms/detail/point_on_border.hpp>
 #include <boost/geometry/multi/algorithms/detail/for_each_range.hpp>
+#include <boost/geometry/multi/algorithms/disjoint.hpp>
 #include <boost/geometry/multi/algorithms/within.hpp>
 #include <boost/geometry/multi/core/closure.hpp>
 #include <boost/geometry/multi/core/geometry_id.hpp>
@@ -97,6 +98,39 @@
         "MULTIPOLYGON(((2 12,2 18,8 18,8 12,2 12)),((22 2,28 2,28 8,22 8,22 2)))",
         "MULTIPOLYGON(((2 2,2 8,8 8,8 2,2 2)),((20 0,20 10,30 10,30 0,20 0)))",
         false);
+
+
+ test_disjoint<P, mp>("point_mp1",
+ "POINT(0 0)",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ false);
+
+ test_disjoint<P, mp>("point_mp2",
+ "POINT(5 5)",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ false);
+
+ test_disjoint<P, mp>("point_mp1",
+ "POINT(11 11)",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ true);
+
+ std::string polygon_inside_hole("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0), (2 2,8 2,8 8,2 8,2 2)),((4 4,4 6,6 6,6 4,4 4)))");
+ test_disjoint<P, mp>("point_mp_pih1",
+ "POINT(5 5)",
+ polygon_inside_hole,
+ false);
+
+ test_disjoint<P, mp>("point_mp_pih2",
+ "POINT(3 3)",
+ polygon_inside_hole,
+ true);
+
+ test_disjoint<mp, P>("point_mp1rev",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ "POINT(0 0)",
+ false);
+
 }
 
 int test_main(int, char* [])

Added: trunk/libs/geometry/test/multi/algorithms/multi_intersects.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/multi/algorithms/multi_intersects.cpp 2012-12-14 17:31:19 EST (Fri, 14 Dec 2012)
@@ -0,0 +1,51 @@
+// 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 <algorithms/test_intersects.hpp>
+
+#include <boost/geometry.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/point_xy.hpp>
+#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+
+template <typename P>
+void test_all()
+{
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::multi_polygon<polygon> mp;
+
+ test_geometry<mp, mp>("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ true);
+
+ test_geometry<P, mp>("POINT(0 0)",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ true);
+
+}
+
+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;
+}
+


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