Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57148 - in sandbox/ggl/formal_review_request/libs/ggl/test: algorithms core multi/algorithms point_concept
From: barend.gehrels_at_[hidden]
Date: 2009-10-25 06:35:12


Author: barendgehrels
Date: 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
New Revision: 57148
URL: http://svn.boost.org/trac/boost/changeset/57148

Log:
Updates to test to reflect concept additions
Added:
   sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/centroid.cpp (contents, props changed)
   sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/test_centroid.hpp (contents, props changed)
   sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/test_within.hpp (contents, props changed)
   sandbox/ggl/formal_review_request/libs/ggl/test/multi/algorithms/multi_centroid.cpp (contents, props changed)
   sandbox/ggl/formal_review_request/libs/ggl/test/multi/algorithms/multi_within.cpp (contents, props changed)
   sandbox/ggl/formal_review_request/libs/ggl/test/point_concept/concept_checker.cpp (contents, props changed)
Text files modified:
   sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/Jamfile.v2 | 2
   sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/area.cpp | 49 ++++++++++++-----
   sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/test_area.hpp | 6 +-
   sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/within.cpp | 110 ++++++---------------------------------
   sandbox/ggl/formal_review_request/libs/ggl/test/core/access.cpp | 4 -
   sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_dimension.cpp | 1
   sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_system.cpp | 1
   sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_type.cpp | 1
   sandbox/ggl/formal_review_request/libs/ggl/test/core/geometry_id.cpp | 1
   sandbox/ggl/formal_review_request/libs/ggl/test/core/point_type.cpp | 1
   sandbox/ggl/formal_review_request/libs/ggl/test/core/tag.cpp | 1
   sandbox/ggl/formal_review_request/libs/ggl/test/core/topological_dimension.cpp | 1
   sandbox/ggl/formal_review_request/libs/ggl/test/multi/algorithms/Jamfile.v2 | 1
   sandbox/ggl/formal_review_request/libs/ggl/test/point_concept/Jamfile.v2 | 1
   sandbox/ggl/formal_review_request/libs/ggl/test/point_concept/function_asserting_a_point.hpp | 2
   sandbox/ggl/formal_review_request/libs/ggl/test/point_concept/function_requiring_a_point.hpp | 2
   16 files changed, 61 insertions(+), 123 deletions(-)

Modified: sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/Jamfile.v2
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/Jamfile.v2 (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/Jamfile.v2 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -12,7 +12,7 @@
     [ run area.cpp ]
 # [ run assign.cpp ]
 # [ run buffer.cpp ]
-# [ run centroid.cpp ]
+ [ run centroid.cpp ]
 # [ run combine.cpp ]
 # [ run convert.cpp ]
     [ run convex_hull.cpp ]

Modified: sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/area.cpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/area.cpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/area.cpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -6,6 +6,7 @@
 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
+
 #include <ggl_test_common.hpp>
 
 #include <ggl/algorithms/area.hpp>
@@ -14,26 +15,13 @@
 
 #include <ggl/geometries/point.hpp>
 #include <ggl/geometries/box.hpp>
-#include <ggl/geometries/nsphere.hpp>
 #include <ggl/geometries/linear_ring.hpp>
 #include <ggl/geometries/polygon.hpp>
 
-#include <algorithms/test_area.hpp>
-
-
+//#define GGL_TEST_DEBUG
 
-template <typename P, typename T>
-void test_area_circle()
-{
- ggl::nsphere<P, T> c;
-
- ggl::set<0>(c.center(), 0);
- ggl::set<1>(c.center(), 0);
- c.radius(2);
+#include <algorithms/test_area.hpp>
 
- double d = ggl::area(c);
- BOOST_CHECK_CLOSE(d, 4 * 3.1415926535897932384626433832795, 0.001);
-}
 
 
 template <typename P>
@@ -61,6 +49,28 @@
             ("POLYGON((0 0,0 7,4 2,2 0,0 0), (1 1,2 1,2 2,1 2,1 1))", -15.0);
 }
 
