diff options
Diffstat (limited to 'boost/geometry/algorithms/detail/overlay/intersection_insert.hpp')
-rw-r--r-- | boost/geometry/algorithms/detail/overlay/intersection_insert.hpp | 132 |
1 files changed, 124 insertions, 8 deletions
diff --git a/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp b/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp index 3101de8c35..af0731f5a9 100644 --- a/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp +++ b/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp @@ -1,9 +1,9 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. -// This file was modified by Oracle on 2014. -// Modifications copyright (c) 2014 Oracle and/or its affiliates. +// This file was modified by Oracle on 2014, 2015. +// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle @@ -39,9 +39,11 @@ #include <boost/geometry/policies/robustness/get_rescale_policy.hpp> #include <boost/geometry/views/segment_view.hpp> +#include <boost/geometry/views/detail/boundary_view.hpp> #include <boost/geometry/algorithms/detail/overlay/linear_linear.hpp> #include <boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp> +#include <boost/geometry/algorithms/detail/overlay/pointlike_linear.hpp> #if defined(BOOST_GEOMETRY_DEBUG_FOLLOW) #include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp> @@ -283,7 +285,8 @@ namespace dispatch template < // real types - typename Geometry1, typename Geometry2, + typename Geometry1, + typename Geometry2, typename GeometryOut, overlay_type OverlayType, // orientation @@ -409,13 +412,13 @@ struct intersection_insert template <typename RobustPolicy, typename OutputIterator, typename Strategy> static inline OutputIterator apply(Linestring const& linestring, Box const& box, - RobustPolicy const& , + RobustPolicy const& robust_policy, OutputIterator out, Strategy const& ) { typedef typename point_type<GeometryOut>::type point_type; strategy::intersection::liang_barsky<Box, point_type> lb_strategy; return detail::intersection::clip_range_with_box - <GeometryOut>(box, linestring, out, lb_strategy); + <GeometryOut>(box, linestring, robust_policy, out, lb_strategy); } }; @@ -487,7 +490,7 @@ struct intersection_insert template <typename RobustPolicy, typename OutputIterator, typename Strategy> static inline OutputIterator apply(Segment const& segment, Box const& box, - RobustPolicy const& ,// TODO: propagate to clip_range_with_box + RobustPolicy const& robust_policy, OutputIterator out, Strategy const& ) { geometry::segment_view<Segment> range(segment); @@ -495,7 +498,7 @@ struct intersection_insert typedef typename point_type<GeometryOut>::type point_type; strategy::intersection::liang_barsky<Box, point_type> lb_strategy; return detail::intersection::clip_range_with_box - <GeometryOut>(box, range, out, lb_strategy); + <GeometryOut>(box, range, robust_policy, out, lb_strategy); } }; @@ -573,6 +576,46 @@ struct intersection_insert_reversed }; +// dispatch for intersection(areal, areal, linear) +template +< + typename Geometry1, typename Geometry2, + typename LinestringOut, + bool Reverse1, bool Reverse2, bool ReverseOut, + typename Tag1, typename Tag2 +> +struct intersection_insert + < + Geometry1, Geometry2, + LinestringOut, + overlay_intersection, + Reverse1, Reverse2, ReverseOut, + Tag1, Tag2, linestring_tag, + true, true, false + > +{ + template + < + typename RobustPolicy, typename OutputIterator, typename Strategy + > + static inline OutputIterator apply(Geometry1 const& geometry1, + Geometry2 const& geometry2, + RobustPolicy const& robust_policy, + OutputIterator oit, + Strategy const& strategy) + { + detail::boundary_view<Geometry1 const> view1(geometry1); + detail::boundary_view<Geometry2 const> view2(geometry2); + + return detail::overlay::linear_linear_linestring + < + detail::boundary_view<Geometry1 const>, + detail::boundary_view<Geometry2 const>, + LinestringOut, + overlay_intersection + >::apply(view1, view2, robust_policy, oit, strategy); + } +}; // dispatch for non-areal geometries template @@ -700,6 +743,79 @@ struct intersection_insert {}; +// dispatch for difference/intersection of pointlike-linear geometries +template +< + typename Point, typename Linear, typename PointOut, + overlay_type OverlayType, + bool Reverse1, bool Reverse2, bool ReverseOut, + typename Tag +> +struct intersection_insert + < + Point, Linear, PointOut, OverlayType, + Reverse1, Reverse2, ReverseOut, + point_tag, Tag, point_tag, + false, false, false + > : detail_dispatch::overlay::pointlike_linear_point + < + Point, Linear, PointOut, OverlayType, + point_tag, typename tag_cast<Tag, segment_tag, linear_tag>::type + > +{}; + + +template +< + typename MultiPoint, typename Linear, typename PointOut, + overlay_type OverlayType, + bool Reverse1, bool Reverse2, bool ReverseOut, + typename Tag +> +struct intersection_insert + < + MultiPoint, Linear, PointOut, OverlayType, + Reverse1, Reverse2, ReverseOut, + multi_point_tag, Tag, point_tag, + false, false, false + > : detail_dispatch::overlay::pointlike_linear_point + < + MultiPoint, Linear, PointOut, OverlayType, + multi_point_tag, + typename tag_cast<Tag, segment_tag, linear_tag>::type + > +{}; + + +template +< + typename Linestring, typename MultiPoint, typename PointOut, + bool Reverse1, bool Reverse2, bool ReverseOut +> +struct intersection_insert + < + Linestring, MultiPoint, PointOut, overlay_intersection, + Reverse1, Reverse2, ReverseOut, + linestring_tag, multi_point_tag, point_tag, + false, false, false + > +{ + template <typename RobustPolicy, typename OutputIterator, typename Strategy> + static inline OutputIterator apply(Linestring const& linestring, + MultiPoint const& multipoint, + RobustPolicy const& robust_policy, + OutputIterator out, + Strategy const& strategy) + { + return detail_dispatch::overlay::pointlike_linear_point + < + MultiPoint, Linestring, PointOut, overlay_intersection, + multi_point_tag, linear_tag + >::apply(multipoint, linestring, robust_policy, out, strategy); + } +}; + + } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH |