Compare commits
6
Commits
dev
..
90f9ad8c79
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90f9ad8c79 | ||
|
|
75c1095140 | ||
|
|
f65bb8b8cb | ||
|
|
4071cc2f2c | ||
|
|
82d7a5b626 | ||
|
|
00100a7dc2 |
No files matched your search
@@ -512,6 +512,7 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
HashSet<IEdge> visited = [];
|
||||
foreach (var (edge, node) in path.Hops) {
|
||||
edge.Highlight = color1;
|
||||
(edge.Start as PipeJoin)?.Highlight = color1;
|
||||
if (flowArrows > MotorState.Halt) {
|
||||
var dir = edge.End == node;
|
||||
if (flowArrows == MotorState.Backward) dir = !dir;
|
||||
@@ -520,7 +521,10 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
}
|
||||
visited.Add(edge);
|
||||
if (node is Pump) color = color2;
|
||||
TraverseSubgraph(node, (n) => n is Valve || n is ISink || n is Pump, visited, edgeAction: (s, r, e) => e.Highlight = color);
|
||||
TraverseSubgraph(node, (n) => n is Valve || n is ISink || n is Pump, visited, edgeAction: (s, r, e) => {
|
||||
(s as PipeJoin)?.Highlight = color;
|
||||
e.Highlight = color;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,6 +534,8 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
edgeAction: (s, r, e) => {
|
||||
if (((e.Start as Valve)?.IsOpen ?? true) && ((e.End as Valve)?.IsOpen ?? true)) {
|
||||
e.Highlight = color1;
|
||||
(e.Start as PipeJoin)?.Highlight = color1;
|
||||
(e.End as PipeJoin)?.Highlight = color1;
|
||||
if (flowArrows == MotorState.Forward || flowArrows == MotorState.Backward) {
|
||||
var dir = e.Start == s;
|
||||
if (r) dir = !dir;
|
||||
|
||||
@@ -1,32 +1,12 @@
|
||||
using PamhagenSysCtrl.Helpers.Pipeline;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace PamhagenSysCtrl.Helpers {
|
||||
public class PamhagenPlant : IDisposable {
|
||||
|
||||
public enum Xbe24Key {
|
||||
START_REBLER = 6, STOP_REBLER = 7,
|
||||
START_TROUGH_AUGER = 12, STOP_TROUGH_AUGER = 13,
|
||||
SELECT_MW1 = 14, SELECT_MW2 = 8,
|
||||
STIRRER_MW1 = 15, STIRRER_MW2 = 9,
|
||||
START_MP1 = 16, STOP_MP1 = 17,
|
||||
START_MP2 = 10, STOP_MP2 = 11,
|
||||
FAST_SELECT_MW1_1 = 18,
|
||||
FAST_SELECT_MW1_2 = 19,
|
||||
FAST_SELECT_MW1_3 = 20,
|
||||
FAST_SELECT_MW1_4 = 21,
|
||||
FAST_SELECT_MW1_5 = 22,
|
||||
FAST_SELECT_MW1_6 = 23,
|
||||
FAST_SELECT_MW2_1 = 0,
|
||||
FAST_SELECT_MW2_2 = 1,
|
||||
FAST_SELECT_MW2_3 = 2,
|
||||
FAST_SELECT_MW2_4 = 3,
|
||||
FAST_SELECT_MW2_5 = 4,
|
||||
FAST_SELECT_MW2_6 = 5,
|
||||
}
|
||||
|
||||
protected PamhagenPlc? Plc;
|
||||
protected Xbe24Keyboard? Keyboard;
|
||||
public PamhagenGraph Graph;
|
||||
@@ -170,28 +150,28 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
protected void UpdateKeyboardBacklights(object? sender, PlantEventArgs evt) {
|
||||
if (sender is not PamhagenPlant plant || plant.Keyboard is not Xbe24Keyboard k) return;
|
||||
|
||||
k.SetBacklight((int)Xbe24Key.START_REBLER, plant.IsReblerActive ? Color.FromRgb(0, 255, 0) : plant.IsAuger1Active ? Color.FromRgb(255, 255, 0) : plant.IsAuger2Active || plant.IsAuger3Active ? Color.FromRgb(32, 32, 4) : Color.FromRgb(4, 32, 4));
|
||||
k.SetBacklight((int)Xbe24Key.STOP_REBLER, !plant.IsReblerActive ? Color.FromRgb(255, 0, 0) : Color.FromRgb(32, 4, 4));
|
||||
k.SetBacklight(0, plant.IsReblerActive ? Color.FromRgb(0, 255, 0) : plant.IsAuger1Active ? Color.FromRgb(255, 255, 0) : plant.IsAuger2Active || plant.IsAuger3Active ? Color.FromRgb(32, 32, 4) : Color.FromRgb(4, 32, 4));
|
||||
k.SetBacklight(1, !plant.IsReblerActive ? Color.FromRgb(255, 0, 0) : Color.FromRgb(32, 4, 4));
|
||||
|
||||
k.SetBacklight((int)Xbe24Key.START_TROUGH_AUGER, !plant.TroughAugerHasClearance ? k.IsKeyPressed((int)Xbe24Key.START_TROUGH_AUGER) ? Color.FromRgb(255, 32, 0) : Color.FromRgb(32, 4, 4) : plant.IsTroughAugerActive ? Color.FromRgb(0, 255, 0) : Color.FromRgb(4, 32, 4));
|
||||
k.SetBacklight((int)Xbe24Key.STOP_TROUGH_AUGER, !plant.IsTroughAugerActive ? Color.FromRgb(255, 0, 0) : Color.FromRgb(32, 4, 4));
|
||||
k.SetBacklight(6, !plant.TroughAugerHasClearance ? k.IsKeyPressed(6) ? Color.FromRgb(255, 0, 0) : Color.FromRgb(32, 4, 4) : plant.IsTroughAugerActive ? Color.FromRgb(0, 255, 0) : Color.FromRgb(4, 32, 4));
|
||||
k.SetBacklight(7, !plant.IsTroughAugerActive ? Color.FromRgb(255, 0, 0) : Color.FromRgb(32, 4, 4));
|
||||
|
||||
k.SetBacklight((int)Xbe24Key.SELECT_MW2, plant.WantMW2Selected || plant.IsMW2Selected ? Color.FromRgb(0, 0, 255) : Color.FromRgb(4, 4, 16), plant.WantMW2Selected && !plant.IsMW2Selected);
|
||||
k.SetBacklight((int)Xbe24Key.SELECT_MW1, plant.WantMW1Selected || plant.IsMW1Selected ? Color.FromRgb(0, 0, 255) : Color.FromRgb(4, 4, 16), plant.WantMW1Selected && !plant.IsMW1Selected);
|
||||
k.SetBacklight(2, plant.WantMW2Selected || plant.IsMW2Selected ? Color.FromRgb(0, 0, 255) : Color.FromRgb(4, 4, 16), plant.WantMW2Selected && !plant.IsMW2Selected);
|
||||
k.SetBacklight(8, plant.WantMW1Selected || plant.IsMW1Selected ? Color.FromRgb(0, 0, 255) : Color.FromRgb(4, 4, 16), plant.WantMW1Selected && !plant.IsMW1Selected);
|
||||
|
||||
var buttons = new Dictionary<Xbe24Key, (ISource Source, Pump Pump, ISink Sink)> {
|
||||
[Xbe24Key.FAST_SELECT_MW1_1] = (Graph.MW1, Graph.MP1, Graph.Press1),
|
||||
[Xbe24Key.FAST_SELECT_MW2_1] = (Graph.MW2, Graph.MP2, Graph.Press1),
|
||||
[Xbe24Key.FAST_SELECT_MW1_2] = (Graph.MW1, Graph.MP1, Graph.Press2),
|
||||
[Xbe24Key.FAST_SELECT_MW2_2] = (Graph.MW2, Graph.MP2, Graph.Press2),
|
||||
[Xbe24Key.FAST_SELECT_MW1_3] = (Graph.MW1, Graph.MP1, Graph.Tank1),
|
||||
[Xbe24Key.FAST_SELECT_MW2_3] = (Graph.MW2, Graph.MP2, Graph.Tank1),
|
||||
[Xbe24Key.FAST_SELECT_MW1_4] = (Graph.MW1, Graph.MP1, Graph.Tank2),
|
||||
[Xbe24Key.FAST_SELECT_MW2_4] = (Graph.MW2, Graph.MP2, Graph.Tank2),
|
||||
[Xbe24Key.FAST_SELECT_MW1_5] = (Graph.MW1, Graph.MP1, Graph.Tank3),
|
||||
[Xbe24Key.FAST_SELECT_MW2_5] = (Graph.MW2, Graph.MP2, Graph.Tank3),
|
||||
[Xbe24Key.FAST_SELECT_MW1_6] = (Graph.MW1, Graph.MP1, Graph.Tank4),
|
||||
[Xbe24Key.FAST_SELECT_MW2_6] = (Graph.MW2, Graph.MP2, Graph.Tank4),
|
||||
var buttons = new Dictionary<int, (ISource Source, Pump Pump, ISink Sink)> {
|
||||
[12] = (Graph.MW1, Graph.MP1, Graph.Press1),
|
||||
[18] = (Graph.MW2, Graph.MP2, Graph.Press1),
|
||||
[13] = (Graph.MW1, Graph.MP1, Graph.Press2),
|
||||
[19] = (Graph.MW2, Graph.MP2, Graph.Press2),
|
||||
[14] = (Graph.MW1, Graph.MP1, Graph.Tank1),
|
||||
[20] = (Graph.MW2, Graph.MP2, Graph.Tank1),
|
||||
[15] = (Graph.MW1, Graph.MP1, Graph.Tank2),
|
||||
[21] = (Graph.MW2, Graph.MP2, Graph.Tank2),
|
||||
[16] = (Graph.MW1, Graph.MP1, Graph.Tank3),
|
||||
[22] = (Graph.MW2, Graph.MP2, Graph.Tank3),
|
||||
[17] = (Graph.MW1, Graph.MP1, Graph.Tank4),
|
||||
[23] = (Graph.MW2, Graph.MP2, Graph.Tank4),
|
||||
};
|
||||
|
||||
bool preparingMP1 = false, preparingMP2 = false;
|
||||
@@ -204,27 +184,27 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
if (!isReady && d.Pump == Graph.MP1) preparingMP1 = true;
|
||||
if (!isReady && d.Pump == Graph.MP2) preparingMP2 = true;
|
||||
var isDefault = !path.Hops.SkipLast(1).Any(h => h.Node is not Valve && h.Node is not PipeJoin && h.Node is not Pump);
|
||||
k.SetBacklight((int)idx, isRunning ? isDefault ? Color.FromRgb(0, 255, 255) : Color.FromRgb(255, 64, 255) : isDefault ? Color.FromRgb(0, 0, 255) : Color.FromRgb(128, 0, 128), !isReady);
|
||||
k.SetBacklight(idx, isRunning ? isDefault ? Color.FromRgb(0, 255, 255) : Color.FromRgb(255, 64, 255) : isDefault ? Color.FromRgb(0, 0, 255) : Color.FromRgb(128, 0, 128), !isReady);
|
||||
} else {
|
||||
var isFree = Graph.GetFreePath([d.Source, d.Sink], overrideStart: true) != null;
|
||||
if (isRunning && k.IsKeyPressed((int)idx) && d.Pump == Graph.MP1) highlightOffMP1 = true;
|
||||
if (isRunning && k.IsKeyPressed((int)idx) && d.Pump == Graph.MP2) highlightOffMP2 = true;
|
||||
k.SetBacklight((int)idx, isRunning ? k.IsKeyPressed((int)idx) ? Color.FromRgb(255, 16, 0) : Color.FromRgb(4, 4, 4) : isFree ? Color.FromRgb(8, 8, 32) : k.IsKeyPressed((int)idx) ? Color.FromRgb(255, 32, 0) : Color.FromRgb(4, 4, 4));
|
||||
if (isRunning && k.IsKeyPressed(idx) && d.Pump == Graph.MP1) highlightOffMP1 = true;
|
||||
if (isRunning && k.IsKeyPressed(idx) && d.Pump == Graph.MP2) highlightOffMP2 = true;
|
||||
k.SetBacklight(idx, isRunning ? k.IsKeyPressed(idx) ? Color.FromRgb(255, 0, 0) : Color.FromRgb(4, 4, 4) : isFree ? Color.FromRgb(8, 8, 32) : k.IsKeyPressed(idx) ? Color.FromRgb(255, 0, 0) : Color.FromRgb(4, 4, 4));
|
||||
}
|
||||
}
|
||||
|
||||
if (!plant.MP2HasPathClearance && plant.MP2HasDryRunClearance && preparingMP2) {
|
||||
k.SetBacklight((int)Xbe24Key.START_MP2, Color.FromRgb(4, 32, 4), true);
|
||||
k.SetBacklight(4, Color.FromRgb(4, 32, 4), true);
|
||||
} else {
|
||||
k.SetBacklight((int)Xbe24Key.START_MP2, !plant.MP2HasClearance ? k.IsKeyPressed((int)Xbe24Key.START_MP2) ? Color.FromRgb(255, 32, 0) : Color.FromRgb(32, 4, 4) : plant.IsMP2Active ? Color.FromRgb(0, 255, 0) : Color.FromRgb(4, 32, 4));
|
||||
k.SetBacklight(4, !plant.MP2HasClearance ? k.IsKeyPressed(4) ? Color.FromRgb(255, 0, 0) : Color.FromRgb(32, 4, 4) : plant.IsMP2Active ? Color.FromRgb(0, 255, 0) : Color.FromRgb(4, 32, 4));
|
||||
}
|
||||
if (!plant.MP1HasPathClearance && plant.MP1HasDryRunClearance && preparingMP1) {
|
||||
k.SetBacklight((int)Xbe24Key.START_MP1, Color.FromRgb(4, 32, 4), true);
|
||||
k.SetBacklight(10, Color.FromRgb(4, 32, 4), true);
|
||||
} else {
|
||||
k.SetBacklight((int)Xbe24Key.START_MP1, !plant.MP1HasClearance ? k.IsKeyPressed((int)Xbe24Key.START_MP1) ? Color.FromRgb(255, 32, 0) : Color.FromRgb(32, 4, 4) : plant.IsMP1Active ? Color.FromRgb(0, 255, 0) : Color.FromRgb(4, 32, 4));
|
||||
k.SetBacklight(10, !plant.MP1HasClearance ? k.IsKeyPressed(10) ? Color.FromRgb(255, 0, 0) : Color.FromRgb(32, 4, 4) : plant.IsMP1Active ? Color.FromRgb(0, 255, 0) : Color.FromRgb(4, 32, 4));
|
||||
}
|
||||
k.SetBacklight((int)Xbe24Key.STOP_MP2, highlightOffMP2 ? Color.FromRgb(255, 32, 0) : !plant.IsMP2Active ? Color.FromRgb(255, 0, 0) : Color.FromRgb(32, 4, 4));
|
||||
k.SetBacklight((int)Xbe24Key.STOP_MP1, highlightOffMP1 ? Color.FromRgb(255, 32, 0) : !plant.IsMP1Active ? Color.FromRgb(255, 0, 0) : Color.FromRgb(32, 4, 4));
|
||||
k.SetBacklight(5, highlightOffMP2 ? Color.FromRgb(255, 64, 0) : !plant.IsMP2Active ? Color.FromRgb(255, 0, 0) : Color.FromRgb(32, 4, 4));
|
||||
k.SetBacklight(11, highlightOffMP1 ? Color.FromRgb(255, 64, 0) : !plant.IsMP1Active ? Color.FromRgb(255, 0, 0) : Color.FromRgb(32, 4, 4));
|
||||
}
|
||||
|
||||
public async Task StartThread() {
|
||||
@@ -319,12 +299,11 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
}
|
||||
|
||||
private void Keyboard_KeyDown(object? sender, int keyIndex) {
|
||||
var key = (Xbe24Key)keyIndex;
|
||||
App.MainDispatcher?.BeginInvoke(() => {
|
||||
try {
|
||||
if (key == Xbe24Key.START_REBLER) {
|
||||
if (keyIndex == 0) {
|
||||
StartRebler();
|
||||
} else if (key == Xbe24Key.STOP_REBLER) {
|
||||
} else if (keyIndex == 1) {
|
||||
if (IsReblerActive) {
|
||||
StopRebler();
|
||||
} else {
|
||||
@@ -334,45 +313,45 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
StopAuger3();
|
||||
}
|
||||
}
|
||||
} else if (key == Xbe24Key.START_TROUGH_AUGER) {
|
||||
} else if (keyIndex == 6) {
|
||||
StartTroughAuger();
|
||||
} else if (key == Xbe24Key.STOP_TROUGH_AUGER) {
|
||||
} else if (keyIndex == 7) {
|
||||
StopTroughAuger();
|
||||
} else if (key == Xbe24Key.SELECT_MW2) {
|
||||
} else if (keyIndex == 2) {
|
||||
SelectMW2();
|
||||
} else if (key == Xbe24Key.SELECT_MW1) {
|
||||
} else if (keyIndex == 8) {
|
||||
SelectMW1();
|
||||
} else if (key == Xbe24Key.START_MP2) {
|
||||
} else if (keyIndex == 4) {
|
||||
StartMP2Forward();
|
||||
} else if (key == Xbe24Key.STOP_MP2) {
|
||||
} else if (keyIndex == 5) {
|
||||
StopMP2();
|
||||
} else if (key == Xbe24Key.START_MP1) {
|
||||
} else if (keyIndex == 10) {
|
||||
StartMP1Forward();
|
||||
} else if (key == Xbe24Key.STOP_MP1) {
|
||||
} else if (keyIndex == 11) {
|
||||
StopMP1();
|
||||
} else if (key == Xbe24Key.FAST_SELECT_MW1_1) {
|
||||
} else if (keyIndex == 12) {
|
||||
FastSelect(Graph.MW1, Graph.Press1);
|
||||
} else if (key == Xbe24Key.FAST_SELECT_MW1_2) {
|
||||
} else if (keyIndex == 13) {
|
||||
FastSelect(Graph.MW1, Graph.Press2);
|
||||
} else if (key == Xbe24Key.FAST_SELECT_MW1_3) {
|
||||
} else if (keyIndex == 14) {
|
||||
FastSelect(Graph.MW1, Graph.Tank1);
|
||||
} else if (key == Xbe24Key.FAST_SELECT_MW1_4) {
|
||||
} else if (keyIndex == 15) {
|
||||
FastSelect(Graph.MW1, Graph.Tank2);
|
||||
} else if (key == Xbe24Key.FAST_SELECT_MW1_5) {
|
||||
} else if (keyIndex == 16) {
|
||||
FastSelect(Graph.MW1, Graph.Tank3);
|
||||
} else if (key == Xbe24Key.FAST_SELECT_MW1_6) {
|
||||
} else if (keyIndex == 17) {
|
||||
FastSelect(Graph.MW1, Graph.Tank4);
|
||||
} else if (key == Xbe24Key.FAST_SELECT_MW2_1) {
|
||||
} else if (keyIndex == 18) {
|
||||
FastSelect(Graph.MW2, Graph.Press1);
|
||||
} else if (key == Xbe24Key.FAST_SELECT_MW2_2) {
|
||||
} else if (keyIndex == 19) {
|
||||
FastSelect(Graph.MW2, Graph.Press2);
|
||||
} else if (key == Xbe24Key.FAST_SELECT_MW2_3) {
|
||||
} else if (keyIndex == 20) {
|
||||
FastSelect(Graph.MW2, Graph.Tank1);
|
||||
} else if (key == Xbe24Key.FAST_SELECT_MW2_4) {
|
||||
} else if (keyIndex == 21) {
|
||||
FastSelect(Graph.MW2, Graph.Tank2);
|
||||
} else if (key == Xbe24Key.FAST_SELECT_MW2_5) {
|
||||
} else if (keyIndex == 22) {
|
||||
FastSelect(Graph.MW2, Graph.Tank3);
|
||||
} else if (key == Xbe24Key.FAST_SELECT_MW2_6) {
|
||||
} else if (keyIndex == 23) {
|
||||
FastSelect(Graph.MW2, Graph.Tank4);
|
||||
}
|
||||
} catch (NoClearanceException) {
|
||||
@@ -488,7 +467,7 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
}
|
||||
|
||||
public bool MP2HasClearance => MP2HasDryRunClearance && MP2HasPathClearance;
|
||||
public bool MP2HasDryRunClearance => (OverrideDryRunClearances || FillLevelMW2 != FillState.Empty);
|
||||
public bool MP2HasDryRunClearance => (OverrideDryRunClearances || FillLevelMW2 != FillState.Empty);
|
||||
public bool MP2HasPathClearance => (
|
||||
OverridePathClearances ||
|
||||
(MP2HasClearancePress1 && Press1HasClearance) ||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
public class PipeJoin : INode {
|
||||
@@ -12,11 +11,12 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
public string Label => "";
|
||||
public Brush? Highlight { get; set; }
|
||||
|
||||
public ISet<IEdge> Inputs { get; init; }
|
||||
public ISet<IEdge> Outputs { get; init; }
|
||||
|
||||
private Polygon? _rect;
|
||||
private System.Windows.Shapes.Path? _rect;
|
||||
|
||||
public PipeJoin(double x, double y) {
|
||||
CenterX = x;
|
||||
@@ -26,8 +26,8 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
}
|
||||
|
||||
public void Draw(Canvas canvas) {
|
||||
_rect = new Polygon() {
|
||||
Fill = Brushes.Black,
|
||||
_rect = new System.Windows.Shapes.Path() {
|
||||
Fill = Brushes.DarkGray,
|
||||
Stroke = Brushes.Black,
|
||||
};
|
||||
canvas.Children.Add(_rect);
|
||||
@@ -43,43 +43,66 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
var il = Inputs.Any(e => (e.Start.CenterX < CenterX && (e.Orientation || e.Start.CenterY == CenterY)) || (e.IsTwoWay && e.End.CenterX < CenterX && (e.Orientation || e.End.CenterY == CenterY)));
|
||||
var ol = Outputs.Any(e => (e.End.CenterX < CenterX && (!e.Orientation || e.End.CenterY == CenterY)) || (e.IsTwoWay && e.Start.CenterX < CenterX && (!e.Orientation || e.Start.CenterY == CenterY)));
|
||||
|
||||
var points = new List<Point> {
|
||||
new(0, 0)
|
||||
};
|
||||
if (ot && it) {
|
||||
points.AddRange([new(SIZE / 2 - POINT, 0), new(SIZE / 2, -POINT / 2), new(SIZE / 2, POINT / 2), new(SIZE / 2 + POINT, 0)]);
|
||||
} else if (ot) {
|
||||
points.AddRange([new(SIZE / 2 - POINT, 0), new(SIZE / 2, -POINT), new(SIZE / 2 + POINT, 0)]);
|
||||
} else if (it) {
|
||||
points.AddRange([new(SIZE / 2 - POINT, 0), new(SIZE / 2, POINT), new(SIZE / 2 + POINT, 0)]);
|
||||
}
|
||||
points.Add(new(SIZE, 0));
|
||||
if (or && ir) {
|
||||
points.AddRange([new(SIZE, SIZE / 2 - POINT), new(SIZE + POINT / 2, SIZE / 2), new(SIZE - POINT / 2, SIZE / 2), new(SIZE, SIZE / 2 + POINT)]);
|
||||
} else if (or) {
|
||||
points.AddRange([new(SIZE, SIZE / 2 - POINT), new(SIZE + POINT, SIZE / 2), new(SIZE, SIZE / 2 + POINT)]);
|
||||
} else if (ir) {
|
||||
points.AddRange([new(SIZE, SIZE / 2 - POINT), new(SIZE - POINT, SIZE / 2), new(SIZE, SIZE / 2 + POINT)]);
|
||||
}
|
||||
points.Add(new(SIZE, SIZE));
|
||||
if (ob && ib) {
|
||||
points.AddRange([new(SIZE / 2 + POINT, SIZE), new(SIZE / 2, SIZE + POINT / 2), new(SIZE / 2, SIZE - POINT / 2), new(SIZE / 2 - POINT, SIZE)]);
|
||||
} else if (ob) {
|
||||
points.AddRange([new(SIZE / 2 + POINT, SIZE), new(SIZE / 2, SIZE + POINT), new(SIZE / 2 - POINT, SIZE)]);
|
||||
} else if (ib) {
|
||||
points.AddRange([new(SIZE / 2 + POINT, SIZE), new(SIZE / 2, SIZE - POINT), new(SIZE / 2 - POINT, SIZE)]);
|
||||
}
|
||||
points.Add(new(0, SIZE));
|
||||
if (ol && il) {
|
||||
points.AddRange([new(0, SIZE / 2 + POINT), new(-POINT / 2, SIZE / 2), new(POINT / 2, SIZE / 2), new(0, SIZE / 2 - POINT)]);
|
||||
} else if (ol) {
|
||||
points.AddRange([new(0, SIZE / 2 + POINT), new(-POINT, SIZE / 2), new(0, SIZE / 2 - POINT)]);
|
||||
} else if (il) {
|
||||
points.AddRange([new(0, SIZE / 2 + POINT), new(POINT, SIZE / 2), new(0, SIZE / 2 - POINT)]);
|
||||
var size = new Size(SIZE / 2 * scale, SIZE / 2 * scale);
|
||||
var geo = new StreamGeometry();
|
||||
using (var ctx = geo.Open()) {
|
||||
var points = new List<Point> {
|
||||
new(0, 0)
|
||||
};
|
||||
|
||||
ctx.BeginFigure(new((SIZE / 2 - POINT) * scale, 0), true, false);
|
||||
if (ot && it) {
|
||||
points.AddRange([new(SIZE / 2, -POINT / 2), new(SIZE / 2, POINT / 2), new(SIZE / 2 + POINT, 0)]);
|
||||
} else if (ot) {
|
||||
ctx.PolyLineTo([new(SIZE / 2 * scale, -POINT * scale), new((SIZE / 2 + POINT) * scale, 0)], true, false);
|
||||
} else if (it) {
|
||||
ctx.PolyLineTo([new(SIZE / 2 * scale, POINT * scale), new((SIZE / 2 + POINT) * scale, 0)], true, false);
|
||||
} else {
|
||||
ctx.ArcTo(new((SIZE / 2 + POINT) * scale, 0), size, 0, false, SweepDirection.Clockwise, true, false);
|
||||
}
|
||||
|
||||
ctx.ArcTo(new(SIZE * scale, (SIZE / 2 - POINT) * scale), size, 0, false, SweepDirection.Clockwise, true, false);
|
||||
points.Add(new(SIZE, 0));
|
||||
if (or && ir) {
|
||||
points.AddRange([new(SIZE, SIZE / 2 - POINT), new(SIZE + POINT / 2, SIZE / 2), new(SIZE - POINT / 2, SIZE / 2), new(SIZE, SIZE / 2 + POINT)]);
|
||||
} else if (or) {
|
||||
ctx.PolyLineTo([new((SIZE + POINT) * scale, SIZE / 2 * scale), new(SIZE * scale, (SIZE / 2 + POINT) * scale)], true, false);
|
||||
} else if (ir) {
|
||||
ctx.PolyLineTo([new((SIZE - POINT) * scale, SIZE / 2 * scale), new(SIZE * scale, (SIZE / 2 + POINT) * scale)], true, false);
|
||||
} else {
|
||||
ctx.ArcTo(new(SIZE * scale, (SIZE / 2 + POINT) * scale), size, 0, false, SweepDirection.Clockwise, true, false);
|
||||
}
|
||||
|
||||
ctx.ArcTo(new((SIZE / 2 + POINT) * scale, SIZE * scale), size, 0, false, SweepDirection.Clockwise, true, false);
|
||||
points.Add(new(SIZE, SIZE));
|
||||
if (ob && ib) {
|
||||
points.AddRange([new(SIZE / 2 + POINT, SIZE), new(SIZE / 2, SIZE + POINT / 2), new(SIZE / 2, SIZE - POINT / 2), new(SIZE / 2 - POINT, SIZE)]);
|
||||
} else if (ob) {
|
||||
ctx.PolyLineTo([new(SIZE / 2 * scale, (SIZE + POINT) * scale), new((SIZE / 2 - POINT) * scale, SIZE * scale)], true, false);
|
||||
} else if (ib) {
|
||||
ctx.PolyLineTo([new(SIZE / 2 * scale, (SIZE - POINT) * scale), new((SIZE / 2 - POINT) * scale, SIZE * scale)], true, false);
|
||||
} else {
|
||||
ctx.ArcTo(new((SIZE / 2 - POINT) * scale, SIZE * scale), size, 0, false, SweepDirection.Clockwise, true, false);
|
||||
}
|
||||
|
||||
ctx.ArcTo(new(0, (SIZE / 2 + POINT) * scale), size, 0, false, SweepDirection.Clockwise, true, false);
|
||||
points.Add(new(0, SIZE));
|
||||
if (ol && il) {
|
||||
points.AddRange([new(0, SIZE / 2 + POINT), new(-POINT / 2, SIZE / 2), new(POINT / 2, SIZE / 2), new(0, SIZE / 2 - POINT)]);
|
||||
} else if (ol) {
|
||||
ctx.PolyLineTo([new(-POINT * scale, SIZE / 2 * scale), new(0, (SIZE / 2 - POINT) * scale)], true, false);
|
||||
} else if (il) {
|
||||
ctx.PolyLineTo([new(POINT * scale, SIZE / 2 * scale), new(0, (SIZE / 2 - POINT) * scale)], true, false);
|
||||
} else {
|
||||
ctx.ArcTo(new(0, (SIZE / 2 - POINT) * scale), size, 0, false, SweepDirection.Clockwise, true, false);
|
||||
}
|
||||
|
||||
ctx.ArcTo(new((SIZE / 2 - POINT) * scale, 0), size, 0, false, SweepDirection.Clockwise, true, false);
|
||||
}
|
||||
|
||||
_rect?.Points = [.. points.Select(p => new Point(p.X * scale, p.Y * scale))];
|
||||
_rect?.StrokeThickness = 2;
|
||||
_rect?.Data = geo;
|
||||
// [.. points.Select(p => new Point(p.X * scale, p.Y * scale))];
|
||||
_rect?.StrokeThickness = Graph.ToBorder(scale);
|
||||
_rect?.SetValue(Canvas.LeftProperty, (CenterX - SIZE / 2) * scale);
|
||||
_rect?.SetValue(Canvas.TopProperty, (CenterY - SIZE / 2) * scale);
|
||||
}
|
||||
@@ -89,7 +112,7 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
}
|
||||
|
||||
public void Update(bool isHovering, bool isPressed) {
|
||||
_rect?.Stroke = isHovering ? Brushes.Black : Brushes.Black;
|
||||
_rect?.Fill = Highlight ?? Brushes.DarkGray;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using PIEHidNetCore;
|
||||
using PIEHidNetCore;
|
||||
using System.IO;
|
||||
using System.Windows.Media;
|
||||
|
||||
|
||||
@@ -484,6 +484,7 @@ namespace PamhagenSysCtrl.Windows {
|
||||
SetFastSelectButton(b,
|
||||
paths.Any(p => p.Start == e.Source && p.Hops.Last().Node == e.Sink) ? (hoverPathDeactivate?.Start == e.Source && hoverPathDeactivate?.Hops.Last().Node == e.Sink) ? 2 : 1 : 0,
|
||||
e.Pump.IsActive || Graph.GetFreePath([e.Source, e.Sink], overrideStart: true) == null);
|
||||
|
||||
}
|
||||
|
||||
private ISet<INode> UpdateScheme(Point pos, bool down) {
|
||||
@@ -494,6 +495,8 @@ namespace PamhagenSysCtrl.Windows {
|
||||
foreach (var n in Graph.Nodes) {
|
||||
if (n is Pump p) {
|
||||
p.Highlight = null;
|
||||
} else if (n is PipeJoin j) {
|
||||
j.Highlight = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,8 +504,10 @@ namespace PamhagenSysCtrl.Windows {
|
||||
SetFastSelectButton(FastSelectButton_EntryTrough_Stop, App.Plant?.IsTroughAugerActive ?? false ? 0 : 2);
|
||||
SetFastSelectButton(FastSelectButton_MW1, App.Plant?.IsMW1Selected ?? false ? 1 : 0);
|
||||
SetFastSelectButton(FastSelectButton_MW2, App.Plant?.IsMW2Selected ?? false ? 1 : 0);
|
||||
|
||||
SetFastSelectButton(FastSelectButton_MP1_Forward, App.Plant?.MP1 == MotorState.Forward ? 1 : 0, !(App.Plant?.MP1HasClearance ?? false));
|
||||
SetFastSelectButton(FastSelectButton_MP1_Stop, App.Plant?.MP1 == MotorState.Halt ? 2 : 0);
|
||||
|
||||
SetFastSelectButton(FastSelectButton_MP2_Forward, App.Plant?.MP2 == MotorState.Forward ? 1 : 0, !(App.Plant?.MP2HasClearance ?? false));
|
||||
SetFastSelectButton(FastSelectButton_MP2_Stop, App.Plant?.MP2 == MotorState.Halt ? 2 : 0);
|
||||
|
||||
|
||||
Reference in new issue
Block a user