+template <typename Point>
+void test_spherical()
+{
+ ggl::polygon<Point> geometry;
+
+ // unit-sphere has area of 4-PI. Polygon covering 1/8 of it:
+ double expected = 4.0 * ggl::math::pi / 8.0;
+ ggl::read_wkt("POLYGON((0 0,0 90,90 0,0 0))", geometry);
+
+ double area = ggl::area(geometry);
+ BOOST_CHECK_CLOSE(area, expected, 0.0001);
+
+ // With strategy, radius 2 -> 4 pi r^2
+ ggl::strategy::area::huiller
+ <
+ typename ggl::point_type<Point>::type
+ > strategy(2.0);
+
+ area = ggl::area(geometry, strategy);
+ BOOST_CHECK_CLOSE(area, 2.0 * 2.0 * expected, 0.0001);
+}
+
 
 int test_main(int, char* [])
 {
@@ -68,5 +78,14 @@
     test_all<ggl::point<float, 2, ggl::cs::cartesian> >();
     test_all<ggl::point<double, 2, ggl::cs::cartesian> >();
 
+ test_spherical<ggl::point<double, 2, ggl::cs::spherical<ggl::degree> > >();
+
+#if defined(HAVE_CLN)
+ test_all<ggl::point_xy<boost::numeric_adaptor::cln_value_type> >();
+#endif
+#if defined(HAVE_GMP)
+ test_all<ggl::point_xy<boost::numeric_adaptor::gmp_value_type> >();
+#endif
+
     return 0;
 }

Added: sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/centroid.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/centroid.cpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -0,0 +1,84 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// 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 <ggl_test_common.hpp>
+
+
+#include <ggl/algorithms/centroid.hpp>
+
+#include <ggl/algorithms/distance.hpp>
+
+#include <ggl/extensions/gis/io/wkt/read_wkt.hpp>
+
+#include <ggl/geometries/geometries.hpp>
+#include <ggl/geometries/adapted/c_array_cartesian.hpp>
+#include <ggl/geometries/adapted/tuple_cartesian.hpp>
+
+#include <algorithms/test_centroid.hpp>
+
+
+template <typename P>
+void test_2d()
+{
+ test_centroid<ggl::linear_ring<P> >(
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2"
+ ",3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))",
+ 4.06923363095238, 1.65055803571429);
+ test_centroid<ggl::polygon<P> >(
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2"
+ ",3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))",
+ 4.06923363095238, 1.65055803571429);
+
+ // with holes
+ test_centroid<ggl::polygon<P> >(
+ "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2"
+ ",3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)"
+ ",(4 2,4.2 1.4,4.8 1.9,4.4 2.2,4 2))"
+ ,
+ 4.0466264962959677, 1.6348996057331333);
+
+
+ // ccw
+ test_centroid<ggl::linear_ring<P, std::vector, false> >(
+ "POLYGON((2 1.3,2.9 0.7,4.9 0.8,5.4 1.2,5.3 2.6,4.1 3,3.4 2"
+ ",3.7 1.6,3.4 1.2,2.8 1.8,2.4 1.7,2 1.3))",
+ 4.06923363095238, 1.65055803571429);
+
+
+ test_centroid<ggl::box<P> >("POLYGON((1 2,3 4))", 2, 3);
+ test_centroid<P>("POINT(3 3)", 3, 3);
+}
+
+template <typename P>
+void test_3d()
+{
+ test_centroid<ggl::box<P> >("POLYGON((1 2 3,5 6 7))", 3, 4, 5);
+ test_centroid<P>("POINT(1 2 3)", 1, 2, 3);
+}
+
+
+
+int test_main(int, char* [])
+{
+ test_2d<ggl::point_xy<double> >();
+ test_2d<boost::tuple<float, float> >();
+ test_2d<ggl::point_xy<float> >();
+
+ test_3d<boost::tuple<double, double, double> >();
+
+
+#if defined(HAVE_CLN)
+ test_2d<ggl::point_xy<boost::numeric_adaptor::cln_value_type> >();
+#endif
+#if defined(HAVE_GMP)
+ test_2d<ggl::point_xy<boost::numeric_adaptor::gmp_value_type> >();
+#endif
+
+ return 0;
+}

Modified: sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/test_area.hpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/test_area.hpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/test_area.hpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -19,9 +19,9 @@
 #ifdef GGL_TEST_DEBUG
     std::ostringstream out;
     out << typeid(typename ggl::coordinate_type<Geometry>::type).name()
- << std::endl
+ << " "
         << typeid(typename ggl::area_result<Geometry>::type).name()
- << std::endl
+ << " "
         << "area : " << ggl::area(geometry)
         << std::endl;
     std::cout << out.str();
@@ -44,8 +44,8 @@
> strategy2;
 
     area = ggl::area(geometry, strategy2);
-}
 
