Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68697 - in trunk/libs/geometry: doc/src/examples/algorithms test/algorithms test/concepts test/core test/extensions/algorithms test/geometries test/test_geometries
From: barend.gehrels_at_[hidden]
Date: 2011-02-07 13:55:39


Author: barendgehrels
Date: 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
New Revision: 68697
URL: http://svn.boost.org/trac/boost/changeset/68697

Log:
Changes related to mutable polygon concept
Added:
   trunk/libs/geometry/test/concepts/
   trunk/libs/geometry/test/concepts/Jamfile.v2 (contents, props changed)
   trunk/libs/geometry/test/concepts/concepts_tests.sln (contents, props changed)
   trunk/libs/geometry/test/concepts/linestring_concept.cpp (contents, props changed)
   trunk/libs/geometry/test/concepts/linestring_concept.vcproj (contents, props changed)
   trunk/libs/geometry/test/core/ring.vcproj (contents, props changed)
   trunk/libs/geometry/test/test_geometries/all_custom_container.hpp (contents, props changed)
   trunk/libs/geometry/test/test_geometries/all_custom_linestring.hpp (contents, props changed)
   trunk/libs/geometry/test/test_geometries/all_custom_polygon.hpp (contents, props changed)
   trunk/libs/geometry/test/test_geometries/all_custom_ring.hpp (contents, props changed)
Text files modified:
   trunk/libs/geometry/doc/src/examples/algorithms/area_with_strategy.cpp | 32 ++---
   trunk/libs/geometry/test/algorithms/area.cpp | 24 +++-
   trunk/libs/geometry/test/algorithms/centroid.cpp | 34 ++++--
   trunk/libs/geometry/test/algorithms/difference.vcproj | 6
   trunk/libs/geometry/test/algorithms/length.cpp | 5
   trunk/libs/geometry/test/algorithms/reverse.cpp | 34 ++++-
   trunk/libs/geometry/test/algorithms/simplify.cpp | 2
   trunk/libs/geometry/test/extensions/algorithms/mark_spikes.cpp | 3
   trunk/libs/geometry/test/geometries/boost_polygon.cpp | 201 ++++++++++++++++++++++++++-------------
   trunk/libs/geometry/test/test_geometries/wrapped_boost_array.hpp | 55 +++-------
   10 files changed, 242 insertions(+), 154 deletions(-)

Modified: trunk/libs/geometry/doc/src/examples/algorithms/area_with_strategy.cpp
==============================================================================
--- trunk/libs/geometry/doc/src/examples/algorithms/area_with_strategy.cpp (original)
+++ trunk/libs/geometry/doc/src/examples/algorithms/area_with_strategy.cpp 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -8,30 +8,27 @@
 // Quickbook Example
 
 //[area_with_strategy
-//` Calculate the area of a polygon specifying a strategy
+//` Calculate the area of a polygon
 
 #include <iostream>
 #include <boost/geometry/geometry.hpp>
 #include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
 
-namespace bg = boost::geometry;
+namespace bg = boost::geometry; /*< Convenient namespace alias >*/
 
 int main()
 {
- // Define a spherical point
- typedef bg::model::point<double, 2, bg::cs::spherical<bg::degree> > pnt_type;
-
- bg::model::polygon<pnt_type> hawaii;
- bg::read_wkt("POLYGON((-155.86 18.93,-155.84 20.30,-154.80 19.52,-155.86 18.93))" /*< Rough appromation of [@http://en.wikipedia.org/wiki/Hawaii_%28island%29 Hawaii Island] >*/
- , hawaii);
- double const mean_radius = 6371.0; /*< [@http://en.wikipedia.org/wiki/Earth_radius Wiki] >*/
-
-
- // Construct the strategy (Huiller) and calculate the area
- bg::strategy::area::huiller<pnt_type> in_square_kilometers(mean_radius);
- double area = bg::area(hawaii, in_square_kilometers);
-
- std::cout << area << " km2" << std::endl;
+ // Calculate the area of a cartesian polygon
+ bg::model::polygon<bg::model::d2::point_xy<double> > poly;
+ bg::read_wkt("POLYGON((0 0,0 7,4 2,2 0,0 0))", poly);
+ double area = bg::area(poly);
+ std::cout << "Area: " << area << std::endl;
+
+ // Calculate the area of a spherical polygon
+ bg::model::polygon<bg::model::point<float, 2, bg::cs::spherical<bg::degree> > > sph_poly;
+ bg::read_wkt("POLYGON((0 0,0 45,45 0,0 0))", sph_poly);
+ area = bg::area(sph_poly);
+ std::cout << "Area: " << area << std::endl;
 
     return 0;
 }
@@ -43,7 +40,8 @@
 /*`
 Output:
 [pre
-Area: 8393.22 km2
+Area: 16
+Area: 0.339837
 ]
 */
 //]

Modified: trunk/libs/geometry/test/algorithms/area.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/area.cpp (original)
+++ trunk/libs/geometry/test/algorithms/area.cpp 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -16,8 +16,21 @@
 #include <boost/geometry/geometries/ring.hpp>
 #include <boost/geometry/geometries/polygon.hpp>
 
+#include <test_geometries/all_custom_ring.hpp>
+#include <test_geometries/all_custom_polygon.hpp>
 //#define GEOMETRY_TEST_DEBUG
 
