Display filling level

This commit is contained in:
2026-07-15 13:59:22 +02:00
parent 4c9da5c9d5
commit b8ac414673
10 changed files with 128 additions and 47 deletions
@@ -47,14 +47,14 @@ namespace PamhagenSysCtrl.Windows {
Graph.AddPath(path);
_lastSource = null;
}
} else if (c is ISource source) {
_lastSource = source;
_path = [];
} else if (_lastSource != null) {
var path = Graph.GetPath([_lastSource, .. _path, c], (n) => n is not ISink && (n is not Valve v || !v.IsLocked));
if (path != null) {
_path.Add(c);
}
} else if (c is ISource source) {
_lastSource = source;
_path = [];
} else {
_lastSource = null;
}
@@ -67,7 +67,7 @@ namespace PamhagenSysCtrl.Windows {
e.Highlight = null;
}
foreach (var p in Graph.SelectedPaths) {
Graph.ColorPipesAdjacientToPath(p, Brushes.Green, Brushes.Orange);
Graph.ColorPipesAdjacientToPath(p, PamhagenBrushes.Green, PamhagenBrushes.DimOrange);
}
var hover = Graph.GetHover(pos.X, pos.Y);
if (_lastSource != null && (hover.Count > 0 || _path.Count > 0)) {
@@ -78,16 +78,16 @@ namespace PamhagenSysCtrl.Windows {
if (points.Count >= 2) {
var res = Graph.GetPath(points, (n) => n is not ISink && (n is not Valve v || !v.IsLocked));
if (res is Path path) {
Graph.ColorPipesAdjacientToPath(path, Brushes.Green, Brushes.Orange);
Graph.ColorPipesAdjacientToPath(path, PamhagenBrushes.Green, PamhagenBrushes.DimOrange);
}
}
} else if (_lastSource == null && hover.Count > 0 && Graph.SelectedPaths.Any(p => p.Start == hover.First())) {
var path = Graph.SelectedPaths.First(p => p.Start == hover.First());
Graph.ColorPipesAdjacientToPath(path, Brushes.Red, null);
Graph.ColorPipesAdjacientToPath(path, PamhagenBrushes.Red, null);
}
if (_lastSource != null) {
foreach (var edge in _lastSource.Outputs) {
edge.Highlight = Brushes.Green;
edge.Highlight = PamhagenBrushes.Green;
}
}
Graph.Update(hover, down);