diff --git a/include/boost/geometry/algorithms/detail/extreme_points.hpp b/include/boost/geometry/algorithms/detail/extreme_points.hpp index 772735522..ac522f995 100644 --- a/include/boost/geometry/algorithms/detail/extreme_points.hpp +++ b/include/boost/geometry/algorithms/detail/extreme_points.hpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -451,6 +452,29 @@ struct extreme_points } }; +template +struct extreme_points +{ + template + static inline bool apply(MultiPolygon const& multi, Extremes& extremes, Intruders& intruders) + { + // Get one for the very first polygon, that is (for the moment) enough. + // It is not guaranteed the "extreme" then, but for the current purpose + // (point_on_surface) it can just be this point. + if (boost::size(multi) >= 1) + { + return extreme_points + < + typename boost::range_value::type, + Dimension, + polygon_tag + >::apply(*boost::begin(multi), extremes, intruders); + } + + return false; + } +}; + } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH diff --git a/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp b/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp index 5e18d0453..4040fbe6b 100644 --- a/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -124,6 +125,30 @@ struct copy_segment_point_box }; +template +< + typename MultiGeometry, + typename SegmentIdentifier, + typename PointOut, + typename Policy +> +struct copy_segment_point_multi +{ + static inline bool apply(MultiGeometry const& multi, + SegmentIdentifier const& seg_id, bool second, + PointOut& point) + { + + BOOST_ASSERT + ( + seg_id.multi_index >= 0 + && seg_id.multi_index < int(boost::size(multi)) + ); + + // Call the single-version + return Policy::apply(multi[seg_id.multi_index], seg_id, second, point); + } +}; }} // namespace detail::copy_segments @@ -188,6 +213,66 @@ struct copy_segment_point {}; +template +< + typename MultiGeometry, + bool Reverse, + typename SegmentIdentifier, + typename PointOut +> +struct copy_segment_point + < + multi_polygon_tag, + MultiGeometry, + Reverse, + SegmentIdentifier, + PointOut + > + : detail::copy_segments::copy_segment_point_multi + < + MultiGeometry, + SegmentIdentifier, + PointOut, + detail::copy_segments::copy_segment_point_polygon + < + typename boost::range_value::type, + Reverse, + SegmentIdentifier, + PointOut + > + > +{}; + +template +< + typename MultiGeometry, + bool Reverse, + typename SegmentIdentifier, + typename PointOut +> +struct copy_segment_point + < + multi_linestring_tag, + MultiGeometry, + Reverse, + SegmentIdentifier, + PointOut + > + : detail::copy_segments::copy_segment_point_multi + < + MultiGeometry, + SegmentIdentifier, + PointOut, + detail::copy_segments::copy_segment_point_range + < + typename boost::range_value::type, + Reverse, + SegmentIdentifier, + PointOut + > + > +{}; + } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH diff --git a/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp b/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp index f7fee8bb9..d4bf0a90f 100644 --- a/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp @@ -15,19 +15,21 @@ #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENTS_HPP -#include -#include -#include #include +#include #include +#include #include +#include #include #include #include #include +#include +#include #include #include #include @@ -37,6 +39,7 @@ #include #include + namespace boost { namespace geometry { @@ -239,6 +242,37 @@ struct copy_segments_box }; +template +struct copy_segments_multi +{ + template + < + typename MultiGeometry, + typename SegmentIdentifier, + typename RobustPolicy, + typename RangeOut + > + static inline void apply(MultiGeometry const& multi_geometry, + SegmentIdentifier const& seg_id, int to_index, + RobustPolicy const& robust_policy, + RangeOut& current_output) + { + + BOOST_ASSERT + ( + seg_id.multi_index >= 0 + && seg_id.multi_index < int(boost::size(multi_geometry)) + ); + + // Call the single-version + Policy::apply(multi_geometry[seg_id.multi_index], + seg_id, to_index, + robust_policy, + current_output); + } +}; + + }} // namespace detail::copy_segments #endif // DOXYGEN_NO_DETAIL @@ -279,6 +313,15 @@ struct copy_segments {}; +template +struct copy_segments + : detail::copy_segments::copy_segments_multi + < + detail::copy_segments::copy_segments_polygon + > +{}; + + } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH diff --git a/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp b/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp index c2c698057..ab9219a3d 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp @@ -13,11 +13,12 @@ #include #include - -#include #include #include +#include +#include #include +#include namespace boost { namespace geometry @@ -92,6 +93,25 @@ struct get_ring }; +template<> +struct get_ring +{ + template + static inline typename ring_type::type const& apply( + ring_identifier const& id, + MultiPolygon const& multi_polygon) + { + BOOST_ASSERT + ( + id.multi_index >= 0 + && id.multi_index < int(boost::size(multi_polygon)) + ); + return get_ring::apply(id, + multi_polygon[id.multi_index]); + } +}; + + }} // namespace detail::overlay #endif // DOXYGEN_NO_DETAIL diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp index 14220e87b..4fdfb0240 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp @@ -26,11 +26,11 @@ #include #include -#include - #include #include +#include #include +#include #include @@ -50,19 +50,19 @@ #include #include + #include #include + #include #include #include - #include - #include +#include #include -#include #ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION # include @@ -764,6 +764,45 @@ struct get_turns_polygon_cs } }; + +template +< + typename Multi, typename Box, + bool Reverse, bool ReverseBox, + typename TurnPolicy +> +struct get_turns_multi_polygon_cs +{ + template + static inline void apply( + int source_id1, Multi const& multi, + int source_id2, Box const& box, + RobustPolicy const& robust_policy, + Turns& turns, InterruptPolicy& interrupt_policy) + { + typedef typename boost::range_iterator + < + Multi const + >::type iterator_type; + + int i = 0; + for (iterator_type it = boost::begin(multi); + it != boost::end(multi); + ++it, ++i) + { + // Call its single version + get_turns_polygon_cs + < + typename boost::range_value::type, Box, + Reverse, ReverseBox, + TurnPolicy + >::apply(source_id1, *it, source_id2, box, + robust_policy, turns, interrupt_policy, i); + } + } +}; + + // GET_TURN_INFO_TYPE template @@ -878,6 +917,29 @@ struct get_turns {}; +template +< + typename MultiPolygon, + typename Box, + bool ReverseMultiPolygon, bool ReverseBox, + typename TurnPolicy +> +struct get_turns + < + multi_polygon_tag, box_tag, + MultiPolygon, Box, + ReverseMultiPolygon, ReverseBox, + TurnPolicy + > + : detail::get_turns::get_turns_multi_polygon_cs + < + MultiPolygon, Box, + ReverseMultiPolygon, ReverseBox, + TurnPolicy + > +{}; + + template < typename GeometryTag1, typename GeometryTag2, diff --git a/include/boost/geometry/algorithms/detail/overlay/select_rings.hpp b/include/boost/geometry/algorithms/detail/overlay/select_rings.hpp index 487bd6c37..5d21c8f51 100644 --- a/include/boost/geometry/algorithms/detail/overlay/select_rings.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/select_rings.hpp @@ -9,8 +9,12 @@ #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP + #include +#include + +#include #include #include @@ -118,7 +122,32 @@ namespace dispatch } } }; -} + + template + struct select_rings + { + template + static inline void apply(Multi const& multi, Geometry const& geometry, + ring_identifier id, Map& map, bool midpoint) + { + typedef typename boost::range_iterator + < + Multi const + >::type iterator_type; + + typedef select_rings::type> per_polygon; + + id.multi_index = 0; + for (iterator_type it = boost::begin(multi); it != boost::end(multi); ++it) + { + id.ring_index = -1; + per_polygon::apply(*it, geometry, id, map, midpoint); + id.multi_index++; + } + } + }; + +} // namespace dispatch template diff --git a/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp b/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp index e2a21a0fe..bcf64a4f6 100644 --- a/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp @@ -9,12 +9,14 @@ #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELF_TURN_POINTS_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELF_TURN_POINTS_HPP + #include #include #include #include +#include #include @@ -224,6 +226,20 @@ struct self_get_turn_points {}; +template +< + typename MultiPolygon, + typename TurnPolicy +> +struct self_get_turn_points + < + multi_polygon_tag, MultiPolygon, + TurnPolicy + > + : detail::self_get_turn_points::get_turns +{}; + + } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH diff --git a/include/boost/geometry/algorithms/detail/point_on_border.hpp b/include/boost/geometry/algorithms/detail/point_on_border.hpp index d99ab3c90..24b88a8d1 100644 --- a/include/boost/geometry/algorithms/detail/point_on_border.hpp +++ b/include/boost/geometry/algorithms/detail/point_on_border.hpp @@ -19,6 +19,7 @@ #include +#include #include #include @@ -153,6 +154,35 @@ struct point_on_box }; +template +< + typename Point, + typename MultiGeometry, + typename Policy +> +struct point_on_multi +{ + static inline bool apply(Point& point, MultiGeometry const& multi, bool midpoint) + { + // Take a point on the first multi-geometry + // (i.e. the first that is not empty) + for (typename boost::range_iterator + < + MultiGeometry const + >::type it = boost::begin(multi); + it != boost::end(multi); + ++it) + { + if (Policy::apply(point, *it, midpoint)) + { + return true; + } + } + return false; + } +}; + + }} // namespace detail::point_on_border #endif // DOXYGEN_NO_DETAIL @@ -203,6 +233,36 @@ struct point_on_border {}; +template +struct point_on_border + : detail::point_on_border::point_on_multi + < + Point, + Multi, + detail::point_on_border::point_on_polygon + < + Point, + typename boost::range_value::type + > + > +{}; + + +template +struct point_on_border + : detail::point_on_border::point_on_multi + < + Point, + Multi, + detail::point_on_border::point_on_range + < + Point, + typename boost::range_value::type + > + > +{}; + + } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH diff --git a/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp b/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp index ad62f232b..4ef11175f 100644 --- a/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp +++ b/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp @@ -7,14 +7,19 @@ // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2013. +// Modifications copyright (c) 2013, Oracle and/or its affiliates. + // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP - +#include #include #include @@ -22,7 +27,9 @@ #include #include #include - +#include +#include +#include namespace boost { namespace geometry @@ -55,6 +62,28 @@ struct full_section_polygon }; +template +< + typename MultiGeometry, + typename Section, + typename Policy +> +struct full_section_multi +{ + static inline typename ring_return_type::type apply( + MultiGeometry const& multi, Section const& section) + { + BOOST_ASSERT + ( + section.ring_id.multi_index >= 0 + && section.ring_id.multi_index < int(boost::size(multi)) + ); + + return Policy::apply(multi[section.ring_id.multi_index], section); + } +}; + + }} // namespace detail::section #endif @@ -98,6 +127,35 @@ struct range_by_section {}; +template +struct range_by_section + : detail::section::full_section_multi + < + MultiPolygon, + Section, + detail::section::full_section_polygon + < + typename boost::range_value::type, + Section + > + > +{}; + +template +struct range_by_section + : detail::section::full_section_multi + < + MultiLinestring, + Section, + detail::section::full_section_range + < + typename boost::range_value::type, + Section + > + > +{}; + + } // namespace dispatch #endif diff --git a/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp b/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp index e6b4c2607..fa14fa36f 100644 --- a/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp +++ b/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp @@ -4,8 +4,8 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. -// This file was modified by Oracle on 2014. -// Modifications copyright (c) 2014 Oracle and/or its affiliates. +// This file was modified by Oracle on 2013, 2014. +// Modifications copyright (c) 2013, 2014 Oracle and/or its affiliates. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -36,7 +37,7 @@ #include #include #include - +#include #include #include @@ -46,8 +47,6 @@ #include #include - - namespace boost { namespace geometry { @@ -556,6 +555,31 @@ struct sectionalize_box } }; +template +struct sectionalize_multi +{ + template + < + typename MultiGeometry, + typename RobustPolicy, + typename Sections + > + static inline void apply(MultiGeometry const& multi, + RobustPolicy const& robust_policy, + bool make_rescaled_boxes, + Sections& sections, ring_identifier ring_id, std::size_t max_count) + { + ring_id.multi_index = 0; + for (typename boost::range_iterator::type + it = boost::begin(multi); + it != boost::end(multi); + ++it, ++ring_id.multi_index) + { + Policy::apply(*it, robust_policy, make_rescaled_boxes, sections, ring_id, max_count); + } + } +}; + template inline void set_section_unique_ids(Sections& sections) { @@ -675,6 +699,45 @@ struct sectionalize > {}; +template +< + typename MultiPolygon, + bool Reverse, + std::size_t DimensionCount +> +struct sectionalize + : detail::sectionalize::sectionalize_multi + < + DimensionCount, + detail::sectionalize::sectionalize_polygon + < + Reverse, + DimensionCount + > + > + +{}; + +template +< + typename MultiLinestring, + bool Reverse, + std::size_t DimensionCount +> +struct sectionalize + : detail::sectionalize::sectionalize_multi + < + DimensionCount, + detail::sectionalize::sectionalize_range + < + closed, false, + typename point_type::type, + DimensionCount + > + > + +{}; + } // namespace dispatch #endif diff --git a/include/boost/geometry/multi/algorithms/detail/extreme_points.hpp b/include/boost/geometry/multi/algorithms/detail/extreme_points.hpp index 5c08f61d2..da2ac5e9f 100644 --- a/include/boost/geometry/multi/algorithms/detail/extreme_points.hpp +++ b/include/boost/geometry/multi/algorithms/detail/extreme_points.hpp @@ -13,55 +13,7 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_EXTREME_POINTS_HPP -#include - -#include - #include -#include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - - -template -struct extreme_points -{ - template - static inline bool apply(MultiPolygon const& multi, Extremes& extremes, Intruders& intruders) - { - // Get one for the very first polygon, that is (for the moment) enough. - // It is not guaranteed the "extreme" then, but for the current purpose - // (point_on_surface) it can just be this point. - if (boost::size(multi) >= 1) - { - return extreme_points - < - typename boost::range_value::type, - Dimension, - polygon_tag - >::apply(*boost::begin(multi), extremes, intruders); - } - - return false; - } -}; - - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_EXTREME_POINTS_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp index 2f744e6a1..5e23cf4ba 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp @@ -13,123 +13,7 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENT_POINT_HPP -#include - #include -#include -#include - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace copy_segments -{ - - -template -< - typename MultiGeometry, - typename SegmentIdentifier, - typename PointOut, - typename Policy -> -struct copy_segment_point_multi -{ - static inline bool apply(MultiGeometry const& multi, - SegmentIdentifier const& seg_id, bool second, - PointOut& point) - { - - BOOST_ASSERT - ( - seg_id.multi_index >= 0 - && seg_id.multi_index < int(boost::size(multi)) - ); - - // Call the single-version - return Policy::apply(multi[seg_id.multi_index], seg_id, second, point); - } -}; - - -}} // namespace detail::copy_segments -#endif // DOXYGEN_NO_DETAIL - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - -template -< - typename MultiGeometry, - bool Reverse, - typename SegmentIdentifier, - typename PointOut -> -struct copy_segment_point - < - multi_polygon_tag, - MultiGeometry, - Reverse, - SegmentIdentifier, - PointOut - > - : detail::copy_segments::copy_segment_point_multi - < - MultiGeometry, - SegmentIdentifier, - PointOut, - detail::copy_segments::copy_segment_point_polygon - < - typename boost::range_value::type, - Reverse, - SegmentIdentifier, - PointOut - > - > -{}; - -template -< - typename MultiGeometry, - bool Reverse, - typename SegmentIdentifier, - typename PointOut -> -struct copy_segment_point - < - multi_linestring_tag, - MultiGeometry, - Reverse, - SegmentIdentifier, - PointOut - > - : detail::copy_segments::copy_segment_point_multi - < - MultiGeometry, - SegmentIdentifier, - PointOut, - detail::copy_segments::copy_segment_point_range - < - typename boost::range_value::type, - Reverse, - SegmentIdentifier, - PointOut - > - > -{}; - - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENT_POINT_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp index a856813e0..54114bfae 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp @@ -10,78 +10,7 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENTS_HPP -#include -#include - #include -#include -#include -#include - - -namespace boost { namespace geometry -{ - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace copy_segments -{ - - -template -struct copy_segments_multi -{ - template - < - typename MultiGeometry, - typename SegmentIdentifier, - typename RobustPolicy, - typename RangeOut - > - static inline void apply(MultiGeometry const& multi_geometry, - SegmentIdentifier const& seg_id, int to_index, - RobustPolicy const& robust_policy, - RangeOut& current_output) - { - - BOOST_ASSERT - ( - seg_id.multi_index >= 0 - && seg_id.multi_index < int(boost::size(multi_geometry)) - ); - - // Call the single-version - Policy::apply(multi_geometry[seg_id.multi_index], - seg_id, to_index, - robust_policy, - current_output); - } -}; - - -}} // namespace detail::copy_segments -#endif // DOXYGEN_NO_DETAIL - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - -template -struct copy_segments - : detail::copy_segments::copy_segments_multi - < - detail::copy_segments::copy_segments_polygon - > -{}; - - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENTS_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp index bd3acf1bc..65e00d064 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp @@ -10,47 +10,7 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_RING_HPP -#include -#include - #include -#include -#include -#include - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace overlay -{ - -template<> -struct get_ring -{ - template - static inline typename ring_type::type const& apply( - ring_identifier const& id, - MultiPolygon const& multi_polygon) - { - BOOST_ASSERT - ( - id.multi_index >= 0 - && id.multi_index < int(boost::size(multi_polygon)) - ); - return get_ring::apply(id, - multi_polygon[id.multi_index]); - } -}; - - - -}} // namespace detail::overlay -#endif // DOXYGEN_NO_DETAIL - - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_RING_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp index f2d67e3c1..a83fb7739 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp @@ -9,99 +9,8 @@ #ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_TURNS_HPP #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_TURNS_HPP + #include -#include -#include -#include - -#include - -#include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace get_turns -{ - -template -< - typename Multi, typename Box, - bool Reverse, bool ReverseBox, - typename TurnPolicy -> -struct get_turns_multi_polygon_cs -{ - template - static inline void apply( - int source_id1, Multi const& multi, - int source_id2, Box const& box, - RobustPolicy const& robust_policy, - Turns& turns, InterruptPolicy& interrupt_policy) - { - typedef typename boost::range_iterator - < - Multi const - >::type iterator_type; - - int i = 0; - for (iterator_type it = boost::begin(multi); - it != boost::end(multi); - ++it, ++i) - { - // Call its single version - get_turns_polygon_cs - < - typename boost::range_value::type, Box, - Reverse, ReverseBox, - TurnPolicy - >::apply(source_id1, *it, source_id2, box, - robust_policy, turns, interrupt_policy, i); - } - } -}; - -}} // namespace detail::get_turns -#endif // DOXYGEN_NO_DETAIL - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - -template -< - typename MultiPolygon, - typename Box, - bool ReverseMultiPolygon, bool ReverseBox, - typename TurnPolicy -> -struct get_turns - < - multi_polygon_tag, box_tag, - MultiPolygon, Box, - ReverseMultiPolygon, ReverseBox, - TurnPolicy - > - : detail::get_turns::get_turns_multi_polygon_cs - < - MultiPolygon, Box, - ReverseMultiPolygon, ReverseBox, - TurnPolicy - > -{}; - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_TURNS_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/select_rings.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/select_rings.hpp index 7c5040b40..c780c4cd9 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/select_rings.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/select_rings.hpp @@ -10,56 +10,7 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP -#include - #include -#include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace overlay -{ - -namespace dispatch -{ - - template - struct select_rings - { - template - static inline void apply(Multi const& multi, Geometry const& geometry, - ring_identifier id, Map& map, bool midpoint) - { - typedef typename boost::range_iterator - < - Multi const - >::type iterator_type; - - typedef select_rings::type> per_polygon; - - id.multi_index = 0; - for (iterator_type it = boost::begin(multi); it != boost::end(multi); ++it) - { - id.ring_index = -1; - per_polygon::apply(*it, geometry, id, map, midpoint); - id.multi_index++; - } - } - }; -} - - -}} // namespace detail::overlay -#endif // DOXYGEN_NO_DETAIL - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp index acb0d3246..39bfea2fb 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp @@ -12,38 +12,5 @@ #include -#include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - -template -< - typename MultiPolygon, - typename TurnPolicy -> -struct self_get_turn_points - < - multi_polygon_tag, MultiPolygon, - TurnPolicy - > - : detail::self_get_turn_points::get_turns -{}; - - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_SELF_TURN_POINTS_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp b/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp index 8585c2f23..2ee789c5d 100644 --- a/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp +++ b/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp @@ -18,96 +18,7 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_POINT_ON_BORDER_HPP -#include - #include -#include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace point_on_border -{ - - -template -< - typename Point, - typename MultiGeometry, - typename Policy -> -struct point_on_multi -{ - static inline bool apply(Point& point, MultiGeometry const& multi, bool midpoint) - { - // Take a point on the first multi-geometry - // (i.e. the first that is not empty) - for (typename boost::range_iterator - < - MultiGeometry const - >::type it = boost::begin(multi); - it != boost::end(multi); - ++it) - { - if (Policy::apply(point, *it, midpoint)) - { - return true; - } - } - return false; - } -}; - - - - -}} // namespace detail::point_on_border -#endif // DOXYGEN_NO_DETAIL - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - -template -struct point_on_border - : detail::point_on_border::point_on_multi - < - Point, - Multi, - detail::point_on_border::point_on_polygon - < - Point, - typename boost::range_value::type - > - > -{}; - -template -struct point_on_border - : detail::point_on_border::point_on_multi - < - Point, - Multi, - detail::point_on_border::point_on_range - < - Point, - typename boost::range_value::type - > - > -{}; - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - - - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_POINT_ON_BORDER_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp b/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp index ecdcbe6c5..5604d9d74 100644 --- a/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp +++ b/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp @@ -14,95 +14,13 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + #ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP -#include -#include - #include -#include -#include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace section -{ - - -template -< - typename MultiGeometry, - typename Section, - typename Policy -> -struct full_section_multi -{ - static inline typename ring_return_type::type apply( - MultiGeometry const& multi, Section const& section) - { - BOOST_ASSERT - ( - section.ring_id.multi_index >= 0 - && section.ring_id.multi_index < int(boost::size(multi)) - ); - - return Policy::apply(multi[section.ring_id.multi_index], section); - } -}; - - -}} // namespace detail::section -#endif - - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - -template -struct range_by_section - : detail::section::full_section_multi - < - MultiPolygon, - Section, - detail::section::full_section_polygon - < - typename boost::range_value::type, - Section - > - > -{}; - -template -struct range_by_section - : detail::section::full_section_multi - < - MultiLinestring, - Section, - detail::section::full_section_range - < - typename boost::range_value::type, - Section - > - > -{}; - -} // namespace dispatch -#endif - - - - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp b/include/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp index 4eecc4a4c..ef9802123 100644 --- a/include/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp +++ b/include/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp @@ -17,106 +17,8 @@ #ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_SECTIONALIZE_HPP #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_SECTIONALIZE_HPP -#include -#include - -#include -#include #include -#include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace sectionalize -{ - - -template -struct sectionalize_multi -{ - template - < - typename MultiGeometry, - typename RobustPolicy, - typename Sections - > - static inline void apply(MultiGeometry const& multi, - RobustPolicy const& robust_policy, - bool make_rescaled_boxes, - Sections& sections, ring_identifier ring_id, std::size_t max_count) - { - ring_id.multi_index = 0; - for (typename boost::range_iterator::type - it = boost::begin(multi); - it != boost::end(multi); - ++it, ++ring_id.multi_index) - { - Policy::apply(*it, robust_policy, make_rescaled_boxes, sections, ring_id, max_count); - } - } -}; - - -}} // namespace detail::sectionalize -#endif // DOXYGEN_NO_DETAIL - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - -template -< - typename MultiPolygon, - bool Reverse, - std::size_t DimensionCount -> -struct sectionalize - : detail::sectionalize::sectionalize_multi - < - DimensionCount, - detail::sectionalize::sectionalize_polygon - < - Reverse, - DimensionCount - > - > - -{}; - -template -< - typename MultiLinestring, - bool Reverse, - std::size_t DimensionCount -> -struct sectionalize - : detail::sectionalize::sectionalize_multi - < - DimensionCount, - detail::sectionalize::sectionalize_range - < - closed, false, - typename point_type::type, - DimensionCount - > - > - -{}; - -} // namespace dispatch -#endif - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_SECTIONALIZE_HPP