+template <typename Polygon>
+void test_polygon()
+{
+ // Rotated square, length=sqrt(2) -> area=2
+ test_geometry<Polygon>("POLYGON((1 1,2 2,3 1,2 0,1 1))", 2.0);
+ test_geometry<Polygon>("POLYGON((1 1,2 2,3 1,2 0,1 1))", 2.0);
+ test_geometry<Polygon>("POLYGON((0 0,0 7,4 2,2 0,0 0))", 16.0);
+ test_geometry<Polygon>("POLYGON((1 1,2 1,2 2,1 2,1 1))", -1.0);
+ test_geometry<Polygon>("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 P>
 void test_all()
@@ -25,18 +38,15 @@
     test_geometry<bg::model::box<P> >("POLYGON((0 0,2 2))", 4.0);
     test_geometry<bg::model::box<P> >("POLYGON((2 2,0 0))", 4.0);
 
- // Rotated square, length=sqrt(2) -> area=2
- test_geometry<bg::model::polygon<P> >("POLYGON((1 1,2 2,3 1,2 0,1 1))", 2.0);
-
+ test_polygon<bg::model::polygon<P> >();
+ test_polygon<all_custom_polygon<P> >();
 
     // clockwise rings (second is wrongly ordered)
     test_geometry<bg::model::ring<P> >("POLYGON((0 0,0 7,4 2,2 0,0 0))", 16.0);
     test_geometry<bg::model::ring<P> >("POLYGON((0 0,2 0,4 2,0 7,0 0))", -16.0);
 
- test_geometry<bg::model::polygon<P> >("POLYGON((0 0,0 7,4 2,2 0,0 0))", 16.0);
- test_geometry<bg::model::polygon<P> >("POLYGON((1 1,2 1,2 2,1 2,1 1))", -1.0);
- test_geometry<bg::model::polygon<P> >
- ("POLYGON((0 0,0 7,4 2,2 0,0 0), (1 1,2 1,2 2,1 2,1 1))", 15.0);
+ test_geometry<all_custom_ring<P> >("POLYGON((0 0,0 7,4 2,2 0,0 0))", 16.0);
+
     // ccw
     test_geometry<bg::model::polygon<P, false> >
             ("POLYGON((0 0,0 7,4 2,2 0,0 0), (1 1,2 1,2 2,1 2,1 1))", -15.0);

Modified: trunk/libs/geometry/test/algorithms/centroid.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/centroid.cpp (original)
+++ trunk/libs/geometry/test/algorithms/centroid.cpp 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -12,31 +12,41 @@
 #include <boost/geometry/geometries/adapted/c_array_cartesian.hpp>
 #include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
 
+#include <test_geometries/all_custom_polygon.hpp>
 
-template <typename P>
-void test_2d()
+template <typename Polygon>
+void test_polygon()
 {
- test_centroid<bg::model::linestring<P> >("LINESTRING(1 1, 2 2, 3 3)", 2.0, 2.0);
- test_centroid<bg::model::linestring<P> >("LINESTRING(0 0,0 4, 4 4)", 1.0, 3.0);
- test_centroid<bg::model::linestring<P> >("LINESTRING(0 0,3 3,0 6,3 9,0 12)", 1.5, 6.0);
-
- test_centroid<bg::model::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<bg::model::polygon<P> >(
+ test_centroid<Polygon>(
         "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<bg::model::polygon<P> >(
+ test_centroid<Polygon>(
         "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);
 
+}
+
+
+template <typename P>
+void test_2d()
+{
+ test_centroid<bg::model::linestring<P> >("LINESTRING(1 1, 2 2, 3 3)", 2.0, 2.0);
+ test_centroid<bg::model::linestring<P> >("LINESTRING(0 0,0 4, 4 4)", 1.0, 3.0);
+ test_centroid<bg::model::linestring<P> >("LINESTRING(0 0,3 3,0 6,3 9,0 12)", 1.5, 6.0);
+
+ test_centroid<bg::model::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_polygon<bg::model::polygon<P> >();
+ test_polygon<all_custom_polygon<P> >();
 
     // ccw
     test_centroid<bg::model::ring<P, false> >(

Modified: trunk/libs/geometry/test/algorithms/difference.vcproj
==============================================================================
--- trunk/libs/geometry/test/algorithms/difference.vcproj (original)
+++ trunk/libs/geometry/test/algorithms/difference.vcproj 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -20,7 +20,7 @@
                         OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                         IntermediateDirectory="$(ConfigurationName)\difference"
                         ConfigurationType="1"
- InheritedPropertySheets="..\boost.vsprops"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
                         CharacterSet="1"
>
                         <Tool
@@ -41,7 +41,7 @@
                         <Tool
                                 Name="VCCLCompilerTool"
                                 Optimization="0"
- AdditionalIncludeDirectories="../../../..;.."
+ AdditionalIncludeDirectories="../../../..;..;../$(TTMATH_ROOT)"
                                 PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS;TEST_WITH_SVG"
                                 ExceptionHandling="2"
                                 RuntimeLibrary="1"
@@ -93,7 +93,7 @@
                         OutputDirectory="$(SolutionDir)$(ConfigurationName)"
                         IntermediateDirectory="$(ConfigurationName)\difference"
                         ConfigurationType="1"
- InheritedPropertySheets="..\boost.vsprops"
+ InheritedPropertySheets="..\boost.vsprops;..\ttmath.vsprops"
                         CharacterSet="1"
                         WholeProgramOptimization="1"
>

Modified: trunk/libs/geometry/test/algorithms/length.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/length.cpp (original)
+++ trunk/libs/geometry/test/algorithms/length.cpp 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -10,6 +10,9 @@
 #include <boost/geometry/geometries/geometries.hpp>
 #include <boost/geometry/geometries/adapted/std_pair_as_segment.hpp>
 
+#include <test_geometries/all_custom_linestring.hpp>
+#include <test_geometries/wrapped_boost_array.hpp>
+
 
 template <typename P>
 void test_all()
@@ -19,6 +22,8 @@
 
     // 3-4-5 plus 1-1
     test_geometry<bg::model::linestring<P> >("LINESTRING(0 0,3 4,4 3)", 5 + sqrt(2.0));
+ test_geometry<all_custom_linestring<P> >("LINESTRING(0 0,3 4,4 3)", 5 + sqrt(2.0));
+ test_geometry<wrapped_boost_array<P, 3> >("LINESTRING(0 0,3 4,4 3)", 5 + sqrt(2.0));
 
     // Geometries with length zero
     test_geometry<P>("POINT(0 0)", 0);

Modified: trunk/libs/geometry/test/algorithms/reverse.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/reverse.cpp (original)
+++ trunk/libs/geometry/test/algorithms/reverse.cpp 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -10,25 +10,42 @@
 #include <boost/geometry/geometries/geometries.hpp>
 
 #include <test_common/test_point.hpp>
+#include <test_geometries/all_custom_linestring.hpp>
+#include <test_geometries/all_custom_ring.hpp>
+#include <test_geometries/wrapped_boost_array.hpp>
 
-
-template <typename Point>
-void test_all()
+template <typename LineString>
+void test_linestring()
 {
     // Simplex
- test_geometry<bg::model::linestring<Point> >(
+ test_geometry<LineString >(
         "LINESTRING(0 0,1 1)",
         "LINESTRING(1 1,0 0)");
 
     // Three points, middle should stay the same
- test_geometry<bg::model::linestring<Point> >(
+ test_geometry<LineString >(
         "LINESTRING(0 0,1 1,2 2)",
         "LINESTRING(2 2,1 1,0 0)");
 
     // Four points
- test_geometry<bg::model::linestring<Point> >(
+ test_geometry<LineString >(
         "LINESTRING(0 0,1 1,2 2,3 3)",
         "LINESTRING(3 3,2 2,1 1,0 0)");
+}
+
+template <typename Ring>
+void test_ring()
+{
+ test_geometry<Ring>(
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0))",
+ "POLYGON((4 0,2 1,0 2,0 7,4 9,8 7,8 2,4 0))");
+}
+
+template <typename Point>
+void test_all()
+{
+ test_linestring<bg::model::linestring<Point> >();
+ test_linestring<all_custom_linestring<Point> >();
 
     // Polygon with holes
     test_geometry<bg::model::polygon<Point> >(
@@ -38,9 +55,8 @@
     // Check compilation
     test_geometry<Point>("POINT(0 0)", "POINT(0 0)");
 
- test_geometry<bg::model::ring<Point> >(
- "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0))",
- "POLYGON((4 0,2 1,0 2,0 7,4 9,8 7,8 2,4 0))");
+ test_ring<bg::model::ring<Point> >();
+ test_ring<all_custom_ring<Point> >();
 }
 
 int test_main(int, char* [])

Modified: trunk/libs/geometry/test/algorithms/simplify.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/simplify.cpp (original)
+++ trunk/libs/geometry/test/algorithms/simplify.cpp 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -32,9 +32,11 @@
         "LINESTRING(0 0,5 5,7 5,10 10)",
         "LINESTRING(0 0,5 5,7 5,10 10)", 1.0);
 
+ /* TODO fix this
     test_geometry<test::wrapped_boost_array<P, 10> >(
         "LINESTRING(0 0,5 5,7 5,10 10)",
         "LINESTRING(0 0,5 5,7 5,10 10)", 1.0);
+ */
 
     test_geometry<bg::model::ring<P> >(
         "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0))",

Added: trunk/libs/geometry/test/concepts/Jamfile.v2
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/concepts/Jamfile.v2 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -0,0 +1,13 @@
+# test/geometries/Jamfile.v2
+#
+# Copyright (c) 2009 Mateusz Loskot <mateusz_at_[hidden]>
+#
+# 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-concepts
+ :
+ [ run linestring_concept.cpp ]
+ [ run polygon_concept.cpp ]
+ ;

Added: trunk/libs/geometry/test/concepts/concepts_tests.sln
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/concepts/concepts_tests.sln 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -0,0 +1,25 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "linestring_concept", "linestring_concept.vcproj", "{CA8D5E44-7D8F-44A1-900C-35C28890299B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "polygon_concept", "polygon_concept.vcproj", "{306B99D1-576A-4EB6-BF7E-B111CA3807FE}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {CA8D5E44-7D8F-44A1-900C-35C28890299B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CA8D5E44-7D8F-44A1-900C-35C28890299B}.Debug|Win32.Build.0 = Debug|Win32
+ {CA8D5E44-7D8F-44A1-900C-35C28890299B}.Release|Win32.ActiveCfg = Release|Win32
+ {CA8D5E44-7D8F-44A1-900C-35C28890299B}.Release|Win32.Build.0 = Release|Win32
+ {306B99D1-576A-4EB6-BF7E-B111CA3807FE}.Debug|Win32.ActiveCfg = Debug|Win32
+ {306B99D1-576A-4EB6-BF7E-B111CA3807FE}.Debug|Win32.Build.0 = Debug|Win32
+ {306B99D1-576A-4EB6-BF7E-B111CA3807FE}.Release|Win32.ActiveCfg = Release|Win32
+ {306B99D1-576A-4EB6-BF7E-B111CA3807FE}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal

Added: trunk/libs/geometry/test/concepts/linestring_concept.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/concepts/linestring_concept.cpp 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -0,0 +1,75 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) test file
+//
+// Copyright Barend Gehrels 2011, 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)
+
+#include <deque>
+#include <vector>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/append.hpp>
+#include <boost/geometry/algorithms/clear.hpp>
+#include <boost/geometry/algorithms/make.hpp>
+#include <boost/geometry/core/access.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/concepts/linestring_concept.hpp>
+
+#include <boost/geometry/util/write_dsv.hpp>
+
+
+#include <test_common/test_point.hpp>
+#include <test_geometries/all_custom_linestring.hpp>
+#include <test_geometries/wrapped_boost_array.hpp>
+
+
+
+template <typename Geometry>
+void test_linestring()
+{
+ BOOST_CONCEPT_ASSERT( (bg::concept::Linestring<Geometry>) );
+ BOOST_CONCEPT_ASSERT( (bg::concept::ConstLinestring<Geometry>) );
+
+ Geometry geometry;
+ typedef typename bg::point_type<Geometry>::type P;
+
+ bg::clear(geometry);
+ BOOST_CHECK_EQUAL(boost::size(geometry), 0);
+
+ bg::append(geometry, bg::make<P>(1, 2));
+ BOOST_CHECK_EQUAL(boost::size(geometry), 1);
+
+ bg::append(geometry, bg::make<P>(3, 4));
+ BOOST_CHECK_EQUAL(boost::size(geometry), 2);
+
+ bg::traits::resize<Geometry>::apply(geometry, 1);
+ BOOST_CHECK_EQUAL(boost::size(geometry), 1);
+
+ //std::cout << bg::dsv(geometry) << std::endl;
+ P p = *boost::begin(geometry);
+ //std::cout << bg::dsv(p) << std::endl;
+ BOOST_CHECK_EQUAL(bg::get<0>(p), 1);
+ BOOST_CHECK_EQUAL(bg::get<1>(p), 2);
+
+ bg::clear(geometry);
+ BOOST_CHECK_EQUAL(boost::size(geometry), 0);
+}
+
+template <typename Point>
+void test_all()
+{
+ test_linestring<bg::model::linestring<Point> >();
+ test_linestring<test::wrapped_boost_array<Point, 10> >();
+ test_linestring<all_custom_linestring<Point> >();
+}
+
+int test_main(int, char* [])
+{
+ test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
+ test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
+
+ return 0;
+}

Added: trunk/libs/geometry/test/concepts/linestring_concept.vcproj
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/concepts/linestring_concept.vcproj 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="linestring_concept"
+ ProjectGUID="{CA8D5E44-7D8F-44A1-900C-35C28890299B}"
+ RootNamespace="linestring_concept"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\linestring_concept"
+ ConfigurationType="1"
+ 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)\linestring_concept"
+ ConfigurationType="1"
+ 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=".\linestring_concept.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Added: trunk/libs/geometry/test/core/ring.vcproj
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/core/ring.vcproj 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="ring"
+ ProjectGUID="{1EE3F112-638F-4447-8F9D-4C5BB3304C3B}"
+ RootNamespace="ring"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\ring"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.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)\ring"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\boost.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=".\ring.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Modified: trunk/libs/geometry/test/extensions/algorithms/mark_spikes.cpp
==============================================================================
--- trunk/libs/geometry/test/extensions/algorithms/mark_spikes.cpp (original)
+++ trunk/libs/geometry/test/extensions/algorithms/mark_spikes.cpp 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -111,6 +111,9 @@
     test_geometry<mp>("texel_183836",
             "MULTIPOLYGON( ((114766.45300292969 560935.37800598145, 114839.08099365234 560958.13200378418, 114919.38200378418 560983.13500976562, 114945.70799255371 560990.80799865723, 114946.2380065918 560992.39601135254, 114930.75900268555 561046.63500976562, 114923.41007995606 561073.32402038574, 114924.41039576962 561073.6148228565, 114903.32929992676 561145.36410522461, 114895.68840026856 561171.36880493164, 114894.6575012207 561174.46450805664, 114894.59449768066 561174.43589782715, 114894.31700134277 561175.496307373, 114894.01480102539 561178.669998169, 114894.57029724121 561179.59580993652, 114969.90060575516 561202.33975150948, 114969.85419015621 561202.51050945686, 114942.83399963379 561194.24600219727, 114895.87001037598 561180.091003418, 114893.3570098877 561179.16500854492, 114872.97556998512 561162.44151731138, 114893.35699462891 561179.16400146484, 114894.90800476074 561173.2380065918, 114892.52699279785 561174.03199768066, 114889.74899291992 561171.51899719238, 114879.56199645996 561162.788
00964355, 114844.50500488281 561131.30200195312, 114809.71200561523 561099.1549987793, 114787.22300720215 561079.17900085449, 114771.87699890137 561065.68499755859, 114753.62100219727 561048.4880065918, 114727.0299987793 561029.17300415039, 114717.10800170898 561021.5, 114701.89500427246 561011.04901123047, 114700.83599853516 561009.59400939941, 114701.89500427246 561006.94799804688, 114715.38800048828 560981.28300476074, 114729.9409942627 560953.370010376, 114738.27499389648 560937.62699890137, 114739.46600341797 560937.75900268555, 114766.45300292969 560935.37800598145), (114825.04400634766 560971.37200927734, 114823.72099304199 560971.76800537109, 114822.66299438477 560971.90100097656, 114821.07600402832 560973.22399902344, 114821.07600402832 560975.33999633789, 114821.47200012207 560976.26600646973, 114823.19200134277 560978.11799621582, 114825.04400634766 560978.51499938965, 114827.42599487305 560978.25100708008, 114828.48399353027 560976.796005249, 114828.61599731445 560974.15000915527, 114827.82200622
559 560972.8270111084, 114825.04400634766 560971.37200927734), (114893.16600036621 561141.21200561523, 114891.51400756836 561142.51000976562, 114890.68800354004 561144.2799987793, 114890.92399597168 561146.9940032959, 114893.04200744629 561149.43600463867, 114897.01100158691 561148.77500915527, 114898.59399414063 561145.10600280762, 114898.00399780273 561142.9820098877, 114895.64399719238 561141.56600952148, 114893.16600036621 561141.21200561523)))",
             bg::select_gapped_spike<>(2.0, 0.1), 31052.272, 794.761);
+ test_geometry<mp>("texel_195365",
+ "MULTIPOLYGON( ((115681.31161499021 560944.083480835, 115681.2671573319 560944.22872300365, 115755.0199966431 560968.15299987793, 115727.1070022583 561055.33200073242, 115707.6600036621 561120.94999694824, 115708.341003418 561121.30999755859, 115728.7350006104 561055.82598876953, 115735.858001709 561033.60101318359, 115738.58300018311 561034.407989502, 115739.43000030521 561034.66000366211, 115739.2969970703 561037.56900024414, 115724.7450027466 561084.66598510742, 115713.5 561123.16198730469, 115736.263999939 561131.608001709, 115789.30400085451 561150.01800537109, 115866.6949996948 561176.07998657227, 115921.46299743649 561194.59899902344, 115984.4339981079 561215.10598754883, 115986.9479980469 561198.83401489258, 115992.372001648 561159.808013916, 115995.4150009155 561122.50100708008, 115997.0019989014 561087.70700073242, 115997.266998291 561057.28100585938, 115996.8700027466 561041.53799438477, 115986.5510025024 561038.89300537109, 115864.5780029297 561002.38000488281, 115757.55999755859 560
968.05499267578, 115757.5589981079 560968.05499267578, 115749.0859985352 560965.33700561523, 115681.31161499021 560944.083480835)))",
+ bg::select_gapped_spike<>(2.0, 0.9), 45002.987, 924.56);
 
     // Found some PostGIS stored procedure as well.
     // http://trac.osgeo.org/postgis/wiki/UsersWikiExamplesSpikeRemover

Modified: trunk/libs/geometry/test/geometries/boost_polygon.cpp
==============================================================================
--- trunk/libs/geometry/test/geometries/boost_polygon.cpp (original)
+++ trunk/libs/geometry/test/geometries/boost_polygon.cpp 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -23,97 +23,164 @@
     bg::concept::check<boost::polygon::point_data<double> >();
 
     // 1b: use a Boost.Polygon point in Boost.Geometry, calc. distance with two point types
- boost::polygon::point_data<double> p1(1, 2);
+ boost::polygon::point_data<double> bpol_point(1, 2);
 
- typedef bg::model::point<double, 2, bg::cs::cartesian> bg_point;
- bg_point p2(3, 4);
- BOOST_CHECK_CLOSE(bg::distance(p1, p2), 2 * std::sqrt(2.0), 0.001);
+ typedef bg::model::point<double, 2, bg::cs::cartesian> bg_point_type;
+ bg_point_type bgeo_point(3, 4);
+ BOOST_CHECK_CLOSE(bg::distance(bpol_point, bgeo_point), 2 * std::sqrt(2.0), 0.001);
 
     // 2a: Check if Boost.Polygon's box fulfills Boost.Geometry's box concept
     bg::concept::check<boost::polygon::rectangle_data<double> >();
 
     // 2b: use a Boost.Polygon rectangle in Boost.Geometry, compare with boxes
- boost::polygon::rectangle_data<double> b1;
- bg::model::box<bg_point> b2;
+ boost::polygon::rectangle_data<double> bpol_box;
+ bg::model::box<bg_point_type> bgeo_box;
 
- bg::assign(b1, 0, 1, 5, 6);
- bg::assign(b2, 0, 1, 5, 6);
- double a1 = bg::area(b1);
- double a2 = bg::area(b2);
+ bg::assign(bpol_box, 0, 1, 5, 6);
+ bg::assign(bgeo_box, 0, 1, 5, 6);
+ double a1 = bg::area(bpol_box);
+ double a2 = bg::area(bgeo_box);
     BOOST_CHECK_CLOSE(a1, a2, 0.001);
 
     // 3a: Check if Boost.Polygon's polygon fulfills Boost.Geometry's ring concept
     bg::concept::check<boost::polygon::polygon_data<double> >();
 
- // 3b: use a Boost.Polygon polygon (ring) in Boost.Geometry
- // Filling it is a two-step process using Boost.Polygon
- std::vector<boost::polygon::point_data<double> > point_vector;
- point_vector.push_back(boost::polygon::point_data<double>(0, 0));
- point_vector.push_back(boost::polygon::point_data<double>(0, 3));
- point_vector.push_back(boost::polygon::point_data<double>(4, 0));
- point_vector.push_back(boost::polygon::point_data<double>(0, 0));
-
- boost::polygon::polygon_data<double> r1;
- r1.set(point_vector.begin(), point_vector.end());
-
- bg::model::ring<bg_point> r2;
- r2.push_back(bg_point(0, 0));
- r2.push_back(bg_point(0, 3));
- r2.push_back(bg_point(4, 0));
- r2.push_back(bg_point(0, 0));
- a1 = bg::area(r1);
- a2 = bg::area(r2);
+ // 3b: use a Boost.Polygon polygon (ring)
+ boost::polygon::polygon_data<double> bpol_ring;
+ {
+ // Filling it is a two-step process using Boost.Polygon
+ std::vector<boost::polygon::point_data<double> > point_vector;
+ point_vector.push_back(boost::polygon::point_data<double>(0, 0));
+ point_vector.push_back(boost::polygon::point_data<double>(0, 3));
+ point_vector.push_back(boost::polygon::point_data<double>(4, 0));
+ point_vector.push_back(boost::polygon::point_data<double>(0, 0));
+ bpol_ring.set(point_vector.begin(), point_vector.end());
+ }
+
+ // Boost-geometry ring
+ bg::model::ring<bg_point_type> bgeo_ring;
+ {
+ bgeo_ring.push_back(bg_point_type(0, 0));
+ bgeo_ring.push_back(bg_point_type(0, 3));
+ bgeo_ring.push_back(bg_point_type(4, 0));
+ bgeo_ring.push_back(bg_point_type(0, 0));
+ }
+ a1 = bg::area(bpol_ring);
+ a2 = bg::area(bgeo_ring);
     BOOST_CHECK_CLOSE(a1, a2, 0.001);
 
+ // Check mutable ring
+ bg::read_wkt("POLYGON((0 0,0 10,10 10,10 0,0 0))", bpol_ring);
+ bg::read_wkt("POLYGON((0 0,0 10,10 10,10 0,0 0))", bgeo_ring);
+ a1 = bg::area(bpol_ring);
+ a2 = bg::area(bgeo_ring);
+ BOOST_CHECK_CLOSE(a1, a2, 0.001);
+
+
 
     // 4a: Boost.Polygon's polygon with holes
- point_vector.clear();
- point_vector.push_back(boost::polygon::point_data<double>(0, 0));
- point_vector.push_back(boost::polygon::point_data<double>(0, 10));
- point_vector.push_back(boost::polygon::point_data<double>(10, 10));
- point_vector.push_back(boost::polygon::point_data<double>(10, 0));
- point_vector.push_back(boost::polygon::point_data<double>(0, 0));
-
- boost::polygon::polygon_with_holes_data<double> poly1;
- poly1.set(point_vector.begin(), point_vector.end());
-
- // Fill the holes (we take two)
- std::vector<boost::polygon::polygon_data<double> > holes;
- holes.resize(2);
-
- point_vector.clear();
- point_vector.push_back(boost::polygon::point_data<double>(1, 1));
- point_vector.push_back(boost::polygon::point_data<double>(2, 1));
- point_vector.push_back(boost::polygon::point_data<double>(2, 2));
- point_vector.push_back(boost::polygon::point_data<double>(1, 2));
- point_vector.push_back(boost::polygon::point_data<double>(1, 1));
- holes[0].set(point_vector.begin(), point_vector.end());
-
- point_vector.clear();
- point_vector.push_back(boost::polygon::point_data<double>(3, 3));
- point_vector.push_back(boost::polygon::point_data<double>(4, 3));
- point_vector.push_back(boost::polygon::point_data<double>(4, 4));
- point_vector.push_back(boost::polygon::point_data<double>(3, 4));
- point_vector.push_back(boost::polygon::point_data<double>(3, 3));
- holes[1].set(point_vector.begin(), point_vector.end());
+ boost::polygon::polygon_with_holes_data<double> bpol_polygon;
+ {
+ std::vector<boost::polygon::point_data<double> > point_vector;
+ point_vector.push_back(boost::polygon::point_data<double>(0, 0));
+ point_vector.push_back(boost::polygon::point_data<double>(0, 10));
+ point_vector.push_back(boost::polygon::point_data<double>(10, 10));
+ point_vector.push_back(boost::polygon::point_data<double>(10, 0));
+ point_vector.push_back(boost::polygon::point_data<double>(0, 0));
+ bpol_polygon.set(point_vector.begin(), point_vector.end());
+ }
+
+ {
+ // Fill the holes (we take two)
+ std::vector<boost::polygon::polygon_data<double> > holes;
+ holes.resize(2);
+
+ {
+ std::vector<boost::polygon::point_data<double> > point_vector;
+ point_vector.push_back(boost::polygon::point_data<double>(1, 1));
+ point_vector.push_back(boost::polygon::point_data<double>(2, 1));
+ point_vector.push_back(boost::polygon::point_data<double>(2, 2));
+ point_vector.push_back(boost::polygon::point_data<double>(1, 2));
+ point_vector.push_back(boost::polygon::point_data<double>(1, 1));
+ holes[0].set(point_vector.begin(), point_vector.end());
+ }
+
+ {
+ std::vector<boost::polygon::point_data<double> > point_vector;
+ point_vector.push_back(boost::polygon::point_data<double>(3, 3));
+ point_vector.push_back(boost::polygon::point_data<double>(4, 3));
+ point_vector.push_back(boost::polygon::point_data<double>(4, 4));
+ point_vector.push_back(boost::polygon::point_data<double>(3, 4));
+ point_vector.push_back(boost::polygon::point_data<double>(3, 3));
+ holes[1].set(point_vector.begin(), point_vector.end());
+ }
 
- poly1.set_holes(holes.begin(), holes.end());
+ bpol_polygon.set_holes(holes.begin(), holes.end());
+ }
 
     // Using Boost.Polygon
- a1 = bg::area(poly1);
- a2 = boost::polygon::area(poly1);
+ a1 = bg::area(bpol_polygon);
+ a2 = boost::polygon::area(bpol_polygon);
     BOOST_CHECK_CLOSE(a1, a2, 0.001);
 
- bg::model::polygon<bg_point> poly2;
- bg::read_wkt("POLYGON((0 0,0 10,10 10,10 0,0 0),(1 1,2 1,2 2,1 2,1 1),(3 3,4 3,4 4,3 4,3 3))", poly2);
+ bg::model::polygon<bg_point_type> bgeo_polygon;
+ bg::read_wkt("POLYGON((0 0,0 10,10 10,10 0,0 0),(1 1,2 1,2 2,1 2,1 1),(3 3,4 3,4 4,3 4,3 3))", bgeo_polygon);
 
- a2 = bg::area(poly2);
+ a2 = bg::area(bgeo_polygon);
     BOOST_CHECK_CLOSE(a1, a2, 0.001);
 
-
- // Not finished:
- //bg::read_wkt("POLYGON((0 0,0 10,10 10,10 0,0 0),(1 1,2 1,2 2,1 2,1 1),(3 3,4 3,4 4,3 4,3 3))", poly1);
-
+ {
+ /*
+ boost::polygon::polygon_with_holes_data<double> const& pc = bpol_polygon;
+
+ BOOST_AUTO(bh, pc.begin_holes());
+ std::cout << typeid(bh).name() << std::endl;
+ std::cout << typeid(*bh).name() << std::endl;
+ BOOST_AUTO(hole1, *bh);
+ BOOST_AUTO(bp, (*hole1.begin()));
+ std::cout << typeid(bp).name() << std::endl;
+
+ BOOST_AUTO(e, bg::exterior_ring(pc));
+ BOOST_AUTO(b, *boost::begin(e));
+ std::cout << typeid(e).name() << std::endl;
+ std::cout << typeid(b).name() << std::endl;
+ std::cout << bg::area(e) << std::endl;
+
+ BOOST_AUTO(i, bg::interior_rings(pc));
+ BOOST_AUTO(bi, *boost::begin(i));
+ std::cout << typeid(i).name() << std::endl;
+ std::cout << typeid(bi).name() << std::endl;
+ BOOST_AUTO(bip, *boost::begin(bi));
+ std::cout << typeid(bip).name() << std::endl;
+ //std::cout << bg::area(e) << std::endl;
+
+
+ BOOST_AUTO(inc, bg::interior_rings(bpol_polygon));
+ BOOST_AUTO(binc, boost::begin(inc));
+ binc++;
+ std::cout << typeid(inc).name() << std::endl;
+ std::cout << typeid(binc).name() << std::endl;
+ */
+ /*
+ BOOST_AUTO(e0, bg::interior_rings(pc));
+ BOOST_AUTO(e1, bg::traits::interior_rings<boost::polygon::polygon_with_holes_data<double> >::get(pc));
+ BOOST_AUTO(e2,
+ (bg::core_dispatch::interior_rings<bg::polygon_tag,
+ boost::polygon::polygon_with_holes_data<double> const>::apply(pc)));
+ */
+
+
+ /*
+ std::cout << typeid(e).name() << std::endl;
+ std::cout << typeid(e0).name() << std::endl;
+ std::cout << typeid(e1).name() << std::endl;
+ std::cout << typeid(e2).name() << std::endl;
+ */
+ }
+
+ // Test adaption to mutable concept
+ bg::clear(bpol_polygon);
+ bg::read_wkt("POLYGON((0 0,0 10,10 10,10 0,0 0),(1 1,2 1,2 2,1 2,1 1),(3 3,4 3,4 4,3 4,3 3))", bpol_polygon);
 
     return 0;
 }

