示例#1
0
 /// <summary>
 /// Returns a directed version of the edge-id. Smaller than 0 if inverted, as-is if not inverted.
 /// </summary>
 /// <remarks>
 /// The relationship between a regular edge id and a directed edge id:
 /// - 0 -> 1 forward, -1 backward.
 /// - all other id's are offset by 1 and postive when forward, negative when backward.
 /// </remarks>
 public static long IdDirected(this RoutingNetwork.EdgeEnumerator edge)
 {
     if (edge.DataInverted)
     {
         return(-(edge.Id + 1));
     }
     return(edge.Id + 1);
 }
示例#2
0
 /// <summary>
 /// Creates a new edge keeping the current state of the given enumerator.
 /// </summary>
 internal RoutingEdge(RoutingNetwork.EdgeEnumerator enumerator)
 {
     this.Id           = enumerator.Id;
     this.To           = enumerator.To;
     this.From         = enumerator.From;
     this.Data         = enumerator.Data;
     this.DataInverted = enumerator.DataInverted;
     this.Shape        = enumerator.Shape;
 }
示例#3
0
        /// <summary>
        /// Moves to the given directed edge-id.
        /// </summary>
        public static void MoveToEdge(this RoutingNetwork.EdgeEnumerator enumerator, long directedEdgeId)
        {
            if (directedEdgeId == 0)
            {
                throw new ArgumentOutOfRangeException("directedEdgeId");
            }

            uint edgeId;

            if (directedEdgeId > 0)
            {
                edgeId = (uint)directedEdgeId - 1;
            }
            else
            {
                edgeId = (uint)((-directedEdgeId) - 1);
            }
            enumerator.MoveToEdge(edgeId);
        }
示例#4
0
 /// <summary>
 /// Returns a directed version of the edge-id. Smaller than 0 if inverted, as-is if not inverted.
 /// </summary>
 /// <remarks>
 /// The relationship between a regular edge id and a directed edge id:
 /// - 0 -> 1 forward, -1 backward.
 /// - all other id's are offset by 1 and postive when forward, negative when backward.
 /// </remarks>
 public static DirectedEdgeId DirectedEdgeId(this RoutingNetwork.EdgeEnumerator enumerator)
 {
     return(new DirectedEdgeId(enumerator.Id, !enumerator.DataInverted));
 }