visualisierung
This commit is contained in:
1 parent
d0655f3638
commit
367c93c93e
84 files changed
+2265
-148
No files matched your search
@@ -1,4 +1,6 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { parseMotorRequest } from '../_dto/motor.dto';
|
||||
import { DrawWarnung, parseWarnungRequest } from '../graphics/elements/drawWarnung';
|
||||
import { DrawShapeOptionenDto } from 'src/_dto/draw.dto';
|
||||
import { DrawBand } from 'src/graphics/elements/drawBand';
|
||||
import { DrawBehaelter } from 'src/graphics/elements/drawBehaelter';
|
||||
@@ -28,6 +30,7 @@ import { parseBandObenRequest } from '../_dto/band-oben.dto';
|
||||
@Injectable()
|
||||
export class DrawService {
|
||||
constructor(
|
||||
private readonly buildWarnung: DrawWarnung,
|
||||
private readonly buildBandOben: DrawBandOben,
|
||||
private readonly buildSieb: Sieb,
|
||||
private readonly buildGurtfoerderer: DrawGurtfoerderer,
|
||||
@@ -63,6 +66,21 @@ export class DrawService {
|
||||
return this.buildBandOben.getObject(config, options);
|
||||
}
|
||||
|
||||
renderGraphic(type: string, input: unknown) {
|
||||
switch (type) {
|
||||
case 'warnung': {
|
||||
const { config, options } = parseWarnungRequest(input);
|
||||
return this.buildWarnung.getObject(config, options);
|
||||
}
|
||||
case 'bandOben': return this.renderBandOben(input);
|
||||
case 'motor': {
|
||||
const { config, options } = parseMotorRequest(input);
|
||||
return this.buildMotor.getObject(config, options);
|
||||
}
|
||||
default: throw new NotFoundException('Unbekannter POST-Grafiktyp: ' + type);
|
||||
}
|
||||
}
|
||||
|
||||
sieb(options?: DrawShapeOptionenDto, rawSvg?: boolean) {
|
||||
if (rawSvg) return this.buildSieb.getSvg(options);
|
||||
return this.buildSieb.getDrawObject(options);
|
||||
|
||||
Reference in new issue
Block a user