File indexing completed on 2025-12-15 09:50:18
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SEGMENT_IDENTIFIER_HPP
0010 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SEGMENT_IDENTIFIER_HPP
0011
0012
0013 #if defined(BOOST_GEOMETRY_DEBUG_OVERLAY)
0014 # define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
0015 #endif
0016
0017 #if defined(BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER)
0018 #include <iostream>
0019 #endif
0020
0021
0022 #include <boost/geometry/algorithms/detail/signed_size_type.hpp>
0023 #include <boost/geometry/algorithms/detail/ring_identifier.hpp>
0024
0025
0026 namespace boost { namespace geometry
0027 {
0028
0029
0030
0031
0032
0033
0034
0035 struct segment_identifier
0036 {
0037 inline segment_identifier()
0038 : source_index(-1)
0039 , multi_index(-1)
0040 , ring_index(-1)
0041 , segment_index(-1)
0042 , piece_index(-1)
0043 {}
0044
0045 inline segment_identifier(signed_size_type src,
0046 signed_size_type mul,
0047 signed_size_type rin,
0048 signed_size_type seg)
0049 : source_index(src)
0050 , multi_index(mul)
0051 , ring_index(rin)
0052 , segment_index(seg)
0053 , piece_index(-1)
0054 {}
0055
0056 inline bool operator<(segment_identifier const& other) const
0057 {
0058 return source_index != other.source_index ? source_index < other.source_index
0059 : multi_index !=other.multi_index ? multi_index < other.multi_index
0060 : ring_index != other.ring_index ? ring_index < other.ring_index
0061 : piece_index != other.piece_index ? piece_index < other.piece_index
0062 : segment_index < other.segment_index
0063 ;
0064 }
0065
0066 inline bool operator==(segment_identifier const& other) const
0067 {
0068 return source_index == other.source_index
0069 && segment_index == other.segment_index
0070 && ring_index == other.ring_index
0071 && piece_index == other.piece_index
0072 && multi_index == other.multi_index
0073 ;
0074 }
0075
0076 #if defined(BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER)
0077 friend std::ostream& operator<<(std::ostream &os, segment_identifier const& seg_id)
0078 {
0079 os
0080 << "s:" << seg_id.source_index
0081 << ", v:" << seg_id.segment_index
0082 ;
0083 if (seg_id.ring_index >= 0) os << ", r:" << seg_id.ring_index;
0084 if (seg_id.multi_index >= 0) os << ", m:" << seg_id.multi_index;
0085 if (seg_id.piece_index >= 0) os << ", p:" << seg_id.piece_index;
0086 return os;
0087 }
0088 #endif
0089
0090 signed_size_type source_index;
0091 signed_size_type multi_index;
0092 signed_size_type ring_index;
0093 signed_size_type segment_index;
0094
0095
0096 signed_size_type piece_index;
0097 };
0098
0099 #ifndef DOXYGEN_NO_DETAIL
0100 namespace detail { namespace overlay
0101 {
0102
0103
0104 inline ring_identifier ring_id_by_seg_id(segment_identifier const& seg_id)
0105 {
0106 return ring_identifier(seg_id.source_index, seg_id.multi_index, seg_id.ring_index);
0107 }
0108
0109 }}
0110 #endif
0111
0112 }}
0113
0114 #endif