using System.Collections; using System.Collections.Generic; using System.Diagnostics; using Microsoft.Msagl.Core.DataStructures; using Microsoft.Msagl.Core.Geometry; namespace Microsoft.Msagl.Routing.Rectilinear.Nudging{ /// /// keeps a list of active overlapping AxisEdges discovered during the sweep /// internal class AxisEdgesContainer:IEnumerable{ readonly Set edges = new Set(); /// /// it is not necessarely the upper point but some point above the source /// internal Point UpPoint; internal void AddEdge(AxisEdge edge){ UpPoint = edge.TargetPoint; Debug.Assert(edges.Contains(edge)==false); edges.Insert(edge); } internal AxisEdgesContainer(Point source){ Source = source; } public Point Source { get; set; } /// /// Returns an enumerator that iterates through the collection. /// /// /// A that can be used to iterate through the collection. /// /// 1 public IEnumerator GetEnumerator(){ return edges.GetEnumerator(); } /// /// Returns an enumerator that iterates through a collection. /// /// /// An object that can be used to iterate through the collection. /// /// 2 IEnumerator IEnumerable.GetEnumerator(){ return GetEnumerator(); } internal void RemoveAxis(AxisEdge edge){ Debug.Assert(edges.Contains(edge)); edges.Remove(edge); } internal bool IsEmpty(){ return edges.Count == 0; } } }