/usr/include/boost/geometry/algorithms/detail/overlay
NameSizeModeActions
add_rings.hpp59640644editdlrm
append_no_duplicates.hpp21010644editdlrm
append_no_dups_or_spikes.hpp74340644editdlrm
assign_parents.hpp145770644editdlrm
backtrack_check_si.hpp63710644editdlrm
check_enrich.hpp53610644editdlrm
clip_linestring.hpp87180644editdlrm
cluster_exits.hpp78170644editdlrm
cluster_info.hpp10100644editdlrm
convert_ring.hpp31130644editdlrm
copy_segments.hpp114810644editdlrm
copy_segment_point.hpp111070644editdlrm
debug_turn_info.hpp19470644editdlrm
do_reverse.hpp12460644editdlrm
enrichment_info.hpp23430644editdlrm
enrich_intersection_points.hpp190080644editdlrm
follow.hpp169070644editdlrm
follow_linear_linear.hpp157110644editdlrm
get_distance_measure.hpp50920644editdlrm
get_intersection_points.hpp42650644editdlrm
get_relative_order.hpp32600644editdlrm
get_ring.hpp37000644editdlrm
get_turns.hpp420780644editdlrm
get_turn_info.hpp457460644editdlrm
get_turn_info_for_endpoint.hpp253370644editdlrm
get_turn_info_helpers.hpp197080644editdlrm
get_turn_info_la.hpp349410644editdlrm
get_turn_info_ll.hpp283800644editdlrm
handle_colocations.hpp286040644editdlrm
handle_self_turns.hpp99620644editdlrm
inconsistent_turns_exception.hpp10430644editdlrm
intersection_box_box.hpp26230644editdlrm
intersection_insert.hpp472960644editdlrm
is_self_turn.hpp16110644editdlrm
less_by_segment_ratio.hpp61610644editdlrm
linear_linear.hpp95620644editdlrm
needs_self_turns.hpp19110644editdlrm
overlay.hpp157060644editdlrm
overlay_type.hpp17460644editdlrm
pointlike_areal.hpp95930644editdlrm
pointlike_linear.hpp115470644editdlrm
pointlike_pointlike.hpp118780644editdlrm
range_in_geometry.hpp50660644editdlrm
ring_properties.hpp21350644editdlrm
segment_as_subrange.hpp14880644editdlrm
segment_identifier.hpp35550644editdlrm
select_rings.hpp123620644editdlrm
self_turn_points.hpp108140644editdlrm
sort_by_side.hpp222160644editdlrm
stream_info.hpp23830644editdlrm
traversal.hpp344320644editdlrm
traversal_info.hpp14690644editdlrm
traversal_ring_creator.hpp153190644editdlrm
traversal_switch_detector.hpp226420644editdlrm
traverse.hpp32560644editdlrm
turn_info.hpp44680644editdlrm
visit_info.hpp23500644editdlrm
Edit: /usr/include/boost/geometry/algorithms/detail/overlay/select_rings.hpp (12362B)
// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland. // This file was modified by Oracle on 2017. // Modifications copyright (c) 2017 Oracle and/or its affiliates. // 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_SELECT_RINGS_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP #include #include #include #include #include #include #include #include #include namespace boost { namespace geometry { #ifndef DOXYGEN_NO_DETAIL namespace detail { namespace overlay { struct ring_turn_info { bool has_traversed_turn; bool has_blocked_turn; bool within_other; ring_turn_info() : has_traversed_turn(false) , has_blocked_turn(false) , within_other(false) {} }; namespace dispatch { template struct select_rings {}; template struct select_rings { template static inline void apply(Box const& box, Geometry const& , ring_identifier const& id, RingPropertyMap& ring_properties, AreaStrategy const& strategy) { ring_properties[id] = typename RingPropertyMap::mapped_type(box, strategy); } template static inline void apply(Box const& box, ring_identifier const& id, RingPropertyMap& ring_properties, AreaStrategy const& strategy) { ring_properties[id] = typename RingPropertyMap::mapped_type(box, strategy); } }; template struct select_rings { template static inline void apply(Ring const& ring, Geometry const& , ring_identifier const& id, RingPropertyMap& ring_properties, AreaStrategy const& strategy) { if (boost::size(ring) > 0) { ring_properties[id] = typename RingPropertyMap::mapped_type(ring, strategy); } } template static inline void apply(Ring const& ring, ring_identifier const& id, RingPropertyMap& ring_properties, AreaStrategy const& strategy) { if (boost::size(ring) > 0) { ring_properties[id] = typename RingPropertyMap::mapped_type(ring, strategy); } } }; template struct select_rings { template static inline void apply(Polygon const& polygon, Geometry const& geometry, ring_identifier id, RingPropertyMap& ring_properties, AreaStrategy const& strategy) { typedef typename geometry::ring_type::type ring_type; typedef select_rings per_ring; per_ring::apply(exterior_ring(polygon), geometry, id, ring_properties, strategy); typename interior_return_type::type rings = interior_rings(polygon); for (typename detail::interior_iterator::type it = boost::begin(rings); it != boost::end(rings); ++it) { id.ring_index++; per_ring::apply(*it, geometry, id, ring_properties, strategy); } } template static inline void apply(Polygon const& polygon, ring_identifier id, RingPropertyMap& ring_properties, AreaStrategy const& strategy) { typedef typename geometry::ring_type::type ring_type; typedef select_rings per_ring; per_ring::apply(exterior_ring(polygon), id, ring_properties, strategy); typename interior_return_type::type rings = interior_rings(polygon); for (typename detail::interior_iterator::type it = boost::begin(rings); it != boost::end(rings); ++it) { id.ring_index++; per_ring::apply(*it, id, ring_properties, strategy); } } }; template struct select_rings { template static inline void apply(Multi const& multi, Geometry const& geometry, ring_identifier id, RingPropertyMap& ring_properties, AreaStrategy const& strategy) { 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, ring_properties, strategy); id.multi_index++; } } }; } // namespace dispatch template struct decide { // Default implementation (union, inflate, deflate, dissolve) static bool include(ring_identifier const& , ring_turn_info const& info) { return ! info.within_other; } static bool reversed(ring_identifier const& , ring_turn_info const& ) { return false; } }; template<> struct decide { static bool include(ring_identifier const& id, ring_turn_info const& info) { // Difference: A - B // If this is A (source_index=0), then the ring is inside B // If this is B (source_index=1), then the ring is NOT inside A // If this is A and the ring is within the other geometry, // then we should NOT include it. // If this is B then we SHOULD include it. return id.source_index == 0 ? ! info.within_other : info.within_other; } static bool reversed(ring_identifier const& id, ring_turn_info const& info) { // Difference: A - B // If this is B, and the ring is included, it should be reversed afterwards return id.source_index == 1 && include(id, info); } }; template<> struct decide { static bool include(ring_identifier const& , ring_turn_info const& info) { return info.within_other; } static bool reversed(ring_identifier const& , ring_turn_info const& ) { return false; } }; template < overlay_type OverlayType, typename Geometry1, typename Geometry2, typename TurnInfoMap, typename RingPropertyMap, typename Strategy > inline void update_ring_selection(Geometry1 const& geometry1, Geometry2 const& geometry2, TurnInfoMap const& turn_info_map, RingPropertyMap const& all_ring_properties, RingPropertyMap& selected_ring_properties, Strategy const& strategy) { selected_ring_properties.clear(); for (typename RingPropertyMap::const_iterator it = boost::begin(all_ring_properties); it != boost::end(all_ring_properties); ++it) { ring_identifier const& id = it->first; ring_turn_info info; typename TurnInfoMap::const_iterator tcit = turn_info_map.find(id); if (tcit != turn_info_map.end()) { info = tcit->second; // Copy by value } if (info.has_traversed_turn || info.has_blocked_turn) { // This turn is traversed or blocked, // don't include the original ring continue; } // Check if the ring is within the other geometry, by taking // a point lying on the ring switch(id.source_index) { // within case 0 : info.within_other = range_in_geometry(it->second.point, geometry1, geometry2, strategy) > 0; break; case 1 : info.within_other = range_in_geometry(it->second.point, geometry2, geometry1, strategy) > 0; break; } if (decide::include(id, info)) { typename RingPropertyMap::mapped_type properties = it->second; // Copy by value properties.reversed = decide::reversed(id, info); selected_ring_properties[id] = properties; } } } /*! \brief The function select_rings select rings based on the overlay-type (union,intersection) */ template < overlay_type OverlayType, typename Geometry1, typename Geometry2, typename RingTurnInfoMap, typename RingPropertyMap, typename Strategy > inline void select_rings(Geometry1 const& geometry1, Geometry2 const& geometry2, RingTurnInfoMap const& turn_info_per_ring, RingPropertyMap& selected_ring_properties, Strategy const& strategy) { typedef typename geometry::tag::type tag1; typedef typename geometry::tag::type tag2; typedef typename geometry::point_type::type point1_type; typedef typename geometry::point_type::type point2_type; RingPropertyMap all_ring_properties; dispatch::select_rings::apply(geometry1, geometry2, ring_identifier(0, -1, -1), all_ring_properties, strategy.template get_area_strategy()); dispatch::select_rings::apply(geometry2, geometry1, ring_identifier(1, -1, -1), all_ring_properties, strategy.template get_area_strategy()); update_ring_selection(geometry1, geometry2, turn_info_per_ring, all_ring_properties, selected_ring_properties, strategy); } template < overlay_type OverlayType, typename Geometry, typename RingTurnInfoMap, typename RingPropertyMap, typename Strategy > inline void select_rings(Geometry const& geometry, RingTurnInfoMap const& turn_info_per_ring, RingPropertyMap& selected_ring_properties, Strategy const& strategy) { typedef typename geometry::tag::type tag; typedef typename geometry::point_type::type point_type; RingPropertyMap all_ring_properties; dispatch::select_rings::apply(geometry, ring_identifier(0, -1, -1), all_ring_properties, strategy.template get_area_strategy()); update_ring_selection(geometry, geometry, turn_info_per_ring, all_ring_properties, selected_ring_properties, strategy); } }} // namespace detail::overlay #endif // DOXYGEN_NO_DETAIL }} // namespace boost::geometry #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP