Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60000 - in sandbox/geometry/libs/geometry: example example/extensions example/extensions/gis example/extensions/gis/latlong example/extensions/gis/projections example/extensions/gis/projections/data test/algorithms test/algorithms/overlay
From: barend.gehrels_at_[hidden]
Date: 2010-02-28 16:16:59


Author: barendgehrels
Date: 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
New Revision: 60000
URL: http://svn.boost.org/trac/boost/changeset/60000

Log:
Added 05 overlay examples
Added difference tests
Updated some overlay tests
Added:
   sandbox/geometry/libs/geometry/example/05_a_overlay_polygon_example.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/example/05_a_overlay_polygon_example.vcproj (contents, props changed)
   sandbox/geometry/libs/geometry/example/05_b_overlay_linestring_polygon_example.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/example/05_b_overlay_linestring_polygon_example.vcproj (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/
   sandbox/geometry/libs/geometry/example/extensions/Jamfile.v2 (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/
   sandbox/geometry/libs/geometry/example/extensions/gis/Jamfile.v2 (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/latlong/
   sandbox/geometry/libs/geometry/example/extensions/gis/latlong/Jamfile.v2 (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/latlong/distance_example.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/latlong/distance_example.vcproj (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/latlong/latlong_examples.sln (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/latlong/point_ll_example.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/latlong/point_ll_example.vcproj (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/osgeo4w-libraries.vsprops (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/projections/
   sandbox/geometry/libs/geometry/example/extensions/gis/projections/Jamfile.v2 (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/projections/data/
   sandbox/geometry/libs/geometry/example/extensions/gis/projections/p01_example.vcproj (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/projections/p01_projection_example.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/projections/p02_example.vcproj (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/projections/p02_projfactory_example.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/projections/p03_example.vcproj (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/projections/p03_projmap_example.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/projections/projection_examples.sln (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/shapelib_common.hpp (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/x01_shapelib_example.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/x01_shapelib_example.vcproj (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/x02_gd_example.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/example/extensions/gis/x02_gd_example.vcproj (contents, props changed)
   sandbox/geometry/libs/geometry/test/algorithms/difference.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/test/algorithms/difference.vcproj (contents, props changed)
   sandbox/geometry/libs/geometry/test/algorithms/test_difference.hpp (contents, props changed)
Text files modified:
   sandbox/geometry/libs/geometry/example/basic_examples.sln | 12 ++++
   sandbox/geometry/libs/geometry/test/algorithms/algorithms_tests.sln | 6 ++
   sandbox/geometry/libs/geometry/test/algorithms/overlay/dissolve.cpp | 7 +-
   sandbox/geometry/libs/geometry/test/algorithms/overlay/get_turns.cpp | 4 +
   sandbox/geometry/libs/geometry/test/algorithms/overlay/overlay.sln | 6 ++
   sandbox/geometry/libs/geometry/test/algorithms/overlay/overlay_cases.hpp | 15 +++++
   sandbox/geometry/libs/geometry/test/algorithms/overlay/traverse.cpp | 100 +++++++++++++++------------------------
   7 files changed, 82 insertions(+), 68 deletions(-)

Added: sandbox/geometry/libs/geometry/example/05_a_overlay_polygon_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/05_a_overlay_polygon_example.cpp 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,71 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright (C) 2010 Mateusz Loskot <mateusz at loskot dot net>, London, UK
+// 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)
+//
+// Polygon Overlay Example
+
+#include <fstream>
+#include <iostream>
+#include <string>
+#include <vector>
+
+#include <boost/foreach.hpp>
+
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/cartesian2d.hpp>
+#include <boost/geometry/geometries/adapted/c_array_cartesian.hpp>
+
+#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
+
+
+int main(void)
+{
+ namespace bg = boost::geometry;
+
+ std::ofstream stream("05_a_intersection_polygon_example.svg");
+ bg::svg_mapper<bg::point_2d> svg(stream, 500, 500);
+
+ // Define a polygons and fill the outer rings.
+ bg::polygon_2d a;
+ {
+ const double c[][2] = {
+ {160, 330}, {60, 260}, {20, 150}, {60, 40}, {190, 20}, {270, 130}, {260, 250}, {160, 330}
+ };
+ bg::assign(a, c);
+ }
+ bg::correct(a);
+ std::cout << "A: " << bg::dsv(a) << std::endl;
+ svg.add(a);
+
+ bg::polygon_2d b;
+ {
+ const double c[][2] = {
+ {300, 330}, {190, 270}, {150, 170}, {150, 110}, {250, 30}, {380, 50}, {380, 250}, {300, 330}
+ };
+ bg::assign(b, c);
+ }
+ bg::correct(b);
+ std::cout << "B: " << bg::dsv(b) << std::endl;
+ svg.add(b);
+
+ svg.map(a, "opacity:0.6;fill:rgb(0,255,0);");
+ svg.map(b, "opacity:0.6;fill:rgb(0,0,255);");
+
+
+ // Calculate interesection(s)
+ std::vector<bg::polygon_2d > intersection;
+ bg::intersection<bg::polygon_2d>(a, b, intersection);
+
+ std::cout << "Intersection of polygons A and B" << std::endl;
+ BOOST_FOREACH(bg::polygon_2d const& polygon, intersection)
+ {
+ std::cout << bg::dsv(polygon) << std::endl;
+ svg.map(polygon, "opacity:0.5;fill:none;stroke:rgb(255,0,0);stroke-width:6");
+ }
+
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/example/05_a_overlay_polygon_example.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/05_a_overlay_polygon_example.vcproj 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="05_a_overlay_polygon_example"
+ ProjectGUID="{119F9CCD-4B5F-4623-B4C1-F65E6323B24F}"
+ RootNamespace="05_a_overlay_polygon_example"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\05_a_overlay_polygon_example"
+ 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"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ RuntimeLibrary="1"
+ DisableLanguageExtensions="false"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NOINHERIT)"
+ LinkIncremental="2"
+ 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)\05_a_overlay_polygon_example"
+ 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"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ 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=".\05_a_overlay_polygon_example.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Added: sandbox/geometry/libs/geometry/example/05_b_overlay_linestring_polygon_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/05_b_overlay_linestring_polygon_example.cpp 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,81 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2010, Geodan, Amsterdam, the Netherlands
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// Linestring Polygon Overlay Example
+
+#include <fstream>
+#include <iostream>
+#include <string>
+#include <vector>
+
+#include <boost/foreach.hpp>
+
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/cartesian2d.hpp>
+#include <boost/geometry/geometries/adapted/c_array_cartesian.hpp>
+
+#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
+
+
+int main(void)
+{
+ namespace bg = boost::geometry;
+
+ // Define a polygons and fill the outer rings.
+ bg::linestring_2d ls;
+ {
+ const double c[][2] = { {0, 1}, {2, 5}, {5, 3} };
+ bg::assign(ls, c);
+ }
+
+ bg::polygon_2d p;
+ {
+ const double c[][2] = { {3, 0}, {0, 3}, {4, 5}, {3, 0} };
+ bg::assign(p, c);
+ }
+ bg::correct(p);
+
+ // Create SVG-mapper
+ std::ofstream stream("05_b_overlay_linestring_polygon_example.svg");
+ bg::svg_mapper<bg::point_2d> svg(stream, 500, 500);
+ // Determine extend by adding geometries
+ svg.add(p);
+ svg.add(ls);
+ // Map geometries
+ svg.map(ls, "opacity:0.6;stroke:rgb(255,0,0);stroke-width:2;");
+ svg.map(p, "opacity:0.6;fill:rgb(0,0,255);");
+
+
+ // Calculate intersection points (turn points)
+ typedef bg::detail::overlay::turn_info<bg::point_2d> turn_info;
+ std::vector<turn_info> turns;
+ bg::get_turns<bg::detail::overlay::assign_null_policy>(ls, p,
+ turns, bg::detail::get_turns::no_interrupt_policy());
+
+ std::cout << "Intersection of linestring/polygon" << std::endl;
+ BOOST_FOREACH(turn_info const& turn, turns)
+ {
+ std::string action = "intersecting";
+ if (turn.operations[0].operation
+ == bg::detail::overlay::operation_intersection)
+ {
+ action = "entering";
+ }
+ else if (turn.operations[0].operation
+ == bg::detail::overlay::operation_union)
+ {
+ action = "leaving";
+
+ }
+ std::cout << action << " polygon at " << bg::dsv(turn.point) << std::endl;
+ svg.map(turn.point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1");
+ svg.text(turn.point, action, "fill:rgb(0,0,0);font-family:Arial;font-size:10px");
+ }
+
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/example/05_b_overlay_linestring_polygon_example.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/05_b_overlay_linestring_polygon_example.vcproj 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="05_b_overlay_linestring_polygon_example"
+ ProjectGUID="{3A803CEA-0902-4355-886A-799C596D0B46}"
+ RootNamespace="05_b_overlay_linestring_polygon_example"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\05_b_overlay_linestring_polygon_example"
+ 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"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE; _SCL_SECURE_NO_WARNINGS"
+ MinimalRebuild="true"
+ RuntimeLibrary="1"
+ DisableLanguageExtensions="false"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NOINHERIT)"
+ LinkIncremental="2"
+ 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)\05_b_overlay_linestring_polygon_example"
+ 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"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE; _SCL_SECURE_NO_WARNINGS"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ 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=".\05_b_overlay_linestring_polygon_example.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Modified: sandbox/geometry/libs/geometry/example/basic_examples.sln
==============================================================================
--- sandbox/geometry/libs/geometry/example/basic_examples.sln (original)
+++ sandbox/geometry/libs/geometry/example/basic_examples.sln 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -12,6 +12,10 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "06_b_transformation_example", "06_b_transformation_example.vcproj", "{34346EC5-1EE8-49D5-AC21-D915B4D7D144}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "05_a_overlay_polygon_example", "05_a_overlay_polygon_example.vcproj", "{119F9CCD-4B5F-4623-B4C1-F65E6323B24F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "05_b_overlay_linestring_polygon_example", "05_b_overlay_linestring_polygon_example.vcproj", "{3A803CEA-0902-4355-886A-799C596D0B46}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -42,6 +46,14 @@
                 {34346EC5-1EE8-49D5-AC21-D915B4D7D144}.Debug|Win32.Build.0 = Debug|Win32
                 {34346EC5-1EE8-49D5-AC21-D915B4D7D144}.Release|Win32.ActiveCfg = Release|Win32
                 {34346EC5-1EE8-49D5-AC21-D915B4D7D144}.Release|Win32.Build.0 = Release|Win32
+ {119F9CCD-4B5F-4623-B4C1-F65E6323B24F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {119F9CCD-4B5F-4623-B4C1-F65E6323B24F}.Debug|Win32.Build.0 = Debug|Win32
+ {119F9CCD-4B5F-4623-B4C1-F65E6323B24F}.Release|Win32.ActiveCfg = Release|Win32
+ {119F9CCD-4B5F-4623-B4C1-F65E6323B24F}.Release|Win32.Build.0 = Release|Win32
+ {3A803CEA-0902-4355-886A-799C596D0B46}.Debug|Win32.ActiveCfg = Debug|Win32
+ {3A803CEA-0902-4355-886A-799C596D0B46}.Debug|Win32.Build.0 = Debug|Win32
+ {3A803CEA-0902-4355-886A-799C596D0B46}.Release|Win32.ActiveCfg = Release|Win32
+ {3A803CEA-0902-4355-886A-799C596D0B46}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE

Added: sandbox/geometry/libs/geometry/example/extensions/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/Jamfile.v2 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,12 @@
+# example/extensions/Jamfile.v2 controls building examples for GGL extensions
+#
+# 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)
+
+project ggl-example-extensions
+ : # requirements
+ ;
+
+build-project gis ;

Added: sandbox/geometry/libs/geometry/example/extensions/gis/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/Jamfile.v2 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,61 @@
+# example/extensions/gis/Jamfile.v2 controls building of GGL examples for GIS
+#
+# 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)
+
+import os ;
+
+# Setting Shapelib and libgd paths
+# Below, example paths point to Shapelib installation by OSGeo4W package
+# available at http://trac.osgeo.org/osgeo4w
+switch [ os.name ]
+{
+ case NT :
+ {
+ lib shp : : <file>C:/OSGeo4W/lib/shapelib_i.lib ;
+ LIBSHP_INCLUDE = <include>C:/OSGeo4W/include ;
+
+ lib gd : : <file>C:/OSGeo4W/lib/gd.lib ;
+ LIBGD_INCLUDE = <include>C:/OSGeo4W/include/gd ;
+ }
+ case * :
+ {
+ lib shp : :
+ <name>shp
+ <search>/usr/lib
+ <search>/usr/local/lib ;
+
+ lib gd : :
+ <name>gd
+ <search>/usr/lib
+ <search>/usr/local/lib ;
+ }
+}
+
+project ggl-example-extensions-gis
+ :
+ requirements
+ <include>.
+ <include>../../../../../boost
+ <toolset>gcc:<cxxflags>-pedantic
+ ;
+
+exe x01_shapelib_example
+ : # sources and dependencies
+ x01_shapelib_example.cpp shp
+ : # requirements
+ $(LIBSHP_INCLUDE)
+ ;
+
+exe x02_gd_example
+ : # sources and dependencies
+ x02_gd_example.cpp gd shp
+ : # requirements
+ $(LIBGD_INCLUDE)
+ $(LIBSHP_INCLUDE)
+ ;
+
+build-project latlong ;
+build-project projections ;

Added: sandbox/geometry/libs/geometry/example/extensions/gis/latlong/Jamfile.v2
==============================================================================

Added: sandbox/geometry/libs/geometry/example/extensions/gis/latlong/distance_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/latlong/distance_example.cpp 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,127 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2007-2009, Geodan, 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)
+//
+// Distance Example
+
+// This sample demonstrates the use of latlong-points, xy-points,
+// calculate distances between latlong points using different formulas,
+// calculate distance between points using pythagoras
+
+#include <iostream>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/cartesian2d.hpp>
+
+#include <boost/geometry/extensions/gis/latlong/latlong.hpp>
+
+#ifndef NO_PROJECTION
+#include <boost/geometry/extensions/gis/projections/proj/sterea.hpp>
+#include <boost/geometry/extensions/gis/projections/parameters.hpp>
+#endif
+
+int main()
+{
+ using namespace boost::geometry;
+
+ point_ll_deg a;
+ // Amsterdam 52 22'23"N 4 53'32"E
+ a.lat(dms<north>(52, 22, 23));
+ a.lon(dms<east>(4, 53, 32));
+
+ // Rotterdam 51 55'51"N 4 28'45"E
+ point_ll_deg r(latitude<>(dms<north>(51, 55, 51)), longitude<>(dms<east>(4, 28, 45)));
+
+ // The hague: 52 4' 48" N, 4 18' 0" E
+ point_ll_deg h(longitude<>(dms<east>(4, 18, 0)), latitude<>(dms<north>(52, 4, 48)));
+
+ point_ll_rad a_rad, r_rad, h_rad;
+ transform(a, a_rad);
+ transform(r, r_rad);
+ transform(h, h_rad);
+
+#ifndef NO_PROJECTION
+ projection::sterea_ellipsoid<point_ll_rad, point_2d> proj(projection::init("+lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m"));
+
+ point_2d a_rd, r_rd, h_rd;
+ proj.forward(a_rad, a_rd);
+ proj.forward(h_rad, h_rd);
+ proj.forward(r_rad, r_rd);
+#else
+ point_2d a_rd(121267, 487245);
+ point_2d r_rd(92526.2, 438324);
+ point_2d h_rd(80454.2, 455086);
+#endif
+
+ // ------------------------------------------------------------------------------------------
+ // Distances
+ // ------------------------------------------------------------------------------------------
+
+ std::cout << "Distance Amsterdam-Rotterdam: " << std::endl;
+ std::cout << "haversine: " << 0.001 * distance(a, r) << " km" << std::endl;
+ std::cout << "haversine rad: " << 0.001 * distance(a_rad, r_rad) << " km" << std::endl;
+ std::cout << "haversine other radius: " << distance(a, r, strategy::distance::haversine<point_ll_deg>(6371.0) ) << " km" << std::endl;
+ std::cout << "andoyer: " << 0.001 * distance(a, r, strategy::distance::andoyer<point_ll_deg>() ) << " km" << std::endl;
+ std::cout << "vincenty: " << 0.001 * distance(a, r, strategy::distance::vincenty<point_ll_deg>() ) << " km" << std::endl;
+ std::cout << "vincenty rad: " << 0.001 * distance(a_rad, r_rad, strategy::distance::vincenty<point_ll_rad>() ) << " km" << std::endl;
+ std::cout << "RD, pythagoras: " << 0.001 * distance(a_rd, r_rd) << " km" << std::endl;
+
+ std::cout << std::endl;
+ std::cout << "Distance Amsterdam-Den Haag: " << std::endl;
+ std::cout << "haversine: " << 0.001 * distance(a, h) << " km" << std::endl;
+
+ // ------------------------------------------------------------------------------------------
+ // Distances to segments
+ // ------------------------------------------------------------------------------------------
+ std::cout << std::endl << "The Hague - line Amsterdam,Rotterdam" << std::endl;
+
+ segment_2d ar_xy(a_rd, r_rd);
+
+ double dr = distance(h_rd, ar_xy);
+ std::cout << "in RD: " << 0.001 * dr << std::endl;
+
+ dr = distance(h, segment_ll_deg(a, r));
+ std::cout << "in LL: " << 0.001 * dr << std::endl;
+
+ std::cout << std::endl << "Rotterdam - line Amsterdam,the Hague" << std::endl;
+ dr = distance(r_rd, segment_2d(a_rd, h_rd));
+ std::cout << "in RD: " << 0.001 * dr << std::endl;
+ dr = distance(r, segment_ll_deg(a, h));
+ std::cout << "in LL: " << 0.001 * dr << std::endl;
+ std::cout << std::endl;
+
+ // ------------------------------------------------------------------------------------------
+ // Compilation
+ // ------------------------------------------------------------------------------------------
+ // Next line does not compile because Vincenty cannot work on xy-points
+ //std::cout << "vincenty on xy: " << 0.001 * distance(a_rd, r_rd, formulae::distance::vincenty<>() ) << " km" << std::endl;
+
+ // Next line does not compile because you cannot (yet) assign degree to radian directly
+ //point_ll_rad a_rad2 = a;
+
+ // Next line does not compile because you cannot assign latlong to xy
+ // point_2d axy = a;
+
+ // ------------------------------------------------------------------------------------------
+ // Length
+ // ------------------------------------------------------------------------------------------
+ // Length calculations use distances internally. The lines below take automatically the default
+ // formulae for distance. However, you can also specify a formula explicitly.
+
+ linestring_ll_deg line1;
+ append(line1, a);
+ append(line1, r);
+ std::cout << "length: " << length(line1) << std::endl;
+ std::cout << "length using Vincenty: " << length(line1, strategy::distance::vincenty<point_ll_deg>()) << std::endl;
+
+ linestring_2d line2;
+ append(line2, a_rd);
+ append(line2, r_rd);
+ std::cout << "length: " << length(line2) << std::endl;
+
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/example/extensions/gis/latlong/distance_example.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/latlong/distance_example.vcproj 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="distance_example"
+ ProjectGUID="{1D50082A-6BE8-493D-80F5-45CBB46CC593}"
+ RootNamespace="distance_example"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\distance_example"
+ 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="../../../../../../boost"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS"
+ MinimalRebuild="true"
+ RuntimeLibrary="3"
+ DisableLanguageExtensions="false"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="2"
+ 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)\distance_example"
+ 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="../../../../../../boost"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ 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=".\distance_example.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Added: sandbox/geometry/libs/geometry/example/extensions/gis/latlong/latlong_examples.sln
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/latlong/latlong_examples.sln 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "point_ll_example", "point_ll_example.vcproj", "{EE76F202-C916-4432-9629-E043098742E0}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "distance_example", "distance_example.vcproj", "{1D50082A-6BE8-493D-80F5-45CBB46CC593}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {EE76F202-C916-4432-9629-E043098742E0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {EE76F202-C916-4432-9629-E043098742E0}.Debug|Win32.Build.0 = Debug|Win32
+ {EE76F202-C916-4432-9629-E043098742E0}.Release|Win32.ActiveCfg = Release|Win32
+ {EE76F202-C916-4432-9629-E043098742E0}.Release|Win32.Build.0 = Release|Win32
+ {1D50082A-6BE8-493D-80F5-45CBB46CC593}.Debug|Win32.ActiveCfg = Debug|Win32
+ {1D50082A-6BE8-493D-80F5-45CBB46CC593}.Debug|Win32.Build.0 = Debug|Win32
+ {1D50082A-6BE8-493D-80F5-45CBB46CC593}.Release|Win32.ActiveCfg = Release|Win32
+ {1D50082A-6BE8-493D-80F5-45CBB46CC593}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal

Added: sandbox/geometry/libs/geometry/example/extensions/gis/latlong/point_ll_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/latlong/point_ll_example.cpp 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,125 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2007-2009, Geodan, 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)
+//
+// Point Example - showing geographic (latitude longitude) points
+
+#include <iostream>
+#include <iomanip>
+
+#include <boost/geometry/geometry.hpp>
+
+
+#include <boost/geometry/algorithms/parse.hpp>
+
+#include <boost/geometry/extensions/gis/latlong/latlong.hpp>
+
+// Formula to get the course (direction) between two points.
+// This might be a GGL-function in the future.
+template <typename P1, typename P2>
+inline double get_course(P1 const& p1, P2 const& p2)
+{
+ double const& lat1 = boost::geometry::get_as_radian<1>(p1);
+ double const& lon1 = boost::geometry::get_as_radian<0>(p1);
+ double const& lat2 = boost::geometry::get_as_radian<1>(p2);
+ double const& lon2 = boost::geometry::get_as_radian<0>(p2);
+ // http://williams.best.vwh.net/avform.htm#Crs
+ return atan2(sin(lon1-lon2)*cos(lat2),
+ cos(lat1)*sin(lat2)-sin(lat1)*cos(lat2)*cos(lon1-lon2));
+}
+
+
+// Formula to calculate the point at a distance/angle from another point
+// This might be a GGL-function in the future.
+template <typename P1, typename P2>
+inline void point_at_distance(P1 const& p1,
+ double distance, double tc, double radius,
+ P2& p2)
+{
+ double earth_perimeter = radius * boost::geometry::math::two_pi;
+ double d = (distance / earth_perimeter) * boost::geometry::math::two_pi;
+ double const& lat1 = boost::geometry::get_as_radian<1>(p1);
+ double const& lon1 = boost::geometry::get_as_radian<0>(p1);
+
+ // http://williams.best.vwh.net/avform.htm#LL
+ double lat = asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc));
+ double dlon = atan2(sin(tc)*sin(d)*cos(lat1),cos(d)-sin(lat1)*sin(lat));
+ double lon = lon1 - dlon;
+
+ boost::geometry::set_from_radian<1>(p2, lat);
+ boost::geometry::set_from_radian<0>(p2, lon);
+}
+
+
+
+int main()
+{
+ using namespace boost::geometry;
+
+ // Declare a latlong point, using doubles and degrees (= default)
+ point_ll_deg paris;
+
+ // Assign coordinates to the latlong point, using the methods lat and lon
+ // Paris 48 52' 0" N, 2 19' 59" E
+ paris.lat(dms<north>(48, 52, 0));
+ paris.lon(dms<east>(2, 19, 59));
+
+ std::cout << "Paris: " << boost::geometry::dsv(paris) << std::endl;
+
+ // Constructor using explicit latitude/longitude
+ // Lima 12 2' 36" S, 77 1' 42" W
+ point_ll_deg lima(
+ latitude<>(dms<south>(12, 2, 36)),
+ longitude<>(dms<west>(77, 1, 42)));
+
+ std::cout << "Lima: " << boost::geometry::dsv(lima) << std::endl;
+
+ // Construction with parse utiity
+ point_ll_deg amsterdam = parse<point_ll_deg>("52 22'23\"N", "4 53'32\"E");
+ std::cout << "Amsterdam: " << boost::geometry::dsv(amsterdam) << std::endl;
+
+ // Calculate the distance using the default strategy (Andoyer), and Vincenty
+ std::cout << std::setprecision(9);
+ std::cout << "Distance Paris-Lima, Andoyer (default) "
+ << 0.001 * distance(paris, lima)
+ << " km" << std::endl;
+
+ std::cout << "Distance Paris-Lima, Vincenty "
+ << 0.001 * distance(paris, lima, strategy::distance::vincenty<point_ll_deg>())
+ << " km" << std::endl;
+
+ // Using great circle (=haversine), this is less precise because earth is not a sphere
+ double const average_earth_radius = 6372795.0;
+ std::cout << "Distance Paris-Lima, great circle "
+ << 0.001 * distance(paris, lima, strategy::distance::haversine<point_ll_deg>(average_earth_radius))
+ << " km" << std::endl;
+
+ // Convert a latlong point to radians. This might be convenient, although algorithms
+ // are transparent on degree/radians
+ point_ll_rad paris_rad;
+ transform(paris, paris_rad);
+ std::cout << "Paris in radians: " << boost::geometry::dsv(paris_rad) << std::endl;
+
+ point_ll_rad amsterdam_rad;
+ transform(amsterdam, amsterdam_rad);
+ std::cout << "Amsterdam in radians: " << boost::geometry::dsv(amsterdam_rad) << std::endl;
+
+ std::cout << "Distance Paris-Amsterdam, (degree) " << 0.001 * distance(paris, amsterdam) << " km" << std::endl;
+ std::cout << "Distance Paris-Amsterdam, (radian) " << 0.001 * distance(paris_rad, amsterdam_rad) << " km" << std::endl;
+
+ std::cout << "Distance Paris-Amsterdam, (mixed) " << 0.001 * distance(paris, amsterdam_rad) << " km" << std::endl;
+
+ // Other way round: have Amsterdam and go 430 km to the south (i.e. first calculate direction)
+ double tc = get_course(amsterdam, paris);
+ std::cout << "Course: " << (tc * boost::geometry::math::r2d) << std::endl;
+
+ point_ll_deg paris_calculated;
+ point_at_distance(amsterdam, 430 * 1000.0, tc, average_earth_radius, paris_calculated);
+ std::cout << "Paris calculated (degree): " << boost::geometry::dsv(paris_calculated) << std::endl;
+
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/example/extensions/gis/latlong/point_ll_example.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/latlong/point_ll_example.vcproj 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="point_ll_example"
+ ProjectGUID="{EE76F202-C916-4432-9629-E043098742E0}"
+ RootNamespace="point_ll_example"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\point_ll_example"
+ 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="../../../../../../boost"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ RuntimeLibrary="3"
+ DisableLanguageExtensions="false"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="2"
+ 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)\point_ll_example"
+ 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="../../../../../../boost"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ 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=".\point_ll_example.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Added: sandbox/geometry/libs/geometry/example/extensions/gis/osgeo4w-libraries.vsprops
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/osgeo4w-libraries.vsprops 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="osgeo4w-libraries"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(OSGEO4W_HOME)/include"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="shapelib_i.lib gd.lib"
+ AdditionalLibraryDirectories="$(OSGEO4W_HOME)/lib"
+ />
+ <UserMacro
+ Name="OSGEO4W_HOME"
+ Value="C:\OSGeo4W"
+ />
+</VisualStudioPropertySheet>

Added: sandbox/geometry/libs/geometry/example/extensions/gis/projections/Jamfile.v2
==============================================================================

Added: sandbox/geometry/libs/geometry/example/extensions/gis/projections/p01_example.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/projections/p01_example.vcproj 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="p01_example"
+ ProjectGUID="{697F1239-C3A8-4EB8-9887-D25895FC1D2A}"
+ RootNamespace="p01_example"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\p01_example"
+ 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="../../../../../..;c:\svn\numeric_adaptor"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS"
+ MinimalRebuild="true"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="2"
+ 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)\p01_example"
+ 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"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ WholeProgramOptimization="false"
+ AdditionalIncludeDirectories="../../../../../..;c:\svn\numeric_adaptor"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS"
+ GeneratePreprocessedFile="0"
+ RuntimeLibrary="0"
+ EnableEnhancedInstructionSet="0"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ 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=".\p01_projection_example.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Added: sandbox/geometry/libs/geometry/example/extensions/gis/projections/p01_projection_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/projections/p01_projection_example.cpp 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,60 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2007-2009, Geodan, 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)
+//
+// Projection example 1, direct
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/algorithms/parse.hpp>
+#include <boost/geometry/geometries/cartesian2d.hpp>
+#include <boost/geometry/extensions/gis/io/wkt/stream_wkt.hpp>
+#include <boost/geometry/extensions/gis/latlong/latlong.hpp>
+#include <boost/geometry/extensions/gis/projections/parameters.hpp>
+#include <boost/geometry/extensions/gis/projections/proj/robin.hpp>
+
+int main()
+{
+ using namespace boost::geometry;
+
+ // Initialize projection parameters
+ projection::parameters par = projection::init("+ellps=WGS84 +units=m");
+
+ // Construct a Robinson projection, using specified point types
+ // (This delivers a projection without virtual methods. Note that in p02 example
+ // the projection is created using a factory, which delivers a projection with virtual methods)
+ projection::robin_spheroid<point_ll_deg, point_2d> prj(par);
+
+ // Define Amsterdam / Barcelona in decimal degrees / degrees/minutes
+ point_ll_deg amsterdam = parse<point_ll_deg>("52.4N", "5.9E");
+ point_ll_deg barcelona = parse<point_ll_deg>("41 23'N", "2 11'E");
+
+ point_2d pa, pb;
+
+ // Now do the projection. "Forward" means from latlong to meters.
+ // (Note that a map projection might fail. This is not 'exceptional'.
+ // Therefore the forward function does not throw but returns false)
+ if (prj.forward(amsterdam, pa) && prj.forward(barcelona, pb))
+ {
+ std::cout << "Amsterdam: " << pa << std::endl << "Barcelona: " << pb << std::endl;
+
+ std::cout << "Distance (unprojected):" << distance(amsterdam, barcelona) / 1000.0 << " km" << std::endl;
+ std::cout << "Distance ( projected):" << distance(pa, pb) / 1000.0 << " km" << std::endl;
+
+ // Do the inverse projection. "Inverse" means from meters to latlong
+ // It also might fail or might not exist, not all projections
+ // have their inverse implemented
+ point_ll_deg a1;
+ if (prj.inverse(pa, a1))
+ {
+ std::cout << "Amsterdam (original): " << amsterdam << std::endl
+ << "Amsterdam (projected, and back):" << a1 << std::endl;
+ std::cout << "Distance a-a': " << distance(amsterdam, a1) << " meter" << std::endl;
+ }
+ }
+
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/example/extensions/gis/projections/p02_example.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/projections/p02_example.vcproj 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="p02_example"
+ ProjectGUID="{E521033E-25D0-4E6B-B9E8-C07197606E43}"
+ RootNamespace="p02_example"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\p02_example"
+ 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;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS"
+ MinimalRebuild="true"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="2"
+ 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)\p02_example"
+ 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"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ WholeProgramOptimization="false"
+ AdditionalIncludeDirectories="../../../../../..;."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS"
+ GeneratePreprocessedFile="0"
+ RuntimeLibrary="0"
+ EnableEnhancedInstructionSet="0"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ 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=".\p02_projfactory_example.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Added: sandbox/geometry/libs/geometry/example/extensions/gis/projections/p02_projfactory_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/projections/p02_projfactory_example.cpp 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,62 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2007-2009, Geodan, 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)
+//
+// Projection example 2, using factory
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/cartesian2d.hpp>
+#include <boost/geometry/extensions/gis/io/wkt/stream_wkt.hpp>
+#include <boost/geometry/extensions/gis/latlong/latlong.hpp>
+#include <boost/geometry/extensions/gis/projections/parameters.hpp>
+#include <boost/geometry/extensions/gis/projections/factory.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+int main()
+{
+ using namespace boost::geometry;
+
+ // Initialize projection parameters. For construction using a factory the projection name is required.
+ projection::parameters par = projection::init("+proj=robin +ellps=WGS84 +units=m");
+
+ // Construct the specified projection, using specified point types
+ // Note that this is the only difference from p01_projection_example. It constructs a projection
+ // with virtual methods, which can be used polymorphically. Therefore it is a pointer. For
+ // convenience we use a boost shared pointer here.
+ projection::factory<point_ll_deg, point_2d> fac;
+ boost::shared_ptr<projection::projection<point_ll_deg, point_2d> > prj(fac.create_new(par));
+
+ // Define Amsterdam / Barcelona in decimal degrees / degrees/minutes
+ point_ll_deg amsterdam(longitude<>(5.9), latitude<>(52.4));
+ point_ll_deg barcelona(
+ latitude<>(dms<north>(41, 23)),
+ longitude<>(dms<east>(2, 11))
+ );
+
+ point_2d pa, pb;
+
+ // Do the forward projection
+ if (prj->forward(amsterdam, pa) && prj->forward(barcelona, pb))
+ {
+ std::cout << "Amsterdam: " << pa << std::endl << "Barcelona: " << pb << std::endl;
+
+ std::cout << "Distance (unprojected):" << distance(amsterdam, barcelona) / 1000.0 << " km" << std::endl;
+ std::cout << "Distance ( projected):" << distance(pa, pb) / 1000.0 << " km" << std::endl;
+
+ // Get the inverse
+ point_ll_deg a1;
+ if (prj->inverse(pa, a1))
+ {
+ std::cout << "Amsterdam (original): " << amsterdam << std::endl
+ << "Amsterdam (projected, and back):" << a1 << std::endl;
+ std::cout << "Distance a-a': " << distance(amsterdam, a1) << " meter" << std::endl;
+ }
+ }
+
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/example/extensions/gis/projections/p03_example.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/projections/p03_example.vcproj 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="p03_example"
+ ProjectGUID="{130DA4D1-E7E6-4E51-9D97-FC048995FEAC}"
+ RootNamespace="p03_example"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\p03_example"
+ 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=".;../../../../../..;&quot;./contrib/shapelib-1.2.10&quot;;&quot;./contrib/gd-2.0.35&quot;"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS"
+ MinimalRebuild="true"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="2"
+ 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)\p03_example"
+ 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"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ WholeProgramOptimization="false"
+ AdditionalIncludeDirectories=".;../../../../../..;&quot;./contrib/shapelib-1.2.10&quot;;&quot;./contrib/gd-2.0.35&quot;"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS"
+ GeneratePreprocessedFile="0"
+ RuntimeLibrary="0"
+ EnableEnhancedInstructionSet="0"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ 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=".\p03_projmap_example.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Added: sandbox/geometry/libs/geometry/example/extensions/gis/projections/p03_projmap_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/projections/p03_projmap_example.cpp 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,149 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2007-2009, Geodan, 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)
+//
+// Projection example 3, combined with shapelib and GD
+
+#include <fstream>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/cartesian2d.hpp>
+#include <boost/geometry/geometries/adapted/std_as_ring.hpp>
+#include <boost/geometry/geometries/register/point.hpp>
+#include <boost/geometry/multi/geometries/multi_polygon.hpp>
+#include <boost/geometry/extensions/io/svg/write_svg.hpp>
+#include <boost/geometry/extensions/gis/io/wkt/read_wkt_multi.hpp>
+#include <boost/geometry/extensions/gis/latlong/latlong.hpp>
+#include <boost/geometry/extensions/gis/projections/project_transformer.hpp>
+
+void read_wkt_and_project_and_write_svg(std::string const& wkt_filename,
+ std::string const& projection_parameters,
+ std::string const& svg_filename)
+{
+ using namespace boost::geometry;
+
+ // Declare a vector containing the world countries
+ std::vector<polygon_ll_deg> ll_polygons;
+
+ // Read polygons from a Well-Known Text file using the ggl parser
+ std::ifstream cpp_file(wkt_filename.c_str());
+ if (! cpp_file.is_open())
+ {
+ throw std::string("File not found: ") + wkt_filename;
+ }
+
+ while (! cpp_file.eof() )
+ {
+ std::string line;
+ std::getline(cpp_file, line);
+ if (boost::starts_with(line, "MULTIPOLYGON"))
+ {
+ typedef boost::geometry::multi_polygon<boost::geometry::polygon<point_ll_deg> > mp_type;
+ mp_type mp;
+ boost::geometry::read_wkt(line, mp);
+ for (mp_type::const_iterator it = boost::begin(mp);
+ it != boost::end(mp); ++it)
+ {
+ ll_polygons.push_back(*it);
+ }
+ }
+ }
+
+ // Our latlong polygon collection will be projected into this vector
+ // (Of course it is also possible to do this while reading and have one vector)
+ std::vector<polygon_2d> xy_polygons;
+
+ // Declare transformation strategy which contains a projection
+ projection::project_transformer
+ <
+ point_ll_deg,
+ point_2d
+ > projection(projection_parameters);
+
+ // Project the polygons, and at the same time get the bounding box (in xy)
+ box_2d bbox;
+ assign_inverse(bbox);
+ for (std::vector<polygon_ll_deg>::const_iterator it = ll_polygons.begin();
+ it != ll_polygons.end();
+ ++it)
+ {
+ polygon_2d xy_polygon;
+
+ if (transform(*it, xy_polygon, projection))
+ {
+ // Update bbox with box of this projected polygon
+ combine(bbox, make_envelope<box_2d>(xy_polygon));
+
+ // Add projected polygon
+ xy_polygons.push_back(xy_polygon);
+ }
+ }
+
+ // Create an SVG image
+ std::ofstream out(svg_filename.c_str());
+ out
+ << "<?xml version=\"1.0\" standalone=\"no\"?>" << std::endl
+ << "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"" << std::endl
+ << "\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">" << std::endl
+ << "<svg width=\"100%\" height=\"100%\" version=\"1.1\"" << std::endl
+ << "xmlns=\"http://www.w3.org/2000/svg\">" << std::endl;
+
+ // Setup the transformation to SVG
+ // (alternatively this could be skipped because SVG can transform itself,
+ // but this example shows it like this)
+ typedef boost::geometry::point_xy<int> svg_point;
+ boost::geometry::strategy::transform::map_transformer
+ <
+ point_2d,
+ svg_point,
+ true,
+ true
+ > svg_transformer(bbox, 800, 600);
+
+ // Create the background. Because projections might reverse the world,
+ // so we use SVG-coordinates here
+ boost::geometry::box<svg_point> box;
+ boost::geometry::assign(box, 0, 0, 800, 600);
+ out << boost::geometry::svg(box, "fill:rgb(0,0,255)") << std::endl;
+
+ for (std::vector<polygon_2d>::const_iterator it = xy_polygons.begin();
+ it != xy_polygons.end();
+ ++it)
+ {
+ boost::geometry::polygon<svg_point> svg_polygon;
+ boost::geometry::transform(*it, svg_polygon, svg_transformer);
+ out << boost::geometry::svg(svg_polygon,
+ "fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:0.2")
+ << std::endl;
+ }
+ out << "</svg>" << std::endl;
+}
+
+int main(int argc, char** argv)
+{
+ try
+ {
+ // Note, file location: trunk/libs/geometry/example/data
+ // update path below if necessary
+ read_wkt_and_project_and_write_svg(
+ "data/world.wkt",
+ "+proj=moll +ellps=clrk66",
+ "world.svg");
+ }
+ catch(std::exception const& e)
+ {
+ std::cout << "Exception: " << e.what() << std::endl;
+ return 1;
+ }
+ catch(std::string const& s)
+ {
+ std::cout << "Exception: " << s << std::endl;
+ return 1;
+ }
+
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/example/extensions/gis/projections/projection_examples.sln
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/projections/projection_examples.sln 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,31 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "p01_example", "p01_example.vcproj", "{697F1239-C3A8-4EB8-9887-D25895FC1D2A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "p02_example", "p02_example.vcproj", "{E521033E-25D0-4E6B-B9E8-C07197606E43}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "p03_example", "p03_example.vcproj", "{130DA4D1-E7E6-4E51-9D97-FC048995FEAC}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {697F1239-C3A8-4EB8-9887-D25895FC1D2A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {697F1239-C3A8-4EB8-9887-D25895FC1D2A}.Debug|Win32.Build.0 = Debug|Win32
+ {697F1239-C3A8-4EB8-9887-D25895FC1D2A}.Release|Win32.ActiveCfg = Release|Win32
+ {697F1239-C3A8-4EB8-9887-D25895FC1D2A}.Release|Win32.Build.0 = Release|Win32
+ {E521033E-25D0-4E6B-B9E8-C07197606E43}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E521033E-25D0-4E6B-B9E8-C07197606E43}.Debug|Win32.Build.0 = Debug|Win32
+ {E521033E-25D0-4E6B-B9E8-C07197606E43}.Release|Win32.ActiveCfg = Release|Win32
+ {E521033E-25D0-4E6B-B9E8-C07197606E43}.Release|Win32.Build.0 = Release|Win32
+ {130DA4D1-E7E6-4E51-9D97-FC048995FEAC}.Debug|Win32.ActiveCfg = Debug|Win32
+ {130DA4D1-E7E6-4E51-9D97-FC048995FEAC}.Debug|Win32.Build.0 = Debug|Win32
+ {130DA4D1-E7E6-4E51-9D97-FC048995FEAC}.Release|Win32.ActiveCfg = Release|Win32
+ {130DA4D1-E7E6-4E51-9D97-FC048995FEAC}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal

Added: sandbox/geometry/libs/geometry/example/extensions/gis/shapelib_common.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/shapelib_common.hpp 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,61 @@
+#ifndef SHAPELIB_COMMON_HPP
+#define SHAPELIB_COMMON_HPP
+
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2007-2009, Geodan, 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 "shapefil.h"
+#include <string>
+#include <vector>
+
+// A slightly different implementation of reading shapefile with shapelib.
+// See also 08_shapefile_example
+template <typename T>
+void read_shapefile(const std::string& filename, std::vector<T>& rings)
+{
+ typedef typename boost::geometry::point_type<T>::type P;
+
+ SHPHandle handle = SHPOpen(filename.c_str(), "rb");
+ if (handle <= 0)
+ {
+ throw std::string("File " + filename + " not found");
+ }
+
+ int nShapeType, nEntities;
+ double adfMinBound[4], adfMaxBound[4];
+ SHPGetInfo(handle, &nEntities, &nShapeType, adfMinBound, adfMaxBound );
+
+ for (int i = 0; i < nEntities; i++)
+ {
+ SHPObject* psShape = SHPReadObject(handle, i );
+
+ if (psShape->nSHPType == SHPT_POLYGON)
+ {
+ // Read all polygon parts. Holes are ignored, handled as normal parts. Add them as rings
+ int v = 0;
+ for (int p = 0; p < psShape->nParts && v < psShape->nVertices; p++)
+ {
+ T ring;
+ int n = p == psShape->nParts - 1 ?psShape->nVertices : psShape->panPartStart[p + 1];
+ while(v < n)
+ {
+ P point;
+ boost::geometry::assign(point, psShape->padfX[v], psShape->padfY[v]);
+ ring.push_back(point);
+ v++;
+ }
+ rings.push_back(ring);
+ }
+ }
+
+ SHPDestroyObject( psShape );
+ }
+ SHPClose(handle);
+}
+
+#endif

Added: sandbox/geometry/libs/geometry/example/extensions/gis/x01_shapelib_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/x01_shapelib_example.cpp 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,117 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2007-2009, Geodan, 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)
+//
+// SHAPELIB example
+
+// Shapelib is a well-known and often used library to read (and write) shapefiles by Frank Warmerdam
+
+// To build and run this example:
+// 1) download shapelib from http://shapelib.maptools.org/
+// 2) extract and put the source "shpopen.cpp" in project or makefile
+// 3) download a shapefile, for example world countries from http://aprsworld.net/gisdata/world
+// Alternativelly, install Shapelib using OSGeo4W installer from http://trac.osgeo.org/osgeo4w/
+// that provides Windows binary packages
+
+#include "shapefil.h"
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/geometries/cartesian2d.hpp>
+#include <boost/geometry/extensions/gis/io/wkt/stream_wkt.hpp>
+
+using namespace boost::geometry;
+
+template <typename T, typename F>
+void read_shapefile(const std::string& filename, std::vector<T>& polygons, F functor)
+{
+ try
+ {
+ SHPHandle handle = SHPOpen(filename.c_str(), "rb");
+ if (handle <= 0)
+ {
+ throw std::string("File " + filename + " not found");
+ }
+
+ int nShapeType, nEntities;
+ double adfMinBound[4], adfMaxBound[4];
+ SHPGetInfo(handle, &nEntities, &nShapeType, adfMinBound, adfMaxBound );
+
+ for (int i = 0; i < nEntities; i++)
+ {
+ SHPObject* psShape = SHPReadObject(handle, i );
+
+ // Read only polygons, and only those without holes
+ if (psShape->nSHPType == SHPT_POLYGON && psShape->nParts == 1)
+ {
+ T polygon;
+ functor(psShape, polygon);
+ polygons.push_back(polygon);
+ }
+ SHPDestroyObject( psShape );
+ }
+ SHPClose(handle);
+ }
+ catch(const std::string& s)
+ {
+ throw s;
+ }
+ catch(...)
+ {
+ throw std::string("Other exception");
+ }
+}
+
+
+template <typename T>
+void convert(SHPObject* psShape, T& polygon)
+{
+ double* x = psShape->padfX;
+ double* y = psShape->padfY;
+ for (int v = 0; v < psShape->nVertices; v++)
+ {
+ typename point_type<T>::type point;
+ assign(point, x[v], y[v]);
+ append(polygon, point);
+ }
+}
+
+
+int main()
+{
+ std::string filename = "c:/data/spatial/shape/world_free/world.shp";
+
+ std::vector<polygon_2d> polygons;
+
+ try
+ {
+ read_shapefile(filename, polygons, convert<polygon_2d>);
+ }
+ catch(const std::string& s)
+ {
+ std::cout << s << std::endl;
+ return 1;
+ }
+
+ // Do something with the polygons, for example simplify them
+ for (std::vector<polygon_2d>::iterator it = polygons.begin(); it != polygons.end(); it++)
+ {
+ polygon_2d p;
+ simplify(*it, p, 0.01);
+ std::cout << it->outer().size() << "," << p.outer().size() << std::endl;
+ *it = p;
+ }
+ std::cout << "Simplified " << polygons.size() << std::endl;
+
+ double sum = 0;
+ for (std::vector<polygon_2d>::const_iterator it = polygons.begin(); it != polygons.end(); it++)
+ {
+ sum += area(*it);
+ }
+ std::cout << "Total area of " << polygons.size() << " polygons, total: " << sum << std::endl;
+
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/example/extensions/gis/x01_shapelib_example.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/x01_shapelib_example.vcproj 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="x01_shapelib_example"
+ ProjectGUID="{92ECE1AC-1A5D-4554-A8AD-690AC266210D}"
+ RootNamespace="shapelib"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\shapelib"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;.\osgeo4w-libraries.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../boost;./contrib/shapelib-1.2.10;$(OSGEO4W_HOME)/include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="$(OSGEO4W_HOME)/lib"
+ 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)\shapelib"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;.\osgeo4w-libraries.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ WholeProgramOptimization="false"
+ AdditionalIncludeDirectories="../../../../../boost;./contrib/shapelib-1.2.10;$(OSGEO4W_HOME)/include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(OSGEO4W_HOME)/lib"
+ GenerateDebugInformation="true"
+ 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=".\x01_shapelib_example.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Added: sandbox/geometry/libs/geometry/example/extensions/gis/x02_gd_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/x02_gd_example.cpp 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,110 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2007-2009, Geodan, 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)
+//
+// GD example
+
+// GD is a well-known and often used graphic library to write GIF (and other formats)
+
+// To build and run this example:
+// 1) This example uses also shapelib, see 08_shapelib_example for necessary proceudre
+// 2) download GD from http://www.libgd.org
+// 3) add 11 files mentioned below to the project or makefile
+// 4) for windows, add define NONDLL to indicate GD is not used as a DLL
+// GD FILES necessary: gd.c, gd_gd.c, gd_gif_out.c, gd_io*.c, gd_security.c, gd_topal.c, gdhelpers.c, gdtables.c
+// Alternativelly, install GD using OSGeo4W installer from http://trac.osgeo.org/osgeo4w/
+// that provides Windows binary packages
+
+#include <cmath>
+#include <cstdio>
+#include <vector>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/algorithms/area.hpp>
+#include <boost/geometry/geometries/cartesian2d.hpp>
+#include <boost/geometry/extensions/gis/latlong/latlong.hpp>
+
+#include <gd.h>
+#include "shapelib_common.hpp"
+
+int main()
+{
+ std::string filename = "c:/data/spatial/shape/world_free/world.shp";
+
+ // The world is measured in latlong (degrees), so latlong (point_ll_deg, ring_ll_deg) is appropriate.
+ // (It is possible to change this in point_xy)
+ // We ignore holes in this sample.
+ // So declare a ring_ll_deg (= closed ring, polygon without holes)
+ std::vector<boost::geometry::ring_ll_deg> rings;
+
+ // Open a shapefile, for example world countries
+ try
+ {
+ read_shapefile(filename, rings);
+ }
+ catch(const std::string& s)
+ {
+ std::cout << s << std::endl;
+ return 1;
+ }
+
+ // Create a GD image.
+ // A world map, as world.shp, is usually mapped in latitude-longitude (-180..180 and -90..90)
+ // For this sample we use a very simple "transformation"
+ // mapping to 0..720 and 0..360
+ const double factor = 2.0;
+ gdImagePtr im = gdImageCreateTrueColor(int(360 * factor), int(180 * factor));
+
+ // Allocate three colors
+ int blue = gdImageColorResolve(im, 0, 52, 255);
+ int green = gdImageColorResolve(im, 0, 255, 0);
+ int black = gdImageColorResolve(im, 0, 0, 0);
+
+ // Paint background
+ gdImageFilledRectangle(im, 0, 0, im->sx, im->sy, blue);
+
+ // Paint all rings
+ for (std::vector<boost::geometry::ring_ll_deg>::const_iterator it = rings.begin(); it != rings.end(); ++it)
+ {
+ const boost::geometry::ring_ll_deg& ring = *it;
+
+ // If wished, suppress too small polygons.
+ // (Note that even in latlong, area is calculated in square meters)
+ const double a = boost::geometry::area(ring);
+ if (std::fabs(a) > 5000.0e6)
+ {
+ const int n = ring.size();
+ gdPoint* points = new gdPoint[n];
+
+ for (int i = 0; i < n; i++)
+ {
+ // Translate lon/lat or x/y to GD x/y points
+ points[i].x = int(factor * (boost::geometry::get<0>(ring[i]) + 180.0));
+ points[i].y = im->sy - int(factor * (boost::geometry::get<1>(ring[i]) + 90.0));
+ }
+
+ // Draw the polygon...
+ gdImageFilledPolygon(im, points, n, green);
+ // .. and the outline...
+ gdImagePolygon(im, points, n, black);
+
+ delete[] points;
+ }
+ }
+
+ // Use GD to create a GIF file
+ std::FILE* out = std::fopen("world.gif", "wb");
+ if (out != NULL)
+ {
+ gdImageGif(im, out);
+ std::fclose(out);
+ }
+
+ gdImageDestroy(im);
+
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/example/extensions/gis/x02_gd_example.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/x02_gd_example.vcproj 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="x02_gd_example"
+ ProjectGUID="{A73F21AC-6F32-41A9-A86C-53BD4DC84B05}"
+ RootNamespace="x02_gd_example"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\x02_gd_example"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;.\osgeo4w-libraries.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../../../../../boost;&quot;./contrib/shapelib-1.2.10&quot;;&quot;./contrib/gd-2.0.35&quot;;$(OSGEO4W_HOME)/include;$(OSGEO4W_HOME)/include/gd"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NONDLL"
+ MinimalRebuild="true"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib"
+ LinkIncremental="2"
+ 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)\x02_gd_example"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\boost.vsprops;.\osgeo4w-libraries.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ WholeProgramOptimization="false"
+ AdditionalIncludeDirectories=".;../../../../../boost;&quot;./contrib/shapelib-1.2.10&quot;;&quot;./contrib/gd-2.0.35&quot;;$(OSGEO4W_HOME)/include;$(OSGEO4W_HOME)/include/gd"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NONDLL"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ 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=".\x02_gd_example.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Modified: sandbox/geometry/libs/geometry/test/algorithms/algorithms_tests.sln
==============================================================================
--- sandbox/geometry/libs/geometry/test/algorithms/algorithms_tests.sln (original)
+++ sandbox/geometry/libs/geometry/test/algorithms/algorithms_tests.sln 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -50,6 +50,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "equals", "equals.vcproj", "{E54F493F-BF9D-4A6D-AE2F-5F97AC95251A}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "difference", "difference.vcproj", "{4EBFC27A-75C9-43A1-8DDA-AFEB45C564DC}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -156,6 +158,10 @@
                 {E54F493F-BF9D-4A6D-AE2F-5F97AC95251A}.Debug|Win32.Build.0 = Debug|Win32
                 {E54F493F-BF9D-4A6D-AE2F-5F97AC95251A}.Release|Win32.ActiveCfg = Release|Win32
                 {E54F493F-BF9D-4A6D-AE2F-5F97AC95251A}.Release|Win32.Build.0 = Release|Win32
+ {4EBFC27A-75C9-43A1-8DDA-AFEB45C564DC}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4EBFC27A-75C9-43A1-8DDA-AFEB45C564DC}.Debug|Win32.Build.0 = Debug|Win32
+ {4EBFC27A-75C9-43A1-8DDA-AFEB45C564DC}.Release|Win32.ActiveCfg = Release|Win32
+ {4EBFC27A-75C9-43A1-8DDA-AFEB45C564DC}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE

Added: sandbox/geometry/libs/geometry/test/algorithms/difference.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/algorithms/difference.cpp 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,76 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) test file
+//
+// Copyright Barend Gehrels 2010, Geodan, Amsterdam, the Netherlands
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <iostream>
+#include <string>
+
+
+#include <algorithms/test_difference.hpp>
+#include <algorithms/test_overlay.hpp>
+#include <algorithms/overlay/overlay_cases.hpp>
+
+template <typename P>
+void test_all()
+{
+ typedef boost::geometry::polygon<P> polygon;
+
+ test_one<polygon, polygon, polygon>(
+ "star_ring", example_star, example_ring,
+ 5, 22, 1.1901714,
+ 5, 27, 1.6701714);
+
+ test_one<polygon, polygon, polygon>("two_bends",
+ two_bends[0], two_bends[1],
+ 1, 7, 24.0,
+ 1, 7, 24.0);
+
+ test_one<polygon, polygon, polygon>("star_comb_15",
+ star_15, comb_15,
+ 28, 150, 189.952883,
+ 28, 150, 189.952883);
+
+ test_one<polygon, polygon, polygon>("simplex_normal",
+ simplex_normal[0], simplex_normal[1],
+ 1, 7, 5.47363293,
+ 1, 7, 5.47363293);
+
+ test_one<polygon, polygon, polygon>("fitting",
+ fitting[0], fitting[1],
+ 0, 0, 0, 0, 0, 0);
+
+ test_one<polygon, polygon, polygon>("new_hole",
+ new_hole[0], new_hole[1],
+ 2, 10, 2.0,
+ 2, 10, 2.0);
+
+ test_one<polygon, polygon, polygon>("intersect_holes_disjoint",
+ intersect_holes_disjoint[0], intersect_holes_disjoint[1],
+ 1, 15, 18.0,
+ 1, 15, 18.0);
+
+ test_one<polygon, polygon, polygon>("intersect_holes_intersect",
+ intersect_holes_intersect[0], intersect_holes_intersect[1],
+ 1, 14, 18.25,
+ 1, 14, 18.25);
+
+ test_one<polygon, polygon, polygon>(
+ "case4", case_4[0], case_4[1],
+ 4, 22, 1.1901714,
+ 4, 27, 1.6701714);
+
+ test_one<polygon, polygon, polygon>(
+ "case5", case_5[0], case_5[1],
+ 4, 22, 1.1901714,
+ 4, 27, 1.6701714);
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<boost::geometry::point_xy<double> >();
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/test/algorithms/difference.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/algorithms/difference.vcproj 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="difference"
+ ProjectGUID="{4EBFC27A-75C9-43A1-8DDA-AFEB45C564DC}"
+ RootNamespace="difference"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\difference"
+ 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;NONDLL;_CRT_SECURE_NO_WARNINGS;TEST_WITH_SVG"
+ MinimalRebuild="true"
+ ExceptionHandling="2"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="2"
+ 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)\difference"
+ 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;NONDLL;_CRT_SECURE_NO_WARNINGS"
+ ExceptionHandling="2"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="kernel32.lib $(NoInherit)"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ 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=".\difference.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Modified: sandbox/geometry/libs/geometry/test/algorithms/overlay/dissolve.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/algorithms/overlay/dissolve.cpp (original)
+++ sandbox/geometry/libs/geometry/test/algorithms/overlay/dissolve.cpp 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -90,10 +90,6 @@
     typedef boost::geometry::linear_ring<P> ring;
     typedef boost::geometry::polygon<P> polygon;
 
- test_geometry<polygon>("case_1", 2, 2.96969697,
- "POLYGON((1 3,0 9,9 5,1 7,9 8,2 5,10 10,9 2,1 3))");
- return;
-
     // Just a normal polygon
     test_geometry<polygon>("1", 0, 0,
             "POLYGON((0 0,0 4,1.5 2.5,2.5 1.5,4 0,0 0))");
@@ -159,6 +155,9 @@
     test_geometry<polygon>("toolkit_2", 2, 2.96969697,
             "POLYGON((170718 605997,170718 605997,170776 606016,170773 606015,170786 606020,170778 606016,170787 606021,170781 606017,170795 606028,170795 606028,170829 606055,170939 606140,170933 605968,170933 605968,170932 605908,170929 605834,170920 605866,170961 605803,170739 605684,170699 605749,170691 605766,170693 605762,170686 605775,170688 605771,170673 605794,170676 605790,170668 605800,170672 605796,170651 605818,170653 605816,170639 605829,170568 605899,170662 605943,170633 605875,170603 605961,170718 605997))");
 
+ test_geometry<polygon>("case_1", 2, 2.96969697,
+ "POLYGON((1 3,0 9,9 5,1 7,9 8,2 5,10 10,9 2,1 3))");
+ //return;
 
 
     // Real-life

Modified: sandbox/geometry/libs/geometry/test/algorithms/overlay/get_turns.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/algorithms/overlay/get_turns.cpp (original)
+++ sandbox/geometry/libs/geometry/test/algorithms/overlay/get_turns.cpp 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -271,6 +271,10 @@
 
     // line-line
     test_overlay<linestring, linestring, test_get_turns, Tuple>("lineline1", boost::make_tuple(3, 1.6190476, 3.4761905), line_line1[0], line_line1[1]);
+
+ // line-polygon
+ test_overlay<linestring, polygon, test_get_turns, Tuple>("line_poly1", boost::make_tuple(3, 1.6190476, 3.4761905), line_line1[0], case_1[1]);
+ test_overlay<linestring, polygon, test_get_turns, Tuple>("line_poly2", boost::make_tuple(3, 1.6190476, 3.4761905), line_line1[1], case_1[0]);
 }
 
 

Modified: sandbox/geometry/libs/geometry/test/algorithms/overlay/overlay.sln
==============================================================================
--- sandbox/geometry/libs/geometry/test/algorithms/overlay/overlay.sln (original)
+++ sandbox/geometry/libs/geometry/test/algorithms/overlay/overlay.sln 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -14,6 +14,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assemble", "assemble.vcproj", "{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dissolve", "dissolve.vcproj", "{206F83D5-17F9-4856-A1DE-82301DB94439}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -48,6 +50,10 @@
                 {306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Debug|Win32.Build.0 = Debug|Win32
                 {306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Release|Win32.ActiveCfg = Release|Win32
                 {306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Release|Win32.Build.0 = Release|Win32
+ {206F83D5-17F9-4856-A1DE-82301DB94439}.Debug|Win32.ActiveCfg = Debug|Win32
+ {206F83D5-17F9-4856-A1DE-82301DB94439}.Debug|Win32.Build.0 = Debug|Win32
+ {206F83D5-17F9-4856-A1DE-82301DB94439}.Release|Win32.ActiveCfg = Release|Win32
+ {206F83D5-17F9-4856-A1DE-82301DB94439}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE

Modified: sandbox/geometry/libs/geometry/test/algorithms/overlay/overlay_cases.hpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/algorithms/overlay/overlay_cases.hpp (original)
+++ sandbox/geometry/libs/geometry/test/algorithms/overlay/overlay_cases.hpp 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -208,6 +208,11 @@
         "POLYGON((2.5 0,2.5 3,5 3,5 2,2 1.5,5 1,5 0,2.5 0))",
         "POLYGON((2 1,2 2,3 2,3 1,2 1))" };
 
+static std::string case_49[2] = {
+ "POLYGON((1 0,1 1,2 2,3 3,4 3,4 0,1 0))",
+ "POLYGON((0 2,2 5,5 2,5 0,2 0,2 2,0 2))" };
+
+
 // 50, collinear opposite
 static std::string case_50[2] = {
         "POLYGON((0 0,0 3,2 3,4 3,4 0,0 0))",
@@ -243,8 +248,14 @@
     };
 
 static std::string case_55[2] = {
- "POLYGON((2 2,3 3,4 3,4 0,1 0,1 1,2 2),(2 1,3 1,3 2,2 2,2 1))",
- "POLYGON((0 2,0 5,5 5,5 0,2 0,2 2,0 2),(1 3,2 2,3 1,4 1,4 4,1 4,1 3))"
+ //"POLYGON((2 2,3 3,4 3,4 0,1 0,1 1,2 2),(2 1,3 1,3 2,2 2,2 1))",
+ //"POLYGON((0 2,0 5,5 5,5 0,2 0,2 2,0 2),(1 3,2 2,3 1,4 1,4 4,1 4,1 3))"
+ // B, not a 4-fold intersection
+ //"POLYGON((2 2,3 3,4 3,4 0,1 0,1 1,2 2),(2 1,3 1,3 2,2.0 1.9,2 1))",
+ //"POLYGON((0 2,0 5,5 5,5 0,2 0,2 2,0 2),(1 3,2.1 2.1,3 1,4 1,4 4,1 4,1 3))"
+ // C, not a 4-fold intersection,
+ "POLYGON((2 2,3 3,4 3,4 0,1 0,1 1,2 2),(2 1,3 1,3 2,2.0 1.9,2 1))",
+ "POLYGON((0 2,0 5,5 5,5 0,2 0,2 2,0 2),(1 3,1.9 1.9,3 1,4 1,4 4,1 4,1 3))"
     };
 
 static std::string case_56[2] = {

Modified: sandbox/geometry/libs/geometry/test/algorithms/overlay/traverse.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/algorithms/overlay/traverse.cpp (original)
+++ sandbox/geometry/libs/geometry/test/algorithms/overlay/traverse.cpp 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -176,71 +176,45 @@
                             );
                     std::string style = "fill:rgb(0,0,0);font-family:Arial;font-size:8px";
 
- {
- std::ostringstream out;
- out << index
- << ": " << bg::operation_char(turn.operations[0].operation)
- << " " << bg::operation_char(turn.operations[1].operation)
- << " (" << bg::method_char(turn.method) << ")"
- << (turn.ignore ? " (ignore) " : " ")
- ;
-
- offsets[p] += lineheight;
- int offset = offsets[p];
- mapper.text(turn.point, out.str(), style, margin, offset);
- }
-
- {
- std::ostringstream out;
- out << "ip: " << turn.operations[0].enriched.travels_to_ip_index
- << "/" << turn.operations[1].enriched.travels_to_ip_index;
- if (turn.operations[0].enriched.next_ip_index != -1
- || turn.operations[1].enriched.next_ip_index != -1)
- {
- out << " [" << turn.operations[0].enriched.next_ip_index
- << "/" << turn.operations[1].enriched.next_ip_index
- << "]"
- ;
- }
-
- offsets[p] += lineheight;
- int offset = offsets[p];
- mapper.text(turn.point, out.str(), style, margin, offset);
- }
-
+ std::ostringstream out;
+ out << index
+ << ": " << bg::operation_char(turn.operations[0].operation)
+ << " " << bg::operation_char(turn.operations[1].operation)
+ << " (" << bg::method_char(turn.method) << ")"
+ << (turn.ignore ? " (ignore) " : " ")
+ << std::endl
+
+ << "ip: " << turn.operations[0].enriched.travels_to_ip_index
+ << "/" << turn.operations[1].enriched.travels_to_ip_index;
 
+ if (turn.operations[0].enriched.next_ip_index != -1
+ || turn.operations[1].enriched.next_ip_index != -1)
                     {
- std::ostringstream out;
- out << "vx:" << turn.operations[0].enriched.travels_to_vertex_index
- << "/" << turn.operations[1].enriched.travels_to_vertex_index;
-
- offsets[p] += lineheight;
- int offset = offsets[p];
- mapper.text(turn.point, out.str(), style, margin, offset);
+ out << " [" << turn.operations[0].enriched.next_ip_index
+ << "/" << turn.operations[1].enriched.next_ip_index
+ << "]"
+ ;
                     }
+ out << std::endl;
 
- {
- std::ostringstream out;
- out << std::setprecision(3)
- << "dist: " << turn.operations[0].enriched.distance
- << " / " << turn.operations[1].enriched.distance;
-
- offsets[p] += lineheight;
- int offset = offsets[p];
- mapper.text(turn.point, out.str(), style, margin, offset);
- }
-
- {
- std::ostringstream out;
- out << std::setprecision(3)
- << "vis: " << bg::visited_char(turn.operations[0].visited)
- << " / " << bg::visited_char(turn.operations[1].visited);
-
- offsets[p] += lineheight;
- int offset = offsets[p];
- mapper.text(turn.point, out.str(), style, margin, offset);
- }
 
+ out
+ << "vx:" << turn.operations[0].enriched.travels_to_vertex_index
+ << "/" << turn.operations[1].enriched.travels_to_vertex_index
+ << std::endl
+
+ << std::setprecision(3)
+ << "dist: " << turn.operations[0].enriched.distance
+ << " / " << turn.operations[1].enriched.distance
+ << std::endl
+
+ << "vis: " << bg::visited_char(turn.operations[0].visited)
+ << " / " << bg::visited_char(turn.operations[1].visited);
+
+ offsets[p] += lineheight;
+ int offset = offsets[p];
+ offsets[p] += lineheight * 5;
+ mapper.text(turn.point, out.str(), style, margin, offset, lineheight);
                 }
                 index++;
             }
@@ -289,8 +263,10 @@
 
     return;
     */
- //test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("57", boost::make_tuple(2, 1.489899), case_57[0], case_57[1]);
- //return;
+ test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("49b", boost::make_tuple(1, 15), case_49[0], case_49[1]);
+ test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("55c", boost::make_tuple(3, 18), case_55[0], case_55[1]);
+ test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("55c", boost::make_tuple(1, 2), case_55[0], case_55[1]);
+ return;
 
 
     // 1-6

Added: sandbox/geometry/libs/geometry/test/algorithms/test_difference.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/algorithms/test_difference.hpp 2010-02-28 16:16:56 EST (Sun, 28 Feb 2010)
@@ -0,0 +1,164 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) test file
+//
+// Copyright Barend Gehrels 2007-2009, 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)
+
+#ifndef BOOST_GEOMETRY_TEST_DIFFERENCE_HPP
+#define BOOST_GEOMETRY_TEST_DIFFERENCE_HPP
+
+#include <fstream>
+#include <iomanip>
+
+#include <boost/foreach.hpp>
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/algorithms/difference.hpp>
+#include <boost/geometry/algorithms/sym_difference.hpp>
+
+#include <boost/geometry/algorithms/area.hpp>
+#include <boost/geometry/algorithms/num_points.hpp>
+#include <boost/geometry/algorithms/unique.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+
+#include <boost/geometry/strategies/strategies.hpp>
+
+#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
+
+
+#if defined(TEST_WITH_SVG)
+# include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
+#endif
+
+
+
+
+template <typename OutputType, typename CalculationType, typename G1, typename G2>
+void test_difference(std::string const& caseid, G1 const& g1, G2 const& g2,
+ std::size_t expected_count, std::size_t expected_point_count,
+ double expected_area,
+ double percentage = 0.0001,
+ bool sym = false)
+{
+ std::vector<OutputType> clip;
+
+ typedef typename boost::geometry::coordinate_type<G1>::type coordinate_type;
+ typedef typename boost::geometry::point_type<G1>::type point_type;
+
+ if (sym)
+ {
+ boost::geometry::sym_difference<OutputType>(g1, g2, clip);
+ }
+ else
+ {
+ boost::geometry::difference<OutputType>(g1, g2, clip);
+ }
+
+ double area = 0;
+ std::size_t n = 0;
+ for (typename std::vector<OutputType>::iterator it = clip.begin();
+ it != clip.end();
+ ++it)
+ {
+ if (expected_point_count > 0)
+ {
+ // Get a correct point-count without duplicate points
+ // (note that overlay might be adapted to avoid duplicates)
+ boost::geometry::unique(*it);
+ n += boost::geometry::num_points(*it);
+ }
+
+ area += boost::geometry::area(*it);
+ }
+
+
+#if ! defined(BOOST_GEOMETRY_NO_BOOST_TEST)
+ if (expected_point_count > 0)
+ {
+ BOOST_CHECK_MESSAGE(n == expected_point_count,
+ "difference: " << caseid
+ << " #points expected: " << expected_point_count
+ << " detected: " << n
+ << " type: " << string_from_type<coordinate_type>::name()
+ );
+ }
+
+ if (expected_count > 0)
+ {
+ BOOST_CHECK_MESSAGE(clip.size() == expected_count,
+ "difference: " << caseid
+ << " #outputs expected: " << expected_count
+ << " detected: " << clip.size()
+ << " type: " << string_from_type<coordinate_type>::name()
+ );
+ }
+
+ BOOST_CHECK_CLOSE(area, expected_area, percentage);
+#endif
+
+
+#if defined(TEST_WITH_SVG)
+ {
+ std::ostringstream filename;
+ filename << "difference_"
+ << caseid << "_"
+ << string_from_type<coordinate_type>::name()
+ << string_from_type<CalculationType>::name()
+ << ".svg";
+
+ std::ofstream svg(filename.str().c_str());
+
+ boost::geometry::svg_mapper<point_type> mapper(svg, 500, 500);
+
+ mapper.add(g1);
+ mapper.add(g2);
+
+ mapper.map(g1, "opacity:0.6;fill:rgb(0,0,255);stroke:rgb(0,0,0);stroke-width:1");
+ mapper.map(g2, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
+
+ for (typename std::vector<OutputType>::const_iterator it = clip.begin();
+ it != clip.end(); ++it)
+ {
+ mapper.map(*it, sym
+ ? "opacity:0.6;fill:rgb(255,255,0);stroke:rgb(255,0,0);stroke-width:5"
+ : "opacity:0.6;fill:none;stroke:rgb(255,0,0);stroke-width:5");
+ }
+ }
+#endif
+}
+
+template <typename OutputType, typename G1, typename G2>
+void test_one(std::string const& caseid,
+ std::string const& wkt1, std::string const& wkt2,
+ std::size_t expected_count1,
+ std::size_t expected_point_count1,
+ double expected_area1,
+ std::size_t expected_count2,
+ std::size_t expected_point_count2,
+ double expected_area2,
+ double percentage = 0.0001)
+{
+ G1 g1;
+ boost::geometry::read_wkt(wkt1, g1);
+
+ G2 g2;
+ boost::geometry::read_wkt(wkt2, g2);
+
+ test_difference<OutputType, void>(caseid + "_a", g1, g2,
+ expected_count1, expected_point_count1,
+ expected_area1, percentage);
+ test_difference<OutputType, void>(caseid + "_b", g2, g1,
+ expected_count2, expected_point_count2,
+ expected_area2, percentage);
+ test_difference<OutputType, void>(caseid + "_s", g1, g2,
+ expected_count1 + expected_count2,
+ expected_point_count1 + expected_point_count2,
+ expected_area1 + expected_area2,
+ percentage, true);
+}
+
+
+
+#endif


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