stand2026_10_06
This commit is contained in:
1 parent
73015386e9
commit
30292794ae
25 files changed
+664
-164
No files matched your search
@@ -0,0 +1,336 @@
|
||||
import { PathCommand } from "../lib/types/path.types";
|
||||
import { DrawLine } from '../lib/drawLine'
|
||||
import { DrawPath } from '../lib/drawPath'
|
||||
import { DrawGroup } from '../lib/drawGroup'
|
||||
import { DrawEllipse } from "../lib/drawEllipse";
|
||||
|
||||
import { cal_rotation_dim } from '../lib/drawFunktions'
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { DrawDto, DrawShapeOptionenDto } from "src/_dto/draw.dto";
|
||||
import { DrawHeader } from "../lib/drawHeader";
|
||||
|
||||
interface Para {
|
||||
scale?: number,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class DrawAnlageDurmin {
|
||||
|
||||
obj_height = 1100;
|
||||
obj_width = 1700;
|
||||
|
||||
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
|
||||
createSiloSued(data: { length: number, height: number, wand: number, posX: number, posY: number }) {
|
||||
let { height, length, posX, posY, wand } = data;
|
||||
|
||||
const pSilo: PathCommand[] = [
|
||||
{ type: "M", x: posX, y: posY },
|
||||
{ relative: true, type: "V", y: height }, // --
|
||||
{ relative: true, type: "H", x: length }, // --
|
||||
{ relative: true, type: "V", y: -height }, // T
|
||||
{ relative: true, type: "H", x: -wand }, // --
|
||||
{ relative: true, type: "V", y: height - wand }, //
|
||||
{ relative: true, type: "H", x: -(length - (wand * 2)) }, // --
|
||||
{ relative: true, type: "V", y: -(height - wand) }, //
|
||||
{ type: "Z" }
|
||||
];
|
||||
|
||||
return pSilo;
|
||||
}
|
||||
|
||||
createSiloNord(data: { length: number, height: number, wand: number, posX: number, posY: number }) {
|
||||
let { height, length, posX, posY, wand } = data;
|
||||
|
||||
const pSilo: PathCommand[] = [
|
||||
{ type: "M", x: posX, y: posY },
|
||||
{ relative: true, type: "V", y: height }, // --
|
||||
{ relative: true, type: "H", x: wand }, // --
|
||||
{ relative: true, type: "V", y: -(height - wand) }, // T
|
||||
{ relative: true, type: "H", x: length - (wand * 2) }, // innen oben
|
||||
{ relative: true, type: "V", y: height - wand }, //
|
||||
{ relative: true, type: "H", x: wand }, // --
|
||||
{ relative: true, type: "V", y: -height }, //
|
||||
{ type: "Z" }
|
||||
];
|
||||
|
||||
return pSilo;
|
||||
}
|
||||
|
||||
createSiloWest(data: { length: number, height: number, wand: number, posX: number, posY: number }) {
|
||||
let { height, length, posX, posY, wand } = data;
|
||||
|
||||
const pSilo: PathCommand[] = [
|
||||
{ type: "M", x: posX, y: posY },
|
||||
{ relative: true, type: "V", y: length }, // --
|
||||
{ relative: true, type: "H", x: height }, // --
|
||||
{ relative: true, type: "V", y: -wand }, // T
|
||||
{ relative: true, type: "H", x: -(height - wand) }, // innen oben
|
||||
{ relative: true, type: "V", y: -(length - 2 * wand) }, //
|
||||
{ relative: true, type: "H", x: height - wand }, // --
|
||||
{ relative: true, type: "V", y: -wand }, //
|
||||
{ type: "Z" }
|
||||
];
|
||||
|
||||
return pSilo;
|
||||
}
|
||||
|
||||
createFahrschine(data: { length: number, height: number, abstand: number, posX: number, posY: number, nordSued: boolean }) {
|
||||
let { height, length, posX, posY, abstand, nordSued } = data;
|
||||
if (nordSued) {
|
||||
height = data.length;
|
||||
length = data.height;
|
||||
}
|
||||
const pSchine1: PathCommand[] = [
|
||||
{ type: "M", x: posX, y: posY },
|
||||
{ relative: true, type: "V", y: height }, // --
|
||||
{ relative: true, type: "H", x: length }, // --
|
||||
{ relative: true, type: "V", y: -height }, // T
|
||||
{ type: "Z" }
|
||||
];
|
||||
|
||||
let abstand_x = nordSued ? abstand : 0;
|
||||
let abstand_y = nordSued ? 0 : abstand;
|
||||
const pSchine2: PathCommand[] = [
|
||||
{ type: "M", x: posX + abstand_x, y: posY + abstand_y },
|
||||
{ relative: true, type: "V", y: height }, // --
|
||||
{ relative: true, type: "H", x: length }, // --
|
||||
{ relative: true, type: "V", y: -height }, // T
|
||||
{ type: "Z" }
|
||||
];
|
||||
return [pSchine1, pSchine2];
|
||||
}
|
||||
|
||||
createBand(data: { width: number, height: number, posX: number, posY: number, nordSued: boolean }) {
|
||||
let { height, width, posX, posY, nordSued } = data;
|
||||
|
||||
if (nordSued) {
|
||||
height = data.width;
|
||||
width = data.height;
|
||||
}
|
||||
|
||||
const pBand1: PathCommand[] = [
|
||||
{ type: "M", x: 0, y: 0 },
|
||||
{ relative: true, type: "V", y: height }, // --
|
||||
{ relative: true, type: "H", x: width }, // --
|
||||
{ relative: true, type: "V", y: -height }, // T
|
||||
{ type: "Z" }
|
||||
];
|
||||
|
||||
let offsetX = nordSued ? 10 : 0;
|
||||
let offsetY = nordSued ? 0 : 10;
|
||||
let belt2Pos = {width:width-offsetX,height:height-offsetY}
|
||||
|
||||
const pBand2: PathCommand[] = [
|
||||
{ type: "M", x: offsetX/2, y: offsetY/2 },
|
||||
{ relative: true, type: "V", y: belt2Pos.height }, // --
|
||||
{ relative: true, type: "H", x: belt2Pos.width }, // --
|
||||
{ relative: true, type: "V", y: -belt2Pos.height }, // T
|
||||
{ type: "Z" }
|
||||
];
|
||||
|
||||
let boxWidth = nordSued ? width : 10;
|
||||
let boxHeight = nordSued ? 10: height;
|
||||
|
||||
let boxValues = {width:boxWidth,height:boxHeight}
|
||||
const pBandBoxStart: PathCommand[] = [
|
||||
{ type: "M", x: 0, y: 0 },
|
||||
{ relative: true, type: "V", y: boxValues.height }, // --
|
||||
{ relative: true, type: "H", x: boxValues.width }, // --
|
||||
{ relative: true, type: "V", y: -boxValues.height }, // T
|
||||
{ type: "Z" }
|
||||
];
|
||||
|
||||
const group = new DrawGroup({});
|
||||
group.setAtrr({ translate_y: posY, translate_x: posX })
|
||||
|
||||
const belt1 = new DrawPath(pBand1);
|
||||
belt1.setAtrr({fill:"#404040", stroke:"#404040"})
|
||||
|
||||
const belt2 = new DrawPath(pBand2);
|
||||
belt2.setAtrr({fill:"#808080", stroke:"#808080"})
|
||||
|
||||
const beltBoxStart = new DrawPath(pBandBoxStart);
|
||||
beltBoxStart.setAtrr({fill:"#101010", stroke:"#101010"})
|
||||
|
||||
group.add(beltBoxStart)
|
||||
group.add(belt2)
|
||||
group.add(belt1)
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
create(optionen?: DrawShapeOptionenDto): DrawGroup {
|
||||
|
||||
let color = "#000000";
|
||||
|
||||
|
||||
const silo_h = 196;
|
||||
const silo_b = 196;
|
||||
const silo_wand = 8;
|
||||
|
||||
const posSiloSued = 1700 - 300;
|
||||
|
||||
|
||||
const siloWestPos = { x: 200, y: 100 }
|
||||
const siloSuedPos = { x: 700, y: siloWestPos.y + (silo_b*3) + (silo_b/2) - (silo_h/2) }
|
||||
const siloNordPos = { x: 700, y: siloWestPos.y + (silo_b*1) + (silo_b/2) - (silo_h/2) }
|
||||
|
||||
|
||||
|
||||
const obj_h = this.obj_height;
|
||||
const obj_w = this.obj_width;
|
||||
|
||||
|
||||
|
||||
const groupInhalt = new DrawGroup({});
|
||||
const group1 = new DrawGroup({});
|
||||
|
||||
|
||||
// Silo Süd
|
||||
let silo_posX = siloSuedPos.x;
|
||||
let silo_posY = siloSuedPos.y;
|
||||
|
||||
const zBa2S1 = new DrawPath(this.createSiloSued({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||
silo_posX += silo_b - silo_wand;
|
||||
const zBa2S2 = new DrawPath(this.createSiloSued({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||
silo_posX += silo_b - silo_wand;
|
||||
const zBa2S3 = new DrawPath(this.createSiloSued({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||
silo_posX += silo_b - silo_wand;
|
||||
const zBa2S4 = new DrawPath(this.createSiloSued({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||
silo_posX += silo_b - silo_wand;
|
||||
const zBa2S5 = new DrawPath(this.createSiloSued({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||
zBa2S1.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||
zBa2S2.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||
zBa2S3.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||
zBa2S4.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||
zBa2S5.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||
|
||||
// Schiene
|
||||
let [pBa1Schiene1, pBa1Schiene2] = this.createFahrschine({ length: silo_b * 5 + 50, height: 4, abstand: 50, posX: siloSuedPos.x - 30, posY: siloSuedPos.y + (silo_h/2) - 25, nordSued: false });
|
||||
const zBa1Schine1 = new DrawPath(pBa1Schiene1);
|
||||
const zBa1Schine2 = new DrawPath(pBa1Schiene2);
|
||||
|
||||
|
||||
// Silo Nord
|
||||
silo_posX = siloNordPos.x;
|
||||
silo_posY = siloNordPos.y;
|
||||
|
||||
const zBa1S1 = new DrawPath(this.createSiloNord({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||
silo_posX += silo_b - silo_wand;
|
||||
const zBa1S2 = new DrawPath(this.createSiloNord({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||
silo_posX += silo_b - silo_wand;
|
||||
const zBa1S3 = new DrawPath(this.createSiloNord({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||
silo_posX += silo_b - silo_wand;
|
||||
const zBa1S4 = new DrawPath(this.createSiloNord({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||
silo_posX += silo_b - silo_wand;
|
||||
const zBa1S5 = new DrawPath(this.createSiloNord({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||
zBa1S1.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||
zBa1S2.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||
zBa1S3.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||
zBa1S4.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||
zBa1S5.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||
|
||||
// Schiene
|
||||
let [pBa2Schiene1, pBa2Schiene2] = this.createFahrschine({ length: silo_b * 5 + 50, height: 4, abstand: 50, posX: siloNordPos.x - 30, posY: siloNordPos.y + (silo_h/2) - 25, nordSued: false });
|
||||
const zBa2Schine1 = new DrawPath(pBa2Schiene1);
|
||||
const zBa2Schine2 = new DrawPath(pBa2Schiene2);
|
||||
|
||||
// Silo West
|
||||
silo_posX = siloWestPos.x;
|
||||
silo_posY = siloWestPos.y;
|
||||
|
||||
const zBa3S1 = new DrawPath(this.createSiloWest({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||
silo_posY += silo_b - silo_wand;
|
||||
const zBa3S2 = new DrawPath(this.createSiloWest({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||
silo_posY += silo_b - silo_wand;
|
||||
const zBa3S3 = new DrawPath(this.createSiloWest({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||
silo_posY += silo_b - silo_wand;
|
||||
const zBa3S4 = new DrawPath(this.createSiloWest({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||
silo_posY += silo_b - silo_wand;
|
||||
const zBa3S5 = new DrawPath(this.createSiloWest({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||
zBa3S1.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||
zBa3S2.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||
zBa3S3.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||
zBa3S4.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||
zBa3S5.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||
|
||||
// Schiene
|
||||
let [pBa3Schiene1, pBa3Schiene2] = this.createFahrschine({ length: silo_b * 5 + 50, height: 4, abstand: 50, posX: siloWestPos.x + (silo_h/2) - 25, posY: siloWestPos.y - 30, nordSued: true });
|
||||
const zBa3Schine1 = new DrawPath(pBa3Schiene1);
|
||||
const zBa3Schine2 = new DrawPath(pBa3Schiene2);
|
||||
|
||||
this.obj_height = obj_h //+ 30;
|
||||
this.obj_width = obj_w;
|
||||
|
||||
group1.add(this.createBand({posX:600,posY:200,width:100,height:40,nordSued:false}))
|
||||
group1.add(this.createBand({posX:500,posY:100,width:100,height:40,nordSued:true}))
|
||||
group1.add(zBa1Schine1);
|
||||
group1.add(zBa1Schine2);
|
||||
group1.add(zBa1S1);
|
||||
group1.add(zBa1S2);
|
||||
group1.add(zBa1S3);
|
||||
group1.add(zBa1S4);
|
||||
group1.add(zBa1S5);
|
||||
|
||||
group1.add(zBa2Schine1);
|
||||
group1.add(zBa2Schine2);
|
||||
group1.add(zBa2S1);
|
||||
group1.add(zBa2S2);
|
||||
group1.add(zBa2S3);
|
||||
group1.add(zBa2S4);
|
||||
group1.add(zBa2S5);
|
||||
|
||||
|
||||
group1.add(zBa3Schine1);
|
||||
group1.add(zBa3Schine2);
|
||||
group1.add(zBa3S1);
|
||||
group1.add(zBa3S2);
|
||||
group1.add(zBa3S3);
|
||||
group1.add(zBa3S4);
|
||||
group1.add(zBa3S5);
|
||||
|
||||
groupInhalt.add(group1)
|
||||
|
||||
groupInhalt.setAtrr({ translate_y: 11, translate_x: 11 })
|
||||
return groupInhalt;
|
||||
|
||||
}
|
||||
|
||||
getDrawObject(optionen?: DrawShapeOptionenDto): DrawDto {
|
||||
const groupSvg = this.create(optionen)
|
||||
const getXaml = true;
|
||||
const svg = groupSvg.getChildString(!getXaml, 0)
|
||||
const xaml = groupSvg.getChildString(getXaml, 0)
|
||||
return {
|
||||
name: "anlageDurmin",
|
||||
height: this.obj_height,
|
||||
length: this.obj_width,
|
||||
px_height: this.obj_height,
|
||||
px_width: this.obj_width,
|
||||
raster: 1,
|
||||
scale: 1,
|
||||
offset_x: 0,
|
||||
offset_y: 0,
|
||||
svg,
|
||||
xaml
|
||||
}
|
||||
}
|
||||
|
||||
getSvg(optionen?: DrawShapeOptionenDto): string {
|
||||
const groupSvg = this.create(optionen)
|
||||
const xaml = optionen && optionen.xaml ? true : false;
|
||||
const header = new DrawHeader({ lenght: this.obj_width, height: this.obj_height });
|
||||
header.add(groupSvg);
|
||||
|
||||
return header.getChildString(xaml, 0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user