Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60551 - in sandbox/geometry/boost/geometry/multi/algorithms: . detail
From: barend.gehrels_at_[hidden]
Date: 2010-03-13 07:27:37


Author: barendgehrels
Date: 2010-03-13 07:27:37 EST (Sat, 13 Mar 2010)
New Revision: 60551
URL: http://svn.boost.org/trac/boost/changeset/60551

Log:
Added reverse for multi_linestring
Used generic "modify" for reverse
Added:
   sandbox/geometry/boost/geometry/multi/algorithms/detail/modify.hpp (contents, props changed)
Text files modified:
   sandbox/geometry/boost/geometry/multi/algorithms/reverse.hpp | 46 ++++++++++++++++++++--------------------
   1 files changed, 23 insertions(+), 23 deletions(-)

Added: sandbox/geometry/boost/geometry/multi/algorithms/detail/modify.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/multi/algorithms/detail/modify.hpp 2010-03-13 07:27:37 EST (Sat, 13 Mar 2010)
@@ -0,0 +1,48 @@
+// 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_MULTI_ALGORITHMS_DETAIL_MODIFY_HPP
+#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_MODIFY_HPP
+
+
+#include <boost/range/functions.hpp>
+#include <boost/range/metafunctions.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail
+{
+
+
+template <typename MultiGeometry, typename Policy>
+struct multi_modify
+{
+ static inline void apply(MultiGeometry& multi)
+ {
+ typedef typename boost::range_iterator<MultiGeometry>::type iterator_type;
+ for (iterator_type it = boost::begin(multi);
+ it != boost::end(multi);
+ ++it)
+ {
+ Policy::apply(*it);
+ }
+ }
+};
+
+
+} // namespace detail
+#endif
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_MODIFY_HPP

Modified: sandbox/geometry/boost/geometry/multi/algorithms/reverse.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/multi/algorithms/reverse.hpp (original)
+++ sandbox/geometry/boost/geometry/multi/algorithms/reverse.hpp 2010-03-13 07:27:37 EST (Sat, 13 Mar 2010)
@@ -1,7 +1,6 @@
 // Boost.Geometry (aka GGL, Generic Geometry Library)
 //
 // Copyright Barend Gehrels 2010, 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)
@@ -14,6 +13,7 @@
 
 
 #include <boost/geometry/algorithms/reverse.hpp>
+#include <boost/geometry/multi/algorithms/detail/modify.hpp>
 
 #include <boost/geometry/multi/core/tags.hpp>
 
@@ -22,35 +22,35 @@
 namespace boost { namespace geometry
 {
 
-#ifndef DOXYGEN_NO_DETAIL
-namespace detail { namespace reverse {
-
-template <typename MultiPolygon>
-struct reverse_multi_polygon
-{
- static inline void apply(MultiPolygon& mp)
- {
- typedef typename boost::range_value<MultiPolygon>::type polygon_type;
- for (typename boost::range_iterator<MultiPolygon>::type it
- = boost::begin(mp);
- it != boost::end(mp);
- ++it)
- {
- polygon_reverse<polygon_type>::apply(*it);
- }
- }
-};
-
-}} // namespace detail::reverse
-#endif
 
 #ifndef DOXYGEN_NO_DISPATCH
 namespace dispatch
 {
 
+
+template <typename Geometry>
+struct reverse<multi_linestring_tag, Geometry>
+ : detail::multi_modify
+ <
+ Geometry,
+ detail::reverse::range_reverse
+ <
+ typename boost::range_value<Geometry>::type
+ >
+ >
+{};
+
+
 template <typename Geometry>
 struct reverse<multi_polygon_tag, Geometry>
- : detail::reverse::reverse_multi_polygon<Geometry>
+ : detail::multi_modify
+ <
+ Geometry,
+ detail::reverse::polygon_reverse
+ <
+ typename boost::range_value<Geometry>::type
+ >
+ >
 {};
 
 


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