Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76485 - in trunk/libs/geometry/test/multi/io: . dsv
From: barend.gehrels_at_[hidden]
Date: 2012-01-14 07:09:52


Author: barendgehrels
Date: 2012-01-14 07:09:51 EST (Sat, 14 Jan 2012)
New Revision: 76485
URL: http://svn.boost.org/trac/boost/changeset/76485

Log:
Added test for multi/dsv
Added:
   trunk/libs/geometry/test/multi/io/dsv/
   trunk/libs/geometry/test/multi/io/dsv/Jamfile.v2 (contents, props changed)
   trunk/libs/geometry/test/multi/io/dsv/dsv.cpp (contents, props changed)
   trunk/libs/geometry/test/multi/io/dsv/dsv.sln (contents, props changed)
   trunk/libs/geometry/test/multi/io/dsv/dsv.vcproj (contents, props changed)
Text files modified:
   trunk/libs/geometry/test/multi/io/Jamfile.v2 | 3 ++-
   1 files changed, 2 insertions(+), 1 deletions(-)

Modified: trunk/libs/geometry/test/multi/io/Jamfile.v2
==============================================================================
--- trunk/libs/geometry/test/multi/io/Jamfile.v2 (original)
+++ trunk/libs/geometry/test/multi/io/Jamfile.v2 2012-01-14 07:09:51 EST (Sat, 14 Jan 2012)
@@ -8,4 +8,5 @@
 # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 # http://www.boost.org/LICENSE_1_0.txt)
 
-build-project wkt ;
\ No newline at end of file
+build-project wkt ;
+build-project dsv ;

Added: trunk/libs/geometry/test/multi/io/dsv/Jamfile.v2
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/multi/io/dsv/Jamfile.v2 2012-01-14 07:09:51 EST (Sat, 14 Jan 2012)
@@ -0,0 +1,15 @@
+# Boost.Geometry (aka GGL, Generic Geometry Library)
+#
+# Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+# Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+# Copyright (c) 2009-2012 Mateusz Loskot, 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)
+
+test-suite boost-geometry-multi-io-dsv
+ :
+ [ run dsv.cpp ]
+ ;
+

Added: trunk/libs/geometry/test/multi/io/dsv/dsv.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/multi/io/dsv/dsv.cpp 2012-01-14 07:09:51 EST (Sat, 14 Jan 2012)
@@ -0,0 +1,100 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Unit Test
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, 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)
+
+
+#include <sstream>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/multi/io/dsv/write.hpp>
+#include <boost/geometry/multi/geometries/multi_geometries.hpp>
+#include <boost/geometry/multi/io/wkt/read.hpp>
+
+template <typename Geometry>
+void test_dsv(std::string const& wkt, std::string const& expected, bool json = false)
+{
+ Geometry geometry;
+ bg::read_wkt(wkt, geometry);
+ std::ostringstream out;
+ if (json)
+ {
+ out << bg::dsv(geometry, ", ", "[", "]", ", ", "[ ", " ]", ", ");
+ }
+ else
+ {
+ out << bg::dsv(geometry);
+ }
+ BOOST_CHECK_EQUAL(out.str(), expected);
+}
+
+
+template <typename T>
+void test_all()
+{
+ using namespace boost::geometry;
+ typedef model::point<T, 2, cs::cartesian> point_type;
+ typedef model::multi_point<point_type> mpoint;
+ typedef model::multi_linestring<model::linestring<point_type> > mline;
+ typedef model::multi_polygon<model::polygon<point_type> > mpoly;
+
+ test_dsv<mpoint>
+ (
+ "multipoint((1 2),(3 4))",
+ "((1, 2), (3, 4))"
+ );
+ test_dsv<mline>
+ (
+ "multilinestring((1 1,2 2,3 3),(4 4,5 5,6 6))",
+ "(((1, 1), (2, 2), (3, 3)), ((4, 4), (5, 5), (6, 6)))"
+ );
+ test_dsv<mpoly>
+ (
+ // Multi with 2 poly's, first has hole, second is triangle
+ "multipolygon(((0 0,0 4,4 4,4 0,0 0),(1 1,1 2,2 2,2 1,1 1)),((5 5,6 5,5 6,5 5)))",
+ "((((0, 0), (0, 4), (4, 4), (4, 0), (0, 0)), ((1, 1), (1, 2), (2, 2), (2, 1), (1, 1))), (((5, 5), (6, 5), (5, 6), (5, 5))))"
+ );
+
+ // http://geojson.org/geojson-spec.html#id5
+ test_dsv<mpoint>
+ (
+ "multipoint((1 2),(3 4))",
+ "[ [1, 2], [3, 4] ]",
+ true
+ );
+
+ // http://geojson.org/geojson-spec.html#id6
+ test_dsv<mline>
+ (
+ "multilinestring((1 1,2 2,3 3),(4 4,5 5,6 6))",
+ "[ [ [1, 1], [2, 2], [3, 3] ], [ [4, 4], [5, 5], [6, 6] ] ]",
+ true
+ );
+
+ // http://geojson.org/geojson-spec.html#id7
+ test_dsv<mpoly>
+ (
+ "multipolygon(((0 0,0 4,4 4,4 0,0 0),(1 1,1 2,2 2,2 1,1 1)),((5 5,6 5,5 6,5 5)))",
+ "[ [ [ [0, 0], [0, 4], [4, 4], [4, 0], [0, 0] ], [ [1, 1], [1, 2], [2, 2], [2, 1], [1, 1] ] ], [ [ [5, 5], [6, 5], [5, 6], [5, 5] ] ] ]",
+ true
+ );
+
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<double>();
+ test_all<int>();
+
+ return 0;
+}
+

Added: trunk/libs/geometry/test/multi/io/dsv/dsv.sln
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/multi/io/dsv/dsv.sln 2012-01-14 07:09:51 EST (Sat, 14 Jan 2012)
@@ -0,0 +1,19 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{6CD4A68C-3EA1-11E1-B9E4-BF144924019B}") = "dsv", "dsv.vcproj", "{7463ED40-3EA1-11E1-9FC7-D0144924019B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {7463ED40-3EA1-11E1-9FC7-D0144924019B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7463ED40-3EA1-11E1-9FC7-D0144924019B}.Debug|Win32.Build.0 = Debug|Win32
+ {7463ED40-3EA1-11E1-9FC7-D0144924019B}.Release|Win32.ActiveCfg = Release|Win32
+ {7463ED40-3EA1-11E1-9FC7-D0144924019B}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal

Added: trunk/libs/geometry/test/multi/io/dsv/dsv.vcproj
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/test/multi/io/dsv/dsv.vcproj 2012-01-14 07:09:51 EST (Sat, 14 Jan 2012)
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="dsv"
+ ProjectGUID="{7463ED40-3EA1-11E1-9FC7-D0144924019B}"
+ RootNamespace="dsv"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\dsv"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../../../..;../../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\dsv"
+ ConfigurationType="1"
+ InheritedPropertySheets="..\..\..\boost.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../../../..;../../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ ExceptionHandling="2"
+ UsePrecompiledHeader="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\dsv.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>


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