/
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/copy_segments.hpp
(11481B)
// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // This file was modified by Oracle on 2014, 2017, 2018. // Modifications copyright (c) 2014-2018 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_COPY_SEGMENTS_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENTS_HPP #include <vector> #include <boost/array.hpp> #include <boost/mpl/assert.hpp> #include <boost/range.hpp> #include <boost/type_traits/integral_constant.hpp> #include <boost/geometry/algorithms/detail/assign_box_corners.hpp> #include <boost/geometry/algorithms/detail/signed_size_type.hpp> #include <boost/geometry/algorithms/detail/overlay/append_no_duplicates.hpp> #include <boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp> #include <boost/geometry/algorithms/not_implemented.hpp> #include <boost/geometry/core/assert.hpp> #include <boost/geometry/core/exterior_ring.hpp> #include <boost/geometry/core/interior_rings.hpp> #include <boost/geometry/core/ring_type.hpp> #include <boost/geometry/core/tags.hpp> #include <boost/geometry/geometries/concepts/check.hpp> #include <boost/geometry/iterators/ever_circling_iterator.hpp> #include <boost/geometry/util/range.hpp> #include <boost/geometry/views/closeable_view.hpp> #include <boost/geometry/views/reversible_view.hpp> namespace boost { namespace geometry { #ifndef DOXYGEN_NO_DETAIL namespace detail { namespace copy_segments { template <bool Reverse> struct copy_segments_ring { template < typename Ring, typename SegmentIdentifier, typename SideStrategy, typename RobustPolicy, typename RangeOut > static inline void apply(Ring const& ring, SegmentIdentifier const& seg_id, signed_size_type to_index, SideStrategy const& strategy, RobustPolicy const& robust_policy, RangeOut& current_output) { typedef typename closeable_view < Ring const, closure<Ring>::value >::type cview_type; typedef typename reversible_view < cview_type const, Reverse ? iterate_reverse : iterate_forward >::type rview_type; typedef typename boost::range_iterator<rview_type const>::type iterator; typedef geometry::ever_circling_iterator<iterator> ec_iterator; cview_type cview(ring); rview_type view(cview); // The problem: sometimes we want to from "3" to "2" // -> end = "3" -> end == begin // This is not convenient with iterators. // So we use the ever-circling iterator and determine when to step out signed_size_type const from_index = seg_id.segment_index + 1; // Sanity check BOOST_GEOMETRY_ASSERT(from_index < static_cast<signed_size_type>(boost::size(view))); ec_iterator it(boost::begin(view), boost::end(view), boost::begin(view) + from_index); // [2..4] -> 4 - 2 + 1 = 3 -> {2,3,4} -> OK // [4..2],size=6 -> 6 - 4 + 2 + 1 = 5 -> {4,5,0,1,2} -> OK // [1..1], travel the whole ring round signed_size_type const count = from_index <= to_index ? to_index - from_index + 1 : static_cast<signed_size_type>(boost::size(view)) - from_index + to_index + 1; for (signed_size_type i = 0; i < count; ++i, ++it) { detail::overlay::append_no_dups_or_spikes(current_output, *it, strategy, robust_policy); } } }; template <bool Reverse, bool RemoveSpikes = true> class copy_segments_linestring { private: // remove spikes template <typename RangeOut, typename Point, typename SideStrategy, typename RobustPolicy> static inline void append_to_output(RangeOut& current_output, Point const& point, SideStrategy const& strategy, RobustPolicy const& robust_policy, boost::true_type const&) { detail::overlay::append_no_dups_or_spikes(current_output, point, strategy, robust_policy); } // keep spikes template <typename RangeOut, typename Point, typename SideStrategy, typename RobustPolicy> static inline void append_to_output(RangeOut& current_output, Point const& point, SideStrategy const& strategy, RobustPolicy const&, boost::false_type const&) { detail::overlay::append_no_duplicates(current_output, point, strategy.get_equals_point_point_strategy()); } public: template < typename LineString, typename SegmentIdentifier, typename SideStrategy, typename RobustPolicy, typename RangeOut > static inline void apply(LineString const& ls, SegmentIdentifier const& seg_id, signed_size_type to_index, SideStrategy const& strategy, RobustPolicy const& robust_policy, RangeOut& current_output) { signed_size_type const from_index = seg_id.segment_index + 1; // Sanity check if ( from_index > to_index || from_index < 0 || to_index >= static_cast<signed_size_type>(boost::size(ls)) ) { return; } signed_size_type const count = to_index - from_index + 1; typename boost::range_iterator<LineString const>::type it = boost::begin(ls) + from_index; for (signed_size_type i = 0; i < count; ++i, ++it) { append_to_output(current_output, *it, strategy, robust_policy, boost::integral_constant<bool, RemoveSpikes>()); } } }; template <bool Reverse> struct copy_segments_polygon { template < typename Polygon, typename SegmentIdentifier, typename SideStrategy, typename RobustPolicy, typename RangeOut > static inline void apply(Polygon const& polygon, SegmentIdentifier const& seg_id, signed_size_type to_index, SideStrategy const& strategy, RobustPolicy const& robust_policy, RangeOut& current_output) { // Call ring-version with the right ring copy_segments_ring<Reverse>::apply ( seg_id.ring_index < 0 ? geometry::exterior_ring(polygon) : range::at(geometry::interior_rings(polygon), seg_id.ring_index), seg_id, to_index, strategy, robust_policy, current_output ); } }; template <bool Reverse> struct copy_segments_box { template < typename Box, typename SegmentIdentifier, typename SideStrategy, typename RobustPolicy, typename RangeOut > static inline void apply(Box const& box, SegmentIdentifier const& seg_id, signed_size_type to_index, SideStrategy const& strategy, RobustPolicy const& robust_policy, RangeOut& current_output) { signed_size_type index = seg_id.segment_index + 1; BOOST_GEOMETRY_ASSERT(index < 5); signed_size_type const count = index <= to_index ? to_index - index + 1 : 5 - index + to_index + 1; // Create array of points, the fifth one closes it boost::array<typename point_type<Box>::type, 5> bp; assign_box_corners_oriented<Reverse>(box, bp); bp[4] = bp[0]; // (possibly cyclic) copy to output // (see comments in ring-version) for (signed_size_type i = 0; i < count; i++, index++) { detail::overlay::append_no_dups_or_spikes(current_output, bp[index % 5], strategy, robust_policy); } } }; template<typename Policy> struct copy_segments_multi { template < typename MultiGeometry, typename SegmentIdentifier, typename SideStrategy, typename RobustPolicy, typename RangeOut > static inline void apply(MultiGeometry const& multi_geometry, SegmentIdentifier const& seg_id, signed_size_type to_index, SideStrategy const& strategy, RobustPolicy const& robust_policy, RangeOut& current_output) { BOOST_GEOMETRY_ASSERT ( seg_id.multi_index >= 0 && static_cast<std::size_t>(seg_id.multi_index) < boost::size(multi_geometry) ); // Call the single-version Policy::apply(range::at(multi_geometry, seg_id.multi_index), seg_id, to_index, strategy, robust_policy, current_output); } }; }} // namespace detail::copy_segments #endif // DOXYGEN_NO_DETAIL #ifndef DOXYGEN_NO_DISPATCH namespace dispatch { template < typename Tag, bool Reverse > struct copy_segments : not_implemented<Tag> {}; template <bool Reverse> struct copy_segments<ring_tag, Reverse> : detail::copy_segments::copy_segments_ring<Reverse> {}; template <bool Reverse> struct copy_segments<linestring_tag, Reverse> : detail::copy_segments::copy_segments_linestring<Reverse> {}; template <bool Reverse> struct copy_segments<polygon_tag, Reverse> : detail::copy_segments::copy_segments_polygon<Reverse> {}; template <bool Reverse> struct copy_segments<box_tag, Reverse> : detail::copy_segments::copy_segments_box<Reverse> {}; template<bool Reverse> struct copy_segments<multi_polygon_tag, Reverse> : detail::copy_segments::copy_segments_multi < detail::copy_segments::copy_segments_polygon<Reverse> > {}; } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH /*! \brief Copy segments from a geometry, starting with the specified segment (seg_id) until the specified index (to_index) \ingroup overlay */ template < bool Reverse, typename Geometry, typename SegmentIdentifier, typename SideStrategy, typename RobustPolicy, typename RangeOut > inline void copy_segments(Geometry const& geometry, SegmentIdentifier const& seg_id, signed_size_type to_index, SideStrategy const& strategy, RobustPolicy const& robust_policy, RangeOut& range_out) { concepts::check<Geometry const>(); dispatch::copy_segments < typename tag<Geometry>::type, Reverse >::apply(geometry, seg_id, to_index, strategy, robust_policy, range_out); } }} // namespace boost::geometry #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENTS_HPP
Save
cmd:
run