// // NeighborSides.cs // MSAGL class for neighboring sides for scanline operations in Rectilinear Edge Routing. // // Copyright Microsoft Corporation. using Microsoft.Msagl.Core.DataStructures; using Microsoft.Msagl.Core.Geometry; namespace Microsoft.Msagl.Routing.Rectilinear { internal partial class VisibilityGraphGenerator { /// /// From an OpenVertexEvent or CloseVertexEvent, we search in the high and low direction for neighbors. /// protected class NeighborSides { /// /// The HighObstacleSide of the low neighbor. /// internal RBNode LowNeighbor { get; private set; } /// /// Dereferences the node if non-null to return the side Item. /// internal BasicObstacleSide LowNeighborSide { get { return (null == this.LowNeighbor) ? null : this.LowNeighbor.Item; } } /// /// A LowObstacleSide that we pass through in the low direction into open space. /// internal RBNode LowOverlapEnd { get; private set; } /// /// A group that we pass through toward the low neighbor. Avoids reflections going through group boundaries. /// internal BasicObstacleSide GroupSideInterveningBeforeLowNeighbor { get; private set; } /// /// The LowObstacleSide of the high neighbor. /// internal RBNode HighNeighbor { get; private set; } /// /// Dereferences the node if non-null to return the side Item. /// internal BasicObstacleSide HighNeighborSide { get { return (null == this.HighNeighbor) ? null : this.HighNeighbor.Item; } } /// /// A HighObstacleSide that we pass through in the high direction into open space. /// internal RBNode HighOverlapEnd { get; private set; } /// /// A group that we pass through toward the high neighbor. Avoids reflections going through group boundaries. /// internal BasicObstacleSide GroupSideInterveningBeforeHighNeighbor { get; private set; } internal void Clear() { this.LowNeighbor = null; this.LowOverlapEnd = null; this.GroupSideInterveningBeforeLowNeighbor = null; this.HighNeighbor = null; this.HighOverlapEnd = null; this.GroupSideInterveningBeforeHighNeighbor = null; } internal void SetSides(Directions dir, RBNode neighborNode, RBNode overlapEndNode, BasicObstacleSide interveningGroupSide) { if (StaticGraphUtility.IsAscending(dir)) { HighNeighbor = neighborNode; HighOverlapEnd = overlapEndNode; this.GroupSideInterveningBeforeHighNeighbor = interveningGroupSide; return; } LowNeighbor = neighborNode; LowOverlapEnd = overlapEndNode; this.GroupSideInterveningBeforeLowNeighbor = interveningGroupSide; } } } }