Add clearance logic to PamhagenPlant

This commit is contained in:
2026-08-04 15:30:08 +02:00
parent 0d65e419b9
commit 7b95cf4221
10 changed files with 459 additions and 94 deletions
+16 -11
View File
@@ -16,11 +16,12 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
public ISet<IEdge> Inputs { get; init; }
public ISet<IEdge> Outputs { get; init; }
public bool IsActive {
get => _active;
public bool IsActive => CallbackActive();
public bool IsAnimationActive {
get => _animationActive;
set {
_active = value;
_auger?.IsActive = value;
_animationActive = value;
_auger?.IsAnimationActive = value;
if (value) {
_doorTransform?.BeginAnimation(
RotateTransform.AngleProperty,
@@ -41,7 +42,9 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
}
}
private bool _active;
protected Func<bool> CallbackActive;
private bool _animationActive;
private Shape? _inner;
private Shape? _outer;
private TextBlock? _text;
@@ -49,10 +52,11 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
private Shape? _door;
private RotateTransform? _doorTransform;
public EntryTrough(string label, double x, double y) {
public EntryTrough(string label, double x, double y, Func<bool> cbActive) {
CenterX = x;
CenterY = y;
Label = label;
CallbackActive = cbActive;
Inputs = new HashSet<IEdge>();
Outputs = new HashSet<IEdge>();
}
@@ -99,12 +103,13 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
}
public void Update(bool isHovering, bool isPressed) {
IsAnimationActive = IsActive;
_inner?.Fill =
IsActive && isHovering && isPressed ? PamhagenBrushes.Red :
IsActive && isHovering ? PamhagenBrushes.Red :
!IsActive && isHovering && isPressed ? PamhagenBrushes.Green :
!IsActive && isHovering ? PamhagenBrushes.Green :
IsActive ? PamhagenBrushes.Green :
IsAnimationActive && isHovering && isPressed ? PamhagenBrushes.Red :
IsAnimationActive && isHovering ? PamhagenBrushes.Red :
!IsAnimationActive && isHovering && isPressed ? PamhagenBrushes.Green :
!IsAnimationActive && isHovering ? PamhagenBrushes.Green :
IsAnimationActive ? PamhagenBrushes.Green :
Brushes.WhiteSmoke;
}
}