Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76340 - in branches/release/boost/geometry: . algorithms algorithms/detail algorithms/detail/overlay io
From: barend.gehrels_at_[hidden]
Date: 2012-01-07 12:32:02


Author: barendgehrels
Date: 2012-01-07 12:32:00 EST (Sat, 07 Jan 2012)
New Revision: 76340
URL: http://svn.boost.org/trac/boost/changeset/76340

Log:
Added new io folder to release branch
Added:
   branches/release/boost/geometry/algorithms/detail/convert_indexed_to_indexed.hpp
      - copied unchanged from r75810, /trunk/boost/geometry/algorithms/detail/convert_indexed_to_indexed.hpp
   branches/release/boost/geometry/algorithms/detail/overlay/follow.hpp
      - copied, changed from r75577, /trunk/boost/geometry/algorithms/detail/overlay/follow.hpp
   branches/release/boost/geometry/algorithms/not_implemented.hpp
      - copied, changed from r75810, /trunk/boost/geometry/algorithms/not_implemented.hpp
   branches/release/boost/geometry/io/
Properties modified:
   branches/release/boost/geometry/algorithms/ (props changed)
   branches/release/boost/geometry/geometry.hpp (contents, props changed)
Text files modified:
   branches/release/boost/geometry/algorithms/append.hpp | 9
   branches/release/boost/geometry/algorithms/area.hpp | 22 +-
   branches/release/boost/geometry/algorithms/assign.hpp | 15 -
   branches/release/boost/geometry/algorithms/convert.hpp | 115 ++++++++-------
   branches/release/boost/geometry/algorithms/covered_by.hpp | 2
   branches/release/boost/geometry/algorithms/detail/has_self_intersections.hpp | 2
   branches/release/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp | 17 -
   branches/release/boost/geometry/algorithms/detail/overlay/copy_segments.hpp | 50 ++++++
   branches/release/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp | 10 -
   branches/release/boost/geometry/algorithms/detail/overlay/follow.hpp | 289 +++++++++++++++++++++++++++++++--------
   branches/release/boost/geometry/algorithms/detail/overlay/get_turns.hpp | 2
   branches/release/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp | 152 +++++++++++++++++++++
   branches/release/boost/geometry/algorithms/detail/overlay/overlay.hpp | 2
   branches/release/boost/geometry/algorithms/detail/overlay/traverse.hpp | 15 -
   branches/release/boost/geometry/algorithms/difference.hpp | 22 ++
   branches/release/boost/geometry/algorithms/distance.hpp | 218 ++++++++++++++++-------------
   branches/release/boost/geometry/algorithms/not_implemented.hpp | 83 ++++++++++
   branches/release/boost/geometry/algorithms/sym_difference.hpp | 36 ++++
   branches/release/boost/geometry/geometry.hpp | 6
   19 files changed, 770 insertions(+), 297 deletions(-)

Modified: branches/release/boost/geometry/algorithms/append.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/append.hpp (original)
+++ branches/release/boost/geometry/algorithms/append.hpp 2012-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -178,14 +178,18 @@
 
 
 // Default: append a range (or linestring or ring or whatever) to any geometry
-template <typename TagRangeOrPoint, typename Geometry, typename RangeOrPoint>
+template
+<
+ typename Geometry, typename RangeOrPoint,
+ typename TagRangeOrPoint = typename tag<RangeOrPoint>::type
+>
 struct append
     : splitted_dispatch::append_range<typename tag<Geometry>::type, Geometry, RangeOrPoint>
 {};
 
 // Specialization for point to append a point to any geometry
 template <typename Geometry, typename RangeOrPoint>
-struct append<point_tag, Geometry, RangeOrPoint>
+struct append<Geometry, RangeOrPoint, point_tag>
     : splitted_dispatch::append_point<typename tag<Geometry>::type, Geometry, RangeOrPoint>
 {};
 
@@ -217,7 +221,6 @@
 
     dispatch::append
         <
- typename tag<RangeOrPoint>::type,
             Geometry,
             RangeOrPoint
>::apply(geometry, range_or_point, ring_index, multi_index);

Modified: branches/release/boost/geometry/algorithms/area.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/area.hpp (original)
+++ branches/release/boost/geometry/algorithms/area.hpp 2012-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -135,9 +135,16 @@
 
 template
 <
- typename Tag,
     typename Geometry,
- typename Strategy
+ 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
@@ -153,7 +160,7 @@
     typename Geometry,
     typename Strategy
>
-struct area<box_tag, Geometry, Strategy>
+struct area<Geometry, Strategy, box_tag>
     : detail::area::box_area<Geometry, Strategy>
 {};
 
@@ -163,7 +170,7 @@
     typename Ring,
     typename Strategy
>
-struct area<ring_tag, Ring, Strategy>
+struct area<Ring, Strategy, ring_tag>
     : detail::area::ring_area
         <
             Ring,
@@ -179,7 +186,7 @@
     typename Polygon,
     typename Strategy
>
-struct area<polygon_tag, Polygon, Strategy>
+struct area<Polygon, Strategy, polygon_tag>
     : detail::calculate_polygon_sum
         <
             typename Strategy::return_type,
@@ -236,9 +243,7 @@
 
     return dispatch::area
         <
- typename tag<Geometry>::type,
- Geometry,
- strategy_type
+ Geometry
>::apply(geometry, strategy_type());
 }
 
@@ -274,7 +279,6 @@
 
     return dispatch::area
         <
- typename tag<Geometry>::type,
             Geometry,
             Strategy
>::apply(geometry, strategy);

Modified: branches/release/boost/geometry/algorithms/assign.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/assign.hpp (original)
+++ branches/release/boost/geometry/algorithms/assign.hpp 2012-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -29,20 +29,17 @@
 #include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
 #include <boost/geometry/algorithms/detail/assign_values.hpp>
 #include <boost/geometry/algorithms/convert.hpp>
-
-#include <boost/geometry/arithmetic/arithmetic.hpp>
 #include <boost/geometry/algorithms/append.hpp>
 #include <boost/geometry/algorithms/clear.hpp>
+#include <boost/geometry/arithmetic/arithmetic.hpp>
 #include <boost/geometry/core/access.hpp>
 #include <boost/geometry/core/exterior_ring.hpp>
 #include <boost/geometry/core/tags.hpp>
 
 #include <boost/geometry/geometries/concepts/check.hpp>
 
-
 #include <boost/geometry/util/for_each_coordinate.hpp>
 
-
 namespace boost { namespace geometry
 {
 
@@ -163,15 +160,7 @@
             , (types<Geometry1, Geometry2>)
         );
 
- dispatch::convert
- <
- false,
- typename tag<Geometry2>::type,
- typename tag<Geometry1>::type,
- dimension<Geometry1>::type::value,
- Geometry2,
- Geometry1
- >::apply(geometry2, geometry1);
+ dispatch::convert<Geometry2, Geometry1>::apply(geometry2, geometry1);
 }
 
 

