File indexing completed on 2026-08-21 08:45:50
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELECT_TOI_BY_INCOMING_HPP
0010 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELECT_TOI_BY_INCOMING_HPP
0011
0012 #include <boost/geometry/algorithms/detail/overlay/turn_operation_id.hpp>
0013
0014
0015 namespace boost { namespace geometry
0016 {
0017
0018 #ifndef DOXYGEN_NO_DETAIL
0019 namespace detail { namespace overlay
0020 {
0021
0022
0023
0024
0025 template <typename Turns, typename Operation>
0026 bool select_toi_for_union(turn_operation_id& result, Operation const& op0, Operation const& op1,
0027 turn_operation_id const& toi0, turn_operation_id const& toi1,
0028 Turns const& turns)
0029 {
0030 if (op0.enriched.travels_to_ip_index != op1.enriched.travels_to_ip_index
0031 || op0.enriched.travels_to_ip_index < 0)
0032 {
0033
0034 return false;
0035 }
0036 auto const& target_turn = turns[op0.enriched.travels_to_ip_index];
0037 auto const& target_op0 = target_turn.operations[0];
0038 auto const& target_op1 = target_turn.operations[1];
0039
0040 bool const is_target_for_union0 = target_op0.enriched.count_left_incoming == 0;
0041 bool const is_target_for_union1 = target_op1.enriched.count_left_incoming == 0;
0042 if (is_target_for_union0 == is_target_for_union1)
0043 {
0044
0045 return false;
0046 }
0047
0048 #if defined(BOOST_GEOMETRY_DEBUG_TRAVERSE_GRAPH)
0049 std::cout << "SELECT_BY_INCOMING " << toi0 << " vs " << toi1
0050 << " " << operation_char(op0.operation) << operation_char(op1.operation)
0051 << " traveling to " << op0.enriched.travels_to_ip_index
0052 << std::endl;
0053 #endif
0054
0055 if (target_op0.seg_id.multi_index == target_op1.seg_id.multi_index)
0056 {
0057
0058
0059 return false;
0060 }
0061
0062 if (is_target_for_union0)
0063 {
0064 if (target_op0.seg_id.multi_index == op0.seg_id.multi_index)
0065 {
0066 result = toi0;
0067 return true;
0068 }
0069 if (target_op0.seg_id.multi_index == op1.seg_id.multi_index)
0070 {
0071 result = toi1;
0072 return true;
0073 }
0074 }
0075 else
0076 {
0077 if (target_op1.seg_id.multi_index == op0.seg_id.multi_index)
0078 {
0079 result = toi0;
0080 return true;
0081 }
0082 if (target_op1.seg_id.multi_index == op1.seg_id.multi_index)
0083 {
0084 result = toi1;
0085 return true;
0086 }
0087 }
0088 return false;
0089 }
0090
0091 }}
0092 #endif
0093
0094 }}
0095
0096 #endif