Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67044 - sandbox/geometry/libs/geometry/test/geometries
From: barend.gehrels_at_[hidden]
Date: 2010-12-05 16:50:17


Author: barendgehrels
Date: 2010-12-05 16:50:16 EST (Sun, 05 Dec 2010)
New Revision: 67044
URL: http://svn.boost.org/trac/boost/changeset/67044

Log:
Shows Boost.Polygon point in example
Added:
   sandbox/geometry/libs/geometry/test/geometries/boost_polygon.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/test/geometries/boost_polygon.vcproj (contents, props changed)
Text files modified:
   sandbox/geometry/libs/geometry/test/geometries/geometries_tests.sln | 6 ++++++
   1 files changed, 6 insertions(+), 0 deletions(-)

Added: sandbox/geometry/libs/geometry/test/geometries/boost_polygon.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/geometries/boost_polygon.cpp 2010-12-05 16:50:16 EST (Sun, 05 Dec 2010)
@@ -0,0 +1,110 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) test file
+//
+// Copyright Alfredo Correa 2010
+// 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 <geometry_test_common.hpp>
+
+
+#include<boost/geometry/geometry.hpp>
+#include<boost/geometry/geometries/adapted/boost_polygon_point.hpp>
+#include<boost/geometry/geometries/adapted/boost_polygon_box.hpp>
+#include<boost/geometry/geometries/adapted/boost_polygon_ring.hpp>
+// not finished: #include<boost/geometry/geometries/adapted/boost_polygon_polygon.hpp>
+#include<boost/geometry/extensions/gis/io/wkt/wkt.hpp>
+#include<iostream>
+
+
+int test_main(int, char* [])
+{
+ // 1a: Check if Boost.Polygon's point fulfills Boost.Geometry's point concept
+ bg::concept::check<boost::polygon::point_data<double> >();
+
+ // 1b: use a Boost.Polygon point in Boost.Geometry, calc. distance with two point types
+ boost::polygon::point_data<double> p1(1, 2);
+
+ typedef bg::model::point<double, 2, bg::cs::cartesian> bg_point;
+ bg_point p2(3, 4);
+ BOOST_CHECK_CLOSE(bg::distance(p1, p2), 2 * std::sqrt(2.0), 0.001);
+
+ // 2a: Check if Boost.Polygon's box fulfills Boost.Geometry's box concept
+ bg::concept::check<boost::polygon::rectangle_data<double> >();
+
+ // 2b: use a Boost.Polygon rectangle in Boost.Geometry, compare with boxes
+ boost::polygon::rectangle_data<double> b1;
+ bg::model::box<bg_point> b2;
+
+ bg::assign(b1, 0, 1, 5, 6);
+ bg::assign(b2, 0, 1, 5, 6);
+ double a1 = bg::area(b1);
+ double a2 = bg::area(b2);
+ BOOST_CHECK_CLOSE(a1, a2, 0.001);
+
+ // 3a: Check if Boost.Polygon's polygon fulfills Boost.Geometry's ring concept
+ bg::concept::check<boost::polygon::polygon_data<double> >();
+
+ // 3b: use a Boost.Polygon polygon (ring) in Boost.Geometry
+ // Filling it is a two-step process using Boost.Polygon
+ std::vector<boost::polygon::point_data<double> > point_vector;
+ point_vector.push_back(boost::polygon::point_data<double>(0, 0));
+ point_vector.push_back(boost::polygon::point_data<double>(0, 3));
+ point_vector.push_back(boost::polygon::point_data<double>(4, 0));
+ point_vector.push_back(boost::polygon::point_data<double>(0, 0));
+
+ boost::polygon::polygon_data<double> r1;
+ r1.set(point_vector.begin(), point_vector.end());
+
+ bg::model::linear_ring<bg_point> r2;
+ r2.push_back(bg_point(0, 0));
+ r2.push_back(bg_point(0, 3));
+ r2.push_back(bg_point(4, 0));
+ r2.push_back(bg_point(0, 0));
+ a1 = bg::area(r1);
+ a2 = bg::area(r2);
+ BOOST_CHECK_CLOSE(a1, a2, 0.001);
+
+
+ // 4a: Boost.Polygon's polygon with holes
+ point_vector.clear();
+ point_vector.push_back(boost::polygon::point_data<double>(0, 0));
+ point_vector.push_back(boost::polygon::point_data<double>(0, 10));
+ point_vector.push_back(boost::polygon::point_data<double>(10, 10));
+ point_vector.push_back(boost::polygon::point_data<double>(10, 0));
+ point_vector.push_back(boost::polygon::point_data<double>(0, 0));
+
+ boost::polygon::polygon_with_holes_data<double> poly1;
+ poly1.set(point_vector.begin(), point_vector.end());
+
+ // Fill the holes (we take two)
+ std::vector<boost::polygon::polygon_data<double> > holes;
+ holes.resize(2);
+
+ point_vector.clear();
+ point_vector.push_back(boost::polygon::point_data<double>(1, 1));
+ point_vector.push_back(boost::polygon::point_data<double>(2, 1));
+ point_vector.push_back(boost::polygon::point_data<double>(2, 2));
+ point_vector.push_back(boost::polygon::point_data<double>(1, 2));
+ point_vector.push_back(boost::polygon::point_data<double>(1, 1));
+ holes[0].set(point_vector.begin(), point_vector.end());
+
+ point_vector.clear();
+ point_vector.push_back(boost::polygon::point_data<double>(3, 3));
+ point_vector.push_back(boost::polygon::point_data<double>(4, 3));
+ point_vector.push_back(boost::polygon::point_data<double>(4, 4));
+ point_vector.push_back(boost::polygon::point_data<double>(3, 4));
+ point_vector.push_back(boost::polygon::point_data<double>(3, 3));
+ holes[1].set(point_vector.begin(), point_vector.end());
+
+ poly1.set_holes(holes.begin(), holes.end());
+
+ a1 = boost::polygon::area(poly1);
+ std::cout << boost::polygon::size(poly1) << std::endl;
+
+ // not finished: a1 = bg::area(poly1);
+
+ return 0;
+}
+

