select static method
Implementation
static select(SegmentList segments, selection, BuildLog buildLog) {
var result = new SegmentList();
segments.forEach((seg) {
var index = (seg.myFill.above ? 8 : 0) +
(seg.myFill.below ? 4 : 0) +
((seg.otherFill != null && seg.otherFill.above) ? 2 : 0) +
((seg.otherFill != null && seg.otherFill.below) ? 1 : 0);
if (selection[index] != 0) {
result.add(new Segment(
id: -1,
start: seg.start,
end: seg.end,
myFill: SegmentFill(
above: selection[index] == 1, // 1 if filled above
below: selection[index] == 2 // 2 if filled below
),
otherFill: null));
// copy the segment to the results, while also calculating the fill status
}
});
return result;
}