Modified: branches/release/boost/geometry/algorithms/convert.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/convert.hpp (original)
+++ branches/release/boost/geometry/algorithms/convert.hpp 2012-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -22,6 +22,7 @@
 #include <boost/type_traits/is_array.hpp>
 
 #include <boost/geometry/arithmetic/arithmetic.hpp>
+#include <boost/geometry/algorithms/not_implemented.hpp>
 #include <boost/geometry/algorithms/append.hpp>
 #include <boost/geometry/algorithms/clear.hpp>
 #include <boost/geometry/algorithms/for_each.hpp>
@@ -29,6 +30,7 @@
 #include <boost/geometry/algorithms/detail/assign_box_corners.hpp>
 #include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
 #include <boost/geometry/algorithms/detail/convert_point_to_point.hpp>
+#include <boost/geometry/algorithms/detail/convert_indexed_to_indexed.hpp>
 
 #include <boost/geometry/views/closeable_view.hpp>
 #include <boost/geometry/views/reversible_view.hpp>
@@ -212,28 +214,24 @@
 
 template
 <
- bool UseAssignment,
- typename Tag1, typename Tag2,
- std::size_t DimensionCount,
- typename Geometry1, typename Geometry2
+ typename Geometry1, typename Geometry2,
+ typename Tag1 = typename tag_cast<typename tag<Geometry1>::type, multi_tag>::type,
+ typename Tag2 = typename tag_cast<typename tag<Geometry2>::type, multi_tag>::type,
+ std::size_t DimensionCount = dimension<Geometry1>::type::value,
+ bool UseAssignment = boost::is_same<Geometry1, Geometry2>::value
+ && !boost::is_array<Geometry1>::value
>
-struct convert
-{
- BOOST_MPL_ASSERT_MSG
- (
- false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPES
- , (types<Geometry1, Geometry2>)
- );
-};
+struct convert: not_implemented<Tag1, Tag2, mpl::int_<DimensionCount> >
+{};
 
 
 template
 <
+ typename Geometry1, typename Geometry2,
     typename Tag,
- std::size_t DimensionCount,
- typename Geometry1, typename Geometry2
+ std::size_t DimensionCount
>
-struct convert<true, Tag, Tag, DimensionCount, Geometry1, Geometry2>
+struct convert<Geometry1, Geometry2, Tag, Tag, DimensionCount, true>
 {
     // Same geometry type -> copy whole geometry
     static inline void apply(Geometry1 const& source, Geometry2& destination)
@@ -245,21 +243,42 @@
 
 template
 <
- std::size_t DimensionCount,
- typename Geometry1, typename Geometry2
+ typename Geometry1, typename Geometry2,
+ std::size_t DimensionCount
>
-struct convert<false, point_tag, point_tag, DimensionCount, Geometry1, Geometry2>
+struct convert<Geometry1, Geometry2, point_tag, point_tag, DimensionCount, false>
     : detail::conversion::point_to_point<Geometry1, Geometry2, 0, DimensionCount>
 {};
 
-template <std::size_t DimensionCount, typename Segment, typename LineString>
-struct convert<false, segment_tag, linestring_tag, DimensionCount, Segment, LineString>
+
+template
+<
+ typename Box1, typename Box2,
+ std::size_t DimensionCount
+>
+struct convert<Box1, Box2, box_tag, box_tag, DimensionCount, false>
+ : detail::conversion::indexed_to_indexed<Box1, Box2, 0, DimensionCount>
+{};
+
+
+template
+<
+ typename Segment1, typename Segment2,
+ std::size_t DimensionCount
+>
+struct convert<Segment1, Segment2, segment_tag, segment_tag, DimensionCount, false>
+ : detail::conversion::indexed_to_indexed<Segment1, Segment2, 0, DimensionCount>
+{};
+
+
+template <typename Segment, typename LineString, std::size_t DimensionCount>
+struct convert<Segment, LineString, segment_tag, linestring_tag, DimensionCount, false>
     : detail::conversion::segment_to_range<Segment, LineString>
 {};
 
 
-template <std::size_t DimensionCount, typename Ring1, typename Ring2>
-struct convert<false, ring_tag, ring_tag, DimensionCount, Ring1, Ring2>
+template <typename Ring1, typename Ring2, std::size_t DimensionCount>
+struct convert<Ring1, Ring2, ring_tag, ring_tag, DimensionCount, false>
     : detail::conversion::range_to_range
         <
             Ring1,
@@ -269,18 +288,18 @@
>
 {};
 
-template <std::size_t DimensionCount, typename LineString1, typename LineString2>
-struct convert<false, linestring_tag, linestring_tag, DimensionCount, LineString1, LineString2>
+template <typename LineString1, typename LineString2, std::size_t DimensionCount>
+struct convert<LineString1, LineString2, linestring_tag, linestring_tag, DimensionCount, false>
     : detail::conversion::range_to_range<LineString1, LineString2>
 {};
 
-template <std::size_t DimensionCount, typename Polygon1, typename Polygon2>
-struct convert<false, polygon_tag, polygon_tag, DimensionCount, Polygon1, Polygon2>
+template <typename Polygon1, typename Polygon2, std::size_t DimensionCount>
+struct convert<Polygon1, Polygon2, polygon_tag, polygon_tag, DimensionCount, false>
     : detail::conversion::polygon_to_polygon<Polygon1, Polygon2>
 {};
 
 template <typename Box, typename Ring>
-struct convert<false, box_tag, ring_tag, 2, Box, Ring>
+struct convert<Box, Ring, box_tag, ring_tag, 2, false>
     : detail::conversion::box_to_range
         <
             Box,
@@ -292,7 +311,7 @@
 
 
 template <typename Box, typename Polygon>
-struct convert<false, box_tag, polygon_tag, 2, Box, Polygon>
+struct convert<Box, Polygon, box_tag, polygon_tag, 2, false>
 {
     static inline void apply(Box const& box, Polygon& polygon)
     {
@@ -300,15 +319,16 @@
 
         convert
             <
- false, box_tag, ring_tag,
- 2, Box, ring_type
+ Box, ring_type,
+ box_tag, ring_tag,
+ 2, false
>::apply(box, exterior_ring(polygon));
     }
 };
 
 
-template <typename Point, std::size_t DimensionCount, typename Box>
-struct convert<false, point_tag, box_tag, DimensionCount, Point, Box>
+template <typename Point, typename Box, std::size_t DimensionCount>
+struct convert<Point, Box, point_tag, box_tag, DimensionCount, false>
 {
     static inline void apply(Point const& point, Box& box)
     {
@@ -324,23 +344,24 @@
 };
 
 
-template <typename Ring, std::size_t DimensionCount, typename Polygon>
-struct convert<false, ring_tag, polygon_tag, DimensionCount, Ring, Polygon>
+template <typename Ring, typename Polygon, std::size_t DimensionCount>
+struct convert<Ring, Polygon, ring_tag, polygon_tag, DimensionCount, false>
 {
     static inline void apply(Ring const& ring, Polygon& polygon)
     {
         typedef typename ring_type<Polygon>::type ring_type;
         convert
             <
- false, ring_tag, ring_tag, DimensionCount,
- Ring, ring_type
+ Ring, ring_type,
+ ring_tag, ring_tag,
+ DimensionCount, false
>::apply(ring, exterior_ring(polygon));
     }
 };
 
 
-template <typename Polygon, std::size_t DimensionCount, typename Ring>
-struct convert<false, polygon_tag, ring_tag, DimensionCount, Polygon, Ring>
+template <typename Polygon, typename Ring, std::size_t DimensionCount>
+struct convert<Polygon, Ring, polygon_tag, ring_tag, DimensionCount, false>
 {
     static inline void apply(Polygon const& polygon, Ring& ring)
     {
@@ -348,9 +369,9 @@
 
         convert
             <
- false,
- ring_tag, ring_tag, DimensionCount,
- ring_type, Ring
+ ring_type, Ring,
+ ring_tag, ring_tag,
+ DimensionCount, false
>::apply(exterior_ring(polygon), ring);
     }
 };
@@ -380,17 +401,7 @@
 {
     concept::check_concepts_and_equal_dimensions<Geometry1 const, Geometry2>();
 
- dispatch::convert
- <
- boost::is_same<Geometry1, Geometry2>::value
- // && boost::has_assign<Geometry2>::value, -- type traits extensions
- && ! boost::is_array<Geometry1>::value,
- typename tag_cast<typename tag<Geometry1>::type, multi_tag>::type,
- typename tag_cast<typename tag<Geometry2>::type, multi_tag>::type,
- dimension<Geometry1>::type::value,
- Geometry1,
- Geometry2
- >::apply(geometry1, geometry2);
+ dispatch::convert<Geometry1, Geometry2>::apply(geometry1, geometry2);
 }
 
 

Modified: branches/release/boost/geometry/algorithms/covered_by.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/covered_by.hpp (original)
+++ branches/release/boost/geometry/algorithms/covered_by.hpp 2012-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -170,7 +170,7 @@
 \param geometry1 \param_geometry geometry which might be covered_by the second geometry
 \param geometry2 \param_geometry which might contain the first geometry
 \param strategy strategy to be used
-\return true if geometry1 is completely contained covered_by geometry2,
+\return true if geometry1 is inside of or on the border of geometry2,
     else false
 
 \qbk{distinguish,with strategy}

Modified: branches/release/boost/geometry/algorithms/detail/has_self_intersections.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/has_self_intersections.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/has_self_intersections.hpp 2012-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -21,7 +21,7 @@
 
 #ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS
 # include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
-# include <boost/geometry/util/write_dsv.hpp>
+# include <boost/geometry/io/dsv/write.hpp>
 #endif
 
 

Modified: branches/release/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp 2012-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -9,34 +9,26 @@
 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_BACKTRACK_CHECK_SI_HPP
 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_BACKTRACK_CHECK_SI_HPP
 
-
 #include <cstddef>
-
 #include <string>
 
 #include <boost/range.hpp>
 
-#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
 #include <boost/geometry/core/access.hpp>
-
-# include <boost/geometry/algorithms/detail/has_self_intersections.hpp>
-
-
+#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
+#include <boost/geometry/algorithms/detail/has_self_intersections.hpp>
 #if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION) || defined(BOOST_GEOMETRY_OVERLAY_REPORT_WKT)
 # include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
-# include <boost/geometry/domains/gis/io/wkt/wkt.hpp>
+# include <boost/geometry/io/wkt/wkt.hpp>
 #endif
 
-
 namespace boost { namespace geometry
 {
 
-
 #ifndef DOXYGEN_NO_DETAIL
 namespace detail { namespace overlay
 {
 
-
 template <typename Turns>
 inline void clear_visit_info(Turns& turns)
 {
@@ -170,12 +162,9 @@
 };
 #endif // BOOST_GEOMETRY_OVERLAY_REPORT_WKT
 
-
 }} // namespace detail::overlay
 #endif // DOXYGEN_NO_DETAIL
 
-
 }} // namespace boost::geometry
 
-
 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_BACKTRACK_CHECK_SI_HPP

Modified: branches/release/boost/geometry/algorithms/detail/overlay/copy_segments.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/copy_segments.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/copy_segments.hpp 2012-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -98,6 +98,41 @@
     }
 };
 
