Schematic drawing with live function, bench control by mouse, Dijkstra algo, vacuum, etc.

This commit is contained in:
Milan Hanajik
2020-06-14 13:01:53 +02:00
parent 2945049288
commit 1f67899a5c
223 changed files with 5684 additions and 3772 deletions
+43
View File
@@ -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);
}
}
}