+}
 
 template <typename Geometry>
 void test_geometry(std::string const& wkt, double expected_area)

Added: sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/test_centroid.hpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/test_centroid.hpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -0,0 +1,86 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef GGL_TEST_CENTROID_HPP
+#define GGL_TEST_CENTROID_HPP
+
+// Test-functionality, shared between single and multi tests
+
+template<std::size_t D>
+struct check_result
+{
+};
+
+template <>
+struct check_result<2>
+{
+ template <typename Point, typename T>
+ static void apply(Point const& p, T const& x, T const& y, T const&)
+ {
+ BOOST_CHECK_CLOSE(double(ggl::get<0>(p)), double(x), 0.001);
+ BOOST_CHECK_CLOSE(double(ggl::get<1>(p)), double(y), 0.001);
+ }
+};
+
+
+template <>
+struct check_result<3>
+{
+ template <typename Point, typename T>
+ static void apply(Point const& p, T const& x, T const& y, T const& z)
+ {
+ BOOST_CHECK_CLOSE(double(ggl::get<0>(p)), double(x), 0.001);
+ BOOST_CHECK_CLOSE(double(ggl::get<1>(p)), double(y), 0.001);
+ BOOST_CHECK_CLOSE(double(ggl::get<2>(p)), double(z), 0.001);
+ }
+};
+
+
+
+template <typename CalculationType, typename Geometry, typename Point>
+void test_with_other_calculation_type(Geometry const& geometry, Point& c1)
+{
+ typedef typename ggl::point_type<Geometry>::type point_type;
+ // Calculate it with user defined strategy
+ point_type c2;
+ ggl::centroid(geometry, c2,
+ ggl::strategy::centroid::bashein_detmer<point_type, point_type, CalculationType>());
+
+ std::cout << typeid(CalculationType).name() << ": " << std::setprecision(20)
+ << ggl::get<0>(c2) << " " << ggl::get<1>(c2)
+ << " -> difference: " << ggl::distance(c1, c2)
+ << std::endl;
+}
+
+template <typename Geometry, typename T>
+void test_centroid(std::string const& wkt, T const& x, T const& y, T const& z = T())
+{
+ Geometry geometry;
+ ggl::read_wkt(wkt, geometry);
+ typedef typename ggl::point_type<Geometry>::type point_type;
+ point_type c1;
+ ggl::centroid(geometry, c1);
+ check_result<ggl::dimension<Geometry>::type::value>::apply(c1, x, y, z);
+
+#ifdef REPORT_RESULTS
+ std::cout << "normal: " << std::setprecision(20) << ggl::get<0>(c1) << " " << ggl::get<1>(c1) << std::endl;
+
+ //test_with_other_calculation_type<long long>(geometry, c1);
+ test_with_other_calculation_type<float>(geometry, c1);
+ test_with_other_calculation_type<long double>(geometry, c1);
+#if defined(HAVE_GMP)
+ test_with_other_calculation_type<boost::numeric_adaptor::gmp_value_type>(geometry, c1);
+#endif
+#if defined(HAVE_CLN)
+ test_with_other_calculation_type<boost::numeric_adaptor::cln_value_type>(geometry, c1);
+#endif
+
+#endif
+}
+
+
+#endif