Added: trunk/libs/geometry/test/test_geometries/all_custom_container.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/test_geometries/all_custom_container.hpp 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -0,0 +1,135 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) test file
+//
+// Copyright Barend Gehrels 2011, 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 ar
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#ifndef GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_CONTAINER_HPP
+#define GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_CONTAINER_HPP
+
+#include <cstddef>
+#include <deque>
+
+
+template <typename Item>
+class all_custom_container
+{
+private :
+ std::deque<Item> m_hidden_deque;
+
+public :
+ typedef typename std::deque<Item>::iterator custom_iterator_type;
+ typedef typename std::deque<Item>::const_iterator custom_const_iterator_type;
+
+ inline std::size_t custom_size() const { return m_hidden_deque.size(); }
+
+ inline custom_const_iterator_type custom_begin() const { return m_hidden_deque.begin(); }
+ inline custom_const_iterator_type custom_end() const { return m_hidden_deque.end(); }
+ inline custom_iterator_type custom_begin() { return m_hidden_deque.begin(); }
+ inline custom_iterator_type custom_end() { return m_hidden_deque.end(); }
+
+ inline void custom_clear() { m_hidden_deque.clear(); }
+ inline void custom_push_back(Item const& p) { m_hidden_deque.push_back(p); }
+ inline void custom_resize(std::size_t new_size) { m_hidden_deque.resize(new_size); }
+};
+
+
+// 1. Adapt to Boost.Geometry (for e.g. inner rings)
+namespace boost { namespace geometry
+{
+
+namespace traits
+{
+ template <typename Item>
+ struct clear<all_custom_container<Item> >
+ {
+ static inline void apply(all_custom_container<Item>& container)
+ {
+ container.custom_clear();
+ }
+ };
+
+ template <typename Item>
+ struct push_back<all_custom_container<Item> >
+ {
+ static inline void apply(all_custom_container<Item>& container, Item const& item)
+ {
+ container.custom_push_back(item);
+ }
+ };
+
+ template <typename Item>
+ struct resize<all_custom_container<Item> >
+ {
+ static inline void apply(all_custom_container<Item>& container, std::size_t new_size)
+ {
+ container.custom_resize(new_size);
+ }
+ };
+
+} // namespace traits
+
+}} // namespace boost::geometry
+
+
+// 2a. Adapt to Boost.Range, meta-functions
+namespace boost
+{
+ template<typename Item>
+ struct range_mutable_iterator<all_custom_container<Item> >
+ {
+ typedef typename all_custom_container<Item>::custom_iterator_type type;
+ };
+
+ template<typename Item>
+ struct range_const_iterator<all_custom_container<Item> >
+ {
+ typedef typename all_custom_container<Item>::custom_const_iterator_type type;
+ };
+
+} // namespace boost
+
+
+// 2b. Adapt to Boost.Range, part 2, ADP
+
+template<typename Item>
+inline typename all_custom_container<Item>::custom_iterator_type
+ range_begin(all_custom_container<Item>& container)
+{
+ return container.custom_begin();
+}
+
+template<typename Item>
+inline typename all_custom_container<Item>::custom_const_iterator_type
+ range_begin(all_custom_container<Item> const& container)
+{
+ return container.custom_begin();
+}
+
+template<typename Item>
+inline typename all_custom_container<Item>::custom_iterator_type
+ range_end(all_custom_container<Item>& container)
+{
+ return container.custom_end();
+}
+
+template<typename Item>
+inline typename all_custom_container<Item>::custom_const_iterator_type
+ range_end(all_custom_container<Item> const& container)
+{
+ return container.custom_end();
+}
+
+// (Optional)
+template<typename Item>
+inline std::size_t range_calculate_size(all_custom_container<Item> const& container)
+{
+ return container.custom_size();
+}
+
+
+
+
+#endif // GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_CONTAINER_HPP

