]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/include/boost/geometry/algorithms/detail/overlay/segment_identifier.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / algorithms / detail / overlay / segment_identifier.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4
5 // Use, modification and distribution is subject to the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8
9 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SEGMENT_IDENTIFIER_HPP
10 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SEGMENT_IDENTIFIER_HPP
11
12
13 #if defined(BOOST_GEOMETRY_DEBUG_OVERLAY)
14 # define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
15 #endif
16
17 #if defined(BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER)
18 #include <iostream>
19 #endif
20
21
22 #include <boost/geometry/algorithms/detail/signed_size_type.hpp>
23
24
25 namespace boost { namespace geometry
26 {
27
28
29
30 // Internal struct to uniquely identify a segment
31 // on a linestring,ring
32 // or polygon (needs ring_index)
33 // or multi-geometry (needs multi_index)
34 struct segment_identifier
35 {
36 inline segment_identifier()
37 : source_index(-1)
38 , multi_index(-1)
39 , ring_index(-1)
40 , segment_index(-1)
41 , piece_index(-1)
42 {}
43
44 inline segment_identifier(signed_size_type src,
45 signed_size_type mul,
46 signed_size_type rin,
47 signed_size_type seg)
48 : source_index(src)
49 , multi_index(mul)
50 , ring_index(rin)
51 , segment_index(seg)
52 , piece_index(-1)
53 {}
54
55 inline bool operator<(segment_identifier const& other) const
56 {
57 return source_index != other.source_index ? source_index < other.source_index
58 : multi_index !=other.multi_index ? multi_index < other.multi_index
59 : ring_index != other.ring_index ? ring_index < other.ring_index
60 : segment_index < other.segment_index
61 ;
62 }
63
64 inline bool operator==(segment_identifier const& other) const
65 {
66 return source_index == other.source_index
67 && segment_index == other.segment_index
68 && ring_index == other.ring_index
69 && multi_index == other.multi_index
70 ;
71 }
72
73 #if defined(BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER)
74 friend std::ostream& operator<<(std::ostream &os, segment_identifier const& seg_id)
75 {
76 os
77 << "s:" << seg_id.source_index
78 << ", v:" << seg_id.segment_index // v:vertex because s is used for source
79 ;
80 if (seg_id.ring_index >= 0) os << ", r:" << seg_id.ring_index;
81 if (seg_id.multi_index >= 0) os << ", m:" << seg_id.multi_index;
82 return os;
83 }
84 #endif
85
86 signed_size_type source_index;
87 signed_size_type multi_index;
88 signed_size_type ring_index;
89 signed_size_type segment_index;
90
91 // For buffer - todo: move this to buffer-only
92 signed_size_type piece_index;
93 };
94
95
96
97 }} // namespace boost::geometry
98
99 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SEGMENT_IDENTIFIER_HPP