diff --git a/public/drawIcon.svg b/public/drawIcon.svg
index 3a336c1..81078a9 100644
--- a/public/drawIcon.svg
+++ b/public/drawIcon.svg
@@ -108,6 +108,14 @@
-
+
+
+
+
+
+
+
+
+
diff --git a/src/drawApp/graphics/FAS/FasAlarmInteraction.ts b/src/drawApp/graphics/FAS/FasAlarmInteraction.ts
index 171d2d9..747214b 100644
--- a/src/drawApp/graphics/FAS/FasAlarmInteraction.ts
+++ b/src/drawApp/graphics/FAS/FasAlarmInteraction.ts
@@ -5,15 +5,15 @@ import { iscsGraphicData } from 'src/protos/iscs_graphic_data';
export class FasAlarmData extends GraphicDataBase implements IFasAlarmData {
constructor(data?: iscsGraphicData.FasAlarm) {
- let cctvButton;
+ let fasAlarm;
if (data) {
- cctvButton = data;
+ fasAlarm = data;
} else {
- cctvButton = new iscsGraphicData.FasAlarm({
+ fasAlarm = new iscsGraphicData.FasAlarm({
common: GraphicDataBase.defaultCommonInfo(FasAlarm.Type),
});
}
- super(cctvButton);
+ super(fasAlarm);
}
public get data(): iscsGraphicData.FasAlarm {
diff --git a/src/drawApp/graphics/FAS/FasFailureControlHostInteraction.ts b/src/drawApp/graphics/FAS/FasFailureControlHostInteraction.ts
index 1de14d3..346a00d 100644
--- a/src/drawApp/graphics/FAS/FasFailureControlHostInteraction.ts
+++ b/src/drawApp/graphics/FAS/FasFailureControlHostInteraction.ts
@@ -11,15 +11,15 @@ export class FasFailureControlHostData
implements IFasFailureControlHostData
{
constructor(data?: iscsGraphicData.FasFailureControlHost) {
- let cctvButton;
+ let fasFailureControlHost;
if (data) {
- cctvButton = data;
+ fasFailureControlHost = data;
} else {
- cctvButton = new iscsGraphicData.FasFailureControlHost({
+ fasFailureControlHost = new iscsGraphicData.FasFailureControlHost({
common: GraphicDataBase.defaultCommonInfo(FasFailureControlHost.Type),
});
}
- super(cctvButton);
+ super(fasFailureControlHost);
}
public get data(): iscsGraphicData.FasFailureControlHost {
diff --git a/src/drawApp/graphics/FAS/FireShutterInteraction.ts b/src/drawApp/graphics/FAS/FireShutterInteraction.ts
new file mode 100644
index 0000000..5f4d172
--- /dev/null
+++ b/src/drawApp/graphics/FAS/FireShutterInteraction.ts
@@ -0,0 +1,44 @@
+import * as pb_1 from 'google-protobuf';
+import { GraphicDataBase } from '../GraphicDataBase';
+import {
+ FireShutter,
+ IFireShutterData,
+} from 'src/graphics/FAS/fireShutter/FireShutter';
+import { iscsGraphicData } from 'src/protos/iscs_graphic_data';
+
+export class FireShutterData
+ extends GraphicDataBase
+ implements IFireShutterData
+{
+ constructor(data?: iscsGraphicData.FireShutter) {
+ let fireShutter;
+ if (data) {
+ fireShutter = data;
+ } else {
+ fireShutter = new iscsGraphicData.FireShutter({
+ common: GraphicDataBase.defaultCommonInfo(FireShutter.Type),
+ });
+ }
+ super(fireShutter);
+ }
+
+ public get data(): iscsGraphicData.FireShutter {
+ return this.getData();
+ }
+
+ get code(): string {
+ return this.data.code;
+ }
+ set code(v: string) {
+ this.data.code = v;
+ }
+ clone(): FireShutterData {
+ return new FireShutterData(this.data.cloneMessage());
+ }
+ copyFrom(data: FireShutterData): void {
+ pb_1.Message.copyInto(data.data, this.data);
+ }
+ eq(other: FireShutterData): boolean {
+ return pb_1.Message.equals(this.data, other.data);
+ }
+}
diff --git a/src/drawApp/graphics/FAS/ManualAlarmButtonInteraction.ts b/src/drawApp/graphics/FAS/ManualAlarmButtonInteraction.ts
index 470a069..3aeed14 100644
--- a/src/drawApp/graphics/FAS/ManualAlarmButtonInteraction.ts
+++ b/src/drawApp/graphics/FAS/ManualAlarmButtonInteraction.ts
@@ -11,15 +11,15 @@ export class ManualAlarmButtonData
implements IManualAlarmButtonData
{
constructor(data?: iscsGraphicData.ManualAlarmButton) {
- let cctvButton;
+ let manualAlarmButton;
if (data) {
- cctvButton = data;
+ manualAlarmButton = data;
} else {
- cctvButton = new iscsGraphicData.ManualAlarmButton({
+ manualAlarmButton = new iscsGraphicData.ManualAlarmButton({
common: GraphicDataBase.defaultCommonInfo(ManualAlarmButton.Type),
});
}
- super(cctvButton);
+ super(manualAlarmButton);
}
public get data(): iscsGraphicData.ManualAlarmButton {
diff --git a/src/drawApp/graphics/FAS/SmokeDetectorInteraction.ts b/src/drawApp/graphics/FAS/SmokeDetectorInteraction.ts
index 0deb9e8..60021b1 100644
--- a/src/drawApp/graphics/FAS/SmokeDetectorInteraction.ts
+++ b/src/drawApp/graphics/FAS/SmokeDetectorInteraction.ts
@@ -11,15 +11,15 @@ export class SmokeDetectorData
implements ISmokeDetectorData
{
constructor(data?: iscsGraphicData.SmokeDetector) {
- let cctvButton;
+ let smokeDetector;
if (data) {
- cctvButton = data;
+ smokeDetector = data;
} else {
- cctvButton = new iscsGraphicData.SmokeDetector({
+ smokeDetector = new iscsGraphicData.SmokeDetector({
common: GraphicDataBase.defaultCommonInfo(SmokeDetector.Type),
});
}
- super(cctvButton);
+ super(smokeDetector);
}
public get data(): iscsGraphicData.SmokeDetector {
diff --git a/src/drawApp/graphics/FAS/TemperatureDetectorInteraction.ts b/src/drawApp/graphics/FAS/TemperatureDetectorInteraction.ts
new file mode 100644
index 0000000..a82a359
--- /dev/null
+++ b/src/drawApp/graphics/FAS/TemperatureDetectorInteraction.ts
@@ -0,0 +1,44 @@
+import * as pb_1 from 'google-protobuf';
+import { GraphicDataBase } from '../GraphicDataBase';
+import {
+ TemperatureDetector,
+ ITemperatureDetectorData,
+} from 'src/graphics/FAS/temperatureDetector/TemperatureDetector';
+import { iscsGraphicData } from 'src/protos/iscs_graphic_data';
+
+export class TemperatureDetectorData
+ extends GraphicDataBase
+ implements ITemperatureDetectorData
+{
+ constructor(data?: iscsGraphicData.TemperatureDetector) {
+ let cctvButton;
+ if (data) {
+ cctvButton = data;
+ } else {
+ cctvButton = new iscsGraphicData.TemperatureDetector({
+ common: GraphicDataBase.defaultCommonInfo(TemperatureDetector.Type),
+ });
+ }
+ super(cctvButton);
+ }
+
+ public get data(): iscsGraphicData.TemperatureDetector {
+ return this.getData();
+ }
+
+ get code(): string {
+ return this.data.code;
+ }
+ set code(v: string) {
+ this.data.code = v;
+ }
+ clone(): TemperatureDetectorData {
+ return new TemperatureDetectorData(this.data.cloneMessage());
+ }
+ copyFrom(data: TemperatureDetectorData): void {
+ pb_1.Message.copyInto(data.data, this.data);
+ }
+ eq(other: TemperatureDetectorData): boolean {
+ return pb_1.Message.equals(this.data, other.data);
+ }
+}
diff --git a/src/drawApp/iscsApp.ts b/src/drawApp/iscsApp.ts
index 88db678..05a9dfe 100644
--- a/src/drawApp/iscsApp.ts
+++ b/src/drawApp/iscsApp.ts
@@ -47,6 +47,18 @@ import {
} from 'src/graphics/FAS/smokeDetector/SmokeDetector';
import { SmokeDetectorData } from './graphics/FAS/SmokeDetectorInteraction';
import { SmokeDetectorDraw } from 'src/graphics/FAS/smokeDetector/SmokeDetectorAssistant';
+import {
+ TemperatureDetector,
+ TemperatureDetectorTemplate,
+} from 'src/graphics/FAS/temperatureDetector/TemperatureDetector';
+import { TemperatureDetectorData } from './graphics/FAS/TemperatureDetectorInteraction';
+import { TemperatureDetectorDraw } from 'src/graphics/FAS/temperatureDetector/TemperatureDetectorAssistant';
+import {
+ FireShutter,
+ FireShutterTemplate,
+} from 'src/graphics/FAS/fireShutter/FireShutter';
+import { FireShutterData } from './graphics/FAS/FireShutterInteraction';
+import { FireShutterDraw } from 'src/graphics/FAS/fireShutter/FireShutterAssistant';
// import { getOnlyToken } from 'src/configs/TokenManage';
let drawApp: IDrawApp | null = null;
@@ -94,6 +106,11 @@ export function initIscsDrawApp(): IDrawApp {
app,
new SmokeDetectorTemplate(new SmokeDetectorData())
);
+ new TemperatureDetectorDraw(
+ app,
+ new TemperatureDetectorTemplate(new TemperatureDetectorData())
+ );
+ new FireShutterDraw(app, new FireShutterTemplate(new FireShutterData()));
app.addKeyboardListener(
new KeyListener({
@@ -271,6 +288,14 @@ export async function loadDrawDatas(): Promise {
fasOfPlatformAlarm.smokeDetectors.forEach((smokeDetector) => {
datas.push(new SmokeDetectorData(smokeDetector));
});
+ fasOfPlatformAlarm.temperatureDetectors.forEach(
+ (temperatureDetector) => {
+ datas.push(new TemperatureDetectorData(temperatureDetector));
+ }
+ );
+ fasOfPlatformAlarm.fireShutters.forEach((fireShutter) => {
+ datas.push(new FireShutterData(fireShutter));
+ });
break;
}
}
@@ -375,6 +400,16 @@ export function saveDrawDatas(app: IDrawApp) {
fasStorage.smokeDetectors.push(
(smokeDetectorData as SmokeDetectorData).data
);
+ } else if (g instanceof TemperatureDetector) {
+ const temperatureDetectorData = g.saveData();
+ fasStorage.temperatureDetectors.push(
+ (temperatureDetectorData as TemperatureDetectorData).data
+ );
+ } else if (g instanceof FireShutter) {
+ const fireShutterData = g.saveData();
+ fasStorage.fireShutters.push(
+ (fireShutterData as FireShutterData).data
+ );
}
});
storage.fasOfPlatformAlarmStorages[i] = fasStorage;
diff --git a/src/graphics/FAS/firePump/FirePump.json b/src/graphics/FAS/firePump/FirePump.json
new file mode 100644
index 0000000..4907c62
--- /dev/null
+++ b/src/graphics/FAS/firePump/FirePump.json
@@ -0,0 +1,21 @@
+{
+ "frames": {
+ "normal.png": {
+ "frame": { "x": 0, "y": 0, "w": 23, "h": 34 },
+ "rotated": false,
+ "trimmed": false,
+ "spriteSourceSize": { "x": 0, "y": 0, "w": 23, "h": 34 },
+ "sourceSize": { "w": 23, "h": 34 },
+ "anchor": { "x": 0.5, "y": 0.5 }
+ }
+ },
+ "meta": {
+ "app": "https://www.codeandweb.com/texturepacker",
+ "version": "1.1",
+ "image": "FirePump.png",
+ "format": "RGBA8888",
+ "size": { "w": 23, "h": 34 },
+ "scale": "1",
+ "smartupdate": "$TexturePacker:SmartUpdate:e7620bd2d73cc0b3e2deea9704e7eefc:f129a1d9e4b9ba57720b3861c22b155b:eb2d421f7759984b7713aa4aa5354134$"
+ }
+}
diff --git a/src/graphics/FAS/firePump/FirePump.png b/src/graphics/FAS/firePump/FirePump.png
new file mode 100644
index 0000000..1b0d0bc
Binary files /dev/null and b/src/graphics/FAS/firePump/FirePump.png differ
diff --git a/src/graphics/FAS/firePump/FirePump.ts b/src/graphics/FAS/firePump/FirePump.ts
new file mode 100644
index 0000000..e69de29
diff --git a/src/graphics/FAS/firePump/FirePumpAssistant.ts b/src/graphics/FAS/firePump/FirePumpAssistant.ts
new file mode 100644
index 0000000..e69de29
diff --git a/src/graphics/FAS/fireShutter/FireShutter.json b/src/graphics/FAS/fireShutter/FireShutter.json
new file mode 100644
index 0000000..c39d0da
--- /dev/null
+++ b/src/graphics/FAS/fireShutter/FireShutter.json
@@ -0,0 +1,21 @@
+{
+ "frames": {
+ "normal.png": {
+ "frame": { "x": 0, "y": 0, "w": 33, "h": 33 },
+ "rotated": false,
+ "trimmed": false,
+ "spriteSourceSize": { "x": 0, "y": 0, "w": 33, "h": 33 },
+ "sourceSize": { "w": 33, "h": 33 },
+ "anchor": { "x": 0.5, "y": 0.5 }
+ }
+ },
+ "meta": {
+ "app": "https://www.codeandweb.com/texturepacker",
+ "version": "1.1",
+ "image": "FireShutter.png",
+ "format": "RGBA8888",
+ "size": { "w": 33, "h": 33 },
+ "scale": "1",
+ "smartupdate": "$TexturePacker:SmartUpdate:e7620bd2d73cc0b3e2deea9704e7eefc:f129a1d9e4b9ba57720b3861c22b155b:eb2d421f7759984b7713aa4aa5354134$"
+ }
+}
diff --git a/src/graphics/FAS/fireShutter/FireShutter.png b/src/graphics/FAS/fireShutter/FireShutter.png
new file mode 100644
index 0000000..8fca74f
Binary files /dev/null and b/src/graphics/FAS/fireShutter/FireShutter.png differ
diff --git a/src/graphics/FAS/fireShutter/FireShutter.ts b/src/graphics/FAS/fireShutter/FireShutter.ts
new file mode 100644
index 0000000..1f5104a
--- /dev/null
+++ b/src/graphics/FAS/fireShutter/FireShutter.ts
@@ -0,0 +1,63 @@
+import { GraphicData, JlGraphic, JlGraphicTemplate } from 'jl-graphic';
+import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js';
+// import { iscsGraphicData } from 'src/protos/iscs_graphic_data';
+import FireShutterJson from './fireShutter.json';
+import FireShutterAssets from './fireShutter.png';
+
+export interface IFireShutterData extends GraphicData {
+ get code(): string;
+ set code(v: string);
+}
+
+interface FireShutterTextures {
+ normal: Texture;
+}
+
+export class FireShutter extends JlGraphic {
+ static Type = 'FireShutter';
+ _fireShutter: Sprite;
+ fireShutterTextures: FireShutterTextures;
+ __state = 0;
+
+ constructor(fireShutterTextures: FireShutterTextures) {
+ super(FireShutter.Type);
+ this._fireShutter = new Sprite();
+ this.fireShutterTextures = fireShutterTextures;
+ this._fireShutter.anchor.set(0.5);
+ this.addChild(this._fireShutter);
+ this._fireShutter.texture = this.fireShutterTextures.normal;
+ }
+ get code(): string {
+ return this.datas.code;
+ }
+ get datas(): IFireShutterData {
+ return this.getDatas();
+ }
+
+ doRepaint(): void {}
+}
+
+export class FireShutterTemplate extends JlGraphicTemplate {
+ fireShutterTextures?: FireShutterTextures;
+ constructor(dataTemplate: IFireShutterData) {
+ super(FireShutter.Type, { dataTemplate });
+ this.loadAssets();
+ }
+ new(): FireShutter {
+ if (this.fireShutterTextures) {
+ const g = new FireShutter(this.fireShutterTextures);
+ g.loadData(this.datas);
+ return g;
+ }
+ throw new Error('资源未加载/加载失败');
+ }
+ async loadAssets(): Promise {
+ const texture = await Assets.load(FireShutterAssets);
+ const fireShutterSheet = new Spritesheet(texture, FireShutterJson);
+ const result = await fireShutterSheet.parse();
+ this.fireShutterTextures = {
+ normal: result['normal.png'],
+ };
+ return this.fireShutterTextures as FireShutterTextures;
+ }
+}
diff --git a/src/graphics/FAS/fireShutter/FireShutterAssistant.ts b/src/graphics/FAS/fireShutter/FireShutterAssistant.ts
new file mode 100644
index 0000000..dc4c3b2
--- /dev/null
+++ b/src/graphics/FAS/fireShutter/FireShutterAssistant.ts
@@ -0,0 +1,128 @@
+import { DisplayObject, FederatedMouseEvent, Point } from 'pixi.js';
+import {
+ AbsorbableLine,
+ AbsorbablePosition,
+ GraphicDrawAssistant,
+ GraphicInteractionPlugin,
+ GraphicTransformEvent,
+ IDrawApp,
+ JlGraphic,
+} from 'jl-graphic';
+import {
+ IFireShutterData,
+ FireShutter,
+ FireShutterTemplate,
+} from './FireShutter';
+
+export class FireShutterDraw extends GraphicDrawAssistant<
+ FireShutterTemplate,
+ IFireShutterData
+> {
+ _fireShutter: FireShutter | null = null;
+ constructor(app: IDrawApp, template: FireShutterTemplate) {
+ super(
+ app,
+ template,
+ 'svguse:../drawIcon.svg#icon-fire-shutter',
+ '防火卷帘'
+ );
+ FireShutterInteraction.init(app);
+ }
+
+ bind(): void {
+ super.bind();
+ if (!this._fireShutter) {
+ this._fireShutter = this.graphicTemplate.new();
+ this.container.addChild(this._fireShutter);
+ }
+ }
+
+ public get fireShutter(): FireShutter {
+ if (!this._fireShutter) {
+ this._fireShutter = this.graphicTemplate.new();
+ this.container.addChild(this._fireShutter);
+ }
+ return this._fireShutter;
+ }
+
+ redraw(cp: Point): void {
+ this.fireShutter.position.copyFrom(cp);
+ }
+ onLeftUp(e: FederatedMouseEvent): void {
+ this.fireShutter.position.copyFrom(this.toCanvasCoordinates(e.global));
+ this.createAndStore(true);
+ }
+ prepareData(data: IFireShutterData): boolean {
+ data.transform = this.fireShutter.saveTransform();
+ return true;
+ }
+ onEsc(): void {
+ this.finish();
+ }
+}
+
+/**
+ * 构建吸附线
+ * @param fireShutter
+ */
+function buildAbsorbablePositions(
+ fireShutter: FireShutter
+): AbsorbablePosition[] {
+ const aps: AbsorbablePosition[] = [];
+ const fireShutters = fireShutter.queryStore.queryByType(
+ FireShutter.Type
+ );
+ const canvas = fireShutter.getCanvas();
+ fireShutters.forEach((item) => {
+ if (item.id === fireShutter.id) {
+ return;
+ }
+ const ala = new AbsorbableLine(
+ new Point(item.x, 0),
+ new Point(item.x, canvas.height)
+ );
+ const alb = new AbsorbableLine(
+ new Point(0, item.y),
+ new Point(canvas.width, item.y)
+ );
+ aps.push(ala);
+ aps.push(alb);
+ });
+
+ return aps;
+}
+
+export class FireShutterInteraction extends GraphicInteractionPlugin {
+ static Name = 'fas_alarm_transform';
+ constructor(app: IDrawApp) {
+ super(FireShutterInteraction.Name, app);
+ }
+ static init(app: IDrawApp) {
+ return new FireShutterInteraction(app);
+ }
+ filter(...grahpics: JlGraphic[]): FireShutter[] | undefined {
+ return grahpics
+ .filter((g) => g.type === FireShutter.Type)
+ .map((g) => g as FireShutter);
+ }
+ bind(g: FireShutter): void {
+ g.eventMode = 'static';
+ g.cursor = 'pointer';
+ g.scalable = true;
+ g.rotatable = true;
+ g.on('transformstart', this.transformstart, this);
+ }
+ unbind(g: FireShutter): void {
+ g.eventMode = 'none';
+ g.scalable = false;
+ g.rotatable = false;
+ g.off('transformstart', this.transformstart, this);
+ }
+ transformstart(e: GraphicTransformEvent) {
+ const target = e.target as DisplayObject;
+ const fireShutter = target.getGraphic() as FireShutter;
+ fireShutter.getGraphicApp().setOptions({
+ absorbablePositions: buildAbsorbablePositions(fireShutter),
+ });
+ }
+}
diff --git a/src/graphics/FAS/temperatureDetector/TemperatureDetector.json b/src/graphics/FAS/temperatureDetector/TemperatureDetector.json
new file mode 100644
index 0000000..47369d4
--- /dev/null
+++ b/src/graphics/FAS/temperatureDetector/TemperatureDetector.json
@@ -0,0 +1,21 @@
+{
+ "frames": {
+ "normal.png": {
+ "frame": { "x": 0, "y": 0, "w": 21, "h": 11 },
+ "rotated": false,
+ "trimmed": false,
+ "spriteSourceSize": { "x": 0, "y": 0, "w": 21, "h": 11 },
+ "sourceSize": { "w": 21, "h": 11 },
+ "anchor": { "x": 0.5, "y": 0.5 }
+ }
+ },
+ "meta": {
+ "app": "https://www.codeandweb.com/texturepacker",
+ "version": "1.1",
+ "image": "TemperatureDetector.png",
+ "format": "RGBA8888",
+ "size": { "w": 21, "h": 11 },
+ "scale": "1",
+ "smartupdate": "$TexturePacker:SmartUpdate:e7620bd2d73cc0b3e2deea9704e7eefc:f129a1d9e4b9ba57720b3861c22b155b:eb2d421f7759984b7713aa4aa5354134$"
+ }
+}
diff --git a/src/graphics/FAS/temperatureDetector/TemperatureDetector.png b/src/graphics/FAS/temperatureDetector/TemperatureDetector.png
new file mode 100644
index 0000000..a3e24cf
Binary files /dev/null and b/src/graphics/FAS/temperatureDetector/TemperatureDetector.png differ
diff --git a/src/graphics/FAS/temperatureDetector/TemperatureDetector.ts b/src/graphics/FAS/temperatureDetector/TemperatureDetector.ts
new file mode 100644
index 0000000..c83c9d5
--- /dev/null
+++ b/src/graphics/FAS/temperatureDetector/TemperatureDetector.ts
@@ -0,0 +1,66 @@
+import { GraphicData, JlGraphic, JlGraphicTemplate } from 'jl-graphic';
+import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js';
+// import { iscsGraphicData } from 'src/protos/iscs_graphic_data';
+import TemperatureDetectorJson from './TemperatureDetector.json';
+import TemperatureDetectorAsset from './TemperatureDetector.png';
+
+export interface ITemperatureDetectorData extends GraphicData {
+ get code(): string;
+ set code(v: string);
+}
+
+interface TemperatureDetectorTextures {
+ normal: Texture;
+}
+
+export class TemperatureDetector extends JlGraphic {
+ static Type = 'TemperatureDetector';
+ _temperatureDetector: Sprite;
+ temperatureDetectorTextures: TemperatureDetectorTextures;
+ __state = 0;
+
+ constructor(temperatureDetectorTextures: TemperatureDetectorTextures) {
+ super(TemperatureDetector.Type);
+ this._temperatureDetector = new Sprite();
+ this.temperatureDetectorTextures = temperatureDetectorTextures;
+ this._temperatureDetector.anchor.set(0.5);
+ this.addChild(this._temperatureDetector);
+ this._temperatureDetector.texture = this.temperatureDetectorTextures.normal;
+ }
+ get code(): string {
+ return this.datas.code;
+ }
+ get datas(): ITemperatureDetectorData {
+ return this.getDatas();
+ }
+
+ doRepaint(): void {}
+}
+
+export class TemperatureDetectorTemplate extends JlGraphicTemplate {
+ temperatureDetectorTextures?: TemperatureDetectorTextures;
+ constructor(dataTemplate: ITemperatureDetectorData) {
+ super(TemperatureDetector.Type, { dataTemplate });
+ this.loadAssets();
+ }
+ new(): TemperatureDetector {
+ if (this.temperatureDetectorTextures) {
+ const g = new TemperatureDetector(this.temperatureDetectorTextures);
+ g.loadData(this.datas);
+ return g;
+ }
+ throw new Error('资源未加载/加载失败');
+ }
+ async loadAssets(): Promise {
+ const texture = await Assets.load(TemperatureDetectorAsset);
+ const temperatureDetectorSheet = new Spritesheet(
+ texture,
+ TemperatureDetectorJson
+ );
+ const result = await temperatureDetectorSheet.parse();
+ this.temperatureDetectorTextures = {
+ normal: result['normal.png'],
+ };
+ return this.temperatureDetectorTextures as TemperatureDetectorTextures;
+ }
+}
diff --git a/src/graphics/FAS/temperatureDetector/TemperatureDetectorAssistant.ts b/src/graphics/FAS/temperatureDetector/TemperatureDetectorAssistant.ts
new file mode 100644
index 0000000..16eb0d2
--- /dev/null
+++ b/src/graphics/FAS/temperatureDetector/TemperatureDetectorAssistant.ts
@@ -0,0 +1,131 @@
+import { DisplayObject, FederatedMouseEvent, Point } from 'pixi.js';
+import {
+ AbsorbableLine,
+ AbsorbablePosition,
+ GraphicDrawAssistant,
+ GraphicInteractionPlugin,
+ GraphicTransformEvent,
+ IDrawApp,
+ JlGraphic,
+} from 'jl-graphic';
+import {
+ ITemperatureDetectorData,
+ TemperatureDetector,
+ TemperatureDetectorTemplate,
+} from './TemperatureDetector';
+
+export class TemperatureDetectorDraw extends GraphicDrawAssistant<
+ TemperatureDetectorTemplate,
+ ITemperatureDetectorData
+> {
+ _temperatureDetector: TemperatureDetector | null = null;
+ constructor(app: IDrawApp, template: TemperatureDetectorTemplate) {
+ super(
+ app,
+ template,
+ 'svguse:../drawIcon.svg#icon-temperature-detector',
+ '温感'
+ );
+ TemperatureDetectorInteraction.init(app);
+ }
+
+ bind(): void {
+ super.bind();
+ if (!this._temperatureDetector) {
+ this._temperatureDetector = this.graphicTemplate.new();
+ this.container.addChild(this._temperatureDetector);
+ }
+ }
+
+ public get temperatureDetector(): TemperatureDetector {
+ if (!this._temperatureDetector) {
+ this._temperatureDetector = this.graphicTemplate.new();
+ this.container.addChild(this._temperatureDetector);
+ }
+ return this._temperatureDetector;
+ }
+
+ redraw(cp: Point): void {
+ this.temperatureDetector.position.copyFrom(cp);
+ }
+ onLeftUp(e: FederatedMouseEvent): void {
+ this.temperatureDetector.position.copyFrom(
+ this.toCanvasCoordinates(e.global)
+ );
+ this.createAndStore(true);
+ }
+ prepareData(data: ITemperatureDetectorData): boolean {
+ data.transform = this.temperatureDetector.saveTransform();
+ return true;
+ }
+ onEsc(): void {
+ this.finish();
+ }
+}
+
+/**
+ * 构建吸附线
+ * @param temperatureDetector
+ */
+function buildAbsorbablePositions(
+ temperatureDetector: TemperatureDetector
+): AbsorbablePosition[] {
+ const aps: AbsorbablePosition[] = [];
+ const temperatureDetectors =
+ temperatureDetector.queryStore.queryByType(
+ TemperatureDetector.Type
+ );
+ const canvas = temperatureDetector.getCanvas();
+ temperatureDetectors.forEach((item) => {
+ if (item.id === temperatureDetector.id) {
+ return;
+ }
+ const ala = new AbsorbableLine(
+ new Point(item.x, 0),
+ new Point(item.x, canvas.height)
+ );
+ const alb = new AbsorbableLine(
+ new Point(0, item.y),
+ new Point(canvas.width, item.y)
+ );
+ aps.push(ala);
+ aps.push(alb);
+ });
+
+ return aps;
+}
+
+export class TemperatureDetectorInteraction extends GraphicInteractionPlugin {
+ static Name = 'temperature_detector_transform';
+ constructor(app: IDrawApp) {
+ super(TemperatureDetectorInteraction.Name, app);
+ }
+ static init(app: IDrawApp) {
+ return new TemperatureDetectorInteraction(app);
+ }
+ filter(...grahpics: JlGraphic[]): TemperatureDetector[] | undefined {
+ return grahpics
+ .filter((g) => g.type === TemperatureDetector.Type)
+ .map((g) => g as TemperatureDetector);
+ }
+ bind(g: TemperatureDetector): void {
+ g.eventMode = 'static';
+ g.cursor = 'pointer';
+ g.scalable = true;
+ g.rotatable = true;
+ g.on('transformstart', this.transformstart, this);
+ }
+ unbind(g: TemperatureDetector): void {
+ g.eventMode = 'none';
+ g.scalable = false;
+ g.rotatable = false;
+ g.off('transformstart', this.transformstart, this);
+ }
+ transformstart(e: GraphicTransformEvent) {
+ const target = e.target as DisplayObject;
+ const temperatureDetector = target.getGraphic() as TemperatureDetector;
+ temperatureDetector.getGraphicApp().setOptions({
+ absorbablePositions: buildAbsorbablePositions(temperatureDetector),
+ });
+ }
+}
diff --git a/src/layouts/IscsDrawLayout.vue b/src/layouts/IscsDrawLayout.vue
index 331613f..777803a 100644
--- a/src/layouts/IscsDrawLayout.vue
+++ b/src/layouts/IscsDrawLayout.vue
@@ -310,6 +310,8 @@ import { FasFailureControlHost } from 'src/graphics/FAS/fireFailureControlHost/F
import { FasAlarm } from 'src/graphics/FAS/fasAlarm/FasAlarm';
import { ManualAlarmButton } from 'src/graphics/FAS/manualAlarmButton/ManualAlarmButton';
import { SmokeDetector } from 'src/graphics/FAS/smokeDetector/SmokeDetector';
+import { TemperatureDetector } from 'src/graphics/FAS/temperatureDetector/TemperatureDetector';
+import { FireShutter } from 'src/graphics/FAS/fireShutter/FireShutter';
const $q = useQuasar();
const route = useRoute();
@@ -398,6 +400,8 @@ function handleUtilsOption() {
drawAssistantsTypes.push(FasAlarm.Type);
drawAssistantsTypes.push(ManualAlarmButton.Type);
drawAssistantsTypes.push(SmokeDetector.Type);
+ drawAssistantsTypes.push(TemperatureDetector.Type);
+ drawAssistantsTypes.push(FireShutter.Type);
break;
}
drawAssistantsTypes.forEach((type) => {