1.1 --- a/imiptools/period.py Sat Oct 14 16:44:49 2017 +0200
1.2 +++ b/imiptools/period.py Sat Oct 14 19:11:58 2017 +0200
1.3 @@ -426,6 +426,31 @@
1.4 overlapping.sort()
1.5 return overlapping
1.6
1.7 +def get_overlapping_members(periods):
1.8 +
1.9 + "Return members of the 'periods' collection that overlap with others."
1.10 +
1.11 + if not periods:
1.12 + return []
1.13 +
1.14 + l = periods[:]
1.15 + l.sort()
1.16 +
1.17 + overlapping = []
1.18 +
1.19 + last = l[0]
1.20 + last_added = None
1.21 +
1.22 + for p in l[1:]:
1.23 + if p.get_start_point() < last.get_end_point():
1.24 + if last_added != last:
1.25 + overlapping.append(last)
1.26 + overlapping.append(p)
1.27 + last_added = p
1.28 + last = p
1.29 +
1.30 + return overlapping
1.31 +
1.32 # Period layout.
1.33
1.34 def get_scale(periods, tzid, view_period=None):