Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61760 - in sandbox/geometry: boost/geometry/iterators boost/geometry/util libs/geometry/test/iterators libs/geometry/test/util
From: barend.gehrels_at_[hidden]
Date: 2010-05-04 11:49:19


Author: barendgehrels
Date: 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
New Revision: 61760
URL: http://svn.boost.org/trac/boost/changeset/61760

Log:
Added optional flag to base iterator
Added closing iterator
Added closeable_view

Added:
   sandbox/geometry/boost/geometry/iterators/closing_iterator.hpp (contents, props changed)
   sandbox/geometry/boost/geometry/util/closeable_view.hpp (contents, props changed)
   sandbox/geometry/libs/geometry/test/iterators/closing_iterator.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/test/iterators/closing_iterator.vcproj (contents, props changed)
   sandbox/geometry/libs/geometry/test/util/closeable_view.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/test/util/closeable_view.vcproj (contents, props changed)
   sandbox/geometry/libs/geometry/test/util/reversible_closeable.cpp (contents, props changed)
   sandbox/geometry/libs/geometry/test/util/reversible_closeable.vcproj (contents, props changed)
Text files modified:
   sandbox/geometry/boost/geometry/iterators/base.hpp | 15 ++++++++++-----
   sandbox/geometry/libs/geometry/test/iterators/Jamfile.v2 | 1 +
   sandbox/geometry/libs/geometry/test/iterators/iterators.sln | 6 ++++++
   sandbox/geometry/libs/geometry/test/util/Jamfile.v2 | 3 +++
   sandbox/geometry/libs/geometry/test/util/as_range.vcproj | 1 +
   sandbox/geometry/libs/geometry/test/util/copy.vcproj | 1 +
   sandbox/geometry/libs/geometry/test/util/for_each_coordinate.vcproj | 1 +
   sandbox/geometry/libs/geometry/test/util/reversible_view.vcproj | 1 +
   sandbox/geometry/libs/geometry/test/util/select_most_precise.vcproj | 1 +
   sandbox/geometry/libs/geometry/test/util/util_tests.sln | 12 ++++++++++++
   sandbox/geometry/libs/geometry/test/util/write_dsv.vcproj | 1 +
   11 files changed, 38 insertions(+), 5 deletions(-)