Added: trunk/libs/geometry/test/test_geometries/all_custom_linestring.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/test_geometries/all_custom_linestring.hpp 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -0,0 +1,136 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) test file
+//
+// Copyright Barend Gehrels 2011, 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 ar
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_LINESTRING_HPP
+#define GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_LINESTRING_HPP
+
+#include <cstddef>
+
+#include <boost/range.hpp>
+
+
+#include <boost/geometry/core/container_access.hpp>
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+#include <test_geometries/all_custom_container.hpp>
+
+
+template <typename P>
+class all_custom_linestring : public all_custom_container<P>
+{};
+
+
+// 1. Adapt to Boost.Geometry
+namespace boost { namespace geometry
+{
+
+namespace traits
+{
+ template <typename Point>
+ struct tag<all_custom_linestring<Point> >
+ {
+ typedef linestring_tag type;
+ };
+
+
+ // Implement traits for the mutable als
+ // These are all optional traits (normally / default they are implemented
+ // conforming std:: functionality)
+
+ template <typename Point>
+ struct clear<all_custom_linestring<Point> >
+ {
+ static inline void apply(all_custom_linestring<Point>& als)
+ {
+ als.custom_clear();
+ }
+ };
+
+ template <typename Point>
+ struct push_back<all_custom_linestring<Point> >
+ {
+ static inline void apply(all_custom_linestring<Point>& als, Point const& point)
+ {
+ als.custom_push_back(point);
+ }
+ };
+
+ template <typename Point>
+ struct resize<all_custom_linestring<Point> >
+ {
+ static inline void apply(all_custom_linestring<Point>& als, std::size_t new_size)
+ {
+ als.custom_resize(new_size);
+ }
+ };
+
+} // namespace traits
+
+}} // namespace boost::geometry
+
+
+// 2a. Adapt to Boost.Range, meta-functions
+namespace boost
+{
+ template<typename Point>
+ struct range_mutable_iterator<all_custom_linestring<Point> >
+ {
+ typedef typename all_custom_linestring<Point>::custom_iterator_type type;
+ };
+
+ template<typename Point>
+ struct range_const_iterator<all_custom_linestring<Point> >
+ {
+ typedef typename all_custom_linestring<Point>::custom_const_iterator_type type;
+ };
+
+} // namespace boost
+
+
+// 2b. Adapt to Boost.Range, part 2, ADP
+
+template<typename Point>
+inline typename all_custom_linestring<Point>::custom_iterator_type
+ range_begin(all_custom_linestring<Point>& als)
+{
+ return als.custom_begin();
+}
+
+template<typename Point>
+inline typename all_custom_linestring<Point>::custom_const_iterator_type
+ range_begin(all_custom_linestring<Point> const& als)
+{
+ return als.custom_begin();
+}
+
+template<typename Point>
+inline typename all_custom_linestring<Point>::custom_iterator_type
+ range_end(all_custom_linestring<Point>& als)
+{
+ return als.custom_end();
+}
+
+template<typename Point>
+inline typename all_custom_linestring<Point>::custom_const_iterator_type
+ range_end(all_custom_linestring<Point> const& als)
+{
+ return als.custom_end();
+}
+
+// (Optional)
+template<typename Point>
+inline std::size_t range_calculate_size(all_custom_linestring<Point> const& als)
+{
+ return als.custom_size();
+}
+
+
+// 3. There used to be a std::back_insert adaption but that is now done using push_back
+
+
+#endif // GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_LINESTRING_HPP

