public static ICoordinate GetFirstPoint(this RoutingNetwork graph, RoutingEdge edge, uint vertex) { List <ICoordinate> coordinateList = new List <ICoordinate>(); if ((int)edge.From == (int)vertex) { if (edge.Shape == null) { return((ICoordinate)graph.GetVertex(edge.To)); } IEnumerator <ICoordinate> enumerator = edge.Shape.GetEnumerator(); enumerator.MoveNext(); return(enumerator.Current); } if ((int)edge.To == (int)vertex) { if (edge.Shape == null) { return((ICoordinate)graph.GetVertex(edge.From)); } IEnumerator <ICoordinate> enumerator = edge.Shape.Reverse().GetEnumerator(); enumerator.MoveNext(); return(enumerator.Current); } throw new ArgumentOutOfRangeException(string.Format("Vertex {0} is not part of edge {1}.", new object[2] { (object)vertex, (object)edge.Id })); }
public static uint GetOther(this RoutingEdge edge, uint vertex) { if ((int)edge.From == (int)vertex) { return(edge.To); } if ((int)edge.To == (int)vertex) { return(edge.From); } throw new ArgumentOutOfRangeException(string.Format("Vertex {0} is not part of edge {1}.", new object[2] { (object)vertex, (object)edge.Id })); }
public static List <ICoordinate> GetShape(this RoutingNetwork graph, RoutingEdge edge) { List <ICoordinate> coordinateList = new List <ICoordinate>(); coordinateList.Add((ICoordinate)graph.GetVertex(edge.From)); ShapeBase shapeBase = edge.Shape; if (shapeBase != null) { if (edge.DataInverted) { shapeBase = shapeBase.Reverse(); } IEnumerator <ICoordinate> enumerator = shapeBase.GetEnumerator(); enumerator.Reset(); while (enumerator.MoveNext()) { coordinateList.Add(enumerator.Current); } } coordinateList.Add((ICoordinate)graph.GetVertex(edge.To)); return(coordinateList); }