@@ -54,6 +54,14 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
return p;
|
||||
}
|
||||
|
||||
public Path? GetFreePath(IEnumerable<INode> points, bool overrideStart = false) {
|
||||
if (overrideStart) {
|
||||
return GetPath(points, (n) => n is not ISink && (n is not Valve v || !v.LockedForPaths.Any(p => p.Start != points.First())));
|
||||
} else {
|
||||
return GetPath(points, (n) => n is not ISink && (n is not Valve v || !v.IsLocked));
|
||||
}
|
||||
}
|
||||
|
||||
public Path? GetPath(IEnumerable<INode> points, Func<INode, bool>? valid = null) {
|
||||
if (points.Count() < 2) return null;
|
||||
var start = points.First();
|
||||
|
||||
@@ -14,7 +14,9 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
public string Label => $"V{Nr}";
|
||||
public Brush? Highlight { get; set; }
|
||||
|
||||
public bool IsLocked { get; set; }
|
||||
public readonly ISet<Path> LockedForPaths = new HashSet<Path>();
|
||||
|
||||
public bool IsLocked => LockedForPaths.Any();
|
||||
public bool IsOpen => CallbackIsOpen();
|
||||
public bool WantOpen => CallbackWantOpen(this);
|
||||
public ISet<IEdge> Inputs { get; init; }
|
||||
|
||||
Reference in New Issue
Block a user