+template
+<
+ typename LineString,
+ bool Reverse,
+ typename SegmentIdentifier,
+ typename RangeOut
+>
+struct copy_segments_linestring
+{
+
+ typedef typename boost::range_iterator<LineString const>::type iterator;
+
+ static inline void apply(LineString const& ls,
+ SegmentIdentifier const& seg_id, int to_index,
+ RangeOut& current_output)
+ {
+ int const from_index = seg_id.segment_index + 1;
+
+ // Sanity check
+ if (from_index > to_index || from_index < 0 || to_index >= boost::size(ls))
+ {
+ return;
+ }
+
+ typedef typename boost::range_difference<LineString>::type size_type;
+ size_type const count = to_index - from_index + 1;
+
+ typename boost::range_iterator<LineString const>::type it = boost::begin(ls) + from_index;
+
+ for (size_type i = 0; i < count; ++i, ++it)
+ {
+ detail::overlay::append_no_duplicates(current_output, *it);
+ }
+ }
+};
 
 template
 <
@@ -208,6 +243,21 @@
 {};
 
 
+
+template
+<
+ typename LineString,
+ bool Reverse,
+ typename SegmentIdentifier,
+ typename RangeOut
+>
+struct copy_segments<linestring_tag, LineString, Reverse, SegmentIdentifier, RangeOut>
+ : detail::copy_segments::copy_segments_linestring
+ <
+ LineString, Reverse, SegmentIdentifier, RangeOut
+ >
+{};
+
 template
 <
     typename Polygon,

Modified: branches/release/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp 2012-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -9,7 +9,6 @@
 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ENRICH_HPP
 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ENRICH_HPP
 
-
 #include <cstddef>
 #include <algorithm>
 #include <map>
@@ -19,26 +18,21 @@
 #ifdef BOOST_GEOMETRY_DEBUG_ENRICH
 # include <iostream>
 # include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
-# include <boost/geometry/domains/gis/io/wkt/wkt.hpp>
+# include <boost/geometry/io/wkt/wkt.hpp>
 # define BOOST_GEOMETRY_DEBUG_IDENTIFIER
 #endif
 
 #include <boost/assert.hpp>
 #include <boost/range.hpp>
 
-
-
 #include <boost/geometry/algorithms/detail/ring_identifier.hpp>
 #include <boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp>
 #include <boost/geometry/algorithms/detail/overlay/get_relative_order.hpp>
-
 #include <boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp>