Added: trunk/libs/geometry/test/test_geometries/all_custom_polygon.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/test_geometries/all_custom_polygon.hpp 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -0,0 +1,128 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) test file
+//
+// Copyright Barend Gehrels 2011, 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 ar
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_POLYGON_HPP
+#define GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_POLYGON_HPP
+
+#include <cstddef>
+
+#include <boost/range.hpp>
+
+
+#include <boost/geometry/core/container_access.hpp>
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+#include <test_geometries/all_custom_container.hpp>
+#include <test_geometries/all_custom_ring.hpp>
+
+
+template <typename P>
+class all_custom_polygon
+{
+public :
+ typedef all_custom_ring<P> custom_ring_type;
+ typedef all_custom_container<custom_ring_type> custom_int_type;
+
+ custom_ring_type& custom_ext() { return m_ext; }
+ custom_int_type& custom_int() { return m_int; }
+
+ custom_ring_type const& custom_ext() const { return m_ext; }
+ custom_int_type const& custom_int() const { return m_int; }
+
+private :
+ custom_ring_type m_ext;
+ custom_int_type m_int;
+};
+
+
+
+namespace boost { namespace geometry
+{
+
+namespace traits
+{
+
+
+
+template <typename Point>
+struct tag<all_custom_polygon<Point> >
+{
+ typedef polygon_tag type;
+};
+
+template <typename Point>
+struct ring_const_type<all_custom_polygon<Point> >
+{
+ typedef typename all_custom_polygon<Point>::custom_ring_type const& type;
+};
+
+template <typename Point>
+struct ring_mutable_type<all_custom_polygon<Point> >
+{
+ typedef typename all_custom_polygon<Point>::custom_ring_type& type;
+};
+
+
+template <typename Point>
+struct interior_const_type<all_custom_polygon<Point> >
+{
+ typedef typename all_custom_polygon<Point>::custom_int_type const& type;
+};
+
+template <typename Point>
+struct interior_mutable_type<all_custom_polygon<Point> >
+{
+ typedef typename all_custom_polygon<Point>::custom_int_type& type;
+};
+
+
+
+template <typename Point>
+struct exterior_ring<all_custom_polygon<Point> >
+{
+ typedef all_custom_polygon<Point> polygon_type;
+ typedef typename polygon_type::custom_ring_type ring_type;
+
+ static inline ring_type& get(polygon_type& p)
+ {
+ return p.custom_ext();
+ }
+
+ static inline ring_type const& get(polygon_type const& p)
+ {
+ return p.custom_ext();
+ }
+};
+
+template <typename Point>
+struct interior_rings<all_custom_polygon<Point> >
+{
+ typedef all_custom_polygon<Point> polygon_type;
+ typedef typename polygon_type::custom_int_type int_type;
+
+ static inline int_type& get(polygon_type& p)
+ {
+ return p.custom_int();
+ }
+
+ static inline int_type const& get(polygon_type const& p)
+ {
+ return p.custom_int();
+ }
+};
+
+
+} // namespace traits
+
+}} // namespace boost::geometry
+
+
+
+
+
+#endif // GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_POLYGON_HPP

