Add Tanks 1-5

This commit is contained in:
2026-07-13 10:49:07 +02:00
parent aece4e202e
commit 011f90233c
7 changed files with 226 additions and 37 deletions
+15 -2
View File
@@ -22,6 +22,16 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
return p;
}
public Inlet CreateInlet(INode start, ISink end) {
Nodes.Add(start);
Nodes.Add(end);
var p = new Inlet(start, end, start.CenterX > end.CenterX);
start.Outputs.Add(p);
end.Inputs.Add(p);
Edges.Add(p);
return p;
}
public Path? GetPath(INode start, INode end, Func<INode, bool>? valid = null) {
if (!Nodes.Contains(start) || !Nodes.Contains(end)) throw new ArgumentException("Start/end node not contained in graph");
valid ??= a => true;
@@ -35,8 +45,11 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
}
var p = GetPath(o.End, end, valid);
if (p != null && (path == null || p.Value.Hops.Count() + 1 < path.Value.Hops.Count())) {
path = new(start, [(o, o.End), ..p.Value.Hops]);
if (p != null) {
var p2 = new Path(start, [(o, o.End), .. p.Value.Hops]);
if (path == null || p2.Length < path.Value.Length) {
path = p2;
}
}
}
return path != null ? new(start, path.Value.Hops) : null;