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
@@ -5,8 +5,9 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PamhagenSysCtrl.Windows"
Title="Schema - Anlagensteuerung Pamhagen" Height="800" Width="1600" MinWidth="1500" MinHeight="800">
<Grid MouseMove="SchemeCanvas_MouseMove" MouseLeftButtonDown="SchemeCanvas_MouseLeftButtonDown" MouseLeftButtonUp="SchemeCanvas_MouseLeftButtonUp">
<Canvas x:Name="SchemeCanvas" Width="1550" Height="750" VerticalAlignment="Center" HorizontalAlignment="Center" SnapsToDevicePixels="True">
<Grid>
<Canvas x:Name="SchemeCanvas" Width="1550" Height="750" VerticalAlignment="Center" HorizontalAlignment="Center" SnapsToDevicePixels="True"
MouseMove="SchemeCanvas_MouseMove" MouseLeftButtonDown="SchemeCanvas_MouseLeftButtonDown" MouseLeftButtonUp="SchemeCanvas_MouseLeftButtonUp">
</Canvas>
</Grid>
</Window>
@@ -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);