/
usr
/
include
/
boost
/
geometry
/
algorithms
/
detail
/
overlay
/
/usr/include/boost/geometry/algorithms/detail/overlay
mkdir
upload
Name
Size
Mode
Actions
add_rings.hpp
5964
0644
edit
dl
rm
append_no_duplicates.hpp
2101
0644
edit
dl
rm
append_no_dups_or_spikes.hpp
7434
0644
edit
dl
rm
assign_parents.hpp
14577
0644
edit
dl
rm
backtrack_check_si.hpp
6371
0644
edit
dl
rm
check_enrich.hpp
5361
0644
edit
dl
rm
clip_linestring.hpp
8718
0644
edit
dl
rm
cluster_exits.hpp
7817
0644
edit
dl
rm
cluster_info.hpp
1010
0644
edit
dl
rm
convert_ring.hpp
3113
0644
edit
dl
rm
copy_segments.hpp
11481
0644
edit
dl
rm
copy_segment_point.hpp
11107
0644
edit
dl
rm
debug_turn_info.hpp
1947
0644
edit
dl
rm
do_reverse.hpp
1246
0644
edit
dl
rm
enrichment_info.hpp
2343
0644
edit
dl
rm
enrich_intersection_points.hpp
19008
0644
edit
dl
rm
follow.hpp
16907
0644
edit
dl
rm
follow_linear_linear.hpp
15711
0644
edit
dl
rm
get_distance_measure.hpp
5092
0644
edit
dl
rm
get_intersection_points.hpp
4265
0644
edit
dl
rm
get_relative_order.hpp
3260
0644
edit
dl
rm
get_ring.hpp
3700
0644
edit
dl
rm
get_turns.hpp
42078
0644
edit
dl
rm
get_turn_info.hpp
45746
0644
edit
dl
rm
get_turn_info_for_endpoint.hpp
25337
0644
edit
dl
rm
get_turn_info_helpers.hpp
19708
0644
edit
dl
rm
get_turn_info_la.hpp
34941
0644
edit
dl
rm
get_turn_info_ll.hpp
28380
0644
edit
dl
rm
handle_colocations.hpp
28604
0644
edit
dl
rm
handle_self_turns.hpp
9962
0644
edit
dl
rm
inconsistent_turns_exception.hpp
1043
0644
edit
dl
rm
intersection_box_box.hpp
2623
0644
edit
dl
rm
intersection_insert.hpp
47296
0644
edit
dl
rm
is_self_turn.hpp
1611
0644
edit
dl
rm
less_by_segment_ratio.hpp
6161
0644
edit
dl
rm
linear_linear.hpp
9562
0644
edit
dl
rm
needs_self_turns.hpp
1911
0644
edit
dl
rm
overlay.hpp
15706
0644
edit
dl
rm
overlay_type.hpp
1746
0644
edit
dl
rm
pointlike_areal.hpp
9593
0644
edit
dl
rm
pointlike_linear.hpp
11547
0644
edit
dl
rm
pointlike_pointlike.hpp
11878
0644
edit
dl
rm
range_in_geometry.hpp
5066
0644
edit
dl
rm
ring_properties.hpp
2135
0644
edit
dl
rm
segment_as_subrange.hpp
1488
0644
edit
dl
rm
segment_identifier.hpp
3555
0644
edit
dl
rm
select_rings.hpp
12362
0644
edit
dl
rm
self_turn_points.hpp
10814
0644
edit
dl
rm
sort_by_side.hpp
22216
0644
edit
dl
rm
stream_info.hpp
2383
0644
edit
dl
rm
traversal.hpp
34432
0644
edit
dl
rm
traversal_info.hpp
1469
0644
edit
dl
rm
traversal_ring_creator.hpp
15319
0644
edit
dl
rm
traversal_switch_detector.hpp
22642
0644
edit
dl
rm
traverse.hpp
3256
0644
edit
dl
rm
turn_info.hpp
4468
0644
edit
dl
rm
visit_info.hpp
2350
0644
edit
dl
rm
Edit:
/usr/include/boost/geometry/algorithms/detail/overlay/follow.hpp
(16907B)
// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2014, 2017, 2018, 2019, 2020. // Modifications copyright (c) 2014-2020 Oracle and/or its affiliates. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_FOLLOW_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_FOLLOW_HPP #include <cstddef> #include <boost/range.hpp> #include <boost/mpl/assert.hpp> #include <boost/geometry/algorithms/detail/point_on_border.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/algorithms/covered_by.hpp> #include <boost/geometry/algorithms/clear.hpp> #include <boost/geometry/algorithms/detail/relate/turns.hpp> #include <boost/geometry/algorithms/detail/tupled_output.hpp> #include <boost/geometry/util/condition.hpp> namespace boost { namespace geometry { #ifndef DOXYGEN_NO_DETAIL namespace detail { namespace overlay { namespace following { template <typename Turn, typename Operation> inline bool is_entering(Turn const& /* TODO remove this parameter */, 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, typename PtInPolyStrategy > inline bool last_covered_by(Turn const& /*turn*/, Operation const& op, LineString const& linestring, Polygon const& polygon, PtInPolyStrategy const& strategy) { return geometry::covered_by(range::at(linestring, op.seg_id.segment_index), polygon, strategy); } template < typename Turn, typename Operation, typename LineString, typename Polygon, typename PtInPolyStrategy > inline bool is_leaving(Turn const& turn, Operation const& op, bool entered, bool first, LineString const& linestring, Polygon const& polygon, PtInPolyStrategy const& strategy) { if (op.operation == operation_union) { return entered || turn.method == method_crosses || (first && op.position != position_front && last_covered_by(turn, op, linestring, polygon, strategy)) ; } return false; } template < typename Turn, typename Operation, typename LineString, typename Polygon, typename PtInPolyStrategy > inline bool is_staying_inside(Turn const& turn, Operation const& op, bool entered, bool first, LineString const& linestring, Polygon const& polygon, PtInPolyStrategy const& strategy) { if (turn.method == method_crosses) { // The normal case, this is completely covered with entering/leaving // so stay out of this time consuming "covered_by" return false; } if (is_entering(turn, op)) { return entered || (first && last_covered_by(turn, op, linestring, polygon, strategy)); } return false; } template < typename Turn, typename Operation, typename Linestring, typename Polygon, typename PtInPolyStrategy > inline bool was_entered(Turn const& turn, Operation const& op, bool first, Linestring const& linestring, Polygon const& polygon, PtInPolyStrategy const& strategy) { if (first && (turn.method == method_collinear || turn.method == method_equal)) { return last_covered_by(turn, op, linestring, polygon, strategy); } return false; } template < typename Turn, typename Operation > inline bool is_touching(Turn const& turn, Operation const& op, bool entered) { return (op.operation == operation_union || op.operation == operation_blocked) && (turn.method == method_touch || turn.method == method_touch_interior) && !entered && !op.is_collinear; } template < typename GeometryOut, typename Tag = typename geometry::tag<GeometryOut>::type > struct add_isolated_point {}; template <typename LineStringOut> struct add_isolated_point<LineStringOut, linestring_tag> { template <typename Point, typename OutputIterator> static inline void apply(Point const& point, OutputIterator& out) { LineStringOut isolated_point_ls; geometry::append(isolated_point_ls, point); #ifndef BOOST_GEOMETRY_ALLOW_ONE_POINT_LINESTRINGS geometry::append(isolated_point_ls, point); #endif // BOOST_GEOMETRY_ALLOW_ONE_POINT_LINESTRINGS *out++ = isolated_point_ls; } }; template <typename PointOut> struct add_isolated_point<PointOut, point_tag> { template <typename Point, typename OutputIterator> static inline void apply(Point const& point, OutputIterator& out) { PointOut isolated_point; geometry::detail::conversion::convert_point_to_point(point, isolated_point); *out++ = isolated_point; } }; // Template specialization structure to call the right actions for the right type template <overlay_type OverlayType, bool RemoveSpikes = true> 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 <bool RemoveSpikes> struct action_selector<overlay_intersection, RemoveSpikes> { template < typename OutputIterator, typename LineStringOut, typename LineString, typename Point, typename Operation, typename Strategy, typename RobustPolicy > static inline void enter(LineStringOut& current_piece, LineString const& , segment_identifier& segment_id, signed_size_type , Point const& point, Operation const& operation, Strategy const& strategy, RobustPolicy const& , OutputIterator& ) { // On enter, append the intersection point and remember starting point // TODO: we don't check on spikes for linestrings (?). Consider this. detail::overlay::append_no_duplicates(current_piece, point, strategy.get_equals_point_point_strategy()); segment_id = operation.seg_id; } template < typename OutputIterator, typename LineStringOut, typename LineString, typename Point, typename Operation, typename Strategy, typename RobustPolicy > static inline void leave(LineStringOut& current_piece, LineString const& linestring, segment_identifier& segment_id, signed_size_type index, Point const& point, Operation const& , Strategy const& strategy, RobustPolicy const& robust_policy, OutputIterator& out) { // On leave, copy all segments from starting point, append the intersection point // and add the output piece detail::copy_segments::copy_segments_linestring < false, RemoveSpikes >::apply(linestring, segment_id, index, strategy, robust_policy, current_piece); detail::overlay::append_no_duplicates(current_piece, point, strategy.get_equals_point_point_strategy()); if (::boost::size(current_piece) > 1) { *out++ = current_piece; } geometry::clear(current_piece); } template < typename LineStringOrPointOut, typename Point, typename OutputIterator > static inline void isolated_point(Point const& point, OutputIterator& out) { add_isolated_point<LineStringOrPointOut>::apply(point, out); } static inline bool is_entered(bool entered) { return entered; } static inline bool included(int inside_value) { return inside_value >= 0; // covered_by } }; // Specialization for difference, which reverses these actions template <bool RemoveSpikes> struct action_selector<overlay_difference, RemoveSpikes> { typedef action_selector<overlay_intersection, RemoveSpikes> normal_action; template < typename OutputIterator, typename LineStringOut, typename LineString, typename Point, typename Operation, typename Strategy, typename RobustPolicy > static inline void enter(LineStringOut& current_piece, LineString const& linestring, segment_identifier& segment_id, signed_size_type index, Point const& point, Operation const& operation, Strategy const& strategy, RobustPolicy const& robust_policy, OutputIterator& out) { normal_action::leave(current_piece, linestring, segment_id, index, point, operation, strategy, robust_policy, out); } template < typename OutputIterator, typename LineStringOut, typename LineString, typename Point, typename Operation, typename Strategy, typename RobustPolicy > static inline void leave(LineStringOut& current_piece, LineString const& linestring, segment_identifier& segment_id, signed_size_type index, Point const& point, Operation const& operation, Strategy const& strategy, RobustPolicy const& robust_policy, OutputIterator& out) { normal_action::enter(current_piece, linestring, segment_id, index, point, operation, strategy, robust_policy, out); } template < typename LineStringOrPointOut, typename Point, typename OutputIterator > static inline void isolated_point(Point const&, OutputIterator const&) { } static inline bool is_entered(bool entered) { return ! normal_action::is_entered(entered); } static inline bool included(int inside_value) { return ! normal_action::included(inside_value); } }; } // namespace following /*! \brief Follows a linestring from intersection point to intersection point, outputting which is inside, or outside, a ring or polygon \ingroup overlay */ template < typename GeometryOut, typename LineString, typename Polygon, overlay_type OverlayType, bool RemoveSpikes, bool FollowIsolatedPoints > class follow { typedef geometry::detail::output_geometry_access < GeometryOut, linestring_tag, linestring_tag > linear; typedef geometry::detail::output_geometry_access < GeometryOut, point_tag, linestring_tag > pointlike; public : static inline bool included(int inside_value) { return following::action_selector < OverlayType, RemoveSpikes >::included(inside_value); } template < typename Turns, typename OutputIterator, typename RobustPolicy, typename Strategy > static inline OutputIterator apply(LineString const& linestring, Polygon const& polygon, detail::overlay::operation_type , // TODO: this parameter might be redundant Turns& turns, RobustPolicy const& robust_policy, OutputIterator out, Strategy const& strategy) { typedef typename boost::range_iterator<Turns>::type turn_iterator; typedef typename boost::range_value<Turns>::type turn_type; typedef typename boost::range_iterator < typename turn_type::container_type >::type turn_operation_iterator_type; typedef following::action_selector<OverlayType, RemoveSpikes> action; typedef typename Strategy::cs_tag cs_tag; typename Strategy::template point_in_geometry_strategy < LineString, Polygon >::type const pt_in_poly_strategy = strategy.template get_point_in_geometry_strategy<LineString, Polygon>(); // Sort intersection points on segments-along-linestring, and distance // (like in enrich is done for poly/poly) // sort turns by Linear seg_id, then by fraction, then // for same ring id: x, u, i, c // for different ring id: c, i, u, x typedef relate::turns::less < 0, relate::turns::less_op_linear_areal_single<0>, cs_tag > turn_less; std::sort(boost::begin(turns), boost::end(turns), turn_less()); typename linear::type current_piece; geometry::segment_identifier current_segment_id(0, -1, -1, -1); // Iterate through all intersection points (they are ordered along the line) bool entered = false; bool first = true; for (turn_iterator it = boost::begin(turns); it != boost::end(turns); ++it) { turn_operation_iterator_type iit = boost::begin(it->operations); if (following::was_entered(*it, *iit, first, linestring, polygon, pt_in_poly_strategy)) { debug_traverse(*it, *iit, "-> Was entered"); entered = true; } if (following::is_staying_inside(*it, *iit, entered, first, linestring, polygon, pt_in_poly_strategy)) { debug_traverse(*it, *iit, "-> Staying inside"); entered = true; } else if (following::is_entering(*it, *iit)) { debug_traverse(*it, *iit, "-> Entering"); entered = true; action::enter(current_piece, linestring, current_segment_id, iit->seg_id.segment_index, it->point, *iit, strategy, robust_policy, linear::get(out)); } else if (following::is_leaving(*it, *iit, entered, first, linestring, polygon, pt_in_poly_strategy)) { debug_traverse(*it, *iit, "-> Leaving"); entered = false; action::leave(current_piece, linestring, current_segment_id, iit->seg_id.segment_index, it->point, *iit, strategy, robust_policy, linear::get(out)); } else if (BOOST_GEOMETRY_CONDITION(FollowIsolatedPoints) && following::is_touching(*it, *iit, entered)) { debug_traverse(*it, *iit, "-> Isolated point"); action::template isolated_point < typename pointlike::type >(it->point, pointlike::get(out)); } first = false; } if (action::is_entered(entered)) { detail::copy_segments::copy_segments_linestring < false, RemoveSpikes >::apply(linestring, current_segment_id, static_cast<signed_size_type>(boost::size(linestring) - 1), strategy, robust_policy, current_piece); } // Output the last one, if applicable std::size_t current_piece_size = ::boost::size(current_piece); if (current_piece_size > 1) { *linear::get(out)++ = current_piece; } else if (BOOST_GEOMETRY_CONDITION(FollowIsolatedPoints) && current_piece_size == 1) { action::template isolated_point < typename pointlike::type >(range::front(current_piece), pointlike::get(out)); } return out; } }; }} // namespace detail::overlay #endif // DOXYGEN_NO_DETAIL }} // namespace boost::geometry #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_FOLLOW_HPP
Save
cmd:
run