Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82022 - in branches/release: boost/geometry boost/geometry/algorithms boost/geometry/algorithms/detail boost/geometry/algorithms/detail/overlay boost/geometry/arithmetic boost/geometry/core boost/geometry/geometries boost/geometry/io boost/geometry/io/dsv boost/geometry/iterators boost/geometry/multi boost/geometry/multi/algorithms boost/geometry/multi/algorithms/detail boost/geometry/policies boost/geometry/strategies boost/geometry/strategies/cartesian boost/geometry/util boost/geometry/views libs/geometry/doc libs/geometry/doc/concept libs/geometry/doc/doxy libs/geometry/doc/generated libs/geometry/doc/html libs/geometry/doc/reference libs/geometry/doc/src libs/geometry/doc/src/docutils/tools/support_status libs/geometry/example libs/geometry/example/with_external_libs libs/geometry/test libs/geometry/test/algorithms libs/geometry/test/algorithms/overlay libs/geometry/test/core libs/geometry/test/multi/algorithms libs/geometry/test/multi/algorithms/overlay
From: barend.gehrels_at_[hidden]
Date: 2012-12-16 10:14:42


Author: barendgehrels
Date: 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
New Revision: 82022
URL: http://svn.boost.org/trac/boost/changeset/82022

Log:
[geometry] merged to release branch
Added:
   branches/release/boost/geometry/geometries/variant.hpp
      - copied unchanged from r80724, /trunk/boost/geometry/geometries/variant.hpp
   branches/release/boost/geometry/multi/algorithms/disjoint.hpp
      - copied unchanged from r82021, /trunk/boost/geometry/multi/algorithms/disjoint.hpp
   branches/release/libs/geometry/doc/generated/buffer_status.qbk
      - copied unchanged from r80724, /trunk/libs/geometry/doc/generated/buffer_status.qbk
   branches/release/libs/geometry/doc/generated/centroid_status.qbk
      - copied unchanged from r80724, /trunk/libs/geometry/doc/generated/centroid_status.qbk
   branches/release/libs/geometry/doc/generated/for_each_point_status.qbk
      - copied unchanged from r81201, /trunk/libs/geometry/doc/generated/for_each_point_status.qbk
   branches/release/libs/geometry/doc/generated/for_each_segment_status.qbk
      - copied unchanged from r81201, /trunk/libs/geometry/doc/generated/for_each_segment_status.qbk
   branches/release/libs/geometry/doc/generated/length_status.qbk
      - copied unchanged from r80724, /trunk/libs/geometry/doc/generated/length_status.qbk
   branches/release/libs/geometry/doc/generated/num_geometries_status.qbk
      - copied unchanged from r81201, /trunk/libs/geometry/doc/generated/num_geometries_status.qbk
   branches/release/libs/geometry/doc/generated/num_interior_rings_status.qbk
      - copied unchanged from r81201, /trunk/libs/geometry/doc/generated/num_interior_rings_status.qbk
   branches/release/libs/geometry/doc/generated/num_points_status.qbk
      - copied unchanged from r81201, /trunk/libs/geometry/doc/generated/num_points_status.qbk
   branches/release/libs/geometry/doc/generated/perimeter_status.qbk
      - copied unchanged from r80724, /trunk/libs/geometry/doc/generated/perimeter_status.qbk
   branches/release/libs/geometry/doc/generated/reverse_status.qbk
      - copied unchanged from r81201, /trunk/libs/geometry/doc/generated/reverse_status.qbk
   branches/release/libs/geometry/doc/generated/simplify_status.qbk
      - copied unchanged from r80187, /trunk/libs/geometry/doc/generated/simplify_status.qbk
   branches/release/libs/geometry/doc/generated/transform_status.qbk
      - copied unchanged from r80215, /trunk/libs/geometry/doc/generated/transform_status.qbk
   branches/release/libs/geometry/doc/generated/unique_status.qbk
      - copied unchanged from r80263, /trunk/libs/geometry/doc/generated/unique_status.qbk
   branches/release/libs/geometry/test/multi/algorithms/multi_intersects.cpp
      - copied unchanged from r82021, /trunk/libs/geometry/test/multi/algorithms/multi_intersects.cpp
Properties modified:
   branches/release/boost/geometry/algorithms/ (props changed)
   branches/release/boost/geometry/arithmetic/ (props changed)
   branches/release/boost/geometry/core/ (props changed)
   branches/release/boost/geometry/geometries/ (props changed)
   branches/release/boost/geometry/geometry.hpp (props changed)
   branches/release/boost/geometry/io/ (props changed)
   branches/release/boost/geometry/io/dsv/ (props changed)
   branches/release/boost/geometry/iterators/ (props changed)
   branches/release/boost/geometry/multi/ (props changed)
   branches/release/boost/geometry/policies/ (props changed)
   branches/release/boost/geometry/strategies/ (props changed)
   branches/release/boost/geometry/util/ (props changed)
   branches/release/boost/geometry/views/ (props changed)
   branches/release/libs/geometry/doc/ (props changed)
   branches/release/libs/geometry/doc/Jamfile.v2 (props changed)
   branches/release/libs/geometry/doc/about_documentation.qbk (props changed)
   branches/release/libs/geometry/doc/acknowledgments.qbk (props changed)
   branches/release/libs/geometry/doc/compiling.qbk (props changed)
   branches/release/libs/geometry/doc/concept/ (props changed)
   branches/release/libs/geometry/doc/copyright_note_policy.txt (props changed)
   branches/release/libs/geometry/doc/design_rationale.qbk (props changed)
   branches/release/libs/geometry/doc/doxy/ (props changed)
   branches/release/libs/geometry/doc/generated/ (props changed)
   branches/release/libs/geometry/doc/geometry.qbk (props changed)
   branches/release/libs/geometry/doc/html/ (props changed)
   branches/release/libs/geometry/doc/imports.qbk (props changed)
   branches/release/libs/geometry/doc/introduction.qbk (props changed)
   branches/release/libs/geometry/doc/make_qbk.py (props changed)
   branches/release/libs/geometry/doc/matrix.qbk (props changed)
   branches/release/libs/geometry/doc/quickref.xml (props changed)
   branches/release/libs/geometry/doc/quickstart.qbk (props changed)
   branches/release/libs/geometry/doc/readme.txt (props changed)
   branches/release/libs/geometry/doc/reference/ (props changed)
   branches/release/libs/geometry/doc/reference.qbk (props changed)
   branches/release/libs/geometry/doc/release_notes.qbk (contents, props changed)
   branches/release/libs/geometry/doc/src/ (props changed)
   branches/release/libs/geometry/example/ (props changed)
   branches/release/libs/geometry/test/ (props changed)
Text files modified:
   branches/release/boost/geometry/algorithms/area.hpp | 140 +++++++++----------
   branches/release/boost/geometry/algorithms/buffer.hpp | 33 ++--
   branches/release/boost/geometry/algorithms/centroid.hpp | 105 ++++----------
   branches/release/boost/geometry/algorithms/convex_hull.hpp | 50 +-----
   branches/release/boost/geometry/algorithms/correct.hpp | 4
   branches/release/boost/geometry/algorithms/detail/calculate_null.hpp | 2
   branches/release/boost/geometry/algorithms/detail/calculate_sum.hpp | 12 -
   branches/release/boost/geometry/algorithms/detail/disjoint.hpp | 14 ++
   branches/release/boost/geometry/algorithms/detail/get_left_turns.hpp | 22 +-
   branches/release/boost/geometry/algorithms/detail/occupation_info.hpp | 2
   branches/release/boost/geometry/algorithms/detail/overlay/add_rings.hpp | 33 ++--
   branches/release/boost/geometry/algorithms/detail/overlay/convert_ring.hpp | 21 ++
   branches/release/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp | 33 ++++
   branches/release/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp | 278 ++++++++++++++++-----------------------
   branches/release/boost/geometry/algorithms/detail/overlay/overlay.hpp | 6
   branches/release/boost/geometry/algorithms/detail/overlay/traverse.hpp | 16 ++
   branches/release/boost/geometry/algorithms/difference.hpp | 14 -
   branches/release/boost/geometry/algorithms/disjoint.hpp | 103 +++++++-------
   branches/release/boost/geometry/algorithms/distance.hpp | 5
   branches/release/boost/geometry/algorithms/for_each.hpp | 223 +++++++++----------------------
   branches/release/boost/geometry/algorithms/intersection.hpp | 147 ++++++++------------
   branches/release/boost/geometry/algorithms/length.hpp | 49 +++---
   branches/release/boost/geometry/algorithms/num_geometries.hpp | 36 ++---
   branches/release/boost/geometry/algorithms/num_interior_rings.hpp | 10 -
   branches/release/boost/geometry/algorithms/num_points.hpp | 61 ++++----
   branches/release/boost/geometry/algorithms/perimeter.hpp | 61 +++----
   branches/release/boost/geometry/algorithms/reverse.hpp | 35 +---
   branches/release/boost/geometry/algorithms/simplify.hpp | 124 ++++++-----------
   branches/release/boost/geometry/algorithms/sym_difference.hpp | 27 ---
   branches/release/boost/geometry/algorithms/transform.hpp | 68 ++++-----
   branches/release/boost/geometry/algorithms/union.hpp | 129 ++++++------------
   branches/release/boost/geometry/algorithms/unique.hpp | 38 ++---
   branches/release/boost/geometry/multi/algorithms/area.hpp | 29 ++--
   branches/release/boost/geometry/multi/algorithms/centroid.hpp | 66 +--------
   branches/release/boost/geometry/multi/algorithms/detail/multi_sum.hpp | 8 -
   branches/release/boost/geometry/multi/algorithms/for_each.hpp | 60 ++------
   branches/release/boost/geometry/multi/algorithms/intersection.hpp | 237 ++++++++++++++-------------------
   branches/release/boost/geometry/multi/algorithms/length.hpp | 34 ++--
   branches/release/boost/geometry/multi/algorithms/num_geometries.hpp | 2
   branches/release/boost/geometry/multi/algorithms/num_interior_rings.hpp | 2
   branches/release/boost/geometry/multi/algorithms/num_points.hpp | 12 -
   branches/release/boost/geometry/multi/algorithms/perimeter.hpp | 29 ++--
   branches/release/boost/geometry/multi/algorithms/reverse.hpp | 10 -
   branches/release/boost/geometry/multi/algorithms/simplify.hpp | 45 +-----
   branches/release/boost/geometry/multi/algorithms/transform.hpp | 22 --
   branches/release/boost/geometry/multi/algorithms/unique.hpp | 33 +---
   branches/release/boost/geometry/multi/multi.hpp | 1
   branches/release/boost/geometry/strategies/cartesian/cart_intersect.hpp | 26 +++
   branches/release/boost/geometry/strategies/cartesian/distance_pythagoras.hpp | 4
   branches/release/boost/geometry/strategies/covered_by.hpp | 2
   branches/release/boost/geometry/strategies/within.hpp | 2
   branches/release/libs/geometry/doc/release_notes.qbk | 22 +++
   branches/release/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp | 74 ++++++++++
   branches/release/libs/geometry/example/with_external_libs/x04_wxwidgets_world_mapper.cpp | 6
   branches/release/libs/geometry/test/algorithms/area.cpp | 26 +++
   branches/release/libs/geometry/test/algorithms/comparable_distance.cpp | 8
   branches/release/libs/geometry/test/algorithms/difference.cpp | 140 +++++++++++--------
   branches/release/libs/geometry/test/algorithms/disjoint.cpp | 16 ++
   branches/release/libs/geometry/test/algorithms/intersects.cpp | 43 +++++
   branches/release/libs/geometry/test/algorithms/overlay/overlay_cases.hpp | 7 +
   branches/release/libs/geometry/test/algorithms/overlay/traverse.cpp | 13 +
   branches/release/libs/geometry/test/algorithms/test_difference.hpp | 31 ++-
   branches/release/libs/geometry/test/algorithms/test_for_each.hpp | 60 ++++++++
   branches/release/libs/geometry/test/algorithms/test_intersects.hpp | 6
   branches/release/libs/geometry/test/core/point_type.cpp | 10 +
   branches/release/libs/geometry/test/geometry_test_common.hpp | 3
   branches/release/libs/geometry/test/multi/algorithms/Jamfile.v2 | 1
   branches/release/libs/geometry/test/multi/algorithms/multi_difference.cpp | 37 +++-
   branches/release/libs/geometry/test/multi/algorithms/multi_disjoint.cpp | 34 ++++
   branches/release/libs/geometry/test/multi/algorithms/multi_intersection.cpp | 7 +
   branches/release/libs/geometry/test/multi/algorithms/multi_union.cpp | 7 +
   branches/release/libs/geometry/test/multi/algorithms/overlay/multi_overlay_cases.hpp | 15 ++
   branches/release/libs/geometry/test/multi/algorithms/overlay/multi_traverse.cpp | 2
   73 files changed, 1482 insertions(+), 1611 deletions(-)

Modified: branches/release/boost/geometry/algorithms/area.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/area.hpp (original)
+++ branches/release/boost/geometry/algorithms/area.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -18,6 +18,8 @@
 #include <boost/mpl/if.hpp>
 #include <boost/range/functions.hpp>
 #include <boost/range/metafunctions.hpp>
+#include <boost/variant/static_visitor.hpp>
+#include <boost/variant/apply_visitor.hpp>
 
 #include <boost/geometry/core/closure.hpp>
 #include <boost/geometry/core/exterior_ring.hpp>
@@ -26,6 +28,7 @@
 #include <boost/geometry/core/ring_type.hpp>
 
 #include <boost/geometry/geometries/concepts/check.hpp>
+#include <boost/geometry/geometries/variant.hpp>
 
 #include <boost/geometry/algorithms/detail/calculate_null.hpp>
 #include <boost/geometry/algorithms/detail/calculate_sum.hpp>