Added: trunk/libs/geometry/test/test_geometries/all_custom_ring.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/test_geometries/all_custom_ring.hpp 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -0,0 +1,140 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) test file
+//
+// Copyright Barend Gehrels 2011, 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 ar
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_RING_HPP
+#define GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_RING_HPP
+
+#include <cstddef>
+
+#include <boost/range.hpp>
+
+
+#include <boost/geometry/core/container_access.hpp>
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+
+#include <test_geometries/all_custom_container.hpp>
+
+
+template <typename P>
+class all_custom_ring : public all_custom_container<P>
+{};
+
+
+// Note that the things below are nearly all identical to implementation
+// in *linestring, but it seems not possible to re-use this (without macro's)
+// (the only thing DIFFERENT is the tag)
+
+
+// 1. Adapt to Boost.Geometry
+namespace boost { namespace geometry
+{
+
+namespace traits
+{
+ template <typename Point>
+ struct tag<all_custom_ring<Point> >
+ {
+ typedef ring_tag type;
+ };
+
+
+ // Implement traits for the mutable acr
+ // These are all optional traits (normally / default they are implemented
+ // conforming std:: functionality)
+
+ template <typename Point>
+ struct clear<all_custom_ring<Point> >
+ {
+ static inline void apply(all_custom_ring<Point>& acr)
+ {
+ acr.custom_clear();
+ }
+ };
+
+ template <typename Point>
+ struct push_back<all_custom_ring<Point> >
+ {
+ static inline void apply(all_custom_ring<Point>& acr, Point const& point)
+ {
+ acr.custom_push_back(point);
+ }
+ };
+
+ template <typename Point>
+ struct resize<all_custom_ring<Point> >
+ {
+ static inline void apply(all_custom_ring<Point>& acr, std::size_t new_size)
+ {
+ acr.custom_resize(new_size);
+ }
+ };
+
+} // namespace traits
+
+}} // namespace boost::geometry
+
+
+// 2a. Adapt to Boost.Range, meta-functions
+namespace boost
+{
+ template<typename Point>
+ struct range_mutable_iterator<all_custom_ring<Point> >
+ {
+ typedef typename all_custom_ring<Point>::custom_iterator_type type;
+ };
+
+ template<typename Point>
+ struct range_const_iterator<all_custom_ring<Point> >
+ {
+ typedef typename all_custom_ring<Point>::custom_const_iterator_type type;
+ };
+
+} // namespace boost
+
+
+// 2b. Adapt to Boost.Range, part 2, ADP
+
+template<typename Point>
+inline typename all_custom_ring<Point>::custom_iterator_type
+ range_begin(all_custom_ring<Point>& acr)
+{
+ return acr.custom_begin();
+}
+
+template<typename Point>
+inline typename all_custom_ring<Point>::custom_const_iterator_type
+ range_begin(all_custom_ring<Point> const& acr)
+{
+ return acr.custom_begin();
+}
+
+template<typename Point>
+inline typename all_custom_ring<Point>::custom_iterator_type
+ range_end(all_custom_ring<Point>& acr)
+{
+ return acr.custom_end();
+}
+
+template<typename Point>
+inline typename all_custom_ring<Point>::custom_const_iterator_type
+ range_end(all_custom_ring<Point> const& acr)
+{
+ return acr.custom_end();
+}
+
+// (Optional)
+template<typename Point>
+inline std::size_t range_calculate_size(all_custom_ring<Point> const& acr)
+{
+ return acr.custom_size();
+}
+
+
+
+
+#endif // GEOMETRY_TEST_TEST_GEOMETRIES_ALL_CUSTOM_RING_HPP