-
 #ifdef BOOST_GEOMETRY_DEBUG_ENRICH
 # include <boost/geometry/algorithms/detail/overlay/check_enrich.hpp>
 #endif
 
-
 namespace boost { namespace geometry
 {
 
@@ -524,8 +518,6 @@
 
 }
 
-
 }} // namespace boost::geometry
 
-
 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_ENRICH_HPP

Copied: branches/release/boost/geometry/algorithms/detail/overlay/follow.hpp (from r75577, /trunk/boost/geometry/algorithms/detail/overlay/follow.hpp)
==============================================================================
--- /trunk/boost/geometry/algorithms/detail/overlay/follow.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/follow.hpp 2012-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -12,14 +12,13 @@
 #include <cstddef>
 
 #include <boost/range.hpp>
+#include <boost/mpl/assert.hpp>
 
 #include <boost/geometry/algorithms/detail/overlay/append_no_duplicates.hpp>
 #include <boost/geometry/algorithms/detail/overlay/copy_segments.hpp>
 #include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
-#include <boost/geometry/core/access.hpp>
-#include <boost/geometry/core/coordinate_dimension.hpp>
-#include <boost/geometry/geometries/concepts/check.hpp>
 
+#include <boost/geometry/algorithms/within.hpp>
 
 
 namespace boost { namespace geometry
@@ -30,7 +29,207 @@
 namespace detail { namespace overlay
 {
 
+namespace following
+{
+
+template <typename Turn, typename Operation>
+static inline bool is_entering(Turn const& turn, Operation const& op)
+{
+ // (Blocked means: blocked for polygon/polygon intersection, because
+ // they are reversed. But for polygon/line it is similar to continue)
+ return op.operation == operation_intersection
+ || op.operation == operation_continue
+ || op.operation == operation_blocked
+ ;
+}
+
+template
+<
+ typename Turn,
+ typename Operation,
+ typename LineString,
+ typename Polygon
+>
+static inline bool is_leaving(Turn const& turn, Operation const& op,
+ bool entered, bool first,
+ LineString const& linestring, Polygon const& polygon)
+{
+ if (op.operation == operation_union)
+ {
+ return entered
+ || turn.method == method_crosses
+ || (first && geometry::within(linestring[0], polygon))
+ ;
+ }
+ return false;
+}
+
+
+template
+<
+ typename Turn,
+ typename Operation,
+ typename LineString,
+ typename Polygon
+>
+static inline bool is_staying_inside(Turn const& turn, Operation const& op,
+ bool entered, bool first,
+ LineString const& linestring, Polygon const& polygon)
+{
+ if (turn.method == method_crosses)
+ {
+ // The normal case, this is completely covered with entering/leaving
+ // so stay out of this time consuming "within"
+ return false;
+ }
+
+ if (is_entering(turn, op))
+ {
+ return entered || (first && geometry::within(linestring[0], polygon));
+ }
+
+ return false;
+}
+
+template <typename Turn>
+static inline bool was_entered(Turn const& turn, bool first)
+{
+ if (first && (turn.method == method_collinear || turn.method == method_equal))
+ {
+ // If it is the very first point, and either equal or collinear, there is only one
+ // IP generated (on purpose). So consider this as having entered.
+ // Maybe it will leave immediately after that (u/i) but that is checked later.
+ return true;
+ }
+ return false;
+}
+
+
+// Template specialization structure to call the right actions for the right type
+template<overlay_type OverlayType>
+struct action_selector
+{
+ // If you get here the overlay type is not intersection or difference
+ // BOOST_MPL_ASSERT(false);
+};
+
+// Specialization for intersection, containing the implementation
+template<>
+struct action_selector<overlay_intersection>
+{
+ template
+ <
+ typename OutputIterator,
+ typename LineStringOut,
+ typename LineString,
+ typename Point,
+ typename Operation
+ >
+ static inline void enter(LineStringOut& current_piece,
+ LineString const& linestring,
+ segment_identifier& segment_id,
+ int index, Point const& point,
+ Operation const& operation, OutputIterator& out)
+ {
+ // On enter, append the intersection point and remember starting point
+ detail::overlay::append_no_duplicates(current_piece, point);
+ segment_id = operation.seg_id;
+ }
+
+ template
+ <
+ typename OutputIterator,
+ typename LineStringOut,
+ typename LineString,
+ typename Point,
+ typename Operation
+ >
+ static inline void leave(LineStringOut& current_piece,
+ LineString const& linestring,
+ segment_identifier& segment_id,
+ int index, Point const& point,
+ Operation const& operation, OutputIterator& out)
+ {
+ // On leave, copy all segments from starting point, append the intersection point
+ // and add the output piece
+ geometry::copy_segments<false>(linestring, segment_id, index, current_piece);
+ detail::overlay::append_no_duplicates(current_piece, point);
+ if (! current_piece.empty())
+ {
+ *out++ = current_piece;
+ current_piece.clear();
+ }
+ }
+
+ static inline bool is_entered(bool entered)
+ {
+ return entered;
+ }
 
+ template <typename Point, typename Geometry>
+ static inline bool included(Point const& point, Geometry const& geometry)
+ {
+ return geometry::within(point, geometry);
+ }
+
+};
+
+// Specialization for difference, which reverses these actions
+template<>
+struct action_selector<overlay_difference>
+{
+ typedef action_selector<overlay_intersection> normal_action;
+
+ template
+ <
+ typename OutputIterator,
+ typename LineStringOut,
+ typename LineString,
+ typename Point,
+ typename Operation
+ >
+ static inline void enter(LineStringOut& current_piece,
+ LineString const& linestring,
+ segment_identifier& segment_id,
+ int index, Point const& point,
+ Operation const& operation, OutputIterator& out)
+ {
+ normal_action::leave(current_piece, linestring, segment_id, index,
+ point, operation, out);
+ }
+
+ template
+ <
+ typename OutputIterator,
+ typename LineStringOut,
+ typename LineString,
+ typename Point,
+ typename Operation
+ >
+ static inline void leave(LineStringOut& current_piece,
+ LineString const& linestring,
+ segment_identifier& segment_id,
+ int index, Point const& point,
+ Operation const& operation, OutputIterator& out)
+ {
+ normal_action::enter(current_piece, linestring, segment_id, index,
+ point, operation, out);
+ }
+
+ static inline bool is_entered(bool entered)
+ {
+ return ! normal_action::is_entered(entered);
+ }
+
+ template <typename Point, typename Geometry>
+ static inline bool included(Point const& point, Geometry const& geometry)
+ {
+ return ! normal_action::included(point, geometry);
+ }
+
+};
+
+}
 
 /*!
 \brief Follows a linestring from intersection point to intersection point, outputting which
@@ -41,7 +240,8 @@
 <
     typename LineStringOut,
     typename LineString,
- typename Polygon
+ typename Polygon,
+ overlay_type OverlayType
>
 class follow
 {
@@ -61,55 +261,16 @@
         }
     };
 
- template <typename Turn, typename Operation>
- static inline bool is_entering(Turn const& turn, Operation const& op)
- {
- // (Blocked means: blocked for polygon/polygon intersection, because
- // they are reversed. But for polygon/line it is similar to continue)
- return op.operation == operation_intersection
- || op.operation == operation_continue
- || op.operation == operation_blocked
- ;
- }
 
- template <typename Turn, typename Operation>
- static inline bool is_leaving(Turn const& turn, Operation const& op,
- bool entered, bool first,
- LineString const& linestring, Polygon const& polygon)
- {
- if (op.operation == operation_union)
- {
- return entered
- || turn.method == method_crosses
- || (first && geometry::within(linestring[0], polygon))
- ;
- }
- return false;
- }
 
+public :
 
- template <typename Turn, typename Operation>
- static inline bool is_staying_inside(Turn const& turn, Operation const& op,
- bool entered, bool first,
- LineString const& linestring, Polygon const& polygon)
+ template <typename Point, typename Geometry>
+ static inline bool included(Point const& point, Geometry const& geometry)
     {
- if (turn.method == method_crosses)
- {
- // The normal case, this is completely covered with entering/leaving
- // so stay out of this time consuming "within"
- return false;
- }
-
- if (is_entering(turn, op))
- {
- return entered || (first && geometry::within(linestring[0], polygon));
- }
-
- return false;
+ return following::action_selector<OverlayType>::included(point, geometry);
     }
 
-
-public :
     template<typename Turns, typename OutputIterator>
     static inline OutputIterator apply(LineString const& linestring, Polygon const& polygon,
                 detail::overlay::operation_type operation,
@@ -122,6 +283,7 @@
                 typename turn_type::container_type
>::type turn_operation_iterator_type;
 
+ typedef following::action_selector<OverlayType> action;
 
         // Sort intersection points on segments-along-linestring, and distance
         // (like in enrich is done for poly/poly)
@@ -137,53 +299,50 @@
         {
             turn_operation_iterator_type iit = boost::begin(it->operations);
 
- if (is_staying_inside(*it, *iit, entered, first, linestring, polygon))
+ if (following::was_entered(*it, first))
+ {
+ debug_traverse(*it, *iit, "-> Was entered");
+ entered = true;
+ }
+
+ if (following::is_staying_inside(*it, *iit, entered, first, linestring, polygon))
             {
                 debug_traverse(*it, *iit, "-> Staying inside");
 
                 entered = true;
             }
- else if (is_entering(*it, *iit))
+ else if (following::is_entering(*it, *iit))
             {
                 debug_traverse(*it, *iit, "-> Entering");
 
                 entered = true;
- detail::overlay::append_no_duplicates(current_piece, it->point);
- current_segment_id = iit->seg_id;
+ action::enter(current_piece, linestring, current_segment_id, iit->seg_id.segment_index, it->point, *iit, out);
             }
- else if (is_leaving(*it, *iit, entered, first, linestring, polygon))
+ else if (following::is_leaving(*it, *iit, entered, first, linestring, polygon))
             {
                 debug_traverse(*it, *iit, "-> Leaving");
 
                 entered = false;
- geometry::copy_segments<false>(linestring, current_segment_id,
- iit->seg_id.segment_index,
- current_piece);
- detail::overlay::append_no_duplicates(current_piece, it->point);
-
- if (! current_piece.empty())
- {
- *out++ = current_piece;
- current_piece.clear();
- }
+ action::leave(current_piece, linestring, current_segment_id, iit->seg_id.segment_index, it->point, *iit, out);
             }
             first = false;
         }
 
- if (entered)
+ if (action::is_entered(entered))
         {
- geometry::copy_segments<false>(linestring, current_segment_id,
+ geometry::copy_segments<false>(linestring, current_segment_id,
                     boost::size(linestring) - 1,
                     current_piece);
         }
 
- // Add the last one, if applicable
+ // Output the last one, if applicable
         if (! current_piece.empty())
         {
             *out++ = current_piece;
         }
         return out;
     }
+
 };
 
 

Modified: branches/release/boost/geometry/algorithms/detail/overlay/get_turns.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/detail/overlay/get_turns.hpp (original)
+++ branches/release/boost/geometry/algorithms/detail/overlay/get_turns.hpp 2012-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -58,7 +58,7 @@
 
 #ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
 # include <sstream>
-# include <boost/geometry/util/write_dsv.hpp>
+# include <boost/geometry/io/dsv/write.hpp>
 #endif
 
 

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-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -26,8 +26,12 @@
 #include <boost/geometry/algorithms/detail/overlay/get_intersection_points.hpp>
 #include <boost/geometry/algorithms/detail/overlay/overlay.hpp>
 #include <boost/geometry/algorithms/detail/overlay/overlay_type.hpp>
+#include <boost/geometry/algorithms/detail/overlay/follow.hpp>
 #include <boost/geometry/views/segment_view.hpp>
 
+#if defined(BOOST_GEOMETRY_DEBUG_FOLLOW)
+#include <boost/foreach.hpp>
+#endif
 
 namespace boost { namespace geometry
 {
@@ -102,6 +106,98 @@
     }
 };
 
+/*!
+\brief Version of linestring with an areal feature (polygon or multipolygon)
+*/
+template
+<
+ typename LineString, typename Areal,
+ bool ReverseAreal,
+ typename OutputIterator, typename LineStringOut,
+ overlay_type OverlayType,
+ typename Strategy
+>
+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,
+ int index)
+ {
+ std::cout << index
+ << " at " << op.seg_id
+ << " meth: " << method_char(turn.method)
+ << " op: " << operation_char(op.operation)
+ << " vis: " << visited_char(op.visited)
+ << " of: " << operation_char(turn.operations[0].operation)
+ << operation_char(turn.operations[1].operation)
+ << " " << geometry::wkt(turn.point)
+ << std::endl;
+ }
+#endif
+
+ static inline OutputIterator apply(LineString const& linestring, Areal const& areal,
+ OutputIterator out,
+ Strategy const& strategy)
+ {
+ if (boost::size(linestring) == 0)
+ {
+ return out;
+ }
+
+ typedef typename point_type<LineStringOut>::type point_type;
+
+ typedef detail::overlay::traversal_turn_info<point_type> turn_info;
+ std::deque<turn_info> turns;
+
+ detail::get_turns::no_interrupt_policy policy;
+ geometry::get_turns
+ <
+ false,
+ (OverlayType == overlay_intersection ? ReverseAreal : !ReverseAreal),
+ detail::overlay::calculate_distance_policy
+ >(linestring, areal, turns, policy);
+
+ if (turns.empty())
+ {
+ // No intersection points, it is either completely
+ // inside (interior + borders)
+ // or completely outside
+ if (follower::included(*boost::begin(linestring), areal))
+ {
+ LineStringOut copy;
+ geometry::convert(linestring, copy);
+ *out++ = copy;
+ }
+ return out;
+ }
+
+#if defined(BOOST_GEOMETRY_DEBUG_FOLLOW)
+ int index = 0;
+ BOOST_FOREACH(turn_info const& turn, turns)
+ {
+ debug_follow(turn, turn.operations[0], index++);
+ }
+#endif
+
+ return follower::apply
+ (
+ linestring, areal,
+ geometry::detail::overlay::operation_intersection,
+ turns, out
+ );
+ }
+};
+
+
 }} // namespace detail::intersection
 #endif // DOXYGEN_NO_DETAIL
 