Modified: sandbox/geometry/boost/geometry/iterators/base.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/iterators/base.hpp (original)
+++ sandbox/geometry/boost/geometry/iterators/base.hpp 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -18,11 +18,16 @@
 namespace boost { namespace geometry { namespace detail { namespace iterators
 {
 
-template <typename T, typename Iterator>
-struct iterator_base :
- public boost::iterator_adaptor
+template
+<
+ typename DerivedClass,
+ typename Iterator,
+ typename TraversalFlag = boost::bidirectional_traversal_tag
+>
+struct iterator_base
+ : public boost::iterator_adaptor
     <
- T,
+ DerivedClass,
         Iterator,
         boost::use_default,
         typename boost::mpl::if_
@@ -32,7 +37,7 @@
                 typename boost::iterator_traversal<Iterator>::type,
                 boost::random_access_traversal_tag
>,
- boost::bidirectional_traversal_tag,
+ TraversalFlag,
             boost::use_default
>::type
>

Added: sandbox/geometry/boost/geometry/iterators/closing_iterator.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/iterators/closing_iterator.hpp 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -0,0 +1,98 @@
+// 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)
+
+#ifndef BOOST_GEOMETRY_ITERATORS_CLOSING_ITERATOR_HPP
+#define BOOST_GEOMETRY_ITERATORS_CLOSING_ITERATOR_HPP
+
+#include <boost/range.hpp>
+#include <boost/iterator.hpp>
+#include <boost/iterator/iterator_adaptor.hpp>
+#include <boost/iterator/iterator_categories.hpp>
+
+#include <boost/geometry/iterators/base.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+/*!
+ \brief Iterator which iterates through a range, but adds first element at end of the range
+ \tparam Range range on which this class is based on
+ \ingroup iterators
+ \note Use with "closing_iterator<Range> or "closing_iterator<Range const>
+ to get non-const / const behaviour
+ \note This class is normally used from "closeable_view" if Close==true
+*/
+template <typename Range>
+struct closing_iterator
+ : public detail::iterators::iterator_base
+ <
+ closing_iterator<Range>,
+ typename boost::range_iterator<Range>::type,
+ boost::forward_traversal_tag
+ >
+{
+ friend class boost::iterator_core_access;
+
+ explicit inline closing_iterator(Range& range)
+ : m_range(range)
+ , m_beyond(false)
+ , m_end(boost::end(m_range))
+ {
+ this->base_reference() = boost::begin(m_range);
+ }
+
+ // Constructor to indicate the end of a range
+ explicit inline closing_iterator(Range& range, bool)
+ : m_range(range)
+ , m_beyond(true)
+ , m_end(boost::end(m_range))
+ {
+ this->base_reference() = m_end;
+ }
+
+ //inline bool equal(closing_iterator const& other) const
+ inline bool operator==(closing_iterator const& other) const
+ {
+ return this->base() == other->base()
+ && this->m_beyond == other->m_beyond;
+ }
+
+
+private:
+
+ inline void increment()
+ {
+ if (m_beyond)
+ {
+ this->base_reference() = m_end;
+ }
+ else if (this->base() != m_end)
+ {
+ (this->base_reference())++;
+
+ if (this->base() == m_end)
+ {
+ // Now beyond last position -> set to "begin" again
+ // and set flag "beyond" such that next increment
+ // will finish traversal
+ this->base_reference() = boost::begin(m_range);
+ m_beyond = true;
+ }
+ }
+ }
+
+ Range& m_range;
+ bool m_beyond;
+ typename boost::range_iterator<Range>::type m_end;
+};
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_ITERATORS_CLOSING_ITERATOR_HPP

Added: sandbox/geometry/boost/geometry/util/closeable_view.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/util/closeable_view.hpp 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -0,0 +1,74 @@
+// 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)
+
+#ifndef BOOST_GEOMETRY_UTIL_CLOSEABLE_VIEW_HPP
+#define BOOST_GEOMETRY_UTIL_CLOSEABLE_VIEW_HPP
+
+
+#include <boost/range.hpp>
+
+#include <boost/geometry/core/ring_type.hpp>
+#include <boost/geometry/core/tag.hpp>
+#include <boost/geometry/core/tags.hpp>
+#include <boost/geometry/iterators/closing_iterator.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+
+template <typename Range, bool Close>
+struct closeable_view {};
+
+
+
+template <typename Range>
+struct closeable_view<Range, false>
+{
+ closeable_view(Range& r)
+ : m_range(r)
+ {}
+
+ typedef typename boost::range_iterator<Range const>::type const_iterator;
+ typedef typename boost::range_iterator<Range>::type iterator;
+
+ const_iterator begin() const { return boost::begin(m_range); }
+ const_iterator end() const { return boost::end(m_range); }
+
+ iterator begin() { return boost::begin(m_range); }
+ iterator end() { return boost::end(m_range); }
+private :
+ Range& m_range;
+};
+
+
+template <typename Range>
+struct closeable_view<Range, true>
+{
+ closeable_view(Range& r)
+ : m_range(r)
+ {}
+
+
+ typedef closing_iterator<Range> iterator;
+ typedef closing_iterator<Range const> const_iterator;
+
+ const_iterator begin() const { return const_iterator(m_range); }
+ const_iterator end() const { return const_iterator(m_range, true); }
+
+ iterator begin() { return iterator(m_range); }
+ iterator end() { return iterator(m_range, true); }
+private :
+ Range& m_range;
+};
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_UTIL_CLOSEABLE_VIEW_HPP

Modified: sandbox/geometry/libs/geometry/test/iterators/Jamfile.v2
==============================================================================
--- sandbox/geometry/libs/geometry/test/iterators/Jamfile.v2 (original)
+++ sandbox/geometry/libs/geometry/test/iterators/Jamfile.v2 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -9,6 +9,7 @@
 test-suite ggl-iterators
     :
     [ run circular_iterator.cpp ]
+ [ run closing_iterator.cpp ]
     [ run ever_circling_iterator.cpp ]
     [ run segment_iterator.cpp ]
     ;

Added: sandbox/geometry/libs/geometry/test/iterators/closing_iterator.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/iterators/closing_iterator.cpp 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -0,0 +1,90 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) test file
+//
+// 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 <algorithm>
+#include <iterator>
+#include <sstream>
+#include <string>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/iterators/closing_iterator.hpp>
+
+#include <boost/geometry/core/coordinate_type.hpp>
+#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
+#include <boost/geometry/geometries/cartesian2d.hpp>
+
+
+
+
+
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt)
+{
+ Geometry geometry;
+ boost::geometry::read_wkt(wkt, geometry);
+ typedef boost::geometry::closing_iterator<Geometry const> closing_iterator;
+
+
+ // 1. Test normal behaviour
+ {
+ closing_iterator it(geometry);
+ closing_iterator end(geometry, true);
+
+ std::ostringstream out;
+ for (; it != end; ++it)
+ {
+ out << " " << boost::geometry::get<0>(*it) << boost::geometry::get<1>(*it);
+ }
+ BOOST_CHECK_EQUAL(out.str(), " 11 14 44 41 11");
+
+ // All the following does NOT compile, and should NOT,
+ // 1) Because it is forward only:
+ //it--;
+ //--it;
+ // 2) Because it is not random access:
+ //it += 2;
+ //it = boost::begin(geometry);
+ }
+
+
+ // 2: check copy behaviour
+ {
+ typedef typename boost::range_iterator<Geometry const>::type normal_iterator;
+ Geometry copy;
+
+ std::copy<closing_iterator>(
+ closing_iterator(geometry),
+ closing_iterator(geometry, true),
+ std::back_inserter(copy));
+
+ std::ostringstream out;
+ for (normal_iterator cit = boost::begin(copy); cit != boost::end(copy); ++cit)
+ {
+ out << " " << boost::geometry::get<0>(*cit) << boost::geometry::get<1>(*cit);
+ }
+ BOOST_CHECK_EQUAL(out.str(), " 11 14 44 41 11");
+ }
+}
+
+
+template <typename P>
+void test_all()
+{
+ test_geometry<boost::geometry::linear_ring<P> >("POLYGON((1 1,1 4,4 4,4 1))");
+}
+
+
+int test_main(int, char* [])
+{
+ test_all<boost::geometry::point_2d>();
+
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/test/iterators/closing_iterator.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/iterators/closing_iterator.vcproj 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="closing_iterator"
+ ProjectGUID="{04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}"
+ RootNamespace="closing_iterator"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\closing_iterator"
+ 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"
+ WarningLevel="3"
+ 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"
+ EmbedManifest="false"
+ />
+ <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)\closing_iterator"
+ 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"
+ WarningLevel="3"
+ />
+ <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"
+ EmbedManifest="false"
+ />
+ <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=".\closing_iterator.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Modified: sandbox/geometry/libs/geometry/test/iterators/iterators.sln
==============================================================================
--- sandbox/geometry/libs/geometry/test/iterators/iterators.sln (original)
+++ sandbox/geometry/libs/geometry/test/iterators/iterators.sln 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -8,6 +8,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ggl_headers", "..\ggl_headers.vcproj", "{B3B37654-5AB4-49F3-A1D3-DFDE73EA5E1A}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "closing_iterator", "closing_iterator.vcproj", "{04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -30,6 +32,10 @@
                 {B3B37654-5AB4-49F3-A1D3-DFDE73EA5E1A}.Debug|Win32.Build.0 = Debug|Win32
                 {B3B37654-5AB4-49F3-A1D3-DFDE73EA5E1A}.Release|Win32.ActiveCfg = Release|Win32
                 {B3B37654-5AB4-49F3-A1D3-DFDE73EA5E1A}.Release|Win32.Build.0 = Release|Win32
+ {04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}.Debug|Win32.ActiveCfg = Debug|Win32
+ {04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}.Debug|Win32.Build.0 = Debug|Win32
+ {04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}.Release|Win32.ActiveCfg = Release|Win32
+ {04C31A2D-BE88-4FDB-AFFE-EFDFFA9D9C39}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE

Modified: sandbox/geometry/libs/geometry/test/util/Jamfile.v2
==============================================================================
--- sandbox/geometry/libs/geometry/test/util/Jamfile.v2 (original)
+++ sandbox/geometry/libs/geometry/test/util/Jamfile.v2 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -12,4 +12,7 @@
     [ run for_each_coordinate.cpp ]
     [ run select_most_precise.cpp ]
     [ run write_dsv.cpp ]
+ [ run reversible_view.cpp ]
+ [ run closeable_view.cpp ]
+ [ run reversible_closeable.cpp ]
     ;

Modified: sandbox/geometry/libs/geometry/test/util/as_range.vcproj
==============================================================================
--- sandbox/geometry/libs/geometry/test/util/as_range.vcproj (original)
+++ sandbox/geometry/libs/geometry/test/util/as_range.vcproj 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -46,6 +46,7 @@
                                 ExceptionHandling="2"
                                 RuntimeLibrary="1"
                                 UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
                         />
                         <Tool
                                 Name="VCManagedResourceCompilerTool"

Added: sandbox/geometry/libs/geometry/test/util/closeable_view.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/util/closeable_view.cpp 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -0,0 +1,74 @@
+// 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 <algorithm>
+#include <iterator>
+#include <sstream>
+#include <string>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/util/closeable_view.hpp>
+
+#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
+#include <boost/geometry/util/write_dsv.hpp>
+#include <boost/geometry/geometries/cartesian2d.hpp>
+#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
+
+
+template <bool Close, typename Range>
+void test_optionally_closing(Range const& range, std::string const& expected)
+{
+ typedef boost::geometry::closeable_view<Range const, Close> view_type;
+ typedef typename boost::range_iterator<view_type const>::type iterator;
+
+ view_type view(range);
+
+ bool first = true;
+ std::ostringstream out;
+ iterator end = boost::end(view);
+ for (iterator it = boost::begin(view); it != end; ++it, first = false)
+ {
+ out << (first ? "" : " ") << boost::geometry::dsv(*it);
+ }
+ BOOST_CHECK_EQUAL(out.str(), expected);
+}
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt,
+ std::string const& expected_false,
+ std::string const& expected_true)
+{
+ namespace bg = boost::geometry;
+ Geometry geo;
+ bg::read_wkt(wkt, geo);
+
+ test_optionally_closing<false>(geo, expected_false);
+ test_optionally_closing<true>(geo, expected_true);
+}
+
+
+template <typename P>
+void test_all()
+{
+ test_geometry<boost::geometry::linear_ring<P> >(
+ "POLYGON((1 1,1 4,4 4,4 1))",
+ "(1, 1) (1, 4) (4, 4) (4, 1)",
+ "(1, 1) (1, 4) (4, 4) (4, 1) (1, 1)");
+}
+
+
+int test_main(int, char* [])
+{
+ namespace bg = boost::geometry;
+ test_all<bg::point_2d>();
+ test_all<bg::point<int, 2, bg::cs::cartesian> >();
+ test_all<boost::tuple<double, double> >();
+
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/test/util/closeable_view.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/util/closeable_view.vcproj 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="closeable_view"
+ ProjectGUID="{5C40995A-B6FC-4C94-B552-0D80EC9E2049}"
+ RootNamespace="closeable_view"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\closeable_view"
+ 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"
+ WarningLevel="3"
+ 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)\closeable_view"
+ 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"
+ WarningLevel="3"
+ />
+ <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=".\closeable_view.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Modified: sandbox/geometry/libs/geometry/test/util/copy.vcproj
==============================================================================
--- sandbox/geometry/libs/geometry/test/util/copy.vcproj (original)
+++ sandbox/geometry/libs/geometry/test/util/copy.vcproj 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -46,6 +46,7 @@
                                 ExceptionHandling="2"
                                 RuntimeLibrary="1"
                                 UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
                         />
                         <Tool
                                 Name="VCManagedResourceCompilerTool"

Modified: sandbox/geometry/libs/geometry/test/util/for_each_coordinate.vcproj
==============================================================================
--- sandbox/geometry/libs/geometry/test/util/for_each_coordinate.vcproj (original)
+++ sandbox/geometry/libs/geometry/test/util/for_each_coordinate.vcproj 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -46,6 +46,7 @@
                                 ExceptionHandling="2"
                                 RuntimeLibrary="1"
                                 UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
                         />
                         <Tool
                                 Name="VCManagedResourceCompilerTool"

Added: sandbox/geometry/libs/geometry/test/util/reversible_closeable.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/util/reversible_closeable.cpp 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -0,0 +1,178 @@
+// 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 <algorithm>
+#include <iterator>
+#include <sstream>
+#include <string>
+
+#include <geometry_test_common.hpp>
+
+#include <boost/geometry/util/closeable_view.hpp>
+#include <boost/geometry/util/reversible_view.hpp>
+
+#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
+#include <boost/geometry/util/write_dsv.hpp>
+#include <boost/geometry/geometries/cartesian2d.hpp>
+#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
+
+
+template <typename View, typename Range>
+void test_option(Range const& range, std::string const& expected)
+{
+ typedef typename boost::range_iterator<View const>::type iterator;
+
+ View view(range);
+
+ bool first = true;
+ std::ostringstream out;
+ iterator end = boost::end(view);
+ for (iterator it = boost::begin(view); it != end; ++it, first = false)
+ {
+ out << (first ? "" : " ") << boost::geometry::dsv(*it);
+ }
+ BOOST_CHECK_EQUAL(out.str(), expected);
+}
+
+template <bool Close, boost::geometry::iterate_direction Direction, typename Range>
+void test_close_reverse(Range const& range, std::string const& expected)
+{
+ namespace bg = boost::geometry;
+ test_option
+ <
+ bg::closeable_view
+ <
+ bg::reversible_view<Range const, Direction> const,
+ Close
+ >
+ >(range, expected);
+}
+
+/*
+
+This should NOT compile, or at least not instantiate
+Use the code as above, so reversible_view should be nested inside closeable_view
+
+template <boost::geometry::iterate_direction Direction, bool Close, typename Range>
+void test_reverse_close(Range const& range, std::string const& expected)
+{
+ namespace bg = boost::geometry;
+ test_option
+ <
+ bg::reversible_view
+ <
+ bg::closeable_view<Range const, Close> const,
+ Direction
+ >
+ >(range, expected);
+}
+*/
+
+template
+<
+ boost::geometry::iterate_direction Direction1,
+ boost::geometry::iterate_direction Direction2,
+ typename Range
+>
+void test_reverse_reverse(Range const& range, std::string const& expected)
+{
+ namespace bg = boost::geometry;
+ test_option
+ <
+ bg::reversible_view
+ <
+ bg::reversible_view<Range const, Direction2> const,
+ Direction1
+ >
+ >(range, expected);
+}
+
+template
+<
+ bool Close1,
+ bool Close2,
+ typename Range
+>
+void test_close_close(Range const& range, std::string const& expected)
+{
+ namespace bg = boost::geometry;
+ test_option
+ <
+ bg::closeable_view
+ <
+ bg::closeable_view<Range const, Close2> const,
+ Close1
+ >
+ >(range, expected);
+}
+
+
+template <typename Geometry>
+void test_geometry(std::string const& wkt,
+ std::string const& expected_1,
+ std::string const& expected_2,
+ std::string const& expected_3,
+ std::string const& expected_4,
+ std::string const& expected_cc
+ )
+{
+ namespace bg = boost::geometry;
+ Geometry geo;
+ bg::read_wkt(wkt, geo);
+
+ test_close_reverse<false, bg::iterate_forward>(geo, expected_1);
+ test_close_reverse<true, bg::iterate_forward>(geo, expected_2);
+ test_close_reverse<false, bg::iterate_reverse>(geo, expected_3);
+ test_close_reverse<true, bg::iterate_reverse>(geo, expected_4);
+
+ /*
+ This should NOT compile on purpose
+ Because the closing_iterator can only be used forward
+ test_reverse_close<bg::iterate_forward, false>(geo, expected_1);
+ test_reverse_close<bg::iterate_forward, true>(geo, expected_2);
+ test_reverse_close<bg::iterate_reverse, false>(geo, expected_3);
+ test_reverse_close<bg::iterate_reverse, true>(geo, expected_4);
+ */
+
+ test_reverse_reverse<bg::iterate_forward, bg::iterate_forward>(geo, expected_1);
+ test_reverse_reverse<bg::iterate_reverse, bg::iterate_reverse>(geo, expected_1);
+
+ test_close_close<false, false>(geo, expected_1);
+ test_close_close<true, false>(geo, expected_2);
+ test_close_close<false, true>(geo, expected_2);
+
+ // Does not compile - no assignment operator
+ // Ranges basically support nesting, but the closing iterator does not.
+ // It is not necessary for the closing iterator to do so.
+
+ //test_close_close<true, true>(geo, expected_cc);
+}
+
+
+template <typename P>
+void test_all()
+{
+ test_geometry<boost::geometry::linear_ring<P> >(
+ "POLYGON((1 1,1 4,4 4,4 1))",
+ "(1, 1) (1, 4) (4, 4) (4, 1)",
+ "(1, 1) (1, 4) (4, 4) (4, 1) (1, 1)",
+ "(4, 1) (4, 4) (1, 4) (1, 1)",
+ "(4, 1) (4, 4) (1, 4) (1, 1) (4, 1)",
+ "(1, 1) (1, 4) (4, 4) (4, 1) (1, 1) (1, 1)" // closed twice, not used
+ );
+}
+
+
+int test_main(int, char* [])
+{
+ namespace bg = boost::geometry;
+ test_all<bg::point_2d>();
+ test_all<bg::point<int, 2, bg::cs::cartesian> >();
+ test_all<boost::tuple<double, double> >();
+
+ return 0;
+}

Added: sandbox/geometry/libs/geometry/test/util/reversible_closeable.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/util/reversible_closeable.vcproj 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="reversible_closeable"
+ ProjectGUID="{AAA72638-34CD-4A34-8329-984DFC766E24}"
+ RootNamespace="reversible_closeable"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\reversible_closeable"
+ 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"
+ WarningLevel="3"
+ 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)\reversible_closeable"
+ 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"
+ WarningLevel="3"
+ />
+ <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=".\reversible_closeable.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Modified: sandbox/geometry/libs/geometry/test/util/reversible_view.vcproj
==============================================================================
--- sandbox/geometry/libs/geometry/test/util/reversible_view.vcproj (original)
+++ sandbox/geometry/libs/geometry/test/util/reversible_view.vcproj 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -47,6 +47,7 @@
                                 RuntimeLibrary="1"
                                 UsePrecompiledHeader="0"
                                 WarningLevel="3"
