|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r57037 - in sandbox/ggl/formal_review_request/libs/ggl: example test/algorithms test/strategies
From: barend.gehrels_at_[hidden]
Date: 2009-10-21 05:17:44
Author: barendgehrels
Date: 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
New Revision: 57037
URL: http://svn.boost.org/trac/boost/changeset/57037
Log:
Updated examples to reflect changes in simplify/convex hull/point order
Added tests for algorithms/strategies
Added:
sandbox/ggl/formal_review_request/libs/ggl/example/x03_d_soci_example.vcproj (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/
sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/Jamfile (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/area.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/convex_hull.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/correct.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/simplify.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/test_convex_hull.hpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/test_simplify.hpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/within.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/strategies/
sandbox/ggl/formal_review_request/libs/ggl/test/strategies/Jamfile (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/strategies/cross_track.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/strategies/haversine.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/strategies/pythagoras.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/test/strategies/transformer.cpp (contents, props changed)
Text files modified:
sandbox/ggl/formal_review_request/libs/ggl/example/02_linestring_example.cpp | 16 ++++++++--------
sandbox/ggl/formal_review_request/libs/ggl/example/03_polygon_example.cpp | 2 +-
sandbox/ggl/formal_review_request/libs/ggl/example/c04_b_custom_triangle_example.cpp | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)
Modified: sandbox/ggl/formal_review_request/libs/ggl/example/02_linestring_example.cpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/example/02_linestring_example.cpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/example/02_linestring_example.cpp 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -84,7 +84,7 @@
// The distance from a point to a linestring can be calculated
point_2d p(1.9, 1.2);
- std::cout << "distance of " << ggl::dsv(p)
+ std::cout << "distance of " << ggl::dsv(p)
<< " to line: " << distance(p, ls) << std::endl;
// A linestring is a vector. However, some algorithms consider "segments",
@@ -131,7 +131,7 @@
{
linestring_2d ls_copy;
- std::unique_copy(ls.begin(), ls.end(), std::back_inserter(ls_copy),
+ std::unique_copy(ls.begin(), ls.end(), std::back_inserter(ls_copy),
point_equal<point_2d>());
ls = ls_copy;
std::cout << "uniquecopy: " << ggl::dsv(ls) << std::endl;
@@ -139,7 +139,7 @@
// Lines can be simplified. This removes points, but preserves the shape
linestring_2d ls_simplified;
- simplify(ls, std::back_inserter(ls_simplified), 0.5);
+ simplify(ls, ls_simplified, 0.5);
std::cout << "simplified: " << ggl::dsv(ls_simplified) << std::endl;
@@ -168,7 +168,7 @@
intersection<std::vector<point_2d> >(cb, ls, std::back_inserter(vector_out));
std::cout << "clipped output as vector:" << std::endl;
- for (std::vector<std::vector<point_2d> >::const_iterator it
+ for (std::vector<std::vector<point_2d> >::const_iterator it
= vector_out.begin(); it != vector_out.end(); ++it)
{
std::cout << ggl::dsv(*it) << std::endl;
@@ -176,7 +176,7 @@
// Calculate the convex hull of the linestring
polygon_2d hull;
- convex_hull(ls, std::back_inserter(hull.outer()));
+ convex_hull(ls, hull);
std::cout << "Convex hull:" << ggl::dsv(hull) << std::endl;
// All the above assumed 2D Cartesian linestrings. 3D is possible as well
@@ -189,12 +189,12 @@
line3d.push_back(make<point_type>(7,8,9));
// Not all algorithms work on 3d lines. For example convex hull does NOT.
- // But for example length, distance, simplify, envelope and stream do.
+ // But, for example, length, distance, simplify, envelope and stream do.
std::cout << "3D: length: " << length(line3d) << " line: " << ggl::dsv(line3d) << std::endl;
// With DSV you can also use other delimiters, e.g. JSON style
- std::cout << "JSON: "
- << ggl::dsv(ls, ", ", "[", "]", ", ", "[ ", " ]")
+ std::cout << "JSON: "
+ << ggl::dsv(ls, ", ", "[", "]", ", ", "[ ", " ]")
<< std::endl;
return 0;
Modified: sandbox/ggl/formal_review_request/libs/ggl/example/03_polygon_example.cpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/example/03_polygon_example.cpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/example/03_polygon_example.cpp 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -117,7 +117,7 @@
}
polygon_2d hull;
- convex_hull(poly, std::back_inserter(hull.outer()));
+ convex_hull(poly, hull);
std::cout << "Convex hull:" << ggl::dsv(hull) << std::endl;
// If you really want:
Modified: sandbox/ggl/formal_review_request/libs/ggl/example/c04_b_custom_triangle_example.cpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/example/c04_b_custom_triangle_example.cpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/example/c04_b_custom_triangle_example.cpp 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -36,7 +36,7 @@
// Specializations of area dispatch structure, implement algorithm
template<typename P, typename S>
-struct area<ring_tag, triangle<P>, S>
+struct area<ring_tag, triangle<P>, clockwise, S>
{
static inline double apply(triangle<P> const& t, S const&)
{
Added: sandbox/ggl/formal_review_request/libs/ggl/example/x03_d_soci_example.vcproj
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/example/x03_d_soci_example.vcproj 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -0,0 +1,727 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="x03_d_soci_example"
+ ProjectGUID="{5EFD08FE-10CB-4D3E-9917-4E9A2F3AB1C1}"
+ RootNamespace="x03_d_soci_example"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)/x03_d_soci_example"
+ ConfigurationType="1"
+ InheritedPropertySheets=".\boost.vsprops"
+ CharacterSet="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../boost;"contrib\soci-3.0.0\src\backends\postgresql";"contrib\soci-3.0.0\src\core";"c:\Program Files\PostgreSQL\8.3\include";c:\oraclexe\app\oracle\product\10.2.0\server\OCI\include;"c:\Program Files\MySQL\MySQL Server 5.0\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;SOCI_USE_BOOST;BOOST_ALL_NO_LIB;_CRT_SECURE_NO_WARNINGS"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="libpq.lib"
+ AdditionalLibraryDirectories=""c:\Program Files\MySQL\MySQL Server 5.0\lib\opt";c:\oraclexe\app\oracle\product\10.2.0\server\OCI\lib\MSVC;"C:\Program Files\PostgreSQL\8.3\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)\x03_d_soci_example"
+ ConfigurationType="1"
+ InheritedPropertySheets=".\boost.vsprops"
+ CharacterSet="0"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../boost;"contrib\soci-3.0.0\src\backends\postgresql";"contrib\soci-3.0.0\src\core";"c:\Program Files\PostgreSQL\8.3\include";c:\oraclexe\app\oracle\product\10.2.0\server\OCI\include;"c:\Program Files\MySQL\MySQL Server 5.0\include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;SOCI_USE_BOOST;BOOST_ALL_NO_LIB;_CRT_SECURE_NO_WARNINGS"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="libpq.lib"
+ AdditionalLibraryDirectories=""c:\Program Files\MySQL\MySQL Server 5.0\lib\opt";c:\oraclexe\app\oracle\product\10.2.0\server\OCI\lib\MSVC;"C:\Program Files\PostgreSQL\8.3\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>
+ <Filter
+ Name="soci_postgresql"
+ >
+ <File
+ RelativePath="contrib\soci-3.0.0\src\backends\postgresql\blob.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\backends\postgresql\common.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\backends\postgresql\factory.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\backends\postgresql\row-id.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\backends\postgresql\session.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\backends\postgresql\standard-into-type.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\backends\postgresql\standard-use-type.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\backends\postgresql\statement.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\backends\postgresql\vector-into-type.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\backends\postgresql\vector-use-type.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\pgsql\"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="soci_core"
+ >
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\backend-loader.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\blob.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\connection-pool.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\error.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\into-type.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\once-temp-type.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\prepare-temp-type.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\procedure.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\ref-counted-prepare-info.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\ref-counted-statement.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\row.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\rowid.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\session.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\statement.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\transaction.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\use-type.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="contrib\soci-3.0.0\src\core\values.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)\core\"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\x03_d_soci_example.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/Jamfile
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/Jamfile 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -0,0 +1,13 @@
+# Generic Geometry Library unit tests
+#
+# Copyright Bruno Lalande 2008
+# Copyright Barend Gehrels, Geodan Holding B.V. Amsterdam, the Netherlands.
+# Use, modification and distribution is subject to the Boost Software License,
+# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+run area.cpp ;
+run correct.cpp ;
+run convex_hull.cpp ;
+run simplify.cpp ;
+run within.cpp ;
Added: sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/area.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/area.cpp 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -0,0 +1,84 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <ggl_test_common.hpp>
+
+#include <ggl/algorithms/area.hpp>
+
+#include <ggl/extensions/gis/io/wkt/read_wkt.hpp>
+
+#include <ggl/geometries/box.hpp>
+#include <ggl/geometries/nsphere.hpp>
+#include <ggl/geometries/linear_ring.hpp>
+#include <ggl/geometries/polygon.hpp>
+
+
+
+
+template <typename P, typename T>
+void test_area_circle()
+{
+ ggl::nsphere<P, T> c;
+
+ ggl::set<0>(c.center(), 0);
+ ggl::set<1>(c.center(), 0);
+ c.radius(2);
+
+ double d = ggl::area(c);
+ BOOST_CHECK_CLOSE(d, 4 * 3.1415926535897932384626433832795, 0.001);
+}
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt, double expected)
+{
+ Geometry geometry;
+ read_wkt(wkt, geometry);
+ double d = area(geometry);
+ BOOST_CHECK_CLOSE(d, expected, 0.001);
+}
+
+
+
+template <typename P>
+void test_all()
+{
+ test_area_circle<P, double>();
+ test_geometry<ggl::box<P> >("POLYGON((0 0,2 2))", 4.0);
+ test_geometry<ggl::box<P> >("POLYGON((2 2,0 0))", 4.0);
+
+ // clockwise rings (second is wrongly ordered)
+ test_geometry<ggl::linear_ring<P> >("POLYGON((0 0,0 7,4 2,2 0,0 0))", 16.0);
+ test_geometry<ggl::linear_ring<P> >("POLYGON((0 0,2 0,4 2,0 7,0 0))", -16.0);
+
+ // counter clockwise rings (first is wrongly ordered)
+ test_geometry<ggl::linear_ring<P, std::vector, false> >
+ ("POLYGON((0 0,0 7,4 2,2 0,0 0))", -16.0);
+ test_geometry<ggl::linear_ring<P, std::vector, false> >
+ ("POLYGON((0 0,2 0,4 2,0 7,0 0))", 16.0);
+
+ test_geometry<ggl::polygon<P> >("POLYGON((0 0,0 7,4 2,2 0,0 0))", 16.0);
+ test_geometry<ggl::polygon<P> >("POLYGON((1 1,2 1,2 2,1 2,1 1))", -1.0);
+ test_geometry<ggl::polygon<P> >
+ ("POLYGON((0 0,0 7,4 2,2 0,0 0), (1 1,2 1,2 2,1 2,1 1))", 15.0);
+ test_geometry<ggl::polygon<P, std::vector, std::vector, false> >
+ ("POLYGON((0 0,0 7,4 2,2 0,0 0), (1 1,2 1,2 2,1 2,1 1))", -15.0);
+}
+
+
+int test_main(int, char* [])
+{
+ //test_all<int[2]>();
+ //test_all<float[2]>(); not yet because cannot be copied, for polygon
+ //test_all<double[2]>();
+
+ //test_all<point_xy<int> >();
+ //test_all<point_xy<float> >();
+ test_all<ggl::point_xy<double> >();
+
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/convex_hull.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/convex_hull.cpp 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -0,0 +1,64 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <cstddef>
+#include <string>
+
+#include <ggl_test_common.hpp>
+
+#include <ggl/algorithms/convex_hull.hpp>
+
+
+#include <ggl/algorithms/area.hpp>
+#include <ggl/algorithms/num_points.hpp>
+
+#include <ggl/extensions/gis/io/wkt/read_wkt.hpp>
+#include <ggl/extensions/gis/io/wkt/write_wkt.hpp>
+
+#include <ggl/geometries/geometries.hpp>
+
+#include <algorithms/test_convex_hull.hpp>
+
+
+template <typename P>
+void test_all()
+{
+ // from sample linestring
+
+ test_geometry<ggl::linestring<P> >(
+ "linestring(1.1 1.1, 2.5 2.1, 3.1 3.1, 4.9 1.1, 3.1 1.9)", 5, 4, 3.8);
+
+ // rectangular, with concavity
+ test_geometry<ggl::polygon<P> >(
+ "polygon((1 1, 5 1, 5 4, 4 4, 4 3, 3 3, 3 4, 1 4, 1 1))",
+ 9, 5, 12.0);
+
+ // from sample polygon, with concavity
+ test_geometry<ggl::polygon<P> >(
+ "polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0"
+ ", 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))",
+ 12, 8, 5.245);
+}
+
+int test_main(int, char* [])
+{
+ //test_all<ggl::point_xy<int> >();
+ //test_all<ggl::point_xy<float> >();
+ test_all<ggl::point_xy<double> >();
+
+#if defined(HAVE_CLN)
+ test_all<ggl::point_xy<boost::numeric_adaptor::cln_value_type> >();
+#endif
+#if defined(HAVE_GMP)
+ // GMP compiles but gives errors in results
+ // TODO: find out what's going wrong here
+ // test_all<ggl::point_xy<boost::numeric_adaptor::gmp_value_type> >();
+#endif
+
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/correct.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/correct.cpp 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -0,0 +1,158 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <ggl_test_common.hpp>
+
+#include <sstream>
+
+#include <ggl/algorithms/correct.hpp>
+
+#include <ggl/util/write_dsv.hpp>
+
+#include <ggl/extensions/gis/io/wkt/read_wkt.hpp>
+#include <ggl/extensions/gis/io/wkt/write_wkt.hpp>
+
+#include <ggl/geometries/box.hpp>
+#include <ggl/geometries/linear_ring.hpp>
+#include <ggl/geometries/polygon.hpp>
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt, std::string const& expected)
+{
+ Geometry geometry;
+
+ ggl::read_wkt(wkt, geometry);
+ ggl::correct(geometry);
+
+ std::ostringstream out;
+ out << ggl::wkt(geometry);
+
+ BOOST_CHECK_EQUAL(out.str(), expected);
+}
+
+
+// Note: 3D/box test cannot be done using WKT because:
+// -> wkt-box does not exist
+// -> so it is converted to a ring
+// -> ring representation of 3d-box is not supported, nor feasible
+// -> so it uses DSV which can represent a box
+template <typename Geometry>
+void test_geometry_dsv(std::string const& wkt, std::string const& expected)
+{
+ Geometry geometry;
+
+ ggl::read_wkt(wkt, geometry);
+ ggl::correct(geometry);
+
+ std::ostringstream out;
+ out << ggl::dsv(geometry);
+
+ BOOST_CHECK_EQUAL(out.str(), expected);
+}
+
+
+
+
+
+
+template <typename P>
+void test_all()
+{
+ // Define clockwise and counter clockwise polygon
+ std::string cw_ring =
+ "POLYGON((0 0,0 1,1 1,1 0,0 0))";
+ std::string ccw_ring =
+ "POLYGON((0 0,1 0,1 1,0 1,0 0))";
+
+ // already cw_ring
+ test_geometry<ggl::linear_ring<P> >(cw_ring, cw_ring);
+
+ // wrong order
+ test_geometry<ggl::linear_ring<P> >(ccw_ring, cw_ring);
+
+ // not closed
+ test_geometry<ggl::linear_ring<P> >(
+ "POLYGON((0 0,1 0,1 1,0 1))",
+ cw_ring);
+
+ // counter clockwise, cw_ring
+ test_geometry<ggl::linear_ring<P, std::vector, false> >
+ (ccw_ring, ccw_ring);
+
+ test_geometry<ggl::linear_ring<P, std::vector, false> >
+ (cw_ring, ccw_ring);
+
+
+ // polygon: cw_ring
+ test_geometry<ggl::polygon<P> >(cw_ring, cw_ring);
+ // wrong order
+ test_geometry<ggl::polygon<P> >(
+ "POLYGON((0 0,1 0,1 1,0 1,0 0))",
+ cw_ring);
+ // wrong order & not closed
+ test_geometry<ggl::polygon<P> >(
+ "POLYGON((0 0,1 0,1 1,0 1))",
+ cw_ring);
+
+
+ std::string cw_holey_polygon =
+ "POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,2 1,2 2,1 2,1 1))";
+ std::string ccw_holey_polygon =
+ "POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1,1 2,2 2,2 1,1 1))";
+
+ // with holes: cw_ring
+ test_geometry<ggl::polygon<P> >(
+ cw_holey_polygon,
+ cw_holey_polygon);
+ // wrong order of main
+ test_geometry<ggl::polygon<P> >(
+ "POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1))",
+ cw_holey_polygon);
+ // wrong order of hole
+ test_geometry<ggl::polygon<P> >(
+ "POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,1 2,2 2,2 1,1 1))",
+ cw_holey_polygon);
+
+ // wrong order of main and hole
+ test_geometry<ggl::polygon<P> >(ccw_holey_polygon, cw_holey_polygon);
+
+ // test the counter-clockwise
+ test_geometry<ggl::polygon<P, std::vector, std::vector, false> >(
+ ccw_holey_polygon, ccw_holey_polygon);
+
+ // Boxes
+ std::string proper_box = "POLYGON((0 0,0 2,2 2,2 0,0 0))";
+ test_geometry<ggl::box<P> >(proper_box, proper_box);
+ test_geometry<ggl::box<P> >("BOX(0 0,2 2)", proper_box);
+ test_geometry<ggl::box<P> >("BOX(2 2,0 0)", proper_box);
+ test_geometry<ggl::box<P> >("BOX(0 2,2 0)", proper_box);
+
+ // Cubes
+ typedef ggl::box<ggl::point<double, 3, ggl::cs::cartesian> > box3d;
+ std::string proper_3d_dsv_box = "((0, 0, 0), (2, 2, 2))";
+ test_geometry_dsv<box3d>("BOX(0 0 0,2 2 2)", proper_3d_dsv_box);
+ test_geometry_dsv<box3d>("BOX(2 2 2,0 0 0)", proper_3d_dsv_box);
+ test_geometry_dsv<box3d>("BOX(0 2 2,2 0 0)", proper_3d_dsv_box);
+ test_geometry_dsv<box3d>("BOX(2 0 2,0 2 0)", proper_3d_dsv_box);
+ test_geometry_dsv<box3d>("BOX(0 0 2,2 2 0)", proper_3d_dsv_box);
+}
+
+
+int test_main(int, char* [])
+{
+ //test_all<int[2]>();
+ //test_all<float[2]>(); not yet because cannot be copied, for polygon
+ //test_all<double[2]>();
+
+ //test_all<point_xy<int> >();
+ //test_all<point_xy<float> >();
+ test_all<ggl::point_xy<double> >();
+
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/simplify.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/simplify.cpp 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -0,0 +1,90 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <iterator>
+
+#include <ggl_test_common.hpp>
+
+#include <ggl/algorithms/simplify.hpp>
+#include <ggl/algorithms/distance.hpp>
+#include <ggl/geometries/geometries.hpp>
+#include <ggl/extensions/gis/io/wkt/wkt.hpp>
+
+
+#include <test_common/test_point.hpp>
+
+#include <algorithms/test_simplify.hpp>
+
+
+
+template <typename P>
+void test_all()
+{
+ test_geometry<ggl::linestring<P> >(
+ "LINESTRING(0 0,5 5,10 10)",
+ "LINESTRING(0 0,10 10)", 1.0);
+
+ test_geometry<ggl::linestring<P> >(
+ "LINESTRING(0 0, 5 5, 6 5, 10 10)",
+ "LINESTRING(0 0,10 10)", 1.0);
+
+ test_geometry<ggl::linestring<P> >(
+ "LINESTRING(0 0,5 5,7 5,10 10)",
+ "LINESTRING(0 0,5 5,7 5,10 10)", 1.0);
+
+ test_geometry<ggl::polygon<P> >(
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0))",
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,4 0))", 1.0);
+
+ test_geometry<ggl::polygon<P> >(
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0),(7 3,7 6,1 6,1 3,4 3,7 3))",
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,4 0),(7 3,7 6,1 6,1 3,7 3))", 1.0);
+
+/*
+
+Above can be checked in PostGIS by:
+
+select astext(ST_Simplify(geomfromtext('LINESTRING(0 0, 5 5, 10 10)'),1.0)) as simplified
+union all select astext(ST_Simplify(geomfromtext('LINESTRING(0 0, 5 5, 6 5, 10 10)'),1.0))
+union all select astext(ST_Simplify(geomfromtext('LINESTRING(0 0, 5 5, 7 5, 10 10)'),1.0))
+union all select astext(ST_Simplify(geomfromtext('POLYGON((4 0, 8 2, 8 7, 4 9, 0 7, 0 2, 2 1, 4 0))'),1.0))
+union all select astext(ST_Simplify(geomfromtext('POLYGON((4 0, 8 2, 8 7, 4 9, 0 7, 0 2, 2 1, 4 0),(7 3, 7 6, 1 6, 1 3, 4 3, 7 3))'),1.0))
+*/
+
+ // Just check compilation
+ test_geometry<P>(
+ "POINT(0 0)",
+ "POINT(0 0)", 1.0);
+
+
+ test_geometry<ggl::linear_ring<P> >(
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0))",
+ "POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,4 0))", 1.0);
+}
+
+
+template <typename P>
+void test_spherical()
+{
+ test_geometry<ggl::linestring<P> >(
+ "LINESTRING(4.1 52.1,4.2 52.2,4.3 52.3)",
+ "LINESTRING(4.1 52.1,4.3 52.3)", 0.01);
+}
+
+
+int test_main(int, char* [])
+{
+ // Integer compiles, but simplify-process fails (due to distances)
+ //test_all<ggl::point_xy<int> >();
+ //test_all<ggl::point_xy<float> >();
+ test_all<ggl::point_xy<double> >();
+
+ test_spherical<ggl::point<double, 2, ggl::cs::spherical<ggl::degree> > >();
+
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/test_convex_hull.hpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/test_convex_hull.hpp 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -0,0 +1,87 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef GGL_TEST_CONVEX_HULL_HPP
+#define GGL_TEST_CONVEX_HULL_HPP
+
+// Test-functionality, shared between single and multi tests
+
+
+template <typename Geometry, typename Hull>
+void test_convex_hull(Geometry const& geometry, Hull const& hull,
+ std::size_t size_original, std::size_t size_hull,
+ double expected_area, bool reverse)
+{
+
+ std::size_t n = ggl::num_points(hull);
+
+ BOOST_CHECK_MESSAGE(n == size_hull,
+ "convex hull: " << ggl::wkt(geometry)
+ << " -> " << ggl::wkt(hull)
+ << " type "
+ << (typeid(typename ggl::coordinate_type<Hull>::type).name())
+ << " -> Expected: " << size_hull
+ << " detected: " << n);
+
+
+ BOOST_CHECK(ggl::num_points(geometry) == size_original);
+
+ double ah = ggl::area(hull);
+ if (reverse)
+ {
+ ah = -ah;
+ }
+
+//std::cout << "Area: " << ggl::area(geometry) << std::endl;
+//std::cout << ggl::wkt(hull) << std::endl;
+
+ BOOST_CHECK_CLOSE(ah, expected_area, 0.001);
+}
+
+template <typename Geometry, bool Clockwise>
+void test_geometry_order(std::string const& wkt,
+ std::size_t size_original, std::size_t size_hull,
+ double expected_area)
+{
+ Geometry geometry;
+ ggl::read_wkt(wkt, geometry);
+
+ ggl::polygon
+ <
+ typename ggl::point_type<Geometry>::type,
+ std::vector,
+ std::vector,
+ Clockwise
+ > hull;
+
+ // Test version with output iterator
+ convex_hull_inserter(geometry, std::back_inserter(hull.outer()));
+ test_convex_hull(geometry, hull,
+ size_original, size_hull, expected_area, ! Clockwise);
+
+ // Test version with ring as output
+ ggl::clear(hull);
+ convex_hull(geometry, hull.outer());
+ test_convex_hull(geometry, hull, size_original, size_hull, expected_area, false);
+
+ // Test version with polygon as output
+ ggl::clear(hull);
+ convex_hull(geometry, hull);
+ test_convex_hull(geometry, hull, size_original, size_hull, expected_area, false);
+}
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt,
+ std::size_t size_original, std::size_t size_hull,
+ double expected_area)
+{
+ test_geometry_order<Geometry, true>(wkt, size_original, size_hull, expected_area);
+ test_geometry_order<Geometry, false>(wkt, size_original, size_hull, expected_area);
+}
+
+
+#endif
Added: sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/test_simplify.hpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/test_simplify.hpp 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -0,0 +1,90 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef GGL_TEST_SIMPLIFY_HPP
+#define GGL_TEST_SIMPLIFY_HPP
+
+// Test-functionality, shared between single and multi tests
+
+
+
+template <typename Tag, typename Geometry>
+struct test_inserter
+{
+ static void apply(Geometry& , std::string const& , double )
+ {}
+};
+
+template <typename Geometry>
+struct test_inserter<ggl::linestring_tag, Geometry>
+{
+ static void apply(Geometry& geometry, std::string const& expected, double distance)
+ {
+ Geometry simplified;
+ ggl::simplify_inserter(geometry,
+ std::back_inserter(simplified), distance);
+
+ std::ostringstream out;
+ out << ggl::wkt(simplified);
+ BOOST_CHECK_EQUAL(out.str(), expected);
+ }
+};
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt, std::string const& expected, double distance)
+{
+ Geometry geometry, simplified;
+
+ // Generate polygon using only integer coordinates and obvious results
+ // Polygon is a hexagon, having one extra point (2,1) on a line which should be filtered out.
+ ggl::read_wkt(wkt, geometry);
+ ggl::simplify(geometry, simplified, distance);
+
+ {
+ std::ostringstream out;
+ out << ggl::wkt(simplified);
+
+ BOOST_CHECK_MESSAGE(out.str() == expected,
+ "simplify: " << ggl::wkt(geometry)
+ << " expected " << expected
+ << " got " << ggl::wkt(simplified));
+ }
+
+ // Check using user-specified strategy
+ typedef typename ggl::point_type<Geometry>::type point_type;
+ typedef typename ggl::cs_tag<point_type>::type tag;
+ typedef ggl::strategy::distance::xy_point_segment
+ <
+ point_type,
+ ggl::segment<const point_type>
+ > strategy;
+ typedef ggl::strategy::simplify::douglas_peucker
+ <
+ point_type,
+ strategy
+ > simplify_strategy_type;
+
+ BOOST_CONCEPT_ASSERT( (ggl::concept::SimplifyStrategy<simplify_strategy_type>) );
+ ggl::simplify(geometry, simplified, distance, simplify_strategy_type());
+
+ {
+ std::ostringstream out;
+ out << ggl::wkt(simplified);
+ BOOST_CHECK_EQUAL(out.str(), expected);
+ }
+
+ // Check inserter (if applicable)
+ test_inserter
+ <
+ typename ggl::tag<Geometry>::type,
+ Geometry
+ >::apply(geometry, expected, distance);
+}
+
+
+#endif
Added: sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/within.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/algorithms/within.cpp 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -0,0 +1,159 @@
+// Generic Geometry Library
+//
+// Copyright Barend Gehrels, Geodan B.V. Amsterdam, the Netherlands.
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <ggl_test_common.hpp>
+
+#include <ggl/algorithms/within.hpp>
+
+#include <ggl/extensions/gis/io/wkt/read_wkt.hpp>
+
+#include <ggl/algorithms/assign.hpp>
+
+#include <ggl/geometries/box.hpp>
+#include <ggl/geometries/cartesian2d.hpp>
+#include <ggl/geometries/linear_ring.hpp>
+#include <ggl/geometries/linestring.hpp>
+#include <ggl/geometries/point.hpp>
+#include <ggl/geometries/point_xy.hpp>
+#include <ggl/geometries/polygon.hpp>
+
+
+template <typename Point, typename Geometry>
+void test_geometry(std::string const& wkt_point,
+ std::string const& wkt_geometry, bool expected)
+{
+ Geometry geometry;
+ Point point;
+
+ ggl::read_wkt(wkt_geometry, geometry);
+ ggl::read_wkt(wkt_point, point);
+
+ bool detected = ggl::within(point, geometry);
+
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "within: " << wkt_point
+ << " in " << wkt_geometry
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+template <typename Geometry>
+void test_circle(std::string const& wkt_geometry, bool expected)
+{
+ ggl::circle circle;
+ ggl::assign(circle, 1.0, 1.0, 3.0);
+
+ Geometry geometry;
+ ggl::read_wkt(wkt_geometry, geometry);
+
+ bool detected = ggl::within(geometry, circle);
+
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "within: " << wkt_geometry
+ << " in circle (1,1) with radius 3"
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+template <typename Point, bool CW>
+void test_ordered_ring(std::string const& wkt_point,
+ std::string const& wkt_geometry, bool expected)
+{
+ ggl::linear_ring<Point, std::vector, CW> ring;
+ Point point;
+
+ ggl::read_wkt(wkt_geometry, ring);
+ if (! CW)
+ {
+ std::reverse(boost::begin(ring), boost::end(ring));
+ }
+ ggl::read_wkt(wkt_point, point);
+
+ bool detected = ggl::within(point, ring);
+
+ BOOST_CHECK_MESSAGE(detected == expected,
+ "within: " << wkt_point
+ << " in " << wkt_geometry
+ << " -> Expected: " << expected
+ << " detected: " << detected);
+}
+
+template <typename Point>
+void test_ring(std::string const& wkt_point,
+ std::string const& wkt_geometry, bool expected)
+{
+ test_ordered_ring<Point, true>(wkt_point, wkt_geometry, expected);
+ test_ordered_ring<Point, false>(wkt_point, wkt_geometry, expected);
+ test_geometry<Point, ggl::polygon<Point> >(wkt_point, wkt_geometry, expected);
+}
+
+
+template <typename P>
+void test_all()
+{
+ // trivial case
+ test_ring<P>("POINT(1 1)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", true);
+
+ // on border/corner
+ test_ring<P>("POINT(0 0)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", false);
+ test_ring<P>("POINT(0 1)", "POLYGON((0 0,0 2,2 2,2 0,0 0))", false);
+
+ // aligned to segment/vertex
+ test_ring<P>("POINT(1 1)", "POLYGON((0 0,0 3,3 3,3 1,2 1,2 0,0 0))", true);
+ test_ring<P>("POINT(1 1)", "POLYGON((0 0,0 3,4 3,3 1,2 2,2 0,0 0))", true);
+
+ // same polygon, but point outside
+ test_ring<P>("POINT(3 3)", "POLYGON((0 0,0 3,3 3,3 1,2 1,2 0,0 0))", false);
+ test_ring<P>("POINT(3 3)", "POLYGON((0 0,0 3,4 3,3 1,2 2,2 0,0 0))", false);
+
+ // holes
+ test_geometry<P, ggl::polygon<P> >("POINT(2 2)",
+ "POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,3 1,3 3,1 3,1 1))", false);
+
+
+ test_geometry<P, ggl::box<P> >("POINT(1 1)", "BOX(0 0,2 2)", true);
+
+ // Real-life problem (solved now), point is in the middle, 409623 is also a coordinate
+ // on the border, it was wrong first.
+ test_ring<P>("POINT(146383 409623)",
+ "POLYGON((146351 410597,146521 410659,147906 410363,148088 410420"
+ ",148175 410296,148281 409750,148215 409623,148154 409666,148154 409666"
+ ",148130 409625,148035 409626,148035 409626,148008 409544,147963 409510"
+ ",147993 409457,147961 409352,147261 408687,147008 408586,145714 408840"
+ ",145001 409033,144486 409066,144616 409308,145023 410286,145254 410488"
+ ",145618 410612,145618 410612,146015 410565,146190 410545,146351 410597))",
+ true);
+}
+
+
+template <typename P>
+void test_circles()
+{
+ // Circles do not yet run on CLN/GMP
+ test_circle<P>("POINT(2 1)", true);
+ test_circle<P>("POINT(12 1)", false);
+
+ test_circle<ggl::linestring<P> >("LINESTRING(1 1,2 1,2 2)", true);
+ test_circle<ggl::linestring<P> >("LINESTRING(1 1,2 1,2 2,10 10)", false);
+}
+
+
+int test_main( int , char* [] )
+{
+ //test_all<ggl::point_xy<int> >();
+ test_all<ggl::point_xy<double> >();
+ test_circles<ggl::point_xy<double> >();
+
+#if defined(HAVE_CLN)
+ test_all<ggl::point_xy<boost::numeric_adaptor::cln_value_type> >();
+#endif
+#if defined(HAVE_GMP)
+ test_all<ggl::point_xy<boost::numeric_adaptor::gmp_value_type> >();
+#endif
+
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/strategies/Jamfile
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/strategies/Jamfile 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -0,0 +1,12 @@
+# Generic Geometry Library unit tests
+#
+# Copyright Bruno Lalande 2008
+# Copyright Barend Gehrels, Geodan Holding B.V. Amsterdam, the Netherlands.
+# Use, modification and distribution is subject to the Boost Software License,
+# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+run cross_track.cpp ;
+run haversine.cpp ;
+run pythagoras.cpp ;
+run transformer.cpp ;
Added: sandbox/ggl/formal_review_request/libs/ggl/test/strategies/cross_track.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/strategies/cross_track.cpp 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -0,0 +1,72 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <ggl_test_common.hpp>
+
+#include <ggl/algorithms/assign.hpp>
+
+#include <ggl/strategies/spherical/distance_haversine.hpp>
+#include <ggl/strategies/spherical/distance_cross_track.hpp>
+
+#include <ggl/strategies/concepts/distance_concept.hpp>
+
+#include <ggl/geometries/point.hpp>
+#include <ggl/geometries/segment.hpp>
+
+
+template <typename Point>
+void test_distance(double lon1, double lat1,
+ double lon2, double lat2,
+ double lon3, double lat3,
+ double radius, double expected, double tolerance)
+{
+ typedef ggl::strategy::distance::cross_track
+ <
+ Point,
+ ggl::segment<const Point>
+ > strategy_type;
+
+
+ BOOST_CONCEPT_ASSERT
+ (
+ (ggl::concept::PointSegmentDistanceStrategy<strategy_type>)
+ );
+
+
+ strategy_type strategy(radius);
+
+ Point p1, p2, p3;
+ ggl::assign(p1, lon1, lat1);
+ ggl::assign(p2, lon2, lat2);
+ ggl::assign(p3, lon3, lat3);
+ typename strategy_type::return_type d
+ = strategy(p1, ggl::segment<const Point>(p2, p3));
+
+ BOOST_CHECK_CLOSE((double) d, expected, tolerance);
+}
+
+template <typename Point>
+void test_all()
+{
+ double const average_earth_radius = 6372795.0;
+
+ // distance (Paris <-> Amsterdam/Barcelona), ~87 km
+ // should be is equal
+ // to distance (Paris <-> Barcelona/Amsterdam)
+ double const p_to_ab = 86.8 * 1000.0;
+ test_distance<Point>(2, 48, 4, 52, 2, 41, average_earth_radius, p_to_ab, 1.0);
+ test_distance<Point>(2, 48, 2, 41, 4, 52, average_earth_radius, p_to_ab, 1.0);
+}
+
+int test_main(int, char* [])
+{
+ test_all<ggl::point<double, 2, ggl::cs::spherical<ggl::degree> > >();
+
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/strategies/haversine.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/strategies/haversine.cpp 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -0,0 +1,81 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <ggl_test_common.hpp>
+
+#include <boost/concept/requires.hpp>
+#include <boost/concept_check.hpp>
+
+#include <ggl/algorithms/assign.hpp>
+#include <ggl/strategies/spherical/distance_haversine.hpp>
+#include <ggl/strategies/concepts/distance_concept.hpp>
+
+
+#include <ggl/geometries/point.hpp>
+
+
+template <typename Point>
+struct test_distance
+{
+ typedef ggl::strategy::distance::haversine
+ <
+ Point,
+ Point
+ > haversine_type;
+
+
+ BOOST_CONCEPT_ASSERT
+ (
+ (ggl::concept::PointDistanceStrategy<haversine_type>)
+ );
+
+
+ static void test(double lon1, double lat1, double lon2, double lat2,
+ double radius, double expected, double tolerance)
+ {
+ haversine_type strategy(radius);
+
+ Point p1, p2;
+ ggl::assign(p1, lon1, lat1);
+ ggl::assign(p2, lon2, lat2);
+ typename haversine_type::return_type d1 = strategy(p1, p2);
+
+ BOOST_CHECK_CLOSE((double) d1, expected, tolerance);
+ }
+};
+
+template <typename Point>
+void test_all()
+{
+ double const average_earth_radius = 6372795.0;
+
+ // earth to unit-sphere -> divide by earth circumference, then it is from 0-1,
+ // then multiply with 2 PI, so effectively just divide by earth raius
+ double e2u = 1.0 / average_earth_radius;
+
+ // ~ Amsterdam/Paris
+ double const a_p = 467.2704 * 1000.0;
+ test_distance<Point>::test(4, 52, 2, 48, average_earth_radius, a_p, 1.0);
+ test_distance<Point>::test(2, 48, 4, 52, average_earth_radius, a_p, 1.0);
+ test_distance<Point>::test(4, 52, 2, 48, 1.0, a_p * e2u, 0.001);
+
+ // ~ Amsterdam/Barcelona
+ double const a_b = 1232.9065 * 1000.0;
+ test_distance<Point>::test(4, 52, 2, 41, average_earth_radius, a_b, 1.0);
+ test_distance<Point>::test(2, 41, 4, 52, average_earth_radius, a_b, 1.0);
+ test_distance<Point>::test(4, 52, 2, 41, 1.0, a_b * e2u, 0.001);
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<ggl::point<double, 2, ggl::cs::spherical<ggl::degree> > >();
+
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/strategies/pythagoras.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/strategies/pythagoras.cpp 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -0,0 +1,186 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <ggl_test_common.hpp>
+
+#include <ggl/algorithms/assign.hpp>
+#include <ggl/strategies/cartesian/cart_distance.hpp>
+
+
+#include <ggl/geometries/point.hpp>
+#include <ggl/geometries/adapted/c_array_cartesian.hpp>
+#include <ggl/geometries/adapted/tuple_cartesian.hpp>
+#include <test_common/test_point.hpp>
+
+template <typename P1, typename P2>
+void test_null_distance_3d()
+{
+ typename ggl::strategy::distance::pythagoras<P1, P2> pythagoras;
+
+ P1 p1;
+ ggl::assign(p1, 1, 2, 3);
+ P2 p2;
+ ggl::assign(p2, 1, 2, 3);
+ BOOST_CHECK_EQUAL(double(
+ typename ggl::coordinate_type<P1>::type(pythagoras(p1, p2))), 0);
+}
+
+template <typename P1, typename P2>
+void test_axis_3d()
+{
+ ggl::strategy::distance::pythagoras<P1, P2> pythagoras;
+
+ P1 p1;
+ ggl::assign(p1, 0, 0, 0);
+
+ P2 p2;
+ ggl::assign(p2, 1, 0, 0);
+ BOOST_CHECK_EQUAL(double(
+ typename ggl::coordinate_type<P1>::type(pythagoras(p1, p2))), 1);
+ ggl::assign(p2, 0, 1, 0);
+ BOOST_CHECK_EQUAL(double(
+ typename ggl::coordinate_type<P1>::type(pythagoras(p1, p2))), 1);
+ ggl::assign(p2, 0, 0, 1);
+ BOOST_CHECK_EQUAL(double(
+ typename ggl::coordinate_type<P1>::type(pythagoras(p1, p2))), 1);
+}
+
+template <typename P1, typename P2>
+void test_arbitrary_3d()
+{
+ ggl::strategy::distance::pythagoras<P1, P2> pythagoras;
+
+ P1 p1;
+ ggl::assign(p1, 1, 2, 3);
+ P2 p2;
+ ggl::assign(p2, 9, 8, 7);
+ BOOST_CHECK_CLOSE(double(
+ typename ggl::coordinate_type<P1>::type(pythagoras(p1, p2))),
+ sqrt((double)116), 0.001);
+}
+
+template <typename CoordinateType, typename CalculationType, typename AssignType>
+void test_big_2d_with(AssignType const& x1, AssignType const& y1,
+ AssignType const& x2, AssignType const& y2)
+{
+ typedef ggl::point<CoordinateType, 2, ggl::cs::cartesian> point_type;
+ typedef ggl::strategy::distance::pythagoras
+ <
+ point_type,
+ point_type,
+ CalculationType> pythagoras_type;
+
+ pythagoras_type pythagoras;
+
+
+ point_type p1, p2;
+ ggl::assign(p1, x1, y1);
+ ggl::assign(p2, x2, y2);
+ typename pythagoras_type::return_type d1 = pythagoras(p1, p2);
+
+ /*
+ std::cout << typeid(CalculationType).name()
+ << " " << std::fixed << std::setprecision(20) << d1.squared_value()
+ << std::endl << std::endl;
+ */
+
+ CalculationType d2 = d1;
+
+ BOOST_CHECK_CLOSE((double) d2,
+ 1076554.5485833955678294387789057, 0.001);
+}
+
+template <typename CoordinateType, typename CalculationType>
+void test_big_2d()
+{
+ test_big_2d_with<CoordinateType, CalculationType>
+ (123456.78900001, 234567.89100001,
+ 987654.32100001, 876543.21900001);
+}
+
+template <typename CoordinateType, typename CalculationType>
+void test_big_2d_string()
+{
+ test_big_2d_with<CoordinateType, CalculationType>
+ ("123456.78900001", "234567.89100001",
+ "987654.32100001", "876543.21900001");
+}
+
+
+
+template <typename P1, typename P2>
+void test_all_3d()
+{
+return;
+ test_null_distance_3d<P1, P2>();
+ test_axis_3d<P1, P2>();
+ test_arbitrary_3d<P1, P2>();
+}
+
+template <typename P>
+void test_all_3d()
+{
+ using ggl::point;
+ using ggl::cs::cartesian;
+
+ test_all_3d<P, int[3]>();
+ test_all_3d<P, float[3]>();
+ test_all_3d<P, double[3]>();
+ test_all_3d<P, test::test_point>();
+ test_all_3d<P, point<int, 3, cartesian> >();
+ test_all_3d<P, point<float, 3, cartesian> >();
+ test_all_3d<P, point<double, 3, cartesian> >();
+}
+
+int test_main(int, char* [])
+{
+ using ggl::point;
+ using ggl::cs::cartesian;
+
+#if ! defined(_MSC_VER)
+ test_all_3d<int[3]>();
+#endif
+ test_all_3d<float[3]>();
+ test_all_3d<double[3]>();
+ test_all_3d<test::test_point>();
+#if ! defined(_MSC_VER)
+ test_all_3d<point<int, 3, cartesian> >();
+#endif
+ test_all_3d<point<float, 3, cartesian> >();
+ test_all_3d<point<double, 3, cartesian> >();
+
+ test_big_2d<float, float>();
+ test_big_2d<double, double>();
+ test_big_2d<long double, long double>();
+ test_big_2d<float, long double>();
+
+
+#if defined(HAVE_CLN)
+ // combination of CLN with normal types
+ typedef boost::numeric_adaptor::cln_value_type cln_type;
+ typedef point<cln_type, 3, cartesian> cln_point;
+ test_all_3d<cln_point>();
+ test_all_3d<cln_point, cln_point>();
+
+ test_big_2d<cln_type, cln_type>();
+ test_big_2d_string<cln_type, cln_type>();
+
+#endif
+#if defined(HAVE_GMP)
+ typedef boost::numeric_adaptor::gmp_value_type gmp_type;
+ typedef point<gmp_type, 3, cartesian> gmp_point;
+ test_all_3d<gmp_point>();
+ test_all_3d<gmp_point, gmp_point>();
+
+ test_big_2d<gmp_type, gmp_type>();
+ test_big_2d_string<gmp_type, gmp_type>();
+#endif
+
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/test/strategies/transformer.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/test/strategies/transformer.cpp 2009-10-21 05:17:42 EDT (Wed, 21 Oct 2009)
@@ -0,0 +1,106 @@
+// Generic Geometry Library test file
+//
+// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <ggl_test_common.hpp>
+
+#include <ggl/strategies/transform/inverse_transformer.hpp>
+#include <ggl/strategies/transform/map_transformer.hpp>
+#include <ggl/strategies/transform/matrix_transformers.hpp>
+
+
+#include <ggl/algorithms/make.hpp>
+#include <ggl/algorithms/transform.hpp>
+
+#include <ggl/geometries/point.hpp>
+#include <ggl/geometries/adapted/c_array_cartesian.hpp>
+#include <ggl/geometries/adapted/tuple_cartesian.hpp>
+
+
+
+
+template <typename P, typename T>
+void check_inverse(P const& p, T const& trans)
+{
+ ggl::strategy::transform::inverse_transformer<P, P> inverse(trans);
+
+ P i;
+ ggl::transform(p, i, inverse);
+
+ BOOST_CHECK_CLOSE(double(ggl::get<0>(i)), 1.0, 0.001);
+ BOOST_CHECK_CLOSE(double(ggl::get<1>(i)), 1.0, 0.001);
+}
+
+template <typename P>
+void test_all()
+{
+ P p;
+ ggl::assign(p, 1, 1);
+
+ {
+ ggl::strategy::transform::translate_transformer<P, P> trans(1, 1);
+ P tp;
+ ggl::transform(p, tp, trans);
+
+ BOOST_CHECK_CLOSE(double(ggl::get<0>(tp)), 2.0, 0.001);
+ BOOST_CHECK_CLOSE(double(ggl::get<1>(tp)), 2.0, 0.001);
+
+ check_inverse(tp, trans);
+ }
+
+ {
+ ggl::strategy::transform::scale_transformer<P, P> trans(10, 10);
+ P tp;
+ ggl::transform(p, tp, trans);
+
+ BOOST_CHECK_CLOSE(double(ggl::get<0>(tp)), 10.0, 0.001);
+ BOOST_CHECK_CLOSE(double(ggl::get<1>(tp)), 10.0, 0.001);
+
+ check_inverse(tp, trans);
+ }
+
+ {
+ ggl::strategy::transform::rotate_transformer<P, P, ggl::degree> trans(90.0);
+ P tp;
+ ggl::transform(p, tp, trans);
+
+ BOOST_CHECK_CLOSE(double(ggl::get<0>(tp)), 1.0, 0.001);
+ BOOST_CHECK_CLOSE(double(ggl::get<1>(tp)), -1.0, 0.001);
+ check_inverse(tp, trans);
+ }
+
+ {
+ // Map from 0,0,2,2 to 0,0,500,500
+ ggl::strategy::transform::map_transformer<P, P, false> trans
+ (
+ 0.0, 0.0, 2.0, 2.0, 500, 500
+ );
+ P tp;
+ ggl::transform(p, tp, trans);
+
+ BOOST_CHECK_CLOSE(double(ggl::get<0>(tp)), 250.0, 0.001);
+ BOOST_CHECK_CLOSE(double(ggl::get<1>(tp)), 250.0, 0.001);
+
+ check_inverse(tp, trans);
+ }
+}
+
+int test_main(int, char* [])
+{
+ //test_all<int[2]>();
+ test_all<float[2]>();
+ test_all<double[2]>();
+
+ test_all<boost::tuple<float, float> >();
+
+ //test_all<point<int, 2, cs::cartesian> >();
+ test_all<ggl::point<float, 2, ggl::cs::cartesian> >();
+ test_all<ggl::point<double, 2, ggl::cs::cartesian> >();
+
+ return 0;
+}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk