Indicate Valve status with top/bottom lines
Test / Run tests (push) Successful in 16s

This commit is contained in:
2026-10-13 15:31:40 +02:00
parent 49bdd5d4c0
commit c3f4acaf07
3 changed files with 21 additions and 0 deletions
@@ -39,6 +39,13 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
IsLocked && WantOpen && IsOpen ? PamhagenBrushes.Green : IsLocked && WantOpen && IsOpen ? PamhagenBrushes.Green :
Highlight ?? (isHovering ? Brushes.LightGray : Brushes.DarkGray); Highlight ?? (isHovering ? Brushes.LightGray : Brushes.DarkGray);
} }
if (IsOpen) {
_topLine?.Points[1] = _middlePoints.Open.Top;
_bottomLine?.Points[1] = _middlePoints.Open.Bottom;
} else {
_topLine?.Points[1] = _middlePoints.Closed.Top;
_bottomLine?.Points[1] = _middlePoints.Closed.Bottom;
}
} }
} }
} }
@@ -17,6 +17,13 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
!IsOpen ? PamhagenBrushes.Red : !IsOpen ? PamhagenBrushes.Red :
IsOpen ? PamhagenBrushes.Green : IsOpen ? PamhagenBrushes.Green :
Highlight ?? Brushes.DarkGray; Highlight ?? Brushes.DarkGray;
if (IsOpen) {
_topLine?.Points[1] = _middlePoints.Open.Top;
_bottomLine?.Points[1] = _middlePoints.Open.Bottom;
} else {
_topLine?.Points[1] = _middlePoints.Closed.Top;
_bottomLine?.Points[1] = _middlePoints.Closed.Bottom;
}
} }
} }
} }
@@ -26,6 +26,7 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
protected Polygon? _triangles; protected Polygon? _triangles;
protected Polyline? _topLine; protected Polyline? _topLine;
protected Polyline? _bottomLine; protected Polyline? _bottomLine;
protected ((Point Top, Point Bottom) Closed, (Point Top, Point Bottom) Open) _middlePoints;
protected TextBlock? _text; protected TextBlock? _text;
public Valve(double x, double y, int orientation, Func<bool> cbOpen) { public Valve(double x, double y, int orientation, Func<bool> cbOpen) {
@@ -83,6 +84,9 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
Graph.ToPx(CenterX + WIDTH / 4, CenterY, scale), Graph.ToPx(CenterX + WIDTH / 4, CenterY, scale),
Graph.ToPx(CenterX + WIDTH / 2, CenterY + LENGTH / 4, scale), Graph.ToPx(CenterX + WIDTH / 2, CenterY + LENGTH / 4, scale),
]; ];
if (_topLine != null && _bottomLine != null)
_middlePoints = ((_topLine.Points[1], _bottomLine.Points[1]),
(Graph.ToPx(CenterX - WIDTH / 3, CenterY, scale), Graph.ToPx(CenterX + WIDTH / 3, CenterY, scale)));
} else { } else {
Graph.SetCenter(_background, CenterX, CenterY, LENGTH, LENGTH / 2, scale); Graph.SetCenter(_background, CenterX, CenterY, LENGTH, LENGTH / 2, scale);
_triangles?.Points = [ _triangles?.Points = [
@@ -101,6 +105,9 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
Graph.ToPx(CenterX, CenterY + WIDTH / 4, scale), Graph.ToPx(CenterX, CenterY + WIDTH / 4, scale),
Graph.ToPx(CenterX + LENGTH / 4, CenterY + WIDTH / 2, scale), Graph.ToPx(CenterX + LENGTH / 4, CenterY + WIDTH / 2, scale),
]; ];
if (_topLine != null && _bottomLine != null)
_middlePoints = ((_topLine.Points[1], _bottomLine.Points[1]),
(Graph.ToPx(CenterX, CenterY - WIDTH / 3, scale), Graph.ToPx(CenterX, CenterY + WIDTH / 3, scale)));
} }
_triangles?.StrokeThickness = border; _triangles?.StrokeThickness = border;
_topLine?.StrokeThickness = border; _topLine?.StrokeThickness = border;