+ DebugInformationFormat="1"
                         />
                         <Tool
                                 Name="VCManagedResourceCompilerTool"

Modified: sandbox/geometry/libs/geometry/test/util/select_most_precise.vcproj
==============================================================================
--- sandbox/geometry/libs/geometry/test/util/select_most_precise.vcproj (original)
+++ sandbox/geometry/libs/geometry/test/util/select_most_precise.vcproj 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -46,6 +46,7 @@
                                 ExceptionHandling="2"
                                 RuntimeLibrary="1"
                                 UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
                         />
                         <Tool
                                 Name="VCManagedResourceCompilerTool"

Modified: sandbox/geometry/libs/geometry/test/util/util_tests.sln
==============================================================================
--- sandbox/geometry/libs/geometry/test/util/util_tests.sln (original)
+++ sandbox/geometry/libs/geometry/test/util/util_tests.sln 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -12,6 +12,10 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reversible_view", "reversible_view.vcproj", "{BFB08FEE-76D6-4F3D-9184-BE03CC3F7968}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "closeable_view", "closeable_view.vcproj", "{5C40995A-B6FC-4C94-B552-0D80EC9E2049}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reversible_closeable", "reversible_closeable.vcproj", "{AAA72638-34CD-4A34-8329-984DFC766E24}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -42,6 +46,14 @@
                 {BFB08FEE-76D6-4F3D-9184-BE03CC3F7968}.Debug|Win32.Build.0 = Debug|Win32
                 {BFB08FEE-76D6-4F3D-9184-BE03CC3F7968}.Release|Win32.ActiveCfg = Release|Win32
                 {BFB08FEE-76D6-4F3D-9184-BE03CC3F7968}.Release|Win32.Build.0 = Release|Win32
