private void InitializeHighlights() { ClearHighlights(); if (!selection.IsEmpty()) { highlights.Insert(selection); } }
/// <summary> /// Breaks down a base highlight and produces atomic highlights /// </summary> private IntervalTree <AtomicHighlight> BreakDownHighlights(Highlight s, IList <Highlight> lst) { //System.Console.WriteLine("breaking down {0}", s); IntervalTree <AtomicHighlight> it = new IntervalTree <AtomicHighlight>(); if (!s.IsEmpty()) { it.Insert(new AtomicHighlight(s)); } foreach (Highlight r in lst) { //System.Console.WriteLine(" Processing {0}", r); IList <AtomicHighlight> overlaps = it.SearchOverlap(r); foreach (AtomicHighlight q in overlaps) { it.Delete(q); //System.Console.WriteLine(" Overlap {0}", q); AtomicHighlight[] ha = SplitAtomicPrioritized(q, r); foreach (AtomicHighlight h in ha) { // Keep only common parts to avoid duplications. // This also has the useful side effect that everything // is clipped inside s h.Intersect(q); //System.Console.WriteLine(" Atomic {0}", h); if (!h.IsEmpty()) { it.Insert(h); } } } } //foreach(AtomicHighlight ah in it.GetValues()) { // System.Console.WriteLine(" " + ah); //} return(it); }