@@ -264,6 +360,62 @@
     }
 };
 
+
+template
+<
+ typename Linestring, typename Polygon,
+ bool ReverseLinestring, bool ReversePolygon, bool ReverseOut,
+ typename OutputIterator, typename GeometryOut,
+ overlay_type OverlayType,
+ typename Strategy
+>
+struct intersection_insert
+ <
+ linestring_tag, polygon_tag, linestring_tag,
+ false, true, false,
+ Linestring, Polygon,
+ ReverseLinestring, ReversePolygon, ReverseOut,
+ OutputIterator, GeometryOut,
+ OverlayType,
+ Strategy
+ > : detail::intersection::intersection_of_linestring_with_areal
+ <
+ Linestring, Polygon,
+ ReversePolygon,
+ OutputIterator, GeometryOut,
+ OverlayType,
+ Strategy
+ >
+{};
+
+
+template
+<
+ typename Linestring, typename Ring,
+ bool ReverseLinestring, bool ReverseRing, bool ReverseOut,
+ typename OutputIterator, typename GeometryOut,
+ overlay_type OverlayType,
+ typename Strategy
+>
+struct intersection_insert
+ <
+ linestring_tag, ring_tag, linestring_tag,
+ false, true, false,
+ Linestring, Ring,
+ ReverseLinestring, ReverseRing, ReverseOut,
+ OutputIterator, GeometryOut,
+ OverlayType,
+ Strategy
+ > : detail::intersection::intersection_of_linestring_with_areal
+ <
+ Linestring, Ring,
+ ReverseRing,
+ OutputIterator, GeometryOut,
+ OverlayType,
+ Strategy
+ >
+{};
+
 template
 <
     typename Segment, typename Box,

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-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -37,7 +37,7 @@
 
 
 #ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE
-# include <boost/geometry/util/write_dsv.hpp>
+# include <boost/geometry/io/dsv/write.hpp>
 #endif
 
 

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-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -9,7 +9,6 @@
 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_TRAVERSE_HPP
 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_TRAVERSE_HPP
 
-
 #include <cstddef>
 
 #include <boost/range.hpp>
@@ -22,19 +21,17 @@
 #include <boost/geometry/core/coordinate_dimension.hpp>
 #include <boost/geometry/geometries/concepts/check.hpp>
 
-
-#if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION) || defined(BOOST_GEOMETRY_OVERLAY_REPORT_WKT)
+#if defined(BOOST_GEOMETRY_DEBUG_INTERSECTION) \
+ || defined(BOOST_GEOMETRY_OVERLAY_REPORT_WKT) \
+ || defined(BOOST_GEOMETRY_DEBUG_TRAVERSE)
 # include <string>
 # include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
-# include <boost/geometry/domains/gis/io/wkt/wkt.hpp>
+# include <boost/geometry/io/wkt/wkt.hpp>
 #endif
 
-
-
 namespace boost { namespace geometry
 {
 
-
 #ifndef DOXYGEN_NO_DETAIL
 namespace detail { namespace overlay
 {
@@ -46,10 +43,12 @@
 #ifdef BOOST_GEOMETRY_DEBUG_TRAVERSE
     std::cout << header
         << " at " << op.seg_id
+ << " meth: " << method_char(turn.method)
         << " op: " << operation_char(op.operation)
         << " vis: " << visited_char(op.visited)
         << " of: " << operation_char(turn.operations[0].operation)
         << operation_char(turn.operations[1].operation)
+ << " " << geometry::wkt(turn.point)
         << std::endl;
 
     if (boost::contains(header, "Finished"))
@@ -387,8 +386,6 @@
 }} // namespace detail::overlay
 #endif // DOXYGEN_NO_DETAIL
 
-
 }} // namespace boost::geometry
 
-
 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_TRAVERSE_HPP

Modified: branches/release/boost/geometry/algorithms/difference.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/difference.hpp (original)
+++ branches/release/boost/geometry/algorithms/difference.hpp 2012-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -53,11 +53,23 @@
     concept::check<Geometry1 const>();
     concept::check<Geometry2 const>();
     concept::check<GeometryOut>();
