Add remaining tanks

This commit is contained in:
2026-07-13 17:11:21 +02:00
parent 011f90233c
commit 74ec9527da
13 changed files with 378 additions and 110 deletions
+25 -13
View File
@@ -16,7 +16,7 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
public ISet<IEdge> Inputs { get; init; }
public ISet<IEdge> Outputs { get; init; }
private Polygon? _rect;
private Shape? _rect;
public PipeJoin(double x, double y) {
CenterX = x;
@@ -26,35 +26,47 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
}
public void Draw(Canvas canvas) {
bool? top = Inputs.Any(e => e.Start.CenterY < CenterY && (!e.Orientation || e.Start.CenterX == CenterX)) ? false : Outputs.Any(e => e.End.CenterY < CenterY && (e.Orientation || e.Start.CenterX == CenterX)) ? true : null;
bool? right = Inputs.Any(e => e.Start.CenterX > CenterX && (e.Orientation || e.Start.CenterY == CenterY)) ? false : Outputs.Any(e => e.End.CenterX > CenterX && (!e.Orientation || e.Start.CenterY == CenterY)) ? true : null;
bool? bottom = Inputs.Any(e => e.Start.CenterY > CenterY && (!e.Orientation || e.Start.CenterX == CenterX)) ? false : Outputs.Any(e => e.End.CenterY > CenterY && (e.Orientation || e.Start.CenterX == CenterX)) ? true : null;
bool? left = Inputs.Any(e => e.Start.CenterX < CenterX && (e.Orientation || e.Start.CenterY == CenterY)) ? false : Outputs.Any(e => e.End.CenterX < CenterX && (!e.Orientation || e.Start.CenterY == CenterY)) ? true : null;
var it = Inputs.Any(e => (e.Start.CenterY < CenterY && (!e.Orientation || e.Start.CenterX == CenterX)) || (e.IsTwoWay && e.End.CenterY < CenterY && (!e.Orientation || e.End.CenterX == CenterX)));
var ot = Outputs.Any(e => (e.End.CenterY < CenterY && ( e.Orientation || e.End.CenterX == CenterX)) || (e.IsTwoWay && e.Start.CenterY < CenterY && ( e.Orientation || e.Start.CenterX == CenterX)));
var ir = 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 or = 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 ib = Inputs.Any(e => (e.Start.CenterY > CenterY && (!e.Orientation || e.Start.CenterX == CenterX)) || (e.IsTwoWay && e.End.CenterY > CenterY && (!e.Orientation || e.End.CenterX == CenterX)));
var ob = Outputs.Any(e => (e.End.CenterY > CenterY && ( e.Orientation || e.End.CenterX == CenterX)) || (e.IsTwoWay && e.Start.CenterY > CenterY && ( e.Orientation || e.Start.CenterX == CenterX)));
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 (top == true) {
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 (top == false) {
} 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 (right == true) {
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 (right == false) {
} 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 (bottom == true) {
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 (bottom == false) {
} 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 (left == true) {
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 (left == false) {
} else if (il) {
points.AddRange([new(0, SIZE / 2 + POINT), new(POINT, SIZE / 2), new(0, SIZE / 2 - POINT)]);
}