@@ -49,41 +52,33 @@
 namespace detail { namespace area
 {
 
-template<typename Box, typename Strategy>
 struct box_area
 {
- typedef typename coordinate_type<Box>::type return_type;
-
- static inline return_type apply(Box const& box, Strategy const&)
+ template <typename Box, typename Strategy>
+ static inline typename coordinate_type<Box>::type
+ apply(Box const& box, Strategy const&)
     {
         // Currently only works for 2D Cartesian boxes
         assert_dimension<Box, 2>();
 
- return_type const dx = get<max_corner, 0>(box)
- - get<min_corner, 0>(box);
- return_type const dy = get<max_corner, 1>(box)
- - get<min_corner, 1>(box);
-
- return dx * dy;
+ return (get<max_corner, 0>(box) - get<min_corner, 0>(box))
+ * (get<max_corner, 1>(box) - get<min_corner, 1>(box));
     }
 };
 
 
 template
 <
- typename Ring,
     iterate_direction Direction,
- closure_selector Closure,
- typename Strategy
+ closure_selector Closure
>
 struct ring_area
 {
- BOOST_CONCEPT_ASSERT( (geometry::concept::AreaStrategy<Strategy>) );
-
- typedef typename Strategy::return_type type;
-
- static inline type apply(Ring const& ring, Strategy const& strategy)
+ template <typename Ring, typename Strategy>
+ static inline typename Strategy::return_type
+ apply(Ring const& ring, Strategy const& strategy)
     {
+ BOOST_CONCEPT_ASSERT( (geometry::concept::AreaStrategy<Strategy>) );
         assert_dimension<Ring, 2>();
 
         // Ignore warning (because using static method sometimes) on strategy
@@ -95,7 +90,7 @@
         if (int(boost::size(ring))
                 < core_detail::closure::minimum_ring_size<Closure>::value)
         {
- return type();
+ return typename Strategy::return_type();
         }
 
         typedef typename reversible_view<Ring const, Direction>::type rview_type;
@@ -136,71 +131,75 @@
 template
 <
     typename Geometry,
- typename Strategy = typename strategy::area::services::default_strategy
- <
- typename cs_tag
- <
- typename point_type<Geometry>::type
- >::type,
- typename point_type<Geometry>::type
- >::type,
     typename Tag = typename tag<Geometry>::type
>
-struct area
- : detail::calculate_null
- <
- typename Strategy::return_type,
- Geometry,
- Strategy
- > {};
+struct area : detail::calculate_null
+{
+ template <typename Strategy>
+ static inline typename Strategy::return_type apply(Geometry const& geometry, Strategy const& strategy)
+ {
+ return calculate_null::apply<typename Strategy::return_type>(geometry, strategy);
+ }
+};
 
 
-template
-<
- typename Geometry,
- typename Strategy
->
-struct area<Geometry, Strategy, box_tag>
- : detail::area::box_area<Geometry, Strategy>
+template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
+struct area<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, void>
+{
+ template <typename Strategy>
+ struct visitor: boost::static_visitor<typename Strategy::return_type>
+ {
+ Strategy const& m_strategy;
+
+ visitor(Strategy const& strategy): m_strategy(strategy) {}
+
+ template <typename Geometry>
+ typename Strategy::return_type operator()(Geometry const& geometry) const
+ {
+ return dispatch::area<Geometry>::apply(geometry, m_strategy);
+ }
+ };
+
+ template <typename Variant, typename Strategy>
+ static inline typename Strategy::return_type
+ apply(Variant const& variant_geometry, Strategy const& strategy)
+ {
+ return boost::apply_visitor(visitor<Strategy>(strategy), variant_geometry);
+ }
+};
+
+
+template <typename Geometry>
+struct area<Geometry, box_tag> : detail::area::box_area
 {};
 
 
-template
-<
- typename Ring,
- typename Strategy
->
-struct area<Ring, Strategy, ring_tag>
+template <typename Ring>
+struct area<Ring, ring_tag>
     : detail::area::ring_area
         <
- Ring,
             order_as_direction<geometry::point_order<Ring>::value>::value,
- geometry::closure<Ring>::value,
- Strategy
+ geometry::closure<Ring>::value
>
 {};
 
 
-template
-<
- typename Polygon,
- typename Strategy
->
-struct area<Polygon, Strategy, polygon_tag>
- : detail::calculate_polygon_sum
- <
+template <typename Polygon>
+struct area<Polygon, polygon_tag> : detail::calculate_polygon_sum
+{
+ template <typename Strategy>
+ static inline typename Strategy::return_type apply(Polygon const& polygon, Strategy const& strategy)
+ {
+ return calculate_polygon_sum::apply<
             typename Strategy::return_type,
- Polygon,
- Strategy,
             detail::area::ring_area
                 <
- typename ring_type<Polygon const>::type,
                     order_as_direction<geometry::point_order<Polygon>::value>::value,
- geometry::closure<Polygon>::value,
- Strategy
+ geometry::closure<Polygon>::value
>
- >
-{};
+ >(polygon, strategy);
+ }
+};
 
 
 } // namespace dispatch
@@ -243,10 +242,7 @@
 
     // detail::throw_on_empty_input(geometry);
         
- return dispatch::area
- <
- Geometry
- >::apply(geometry, strategy_type());
+ return dispatch::area<Geometry>::apply(geometry, strategy_type());
 }
 
 /*!
@@ -281,11 +277,7 @@
 
     // detail::throw_on_empty_input(geometry);
     
- return dispatch::area
- <
- Geometry,
- Strategy
- >::apply(geometry, strategy);
+ return dispatch::area<Geometry>::apply(geometry, strategy);
 }
 
 

Modified: branches/release/boost/geometry/algorithms/buffer.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/buffer.hpp (original)
+++ branches/release/boost/geometry/algorithms/buffer.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -20,6 +20,7 @@
 
 
 #include <boost/geometry/algorithms/clear.hpp>
+#include <boost/geometry/algorithms/not_implemented.hpp>
 #include <boost/geometry/algorithms/detail/disjoint.hpp>
 #include <boost/geometry/arithmetic/arithmetic.hpp>
 #include <boost/geometry/geometries/concepts/check.hpp>
@@ -75,15 +76,23 @@
 namespace dispatch
 {
 
-template <typename TagIn, typename TagOut, typename Input, typename T, typename Output>
-struct buffer {};
-
-
-template <typename BoxIn, typename T, typename BoxOut>
-struct buffer<box_tag, box_tag, BoxIn, T, BoxOut>
-{
- static inline void apply(BoxIn const& box_in, T const& distance,
- T const& , BoxIn& box_out)
+template
+<
+ typename Input,
+ typename Output,
+ typename TagIn = typename tag<Input>::type,
+ typename TagOut = typename tag<Output>::type
+>
+struct buffer: not_implemented<TagIn, TagOut>
+{};
+
+
+template <typename BoxIn, typename BoxOut>
+struct buffer<BoxIn, BoxOut, box_tag, box_tag>
+{
+ template <typename Distance>
+ static inline void apply(BoxIn const& box_in, Distance const& distance,
+ Distance const& , BoxIn& box_out)
     {
         detail::buffer::buffer_box(box_in, distance, box_out);
     }
@@ -122,10 +131,7 @@
 
     dispatch::buffer
         <
- typename tag<Input>::type,
- typename tag<Output>::type,
             Input,
- Distance,
             Output
>::apply(geometry_in, distance, chord_length, geometry_out);
 }
@@ -152,10 +158,7 @@
 
     dispatch::buffer
         <
- typename tag<Input>::type,
- typename tag<Output>::type,
             Input,
- T,
             Output
>::apply(geometry, distance, chord_length, geometry_out);
 

Modified: branches/release/boost/geometry/algorithms/centroid.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/centroid.hpp (original)
+++ branches/release/boost/geometry/algorithms/centroid.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -30,6 +30,7 @@
 
 #include <boost/geometry/algorithms/convert.hpp>
 #include <boost/geometry/algorithms/distance.hpp>
+#include <boost/geometry/algorithms/not_implemented.hpp>
 #include <boost/geometry/geometries/concepts/check.hpp>
 #include <boost/geometry/strategies/centroid.hpp>
 #include <boost/geometry/strategies/concepts/centroid_concept.hpp>
@@ -77,9 +78,9 @@
 namespace detail { namespace centroid
 {
 
-template<typename Point, typename PointCentroid, typename Strategy>
 struct centroid_point
 {
+ template<typename Point, typename PointCentroid, typename Strategy>
     static inline void apply(Point const& point, PointCentroid& centroid,
             Strategy const&)
     {
@@ -127,9 +128,9 @@
 };
 
 
-template<typename Box, typename Point, typename Strategy>
 struct centroid_box
 {
+ template<typename Box, typename Point, typename Strategy>
     static inline void apply(Box const& box, Point& centroid,
             Strategy const&)
     {
@@ -173,9 +174,10 @@
 /*!
     \brief Calculate the centroid of a ring.
 */
-template<typename Ring, closure_selector Closure, typename Strategy>
+template <closure_selector Closure>
 struct centroid_range_state
 {
+ template<typename Ring, typename Strategy>
     static inline void apply(Ring const& ring,
             Strategy const& strategy, typename Strategy::state_type& state)
     {
@@ -196,21 +198,17 @@
     }
 };
 
-template<typename Range, typename Point, closure_selector Closure, typename Strategy>
+template <closure_selector Closure>
 struct centroid_range
 {
+ template<typename Range, typename Point, typename Strategy>
     static inline void apply(Range const& range, Point& centroid,
             Strategy const& strategy)
     {
         if (range_ok(range, centroid))
         {
             typename Strategy::state_type state;
- centroid_range_state
- <
- Range,
- Closure,
- Strategy
- >::apply(range, strategy, state);
+ centroid_range_state<Closure>::apply(range, strategy, state);
             strategy.result(state, centroid);
         }
     }
@@ -222,20 +220,14 @@
     \note Because outer ring is clockwise, inners are counter clockwise,
     triangle approach is OK and works for polygons with rings.
 */
-template<typename Polygon, typename Strategy>
 struct centroid_polygon_state
 {
- typedef typename ring_type<Polygon>::type ring_type;
-
+ template<typename Polygon, typename Strategy>
     static inline void apply(Polygon const& poly,
             Strategy const& strategy, typename Strategy::state_type& state)
     {
- typedef centroid_range_state
- <
- ring_type,
- geometry::closure<ring_type>::value,
- Strategy
- > per_ring;
+ typedef typename ring_type<Polygon>::type ring_type;
+ typedef centroid_range_state<geometry::closure<ring_type>::value> per_ring;
 
         per_ring::apply(exterior_ring(poly), strategy, state);
 
@@ -248,20 +240,16 @@
     }
 };
 
-template<typename Polygon, typename Point, typename Strategy>
 struct centroid_polygon
 {
+ template<typename Polygon, typename Point, typename Strategy>
     static inline void apply(Polygon const& poly, Point& centroid,
             Strategy const& strategy)
     {
         if (range_ok(exterior_ring(poly), centroid))
         {
             typename Strategy::state_type state;
- centroid_polygon_state
- <
- Polygon,
- Strategy
- >::apply(poly, strategy, state);
+ centroid_polygon_state::apply(poly, strategy, state);
             strategy.result(state, centroid);
         }
     }
@@ -278,58 +266,35 @@
 
 template
 <
- typename Tag,
     typename Geometry,
- typename Point,
- typename Strategy
+ typename Tag = typename tag<Geometry>::type
>
-struct centroid {};
+struct centroid: not_implemented<Tag>
+{};
 
-template
-<
- typename Geometry,
- typename Point,
- typename Strategy
->
-struct centroid<point_tag, Geometry, Point, Strategy>
- : detail::centroid::centroid_point<Geometry, Point, Strategy>
+template <typename Geometry>
+struct centroid<Geometry, point_tag>
+ : detail::centroid::centroid_point
 {};
 
-template
-<
- typename Box,
- typename Point,
- typename Strategy
->
-struct centroid<box_tag, Box, Point, Strategy>
- : detail::centroid::centroid_box<Box, Point, Strategy>
+template <typename Box>
+struct centroid<Box, box_tag>
+ : detail::centroid::centroid_box
 {};
 
-template <typename Ring, typename Point, typename Strategy>
-struct centroid<ring_tag, Ring, Point, Strategy>
- : detail::centroid::centroid_range
- <
- Ring,
- Point,
- geometry::closure<Ring>::value,
- Strategy
- >
+template <typename Ring>
+struct centroid<Ring, ring_tag>
+ : detail::centroid::centroid_range<geometry::closure<Ring>::value>
 {};
 
-template <typename Linestring, typename Point, typename Strategy>
-struct centroid<linestring_tag, Linestring, Point, Strategy>
- : detail::centroid::centroid_range
- <
- Linestring,
- Point,
- closed,
- Strategy
- >
+template <typename Linestring>
+struct centroid<Linestring, linestring_tag>
+ : detail::centroid::centroid_range<closed>
  {};
 
-template <typename Polygon, typename Point, typename Strategy>
-struct centroid<polygon_tag, Polygon, Point, Strategy>
- : detail::centroid::centroid_polygon<Polygon, Point, Strategy>
+template <typename Polygon>
+struct centroid<Polygon, polygon_tag>
+ : detail::centroid::centroid_polygon
  {};
 
 } // namespace dispatch
@@ -365,13 +330,7 @@
 
     // Call dispatch apply method. That one returns true if centroid
     // should be taken from state.
- dispatch::centroid
- <
- typename tag<Geometry>::type,
- Geometry,
- Point,
- Strategy
- >::apply(geometry, c, strategy);
+ dispatch::centroid<Geometry>::apply(geometry, c, strategy);
 }
 
 

Modified: branches/release/boost/geometry/algorithms/convex_hull.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/convex_hull.hpp (original)
+++ branches/release/boost/geometry/algorithms/convex_hull.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -40,18 +40,13 @@
 namespace detail { namespace convex_hull
 {
 
-template
-<
- typename Geometry,
- order_selector Order,
- typename Strategy
->
+template <order_selector Order>
 struct hull_insert
 {
 
     // Member template function (to avoid inconvenient declaration
     // of output-iterator-type, from hull_to_geometry)
- template <typename OutputIterator>
+ template <typename Geometry, typename OutputIterator, typename Strategy>
     static inline OutputIterator apply(Geometry const& geometry,
             OutputIterator out, Strategy const& strategy)
     {
@@ -63,22 +58,15 @@
     }
 };
 
-template
-<
- typename Geometry,
- typename Strategy
->
 struct hull_to_geometry
 {
- template <typename OutputGeometry>
+ template <typename Geometry, typename OutputGeometry, typename Strategy>
     static inline void apply(Geometry const& geometry, OutputGeometry& out,
             Strategy const& strategy)
     {
         hull_insert
             <
- Geometry,
- geometry::point_order<OutputGeometry>::value,
- Strategy
+ geometry::point_order<OutputGeometry>::value
>::apply(geometry,
                 std::back_inserter(
                     // Handle linestring, ring and polygon the same:
@@ -113,21 +101,16 @@
 template
 <
     typename Geometry,
- typename Strategy = typename detail::convex_hull::default_strategy<Geometry>::type,
     typename Tag = typename tag<Geometry>::type
>
 struct convex_hull
- : detail::convex_hull::hull_to_geometry<Geometry, Strategy>
+ : detail::convex_hull::hull_to_geometry
 {};
 
-template
-<
- typename Box,
- typename Strategy
->
-struct convex_hull<Box, Strategy, box_tag>
+template <typename Box>
+struct convex_hull<Box, box_tag>
 {
- template <typename OutputGeometry>
+ template <typename OutputGeometry, typename Strategy>
     static inline void apply(Box const& box, OutputGeometry& out,
             Strategy const& )
     {
@@ -149,13 +132,9 @@
 
 
 
-template
-<
- order_selector Order,
- typename Geometry, typename Strategy
->
+template <order_selector Order>
 struct convex_hull_insert
- : detail::convex_hull::hull_insert<Geometry, Order, Strategy>
+ : detail::convex_hull::hull_insert<Order>
 {};
 
 
@@ -181,11 +160,7 @@
         return;
     }
 
- dispatch::convex_hull
- <
- Geometry,
- Strategy
- >::apply(geometry, out, strategy);
+ dispatch::convex_hull<Geometry>::apply(geometry, out, strategy);
 }
 
 
@@ -232,8 +207,7 @@
 
     return dispatch::convex_hull_insert
         <
- geometry::point_order<Geometry>::value,
- Geometry, Strategy
+ geometry::point_order<Geometry>::value
>::apply(geometry, out, strategy);
 }
 

Modified: branches/release/boost/geometry/algorithms/correct.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/correct.hpp (original)
+++ branches/release/boost/geometry/algorithms/correct.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -119,10 +119,8 @@
 
     typedef detail::area::ring_area
             <
- Ring,
                 order_as_direction<geometry::point_order<Ring>::value>::value,
- geometry::closure<Ring>::value,
- strategy_type
+ geometry::closure<Ring>::value
> ring_area_type;
 
 

Modified: branches/release/boost/geometry/algorithms/detail/calculate_null.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/calculate_null.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/calculate_null.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -21,9 +21,9 @@
 namespace detail
 {
 
-template<typename ReturnType, typename Geometry, typename Strategy>
 struct calculate_null
 {
+ template<typename ReturnType, typename Geometry, typename Strategy>
     static inline ReturnType apply(Geometry const& , Strategy const&)
     {
         return ReturnType();

Modified: branches/release/boost/geometry/algorithms/detail/calculate_sum.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/calculate_sum.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/calculate_sum.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -26,16 +26,9 @@
 {
 
 
-template
-<
- typename ReturnType,
- typename Polygon,
- typename Strategy,
- typename Policy
->
 class calculate_polygon_sum
 {
- template <typename Rings>
+ template <typename ReturnType, typename Policy, typename Rings, typename Strategy>
     static inline ReturnType sum_interior_rings(Rings const& rings, Strategy const& strategy)
     {
         ReturnType sum = ReturnType();
@@ -47,10 +40,11 @@
     }
 
 public :
+ template <typename ReturnType, typename Policy, typename Polygon, typename Strategy>
     static inline ReturnType apply(Polygon const& poly, Strategy const& strategy)
     {
         return Policy::apply(exterior_ring(poly), strategy)
- + sum_interior_rings(interior_rings(poly), strategy)
+ + sum_interior_rings<ReturnType, Policy>(interior_rings(poly), strategy)
             ;
     }
 };

Modified: branches/release/boost/geometry/algorithms/detail/disjoint.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/disjoint.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/disjoint.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -26,6 +26,7 @@
 #include <boost/geometry/core/coordinate_dimension.hpp>
 #include <boost/geometry/core/reverse_dispatch.hpp>
 
+#include <boost/geometry/algorithms/covered_by.hpp>
 
 #include <boost/geometry/util/math.hpp>
 
@@ -165,6 +166,19 @@
 };
 
 
+template
+<
+ typename Geometry1, typename Geometry2
+>
+struct reverse_covered_by
+{
+ static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2)
+ {
+ return ! geometry::covered_by(geometry1, geometry2);
+ }
+};
+
+
 
 /*!
     \brief Internal utility function to detect of boxes are disjoint

Modified: branches/release/boost/geometry/algorithms/detail/get_left_turns.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/get_left_turns.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/get_left_turns.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -120,10 +120,10 @@
 
     bool result = false;
     std::pair<segment_identifier, segment_identifier> pair = ordered_pair(outgoing_seg_id, incoming_seg_id);
- auto it = turn_segment_indices.find(pair);
+ typename boost::range_iterator<TurnSegmentIndices const>::type it = turn_segment_indices.find(pair);
     if (it != turn_segment_indices.end())
     {
- for (auto sit = it->second.begin(); sit != it->second.end(); ++sit)
+ for (std::set<int>::const_iterator sit = it->second.begin(); sit != it->second.end(); ++sit)
         {
             if (process_include(outgoing_seg_id, incoming_seg_id, *sit, turns[*sit], keep_indices, priority))
             {
@@ -148,14 +148,17 @@
             std::set<int>& indices)
 {
     std::map<segment_identifier, int> map;
- for (auto sit = indices.begin(); sit != indices.end(); ++sit)
+ for (std::set<int>::const_iterator sit = indices.begin();
+ sit != indices.end();
+ ++sit)
     {
         map[turns[*sit].operations[0].seg_id]++;
         map[turns[*sit].operations[1].seg_id]++;
     }
 
     std::set<segment_identifier> segment_occuring_once;
- for (auto mit = map.begin(); mit != map.end(); ++mit)
+ for (std::map<segment_identifier, int>::const_iterator mit = map.begin();
+ mit != map.end();++mit)
     {
         if (mit->second == 1)
         {
@@ -176,13 +179,14 @@
         segment_identifier back = *soo_it;
 
         std::pair<segment_identifier, segment_identifier> pair = ordered_pair(front, back);
- auto it = turn_segment_indices.find(pair);
+
+ typename boost::range_iterator<TurnSegmentIndices const>::type it = turn_segment_indices.find(pair);
         if (it != turn_segment_indices.end())
         {
             // debug_turns_by_indices("Found", it->second);
             // Check which is the union/continue
             segment_identifier good;
- for (auto sit = it->second.begin(); sit != it->second.end(); ++sit)
+ for (std::set<int>::const_iterator sit = it->second.begin(); sit != it->second.end(); ++sit)
             {
                 if (turns[*sit].operations[0].operation == detail::overlay::operation_union)
                 {
@@ -200,7 +204,7 @@
 
             // Find in indexes-to-keep this segment with the union. Discard the other one
             std::set<int> ok_indices;
- for (auto sit = indices.begin(); sit != indices.end(); ++sit)
+ for (std::set<int>::const_iterator sit = indices.begin(); sit != indices.end(); ++sit)
             {
                 if (corresponds<0>(turns[*sit], good) || corresponds<1>(turns[*sit], good))
                 {
@@ -223,7 +227,7 @@
 {
     // Find max prio
     int min_prio = 1024, max_prio = 0;
- for (auto sit = indices.begin(); sit != indices.end(); ++sit)
+ for (std::set<int>::const_iterator sit = indices.begin(); sit != indices.end(); ++sit)
     {
         if (turns[*sit].priority > max_prio)
         {
@@ -242,7 +246,7 @@
 
     // Only keep indices with high prio
     std::set<int> ok_indices;
- for (auto sit = indices.begin(); sit != indices.end(); ++sit)
+ for (std::set<int>::const_iterator sit = indices.begin(); sit != indices.end(); ++sit)
     {
         if (turns[*sit].priority >= max_prio)
         {

Modified: branches/release/boost/geometry/algorithms/detail/occupation_info.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/occupation_info.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/occupation_info.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -10,7 +10,7 @@
 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OCCUPATION_INFO_HPP
 
 #if ! defined(NDEBUG)
- #define BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION
+// #define BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION
 #endif
 
 #include <algorithm>

Modified: branches/release/boost/geometry/algorithms/detail/overlay/add_rings.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/add_rings.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/add_rings.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -75,15 +75,15 @@
             OutputIterator out)
 {
     typedef typename SelectionMap::const_iterator iterator;
- typedef typename SelectionMap::mapped_type property_type;
- typedef typename property_type::area_type area_type;
+ typedef typename SelectionMap::mapped_type property_type;
+ typedef typename property_type::area_type area_type;
 
- area_type const zero = 0;
- std::size_t const min_num_points = core_detail::closure::minimum_ring_size
- <
- geometry::closure
- <
- typename boost::range_value
+ area_type const zero = 0;
+ std::size_t const min_num_points = core_detail::closure::minimum_ring_size
+ <
+ geometry::closure
+ <
+ typename boost::range_value
                         <
                             RingCollection const
>::type
@@ -117,15 +117,14 @@
                 }
             }
 
- // Only add rings if they satisfy minimal requirements.
- // This cannot be done earlier (during traversal), not
- // everything is figured out yet (sum of positive/negative rings)
- // TODO: individual rings can still contain less than 3 points.
- if (geometry::num_points(result) >= min_num_points
- && math::larger(geometry::area(result), zero))
- {
- *out++ = result;
- }
+ // Only add rings if they satisfy minimal requirements.
+ // This cannot be done earlier (during traversal), not
+ // everything is figured out yet (sum of positive/negative rings)
+ if (geometry::num_points(result) >= min_num_points
+ && math::larger(geometry::area(result), zero))
+ {
+ *out++ = result;
+ }
         }
     }
     return out;

Modified: branches/release/boost/geometry/algorithms/detail/overlay/convert_ring.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/convert_ring.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/convert_ring.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -77,12 +77,23 @@
         }
         else
         {
- interior_rings(destination).resize(
- interior_rings(destination).size() + 1);
- geometry::convert(source, interior_rings(destination).back());
- if (reverse)
+ // Avoid adding interior rings which are invalid
+ // because of its number of points:
+ std::size_t const min_num_points
+ = core_detail::closure::minimum_ring_size
+ <
+ geometry::closure<Destination>::value
+ >::value;
+
+ if (geometry::num_points(source) >= min_num_points)
             {
- boost::reverse(interior_rings(destination).back());
+ interior_rings(destination).resize(
+ interior_rings(destination).size() + 1);
+ geometry::convert(source, interior_rings(destination).back());
+ if (reverse)
+ {
+ boost::reverse(interior_rings(destination).back());
+ }
             }
         }
     }

Modified: branches/release/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -252,6 +252,32 @@
             : order == 1;
     }
 
+ inline bool consider_ix_ix(Indexed const& left, Indexed const& right
+ , std::string const& // header
+ ) const
+ {
+ // Take first intersection, then blocked.
+ if (left.subject.operation == operation_intersection
+ && right.subject.operation == operation_blocked)
+ {
+ return true;
+ }
+ else if (left.subject.operation == operation_blocked
+ && right.subject.operation == operation_intersection)
+ {
+ return false;
+ }
+
+ // Default case, should not occur
+
+#ifdef BOOST_GEOMETRY_DEBUG_ENRICH
+ std::cout << "ix/ix unhandled" << std::endl;
+#endif
+ //debug_consider(0, left, right, header, false, "-> return", ret);
+
+ return left.index < right.index;
+ }
+
 
     inline bool consider_iu_iu(Indexed const& left, Indexed const& right,
                     std::string const& header) const
@@ -446,6 +472,11 @@
         {
             return consider_iu_iu(left, right, "iu/iu");
         }
+ else if (m_turn_points[left.index].combination(operation_intersection, operation_blocked)
+ && m_turn_points[right.index].combination(operation_intersection, operation_blocked))
+ {
+ return consider_ix_ix(left, right, "ix/ix");
+ }
         else if (m_turn_points[left.index].both(operation_intersection)
                 && m_turn_points[right.index].both(operation_intersection))
         {
@@ -493,7 +524,7 @@
                 << "/" << operation_char(m_turn_points[right.index].operations[0].operation)
                 << operation_char(m_turn_points[right.index].operations[1].operation)
                 << " " << " Take " << left.index << " < " << right.index
- << std::cout;
+ << std::endl;
 #endif
 
         return default_order;

Modified: branches/release/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -41,14 +41,14 @@
 namespace detail { namespace intersection
 {
 
-template
-<
- typename Segment1, typename Segment2,
- typename OutputIterator, typename PointOut,
- typename Strategy
->
+template <typename PointOut>
 struct intersection_segment_segment_point
 {
+ template
+ <
+ typename Segment1, typename Segment2,
+ typename OutputIterator, typename Strategy
+ >
     static inline OutputIterator apply(Segment1 const& segment1,
             Segment2 const& segment2, OutputIterator out,
             Strategy const& )
@@ -77,14 +77,14 @@
     }
 };
 
-template
-<
- typename Linestring1, typename Linestring2,
- typename OutputIterator, typename PointOut,
- typename Strategy
->
+template <typename PointOut>
 struct intersection_linestring_linestring_point
 {
+ template
+ <
+ typename Linestring1, typename Linestring2,
+ typename OutputIterator, typename Strategy
+ >
     static inline OutputIterator apply(Linestring1 const& linestring1,
             Linestring2 const& linestring2, OutputIterator out,
             Strategy const& )
@@ -112,22 +112,12 @@
 */
 template
 <
- typename LineString, typename Areal,
     bool ReverseAreal,
- typename OutputIterator, typename LineStringOut,
- overlay_type OverlayType,
- typename Strategy
+ typename LineStringOut,
+ overlay_type OverlayType
>
 struct intersection_of_linestring_with_areal
 {
- typedef detail::overlay::follow
- <
- LineStringOut,
- LineString,
- Areal,
- OverlayType
- > follower;
-
 #if defined(BOOST_GEOMETRY_DEBUG_FOLLOW)
         template <typename Turn, typename Operation>
         static inline void debug_follow(Turn const& turn, Operation op,
@@ -145,6 +135,11 @@
         }
 #endif
 
+ template
+ <
+ typename LineString, typename Areal,
+ typename OutputIterator, typename Strategy
+ >
     static inline OutputIterator apply(LineString const& linestring, Areal const& areal,
             OutputIterator out,
             Strategy const& )
@@ -154,6 +149,14 @@
             return out;
         }
 
+ typedef detail::overlay::follow
+ <
+ LineStringOut,
+ LineString,
+ Areal,
+ OverlayType
+ > follower;
+
         typedef typename point_type<LineStringOut>::type point_type;
 
         typedef detail::overlay::traversal_turn_info<point_type> turn_info;
@@ -220,18 +223,22 @@
 
 template
 <
- // tag dispatching:
- typename TagIn1, typename TagIn2, typename TagOut,
- // orientation
- // metafunction finetuning helpers:
- bool Areal1, bool Areal2, bool ArealOut,
     // real types
     typename Geometry1, typename Geometry2,
- bool Reverse1, bool Reverse2, bool ReverseOut,
- typename OutputIterator,
     typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ // orientation
+ bool Reverse1 = detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
+ bool Reverse2 = detail::overlay::do_reverse<geometry::point_order<Geometry2>::value>::value,
+ bool ReverseOut = detail::overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value,
+ // tag dispatching:
+ typename TagIn1 = typename geometry::tag<Geometry1>::type,
+ typename TagIn2 = typename geometry::tag<Geometry2>::type,
+ typename TagOut = typename geometry::tag<GeometryOut>::type,
+ // metafunction finetuning helpers:
+ bool Areal1 = geometry::is_areal<Geometry1>::value,
+ bool Areal2 = geometry::is_areal<Geometry2>::value,
+ bool ArealOut = geometry::is_areal<GeometryOut>::value
>
 struct intersection_insert
 {
@@ -245,122 +252,103 @@
 
 template
 <
- typename TagIn1, typename TagIn2, typename TagOut,
     typename Geometry1, typename Geometry2,
- bool Reverse1, bool Reverse2, bool ReverseOut,
- typename OutputIterator,
     typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool Reverse1, bool Reverse2, bool ReverseOut,
+ typename TagIn1, typename TagIn2, typename TagOut
>
 struct intersection_insert
     <
- TagIn1, TagIn2, TagOut,
- true, true, true,
         Geometry1, Geometry2,
- Reverse1, Reverse2, ReverseOut,
- OutputIterator, GeometryOut,
+ GeometryOut,
         OverlayType,
- Strategy
+ Reverse1, Reverse2, ReverseOut,
+ TagIn1, TagIn2, TagOut,
+ true, true, true
> : detail::overlay::overlay
- <Geometry1, Geometry2, Reverse1, Reverse2, ReverseOut, OutputIterator, GeometryOut, OverlayType, Strategy>
+ <Geometry1, Geometry2, Reverse1, Reverse2, ReverseOut, GeometryOut, OverlayType>
 {};
 
 
 // Any areal type with box:
 template
 <
- typename TagIn, typename TagOut,
     typename Geometry, typename Box,
- bool Reverse1, bool Reverse2, bool ReverseOut,
- typename OutputIterator,
     typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool Reverse1, bool Reverse2, bool ReverseOut,
+ typename TagIn, typename TagOut
>
 struct intersection_insert
     <
- TagIn, box_tag, TagOut,
- true, true, true,
         Geometry, Box,
- Reverse1, Reverse2, ReverseOut,
- OutputIterator, GeometryOut,
+ GeometryOut,
         OverlayType,
- Strategy
+ Reverse1, Reverse2, ReverseOut,
+ TagIn, box_tag, TagOut,
+ true, true, true
> : detail::overlay::overlay
- <Geometry, Box, Reverse1, Reverse2, ReverseOut, OutputIterator, GeometryOut, OverlayType, Strategy>
+ <Geometry, Box, Reverse1, Reverse2, ReverseOut, GeometryOut, OverlayType>
 {};
 
 
 template
 <
     typename Segment1, typename Segment2,
- bool Reverse1, bool Reverse2, bool ReverseOut,
- typename OutputIterator, typename GeometryOut,
+ typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool Reverse1, bool Reverse2, bool ReverseOut
>
 struct intersection_insert
     <
- segment_tag, segment_tag, point_tag,
- false, false, false,
         Segment1, Segment2,
+ GeometryOut,
+ OverlayType,
         Reverse1, Reverse2, ReverseOut,
- OutputIterator, GeometryOut,
- OverlayType, Strategy
- > : detail::intersection::intersection_segment_segment_point
- <
- Segment1, Segment2,
- OutputIterator, GeometryOut,
- Strategy
- >
+ segment_tag, segment_tag, point_tag,
+ false, false, false
+ > : detail::intersection::intersection_segment_segment_point<GeometryOut>
 {};
 
 
 template
 <
     typename Linestring1, typename Linestring2,
- bool Reverse1, bool Reverse2, bool ReverseOut,
- typename OutputIterator, typename GeometryOut,
+ typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool Reverse1, bool Reverse2, bool ReverseOut
>
 struct intersection_insert
     <
- linestring_tag, linestring_tag, point_tag,
- false, false, false,
         Linestring1, Linestring2,
+ GeometryOut,
+ OverlayType,
         Reverse1, Reverse2, ReverseOut,
- OutputIterator, GeometryOut,
- OverlayType, Strategy
- > : detail::intersection::intersection_linestring_linestring_point
- <
- Linestring1, Linestring2,
- OutputIterator, GeometryOut,
- Strategy
- >
+ linestring_tag, linestring_tag, point_tag,
+ false, false, false
+ > : detail::intersection::intersection_linestring_linestring_point<GeometryOut>
 {};
 
 
 template
 <
     typename Linestring, typename Box,
- bool Reverse1, bool Reverse2, bool ReverseOut,
- typename OutputIterator, typename GeometryOut,
+ typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool Reverse1, bool Reverse2, bool ReverseOut
>
 struct intersection_insert
     <
- linestring_tag, box_tag, linestring_tag,
- false, true, false,
         Linestring, Box,
- Reverse1, Reverse2, ReverseOut,
- OutputIterator, GeometryOut,
+ GeometryOut,
         OverlayType,
- Strategy
+ Reverse1, Reverse2, ReverseOut,
+ linestring_tag, box_tag, linestring_tag,
+ false, true, false
>
 {
+ template <typename OutputIterator, typename Strategy>
     static inline OutputIterator apply(Linestring const& linestring,
             Box const& box, OutputIterator out, Strategy const& )
     {
@@ -375,27 +363,23 @@
 template
 <
     typename Linestring, typename Polygon,
- bool ReverseLinestring, bool ReversePolygon, bool ReverseOut,
- typename OutputIterator, typename GeometryOut,
+ typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool ReverseLinestring, bool ReversePolygon, bool ReverseOut
>
 struct intersection_insert
     <
- linestring_tag, polygon_tag, linestring_tag,
- false, true, false,
         Linestring, Polygon,
- ReverseLinestring, ReversePolygon, ReverseOut,
- OutputIterator, GeometryOut,
+ GeometryOut,
         OverlayType,
- Strategy
+ ReverseLinestring, ReversePolygon, ReverseOut,
+ linestring_tag, polygon_tag, linestring_tag,
+ false, true, false
> : detail::intersection::intersection_of_linestring_with_areal
             <
- Linestring, Polygon,
                 ReversePolygon,
- OutputIterator, GeometryOut,
- OverlayType,
- Strategy
+ GeometryOut,
+ OverlayType
>
 {};
 
@@ -403,49 +387,44 @@
 template
 <
     typename Linestring, typename Ring,
- bool ReverseLinestring, bool ReverseRing, bool ReverseOut,
- typename OutputIterator, typename GeometryOut,
+ typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool ReverseLinestring, bool ReverseRing, bool ReverseOut
>
 struct intersection_insert
     <
- linestring_tag, ring_tag, linestring_tag,
- false, true, false,
         Linestring, Ring,
- ReverseLinestring, ReverseRing, ReverseOut,
- OutputIterator, GeometryOut,
+ GeometryOut,
         OverlayType,
- Strategy
+ ReverseLinestring, ReverseRing, ReverseOut,
+ linestring_tag, ring_tag, linestring_tag,
+ false, true, false
> : detail::intersection::intersection_of_linestring_with_areal
             <
- Linestring, Ring,
                 ReverseRing,
- OutputIterator, GeometryOut,
- OverlayType,
- Strategy
+ GeometryOut,
+ OverlayType
>
 {};
 
 template
 <
     typename Segment, typename Box,
- bool Reverse1, bool Reverse2, bool ReverseOut,
- typename OutputIterator, typename GeometryOut,
+ typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool Reverse1, bool Reverse2, bool ReverseOut
>
 struct intersection_insert
     <
- segment_tag, box_tag, linestring_tag,
- false, true, false,
         Segment, Box,
- Reverse1, Reverse2, ReverseOut,
- OutputIterator, GeometryOut,
+ GeometryOut,
         OverlayType,
- Strategy
+ Reverse1, Reverse2, ReverseOut,
+ segment_tag, box_tag, linestring_tag,
+ false, true, false
>
 {
+ template <typename OutputIterator, typename Strategy>
     static inline OutputIterator apply(Segment const& segment,
             Box const& box, OutputIterator out, Strategy const& )
     {
@@ -460,25 +439,24 @@
 
 template
 <
- typename Tag1, typename Tag2,
- bool Areal1, bool Areal2,
     typename Geometry1, typename Geometry2,
- bool Reverse1, bool Reverse2, bool ReverseOut,
- typename OutputIterator, typename PointOut,
+ typename PointOut,
     overlay_type OverlayType,
- typename Strategy
+ bool Reverse1, bool Reverse2, bool ReverseOut,
+ typename Tag1, typename Tag2,
+ bool Areal1, bool Areal2
>
 struct intersection_insert
     <
- Tag1, Tag2, point_tag,
- Areal1, Areal2, false,
         Geometry1, Geometry2,
- Reverse1, Reverse2, ReverseOut,
- OutputIterator, PointOut,
+ PointOut,
         OverlayType,
- Strategy
+ Reverse1, Reverse2, ReverseOut,
+ Tag1, Tag2, point_tag,
+ Areal1, Areal2, false
>
 {
+ template <typename OutputIterator, typename Strategy>
     static inline OutputIterator apply(Geometry1 const& geometry1,
             Geometry2 const& geometry2, OutputIterator out, Strategy const& )
     {
@@ -504,29 +482,22 @@
 
 template
 <
- typename GeometryTag1, typename GeometryTag2, typename GeometryTag3,
- bool Areal1, bool Areal2, bool ArealOut,
- typename Geometry1, typename Geometry2,
- bool Reverse1, bool Reverse2, bool ReverseOut,
- typename OutputIterator, typename GeometryOut,
+ typename Geometry1, typename Geometry2, typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool Reverse1, bool Reverse2, bool ReverseOut
>
 struct intersection_insert_reversed
 {
+ template <typename OutputIterator, typename Strategy>
     static inline OutputIterator apply(Geometry1 const& g1,
                 Geometry2 const& g2, OutputIterator out,
                 Strategy const& strategy)
     {
         return intersection_insert
             <
- GeometryTag2, GeometryTag1, GeometryTag3,
- Areal2, Areal1, ArealOut,
- Geometry2, Geometry1,
- Reverse2, Reverse1, ReverseOut,
- OutputIterator, GeometryOut,
+ Geometry2, Geometry1, GeometryOut,
                 OverlayType,
- Strategy
+ Reverse2, Reverse1, ReverseOut
>::apply(g2, g1, out, strategy);
     }
 };
@@ -561,35 +532,20 @@
             geometry::reverse_dispatch<Geometry1, Geometry2>::type::value,
             geometry::dispatch::intersection_insert_reversed
             <
- typename geometry::tag<Geometry1>::type,
- typename geometry::tag<Geometry2>::type,
- typename geometry::tag<GeometryOut>::type,
- geometry::is_areal<Geometry1>::value,
- geometry::is_areal<Geometry2>::value,
- geometry::is_areal<GeometryOut>::value,
                 Geometry1, Geometry2,
+ GeometryOut,
+ OverlayType,
                 overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
                 overlay::do_reverse<geometry::point_order<Geometry2>::value, ReverseSecond>::value,
- overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value,
- OutputIterator, GeometryOut,
- OverlayType,
- Strategy
+ overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value
>,
             geometry::dispatch::intersection_insert
             <
- typename geometry::tag<Geometry1>::type,
- typename geometry::tag<Geometry2>::type,
- typename geometry::tag<GeometryOut>::type,
- geometry::is_areal<Geometry1>::value,
- geometry::is_areal<Geometry2>::value,
- geometry::is_areal<GeometryOut>::value,
                 Geometry1, Geometry2,
- geometry::detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
- geometry::detail::overlay::do_reverse<geometry::point_order<Geometry2>::value, ReverseSecond>::value,
- geometry::detail::overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value,
- OutputIterator, GeometryOut,
+ GeometryOut,
                 OverlayType,
- Strategy
+ geometry::detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
+ geometry::detail::overlay::do_reverse<geometry::point_order<Geometry2>::value, ReverseSecond>::value
>
>::type::apply(geometry1, geometry2, out, strategy);
 }

Modified: branches/release/boost/geometry/algorithms/detail/overlay/overlay.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/overlay.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/overlay.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -134,12 +134,12 @@
 <
     typename Geometry1, typename Geometry2,
     bool Reverse1, bool Reverse2, bool ReverseOut,
- typename OutputIterator, typename GeometryOut,
- overlay_type Direction,
- typename Strategy
+ typename GeometryOut,
+ overlay_type Direction
>
 struct overlay
 {
+ template <typename OutputIterator, typename Strategy>
     static inline OutputIterator apply(
                 Geometry1 const& geometry1, Geometry2 const& geometry2,
                 OutputIterator out,

Modified: branches/release/boost/geometry/algorithms/detail/overlay/traverse.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/traverse.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/traverse.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -17,7 +17,9 @@
 #include <boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp>
 #include <boost/geometry/algorithms/detail/overlay/copy_segments.hpp>
 #include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
+#include <boost/geometry/algorithms/num_points.hpp>
 #include <boost/geometry/core/access.hpp>
+#include <boost/geometry/core/closure.hpp>
 #include <boost/geometry/core/coordinate_dimension.hpp>
 #include <boost/geometry/geometries/concepts/check.hpp>
 
@@ -233,6 +235,7 @@
                 detail::overlay::operation_type operation,
                 Turns& turns, Rings& rings)
     {
+ typedef typename boost::range_value<Rings>::type ring_type;
         typedef typename boost::range_iterator<Turns>::type turn_iterator;
         typedef typename boost::range_value<Turns>::type turn_type;
         typedef typename boost::range_iterator
@@ -240,6 +243,12 @@
                 typename turn_type::container_type
>::type turn_operation_iterator_type;
 
+ std::size_t const min_num_points
+ = core_detail::closure::minimum_ring_size
+ <
+ geometry::closure<ring_type>::value
+ >::value;
+
         std::size_t size_at_start = boost::size(rings);
 
         typename Backtrack::state_type state;
@@ -267,7 +276,7 @@
                         {
                             set_visited_for_continue(*it, *iit);
 
- typename boost::range_value<Rings>::type current_output;
+ ring_type current_output;
                             detail::overlay::append_no_duplicates(current_output,
                                         it->point, true);
 
@@ -376,7 +385,10 @@
                                 {
                                     iit->visited.set_finished();
                                     detail::overlay::debug_traverse(*current, *iit, "->Finished");
- rings.push_back(current_output);
+ if (geometry::num_points(current_output) >= min_num_points)
+ {
+ rings.push_back(current_output);
+ }
                                 }
                             }
                         }

Modified: branches/release/boost/geometry/algorithms/difference.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/difference.hpp (original)
+++ branches/release/boost/geometry/algorithms/difference.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -56,19 +56,11 @@
     
     return geometry::dispatch::intersection_insert
         <
- typename geometry::tag<Geometry1>::type,
- typename geometry::tag<Geometry2>::type,
- typename geometry::tag<GeometryOut>::type,
- geometry::is_areal<Geometry1>::value,
- geometry::is_areal<Geometry2>::value,
- geometry::is_areal<GeometryOut>::value,
             Geometry1, Geometry2,
- geometry::detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
- geometry::detail::overlay::do_reverse<geometry::point_order<Geometry2>::value, true>::value,
- geometry::detail::overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value,
- OutputIterator, GeometryOut,
+ GeometryOut,
             overlay_difference,
- Strategy
+ geometry::detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
+ geometry::detail::overlay::do_reverse<geometry::point_order<Geometry2>::value, true>::value
>::apply(geometry1, geometry2, out, strategy);
 }
 

Modified: branches/release/boost/geometry/algorithms/disjoint.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/disjoint.hpp (original)
+++ branches/release/boost/geometry/algorithms/disjoint.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -184,68 +184,82 @@
 
 template
 <
- typename GeometryTag1, typename GeometryTag2,
     typename Geometry1, typename Geometry2,
- std::size_t DimensionCount
+ std::size_t DimensionCount = dimension<Geometry1>::type::value,
+ typename Tag1 = typename tag<Geometry1>::type,
+ typename Tag2 = typename tag<Geometry2>::type,
+ bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value
>
 struct disjoint
     : detail::disjoint::general_areal<Geometry1, Geometry2>
 {};
 
 
-template <typename Point1, typename Point2, std::size_t DimensionCount>
-struct disjoint<point_tag, point_tag, Point1, Point2, DimensionCount>
+// If reversal is needed, perform it
+template
+<
+ typename Geometry1, typename Geometry2,
+ std::size_t DimensionCount,
+ typename Tag1, typename Tag2
+>
+struct disjoint<Geometry1, Geometry2, DimensionCount, Tag1, Tag2, true>
+ : disjoint<Geometry2, Geometry1, DimensionCount, Tag2, Tag1, false>
+{
+ static inline bool apply(Geometry1 const& g1, Geometry2 const& g2)
+ {
+ return disjoint
+ <
+ Geometry2, Geometry1,
+ DimensionCount,
+ Tag2, Tag1
+ >::apply(g2, g1);
+ }
+};
+
+
+template <typename Point1, typename Point2, std::size_t DimensionCount, bool Reverse>
+struct disjoint<Point1, Point2, DimensionCount, point_tag, point_tag, Reverse>
     : detail::disjoint::point_point<Point1, Point2, 0, DimensionCount>
 {};
 
 
-template <typename Box1, typename Box2, std::size_t DimensionCount>
-struct disjoint<box_tag, box_tag, Box1, Box2, DimensionCount>
+template <typename Box1, typename Box2, std::size_t DimensionCount, bool Reverse>
+struct disjoint<Box1, Box2, DimensionCount, box_tag, box_tag, Reverse>
     : detail::disjoint::box_box<Box1, Box2, 0, DimensionCount>
 {};
 
 
-template <typename Point, typename Box, std::size_t DimensionCount>
-struct disjoint<point_tag, box_tag, Point, Box, DimensionCount>
+template <typename Point, typename Box, std::size_t DimensionCount, bool Reverse>
+struct disjoint<Point, Box, DimensionCount, point_tag, box_tag, Reverse>
     : detail::disjoint::point_box<Point, Box, 0, DimensionCount>
 {};
 
-template <typename Linestring1, typename Linestring2>
-struct disjoint<linestring_tag, linestring_tag, Linestring1, Linestring2, 2>
+template <typename Point, typename Ring, std::size_t DimensionCount, bool Reverse>
+struct disjoint<Point, Ring, DimensionCount, point_tag, ring_tag, Reverse>
+ : detail::disjoint::reverse_covered_by<Point, Ring>
+{};
+
+template <typename Point, typename Polygon, std::size_t DimensionCount, bool Reverse>
+struct disjoint<Point, Polygon, DimensionCount, point_tag, polygon_tag, Reverse>
+ : detail::disjoint::reverse_covered_by<Point, Polygon>
+{};
+
+template <typename Linestring1, typename Linestring2, bool Reverse>
+struct disjoint<Linestring1, Linestring2, 2, linestring_tag, linestring_tag, Reverse>
     : detail::disjoint::disjoint_linear<Linestring1, Linestring2>
 {};
 
-template <typename Linestring1, typename Linestring2>
-struct disjoint<segment_tag, segment_tag, Linestring1, Linestring2, 2>
+template <typename Linestring1, typename Linestring2, bool Reverse>
+struct disjoint<Linestring1, Linestring2, 2, segment_tag, segment_tag, Reverse>
     : detail::disjoint::disjoint_segment<Linestring1, Linestring2>
 {};
 
-template <typename Linestring, typename Segment>
-struct disjoint<linestring_tag, segment_tag, Linestring, Segment, 2>
+template <typename Linestring, typename Segment, bool Reverse>
+struct disjoint<Linestring, Segment, 2, linestring_tag, segment_tag, Reverse>
     : detail::disjoint::disjoint_linear<Linestring, Segment>
 {};
 
 
-template
-<
- typename GeometryTag1, typename GeometryTag2,
- typename Geometry1, typename Geometry2,
- std::size_t DimensionCount
->
-struct disjoint_reversed
-{
- static inline bool apply(Geometry1 const& g1, Geometry2 const& g2)
- {
- return disjoint
- <
- GeometryTag2, GeometryTag1,
- Geometry2, Geometry1,
- DimensionCount
- >::apply(g2, g1);
- }
-};
-
-
 } // namespace dispatch
 #endif // DOXYGEN_NO_DISPATCH
 
@@ -272,26 +286,7 @@
             Geometry2 const
>();
 
- return boost::mpl::if_c
- <
- reverse_dispatch<Geometry1, Geometry2>::type::value,
- dispatch::disjoint_reversed
- <
- typename tag<Geometry1>::type,
- typename tag<Geometry2>::type,
- Geometry1,
- Geometry2,
- dimension<Geometry1>::type::value
- >,
- dispatch::disjoint
- <
- typename tag<Geometry1>::type,
- typename tag<Geometry2>::type,
- Geometry1,
- Geometry2,
- dimension<Geometry1>::type::value
- >
- >::type::apply(geometry1, geometry2);
+ return dispatch::disjoint<Geometry1, Geometry2>::apply(geometry1, geometry2);
 }
 
 

Modified: branches/release/boost/geometry/algorithms/distance.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/distance.hpp (original)
+++ branches/release/boost/geometry/algorithms/distance.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -369,7 +369,10 @@
                     <
                         segment_tag,
                         Point,
- typename point_type<Linestring>::type
+ typename point_type<Linestring>::type,
+ typename cs_tag<Point>::type,
+ typename cs_tag<typename point_type<Linestring>::type>::type,
+ Strategy
>::type ps_strategy_type;
 
         return detail::distance::point_to_range

Modified: branches/release/boost/geometry/algorithms/for_each.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/for_each.hpp (original)
+++ branches/release/boost/geometry/algorithms/for_each.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -18,8 +18,10 @@
 #include <algorithm>
 
 #include <boost/range.hpp>
+#include <boost/type_traits/is_const.hpp>
 #include <boost/typeof/typeof.hpp>
 
+#include <boost/geometry/algorithms/not_implemented.hpp>
 #include <boost/geometry/core/exterior_ring.hpp>
 #include <boost/geometry/core/interior_rings.hpp>
 #include <boost/geometry/core/tag_cast.hpp>
@@ -39,53 +41,55 @@
 {
 
 
-template <typename Point, typename Functor, bool IsConst>
 struct fe_point_per_point
 {
- static inline Functor apply(
- typename add_const_if_c<IsConst, Point>::type& point, Functor f)
+ template <typename Point, typename Functor>
+ static inline void apply(Point& point, Functor& f)
     {
         f(point);
- return f;
     }
 };
 
 
-template <typename Point, typename Functor, bool IsConst>
 struct fe_point_per_segment
 {
- static inline Functor apply(
- typename add_const_if_c<IsConst, Point>::type& , Functor f)
+ template <typename Point, typename Functor>
+ static inline void apply(Point& , Functor& f)
     {
         // TODO: if non-const, we should extract the points from the segment
         // and call the functor on those two points
- return f;
     }
 };
 
 
-template <typename Range, typename Functor, bool IsConst>
 struct fe_range_per_point
 {
- static inline Functor apply(
- typename add_const_if_c<IsConst, Range>::type& range,
- Functor f)
+ template <typename Range, typename Functor>
+ static inline void apply(Range& range, Functor& f)
     {
- return (std::for_each(boost::begin(range), boost::end(range), f));
+ // The previous implementation called the std library:
+ // return (std::for_each(boost::begin(range), boost::end(range), f));
+ // But that is not accepted for capturing lambda's.
+ // It needs to do it like that to return the state of Functor f (f is passed by value in std::for_each).
+
+ // So we now loop manually.
+
+ for (typename boost::range_iterator<Range>::type it = boost::begin(range); it != boost::end(range); ++it)
+ {
+ f(*it);
+ }
     }
 };
 
 
-template <typename Range, typename Functor, bool IsConst>
 struct fe_range_per_segment
 {
- static inline Functor apply(
- typename add_const_if_c<IsConst, Range>::type& range,
- Functor f)
+ template <typename Range, typename Functor>
+ static inline void apply(Range& range, Functor& f)
     {
         typedef typename add_const_if_c
             <
- IsConst,
+ is_const<Range>::value,
                 typename point_type<Range>::type
>::type point_type;
 
@@ -97,65 +101,41 @@
             f(s);
             previous = it++;
         }
-
- return f;
     }
 };
 
 
-template <typename Polygon, typename Functor, bool IsConst>
 struct fe_polygon_per_point
 {
- typedef typename add_const_if_c<IsConst, Polygon>::type poly_type;
-
- static inline Functor apply(poly_type& poly, Functor f)
+ template <typename Polygon, typename Functor>
+ static inline void apply(Polygon& poly, Functor& f)
     {
- typedef fe_range_per_point
- <
- typename ring_type<Polygon>::type,
- Functor,
- IsConst
- > per_ring;
-
- f = per_ring::apply(exterior_ring(poly), f);
+ fe_range_per_point::apply(exterior_ring(poly), f);
 
- typename interior_return_type<poly_type>::type rings
+ typename interior_return_type<Polygon>::type rings
                     = interior_rings(poly);
         for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it)
         {
- f = per_ring::apply(*it, f);
+ fe_range_per_point::apply(*it, f);
         }
-
- return f;
     }
 
 };
 
 
-template <typename Polygon, typename Functor, bool IsConst>
 struct fe_polygon_per_segment
 {
- typedef typename add_const_if_c<IsConst, Polygon>::type poly_type;
-
- static inline Functor apply(poly_type& poly, Functor f)
+ template <typename Polygon, typename Functor>
+ static inline void apply(Polygon& poly, Functor& f)
     {
- typedef fe_range_per_segment
- <
- typename ring_type<Polygon>::type,
- Functor,
- IsConst
- > per_ring;
+ fe_range_per_segment::apply(exterior_ring(poly), f);
 
- f = per_ring::apply(exterior_ring(poly), f);
-
- typename interior_return_type<poly_type>::type rings
+ typename interior_return_type<Polygon>::type rings
                     = interior_rings(poly);
         for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it)
         {
- f = per_ring::apply(*it, f);
+ fe_range_per_segment::apply(*it, f);
         }
-
- return f;
     }
 
 };
@@ -171,68 +151,66 @@
 
 template
 <
- typename Tag,
     typename Geometry,
- typename Functor,
- bool IsConst
+ typename Tag = typename tag_cast<typename tag<Geometry>::type, multi_tag>::type
>
-struct for_each_point {};
+struct for_each_point: not_implemented<Tag>
+{};
 
 
-template <typename Point, typename Functor, bool IsConst>
-struct for_each_point<point_tag, Point, Functor, IsConst>
- : detail::for_each::fe_point_per_point<Point, Functor, IsConst>
+template <typename Point>
+struct for_each_point<Point, point_tag>
+ : detail::for_each::fe_point_per_point
 {};
 
 
-template <typename Linestring, typename Functor, bool IsConst>
-struct for_each_point<linestring_tag, Linestring, Functor, IsConst>
- : detail::for_each::fe_range_per_point<Linestring, Functor, IsConst>
+template <typename Linestring>
+struct for_each_point<Linestring, linestring_tag>
+ : detail::for_each::fe_range_per_point
 {};
 
 
-template <typename Ring, typename Functor, bool IsConst>
-struct for_each_point<ring_tag, Ring, Functor, IsConst>
- : detail::for_each::fe_range_per_point<Ring, Functor, IsConst>
+template <typename Ring>
+struct for_each_point<Ring, ring_tag>
+ : detail::for_each::fe_range_per_point
 {};
 
 
-template <typename Polygon, typename Functor, bool IsConst>
-struct for_each_point<polygon_tag, Polygon, Functor, IsConst>
- : detail::for_each::fe_polygon_per_point<Polygon, Functor, IsConst>
+template <typename Polygon>
+struct for_each_point<Polygon, polygon_tag>
+ : detail::for_each::fe_polygon_per_point
 {};
 
 
 template
 <
- typename Tag,
     typename Geometry,
- typename Functor,
- bool IsConst
+ typename Tag = typename tag_cast<typename tag<Geometry>::type, multi_tag>::type
>
-struct for_each_segment {};
+struct for_each_segment: not_implemented<Tag>
+{};
 
-template <typename Point, typename Functor, bool IsConst>
-struct for_each_segment<point_tag, Point, Functor, IsConst>
- : detail::for_each::fe_point_per_segment<Point, Functor, IsConst>
+template <typename Point>
+struct for_each_segment<Point, point_tag>
+ : detail::for_each::fe_point_per_segment
 {};
 
 
-template <typename Linestring, typename Functor, bool IsConst>
-struct for_each_segment<linestring_tag, Linestring, Functor, IsConst>
- : detail::for_each::fe_range_per_segment<Linestring, Functor, IsConst>
+template <typename Linestring>
+struct for_each_segment<Linestring, linestring_tag>
+ : detail::for_each::fe_range_per_segment
 {};
 
 
-template <typename Ring, typename Functor, bool IsConst>
-struct for_each_segment<ring_tag, Ring, Functor, IsConst>
- : detail::for_each::fe_range_per_segment<Ring, Functor, IsConst>
+template <typename Ring>
+struct for_each_segment<Ring, ring_tag>
+ : detail::for_each::fe_range_per_segment
 {};
 
 
-template <typename Polygon, typename Functor, bool IsConst>
-struct for_each_segment<polygon_tag, Polygon, Functor, IsConst>
- : detail::for_each::fe_polygon_per_segment<Polygon, Functor, IsConst>
+template <typename Polygon>
+struct for_each_segment<Polygon, polygon_tag>
+ : detail::for_each::fe_polygon_per_segment
 {};
 
 
@@ -245,35 +223,6 @@
 \details \det_for_each{point}
 \ingroup for_each
 \param geometry \param_geometry
-\param f \par_for_each_f{const point}
-\tparam Geometry \tparam_geometry
-\tparam Functor \tparam_functor
-
-\qbk{distinguish,const version}
-\qbk{[include reference/algorithms/for_each_point.qbk]}
-\qbk{[heading Example]}
-\qbk{[for_each_point_const] [for_each_point_const_output]}
-*/
-template<typename Geometry, typename Functor>
-inline Functor for_each_point(Geometry const& geometry, Functor f)
-{
- concept::check<Geometry const>();
-
- return dispatch::for_each_point
- <
- typename tag_cast<typename tag<Geometry>::type, multi_tag>::type,
- Geometry,
- Functor,
- true
- >::apply(geometry, f);
-}
-
-
-/*!
-\brief \brf_for_each{point}
-\details \det_for_each{point}
-\ingroup for_each
-\param geometry \param_geometry
 \param f \par_for_each_f{point}
 \tparam Geometry \tparam_geometry
 \tparam Functor \tparam_functor
@@ -281,19 +230,15 @@
 \qbk{[include reference/algorithms/for_each_point.qbk]}
 \qbk{[heading Example]}
 \qbk{[for_each_point] [for_each_point_output]}
+\qbk{[for_each_point_const] [for_each_point_const_output]}
 */
 template<typename Geometry, typename Functor>
 inline Functor for_each_point(Geometry& geometry, Functor f)
 {
     concept::check<Geometry>();
 
- return dispatch::for_each_point
- <
- typename tag_cast<typename tag<Geometry>::type, multi_tag>::type,
- Geometry,
- Functor,
- false
- >::apply(geometry, f);
+ dispatch::for_each_point<Geometry>::apply(geometry, f);
+ return f;
 }
 
 
@@ -302,53 +247,21 @@
 \details \det_for_each{segment}
 \ingroup for_each
 \param geometry \param_geometry
-\param f \par_for_each_f{const segment}
+\param f \par_for_each_f{segment}
 \tparam Geometry \tparam_geometry
 \tparam Functor \tparam_functor
 
-\qbk{distinguish,const version}
 \qbk{[include reference/algorithms/for_each_segment.qbk]}
 \qbk{[heading Example]}
 \qbk{[for_each_segment_const] [for_each_segment_const_output]}
 */
 template<typename Geometry, typename Functor>
-inline Functor for_each_segment(Geometry const& geometry, Functor f)
-{
- concept::check<Geometry const>();
-
- return dispatch::for_each_segment
- <
- typename tag_cast<typename tag<Geometry>::type, multi_tag>::type,
- Geometry,
- Functor,
- true
- >::apply(geometry, f);
-}
-
-
-/*!
-\brief \brf_for_each{segment}
-\details \det_for_each{segment}
-\ingroup for_each
-\param geometry \param_geometry
-\param f \par_for_each_f{segment}
-\tparam Geometry \tparam_geometry
-\tparam Functor \tparam_functor
-
-\qbk{[include reference/algorithms/for_each_segment.qbk]}
-*/
-template<typename Geometry, typename Functor>
 inline Functor for_each_segment(Geometry& geometry, Functor f)
 {
     concept::check<Geometry>();
 
- return dispatch::for_each_segment
- <
- typename tag_cast<typename tag<Geometry>::type, multi_tag>::type,
- Geometry,
- Functor,
- false
- >::apply(geometry, f);
+ dispatch::for_each_segment<Geometry>::apply(geometry, f);
+ return f;
 }
 
 

Modified: branches/release/boost/geometry/algorithms/intersection.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/intersection.hpp (original)
+++ branches/release/boost/geometry/algorithms/intersection.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -22,15 +22,14 @@
 namespace detail { namespace intersection
 {
 
-template
-<
- typename Box1, typename Box2,
- typename BoxOut,
- typename Strategy,
- std::size_t Dimension, std::size_t DimensionCount
->
+template <std::size_t Dimension, std::size_t DimensionCount>
 struct intersection_box_box
 {
+ template
+ <
+ typename Box1, typename Box2, typename BoxOut,
+ typename Strategy
+ >
     static inline bool apply(Box1 const& box1,
             Box2 const& box2, BoxOut& box_out,
             Strategy const& strategy)
@@ -50,23 +49,19 @@
         set<min_corner, Dimension>(box_out, min1 < min2 ? min2 : min1);
         set<max_corner, Dimension>(box_out, max1 > max2 ? max2 : max1);
 
- return intersection_box_box
- <
- Box1, Box2, BoxOut, Strategy,
- Dimension + 1, DimensionCount
- >::apply(box1, box2, box_out, strategy);
+ return intersection_box_box<Dimension + 1, DimensionCount>
+ ::apply(box1, box2, box_out, strategy);
     }
 };
 
-template
-<
- typename Box1, typename Box2,
- typename BoxOut,
- typename Strategy,
- std::size_t DimensionCount
->
-struct intersection_box_box<Box1, Box2, BoxOut, Strategy, DimensionCount, DimensionCount>
+template <std::size_t DimensionCount>
+struct intersection_box_box<DimensionCount, DimensionCount>
 {
+ template
+ <
+ typename Box1, typename Box2, typename BoxOut,
+ typename Strategy
+ >
     static inline bool apply(Box1 const&, Box2 const&, BoxOut&, Strategy const&)
     {
         return true;
@@ -86,15 +81,14 @@
 // By default, all is forwarded to the intersection_insert-dispatcher
 template
 <
- typename Tag1, typename Tag2, typename TagOut,
     typename Geometry1, typename Geometry2,
- typename GeometryOut,
- typename Strategy
+ typename Tag1 = typename geometry::tag<Geometry1>::type,
+ typename Tag2 = typename geometry::tag<Geometry2>::type,
+ bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value
>
 struct intersection
 {
- typedef std::back_insert_iterator<GeometryOut> output_iterator;
-
+ template <typename GeometryOut, typename Strategy>
     static inline bool apply(Geometry1 const& geometry1,
             Geometry2 const& geometry2,
             GeometryOut& geometry_out,
@@ -104,17 +98,8 @@
 
         intersection_insert
         <
- Tag1, Tag2, typename geometry::tag<OneOut>::type,
- geometry::is_areal<Geometry1>::value,
- geometry::is_areal<Geometry2>::value,
- geometry::is_areal<OneOut>::value,
- Geometry1, Geometry2,
- detail::overlay::do_reverse<geometry::point_order<Geometry1>::value, false>::value,
- detail::overlay::do_reverse<geometry::point_order<Geometry2>::value, false>::value,
- detail::overlay::do_reverse<geometry::point_order<OneOut>::value>::value,
- output_iterator, OneOut,
- overlay_intersection,
- Strategy
+ Geometry1, Geometry2, OneOut,
+ overlay_intersection
>::apply(geometry1, geometry2, std::back_inserter(geometry_out), strategy);
 
         return true;
@@ -123,50 +108,50 @@
 };
 
 
+// If reversal is needed, perform it
 template
 <
- typename Box1, typename Box2,
- typename BoxOut,
- typename Strategy
+ typename Geometry1, typename Geometry2,
+ typename Tag1, typename Tag2
>
 struct intersection
- <
- box_tag, box_tag, box_tag,
- Box1, Box2, BoxOut,
- Strategy
- > : public detail::intersection::intersection_box_box
- <
- Box1, Box2, BoxOut,
- Strategy,
- 0, geometry::dimension<Box1>::value
- >
-{};
-
-
-template
 <
- typename Tag1, typename Tag2, typename TagOut,
- typename Geometry1, typename Geometry2,
- typename GeometryOut,
- typename Strategy
->
-struct intersection_reversed
-{
- static inline bool apply(Geometry1 const& geometry1,
- Geometry2 const& geometry2,
- GeometryOut& geometry_out,
- Strategy const& strategy)
+ Geometry1, Geometry2,
+ Tag1, Tag2,
+ true
+>
+ : intersection<Geometry2, Geometry1, Tag2, Tag1, false>
+{
+ template <typename GeometryOut, typename Strategy>
+ static inline bool apply(
+ Geometry1 const& g1,
+ Geometry2 const& g2,
+ GeometryOut& out,
+ Strategy const& strategy)
     {
- return intersection
- <
- Tag2, Tag1, TagOut,
- Geometry2, Geometry1,
- GeometryOut, Strategy
- >::apply(geometry2, geometry1, geometry_out, strategy);
+ return intersection<
+ Geometry2, Geometry1,
+ Tag2, Tag1,
+ false
+ >::apply(g2, g1, out, strategy);
     }
 };
 
 
+template
+<
+ typename Box1, typename Box2, bool Reverse
+>
+struct intersection
+ <
+ Box1, Box2,
+ box_tag, box_tag,
+ Reverse
+ > : public detail::intersection::intersection_box_box
+ <
+ 0, geometry::dimension<Box1>::value
+ >
+{};
 
 
 } // namespace dispatch
@@ -210,24 +195,10 @@
> strategy;
 
 
- return boost::mpl::if_c
- <
- geometry::reverse_dispatch<Geometry1, Geometry2>::type::value,
- dispatch::intersection_reversed
- <
- typename geometry::tag<Geometry1>::type,
- typename geometry::tag<Geometry2>::type,
- typename geometry::tag<GeometryOut>::type,
- Geometry1, Geometry2, GeometryOut, strategy
- >,
- dispatch::intersection
- <
- typename geometry::tag<Geometry1>::type,
- typename geometry::tag<Geometry2>::type,
- typename geometry::tag<GeometryOut>::type,
- Geometry1, Geometry2, GeometryOut, strategy
- >
- >::type::apply(geometry1, geometry2, geometry_out, strategy());
+ return dispatch::intersection<
+ Geometry1,
+ Geometry2
+ >::apply(geometry1, geometry2, geometry_out, strategy());
 }
 
 

Modified: branches/release/boost/geometry/algorithms/length.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/length.hpp (original)
+++ branches/release/boost/geometry/algorithms/length.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -43,9 +43,10 @@
 {
 
 
-template<typename Segment, typename Strategy>
+template<typename Segment>
 struct segment_length
 {
+ template <typename Strategy>
     static inline typename default_length_result<Segment>::type apply(
             Segment const& segment, Strategy const& strategy)
     {
@@ -63,11 +64,12 @@
 \note for_each could be used here, now that point_type is changed by boost
     range iterator
 */
-template<typename Range, typename Strategy, closure_selector Closure>
+template<typename Range, closure_selector Closure>
 struct range_length
 {
     typedef typename default_length_result<Range>::type return_type;
 
+ template <typename Strategy>
     static inline return_type apply(
             Range const& range, Strategy const& strategy)
     {
@@ -106,28 +108,31 @@
 {
 
 
-template <typename Tag, typename Geometry, typename Strategy>
+template <typename Geometry, typename Tag = typename tag<Geometry>::type>
 struct length : detail::calculate_null
- <
- typename default_length_result<Geometry>::type,
- Geometry,
- Strategy
- >
-{};
+{
+ typedef typename default_length_result<Geometry>::type return_type;
+
+ template <typename Strategy>
+ static inline return_type apply(Geometry const& geometry, Strategy const& strategy)
+ {
+ return calculate_null::apply<return_type>(geometry, strategy);
+ }
+};
 
 
-template <typename Geometry, typename Strategy>
-struct length<linestring_tag, Geometry, Strategy>
- : detail::length::range_length<Geometry, Strategy, closed>
+template <typename Geometry>
+struct length<Geometry, linestring_tag>
+ : detail::length::range_length<Geometry, closed>
 {};
 
 
 // RING: length is currently 0; it might be argued that it is the "perimeter"
 
 
-template <typename Geometry, typename Strategy>
-struct length<segment_tag, Geometry, Strategy>
- : detail::length::segment_length<Geometry, Strategy>
+template <typename Geometry>
+struct length<Geometry, segment_tag>
+ : detail::length::segment_length<Geometry>
 {};
 
 
@@ -159,12 +164,7 @@
             point_tag, typename point_type<Geometry>::type
>::type strategy_type;
 
- return dispatch::length
- <
- typename tag<Geometry>::type,
- Geometry,
- strategy_type
- >::apply(geometry, strategy_type());
+ return dispatch::length<Geometry>::apply(geometry, strategy_type());
 }
 
 
@@ -190,12 +190,7 @@
 
     // detail::throw_on_empty_input(geometry);
     
- return dispatch::length
- <
- typename tag<Geometry>::type,
- Geometry,
- Strategy
- >::apply(geometry, strategy);
+ return dispatch::length<Geometry>::apply(geometry, strategy);
 }
 
 

Modified: branches/release/boost/geometry/algorithms/num_geometries.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/num_geometries.hpp (original)
+++ branches/release/boost/geometry/algorithms/num_geometries.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -17,7 +17,7 @@
 
 #include <cstddef>
 
-#include <boost/mpl/assert.hpp>
+#include <boost/geometry/algorithms/not_implemented.hpp>
 
 #include <boost/geometry/core/tag.hpp>
 #include <boost/geometry/core/tags.hpp>
@@ -35,19 +35,22 @@
 {
 
 
-template <typename Tag, typename Geometry>
-struct num_geometries
-{
- BOOST_MPL_ASSERT_MSG
- (
- false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
- , (types<Geometry>)
- );
-};
+template
+<
+ typename Geometry,
+ typename Tag = typename tag_cast
+ <
+ typename tag<Geometry>::type,
+ single_tag,
+ multi_tag
+ >::type
+>
+struct num_geometries: not_implemented<Tag>
+{};
 
 
 template <typename Geometry>
-struct num_geometries<single_tag, Geometry>
+struct num_geometries<Geometry, single_tag>
 {
     static inline std::size_t apply(Geometry const&)
     {
@@ -76,16 +79,7 @@
 {
     concept::check<Geometry const>();
 
- return dispatch::num_geometries
- <
- typename tag_cast
- <
- typename tag<Geometry>::type,
- single_tag,
- multi_tag
- >::type,
- Geometry
- >::apply(geometry);
+ return dispatch::num_geometries<Geometry>::apply(geometry);
 }
 
 

Modified: branches/release/boost/geometry/algorithms/num_interior_rings.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/num_interior_rings.hpp (original)
+++ branches/release/boost/geometry/algorithms/num_interior_rings.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -32,7 +32,7 @@
 {
 
 
-template <typename Tag, typename Geometry>
+template <typename Geometry, typename Tag = typename tag<Geometry>::type>
 struct num_interior_rings
 {
     static inline std::size_t apply(Geometry const& )
@@ -44,7 +44,7 @@
 
 
 template <typename Polygon>
-struct num_interior_rings<polygon_tag, Polygon>
+struct num_interior_rings<Polygon, polygon_tag>
 {
     static inline std::size_t apply(Polygon const& polygon)
     {
@@ -74,11 +74,7 @@
 template <typename Geometry>
 inline std::size_t num_interior_rings(Geometry const& geometry)
 {
- return dispatch::num_interior_rings
- <
- typename tag<Geometry>::type,
- Geometry
- >::apply(geometry);
+ return dispatch::num_interior_rings<Geometry>::apply(geometry);
 }
 
 

Modified: branches/release/boost/geometry/algorithms/num_points.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/num_points.hpp (original)
+++ branches/release/boost/geometry/algorithms/num_points.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -16,7 +16,6 @@
 
 #include <cstddef>
 
-#include <boost/mpl/assert.hpp>
 #include <boost/range.hpp>
 #include <boost/typeof/typeof.hpp>
 
@@ -27,6 +26,7 @@
 #include <boost/geometry/core/tag_cast.hpp>
 
 #include <boost/geometry/algorithms/disjoint.hpp>
+#include <boost/geometry/algorithms/not_implemented.hpp>
 #include <boost/geometry/geometries/concepts/check.hpp>
 
 
@@ -38,9 +38,9 @@
 {
 
 
-template <typename Range>
 struct range_count
 {
+ template <typename Range>
     static inline std::size_t apply(Range const& range, bool add_for_open)
     {
         std::size_t n = boost::size(range);
@@ -60,30 +60,31 @@
     }
 };
 
-template <typename Geometry, std::size_t D>
+template <std::size_t D>
 struct other_count
 {
+ template <typename Geometry>
     static inline std::size_t apply(Geometry const&, bool)
     {
         return D;
     }
 };
 
-template <typename Polygon>
-struct polygon_count
+struct polygon_count: private range_count
 {
+ template <typename Polygon>
     static inline std::size_t apply(Polygon const& poly, bool add_for_open)
     {
         typedef typename geometry::ring_type<Polygon>::type ring_type;
 
- std::size_t n = range_count<ring_type>::apply(
+ std::size_t n = range_count::apply(
                     exterior_ring(poly), add_for_open);
 
         typename interior_return_type<Polygon const>::type rings
                     = interior_rings(poly);
         for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it)
         {
- n += range_count<ring_type>::apply(*it, add_for_open);
+ n += range_count::apply(*it, add_for_open);
         }
 
         return n;
@@ -98,44 +99,42 @@
 namespace dispatch
 {
 
-template <typename GeometryTag, typename Geometry>
-struct num_points
-{
- BOOST_MPL_ASSERT_MSG
- (
- false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
- , (types<Geometry>)
- );
-};
+template
+<
+ typename Geometry,
+ typename Tag = typename tag_cast<typename tag<Geometry>::type, multi_tag>::type
+>
+struct num_points: not_implemented<Tag>
+{};
 
 template <typename Geometry>
-struct num_points<point_tag, Geometry>
- : detail::num_points::other_count<Geometry, 1>
+struct num_points<Geometry, point_tag>
+ : detail::num_points::other_count<1>
 {};
 
 template <typename Geometry>
-struct num_points<box_tag, Geometry>
- : detail::num_points::other_count<Geometry, 4>
+struct num_points<Geometry, box_tag>
+ : detail::num_points::other_count<4>
 {};
 
 template <typename Geometry>
-struct num_points<segment_tag, Geometry>
- : detail::num_points::other_count<Geometry, 2>
+struct num_points<Geometry, segment_tag>
+ : detail::num_points::other_count<2>
 {};
 
 template <typename Geometry>
-struct num_points<linestring_tag, Geometry>
- : detail::num_points::range_count<Geometry>
+struct num_points<Geometry, linestring_tag>
+ : detail::num_points::range_count
 {};
 
 template <typename Geometry>
-struct num_points<ring_tag, Geometry>
- : detail::num_points::range_count<Geometry>
+struct num_points<Geometry, ring_tag>
+ : detail::num_points::range_count
 {};
 
 template <typename Geometry>
-struct num_points<polygon_tag, Geometry>
- : detail::num_points::polygon_count<Geometry>
+struct num_points<Geometry, polygon_tag>
+ : detail::num_points::polygon_count
 {};
 
 } // namespace dispatch
@@ -158,11 +157,7 @@
 {
     concept::check<Geometry const>();
 
- return dispatch::num_points
- <
- typename tag_cast<typename tag<Geometry>::type, multi_tag>::type,
- Geometry
- >::apply(geometry, add_for_open);
+ return dispatch::num_points<Geometry>::apply(geometry, add_for_open);
 }
 
 }} // namespace boost::geometry

Modified: branches/release/boost/geometry/algorithms/perimeter.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/perimeter.hpp (original)
+++ branches/release/boost/geometry/algorithms/perimeter.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -33,40 +33,43 @@
 {
 
 // Default perimeter is 0.0, specializations implement calculated values
-template <typename Tag, typename Geometry, typename Strategy>
+template <typename Geometry, typename Tag = typename tag<Geometry>::type>
 struct perimeter : detail::calculate_null
- <
- typename default_length_result<Geometry>::type,
- Geometry,
- Strategy
- >
-{};
+{
+ typedef typename default_length_result<Geometry>::type return_type;
+
+ template <typename Strategy>
+ static inline return_type apply(Geometry const& geometry, Strategy const& strategy)
+ {
+ return calculate_null::apply<return_type>(geometry, strategy);
+ }
+};
 
-template <typename Geometry, typename Strategy>
-struct perimeter<ring_tag, Geometry, Strategy>
+template <typename Geometry>
+struct perimeter<Geometry, ring_tag>
     : detail::length::range_length
         <
             Geometry,
- Strategy,
             closure<Geometry>::value
>
 {};
 
-template <typename Polygon, typename Strategy>
-struct perimeter<polygon_tag, Polygon, Strategy>
- : detail::calculate_polygon_sum
- <
- typename default_length_result<Polygon>::type,
- Polygon,
- Strategy,
- detail::length::range_length
+template <typename Polygon>
+struct perimeter<Polygon, polygon_tag> : detail::calculate_polygon_sum
+{
+ typedef typename default_length_result<Polygon>::type return_type;
+ typedef detail::length::range_length
                 <
                     typename ring_type<Polygon>::type,
- Strategy,
                     closure<Polygon>::value
- >
- >
-{};
+ > policy;
+
+ template <typename Strategy>
+ static inline return_type apply(Polygon const& polygon, Strategy const& strategy)
+ {
+ return calculate_polygon_sum::apply<return_type, policy>(polygon, strategy);
+ }
+};
 
 
 // box,n-sphere: to be implemented
@@ -100,12 +103,7 @@
 
     // detail::throw_on_empty_input(geometry);
         
- return dispatch::perimeter
- <
- typename tag<Geometry>::type,
- Geometry,
- strategy_type
- >::apply(geometry, strategy_type());
+ return dispatch::perimeter<Geometry>::apply(geometry, strategy_type());
 }
 
 /*!
@@ -130,12 +128,7 @@
 
     // detail::throw_on_empty_input(geometry);
     
- return dispatch::perimeter
- <
- typename tag<Geometry>::type,
- Geometry,
- Strategy
- >::apply(geometry, strategy);
+ return dispatch::perimeter<Geometry>::apply(geometry, strategy);
 }
 
 }} // namespace boost::geometry

Modified: branches/release/boost/geometry/algorithms/reverse.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/reverse.hpp (original)
+++ branches/release/boost/geometry/algorithms/reverse.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -32,9 +32,9 @@
 {
 
 
-template <typename Range>
 struct range_reverse
 {
+ template <typename Range>
     static inline void apply(Range& range)
     {
         std::reverse(boost::begin(range), boost::end(range));
@@ -42,21 +42,20 @@
 };
 
 
-template <typename Polygon>
-struct polygon_reverse
+struct polygon_reverse: private range_reverse
 {
+ template <typename Polygon>
     static inline void apply(Polygon& polygon)
     {
         typedef typename geometry::ring_type<Polygon>::type ring_type;
 
- typedef range_reverse<ring_type> per_range;
- per_range::apply(exterior_ring(polygon));
+ range_reverse::apply(exterior_ring(polygon));
 
         typename interior_return_type<Polygon>::type rings
                     = interior_rings(polygon);
         for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it)
         {
- per_range::apply(*it);
+ range_reverse::apply(*it);
         }
     }
 };
@@ -71,11 +70,7 @@
 {
 
 
-template
-<
- typename Tag,
- typename Geometry
->
+template <typename Geometry, typename Tag = typename tag<Geometry>::type>
 struct reverse
 {
     static inline void apply(Geometry&)
@@ -84,20 +79,20 @@
 
 
 template <typename Ring>
-struct reverse<ring_tag, Ring>
- : detail::reverse::range_reverse<Ring>
+struct reverse<Ring, ring_tag>
+ : detail::reverse::range_reverse
 {};
 
 
 template <typename LineString>
-struct reverse<linestring_tag, LineString>
- : detail::reverse::range_reverse<LineString>
+struct reverse<LineString, linestring_tag>
+ : detail::reverse::range_reverse
 {};
 
 
 template <typename Polygon>
-struct reverse<polygon_tag, Polygon>
- : detail::reverse::polygon_reverse<Polygon>
+struct reverse<Polygon, polygon_tag>
+ : detail::reverse::polygon_reverse
 {};
 
 
@@ -121,11 +116,7 @@
 {
     concept::check<Geometry>();
 
- dispatch::reverse
- <
- typename tag<Geometry>::type,
- Geometry
- >::apply(geometry);
+ dispatch::reverse<Geometry>::apply(geometry);
 }
 
 }} // namespace boost::geometry

Modified: branches/release/boost/geometry/algorithms/simplify.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/simplify.hpp (original)
+++ branches/release/boost/geometry/algorithms/simplify.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -33,6 +33,7 @@
 
 #include <boost/geometry/algorithms/clear.hpp>
 #include <boost/geometry/algorithms/convert.hpp>
+#include <boost/geometry/algorithms/not_implemented.hpp>
 #include <boost/geometry/algorithms/num_interior_rings.hpp>
 
 
@@ -43,12 +44,11 @@
 namespace detail { namespace simplify
 {
 
-template<typename Range, typename Strategy>
 struct simplify_range_insert
 {
- template <typename OutputIterator, typename Distance>
+ template<typename Range, typename Strategy, typename OutputIterator, typename Distance>
     static inline void apply(Range const& range, OutputIterator out,
- Distance const& max_distance, Strategy const& strategy)
+ Distance const& max_distance, Strategy const& strategy)
     {
         if (boost::size(range) <= 2 || max_distance < 0)
         {
@@ -62,12 +62,11 @@
 };
 
 
-template<typename Range, typename Strategy>
 struct simplify_copy
 {
- template <typename Distance>
+ template <typename Range, typename Strategy, typename Distance>
     static inline void apply(Range const& range, Range& out,
- Distance const& , Strategy const& )
+ Distance const& , Strategy const& )
     {
         std::copy
             (
@@ -77,10 +76,10 @@
 };
 
 
-template<typename Range, typename Strategy, std::size_t Minimum>
+template<std::size_t Minimum>
 struct simplify_range
 {
- template <typename Distance>
+ template <typename Range, typename Strategy, typename Distance>
     static inline void apply(Range const& range, Range& out,
                     Distance const& max_distance, Strategy const& strategy)
     {
@@ -101,14 +100,11 @@
 
         if (boost::size(range) <= int(Minimum) || max_distance < 0.0)
         {
- simplify_copy<Range, Strategy>::apply
- (
- range, out, max_distance, strategy
- );
+ simplify_copy::apply(range, out, max_distance, strategy);
         }
         else
         {
- simplify_range_insert<Range, Strategy>::apply
+ simplify_range_insert::apply
                 (
                     range, std::back_inserter(out), max_distance, strategy
                 );
@@ -116,10 +112,9 @@
     }
 };
 
-template<typename Polygon, typename Strategy>
 struct simplify_polygon
 {
- template <typename Distance>
+ template <typename Polygon, typename Strategy, typename Distance>
     static inline void apply(Polygon const& poly_in, Polygon& poly_out,
                     Distance const& max_distance, Strategy const& strategy)
     {
@@ -133,9 +128,9 @@
         // Note that if there are inner rings, and distance is too large,
         // they might intersect with the outer ring in the output,
         // while it didn't in the input.
- simplify_range<ring_type, Strategy, Minimum>::apply(exterior_ring(poly_in),
- exterior_ring(poly_out),
- max_distance, strategy);
+ simplify_range<Minimum>::apply(exterior_ring(poly_in),
+ exterior_ring(poly_out),
+ max_distance, strategy);
 
         traits::resize
             <
@@ -154,8 +149,7 @@
             it_in != boost::end(rings_in);
             ++it_in, ++it_out)
         {
- simplify_range<ring_type, Strategy, Minimum>::apply(*it_in,
- *it_out, max_distance, strategy);
+ simplify_range<Minimum>::apply(*it_in, *it_out, max_distance, strategy);
         }
     }
 };
@@ -169,15 +163,18 @@
 namespace dispatch
 {
 
-template <typename Tag, typename Geometry, typename Strategy>
-struct simplify
-{
-};
+template
+<
+ typename Geometry,
+ typename Tag = typename tag<Geometry>::type
+>
+struct simplify: not_implemented<Tag>
+{};
 
-template <typename Point, typename Strategy>
-struct simplify<point_tag, Point, Strategy>
+template <typename Point>
+struct simplify<Point, point_tag>
 {
- template <typename Distance>
+ template <typename Distance, typename Strategy>
     static inline void apply(Point const& point, Point& out,
                     Distance const& , Strategy const& )
     {
@@ -186,22 +183,15 @@
 };
 
 
-template <typename Linestring, typename Strategy>
-struct simplify<linestring_tag, Linestring, Strategy>
- : detail::simplify::simplify_range
- <
- Linestring,
- Strategy,
- 2
- >
+template <typename Linestring>
+struct simplify<Linestring, linestring_tag>
+ : detail::simplify::simplify_range<2>
 {};
 
-template <typename Ring, typename Strategy>
-struct simplify<ring_tag, Ring, Strategy>
+template <typename Ring>
+struct simplify<Ring, ring_tag>
     : detail::simplify::simplify_range
             <
- Ring,
- Strategy,
                 core_detail::closure::minimum_ring_size
                     <
                         geometry::closure<Ring>::value
@@ -209,38 +199,29 @@
>
 {};
 
-template <typename Polygon, typename Strategy>
-struct simplify<polygon_tag, Polygon, Strategy>
+template <typename Polygon>
+struct simplify<Polygon, polygon_tag>
     : detail::simplify::simplify_polygon
- <
- Polygon,
- Strategy
- >
 {};
 
 
-template <typename Tag, typename Geometry, typename Strategy>
-struct simplify_insert
-{
-};
+template
+<
+ typename Geometry,
+ typename Tag = typename tag<Geometry>::type
+>
+struct simplify_insert: not_implemented<Tag>
+{};
 
 
-template <typename Linestring, typename Strategy>
-struct simplify_insert<linestring_tag, Linestring, Strategy>
+template <typename Linestring>
+struct simplify_insert<Linestring, linestring_tag>
     : detail::simplify::simplify_range_insert
- <
- Linestring,
- Strategy
- >
 {};
 
-template <typename Ring, typename Strategy>
-struct simplify_insert<ring_tag, Ring, Strategy>
+template <typename Ring>
+struct simplify_insert<Ring, ring_tag>
     : detail::simplify::simplify_range_insert
- <
- Ring,
- Strategy
- >
 {};
 
 
@@ -275,12 +256,7 @@
 
     geometry::clear(out);
 
- dispatch::simplify
- <
- typename tag<Geometry>::type,
- Geometry,
- Strategy
- >::apply(geometry, out, max_distance, strategy);
+ dispatch::simplify<Geometry>::apply(geometry, out, max_distance, strategy);
 }
 
 
@@ -348,12 +324,7 @@
     concept::check<Geometry const>();
     BOOST_CONCEPT_ASSERT( (geometry::concept::SimplifyStrategy<Strategy>) );
 
- dispatch::simplify_insert
- <
- typename tag<Geometry>::type,
- Geometry,
- Strategy
- >::apply(geometry, out, max_distance, strategy);
+ dispatch::simplify_insert<Geometry>::apply(geometry, out, max_distance, strategy);
 }
 
 /*!
@@ -387,12 +358,7 @@
             point_type, ds_strategy_type
> strategy_type;
 
- dispatch::simplify_insert
- <
- typename tag<Geometry>::type,
- Geometry,
- strategy_type
- >::apply(geometry, out, max_distance, strategy_type());
+ dispatch::simplify_insert<Geometry>::apply(geometry, out, max_distance, strategy_type());
 }
 
 }} // namespace detail::simplify

Modified: branches/release/boost/geometry/algorithms/sym_difference.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/sym_difference.hpp (original)
+++ branches/release/boost/geometry/algorithms/sym_difference.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -59,35 +59,20 @@
 
     out = geometry::dispatch::intersection_insert
         <
- typename geometry::tag<Geometry1>::type,
- typename geometry::tag<Geometry2>::type,
- typename geometry::tag<GeometryOut>::type,
- geometry::is_areal<Geometry1>::value,
- geometry::is_areal<Geometry2>::value,
- geometry::is_areal<GeometryOut>::value,
             Geometry1, Geometry2,
- geometry::detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
- geometry::detail::overlay::do_reverse<geometry::point_order<Geometry2>::value, true>::value,
- geometry::detail::overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value,
- OutputIterator, GeometryOut,
+ GeometryOut,
             overlay_difference,
- Strategy
+ geometry::detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
+ geometry::detail::overlay::do_reverse<geometry::point_order<Geometry2>::value, true>::value
>::apply(geometry1, geometry2, out, strategy);
     out = geometry::dispatch::intersection_insert
         <
- typename geometry::tag<Geometry2>::type,
- typename geometry::tag<Geometry1>::type,
- typename geometry::tag<GeometryOut>::type,
- geometry::is_areal<Geometry2>::value,
- geometry::is_areal<Geometry1>::value,
- geometry::is_areal<GeometryOut>::value,
             Geometry2, Geometry1,
+ GeometryOut,
+ overlay_difference,
             geometry::detail::overlay::do_reverse<geometry::point_order<Geometry2>::value>::value,
             geometry::detail::overlay::do_reverse<geometry::point_order<Geometry1>::value, true>::value,
- geometry::detail::overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value,
- OutputIterator, GeometryOut,
- overlay_difference,
- Strategy
+ geometry::detail::overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value
>::apply(geometry2, geometry1, out, strategy);
     return out;
 }

Modified: branches/release/boost/geometry/algorithms/transform.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/transform.hpp (original)
+++ branches/release/boost/geometry/algorithms/transform.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -41,9 +41,9 @@
 namespace detail { namespace transform
 {
 
-template <typename Point1, typename Point2, typename Strategy>
 struct transform_point
 {
+ template <typename Point1, typename Point2, typename Strategy>
     static inline bool apply(Point1 const& p1, Point2& p2,
                 Strategy const& strategy)
     {
@@ -52,9 +52,9 @@
 };
 
 
-template <typename Box1, typename Box2, typename Strategy>
 struct transform_box
 {
+ template <typename Box1, typename Box2, typename Strategy>
     static inline bool apply(Box1 const& b1, Box2& b2,
                 Strategy const& strategy)
     {
@@ -91,9 +91,9 @@
     }
 };
 
-template <typename Geometry1, typename Geometry2, typename Strategy>
 struct transform_box_or_segment
 {
+ template <typename Geometry1, typename Geometry2, typename Strategy>
     static inline bool apply(Geometry1 const& source, Geometry2& target,
                 Strategy const& strategy)
     {
@@ -133,12 +133,7 @@
         it != boost::end(range);
         ++it)
     {
- if (! transform_point
- <
- typename point_type<Range>::type,
- PointOut,
- Strategy
- >::apply(*it, point_out, strategy))
+ if (! transform_point::apply(*it, point_out, strategy))
         {
             return false;
         }
@@ -148,9 +143,9 @@
 }
 
 
-template <typename Polygon1, typename Polygon2, typename Strategy>
 struct transform_polygon
 {
+ template <typename Polygon1, typename Polygon2, typename Strategy>
     static inline bool apply(Polygon1 const& poly1, Polygon2& poly2,
                 Strategy const& strategy)
     {
@@ -211,9 +206,9 @@
>::type type;
 };
 
-template <typename Range1, typename Range2, typename Strategy>
 struct transform_range
 {
+ template <typename Range1, typename Range2, typename Strategy>
     static inline bool apply(Range1 const& range1,
             Range2& range2, Strategy const& strategy)
     {
@@ -236,50 +231,50 @@
 
 template
 <
- typename Tag1, typename Tag2,
     typename Geometry1, typename Geometry2,
- typename Strategy
+ typename Tag1 = typename tag_cast<typename tag<Geometry1>::type, multi_tag>::type,
+ typename Tag2 = typename tag_cast<typename tag<Geometry2>::type, multi_tag>::type
>
 struct transform {};
 
-template <typename Point1, typename Point2, typename Strategy>
-struct transform<point_tag, point_tag, Point1, Point2, Strategy>
- : detail::transform::transform_point<Point1, Point2, Strategy>
+template <typename Point1, typename Point2>
+struct transform<Point1, Point2, point_tag, point_tag>
+ : detail::transform::transform_point
 {
 };
 
 
-template <typename Linestring1, typename Linestring2, typename Strategy>
+template <typename Linestring1, typename Linestring2>
 struct transform
     <
- linestring_tag, linestring_tag,
- Linestring1, Linestring2, Strategy
+ Linestring1, Linestring2,
+ linestring_tag, linestring_tag
>
- : detail::transform::transform_range<Linestring1, Linestring2, Strategy>
+ : detail::transform::transform_range
 {
 };
 
-template <typename Range1, typename Range2, typename Strategy>
-struct transform<ring_tag, ring_tag, Range1, Range2, Strategy>
- : detail::transform::transform_range<Range1, Range2, Strategy>
+template <typename Range1, typename Range2>
+struct transform<Range1, Range2, ring_tag, ring_tag>
+ : detail::transform::transform_range
 {
 };
 
-template <typename Polygon1, typename Polygon2, typename Strategy>
-struct transform<polygon_tag, polygon_tag, Polygon1, Polygon2, Strategy>
- : detail::transform::transform_polygon<Polygon1, Polygon2, Strategy>
+template <typename Polygon1, typename Polygon2>
+struct transform<Polygon1, Polygon2, polygon_tag, polygon_tag>
+ : detail::transform::transform_polygon
 {
 };
 
-template <typename Box1, typename Box2, typename Strategy>
-struct transform<box_tag, box_tag, Box1, Box2, Strategy>
- : detail::transform::transform_box<Box1, Box2, Strategy>
+template <typename Box1, typename Box2>
+struct transform<Box1, Box2, box_tag, box_tag>
+ : detail::transform::transform_box
 {
 };
 
-template <typename Segment1, typename Segment2, typename Strategy>
-struct transform<segment_tag, segment_tag, Segment1, Segment2, Strategy>
- : detail::transform::transform_box_or_segment<Segment1, Segment2, Strategy>
+template <typename Segment1, typename Segment2>
+struct transform<Segment1, Segment2, segment_tag, segment_tag>
+ : detail::transform::transform_box_or_segment
 {
 };
 
@@ -310,14 +305,7 @@
     concept::check<Geometry1 const>();
     concept::check<Geometry2>();
 
- typedef dispatch::transform
- <
- typename tag_cast<typename tag<Geometry1>::type, multi_tag>::type,
- typename tag_cast<typename tag<Geometry2>::type, multi_tag>::type,
- Geometry1,
- Geometry2,
- Strategy
- > transform_type;
+ typedef dispatch::transform<Geometry1, Geometry2> transform_type;
 
     return transform_type::apply(geometry1, geometry2, strategy);
 }

Modified: branches/release/boost/geometry/algorithms/union.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/union.hpp (original)
+++ branches/release/boost/geometry/algorithms/union.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -10,14 +10,13 @@
 #define BOOST_GEOMETRY_ALGORITHMS_UNION_HPP
 
 
-#include <boost/mpl/if.hpp>
-
 #include <boost/range/metafunctions.hpp>
 
 #include <boost/geometry/core/is_areal.hpp>
 #include <boost/geometry/core/point_order.hpp>
 #include <boost/geometry/core/reverse_dispatch.hpp>
 #include <boost/geometry/geometries/concepts/check.hpp>
+#include <boost/geometry/algorithms/not_implemented.hpp>
 #include <boost/geometry/algorithms/detail/overlay/overlay.hpp>
 
 
@@ -30,78 +29,70 @@
 
 template
 <
- // tag dispatching:
- typename TagIn1, typename TagIn2, typename TagOut,
- // metafunction finetuning helpers:
- bool Areal1, bool Areal2, bool ArealOut,
- // real types
- typename Geometry1, typename Geometry2,
- bool Reverse1, bool Reverse2, bool ReverseOut,
- typename OutputIterator,
- typename GeometryOut,
- typename Strategy
+ typename Geometry1, typename Geometry2, typename GeometryOut,
+ typename TagIn1 = typename tag<Geometry1>::type,
+ typename TagIn2 = typename tag<Geometry2>::type,
+ typename TagOut = typename tag<GeometryOut>::type,
+ bool Areal1 = geometry::is_areal<Geometry1>::value,
+ bool Areal2 = geometry::is_areal<Geometry2>::value,
+ bool ArealOut = geometry::is_areal<GeometryOut>::value,
+ bool Reverse1 = detail::overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
+ bool Reverse2 = detail::overlay::do_reverse<geometry::point_order<Geometry2>::value>::value,
+ bool ReverseOut = detail::overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value,
+ bool Reverse = geometry::reverse_dispatch<Geometry1, Geometry2>::type::value
>
-struct union_insert
-{
- BOOST_MPL_ASSERT_MSG
- (
- false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPES
- , (types<Geometry1, Geometry2, GeometryOut>)
- );
-};
+struct union_insert: not_implemented<TagIn1, TagIn2, TagOut>
+{};
+
 
+// If reversal is needed, perform it first
 
 template
 <
+ typename Geometry1, typename Geometry2, typename GeometryOut,
     typename TagIn1, typename TagIn2, typename TagOut,
- typename Geometry1, typename Geometry2,
- bool Reverse1, bool Reverse2, bool ReverseOut,
- typename OutputIterator,
- typename GeometryOut,
- typename Strategy
+ bool Reverse1, bool Reverse2, bool ReverseOut
>
 struct union_insert
     <
+ Geometry1, Geometry2, GeometryOut,
         TagIn1, TagIn2, TagOut,
         true, true, true,
- Geometry1, Geometry2,
         Reverse1, Reverse2, ReverseOut,
- OutputIterator, GeometryOut,
- Strategy
- > : detail::overlay::overlay
- <Geometry1, Geometry2, Reverse1, Reverse2, ReverseOut, OutputIterator, GeometryOut, overlay_union, Strategy>
-{};
-
-
-
-template
-<
- typename GeometryTag1, typename GeometryTag2, typename GeometryTag3,
- bool Areal1, bool Areal2, bool ArealOut,
- typename Geometry1, typename Geometry2,
- bool Reverse1, bool Reverse2, bool ReverseOut,
- typename OutputIterator, typename GeometryOut,
- typename Strategy
->
-struct union_insert_reversed
+ true
+ >: union_insert<Geometry2, Geometry1, GeometryOut>
 {
+ template <typename OutputIterator, typename Strategy>
     static inline OutputIterator apply(Geometry1 const& g1,
             Geometry2 const& g2, OutputIterator out,
             Strategy const& strategy)
     {
         return union_insert
             <
- GeometryTag2, GeometryTag1, GeometryTag3,
- Areal2, Areal1, ArealOut,
- Geometry2, Geometry1,
- Reverse2, Reverse1, ReverseOut,
- OutputIterator, GeometryOut,
- Strategy
+ Geometry2, Geometry1, GeometryOut
>::apply(g2, g1, out, strategy);
     }
 };
 
 
+template
+<
+ typename Geometry1, typename Geometry2, typename GeometryOut,
+ typename TagIn1, typename TagIn2, typename TagOut,
+ bool Reverse1, bool Reverse2, bool ReverseOut
+>
+struct union_insert
+ <
+ Geometry1, Geometry2, GeometryOut,
+ TagIn1, TagIn2, TagOut,
+ true, true, true,
+ Reverse1, Reverse2, ReverseOut,
+ false
+ > : detail::overlay::overlay
+ <Geometry1, Geometry2, Reverse1, Reverse2, ReverseOut, GeometryOut, overlay_union>
+{};
+
+
 } // namespace dispatch
 #endif // DOXYGEN_NO_DISPATCH
 
@@ -121,40 +112,10 @@
             OutputIterator out,
             Strategy const& strategy)
 {
- return boost::mpl::if_c
- <
- geometry::reverse_dispatch<Geometry1, Geometry2>::type::value,
- dispatch::union_insert_reversed
- <
- typename tag<Geometry1>::type,
- typename tag<Geometry2>::type,
- typename tag<GeometryOut>::type,
- geometry::is_areal<Geometry1>::value,
- geometry::is_areal<Geometry2>::value,
- geometry::is_areal<GeometryOut>::value,
- Geometry1, Geometry2,
- overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
- overlay::do_reverse<geometry::point_order<Geometry2>::value>::value,
- overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value,
- OutputIterator, GeometryOut,
- Strategy
- >,
- dispatch::union_insert
- <
- typename tag<Geometry1>::type,
- typename tag<Geometry2>::type,
- typename tag<GeometryOut>::type,
- geometry::is_areal<Geometry1>::value,
- geometry::is_areal<Geometry2>::value,
- geometry::is_areal<GeometryOut>::value,
- Geometry1, Geometry2,
- overlay::do_reverse<geometry::point_order<Geometry1>::value>::value,
- overlay::do_reverse<geometry::point_order<Geometry2>::value>::value,
- overlay::do_reverse<geometry::point_order<GeometryOut>::value>::value,
- OutputIterator, GeometryOut,
- Strategy
- >
- >::type::apply(geometry1, geometry2, out, strategy);
+ return dispatch::union_insert
+ <
+ Geometry1, Geometry2, GeometryOut
+ >::apply(geometry1, geometry2, out, strategy);
 }
 
 /*!

Modified: branches/release/boost/geometry/algorithms/unique.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/unique.hpp (original)
+++ branches/release/boost/geometry/algorithms/unique.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -34,9 +34,9 @@
 {
 
 
-template <typename Range, typename ComparePolicy>
 struct range_unique
 {
+ template <typename Range, typename ComparePolicy>
     static inline void apply(Range& range, ComparePolicy const& policy)
     {
         typename boost::range_iterator<Range>::type it
@@ -52,21 +52,20 @@
 };
 
 
-template <typename Polygon, typename ComparePolicy>
 struct polygon_unique
 {
+ template <typename Polygon, typename ComparePolicy>
     static inline void apply(Polygon& polygon, ComparePolicy const& policy)
     {
         typedef typename geometry::ring_type<Polygon>::type ring_type;
 
- typedef range_unique<ring_type, ComparePolicy> per_range;
- per_range::apply(exterior_ring(polygon), policy);
+ range_unique::apply(exterior_ring(polygon), policy);
 
         typename interior_return_type<Polygon>::type rings
                     = interior_rings(polygon);
         for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it)
         {
- per_range::apply(*it, policy);
+ range_unique::apply(*it, policy);
         }
     }
 };
@@ -85,32 +84,32 @@
 
 template
 <
- typename Tag,
     typename Geometry,
- typename ComparePolicy
+ typename Tag = typename tag<Geometry>::type
>
 struct unique
 {
+ template <typename ComparePolicy>
     static inline void apply(Geometry&, ComparePolicy const& )
     {}
 };
 
 
-template <typename Ring, typename ComparePolicy>
-struct unique<ring_tag, Ring, ComparePolicy>
- : detail::unique::range_unique<Ring, ComparePolicy>
+template <typename Ring>
+struct unique<Ring, ring_tag>
+ : detail::unique::range_unique
 {};
 
 
-template <typename LineString, typename ComparePolicy>
-struct unique<linestring_tag, LineString, ComparePolicy>
- : detail::unique::range_unique<LineString, ComparePolicy>
+template <typename LineString>
+struct unique<LineString, linestring_tag>
+ : detail::unique::range_unique
 {};
 
 
-template <typename Polygon, typename ComparePolicy>
-struct unique<polygon_tag, Polygon, ComparePolicy>
- : detail::unique::polygon_unique<Polygon, ComparePolicy>
+template <typename Polygon>
+struct unique<Polygon, polygon_tag>
+ : detail::unique::polygon_unique
 {};
 
 
@@ -139,12 +138,7 @@
> policy;
 
 
- dispatch::unique
- <
- typename tag<Geometry>::type,
- Geometry,
- policy
- >::apply(geometry, policy());
+ dispatch::unique<Geometry>::apply(geometry, policy());
 }
 
 }} // namespace boost::geometry

Modified: branches/release/boost/geometry/multi/algorithms/area.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/area.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/area.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -30,21 +30,20 @@
 #ifndef DOXYGEN_NO_DISPATCH
 namespace dispatch
 {
-template <typename MultiGeometry, typename Strategy>
-struct area<MultiGeometry, Strategy, multi_polygon_tag>
- : detail::multi_sum
- <
- typename Strategy::return_type,
- MultiGeometry,
- Strategy,
- area
- <
- typename boost::range_value<MultiGeometry>::type,
- Strategy,
- polygon_tag
- >
- >
-{};
+template <typename MultiGeometry>
+struct area<MultiGeometry, multi_polygon_tag> : detail::multi_sum
+{
+ template <typename Strategy>
+ static inline typename Strategy::return_type
+ apply(MultiGeometry const& multi, Strategy const& strategy)
+ {
+ return multi_sum::apply
+ <
+ typename Strategy::return_type,
+ area<typename boost::range_value<MultiGeometry>::type>
+ >(multi, strategy);
+ }
+};
 
 
 } // namespace dispatch

Modified: branches/release/boost/geometry/multi/algorithms/centroid.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/centroid.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/centroid.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -35,13 +35,9 @@
     \brief Building block of a multi-point, to be used as Policy in the
         more generec centroid_multi
 */
-template
-<
- typename Point,
- typename Strategy
->
 struct centroid_multi_point_state
 {
+ template <typename Point, typename Strategy>
     static inline void apply(Point const& point,
             Strategy const& strategy, typename Strategy::state_type& state)
     {
@@ -59,15 +55,10 @@
         detail::centroid::centroid_multi
 
 */
-template
-<
- typename Multi,
- typename Point,
- typename Strategy,
- typename Policy
->
+template <typename Policy>
 struct centroid_multi
 {
+ template <typename Multi, typename Point, typename Strategy>
     static inline void apply(Multi const& multi, Point& centroid,
             Strategy const& strategy)
     {
@@ -104,65 +95,28 @@
 namespace dispatch
 {
 
-template
-<
- typename MultiLinestring,
- typename Point,
- typename Strategy
->
-struct centroid<multi_linestring_tag, MultiLinestring, Point, Strategy>
+template <typename MultiLinestring>
+struct centroid<MultiLinestring, multi_linestring_tag>
     : detail::centroid::centroid_multi
         <
- MultiLinestring,
- Point,
- Strategy,
- detail::centroid::centroid_range_state
- <
- typename boost::range_value<MultiLinestring>::type,
- closed,
- Strategy
- >
+ detail::centroid::centroid_range_state<closed>
>
 {};
 
-template
-<
- typename MultiPolygon,
- typename Point,
- typename Strategy
->
-struct centroid<multi_polygon_tag, MultiPolygon, Point, Strategy>
+template <typename MultiPolygon>
+struct centroid<MultiPolygon, multi_polygon_tag>
     : detail::centroid::centroid_multi
         <
- MultiPolygon,
- Point,
- Strategy,
             detail::centroid::centroid_polygon_state
- <
- typename boost::range_value<MultiPolygon>::type,
- Strategy
- >
>
 {};
 
 
-template
-<
- typename MultiPoint,
- typename Point,
- typename Strategy
->
-struct centroid<multi_point_tag, MultiPoint, Point, Strategy>
+template <typename MultiPoint>
+struct centroid<MultiPoint, multi_point_tag>
     : detail::centroid::centroid_multi
         <
- MultiPoint,
- Point,
- Strategy,
             detail::centroid::centroid_multi_point_state
- <
- typename boost::range_value<MultiPoint>::type,
- Strategy
- >
>
 {};
 

Modified: branches/release/boost/geometry/multi/algorithms/detail/multi_sum.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/detail/multi_sum.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/detail/multi_sum.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -23,15 +23,9 @@
 namespace detail
 {
 
-template
-<
- typename ReturnType,
- typename MultiGeometry,
- typename Strategy,
- typename Policy
->
 struct multi_sum
 {
+ template <typename ReturnType, typename Policy, typename MultiGeometry, typename Strategy>
     static inline ReturnType apply(MultiGeometry const& geometry, Strategy const& strategy)
     {
         ReturnType sum = ReturnType();

Modified: branches/release/boost/geometry/multi/algorithms/for_each.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/for_each.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/for_each.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -36,24 +36,16 @@
 
 // Implementation of multi, for both point and segment,
 // just calling the single version.
-template
-<
- typename MultiGeometry,
- typename Functor,
- bool IsConst,
- typename Policy
->
+template <typename Policy>
 struct for_each_multi
 {
- static inline Functor apply(
- typename add_const_if_c<IsConst, MultiGeometry>::type& multi,
- Functor f)
+ template <typename MultiGeometry, typename Functor>
+ static inline void apply(MultiGeometry& multi, Functor& f)
     {
         for(BOOST_AUTO_TPL(it, boost::begin(multi)); it != boost::end(multi); ++it)
         {
- f = Policy::apply(*it, f);
+ Policy::apply(*it, f);
         }
- return f;
     }
 };
 
@@ -66,55 +58,35 @@
 namespace dispatch
 {
 
-template
-<
- typename MultiGeometry,
- typename Functor,
- bool IsConst
->
-struct for_each_point<multi_tag, MultiGeometry, Functor, IsConst>
+template <typename MultiGeometry>
+struct for_each_point<MultiGeometry, multi_tag>
     : detail::for_each::for_each_multi
         <
- MultiGeometry,
- Functor,
- IsConst,
             // Specify the dispatch of the single-version as policy
             for_each_point
                 <
- typename single_tag_of
+ typename add_const_if_c
                         <
- typename tag<MultiGeometry>::type
- >::type,
- typename boost::range_value<MultiGeometry>::type,
- Functor,
- IsConst
+ is_const<MultiGeometry>::value,
+ typename boost::range_value<MultiGeometry>::type
+ >::type
>
>
 {};
 
 
-template
-<
- typename MultiGeometry,
- typename Functor,
- bool IsConst
->
-struct for_each_segment<multi_tag, MultiGeometry, Functor, IsConst>
+template <typename MultiGeometry>
+struct for_each_segment<MultiGeometry, multi_tag>
     : detail::for_each::for_each_multi
         <
- MultiGeometry,
- Functor,
- IsConst,
             // Specify the dispatch of the single-version as policy
             for_each_segment
                 <
- typename single_tag_of
+ typename add_const_if_c
                         <
- typename tag<MultiGeometry>::type
- >::type,
- typename boost::range_value<MultiGeometry>::type,
- Functor,
- IsConst
+ is_const<MultiGeometry>::value,
+ typename boost::range_value<MultiGeometry>::type
+ >::type
>
>
 {};

Modified: branches/release/boost/geometry/multi/algorithms/intersection.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/intersection.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/intersection.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -36,14 +36,14 @@
 {
 
 
-template
-<
- typename MultiLinestring1, typename MultiLinestring2,
- typename OutputIterator, typename PointOut,
- typename Strategy
->
+template <typename PointOut>
 struct intersection_multi_linestring_multi_linestring_point
 {
+ template
+ <
+ typename MultiLinestring1, typename MultiLinestring2,
+ typename OutputIterator, typename Strategy
+ >
     static inline OutputIterator apply(MultiLinestring1 const& ml1,
             MultiLinestring2 const& ml2, OutputIterator out,
             Strategy const& strategy)
@@ -64,12 +64,8 @@
                 it2 != boost::end(ml2);
                 ++it2)
             {
- out = intersection_linestring_linestring_point
- <
- typename boost::range_value<MultiLinestring1>::type,
- typename boost::range_value<MultiLinestring2>::type,
- OutputIterator, PointOut, Strategy
- >::apply(*it1, *it2, out, strategy);
+ out = intersection_linestring_linestring_point<PointOut>
+ ::apply(*it1, *it2, out, strategy);
             }
         }
 
@@ -78,14 +74,14 @@
 };
 
 
-template
-<
- typename Linestring, typename MultiLinestring,
- typename OutputIterator, typename PointOut,
- typename Strategy
->
+template <typename PointOut>
 struct intersection_linestring_multi_linestring_point
 {
+ template
+ <
+ typename Linestring, typename MultiLinestring,
+ typename OutputIterator, typename Strategy
+ >
     static inline OutputIterator apply(Linestring const& linestring,
             MultiLinestring const& ml, OutputIterator out,
             Strategy const& strategy)
@@ -97,12 +93,8 @@
             it != boost::end(ml);
             ++it)
         {
- out = intersection_linestring_linestring_point
- <
- Linestring,
- typename boost::range_value<MultiLinestring>::type,
- OutputIterator, PointOut, Strategy
- >::apply(linestring, *it, out, strategy);
+ out = intersection_linestring_linestring_point<PointOut>
+ ::apply(linestring, *it, out, strategy);
         }
 
         return out;
@@ -114,14 +106,17 @@
 // is second (above) or first (below) argument, it is not trivial to merge them.
 template
 <
- typename MultiLinestring, typename Areal,
     bool ReverseAreal,
- typename OutputIterator, typename LineStringOut,
- overlay_type OverlayType,
- typename Strategy
+ typename LineStringOut,
+ overlay_type OverlayType
>
 struct intersection_of_multi_linestring_with_areal
 {
+ template
+ <
+ typename MultiLinestring, typename Areal,
+ typename OutputIterator, typename Strategy
+ >
     static inline OutputIterator apply(MultiLinestring const& ml, Areal const& areal,
             OutputIterator out,
             Strategy const& strategy)
@@ -135,9 +130,7 @@
         {
             out = intersection_of_linestring_with_areal
                 <
- typename boost::range_value<MultiLinestring>::type,
- Areal, ReverseAreal,
- OutputIterator, LineStringOut, OverlayType, Strategy
+ ReverseAreal, LineStringOut, OverlayType
>::apply(*it, areal, out, strategy);
         }
 
@@ -149,38 +142,38 @@
 // This one calls the one above with reversed arguments
 template
 <
- typename Areal, typename MultiLinestring,
     bool ReverseAreal,
- typename OutputIterator, typename LineStringOut,
- overlay_type OverlayType,
- typename Strategy
+ typename LineStringOut,
+ overlay_type OverlayType
>
 struct intersection_of_areal_with_multi_linestring
 {
+ template
+ <
+ typename Areal, typename MultiLinestring,
+ typename OutputIterator, typename Strategy
+ >
     static inline OutputIterator apply(Areal const& areal, MultiLinestring const& ml,
             OutputIterator out,
             Strategy const& strategy)
     {
         return intersection_of_multi_linestring_with_areal
             <
- MultiLinestring, Areal, ReverseAreal,
- OutputIterator, LineStringOut,
- OverlayType,
- Strategy
+ ReverseAreal, LineStringOut, OverlayType
>::apply(ml, areal, out, strategy);
     }
 };
 
 
 
-template
-<
- typename MultiLinestring, typename Box,
- typename OutputIterator, typename LinestringOut,
- typename Strategy
->
+template <typename LinestringOut>
 struct clip_multi_linestring
 {
+ template
+ <
+ typename MultiLinestring, typename Box,
+ typename OutputIterator, typename Strategy
+ >
     static inline OutputIterator apply(MultiLinestring const& multi_linestring,
             Box const& box, OutputIterator out, Strategy const& )
     {
@@ -211,25 +204,21 @@
 template
 <
     typename MultiLinestring1, typename MultiLinestring2,
- bool Reverse1, bool Reverse2, bool ReverseOut,
- typename OutputIterator, typename GeometryOut,
+ typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool Reverse1, bool Reverse2, bool ReverseOut
>
 struct intersection_insert
     <
- multi_linestring_tag, multi_linestring_tag, point_tag,
- false, false, false,
         MultiLinestring1, MultiLinestring2,
- Reverse1, Reverse2, ReverseOut,
- OutputIterator, GeometryOut,
+ GeometryOut,
         OverlayType,
- Strategy
+ Reverse1, Reverse2, ReverseOut,
+ multi_linestring_tag, multi_linestring_tag, point_tag,
+ false, false, false
> : detail::intersection::intersection_multi_linestring_multi_linestring_point
             <
- MultiLinestring1, MultiLinestring2,
- OutputIterator, GeometryOut,
- Strategy
+ GeometryOut
>
 {};
 
@@ -237,25 +226,21 @@
 template
 <
     typename Linestring, typename MultiLinestring,
- typename OutputIterator, typename GeometryOut,
- bool Reverse1, bool Reverse2, bool ReverseOut,
+ typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool Reverse1, bool Reverse2, bool ReverseOut
>
 struct intersection_insert
     <
- linestring_tag, multi_linestring_tag, point_tag,
- false, false, false,
         Linestring, MultiLinestring,
- Reverse1, Reverse2, ReverseOut,
- OutputIterator, GeometryOut,
+ GeometryOut,
         OverlayType,
- Strategy
+ Reverse1, Reverse2, ReverseOut,
+ linestring_tag, multi_linestring_tag, point_tag,
+ false, false, false
> : detail::intersection::intersection_linestring_multi_linestring_point
             <
- Linestring, MultiLinestring,
- OutputIterator, GeometryOut,
- Strategy
+ GeometryOut
>
 {};
 
@@ -263,25 +248,21 @@
 template
 <
     typename MultiLinestring, typename Box,
- bool Reverse1, bool Reverse2, bool ReverseOut,
- typename OutputIterator, typename GeometryOut,
+ typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool Reverse1, bool Reverse2, bool ReverseOut
>
 struct intersection_insert
     <
- multi_linestring_tag, box_tag, linestring_tag,
- false, true, false,
         MultiLinestring, Box,
- Reverse1, Reverse2, ReverseOut,
- OutputIterator, GeometryOut,
+ GeometryOut,
         OverlayType,
- Strategy
+ Reverse1, Reverse2, ReverseOut,
+ multi_linestring_tag, box_tag, linestring_tag,
+ false, true, false
> : detail::intersection::clip_multi_linestring
             <
- MultiLinestring, Box,
- OutputIterator, GeometryOut,
- Strategy
+ GeometryOut
>
 {};
 
@@ -289,27 +270,23 @@
 template
 <
     typename Linestring, typename MultiPolygon,
- bool ReverseLinestring, bool ReverseMultiPolygon, bool ReverseOut,
- typename OutputIterator, typename GeometryOut,
+ typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool ReverseLinestring, bool ReverseMultiPolygon, bool ReverseOut
>
 struct intersection_insert
     <
- linestring_tag, multi_polygon_tag, linestring_tag,
- false, true, false,
         Linestring, MultiPolygon,
- ReverseLinestring, ReverseMultiPolygon, ReverseOut,
- OutputIterator, GeometryOut,
+ GeometryOut,
         OverlayType,
- Strategy
+ ReverseLinestring, ReverseMultiPolygon, ReverseOut,
+ linestring_tag, multi_polygon_tag, linestring_tag,
+ false, true, false
> : detail::intersection::intersection_of_linestring_with_areal
             <
- Linestring, MultiPolygon,
                 ReverseMultiPolygon,
- OutputIterator, GeometryOut,
- OverlayType,
- Strategy
+ GeometryOut,
+ OverlayType
>
 {};
 
@@ -319,27 +296,23 @@
 template
 <
     typename Polygon, typename MultiLinestring,
- bool ReversePolygon, bool ReverseMultiLinestring, bool ReverseOut,
- typename OutputIterator, typename GeometryOut,
+ typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool ReversePolygon, bool ReverseMultiLinestring, bool ReverseOut
>
 struct intersection_insert
     <
- polygon_tag, multi_linestring_tag, linestring_tag,
- true, false, false,
         Polygon, MultiLinestring,
- ReversePolygon, ReverseMultiLinestring, ReverseOut,
- OutputIterator, GeometryOut,
+ GeometryOut,
         OverlayType,
- Strategy
+ ReversePolygon, ReverseMultiLinestring, ReverseOut,
+ polygon_tag, multi_linestring_tag, linestring_tag,
+ true, false, false
> : detail::intersection::intersection_of_areal_with_multi_linestring
             <
- Polygon, MultiLinestring,
                 ReversePolygon,
- OutputIterator, GeometryOut,
- OverlayType,
- Strategy
+ GeometryOut,
+ OverlayType
>
 {};
 
@@ -347,54 +320,46 @@
 template
 <
     typename MultiLinestring, typename Ring,
- bool ReverseMultiLinestring, bool ReverseRing, bool ReverseOut,
- typename OutputIterator, typename GeometryOut,
+ typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool ReverseMultiLinestring, bool ReverseRing, bool ReverseOut
>
 struct intersection_insert
     <
- multi_linestring_tag, ring_tag, linestring_tag,
- false, true, false,
         MultiLinestring, Ring,
- ReverseMultiLinestring, ReverseRing, ReverseOut,
- OutputIterator, GeometryOut,
+ GeometryOut,
         OverlayType,
- Strategy
+ ReverseMultiLinestring, ReverseRing, ReverseOut,
+ multi_linestring_tag, ring_tag, linestring_tag,
+ false, true, false
> : detail::intersection::intersection_of_multi_linestring_with_areal
             <
- MultiLinestring, Ring,
                 ReverseRing,
- OutputIterator, GeometryOut,
- OverlayType,
- Strategy
+ GeometryOut,
+ OverlayType
>
 {};
 
 template
 <
     typename MultiLinestring, typename Polygon,
- bool ReverseMultiLinestring, bool ReverseRing, bool ReverseOut,
- typename OutputIterator, typename GeometryOut,
+ typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool ReverseMultiLinestring, bool ReverseRing, bool ReverseOut
>
 struct intersection_insert
     <
- multi_linestring_tag, polygon_tag, linestring_tag,
- false, true, false,
         MultiLinestring, Polygon,
- ReverseMultiLinestring, ReverseRing, ReverseOut,
- OutputIterator, GeometryOut,
+ GeometryOut,
         OverlayType,
- Strategy
+ ReverseMultiLinestring, ReverseRing, ReverseOut,
+ multi_linestring_tag, polygon_tag, linestring_tag,
+ false, true, false
> : detail::intersection::intersection_of_multi_linestring_with_areal
             <
- MultiLinestring, Polygon,
                 ReverseRing,
- OutputIterator, GeometryOut,
- OverlayType,
- Strategy
+ GeometryOut,
+ OverlayType
>
 {};
 
@@ -403,27 +368,23 @@
 template
 <
     typename MultiLinestring, typename MultiPolygon,
- bool ReverseMultiLinestring, bool ReverseMultiPolygon, bool ReverseOut,
- typename OutputIterator, typename GeometryOut,
+ typename GeometryOut,
     overlay_type OverlayType,
- typename Strategy
+ bool ReverseMultiLinestring, bool ReverseMultiPolygon, bool ReverseOut
>
 struct intersection_insert
     <
- multi_linestring_tag, multi_polygon_tag, linestring_tag,
- false, true, false,
         MultiLinestring, MultiPolygon,
- ReverseMultiLinestring, ReverseMultiPolygon, ReverseOut,
- OutputIterator, GeometryOut,
+ GeometryOut,
         OverlayType,
- Strategy
+ ReverseMultiLinestring, ReverseMultiPolygon, ReverseOut,
+ multi_linestring_tag, multi_polygon_tag, linestring_tag,
+ false, true, false
> : detail::intersection::intersection_of_multi_linestring_with_areal
             <
- MultiLinestring, MultiPolygon,
                 ReverseMultiPolygon,
- OutputIterator, GeometryOut,
- OverlayType,
- Strategy
+ GeometryOut,
+ OverlayType
>
 {};
 

Modified: branches/release/boost/geometry/multi/algorithms/length.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/length.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/length.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -30,21 +30,25 @@
 namespace dispatch
 {
 
-template <typename MultiLinestring, typename Strategy>
-struct length<multi_linestring_tag, MultiLinestring, Strategy>
- : detail::multi_sum
- <
- typename default_length_result<MultiLinestring>::type,
- MultiLinestring,
- Strategy,
- detail::length::range_length
- <
- typename boost::range_value<MultiLinestring>::type,
- Strategy,
- closed // no need to close it explicitly
- >
- >
-{};
+template <typename MultiLinestring>
+struct length<MultiLinestring, multi_linestring_tag> : detail::multi_sum
+{
+ template <typename Strategy>
+ static inline typename default_length_result<MultiLinestring>::type
+ apply(MultiLinestring const& multi, Strategy const& strategy)
+ {
+ return multi_sum::apply
+ <
+ typename default_length_result<MultiLinestring>::type,
+ detail::length::range_length
+ <
+ typename boost::range_value<MultiLinestring>::type,
+ closed // no need to close it explicitly
+ >
+ >(multi, strategy);
+
+ }
+};
 
 
 } // namespace dispatch

Modified: branches/release/boost/geometry/multi/algorithms/num_geometries.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/num_geometries.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/num_geometries.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -32,7 +32,7 @@
 {
 
 template <typename MultiGeometry>
-struct num_geometries<multi_tag, MultiGeometry>
+struct num_geometries<MultiGeometry, multi_tag>
 {
     static inline std::size_t apply(MultiGeometry const& multi_geometry)
     {

Modified: branches/release/boost/geometry/multi/algorithms/num_interior_rings.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/num_interior_rings.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/num_interior_rings.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -34,7 +34,7 @@
 
 
 template <typename MultiPolygon>
-struct num_interior_rings<multi_polygon_tag, MultiPolygon>
+struct num_interior_rings<MultiPolygon, multi_polygon_tag>
 {
     static inline std::size_t apply(MultiPolygon const& multi_polygon)
     {

Modified: branches/release/boost/geometry/multi/algorithms/num_points.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/num_points.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/num_points.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -30,9 +30,9 @@
 {
 
 
-template <typename MultiGeometry>
 struct multi_count
 {
+ template <typename MultiGeometry>
     static inline size_t apply(MultiGeometry const& geometry, bool add_for_open)
     {
         typedef typename boost::range_value<MultiGeometry>::type geometry_type;
@@ -46,11 +46,7 @@
             it != boost::end(geometry);
             ++it)
         {
- n += dispatch::num_points
- <
- typename tag<geometry_type>::type,
- geometry_type
- >::apply(*it, add_for_open);
+ n += dispatch::num_points<geometry_type>::apply(*it, add_for_open);
         }
         return n;
     }
@@ -67,8 +63,8 @@
 
 
 template <typename Geometry>
-struct num_points<multi_tag, Geometry>
- : detail::num_points::multi_count<Geometry> {};
+struct num_points<Geometry, multi_tag>
+ : detail::num_points::multi_count {};
 
 
 } // namespace dispatch

Modified: branches/release/boost/geometry/multi/algorithms/perimeter.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/perimeter.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/perimeter.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -30,21 +30,20 @@
 #ifndef DOXYGEN_NO_DISPATCH
 namespace dispatch
 {
-template <typename MultiPolygon, typename Strategy>
-struct perimeter<multi_polygon_tag, MultiPolygon, Strategy>
- : detail::multi_sum
- <
- typename default_length_result<MultiPolygon>::type,
- MultiPolygon,
- Strategy,
- perimeter
- <
- polygon_tag,
- typename boost::range_value<MultiPolygon>::type,
- Strategy
- >
- >
-{};
+template <typename MultiPolygon>
+struct perimeter<MultiPolygon, multi_polygon_tag> : detail::multi_sum
+{
+ template <typename Strategy>
+ static inline typename default_length_result<MultiPolygon>::type
+ apply(MultiPolygon const& multi, Strategy const& strategy)
+ {
+ return multi_sum::apply
+ <
+ typename default_length_result<MultiPolygon>::type,
+ perimeter<typename boost::range_value<MultiPolygon>::type>
+ >(multi, strategy);
+ }
+};
 
 } // namespace dispatch
 #endif

Modified: branches/release/boost/geometry/multi/algorithms/reverse.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/reverse.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/reverse.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -34,27 +34,21 @@
 
 
 template <typename Geometry>
-struct reverse<multi_linestring_tag, Geometry>
+struct reverse<Geometry, multi_linestring_tag>
     : detail::multi_modify
         <
             Geometry,
             detail::reverse::range_reverse
- <
- typename boost::range_value<Geometry>::type
- >
>
 {};
 
 
 template <typename Geometry>
-struct reverse<multi_polygon_tag, Geometry>
+struct reverse<Geometry, multi_polygon_tag>
     : detail::multi_modify
         <
             Geometry,
             detail::reverse::polygon_reverse
- <
- typename boost::range_value<Geometry>::type
- >
>
 {};
 

Modified: branches/release/boost/geometry/multi/algorithms/simplify.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/simplify.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/simplify.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -31,9 +31,10 @@
 namespace detail { namespace simplify
 {
 
-template<typename MultiGeometry, typename Strategy, typename Policy>
+template<typename Policy>
 struct simplify_multi
 {
+ template <typename MultiGeometry, typename Strategy>
     static inline void apply(MultiGeometry const& multi, MultiGeometry& out,
                     double max_distance, Strategy const& strategy)
     {
@@ -63,47 +64,21 @@
 namespace dispatch
 {
 
-template <typename MultiPoint, typename Strategy>
-struct simplify<multi_point_tag, MultiPoint, Strategy>
+template <typename MultiPoint>
+struct simplify<MultiPoint, multi_point_tag>
     : detail::simplify::simplify_copy
- <
- MultiPoint,
- Strategy
- >
-
 {};
 
 
-template <typename MultiLinestring, typename Strategy>
-struct simplify<multi_linestring_tag, MultiLinestring, Strategy>
- : detail::simplify::simplify_multi
- <
- MultiLinestring,
- Strategy,
- detail::simplify::simplify_range
- <
- typename boost::range_value<MultiLinestring>::type,
- Strategy,
- 2
- >
- >
-
+template <typename MultiLinestring>
+struct simplify<MultiLinestring, multi_linestring_tag>
+ : detail::simplify::simplify_multi<detail::simplify::simplify_range<2> >
 {};
 
 
-template <typename MultiPolygon, typename Strategy>
-struct simplify<multi_polygon_tag, MultiPolygon, Strategy>
- : detail::simplify::simplify_multi
- <
- MultiPolygon,
- Strategy,
- detail::simplify::simplify_polygon
- <
- typename boost::range_value<MultiPolygon>::type,
- Strategy
- >
- >
-
+template <typename MultiPolygon>
+struct simplify<MultiPolygon, multi_polygon_tag>
+ : detail::simplify::simplify_multi<detail::simplify::simplify_polygon>
 {};
 
 

Modified: branches/release/boost/geometry/multi/algorithms/transform.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/transform.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/transform.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -31,10 +31,10 @@
 /*!
     \brief Is able to transform any multi-geometry, calling the single-version as policy
 */
-template <typename Multi1, typename Multi2, typename Policy>
+template <typename Policy>
 struct transform_multi
 {
- template <typename S>
+ template <typename Multi1, typename Multi2, typename S>
     static inline bool apply(Multi1 const& multi1, Multi2& multi2, S const& strategy)
     {
         traits::resize<Multi2>::apply(multi2, boost::size(multi1));
@@ -65,30 +65,18 @@
 namespace dispatch
 {
 
-template <typename Multi1, typename Multi2, typename Strategy>
+template <typename Multi1, typename Multi2>
 struct transform
     <
- multi_tag, multi_tag,
         Multi1, Multi2,
- Strategy
+ multi_tag, multi_tag
>
     : detail::transform::transform_multi
         <
- Multi1,
- Multi2,
             transform
                 <
- typename single_tag_of
- <
- typename tag<Multi1>::type
- >::type,
- typename single_tag_of
- <
- typename tag<Multi2>::type
- >::type,
                     typename boost::range_value<Multi1>::type,
- typename boost::range_value<Multi2>::type,
- Strategy
+ typename boost::range_value<Multi2>::type
>
>
 {};

Modified: branches/release/boost/geometry/multi/algorithms/unique.hpp
==============================================================================
--- branches/release/boost/geometry/multi/algorithms/unique.hpp (original)
+++ branches/release/boost/geometry/multi/algorithms/unique.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -30,9 +30,10 @@
 {
 
 
-template <typename MultiGeometry, typename ComparePolicy, typename Policy>
+template <typename Policy>
 struct multi_unique
 {
+ template <typename MultiGeometry, typename ComparePolicy>
     static inline void apply(MultiGeometry& multi, ComparePolicy const& compare)
     {
         for (typename boost::range_iterator<MultiGeometry>::type
@@ -62,33 +63,15 @@
 // possible for multi-points as well, removing points at the same location.
 
 
-template <typename MultiLineString, typename ComparePolicy>
-struct unique<multi_linestring_tag, MultiLineString, ComparePolicy>
- : detail::unique::multi_unique
- <
- MultiLineString,
- ComparePolicy,
- detail::unique::range_unique
- <
- typename boost::range_value<MultiLineString>::type,
- ComparePolicy
- >
- >
+template <typename MultiLineString>
+struct unique<MultiLineString, multi_linestring_tag>
+ : detail::unique::multi_unique<detail::unique::range_unique>
 {};
 
 
-template <typename MultiPolygon, typename ComparePolicy>
-struct unique<multi_polygon_tag, MultiPolygon, ComparePolicy>
- : detail::unique::multi_unique
- <
- MultiPolygon,
- ComparePolicy,
- detail::unique::polygon_unique
- <
- typename boost::range_value<MultiPolygon>::type,
- ComparePolicy
- >
- >
+template <typename MultiPolygon>
+struct unique<MultiPolygon, multi_polygon_tag>
+ : detail::unique::multi_unique<detail::unique::polygon_unique>
 {};
 
 

Modified: branches/release/boost/geometry/multi/multi.hpp
==============================================================================
--- branches/release/boost/geometry/multi/multi.hpp (original)
+++ branches/release/boost/geometry/multi/multi.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -32,6 +32,7 @@
 #include <boost/geometry/multi/algorithms/convert.hpp>
 #include <boost/geometry/multi/algorithms/correct.hpp>
 #include <boost/geometry/multi/algorithms/covered_by.hpp>
+#include <boost/geometry/multi/algorithms/disjoint.hpp>
 #include <boost/geometry/multi/algorithms/distance.hpp>
 #include <boost/geometry/multi/algorithms/envelope.hpp>
 #include <boost/geometry/multi/algorithms/equals.hpp>

Modified: branches/release/boost/geometry/strategies/cartesian/cart_intersect.hpp
==============================================================================
--- branches/release/boost/geometry/strategies/cartesian/cart_intersect.hpp (original)
+++ branches/release/boost/geometry/strategies/cartesian/cart_intersect.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -120,6 +120,22 @@
         typedef side::side_by_triangle<coordinate_type> side;
         side_info sides;
 
+ coordinate_type const zero = 0;
+ bool const a_is_point = math::equals(dx_a, zero) && math::equals(dy_a, zero);
+ bool const b_is_point = math::equals(dx_b, zero) && math::equals(dy_b, zero);
+
+ if(a_is_point && b_is_point)
+ {
+ if(math::equals(get<1,0>(a), get<1,0>(b)) && math::equals(get<1,1>(a), get<1,1>(b)))
+ {
+ Policy::degenerate(a, true);
+ }
+ else
+ {
+ return Policy::disjoint();
+ }
+ }
+
         bool collinear_use_first = math::abs(dx_a) + math::abs(dx_b) >= math::abs(dy_a) + math::abs(dy_b);
 
         sides.set<0>
@@ -143,7 +159,7 @@
 
         bool collinear = sides.collinear();
 
- robustness_verify_collinear(a, b, sides, collinear);
+ robustness_verify_collinear(a, b, a_is_point, b_is_point, sides, collinear);
         robustness_verify_meeting(a, b, sides, collinear, collinear_use_first);
 
         if (sides.same<0>() || sides.same<1>())
@@ -156,12 +172,11 @@
         }
 
         // Degenerate cases: segments of single point, lying on other segment, non disjoint
- coordinate_type const zero = 0;
- if (math::equals(dx_a, zero) && math::equals(dy_a, zero))
+ if (a_is_point)
         {
             return Policy::degenerate(a, true);
         }
- if (math::equals(dx_b, zero) && math::equals(dy_b, zero))
+ if (b_is_point)
         {
             return Policy::degenerate(b, false);
         }
@@ -281,10 +296,11 @@
 
     static inline void robustness_verify_collinear(
                 segment_type1 const& a, segment_type2 const& b,
+ bool a_is_point, bool b_is_point,
                 side_info& sides,
                 bool& collinear)
     {
- if ((sides.zero<0>() && ! sides.zero<1>()) || (sides.zero<1>() && ! sides.zero<0>()))
+ if ((sides.zero<0>() && ! b_is_point && ! sides.zero<1>()) || (sides.zero<1>() && ! a_is_point && ! sides.zero<0>()))
         {
             // If one of the segments is collinear, the other must be as well.
             // So handle it as collinear.

Modified: branches/release/boost/geometry/strategies/cartesian/distance_pythagoras.hpp
==============================================================================
--- branches/release/boost/geometry/strategies/cartesian/distance_pythagoras.hpp (original)
+++ branches/release/boost/geometry/strategies/cartesian/distance_pythagoras.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -42,8 +42,8 @@
 {
     static inline T apply(Point1 const& p1, Point2 const& p2)
     {
- T const c1 = boost::numeric_cast<T>(get<I-1>(p2));
- T const c2 = boost::numeric_cast<T>(get<I-1>(p1));
+ T const c1 = boost::numeric_cast<T>(get<I-1>(p1));
+ T const c2 = boost::numeric_cast<T>(get<I-1>(p2));
         T const d = c1 - c2;
         return d * d + compute_pythagoras<Point1, Point2, I-1, T>::apply(p1, p2);
     }

Modified: branches/release/boost/geometry/strategies/covered_by.hpp
==============================================================================
--- branches/release/boost/geometry/strategies/covered_by.hpp (original)
+++ branches/release/boost/geometry/strategies/covered_by.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -53,7 +53,7 @@
 {
     BOOST_MPL_ASSERT_MSG
         (
- false, NOT_IMPLEMENTED_FOR_THIS_TYPES
+ false, NOT_IMPLEMENTED_FOR_THESE_TYPES
             , (types<GeometryContained, GeometryContaining>)
         );
 };

Modified: branches/release/boost/geometry/strategies/within.hpp
==============================================================================
--- branches/release/boost/geometry/strategies/within.hpp (original)
+++ branches/release/boost/geometry/strategies/within.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -52,7 +52,7 @@
 {
     BOOST_MPL_ASSERT_MSG
         (
- false, NOT_IMPLEMENTED_FOR_THIS_TYPES
+ false, NOT_IMPLEMENTED_FOR_THESE_TYPES
             , (types<GeometryContained, GeometryContaining>)
         );
 };

Modified: branches/release/libs/geometry/doc/release_notes.qbk
==============================================================================
--- branches/release/libs/geometry/doc/release_notes.qbk (original)
+++ branches/release/libs/geometry/doc/release_notes.qbk 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -14,6 +14,28 @@
 
 
 [/=================]
+[heading Boost 1.53]
+[/=================]
+
+[*Bugfixes]
+
+* avoid generating output polygons with interior rings below minimum size (e.g. one or two points)
+* `geometry::disjoint` for degenerate segments (patched by Karsten Ahnert)
+* problem in `geometry::difference` for missing handling tangency, reported by H2
+* fixed `geometry::for_each` for use with Lambda's
+* fixed `geometry::comparable_distance` point-linestring (and -range, -polygon)
+
+[*Additional functionality]
+
+* combinations for `geometry::disjoint`: point/ring, point/polygon, point/multi_polygon
+* combinations for `geometry::intersects`: point/ring, point/polygon, point/multi_polygon
+
+[*Internal changes]
+
+* updates in specializations/not_implemented for various algorithms (as in an earlier version, these changes are still going on; they take care for simplified structs, better error reporting, and automatized documentation)
+* fixes in unit tests
+
+[/=================]
 [heading Boost 1.51]
 [/=================]
 

Modified: branches/release/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp
==============================================================================
--- branches/release/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp (original)
+++ branches/release/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -22,19 +22,49 @@
 #include <boost/geometry/multi/geometries/multi_geometries.hpp>
 #include <boost/geometry/algorithms/append.hpp>
 #include <boost/geometry/algorithms/area.hpp>
+#include <boost/geometry/algorithms/buffer.hpp>
+#include <boost/geometry/algorithms/centroid.hpp>
 #include <boost/geometry/algorithms/clear.hpp>
 #include <boost/geometry/algorithms/convert.hpp>
 #include <boost/geometry/algorithms/convex_hull.hpp>
 #include <boost/geometry/algorithms/correct.hpp>
 #include <boost/geometry/algorithms/covered_by.hpp>
+#include <boost/geometry/algorithms/disjoint.hpp>
 #include <boost/geometry/algorithms/distance.hpp>
+#include <boost/geometry/algorithms/envelope.hpp>
+#include <boost/geometry/algorithms/equals.hpp>
+#include <boost/geometry/algorithms/expand.hpp>
+#include <boost/geometry/algorithms/for_each.hpp>
+#include <boost/geometry/algorithms/length.hpp>
+#include <boost/geometry/algorithms/num_geometries.hpp>
+#include <boost/geometry/algorithms/num_interior_rings.hpp>
+#include <boost/geometry/algorithms/num_points.hpp>
+#include <boost/geometry/algorithms/overlaps.hpp>
+#include <boost/geometry/algorithms/perimeter.hpp>
+#include <boost/geometry/algorithms/reverse.hpp>
+#include <boost/geometry/algorithms/simplify.hpp>
+#include <boost/geometry/algorithms/transform.hpp>
+#include <boost/geometry/algorithms/unique.hpp>
 #include <boost/geometry/multi/algorithms/append.hpp>
 #include <boost/geometry/multi/algorithms/area.hpp>
+#include <boost/geometry/multi/algorithms/centroid.hpp>
 #include <boost/geometry/multi/algorithms/clear.hpp>
 #include <boost/geometry/multi/algorithms/convert.hpp>
 #include <boost/geometry/multi/algorithms/correct.hpp>
 #include <boost/geometry/multi/algorithms/covered_by.hpp>
 #include <boost/geometry/multi/algorithms/distance.hpp>
+#include <boost/geometry/multi/algorithms/envelope.hpp>
+#include <boost/geometry/multi/algorithms/equals.hpp>
+#include <boost/geometry/multi/algorithms/for_each.hpp>
+#include <boost/geometry/multi/algorithms/length.hpp>
+#include <boost/geometry/multi/algorithms/num_geometries.hpp>
+#include <boost/geometry/multi/algorithms/num_interior_rings.hpp>
+#include <boost/geometry/multi/algorithms/num_points.hpp>
+#include <boost/geometry/multi/algorithms/perimeter.hpp>
+#include <boost/geometry/multi/algorithms/reverse.hpp>
+#include <boost/geometry/multi/algorithms/simplify.hpp>
+#include <boost/geometry/multi/algorithms/transform.hpp>
+#include <boost/geometry/multi/algorithms/unique.hpp>
 #include <boost/geometry/strategies/strategies.hpp>
 
 #include "text_outputter.hpp"
@@ -76,13 +106,31 @@
     {};
 
 DECLARE_BINARY_ALGORITHM(append)
-DECLARE_UNARY_ALGORITHM (area)
-DECLARE_UNARY_ALGORITHM (clear)
+DECLARE_UNARY_ALGORITHM(area)
+DECLARE_BINARY_ALGORITHM(buffer)
+DECLARE_UNARY_ALGORITHM(centroid)
+DECLARE_UNARY_ALGORITHM(clear)
 DECLARE_BINARY_ALGORITHM(convert)
-DECLARE_UNARY_ALGORITHM (convex_hull)
-DECLARE_UNARY_ALGORITHM (correct)
+DECLARE_UNARY_ALGORITHM(convex_hull)
+DECLARE_UNARY_ALGORITHM(correct)
 DECLARE_BINARY_ALGORITHM(covered_by)
+DECLARE_BINARY_ALGORITHM(disjoint)
 DECLARE_BINARY_ALGORITHM(distance)
+DECLARE_UNARY_ALGORITHM(envelope)
+DECLARE_BINARY_ALGORITHM(equals)
+DECLARE_BINARY_ALGORITHM(expand)
+DECLARE_UNARY_ALGORITHM(for_each_point)
+DECLARE_UNARY_ALGORITHM(for_each_segment)
+DECLARE_UNARY_ALGORITHM(length)
+DECLARE_UNARY_ALGORITHM(num_geometries)
+DECLARE_UNARY_ALGORITHM(num_interior_rings)
+DECLARE_UNARY_ALGORITHM(num_points)
+DECLARE_BINARY_ALGORITHM(overlaps)
+DECLARE_UNARY_ALGORITHM(perimeter)
+DECLARE_UNARY_ALGORITHM(reverse)
+DECLARE_UNARY_ALGORITHM(simplify)
+DECLARE_BINARY_ALGORITHM(transform)
+DECLARE_UNARY_ALGORITHM(unique)
 DECLARE_BINARY_ALGORITHM(within)
 
 
@@ -194,12 +242,30 @@
 {
     test_binary_algorithm<append, all_types, boost::mpl::vector<point_type, std::vector<point_type> >, OutputFactory>("append");
     test_unary_algorithm<area, all_types, OutputFactory>("area");
+ test_binary_algorithm<buffer, all_types, all_types, OutputFactory>("buffer");
+ test_unary_algorithm<centroid, all_types, OutputFactory>("centroid");
     test_unary_algorithm<clear, all_types, OutputFactory>("clear");
     test_binary_algorithm<convert, all_types, all_types, OutputFactory>("convert");
     test_unary_algorithm<convex_hull, all_types, OutputFactory>("convex_hull");
     test_unary_algorithm<correct, all_types, OutputFactory>("correct");
     test_binary_algorithm<covered_by, all_types, all_types, OutputFactory>("covered_by");
+ test_binary_algorithm<disjoint, all_types, all_types, OutputFactory>("disjoint");
     test_binary_algorithm<distance, all_types, all_types, OutputFactory>("distance");
+ test_unary_algorithm<envelope, all_types, OutputFactory>("envelope");
+ test_binary_algorithm<equals, all_types, all_types, OutputFactory>("equals");
+ test_binary_algorithm<expand, all_types, all_types, OutputFactory>("expand");
+ test_unary_algorithm<for_each_point, all_types, OutputFactory>("for_each_point");
+ test_unary_algorithm<for_each_segment, all_types, OutputFactory>("for_each_segment");
+ test_unary_algorithm<length, all_types, OutputFactory>("length");
+ test_unary_algorithm<num_geometries, all_types, OutputFactory>("num_geometries");
+ test_unary_algorithm<num_interior_rings, all_types, OutputFactory>("num_interior_rings");
+ test_unary_algorithm<num_interior_rings, all_types, OutputFactory>("num_points");
+ test_binary_algorithm<overlaps, all_types, all_types, OutputFactory>("overlaps");
+ test_unary_algorithm<perimeter, all_types, OutputFactory>("perimeter");
+ test_unary_algorithm<reverse, all_types, OutputFactory>("reverse");
+ test_unary_algorithm<simplify, all_types, OutputFactory>("simplify");
+ test_binary_algorithm<transform, all_types, all_types, OutputFactory>("transform");
+ test_unary_algorithm<unique, all_types, OutputFactory>("unique");
     test_binary_algorithm<within, all_types, all_types, OutputFactory>("within");
 }
 

Modified: branches/release/libs/geometry/example/with_external_libs/x04_wxwidgets_world_mapper.cpp
==============================================================================
--- branches/release/libs/geometry/example/with_external_libs/x04_wxwidgets_world_mapper.cpp (original)
+++ branches/release/libs/geometry/example/with_external_libs/x04_wxwidgets_world_mapper.cpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -357,15 +357,15 @@
 
     BOOST_FOREACH(bg::model::polygon<point_2d> const& poly, country)
     {
- // Use only outer, holes are (for the moment) ignored. This would need
+ // Use only exterior ring, holes are (for the moment) ignored. This would need
         // a holey-polygon compatible wx object
 
- std::size_t n = boost::size(poly.outer());
+ std::size_t n = boost::size(bg::exterior_ring(poly));
 
         boost::scoped_array<wxPoint> points(new wxPoint[n]);
 
         wxPointPointerPair pair = std::make_pair(points.get(), points.get() + n);
- bg::transform(poly.outer(), pair, *m_map_transformer);
+ bg::transform(bg::exterior_ring(poly), pair, *m_map_transformer);
 
         dc.DrawPolygon(n, points.get());
     }

Modified: branches/release/libs/geometry/test/algorithms/area.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/area.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/area.cpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -25,6 +25,8 @@
 #include <test_geometries/all_custom_polygon.hpp>
 //#define GEOMETRY_TEST_DEBUG
 
+#include <boost/variant/variant.hpp>
+
 template <typename Polygon>
 void test_polygon()
 {
@@ -222,6 +224,28 @@
     BOOST_CHECK_CLOSE(int_area, double_area, 0.0001);
 }
 
+void test_variant()
+{
+ typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
+ typedef bg::model::polygon<double_point_type> polygon_type;
+ typedef bg::model::box<double_point_type> box_type;
+
+ polygon_type poly;
+ std::string const polygon_li = "POLYGON((18 5,18 1,15 1,15 5,12 5,12 8,15 8,18 8,18 5))";
+ bg::read_wkt(polygon_li, poly);
+
+ box_type box;
+ std::string const box_li = "BOX(0 0,2 2)";
+ bg::read_wkt(box_li, box);
+
+ boost::variant<polygon_type, box_type> v;
+
+ v = poly;
+ BOOST_CHECK_CLOSE(bg::area(v), bg::area(poly), 0.0001);
+ v = box;
+ BOOST_CHECK_CLOSE(bg::area(v), bg::area(box), 0.0001);
+}
+
 int test_main(int, char* [])
 {
     test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
@@ -242,6 +266,8 @@
 
     test_large_integers();
 
+ test_variant();
+
     // test_empty_input<bg::model::d2::point_xy<int> >();
 
     return 0;

Modified: branches/release/libs/geometry/test/algorithms/comparable_distance.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/comparable_distance.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/comparable_distance.cpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -102,11 +102,11 @@
     P p = bg::make<P>(2, 1);
 
     typename bg::coordinate_type<P>::type d = bg::comparable_distance(p, points);
- BOOST_CHECK_CLOSE(d, 0.70710678, 0.001);
+ BOOST_CHECK_CLOSE(d, 0.5, 0.001);
 
     p = bg::make<P>(5, 5);
     d = bg::comparable_distance(p, points);
- BOOST_CHECK_CLOSE(d, 2.828427, 0.001);
+ BOOST_CHECK_CLOSE(d, 8.0, 0.001);
 
 
     bg::model::linestring<P> line;
@@ -117,11 +117,11 @@
     p = bg::make<P>(5, 5);
 
     d = bg::comparable_distance(p, line);
- BOOST_CHECK_CLOSE(d, 2.828427, 0.001);
+ BOOST_CHECK_CLOSE(d, 8.0, 0.001);
 
     // Reverse case
     d = bg::comparable_distance(line, p);
- BOOST_CHECK_CLOSE(d, 2.828427, 0.001);
+ BOOST_CHECK_CLOSE(d, 8.0, 0.001);
 }
 
 template <typename P>

Modified: branches/release/libs/geometry/test/algorithms/difference.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/difference.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/difference.cpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -9,6 +9,8 @@
 
 // #define TEST_ISOVIST
 
+//#define HAVE_TTMATH
+
 //#define BOOST_GEOMETRY_CHECK_WITH_POSTGIS
 
 //#define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
@@ -111,8 +113,8 @@
 
     test_one<polygon, polygon, polygon>("simplex_normal",
         simplex_normal[0], simplex_normal[1],
- 3, 3, 2.52636706856656,
- 3, 3, 3.52636706856656);
+ 3, 12, 2.52636706856656,
+ 3, 12, 3.52636706856656);
 
     test_one<polygon, polygon, polygon>("simplex_with_empty",
         simplex_normal[0], polygon_empty,
@@ -126,24 +128,24 @@
 
     test_one<polygon, polygon, polygon>("two_bends",
         two_bends[0], two_bends[1],
- 1, 7, 8.0,
- 1, 7, 8.0);
+ 1, 5, 8.0,
+ 1, 5, 8.0);
 
     test_one<polygon, polygon, polygon>("star_comb_15",
         star_comb_15[0], star_comb_15[1],
- 30, 150, 227.658275102812,
- 30, 150, 480.485775259312);
+ 30, 160, 227.658275102812,
+ 30, 198, 480.485775259312);
 
     test_one<polygon, polygon, polygon>("new_hole",
         new_hole[0], new_hole[1],
- 1, 10, 7.0,
- 1, 10, 14.0);
+ 1, 9, 7.0,
+ 1, 13, 14.0);
 
 
     test_one<polygon, polygon, polygon>("crossed",
         crossed[0], crossed[1],
- 1, 0, 19.5,
- 1, 0, 2.5);
+ 1, 18, 19.5,
+ 1, 7, 2.5);
 
     test_one<polygon, polygon, polygon>("disjoint",
         disjoint[0], disjoint[1],
@@ -152,35 +154,35 @@
 
     test_one<polygon, polygon, polygon>("distance_zero",
         distance_zero[0], distance_zero[1],
- 2, 0, 8.7048386,
+ 2, -1, 8.7048386,
         if_typed<ct, float>(1, 2), // The too small one is discarded for floating point
- 0, 0.0098387);
+ -1, 0.0098387);
 
 
     test_one<polygon, polygon, polygon>("equal_holes_disjoint",
         equal_holes_disjoint[0], equal_holes_disjoint[1],
- 1, 0, 9.0,
- 1, 0, 9.0);
+ 1, 5, 9.0,
+ 1, 5, 9.0);
 
     test_one<polygon, polygon, polygon>("only_hole_intersections1",
         only_hole_intersections[0], only_hole_intersections[1],
- 2, 0, 1.9090909,
- 4, 0, 10.9090909);
+ 2, 10, 1.9090909,
+ 4, 16, 10.9090909);
 
     test_one<polygon, polygon, polygon>("only_hole_intersection2",
         only_hole_intersections[0], only_hole_intersections[2],
- 3, 0, 30.9090909,
- 4, 0, 10.9090909);
+ 3, 20, 30.9090909,
+ 4, 16, 10.9090909);
 
     test_one<polygon, polygon, polygon>("first_within_second",
         first_within_second[1], first_within_second[0],
- 1, 1, 24,
+ 1, 10, 24,
         0, 0, 0);
 
     test_one<polygon, polygon, polygon>("fitting",
         fitting[0], fitting[1],
- 1, 0, 21.0,
- 1, 0, 4.0);
+ 1, 9, 21.0,
+ 1, 4, 4.0);
 
     test_one<polygon, polygon, polygon>("identical",
         identical[0], identical[1],
@@ -189,63 +191,63 @@
 
     test_one<polygon, polygon, polygon>("intersect_exterior_and_interiors_winded",
         intersect_exterior_and_interiors_winded[0], intersect_exterior_and_interiors_winded[1],
- 4, 0, 11.533333,
- 5, 0, 29.783333);
+ 4, 20, 11.533333,
+ 5, 26, 29.783333);
 
     test_one<polygon, polygon, polygon>("intersect_holes_intersect_and_disjoint",
         intersect_holes_intersect_and_disjoint[0], intersect_holes_intersect_and_disjoint[1],
- 2, 0, 15.75,
- 3, 0, 6.75);
+ 2, 16, 15.75,
+ 3, 17, 6.75);
 
     test_one<polygon, polygon, polygon>("intersect_holes_intersect_and_touch",
         intersect_holes_intersect_and_touch[0], intersect_holes_intersect_and_touch[1],
- 3, 0, 16.25,
- 3, 0, 6.25);
+ 3, 21, 16.25,
+ 3, 17, 6.25);
 
     test_one<polygon, polygon, polygon>("intersect_holes_new_ring",
         intersect_holes_new_ring[0], intersect_holes_new_ring[1],
- 3, 0, 9.8961,
- 4, 0, 121.8961, 0.01);
+ 3, 15, 9.8961,
+ 4, 25, 121.8961, 0.01);
 
     test_one<polygon, polygon, polygon>("first_within_hole_of_second",
         first_within_hole_of_second[0], first_within_hole_of_second[1],
- 1, -1, 1,
- 1, -1, 16);
+ 1, 5, 1,
+ 1, 10, 16);
 
     test_one<polygon, polygon, polygon>("intersect_holes_disjoint",
         intersect_holes_disjoint[0], intersect_holes_disjoint[1],
- 2, 15, 16.0,
- 2, 15, 6.0);
+ 2, 14, 16.0,
+ 2, 10, 6.0);
 
     test_one<polygon, polygon, polygon>("intersect_holes_intersect",
         intersect_holes_intersect[0], intersect_holes_intersect[1],
- 2, 14, 15.75,
- 2, 14, 5.75);
+ 2, 16, 15.75,
+ 2, 12, 5.75);
 
     test_one<polygon, polygon, polygon>(
             "case4", case_4[0], case_4[1],
- 6, 22, 2.77878787878788,
- 4, 27, 4.77878787878788);
+ 6, 28, 2.77878787878788,
+ 4, 22, 4.77878787878788);
 
     test_one<polygon, polygon, polygon>(
             "case5", case_5[0], case_5[1],
- 8, 22, 2.43452380952381,
- 7, 27, 3.18452380952381);
+ 8, 36, 2.43452380952381,
+ 7, 33, 3.18452380952381);
 
     test_one<polygon, polygon, polygon>("winded",
         winded[0], winded[1],
- 3, 1, 61,
- 1, 0, 13);
+ 3, 37, 61,
+ 1, 15, 13);
 
     test_one<polygon, polygon, polygon>("within_holes_disjoint",
         within_holes_disjoint[0], within_holes_disjoint[1],
- 2, 1, 25,
- 1, 0, 1);
+ 2, 15, 25,
+ 1, 5, 1);
 
     test_one<polygon, polygon, polygon>("side_side",
         side_side[0], side_side[1],
- 1, 0, 1,
- 1, 0, 1);
+ 1, 5, 1,
+ 1, 5, 1);
 
     /*** TODO: self-tangencies for difference
     test_one<polygon, polygon, polygon>("wrapped_a",
@@ -274,32 +276,35 @@
 
     test_one<polygon, polygon, polygon>("ggl_list_20110306_javier",
         ggl_list_20110306_javier[0], ggl_list_20110306_javier[1],
- 1, 0, 71495.3331,
- 2, 0, 8960.49049);
+ 1, -1, 71495.3331,
+ 2, -1, 8960.49049);
 #endif
         
     test_one<polygon, polygon, polygon>("ggl_list_20110307_javier",
         ggl_list_20110307_javier[0], ggl_list_20110307_javier[1],
- 1, 0, 16815.6,
- 1, 0, 3200.4,
+ 1, 13, 16815.6,
+ 1, 4, 3200.4,
         0.01);
 
     if (! boost::is_same<ct, float>::value)
     {
         test_one<polygon, polygon, polygon>("ggl_list_20110716_enrico",
             ggl_list_20110716_enrico[0], ggl_list_20110716_enrico[1],
- 3, 0, 35723.8506317139,
- 1, 0, 58456.4964294434
+ 3, -1, 35723.8506317139,
+ 1, -1, 58456.4964294434
             );
     }
 
     test_one<polygon, polygon, polygon>("ggl_list_20110820_christophe",
         ggl_list_20110820_christophe[0], ggl_list_20110820_christophe[1],
- 1, 0, 2.8570121719168924,
- 1, 0, 64.498061986388564);
-
-
+ 1, -1, 2.8570121719168924,
+ 1, -1, 64.498061986388564);
 
+ test_one<polygon, polygon, polygon>("ggl_list_20120717_volker",
+ ggl_list_20120717_volker[0], ggl_list_20120717_volker[1],
+ 1, 11, 3370866.2295081965,
+ 1, 5, 384.2295081964694, 0.01);
+
 #ifdef _MSC_VER
     // 2011-07-02
     // Interesting FP-precision case.
@@ -310,9 +315,9 @@
     // Because we cannot predict this, we only test for MSVC
     test_one<polygon, polygon, polygon>("ggl_list_20110627_phillip",
         ggl_list_20110627_phillip[0], ggl_list_20110627_phillip[1],
- if_typed_tt<ct>(1, 0), 0,
+ if_typed_tt<ct>(1, 0), -1,
             if_typed_tt<ct>(0.0000000000001105367, 0.0),
- 1, 0, 3577.40960816756,
+ 1, -1, 3577.40960816756,
         0.01
         );
 #endif
@@ -325,17 +330,17 @@
 
         test_one<polygon, ring, polygon>(
                 "ring_star_ring", example_ring, example_star,
- 5, 22, 1.6701714, 5, 27, 1.1901714);
+ 5, 27, 1.6701714, 5, 22, 1.1901714);
 
         static std::string const clip = "POLYGON((2.5 0.5,5.5 2.5))";
 
         test_one<polygon, box, ring>("star_box",
             clip, example_star,
- 4, 11, 2.833333, 4, 11, 0.833333);
+ 4, 20, 2.833333, 4, 16, 0.833333);
 
         test_one<polygon, ring, box>("box_star",
             example_star, clip,
- 4, 11, 0.833333, 4, 11, 2.833333);
+ 4, 16, 0.833333, 4, 20, 2.833333);
     }
 
     // Counter clockwise
@@ -464,6 +469,19 @@
 }
 *****/
 
+
+template <typename P, bool clockwise, bool closed>
+void test_specific()
+{
+ typedef bg::model::polygon<P, clockwise, closed> polygon;
+
+ test_one<polygon, polygon, polygon>("ggl_list_20120717_volker",
+ ggl_list_20120717_volker[0], ggl_list_20120717_volker[1],
+ 1, 11, 3370866.2295081965,
+ 1, 5, 384, 0.01);
+}
+
+
 int test_main(int, char* [])
 {
     //test_difference_parcel_precision<float>();
@@ -471,6 +489,8 @@
 
     test_all<bg::model::d2::point_xy<double> >();
 
+ test_specific<bg::model::d2::point_xy<int>, false, false>();
+
 #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
     test_all<bg::model::d2::point_xy<float> >();
 

Modified: branches/release/libs/geometry/test/algorithms/disjoint.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/disjoint.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/disjoint.cpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -105,6 +105,16 @@
     test_disjoint<ring, ring>("within_simplex_rr1", within_simplex[0], within_simplex[1], false);
     test_disjoint<ring, ring>("within_simplex_rr2", within_simplex[1], within_simplex[0], false);
 
+ test_disjoint<P, ring>("point_ring1", "POINT(0 0)", "POLYGON((0 0,3 3,6 0,0 0))", false);
+ test_disjoint<P, ring>("point_ring2", "POINT(3 1)", "POLYGON((0 0,3 3,6 0,0 0))", false);
+ test_disjoint<P, ring>("point_ring3", "POINT(0 3)", "POLYGON((0 0,3 3,6 0,0 0))", true);
+ test_disjoint<P, polygon>("point_polygon1", "POINT(0 0)", "POLYGON((0 0,3 3,6 0,0 0))", false);
+ test_disjoint<P, polygon>("point_polygon2", "POINT(3 1)", "POLYGON((0 0,3 3,6 0,0 0))", false);
+ test_disjoint<P, polygon>("point_polygon3", "POINT(0 3)", "POLYGON((0 0,3 3,6 0,0 0))", true);
+
+ test_disjoint<ring, P>("point_ring2", "POLYGON((0 0,3 3,6 0,0 0))", "POINT(0 0)", false);
+ test_disjoint<polygon, P>("point_polygon2", "POLYGON((0 0,3 3,6 0,0 0))", "POINT(0 0)", false);
+
     // Linear
     typedef bg::model::linestring<P> ls;
     typedef bg::model::segment<P> segment;
@@ -113,6 +123,12 @@
     test_disjoint<segment, segment>("s/s 1", "linestring(0 0,1 1)", "linestring(1 0,0 1)", false);
     test_disjoint<segment, segment>("s/s 2", "linestring(0 0,1 1)", "linestring(1 0,2 1)", true);
 
+ // Test degenerate segments (patched by Karsten Ahnert on 2012-07-25)
+ test_disjoint<segment, segment>("s/s 3", "linestring(0 0,0 0)", "linestring(1 0,0 1)", true);
+ test_disjoint<segment, segment>("s/s 4", "linestring(0 0,0 0)", "linestring(0 0,0 0)", false);
+ test_disjoint<segment, segment>("s/s 5", "linestring(0 0,0 0)", "linestring(1 0,1 0)", true);
+ test_disjoint<segment, segment>("s/s 6", "linestring(0 0,0 0)", "linestring(0 1,0 1)", true);
+
     // Collinear opposite
     test_disjoint<ls, ls>("ls/ls co", "linestring(0 0,2 2)", "linestring(1 1,0 0)", false);
     // Collinear opposite and equal

Modified: branches/release/libs/geometry/test/algorithms/intersects.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/intersects.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/intersects.cpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -17,13 +17,28 @@
 template <typename P>
 void test_all()
 {
- // intersect <=> ! disjoint
+ typedef bg::model::polygon<P> polygon;
+ typedef bg::model::ring<P> ring;
+
+ // intersect <=> ! disjoint (in most cases)
     // so most tests are done in disjoint test.
- // We only test compilation of one case.
+ // We only test compilation of a few cases.
     test_geometry<P, bg::model::box<P> >("POINT(1 1)", "BOX(0 0,2 2)", true);
 
+ test_geometry<polygon, bg::model::box<P> >(
+ "POLYGON((1992 3240,1992 1440,3792 1800,3792 3240,1992 3240))",
+ "BOX(1941 2066, 2055 2166)", true);
+
+ test_geometry<ring, bg::model::box<P> >(
+ "POLYGON((1992 3240,1992 1440,3792 1800,3792 3240,1992 3240))",
+ "BOX(1941 2066, 2055 2166)", true);
+
+ test_geometry<polygon, bg::model::box<P> >(
+ "POLYGON((1941 2066,2055 2066,2055 2166,1941 2166))",
+ "BOX(1941 2066, 2055 2166)", true);
+
+
     // self-intersecting is not tested in disjoint, so that is done here.
- typedef bg::model::polygon<P> polygon;
 
     // Just a normal polygon
     test_self_intersects<polygon>("POLYGON((0 0,0 4,1.5 2.5,2.5 1.5,4 0,0 0))", false);
@@ -111,6 +126,28 @@
         "POLYGON((0 0,3 3,3 3,4 1,0 0))", false);
     test_self_intersects<bg::model::ring<P, true, false> >(
         "POLYGON((0 0,3 3,3 3,4 1))", false);
+
+ test_geometry<P, bg::model::box<P> >(
+ "POINT(0 0)",
+ "BOX(0 0,4 4)",
+ true);
+ test_geometry<P, bg::model::ring<P> >(
+ "POINT(0 0)",
+ "POLYGON((0 0,3 3,3 3,4 1))",
+ true);
+ test_geometry<P, bg::model::polygon<P> >(
+ "POINT(0 0)",
+ "POLYGON((0 0,3 3,3 3,4 1))",
+ true);
+
+ test_geometry<bg::model::ring<P>, P>(
+ "POLYGON((0 0,3 3,3 3,4 1))",
+ "POINT(0 0)",
+ true);
+ test_geometry<bg::model::polygon<P>, P>(
+ "POLYGON((0 0,3 3,3 3,4 1))",
+ "POINT(0 0)",
+ true);
 }
 
 

Modified: branches/release/libs/geometry/test/algorithms/overlay/overlay_cases.hpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/overlay/overlay_cases.hpp (original)
+++ branches/release/libs/geometry/test/algorithms/overlay/overlay_cases.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -567,6 +567,13 @@
     "POLYGON((1716 1554,2076 2250,2436 2352,2796 1248,3156 2484,3516 2688,3156 2483,2796 1247,2436 2351,2076 2249, 1716 1554))",
     };
 
+static std::string ggl_list_20120717_volker[2] =
+ {
+ "POLYGON((1031 1056,3232 1056,3232 2856,1031 2856))",
+ "POLYGON((1032 1458,1032 1212,2136 2328,3234 2220,3234 2412,2136 2646))"
+ };
+
+
 static std::string buffer_rt_a[2] =
     {
     "POLYGON((1 7,1 8,1.0012 8.04907,1.00482 8.09802,1.01082 8.14673,1.01921 8.19509,1.02997 8.24298,1.04306 8.29028,1.05846 8.33689,1.07612 8.38268,1.09601 8.42756,1.11808 8.4714,1.14227 8.5141,1.16853 8.55557,1.19679 8.5957,1.22699 8.63439,1.25905 8.67156,1.29289 8.70711,1.32844 8.74095,1.36561 8.77301,1.4043 8.80321,1.44443 8.83147,1.4859 8.85773,1.5286 8.88192,1.57244 8.90399,1.61732 8.92388,1.66311 8.94154,1.70972 8.95694,1.75702 8.97003,1.80491 8.98079,1.85327 8.98918,1.90198 8.99518,1.95093 8.9988,2 9,3 9,3.04907 8.9988,3.09802 8.99518,3.14673 8.98918,3.19509 8.98079,3.24298 8.97003,3.29028 8.95694,3.33689 8.94154,3.38268 8.92388,3.42756 8.90399,3.4714 8.88192,3.5141 8.85773,3.55557 8.83147,3.5957 8.80321,3.63439 8.77301,3.67156 8.74095,3.70711 8.70711,3.74095 8.67156,3.77301 8.63439,3.80321 8.5957,3.83147 8.55557,3.85773 8.5141,3.88192 8.4714,3.90399 8.42756,3.92388 8.38268,3.94154 8.33689,3.95694 8.29028,3.97003 8.24298,3.98079 8.19509,3.98918 8.14673,3.99518 8.09802,3.9988 8.04907,4 8,4 7,3.9988 6
.95093,3.99518 6.90198,3.98918 6.85327,3.98079 6.80491,3.97003 6.75702,3.95694 6.70972,3.94154 6.66311,3.92388 6.61732,3.90399 6.57244,3.88192 6.5286,3.85773 6.4859,3.83147 6.44443,3.80321 6.4043,3.77301 6.36561,3.74095 6.32844,3.70711 6.29289,3.67156 6.25905,3.63439 6.22699,3.5957 6.19679,3.55557 6.16853,3.5141 6.14227,3.4714 6.11808,3.42756 6.09601,3.38268 6.07612,3.33689 6.05846,3.29028 6.04306,3.24298 6.02997,3.19509 6.01921,3.14673 6.01082,3.09802 6.00482,3.04907 6.0012,3 6,2 6,1.95093 6.0012,1.90198 6.00482,1.85327 6.01082,1.80491 6.01921,1.75702 6.02997,1.70972 6.04306,1.66311 6.05846,1.61732 6.07612,1.57244 6.09601,1.5286 6.11808,1.4859 6.14227,1.44443 6.16853,1.4043 6.19679,1.36561 6.22699,1.32844 6.25905,1.29289 6.29289,1.25905 6.32844,1.22699 6.36561,1.19679 6.4043,1.16853 6.44443,1.14227 6.4859,1.11808 6.5286,1.09601 6.57244,1.07612 6.61732,1.05846 6.66311,1.04306 6.70972,1.02997 6.75702,1.01921 6.80491,1.01082 6.85327,1.00482 6.90198,1.0012 6.95093,1 7))",

Modified: branches/release/libs/geometry/test/algorithms/overlay/traverse.cpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/overlay/traverse.cpp (original)
+++ branches/release/libs/geometry/test/algorithms/overlay/traverse.cpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -7,9 +7,10 @@
 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
+// #define BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE
 // #define BOOST_GEOMETRY_OVERLAY_NO_THROW
 // #define TEST_WITH_SVG
+// #define HAVE_TTMATH
 
 #include <iostream>
 #include <iomanip>
@@ -633,8 +634,7 @@
             2, 16, case_53[0], case_53[2]);
     if (test_self_tangencies)
     {
- // The st_st version might generate one ring with area zero, which is OK
- test_traverse<polygon, polygon, operation_union>::apply("54_st_st", 3, 20, case_54[0], case_54[2]);
+ test_traverse<polygon, polygon, operation_union>::apply("54_st_st", 2, 20, case_54[0], case_54[2]);
         test_traverse<polygon, polygon, operation_union>::apply("54_st_iet", 2, 20, case_54[0], case_54[3]);
         test_traverse<polygon, polygon, operation_union>::apply("54_iet_st", 2, 20, case_54[1], case_54[2]);
     }
@@ -786,6 +786,7 @@
     // the chance is 50% that the segments are not sorted correctly and the wrong
     // decision is taken.
     // Solved now (by sorting on sides in those cases)
+ if (! is_float_on_non_msvc)
     {
         test_traverse<polygon, polygon, operation_intersection>::apply("dz_1",
                 3, 16.887537949472005, dz_1[0], dz_1[1]);
@@ -884,8 +885,10 @@
 
 #if defined(_MSC_VER)
         double const expected = if_typed_tt<T>(3.63794e-17, 0.0);
+ int expected_count = if_typed_tt<T>(1, 0);
 #else
         double const expected = if_typed<T, long double>(2.77555756156289135106e-17, 0.0);
+ int expected_count = if_typed<T, long double>(1, 0);
 #endif
 
         // Calculate intersection/union of two triangles. Robustness case.
@@ -893,7 +896,7 @@
         // (which is even not accomplished by SQL Server/PostGIS)
         std::string const caseid = "ggl_list_20110820_christophe";
         test_traverse<polygon, polygon, operation_intersection>::apply(caseid,
- 1, expected,
+ expected_count, expected,
             ggl_list_20110820_christophe[0], ggl_list_20110820_christophe[1]);
         test_traverse<polygon, polygon, operation_union>::apply(caseid,
             1, 67.3550722317627,
@@ -905,7 +908,7 @@
         buffer_rt_f[0], buffer_rt_f[1]);
     test_traverse<polygon, polygon, operation_intersection>::apply("buffer_rt_f",
         1, 0.0002943725152286,
- buffer_rt_f[0], buffer_rt_f[1]);
+ buffer_rt_f[0], buffer_rt_f[1], 0.01);
 
     test_traverse<polygon, polygon, operation_union>::apply("buffer_rt_g",
         1, 16.571,

Modified: branches/release/libs/geometry/test/algorithms/test_difference.hpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/test_difference.hpp (original)
+++ branches/release/libs/geometry/test/algorithms/test_difference.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -38,7 +38,10 @@
 
 
 #if defined(TEST_WITH_SVG)
+# define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
+# define BOOST_GEOMETRY_DEBUG_IDENTIFIER
 # include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
+# include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
 #endif
 
 
@@ -79,7 +82,7 @@
 
 template <typename OutputType, typename G1, typename G2>
 void test_difference(std::string const& caseid, G1 const& g1, G2 const& g2,
- std::size_t expected_count, std::size_t expected_point_count,
+ std::size_t expected_count, int expected_point_count,
         double expected_area,
         double percentage = 0.0001,
         bool sym = false)
@@ -103,7 +106,7 @@
             it != clip.end();
             ++it)
     {
- if (expected_point_count > 0)
+ if (expected_point_count >= 0)
         {
             n += bg::num_points(*it);
         }
@@ -135,15 +138,15 @@
 
 
 #if ! defined(BOOST_GEOMETRY_NO_BOOST_TEST)
- /*if (expected_point_count > 0)
+ if (expected_point_count >= 0)
     {
- BOOST_CHECK_MESSAGE(n == expected_point_count,
+ BOOST_CHECK_MESSAGE(n == std::size_t(expected_point_count),
                 "difference: " << caseid
                 << " #points expected: " << expected_point_count
                 << " detected: " << n
                 << " type: " << string_from_type<coordinate_type>::name()
                 );
- }*/
+ }
 
     if (expected_count > 0)
     {
@@ -171,11 +174,11 @@
 void test_one(std::string const& caseid,
         std::string const& wkt1, std::string const& wkt2,
         std::size_t expected_count1,
- std::size_t expected_point_count1,
+ int expected_point_count1,
         double expected_area1,
 
         std::size_t expected_count2,
- std::size_t expected_point_count2,
+ int expected_point_count2,
         double expected_area2,
 
         double percentage = 0.0001)
@@ -256,7 +259,7 @@
 void test_one_lp(std::string const& caseid,
         std::string const& wkt1, std::string const& wkt2,
         std::size_t expected_count,
- std::size_t expected_point_count,
+ int expected_point_count,
         double expected_length)
 {
     G1 g1;
@@ -272,25 +275,29 @@
 
     typename bg::default_length_result<G1>::type length = 0;
     std::size_t n = 0;
+ std::size_t piece_count = 0;
     for (typename std::vector<OutputType>::iterator it = pieces.begin();
             it != pieces.end();
             ++it)
     {
- if (expected_point_count > 0)
+ if (expected_point_count >= 0)
         {
             n += bg::num_points(*it);
         }
-
+ piece_count++;
         length += bg::length(*it);
     }
 
- BOOST_CHECK_MESSAGE(pieces.size() == expected_count,
+ BOOST_CHECK_MESSAGE(piece_count == expected_count,
             "difference: " << caseid
             << " #outputs expected: " << expected_count
             << " detected: " << pieces.size()
             );
 
- BOOST_CHECK_EQUAL(n, expected_point_count);
+ if (expected_point_count >= 0)
+ {
+ BOOST_CHECK_EQUAL(n, std::size_t(expected_point_count));
+ }
 
     BOOST_CHECK_CLOSE(length, expected_length, 0.001);
 

Modified: branches/release/libs/geometry/test/algorithms/test_for_each.hpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/test_for_each.hpp (original)
+++ branches/release/libs/geometry/test/algorithms/test_for_each.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -11,6 +11,7 @@
 
 #include <geometry_test_common.hpp>
 
+#include <boost/config.hpp>
 #include <boost/geometry/algorithms/for_each.hpp>
 
 #include <boost/geometry/algorithms/distance.hpp>
@@ -87,9 +88,29 @@
 {
     typedef typename bg::point_type<Geometry>::type point_type;
 
+ // Class (functor)
     sum_x_functor<point_type> functor;
     functor = bg::for_each_point(geometry, functor);
     BOOST_CHECK_EQUAL(functor.sum, expected);
+
+
+ // Lambda
+#if !defined(BOOST_NO_CXX11_LAMBDAS)
+
+ typename bg::coordinate_type<point_type>::type sum_x = 0;
+
+ bg::for_each_point
+ (
+ geometry,
+ [&sum_x](point_type const& p)
+ {
+ sum_x += bg::get<0>(p);
+ }
+
+ );
+
+ BOOST_CHECK_EQUAL(sum_x, expected);
+#endif
 }
 
 template <typename Geometry>
@@ -97,6 +118,10 @@
     std::string const& expected1,
     std::string const& expected2)
 {
+#if !defined(BOOST_NO_CXX11_LAMBDAS)
+ Geometry copy = geometry;
+#endif
+
     typedef typename bg::point_type<Geometry>::type point_type;
 
     // function
@@ -119,6 +144,41 @@
         "for_each_point: "
         << " expected " << expected2
         << " got " << bg::wkt(geometry));
+
+#if !defined(BOOST_NO_CXX11_LAMBDAS)
+ // Lambda, both functions above together. Without / with capturing
+
+ geometry = copy;
+ bg::for_each_point
+ (
+ geometry,
+ [](point_type& p)
+ {
+ bg::set<0>(p, bg::get<0>(p) + 100);
+ }
+
+ );
+
+ typename bg::coordinate_type<point_type>::type scale = 100;
+ bg::for_each_point
+ (
+ geometry,
+ [&](point_type& p)
+ {
+ bg::set<1>(p, bg::get<1>(p) * scale);
+ }
+
+ );
+
+ std::ostringstream out3;
+ out3 << bg::wkt(geometry);
+
+ BOOST_CHECK_MESSAGE(out3.str() == expected2,
+ "for_each_point (lambda): "
+ << " expected " << expected2
+ << " got " << bg::wkt(geometry));
+#endif
+
 }
 
 

Modified: branches/release/libs/geometry/test/algorithms/test_intersects.hpp
==============================================================================
--- branches/release/libs/geometry/test/algorithms/test_intersects.hpp (original)
+++ branches/release/libs/geometry/test/algorithms/test_intersects.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -32,12 +32,18 @@
     bg::read_wkt(wkt2, geometry2);
 
     bool detected = bg::intersects(geometry1, geometry2);
+ bool detected2 = bg::intersects(geometry2, geometry1);
 
     BOOST_CHECK_MESSAGE(detected == expected,
         "intersects: " << wkt1
         << " with " << wkt2
         << " -> Expected: " << expected
         << " detected: " << detected);
+ BOOST_CHECK_MESSAGE(detected2 == expected,
+ "intersects: " << wkt1
+ << " with " << wkt2
+ << " -> Expected: " << expected
+ << " detected: " << detected2);
 }
 
 

Modified: branches/release/libs/geometry/test/core/point_type.cpp
==============================================================================
--- branches/release/libs/geometry/test/core/point_type.cpp (original)
+++ branches/release/libs/geometry/test/core/point_type.cpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -14,12 +14,15 @@
 #include <boost/geometry/core/tag.hpp>
 
 #include <boost/geometry/geometries/geometries.hpp>
+#include <boost/geometry/geometries/variant.hpp>
 
 #include <boost/geometry/geometries/adapted/c_array.hpp>
 #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
 
 #include <boost/geometry/geometries/register/linestring.hpp>
 
+#include <boost/variant/variant.hpp>
+
 #include <vector>
 #include <deque>
 
@@ -64,9 +67,12 @@
     test_geometry<double[3], double[3]>();
 
     test_geometry<boost::tuple<double, double>,
- boost::tuple<double, double> >();
+ boost::tuple<double, double> >();
     test_geometry<boost::tuple<double, double, double>,
- boost::tuple<double, double, double> >();
+ boost::tuple<double, double, double> >();
+
+ test_geometry<boost::variant<bg::model::box<boost::tuple<double, double> > >,
+ boost::tuple<double, double> >();
 
     test_all<bg::model::point<int, 2, bg::cs::cartesian> >();
     test_all<bg::model::point<float, 2, bg::cs::cartesian> >();

Modified: branches/release/libs/geometry/test/geometry_test_common.hpp
==============================================================================
--- branches/release/libs/geometry/test/geometry_test_common.hpp (original)
+++ branches/release/libs/geometry/test/geometry_test_common.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -89,6 +89,9 @@
 template <> struct string_from_type<long double>
 { static std::string name() { return "e"; } };
 
+template <> struct string_from_type<int>
+{ static std::string name() { return "i"; } };
+
 #if defined(HAVE_TTMATH)
     template <> struct string_from_type<ttmath_big>
     { static std::string name() { return "t"; } };

Modified: branches/release/libs/geometry/test/multi/algorithms/Jamfile.v2
==============================================================================
--- branches/release/libs/geometry/test/multi/algorithms/Jamfile.v2 (original)
+++ branches/release/libs/geometry/test/multi/algorithms/Jamfile.v2 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -23,6 +23,7 @@
     [ run multi_equals.cpp ]
     [ run multi_for_each.cpp ]
     [ run multi_intersection.cpp ]
+ [ run multi_intersects.cpp ]
     [ run multi_length.cpp ]
     [ run multi_num_geometries.cpp ]
     [ run multi_num_interior_rings.cpp ]

Modified: branches/release/libs/geometry/test/multi/algorithms/multi_difference.cpp
==============================================================================
--- branches/release/libs/geometry/test/multi/algorithms/multi_difference.cpp (original)
+++ branches/release/libs/geometry/test/multi/algorithms/multi_difference.cpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -10,7 +10,8 @@
 #include <iostream>
 #include <string>
 
-// #define BOOST_GEOMETRY_DEBUG_ASSEMBLE
+//#define HAVE_TTMATH
+//#define BOOST_GEOMETRY_DEBUG_ASSEMBLE
 //#define BOOST_GEOMETRY_CHECK_WITH_SQLSERVER
 
 //#define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
@@ -38,7 +39,7 @@
 {
     test_one<Polygon, MultiPolygon, MultiPolygon>("simplex_multi",
             case_multi_simplex[0], case_multi_simplex[1],
- 5, 12, 5.58, 4, 12, 2.58);
+ 5, 21, 5.58, 4, 17, 2.58);
 
     test_one<Polygon, MultiPolygon, MultiPolygon>("case_multi_no_ip",
             case_multi_no_ip[0], case_multi_no_ip[1],
@@ -49,13 +50,13 @@
 
     test_one<Polygon, MultiPolygon, Polygon>("simplex_multi_mp_p",
             case_multi_simplex[0], case_single_simplex,
- 5, 22, 5.58, 4, 17, 2.58);
+ 5, 21, 5.58, 4, 17, 2.58);
     test_one<Polygon, Ring, MultiPolygon>("simplex_multi_r_mp",
             case_single_simplex, case_multi_simplex[0],
- 4, 17, 2.58, 5, 22, 5.58);
+ 4, 17, 2.58, 5, 21, 5.58);
     test_one<Ring, MultiPolygon, Polygon>("simplex_multi_mp_r",
             case_multi_simplex[0], case_single_simplex,
- 5, 22, 5.58, 4, 17, 2.58);
+ 5, 21, 5.58, 4, 17, 2.58);
 
     // Constructed cases for multi/touch/equal/etc
     test_one<Polygon, MultiPolygon, MultiPolygon>("case_61_multi",
@@ -69,7 +70,7 @@
             0, 0, 0, 1, 5, 1);
     test_one<Polygon, MultiPolygon, MultiPolygon>("case_64_multi",
         case_64_multi[0], case_64_multi[1],
- 1, 1, 1, 1, 1, 1);
+ 1, 5, 1, 1, 5, 1);
     test_one<Polygon, MultiPolygon, MultiPolygon>("case_65_multi",
         case_65_multi[0], case_65_multi[1],
             0, 0, 0, 2, 10, 3);
@@ -84,22 +85,22 @@
 
     test_one<Polygon, MultiPolygon, MultiPolygon>("case_78_multi",
         case_78_multi[0], case_78_multi[1],
- 1, 1, 1.0, 1, 1, 1.0);
+ 1, 5, 1.0, 1, 5, 1.0);
 
     // Ticket on GGL list 2011/10/25
     // to mix polygon/multipolygon in call to difference
     test_one<Polygon, Polygon, Polygon>("ggl_list_20111025_vd_pp",
         ggl_list_20111025_vd[0], ggl_list_20111025_vd[1],
- 1, -999, 8.0, 1, -999, 12.5);
+ 1, 4, 8.0, 1, 4, 12.5);
     test_one<Polygon, Polygon, MultiPolygon>("ggl_list_20111025_vd_pm",
         ggl_list_20111025_vd[0], ggl_list_20111025_vd[3],
- 1, -999, 8.0, 1, -999, 12.5);
+ 1, 4, 8.0, 1, 4, 12.5);
     test_one<Polygon, MultiPolygon, Polygon>("ggl_list_20111025_vd_mp",
         ggl_list_20111025_vd[2], ggl_list_20111025_vd[1],
- 1, -999, 8.0, 1, -999, 12.5);
+ 1, 4, 8.0, 1, 4, 12.5);
     test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20111025_vd_mm",
         ggl_list_20111025_vd[2], ggl_list_20111025_vd[3],
- 1, -999, 8.0, 1, -999, 12.5);
+ 1, 4, 8.0, 1, 4, 12.5);
 
     // Second case
     // This can be tested with this SQL for SQL-Server
@@ -120,7 +121,19 @@
 
     test_one<Polygon, Polygon, MultiPolygon>("ggl_list_20111025_vd_2",
         ggl_list_20111025_vd_2[0], ggl_list_20111025_vd_2[1],
- 1, -999, 10.0, 2, -999, 6.0);
+ 1, 7, 10.0, 2, 10, 6.0);
+
+ test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_a",
+ ggl_list_20120915_h2[0], ggl_list_20120915_h2[1],
+ 2, 13, 17.0, 0, 0, 0.0);
+ test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_b",
+ ggl_list_20120915_h2[0], ggl_list_20120915_h2[2],
+ 2, 13, 17.0, 0, 0, 0.0);
+
+ test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120221_volker",
+ ggl_list_20120221_volker[0], ggl_list_20120221_volker[1],
+ 2, 12, 7962.66, 1, 18, 2775258.93,
+ 0.001);
 
 
     /* TODO: fix

Modified: branches/release/libs/geometry/test/multi/algorithms/multi_disjoint.cpp
==============================================================================
--- branches/release/libs/geometry/test/multi/algorithms/multi_disjoint.cpp (original)
+++ branches/release/libs/geometry/test/multi/algorithms/multi_disjoint.cpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -22,6 +22,7 @@
 #include <boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp>
 #include <boost/geometry/multi/algorithms/detail/point_on_border.hpp>
 #include <boost/geometry/multi/algorithms/detail/for_each_range.hpp>
+#include <boost/geometry/multi/algorithms/disjoint.hpp>
 #include <boost/geometry/multi/algorithms/within.hpp>
 #include <boost/geometry/multi/core/closure.hpp>
 #include <boost/geometry/multi/core/geometry_id.hpp>
@@ -97,6 +98,39 @@
         "MULTIPOLYGON(((2 12,2 18,8 18,8 12,2 12)),((22 2,28 2,28 8,22 8,22 2)))",
         "MULTIPOLYGON(((2 2,2 8,8 8,8 2,2 2)),((20 0,20 10,30 10,30 0,20 0)))",
         false);
+
+
+ test_disjoint<P, mp>("point_mp1",
+ "POINT(0 0)",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ false);
+
+ test_disjoint<P, mp>("point_mp2",
+ "POINT(5 5)",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ false);
+
+ test_disjoint<P, mp>("point_mp1",
+ "POINT(11 11)",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ true);
+
+ std::string polygon_inside_hole("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0), (2 2,8 2,8 8,2 8,2 2)),((4 4,4 6,6 6,6 4,4 4)))");
+ test_disjoint<P, mp>("point_mp_pih1",
+ "POINT(5 5)",
+ polygon_inside_hole,
+ false);
+
+ test_disjoint<P, mp>("point_mp_pih2",
+ "POINT(3 3)",
+ polygon_inside_hole,
+ true);
+
+ test_disjoint<mp, P>("point_mp1rev",
+ "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
+ "POINT(0 0)",
+ false);
+
 }
 
 int test_main(int, char* [])

Modified: branches/release/libs/geometry/test/multi/algorithms/multi_intersection.cpp
==============================================================================
--- branches/release/libs/geometry/test/multi/algorithms/multi_intersection.cpp (original)
+++ branches/release/libs/geometry/test/multi/algorithms/multi_intersection.cpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -100,6 +100,13 @@
      test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_4",
          case_recursive_boxes_4[0], case_recursive_boxes_4[1],
          13, 157, 67.0); // Area from SQL Server
+
+ test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_a",
+ ggl_list_20120915_h2[0], ggl_list_20120915_h2[1],
+ 2, 10, 6.0); // Area from SQL Server
+ test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_b",
+ ggl_list_20120915_h2[0], ggl_list_20120915_h2[2],
+ 2, 10, 6.0); // Area from SQL Server
 }
 
 template <typename Polygon, typename MultiPolygon, typename Box>

Modified: branches/release/libs/geometry/test/multi/algorithms/multi_union.cpp
==============================================================================
--- branches/release/libs/geometry/test/multi/algorithms/multi_union.cpp (original)
+++ branches/release/libs/geometry/test/multi/algorithms/multi_union.cpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -106,6 +106,13 @@
     test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_3",
         case_recursive_boxes_3[0], case_recursive_boxes_3[1],
         17, 0, 159, 56.5); // Area from SQL Server
+
+ test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_a",
+ ggl_list_20120915_h2[0], ggl_list_20120915_h2[1],
+ 1, 0, 12, 23.0); // Area from SQL Server
+ test_one<Polygon, MultiPolygon, MultiPolygon>("ggl_list_20120915_h2_b",
+ ggl_list_20120915_h2[0], ggl_list_20120915_h2[2],
+ 1, 0, 12, 23.0); // Area from SQL Server
 }
 
 template <typename P>

Modified: branches/release/libs/geometry/test/multi/algorithms/overlay/multi_overlay_cases.hpp
==============================================================================
--- branches/release/libs/geometry/test/multi/algorithms/overlay/multi_overlay_cases.hpp (original)
+++ branches/release/libs/geometry/test/multi/algorithms/overlay/multi_overlay_cases.hpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -426,6 +426,21 @@
     "MULTIPOLYGON(((0 0,0 2,2 2,2 0,0 0)),((4 0,4 2,6 2,6 0,4 0)))"
     };
     
+// Mail of h2 indicating that reversed order (in second polygon) has ix/ix problems
+static std::string ggl_list_20120915_h2[3] =
+ {
+ "MULTIPOLYGON(((-2 5, -1 5, 0 5, 2 5, 2 -2, 1 -2, 1 -1, 0 -1,0 0, -1 0, -2 0, -2 5)))",
+ "MULTIPOLYGON(((0 0, 1 0, 1 -1, 0 -1, 0 0)), ((-1 5, 0 5, 0 0, -1 0, -1 5)))",
+ "MULTIPOLYGON(((-1 5, 0 5, 0 0, -1 0, -1 5)), ((0 0, 1 0, 1 -1, 0 -1, 0 0)))"
+ };
+
+// Mail of volker, about another problem, but this specific example is causing two-point inner rings polygons which should be discarded
+// (condition of num_points in detail/overlay/convert_ring.hpp)
+static std::string ggl_list_20120221_volker[2] =
+ {
+ "MULTIPOLYGON(((1032 2130,1032 1764,2052 2712,1032 2130)),((3234 2580,2558 2690,3234 2532,3234 2580)),((2558 2690,2136 2790,2052 2712,2136 2760,2558 2690)))",
+ "MULTIPOLYGON(((3232 2532.469945355191,2136 2790,1032 1764,1032 1458,1032 1212,2136 2328,3232 2220.196721311475,3232 1056,1031 1056,1031 2856,3232 2856,3232 2532.469945355191),(3232 2412.426229508197,2136 2646,3232 2412.426229508197)))"
+ };
 
 
 #endif // BOOST_GEOMETRY_TEST_MULTI_OVERLAY_CASES_HPP

Modified: branches/release/libs/geometry/test/multi/algorithms/overlay/multi_traverse.cpp
==============================================================================
--- branches/release/libs/geometry/test/multi/algorithms/overlay/multi_traverse.cpp (original)
+++ branches/release/libs/geometry/test/multi/algorithms/overlay/multi_traverse.cpp 2012-12-16 10:14:35 EST (Sun, 16 Dec 2012)
@@ -386,7 +386,7 @@
 
     test_traverse_union::apply
         (
- "case_recursive_boxes_3", 8, 49.5,
+ "case_recursive_boxes_3", 7, 49.5,
             case_recursive_boxes_3[0], case_recursive_boxes_3[1]
         );
 


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