Schematic drawing with live function, bench control by mouse, Dijkstra algo, vacuum, etc.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace SchematicDrawing
|
||||
{
|
||||
public class GEdge
|
||||
{
|
||||
public readonly GNode StartNode;
|
||||
public readonly GNode EndNode;
|
||||
public readonly int DefaultDist;
|
||||
public readonly RouteCouple RouteCouple;
|
||||
|
||||
public int Dist;
|
||||
|
||||
public GEdge(GNode startNode, GNode endNode, int defaultDist, RouteCouple routeCouple)
|
||||
{
|
||||
StartNode = startNode;
|
||||
EndNode = endNode;
|
||||
DefaultDist = defaultDist;
|
||||
RouteCouple = routeCouple;
|
||||
|
||||
Dist = (routeCouple == RouteCouple.None || routeCouple == RouteCouple.ClosedWhen1) ? DefaultDist : int.MaxValue;
|
||||
}
|
||||
|
||||
public void UpdateFromRoute(bool routeBit)
|
||||
{
|
||||
switch (RouteCouple)
|
||||
{
|
||||
case RouteCouple.OpenWhen1:
|
||||
Dist = routeBit ? DefaultDist : int.MaxValue; break;
|
||||
case RouteCouple.ClosedWhen1:
|
||||
Dist = routeBit ? int.MaxValue : DefaultDist; break;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}/{1}-{2}/{3} dist={4}", StartNode.Item.Name, StartNode.NodeId, EndNode.Item.Name, EndNode.NodeId, Dist);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user