-
- return detail::intersection::insert<GeometryOut, true, overlay_difference>(
- geometry1, geometry2,
- out,
- strategy);
+
+ 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,
+ overlay_difference,
+ Strategy
+ >::apply(geometry1, geometry2, out, strategy);
 }
 
 /*!

Modified: branches/release/boost/geometry/algorithms/distance.hpp
==============================================================================
--- branches/release/boost/geometry/algorithms/distance.hpp (original)
+++ branches/release/boost/geometry/algorithms/distance.hpp 2012-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -19,15 +19,13 @@
 #include <boost/range.hpp>
 #include <boost/typeof/typeof.hpp>
 
-#include <boost/static_assert.hpp>
-
-#include <boost/mpl/assert.hpp>
-
 #include <boost/geometry/core/cs.hpp>
 #include <boost/geometry/core/closure.hpp>
 #include <boost/geometry/core/reverse_dispatch.hpp>
 #include <boost/geometry/core/tag_cast.hpp>
 
+#include <boost/geometry/algorithms/not_implemented.hpp>
+
 #include <boost/geometry/geometries/segment.hpp>
 #include <boost/geometry/geometries/concepts/check.hpp>
 
@@ -236,6 +234,18 @@
 };
 
 
+// Helper metafunction for default strategy retrieval
+template <typename Geometry1, typename Geometry2>
+struct default_strategy
+ : strategy::distance::services::default_strategy
+ <
+ point_tag,
+ typename point_type<Geometry1>::type,
+ typename point_type<Geometry2>::type
+ >
+{};
+
+
 }} // namespace detail::distance
 #endif // DOXYGEN_NO_DETAIL
 
@@ -244,31 +254,97 @@
 namespace dispatch
 {
 
+
 using strategy::distance::services::return_type;
 
 
 template
 <
- typename GeometryTag1, typename GeometryTag2,
     typename Geometry1, typename Geometry2,
- typename StrategyTag, typename Strategy
+ typename Strategy = typename detail::distance::default_strategy<Geometry1, Geometry2>::type,
+ typename Tag1 = typename tag_cast<typename tag<Geometry1>::type, multi_tag>::type,
+ typename Tag2 = typename tag_cast<typename tag<Geometry2>::type, multi_tag>::type,
+ typename StrategyTag = typename strategy::distance::services::tag<Strategy>::type,
+ bool Reverse = reverse_dispatch<Geometry1, Geometry2>::type::value
+>
+struct distance: not_implemented<Tag1, Tag2>
+{};
+
+
+// If reversal is needed, perform it
+template
+<
+ typename Geometry1, typename Geometry2, typename Strategy,
+ typename Tag1, typename Tag2, typename StrategyTag
>
 struct distance
+<
+ Geometry1, Geometry2, Strategy,
+ Tag1, Tag2, StrategyTag,
+ true
+>
+ : distance<Geometry2, Geometry1, Strategy, Tag2, Tag1, StrategyTag, false>
 {
- BOOST_MPL_ASSERT_MSG
- (
- false, NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
- , (types<Geometry1, Geometry2>)
- );
+ static inline typename return_type<Strategy>::type apply(
+ Geometry1 const& g1,
+ Geometry2 const& g2,
+ Strategy const& strategy)
+ {
+ return distance
+ <
+ Geometry2, Geometry1, Strategy,
+ Tag2, Tag1, StrategyTag,
+ false
+ >::apply(g2, g1, strategy);
+ }
+};
+
+// If reversal is needed and we got the strategy by default, invert it before
+// proceeding to the reversal.
+template
+<
+ typename Geometry1, typename Geometry2,
+ typename Tag1, typename Tag2, typename StrategyTag
+>
+struct distance
+<
+ Geometry1, Geometry2,
+ typename detail::distance::default_strategy<Geometry1, Geometry2>::type,
+ Tag1, Tag2, StrategyTag,
+ true
+>
+ : distance
+ <
+ Geometry2, Geometry1,
+ typename detail::distance::default_strategy<Geometry2, Geometry1>::type,
+ Tag2, Tag1, StrategyTag,
+ false
+ >
+{
+ typedef typename detail::distance::default_strategy<Geometry2, Geometry1>::type reversed_strategy;
+
+ static inline typename strategy::distance::services::return_type<reversed_strategy>::type apply(
+ Geometry1 const& g1,
+ Geometry2 const& g2,
+ typename detail::distance::default_strategy<Geometry1, Geometry2>::type const&)
+ {
+ return distance
+ <
+ Geometry2, Geometry1, reversed_strategy,
+ Tag2, Tag1, StrategyTag,
+ false
+ >::apply(g2, g1, reversed_strategy());
+ }
 };
 
 
+// Point-point
 template <typename P1, typename P2, typename Strategy>
 struct distance
     <
- point_tag, point_tag,
- P1, P2,
- strategy_tag_distance_point_point, Strategy
+ P1, P2, Strategy,
+ point_tag, point_tag, strategy_tag_distance_point_point,
+ false
>
     : detail::distance::point_to_point<P1, P2, Strategy>
 {};
@@ -278,9 +354,9 @@
 template <typename Point, typename Linestring, typename Strategy>
 struct distance
 <
- point_tag, linestring_tag,
- Point, Linestring,
- strategy_tag_distance_point_point, Strategy
+ Point, Linestring, Strategy,
+ point_tag, linestring_tag, strategy_tag_distance_point_point,
+ false
>
 {
 
@@ -307,9 +383,9 @@
 template <typename Point, typename Linestring, typename Strategy>
 struct distance
 <
- point_tag, linestring_tag,
- Point, Linestring,
- strategy_tag_distance_point_segment, Strategy
+ Point, Linestring, Strategy,
+ point_tag, linestring_tag, strategy_tag_distance_point_segment,
+ false
>
 {
     static inline typename return_type<Strategy>::type apply(Point const& point,
@@ -328,9 +404,9 @@
 template <typename Point, typename Ring, typename Strategy>
 struct distance
 <
- point_tag, ring_tag,
- Point, Ring,
- strategy_tag_distance_point_point, Strategy
+ Point, Ring, Strategy,
+ point_tag, ring_tag, strategy_tag_distance_point_point,
+ false
>
 {
     typedef typename return_type<Strategy>::type return_type;
@@ -363,9 +439,9 @@
 template <typename Point, typename Polygon, typename Strategy>
 struct distance
 <
- point_tag, polygon_tag,
- Point, Polygon,
- strategy_tag_distance_point_point, Strategy
+ Point, Polygon, Strategy,
+ point_tag, polygon_tag, strategy_tag_distance_point_point,
+ false
>
 {
     typedef typename return_type<Strategy>::type return_type;
@@ -399,9 +475,9 @@
 template <typename Point, typename Segment, typename Strategy>
 struct distance
 <
- point_tag, segment_tag,
- Point, Segment,
- strategy_tag_distance_point_point, Strategy
+ Point, Segment, Strategy,
+ point_tag, segment_tag, strategy_tag_distance_point_point,
+ false
> : detail::distance::point_to_segment<Point, Segment, Strategy>
 {};
 
@@ -409,9 +485,9 @@
 template <typename Point, typename Segment, typename Strategy>
 struct distance
 <
- point_tag, segment_tag,
- Point, Segment,
- strategy_tag_distance_point_segment, Strategy
+ Point, Segment, Strategy,
+ point_tag, segment_tag, strategy_tag_distance_point_segment,
+ false
>
 {
     static inline typename return_type<Strategy>::type apply(Point const& point,
@@ -427,27 +503,6 @@
 
 
 
-// Strictly spoken this might be in namespace <impl> again
-template
-<
- typename GeometryTag1, typename GeometryTag2,
- typename G1, typename G2,
- typename StrategyTag, typename Strategy
->
-struct distance_reversed
-{
- static inline typename return_type<Strategy>::type apply(G1 const& g1,
- G2 const& g2, Strategy const& strategy)
- {
- return distance
- <
- GeometryTag2, GeometryTag1,
- G2, G1,
- StrategyTag, Strategy
- >::apply(g2, g1, strategy);
- }
-};
-
 } // namespace dispatch
 #endif // DOXYGEN_NO_DISPATCH
 
@@ -489,34 +544,18 @@
 */
 template <typename Geometry1, typename Geometry2, typename Strategy>
 inline typename strategy::distance::services::return_type<Strategy>::type distance(
- Geometry1 const& geometry1,
- Geometry2 const& geometry2, Strategy const& strategy)
+ Geometry1 const& geometry1, Geometry2 const& geometry2,
+ Strategy const& strategy)
 {
     concept::check<Geometry1 const>();
     concept::check<Geometry2 const>();
 
- return boost::mpl::if_
- <
- typename geometry::reverse_dispatch<Geometry1, Geometry2>::type,
- dispatch::distance_reversed
- <
- typename tag_cast<typename tag<Geometry1>::type, multi_tag>::type,
- typename tag_cast<typename tag<Geometry2>::type, multi_tag>::type,
- Geometry1,
- Geometry2,
- typename strategy::distance::services::tag<Strategy>::type,
- Strategy
- >,
- dispatch::distance
- <
- typename tag_cast<typename tag<Geometry1>::type, multi_tag>::type,
- typename tag_cast<typename tag<Geometry2>::type, multi_tag>::type,
- Geometry1,
- Geometry2,
- typename strategy::distance::services::tag<Strategy>::type,
- Strategy
- >
- >::type::apply(geometry1, geometry2, strategy);
+ return dispatch::distance
+ <
+ Geometry1,
+ Geometry2,
+ Strategy
+ >::apply(geometry1, geometry2, strategy);
 }
 
 