Added: sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/test_within.hpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/test_within.hpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -0,0 +1,93 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef GGL_TEST_WITHIN_HPP
+#define GGL_TEST_WITHIN_HPP
+
+// Test-functionality, shared between single and multi tests
+
+
+template <typename Point, typename Geometry>
+void test_geometry(std::string const& wkt_point,
+ std::string const& wkt_geometry, bool expected)
+{
+ Geometry geometry;
+ Point point;
+
+ ggl::read_wkt(wkt_geometry, geometry);
+ ggl::read_wkt(wkt_point, point);
+
+ bool detected = ggl::within(point, geometry);
+
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "within: " << wkt_point
+ << " in " << wkt_geometry
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+template <typename Point, bool CW>
+void test_ordered_ring(std::string const& wkt_point,
+ std::string const& wkt_geometry, bool expected, bool on_border)
+{
+ typedef ggl::linear_ring<Point, std::vector, CW> ring_type;
+ ring_type ring;
+ Point point;
+
+ ggl::read_wkt(wkt_geometry, ring);
+ if (! CW)
+ {
+ std::reverse(boost::begin(ring), boost::end(ring));
+ }
+ ggl::read_wkt(wkt_point, point);
+
+ bool detected = ggl::within(point, ring);
+
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "within: " << wkt_point
+ << " in " << wkt_geometry
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+
+ // other strategy (note that this one cannot detect OnBorder
+ // (without modifications)
+
+ ggl::strategy::within::franklin<Point> franklin;
+ detected = ggl::within(point, ring, franklin);
+ if (! on_border)
+ {
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "within: " << wkt_point
+ << " in " << wkt_geometry
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+ }
+
+
+ ggl::strategy::within::crossings_multiply<Point> cm;
+ detected = ggl::within(point, ring, cm);
+ if (! on_border)
+ {
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "within: " << wkt_point
+ << " in " << wkt_geometry
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+ }
+}
+
+template <typename Point>
+void test_ring(std::string const& wkt_point,
+ std::string const& wkt_geometry,
+ bool expected, bool on_border)
+{
+ test_ordered_ring<Point, true>(wkt_point, wkt_geometry, expected, on_border);
+ test_ordered_ring<Point, false>(wkt_point, wkt_geometry, expected, on_border);
+ test_geometry<Point, ggl::polygon<Point> >(wkt_point, wkt_geometry, expected);
+}
+
+#endif

Modified: sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/within.cpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/within.cpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/within.cpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -21,94 +21,25 @@
 #include <ggl/geometries/point_xy.hpp>
 #include <ggl/geometries/polygon.hpp>
 
-
-template <typename Point, typename Geometry>
-void test_geometry(std::string const& wkt_point,
- std::string const& wkt_geometry, bool expected)
-{
- Geometry geometry;
- Point point;
-
- ggl::read_wkt(wkt_geometry, geometry);
- ggl::read_wkt(wkt_point, point);
-
- bool detected = ggl::within(point, geometry);
-
- BOOST_CHECK_MESSAGE(detected == expected,
- "within: " << wkt_point
- << " in " << wkt_geometry
- << " -> Expected: " << expected
- << " detected: " << detected);
-}
-
-template <typename Geometry>
-void test_circle(std::string const& wkt_geometry, bool expected)
-{
- ggl::circle circle;
- ggl::assign(circle, 1.0, 1.0, 3.0);
-
- Geometry geometry;
- ggl::read_wkt(wkt_geometry, geometry);
-
- bool detected = ggl::within(geometry, circle);
-
- BOOST_CHECK_MESSAGE(detected == expected,
- "within: " << wkt_geometry
- << " in circle (1,1) with radius 3"
- << " -> Expected: " << expected
- << " detected: " << detected);
-}
-
-template <typename Point, bool CW>
-void test_ordered_ring(std::string const& wkt_point,
- std::string const& wkt_geometry, bool expected)
-{
- ggl::linear_ring<Point, std::vector, CW> ring;
- Point point;
-
- ggl::read_wkt(wkt_geometry, ring);
- if (! CW)
- {
- std::reverse(boost::begin(ring), boost::end(ring));
- }
- ggl::read_wkt(wkt_point, point);
-
- bool detected = ggl::within(point, ring);
-
- BOOST_CHECK_MESSAGE(detected == expected,
- "within: " << wkt_point
- << " in " << wkt_geometry
- << " -> Expected: " << expected
- << " detected: " << detected);
-}
-
-template <typename Point>
-void test_ring(std::string const& wkt_point,
- std::string const& wkt_geometry, bool expected)
-{
- test_ordered_ring<Point, true>(wkt_point, wkt_geometry, expected);
- test_ordered_ring<Point, false>(wkt_point, wkt_geometry, expected);
- test_geometry<Point, ggl::polygon<Point> >(wkt_point, wkt_geometry, expected);
-}
-
+#include <algorithms/test_within.hpp>
 
 template <typename P>
 void test_all()
 {
     // trivial case
- test_ring<P>("POINT(1 1)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", true);
+ test_ring<P>("POINT(1 1)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", true, false);
 
     // on border/corner
- test_ring<P>("POINT(0 0)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", false);
- test_ring<P>("POINT(0 1)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", false);
+ test_ring<P>("POINT(0 0)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", false, true);
+ test_ring<P>("POINT(0 1)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", false, true);
 
     // aligned to segment/vertex
- test_ring<P>("POINT(1 1)", "POLYGON((0 0,0 3,3 3,3 1,2 1,2 0,0 0))", true);
- test_ring<P>("POINT(1 1)", "POLYGON((0 0,0 3,4 3,3 1,2 2,2 0,0 0))", true);
+ test_ring<P>("POINT(1 1)", "POLYGON((0 0,0 3,3 3,3 1,2 1,2 0,0 0))", true, false);
+ test_ring<P>("POINT(1 1)", "POLYGON((0 0,0 3,4 3,3 1,2 2,2 0,0 0))", true, false);
 
- // same polygon, but point outside
- test_ring<P>("POINT(3 3)", "POLYGON((0 0,0 3,3 3,3 1,2 1,2 0,0 0))", false);
- test_ring<P>("POINT(3 3)", "POLYGON((0 0,0 3,4 3,3 1,2 2,2 0,0 0))", false);
+ // same polygon, but point on border
+ test_ring<P>("POINT(3 3)", "POLYGON((0 0,0 3,3 3,3 1,2 1,2 0,0 0))", false, true);
+ test_ring<P>("POINT(3 3)", "POLYGON((0 0,0 3,4 3,3 1,2 2,2 0,0 0))", false, true);
 
     // holes
     test_geometry<P, ggl::polygon<P> >("POINT(2 2)",
@@ -117,6 +48,14 @@
 
     test_geometry<P, ggl::box<P> >("POINT(1 1)", "BOX(0 0,2 2)", true);
 
+ // Mixed point types
+ test_geometry
+ <
+ ggl::point_xy<float>,
+ ggl::polygon<P>
+ >("POINT(1 1)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", true);
+
+
     // Real-life problem (solved now), point is in the middle, 409623 is also a coordinate
     // on the border, it was wrong first.
     test_ring<P>("POINT(146383 409623)",
@@ -126,27 +65,16 @@
         ",147993 409457,147961 409352,147261 408687,147008 408586,145714 408840"
         ",145001 409033,144486 409066,144616 409308,145023 410286,145254 410488"
         ",145618 410612,145618 410612,146015 410565,146190 410545,146351 410597))",
- true);
+ true, false);
 }
 
 
-template <typename P>
-void test_circles()
-{
- // Circles do not yet run on CLN/GMP
- test_circle<P>("POINT(2 1)", true);
- test_circle<P>("POINT(12 1)", false);
-
- test_circle<ggl::linestring<P> >("LINESTRING(1 1,2 1,2 2)", true);
- test_circle<ggl::linestring<P> >("LINESTRING(1 1,2 1,2 2,10 10)", false);
-}
 
 
 int test_main( int , char* [] )
 {
- //test_all<ggl::point_xy<int> >();
+ test_all<ggl::point_xy<int> >();
     test_all<ggl::point_xy<double> >();
- test_circles<ggl::point_xy<double> >();
 
 #if defined(HAVE_CLN)
     test_all<ggl::point_xy<boost::numeric_adaptor::cln_value_type> >();

Modified: sandbox/ggl/formal_review_request/libs/ggl/test/core/access.cpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/test/core/access.cpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/access.cpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -22,7 +22,6 @@
 
 #include <ggl/core/cs.hpp>
 #include <ggl/geometries/point.hpp>
-#include <ggl/geometries/nsphere.hpp>
 #include <ggl/geometries/segment.hpp>
 #include <ggl/geometries/box.hpp>
 
@@ -86,9 +85,6 @@
     // POINT, setting coordinate
     test_get_set<P>();
 
- // N-SPHERE, setting sphere center
- test_get_set<ggl::nsphere<P, coordinate_type> >();
-
 
     // BOX, setting left/right/top/bottom
     ggl::box<P> b;

Modified: sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_dimension.cpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_dimension.cpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_dimension.cpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -41,7 +41,6 @@
     test_geometry<ggl::box<P> , D>();
     test_geometry<ggl::segment<P> , D>();
     test_geometry<ggl::segment<const P> , D>();
- test_geometry<ggl::nsphere<P, double> , D>();
 
     test_geometry<std::vector<P>, D>();
     test_geometry<std::deque<P>, D>();

Modified: sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_system.cpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_system.cpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_system.cpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -42,7 +42,6 @@
     test_geometry<ggl::box<P> , Expected>();
     test_geometry<ggl::segment<P> , Expected>();
     test_geometry<ggl::segment<const P> , Expected>();
- test_geometry<ggl::nsphere<P, double> , Expected>();
 
     test_geometry<std::vector<P>, Expected>();
     test_geometry<std::deque<P>, Expected>();

Modified: sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_type.cpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_type.cpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/coordinate_type.cpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -42,7 +42,6 @@
     test_geometry<ggl::box<P> , Expected>();
     test_geometry<ggl::segment<P> , Expected>();
     test_geometry<ggl::segment<const P> , Expected>();
- test_geometry<ggl::nsphere<P, double> , Expected>();
 
     test_geometry<std::vector<P>, Expected>();
     test_geometry<std::deque<P>, Expected>();

Modified: sandbox/ggl/formal_review_request/libs/ggl/test/core/geometry_id.cpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/test/core/geometry_id.cpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/geometry_id.cpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -40,7 +40,6 @@
     test_geometry<ggl::box<P> , 94>();
     test_geometry<ggl::segment<P> , 92>();
     test_geometry<ggl::segment<const P> , 92>();
- test_geometry<ggl::nsphere<P, double> , 91>();
 
     test_geometry<std::vector<P>, 2>();
     test_geometry<std::deque<P>, 2>();

Modified: sandbox/ggl/formal_review_request/libs/ggl/test/core/point_type.cpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/test/core/point_type.cpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/point_type.cpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -41,7 +41,6 @@
     test_geometry<ggl::box<P> , P>();
     test_geometry<ggl::segment<P> , P>();
     test_geometry<ggl::segment<const P> , P>();
- test_geometry<ggl::nsphere<P, double> , P>();
 
     test_geometry<std::vector<P>, P>();
     test_geometry<std::deque<P>, P>();

Modified: sandbox/ggl/formal_review_request/libs/ggl/test/core/tag.cpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/test/core/tag.cpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/tag.cpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -40,7 +40,6 @@
     test_geometry<ggl::box<P> , ggl::box_tag>();
     test_geometry<ggl::segment<P> , ggl::segment_tag>();
     test_geometry<ggl::segment<const P> , ggl::segment_tag>();
- test_geometry<ggl::nsphere<P, double> , ggl::nsphere_tag>();
 
     test_geometry<std::vector<P>, ggl::linestring_tag>();
     test_geometry<std::deque<P>, ggl::linestring_tag>();

Modified: sandbox/ggl/formal_review_request/libs/ggl/test/core/topological_dimension.cpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/test/core/topological_dimension.cpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/core/topological_dimension.cpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -39,7 +39,6 @@
     test_geometry<ggl::box<P> , 2>();
     test_geometry<ggl::segment<P> , 1>();
     test_geometry<ggl::segment<const P> , 1>();
- test_geometry<ggl::nsphere<P, double> , 2>(); // being discussed
 
     test_geometry<std::vector<P>, 1>();
     test_geometry<std::deque<P>, 1>();

Modified: sandbox/ggl/formal_review_request/libs/ggl/test/multi/algorithms/Jamfile.v2
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/test/multi/algorithms/Jamfile.v2 (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/multi/algorithms/Jamfile.v2 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -9,6 +9,7 @@
 test-suite ggl-multi-algorithms
     :
     [ run multi_area.cpp ]
+ [ run multi_centroid.cpp ]
     [ run multi_convex_hull.cpp ]
     [ run multi_correct.cpp ]
     [ run multi_for_each.cpp ]

Added: sandbox/ggl/formal_review_request/libs/ggl/test/multi/algorithms/multi_centroid.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/multi/algorithms/multi_centroid.cpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -0,0 +1,115 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// 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 <ggl_test_common.hpp>
+
+
+#include <ggl/algorithms/assign.hpp>
+#include <ggl/algorithms/centroid.hpp>
+#include <ggl/algorithms/distance.hpp>
+#include <ggl/algorithms/make.hpp>
+#include <ggl/extensions/gis/io/wkt/read_wkt.hpp>
+#include <ggl/geometries/geometries.hpp>
+
+#include <ggl/multi/geometries/multi_point.hpp>
+#include <ggl/multi/geometries/multi_polygon.hpp>
+
+#include <ggl/multi/algorithms/centroid.hpp>
+
+#include <ggl/extensions/gis/io/wkt/read_wkt_multi.hpp>
+
+#include <algorithms/test_centroid.hpp>
+
+// #define REPORT_RESULTS
+
+
+
+
+
+template <typename P>
+void test_2d(bool is_integer = false)
+{
+ typedef typename ggl::coordinate_type<P>::type ct;
+#ifdef REPORT_RESULTS
+ std::cout << std::endl << "type: " << typeid(ct).name() << " size: " << sizeof(ct) << std::endl;
+#endif
+
+ if (! is_integer)
+ {
+ test_centroid<ggl::multi_point<P> >(
+ "MULTIPOINT((1 1),(2 3),(5 0))",
+ 2.666666666666667, 1.33333);
+
+
+
+ // Only working for floating point:
+ test_centroid<ggl::multi_polygon<ggl::polygon<P> > >(
+ "MULTIPOLYGON(((1 1,1 3,3 3,3 1,1 1)),((4 1,4 3,8 3,8 1,4 1)))",
+ 4.666666666666667, 2.0);
+
+ test_centroid<ggl::multi_polygon<ggl::polygon<P> > >(
+ "MULTIPOLYGON(((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2"
+ ",3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)),"
+ "((10 10,10 12,12 12,12 10,10 10)))",
+ 7.338463104108615, 6.0606722055552407);
+ }
+
+
+
+ // Test using real-world polygon with large (Y) coordinates
+ // (coordinates can be used for integer and floating point point-types)
+ // Note that this will fail (overflow) if centroid calculation uses float
+ test_centroid<ggl::multi_polygon<ggl::polygon<P> > >(
+ "MULTIPOLYGON(((426062 4527794,426123 4527731"
+ ",426113 4527700,426113 4527693,426115 4527671"
+ ",426133 4527584,426135 4527569,426124 4527558"
+ ",426103 4527547,426072 4527538,426003 4527535"
+ ",425972 4527532,425950 4527531,425918 4527528"
+ ",425894 4527517,425876 4527504,425870 4527484"
+ ",425858 4527442,425842 4527414,425816 4527397"
+ ",425752 4527384,425692 4527369,425658 4527349"
+ ",425624 4527307,425605 4527260,425598 4527213"
+ ",425595 4527167,425582 4527125,425548 4527064"
+ ",425535 4527027,425537 4526990,425534 4526943"
+ ",425525 4526904,425500 4526856,425461 4526811"
+ ",425450 4526798,425381 4526823,425362 4526830"
+ ",425329 4526848,425298 4526883,425291 4526897"
+ ",425268 4526923,425243 4526945,425209 4526971"
+ ",425172 4526990,425118 4527028,425104 4527044"
+ ",425042 4527090,424980 4527126,424925 4527147"
+ ",424881 4527148,424821 4527147,424698 4527125"
+ ",424610 4527121,424566 4527126,424468 4527139"
+ ",424426 4527141,424410 4527142,424333 4527130"
+ ",424261 4527110,424179 4527073,424024 4527012"
+ ",423947 4526987,423902 4526973,423858 4526961"
+ ",423842 4526951,423816 4526935,423799 4526910"
+ ",423776 4526905,423765 4526911,423739 4526927"
+ ",423692 4526946,423636 4526976,423608 4527008"
+ ",423570 4527016,423537 4527011,423505 4526996"
+ ",423480 4526994,423457 4527012,423434 4527021"
+ ",423367 4527008,423263 4526998,423210 4526993"
+ ",423157 4526996,423110 4526994,423071 4526984"
+ ",423048 4526984,423032 4526994,423254 4527613"
+ ",423889 4528156,424585 4528050,425479 4527974"
+ ",425795 4527867,426062 4527794)))",
+ 424530.6059719588, 4527519.619367547);
+}
+
+
+
+int test_main(int, char* [])
+{
+ //test_2d<ggl::point_xy<float> >();
+ test_2d<ggl::point_xy<double> >();
+ test_2d<ggl::point_xy<long int> >(true);
+ //test_2d<ggl::point_xy<long long> >(true);
+ test_2d<ggl::point_xy<long double> >();
+
+ return 0;
+}

Added: sandbox/ggl/formal_review_request/libs/ggl/test/multi/algorithms/multi_within.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/multi/algorithms/multi_within.cpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -0,0 +1,55 @@
+// Generic Geometry Library
+//
+// Copyright Barend Gehrels, Geodan B.V. 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 <ggl_test_common.hpp>
+
+#include <ggl/extensions/gis/io/wkt/wkt.hpp>
+
+#include <ggl/algorithms/correct.hpp>
+#include <ggl/algorithms/within.hpp>
+
+#include <ggl/geometries/box.hpp>
+#include <ggl/geometries/polygon.hpp>
+
+#include <ggl/multi/algorithms/within.hpp>
+
+#include <ggl/multi/geometries/multi_polygon.hpp>
+
+#include <algorithms/test_within.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ typedef ggl::multi_polygon<ggl::polygon<P> > mp;
+
+ // trivial cases
+ test_geometry<P, mp>("POINT(1 1)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", true);
+ test_geometry<P, mp>("POINT(3 3)", "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)))", false);
+
+ // test if it is in one of them
+ test_geometry<P, mp>("POINT(4 4)", "MULTIPOLYGON("
+ "((0 0,0 2,2 2,2 0,0 0))"
+ "((3 3,3 6,6 6,6 3,3 3))"
+ ")",
+ true);
+}
+
+int test_main( int , char* [] )
+{
+ //test_all<ggl::point_xy<int> >();
+ test_all<ggl::point_xy<double> >();
+
+#if defined(HAVE_CLN)
+ test_all<ggl::point_xy<boost::numeric_adaptor::cln_value_type> >();
+#endif
+#if defined(HAVE_GMP)
+ test_all<ggl::point_xy<boost::numeric_adaptor::gmp_value_type> >();
+#endif
+
+ return 0;
+}

Modified: sandbox/ggl/formal_review_request/libs/ggl/test/point_concept/Jamfile.v2
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/test/point_concept/Jamfile.v2 (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/point_concept/Jamfile.v2 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -8,6 +8,7 @@
 
 test-suite ggl-point-concept
     :
+ [ compile concept_checker.cpp ]
     [ compile well_formed_point.cpp ]
     [ compile well_formed_point_traits.cpp ]
     [ compile array_point.cpp ]

Added: sandbox/ggl/formal_review_request/libs/ggl/test/point_concept/concept_checker.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/point_concept/concept_checker.cpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -0,0 +1,70 @@
+// Generic Geometry Library Point concept test file
+//
+// Copyright Bruno Lalande 2008, 2009
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. 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 <ggl/core/cs.hpp>
+#include <ggl/geometries/concepts/check.hpp>
+
+struct ro_point
+{
+ float x, y;
+};
+
+
+struct rw_point
+{
+ float x, y;
+};
+
+
+namespace ggl { namespace traits {
+
+template <> struct tag<ro_point> { typedef point_tag type; };
+template <> struct coordinate_type<ro_point> { typedef float type; };
+template <> struct coordinate_system<ro_point> { typedef ggl::cs::cartesian type; };
+template <> struct dimension<ro_point> { enum { value = 2 }; };
+
+template <> struct access<ro_point, 0>
+{
+ static float get(ro_point const& p) { return p.x; }
+};
+
+template <> struct access<ro_point, 1>
+{
+ static float get(ro_point const& p) { return p.y; }
+};
+
+
+
+
+template <> struct tag<rw_point> { typedef point_tag type; };
+template <> struct coordinate_type<rw_point> { typedef float type; };
+template <> struct coordinate_system<rw_point> { typedef ggl::cs::cartesian type; };
+template <> struct dimension<rw_point> { enum { value = 2 }; };
+
+template <> struct access<rw_point, 0>
+{
+ static float get(rw_point const& p) { return p.x; }
+ static void set(rw_point& p, float value) { p.x = value; }
+};
+
+template <> struct access<rw_point, 1>
+{
+ static float get(rw_point const& p) { return p.y; }
+ static void set(rw_point& p, float value) { p.y = value; }
+};
+
+
+}} // namespace ggl::traits
+
+
+int main()
+{
+ ggl::concept::check<const ro_point>();
+ ggl::concept::check<rw_point>();
+}

Modified: sandbox/ggl/formal_review_request/libs/ggl/test/point_concept/function_asserting_a_point.hpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/test/point_concept/function_asserting_a_point.hpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/point_concept/function_asserting_a_point.hpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -11,7 +11,7 @@
 
 #include <boost/concept/requires.hpp>
 
-#include <ggl/core/concepts/point_concept.hpp>
+#include <ggl/geometries/concepts/point_concept.hpp>
 
 namespace ggl
 {

Modified: sandbox/ggl/formal_review_request/libs/ggl/test/point_concept/function_requiring_a_point.hpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/test/point_concept/function_requiring_a_point.hpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/point_concept/function_requiring_a_point.hpp 2009-10-25 06:35:09 EDT (Sun, 25 Oct 2009)
@@ -11,7 +11,7 @@
 
 #include <boost/concept/requires.hpp>
 
-#include <ggl/core/concepts/point_concept.hpp>
+#include <ggl/geometries/concepts/point_concept.hpp>
 
 namespace ggl
 {


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