mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-13 00:22:10 +00:00
Added test for multi/dsv
[SVN r76485]
This commit is contained in:
@@ -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 ;
|
||||
build-project wkt ;
|
||||
build-project dsv ;
|
||||
|
||||
15
test/multi/io/dsv/Jamfile.v2
Normal file
15
test/multi/io/dsv/Jamfile.v2
Normal file
@@ -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 ]
|
||||
;
|
||||
|
||||
100
test/multi/io/dsv/dsv.cpp
Normal file
100
test/multi/io/dsv/dsv.cpp
Normal file
@@ -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;
|
||||
}
|
||||
|
||||
19
test/multi/io/dsv/dsv.sln
Normal file
19
test/multi/io/dsv/dsv.sln
Normal file
@@ -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
|
||||
174
test/multi/io/dsv/dsv.vcproj
Normal file
174
test/multi/io/dsv/dsv.vcproj
Normal file
@@ -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>
|
||||
Reference in New Issue
Block a user