@@ -539,29 +578,8 @@
     concept::check<Geometry1 const>();
     concept::check<Geometry2 const>();
 
- typedef typename point_type<Geometry1>::type point1_type;
- typedef typename point_type<Geometry2>::type point2_type;
-
- // Define a point-point-distance-strategy
- // for either the normal case, either the reversed case
- typedef typename boost::mpl::if_c
- <
- geometry::reverse_dispatch<Geometry1, Geometry2>::type::value,
- typename strategy::distance::services::default_strategy
- <
- point_tag,
- point2_type,
- point1_type
- >::type,
- typename strategy::distance::services::default_strategy
- <
- point_tag,
- point1_type,
- point2_type
- >::type
- >::type strategy;
-
- return distance(geometry1, geometry2, strategy());
+ return distance(geometry1, geometry2,
+ typename detail::distance::default_strategy<Geometry1, Geometry2>::type());
 }
 
 }} // namespace boost::geometry

Copied: branches/release/boost/geometry/algorithms/not_implemented.hpp (from r75810, /trunk/boost/geometry/algorithms/not_implemented.hpp)
==============================================================================
--- /trunk/boost/geometry/algorithms/not_implemented.hpp (original)
+++ branches/release/boost/geometry/algorithms/not_implemented.hpp 2012-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -17,28 +17,99 @@
 
 
 #include <boost/mpl/assert.hpp>
+#include <boost/geometry/core/tags.hpp>
+#include <boost/geometry/multi/core/tags.hpp>
 
 
 namespace boost { namespace geometry
 {
 
 
+namespace info
+{
+ struct UNRECOGNIZED_GEOMETRY_TYPE {};
+ struct POINT {};
+ struct LINESTRING {};
+ struct POLYGON {};
+ struct RING {};
+ struct BOX {};
+ struct SEGMENT {};
+ struct MULTI_POINT {};
+ struct MULTI_LINESTRING {};
+ struct MULTI_POLYGON {};
+ struct GEOMETRY_COLLECTION {};
+ template <size_t D> struct DIMENSION {};
+}
+
+
+namespace nyi
+{
+
+
+struct not_implemented_tag {};
+
+template
+<
+ typename Term1,
+ typename Term2,
+ typename Term3
+>
+struct not_implemented_error
+{
+
 #ifndef BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD
 # define BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD false
 #endif
 
-
-template <typename Geometry1, typename Geometry2>
-struct not_implemented
-{
     BOOST_MPL_ASSERT_MSG
         (
             BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD,
- NOT_OR_NOT_YET_IMPLEMENTED_FOR_THIS_GEOMETRY_TYPE
- , (types<Geometry1, Geometry2>)
+ THIS_OPERATION_IS_NOT_OR_NOT_YET_IMPLEMENTED,
+ (
+ types<Term1, Term2, Term3>
+ )
         );
 };
 
+template <typename Tag>
+struct tag_to_term
+{
+ typedef Tag type;
+};
+
+template <> struct tag_to_term<geometry_not_recognized_tag> { typedef info::UNRECOGNIZED_GEOMETRY_TYPE type; };
+template <> struct tag_to_term<point_tag> { typedef info::POINT type; };
+template <> struct tag_to_term<linestring_tag> { typedef info::LINESTRING type; };
+template <> struct tag_to_term<polygon_tag> { typedef info::POLYGON type; };
+template <> struct tag_to_term<ring_tag> { typedef info::RING type; };
+template <> struct tag_to_term<box_tag> { typedef info::BOX type; };
+template <> struct tag_to_term<segment_tag> { typedef info::SEGMENT type; };
+template <> struct tag_to_term<multi_point_tag> { typedef info::MULTI_POINT type; };
+template <> struct tag_to_term<multi_linestring_tag> { typedef info::MULTI_LINESTRING type; };
+template <> struct tag_to_term<multi_polygon_tag> { typedef info::MULTI_POLYGON type; };
+template <> struct tag_to_term<geometry_collection_tag> { typedef info::GEOMETRY_COLLECTION type; };
+template <int D> struct tag_to_term<mpl::int_<D> > { typedef info::DIMENSION<D> type; };
+
+
+}
+
+
+template
+<
+ typename Term1 = void,
+ typename Term2 = void,
+ typename Term3 = void
+>
+struct not_implemented
+ : nyi::not_implemented_tag,
+ nyi::not_implemented_error
+ <
+ typename mpl::identity<typename nyi::tag_to_term<Term1>::type>::type,
+ typename mpl::identity<typename nyi::tag_to_term<Term2>::type>::type,
+ typename mpl::identity<typename nyi::tag_to_term<Term3>::type>::type
+ >
+{};
+
 
 }} // namespace boost::geometry
 

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-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -57,10 +57,38 @@
     concept::check<Geometry2 const>();
     concept::check<GeometryOut>();
 
- out = detail::intersection::insert<GeometryOut, true, overlay_difference>(
- geometry1, geometry2, out, strategy);
- out = detail::intersection::insert<GeometryOut, true, overlay_difference>(
- geometry2, geometry1, out, strategy);
+ 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,
+ overlay_difference,
+ Strategy
+ >::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,
+ 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
+ >::apply(geometry2, geometry1, out, strategy);
     return out;
 }
 

Modified: branches/release/boost/geometry/geometry.hpp
==============================================================================
--- branches/release/boost/geometry/geometry.hpp (original)
+++ branches/release/boost/geometry/geometry.hpp 2012-01-07 12:32:00 EST (Sat, 07 Jan 2012)
@@ -16,7 +16,6 @@
 
 // Shortcut to include all header files
 
-
 #include <boost/geometry/core/cs.hpp>
 #include <boost/geometry/core/tag.hpp>
 #include <boost/geometry/core/tag_cast.hpp>
@@ -76,12 +75,11 @@
 #include <boost/geometry/util/math.hpp>
 #include <boost/geometry/util/select_most_precise.hpp>
 #include <boost/geometry/util/select_coordinate_type.hpp>
-#include <boost/geometry/util/write_dsv.hpp>
+#include <boost/geometry/io/dsv/write.hpp>
 
 #include <boost/geometry/views/box_view.hpp>
 #include <boost/geometry/views/segment_view.hpp>
 
-#include <boost/geometry/domains/gis/io/wkt/wkt.hpp>
-
+#include <boost/geometry/io/io.hpp>
 
 #endif // BOOST_GEOMETRY_GEOMETRY_HPP


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