Timeline: Now uses splitInterval

This commit is contained in:
Paul Beckingham 2016-04-27 23:30:07 -04:00
parent 7c51f76954
commit b2cd2e2953

View file

@ -80,27 +80,8 @@ std::vector <Interval> Timeline::tracked (Rules& rules) const
// Open intervals need to be split according to the exclusions.
else
{
// Start with a single range from the interval, from which to subtract.
std::vector <Range> intervalFragments {interval.range};
for (auto& exclusion : exclusions)
{
std::vector <Range> brokenFragments;
for (auto& fragment : intervalFragments)
for (auto& broken : fragment.subtract (exclusion))
brokenFragments.push_back (broken);
intervalFragments = brokenFragments;
}
// Return all the fragments as intervals.
for (auto& fragment : intervalFragments)
{
// Clone the interval, set the new range.
Interval clipped {interval};
clipped.range = fragment;
all.push_back (clipped);
}
for (auto& fragment : splitInterval (interval, exclusions))
all.push_back (fragment);
}
}