Added: sandbox/geometry/libs/geometry/test/geometries/boost_polygon.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/geometries/boost_polygon.vcproj 2010-12-05 16:50:16 EST (Sun, 05 Dec 2010)
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="boost_polygon"
+ ProjectGUID="{6809180F-1E31-42B0-8481-67AC8E9B180B}"
+ RootNamespace="boost_polygon"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\boost_polygon"
+ 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)\boost_polygon"
+ 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=".\boost_polygon.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Modified: sandbox/geometry/libs/geometry/test/geometries/geometries_tests.sln
==============================================================================
--- sandbox/geometry/libs/geometry/test/geometries/geometries_tests.sln (original)
+++ sandbox/geometry/libs/geometry/test/geometries/geometries_tests.sln 2010-12-05 16:50:16 EST (Sun, 05 Dec 2010)
@@ -8,6 +8,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_array_as_point", "boost_array_as_point.vcproj", "{77F84000-D088-46AD-A023-08552101B1C5}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_polygon", "boost_polygon.vcproj", "{6809180F-1E31-42B0-8481-67AC8E9B180B}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -30,6 +32,10 @@
                 {77F84000-D088-46AD-A023-08552101B1C5}.Debug|Win32.Build.0 = Debug|Win32
                 {77F84000-D088-46AD-A023-08552101B1C5}.Release|Win32.ActiveCfg = Release|Win32
                 {77F84000-D088-46AD-A023-08552101B1C5}.Release|Win32.Build.0 = Release|Win32
+ {6809180F-1E31-42B0-8481-67AC8E9B180B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {6809180F-1E31-42B0-8481-67AC8E9B180B}.Debug|Win32.Build.0 = Debug|Win32
+ {6809180F-1E31-42B0-8481-67AC8E9B180B}.Release|Win32.ActiveCfg = Release|Win32
+ {6809180F-1E31-42B0-8481-67AC8E9B180B}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE


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