public ScreenLocRange Union(ScreenLocRange range2) { var r1 = this.Extend(range2.From); var r2 = r1.Extend(range2.To); return(r2); }
/// <summary> /// return true if the input range fully or partially overlaps this range. /// </summary> /// <param name="Range"></param> /// <returns></returns> public bool ContainsAny(ScreenLocRange Range) { bool contains = false; // the input range starts somewhere within this range. if (this.Contains(Range.From)) { contains = true; } // the input range ends somewhere within this range. else if (this.Contains(Range.To)) { contains = true; } // the input range starts before and ends after this range. That is, the // input range completely overlaps this range. else if ((Range.From.CompareTo(this.From) < 0) && (Range.To.CompareTo(this.To) > 0)) { contains = true; } return(contains); }
public bool CompletelyContains(ScreenLocRange Range) { bool contains = false; if (this.From.CompareTo(Range.From) <= 0) { if (this.To.CompareTo(Range.To) >= 0) { contains = true; } } return(contains); }