Modified: trunk/libs/geometry/test/test_geometries/wrapped_boost_array.hpp
==============================================================================
--- trunk/libs/geometry/test/test_geometries/wrapped_boost_array.hpp (original)
+++ trunk/libs/geometry/test/test_geometries/wrapped_boost_array.hpp 2011-02-07 13:55:36 EST (Mon, 07 Feb 2011)
@@ -123,50 +123,27 @@
         }
     };
 
-
-}}} // namespace bg::traits
-
-
-
-namespace std
-{
-
-template <typename Point, std::size_t Count>
-class back_insert_iterator< test::wrapped_boost_array<Point, Count> >
- : public std::iterator<std::output_iterator_tag, void, void, void, void>
-{
-public:
-
- typedef test::wrapped_boost_array<Point, Count> container_type;
- typedef back_insert_iterator<container_type> this_type;
-
- explicit back_insert_iterator(container_type& ar)
- : m_current(boost::begin(ar) + ar.size)
- , m_array(ar)
- {}
-
- inline this_type& operator=(Point const& value)
+ template <typename Point, std::size_t Count>
+ struct push_back< wrapped_boost_array<Point, Count> >
     {
- // Check if not passed beyond
- if (std::size_t(m_array.size) < Count)
+ static inline void apply(wrapped_boost_array<Point, Count>& ar, Point const& point)
         {
- *m_current++ = value;
- m_array.size++;
+ // BOOST_ASSERT((ar.size < Count));
+ ar.array[ar.size++] = point;
         }
- return *this;
- }
-
- // Boiler-plate
- inline this_type& operator*() { return *this; }
- inline this_type& operator++() { return *this; }
- inline this_type& operator++(int) { return *this; }
+ };
 
-private:
- typename boost::range_iterator<container_type>::type m_current;
- container_type& m_array;
-};
+ template <typename Point, std::size_t Count>
+ struct resize< wrapped_boost_array<Point, Count> >
+ {
+ static inline void apply(wrapped_boost_array<Point, Count>& ar, std::size_t new_size)
+ {
+ BOOST_ASSERT(new_size < Count);
+ ar.size = new_size;
+ }
+ };
 
-} // namespace std
+}}} // namespace bg::traits
 
 
 #endif // GEOMETRY_TEST_TEST_GEOMETRIES_WRAPPED_BOOST_ARRAY_HPP


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