+ {5C40995A-B6FC-4C94-B552-0D80EC9E2049}.Debug|Win32.ActiveCfg = Debug|Win32
+ {5C40995A-B6FC-4C94-B552-0D80EC9E2049}.Debug|Win32.Build.0 = Debug|Win32
+ {5C40995A-B6FC-4C94-B552-0D80EC9E2049}.Release|Win32.ActiveCfg = Release|Win32
+ {5C40995A-B6FC-4C94-B552-0D80EC9E2049}.Release|Win32.Build.0 = Release|Win32
+ {AAA72638-34CD-4A34-8329-984DFC766E24}.Debug|Win32.ActiveCfg = Debug|Win32
+ {AAA72638-34CD-4A34-8329-984DFC766E24}.Debug|Win32.Build.0 = Debug|Win32
+ {AAA72638-34CD-4A34-8329-984DFC766E24}.Release|Win32.ActiveCfg = Release|Win32
+ {AAA72638-34CD-4A34-8329-984DFC766E24}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE

Modified: sandbox/geometry/libs/geometry/test/util/write_dsv.vcproj
==============================================================================
--- sandbox/geometry/libs/geometry/test/util/write_dsv.vcproj (original)
+++ sandbox/geometry/libs/geometry/test/util/write_dsv.vcproj 2010-05-04 11:49:16 EDT (Tue, 04 May 2010)
@@ -46,6 +46,7 @@
                                 ExceptionHandling="2"
                                 RuntimeLibrary="1"
                                 UsePrecompiledHeader="0"
+ DebugInformationFormat="1"
                         />
                         <Tool
                                 Name="VCManagedResourceCompilerTool"


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