From ebcfbfd891bfc9f4ed5a01ce74eec638f0b5a606 Mon Sep 17 00:00:00 2001
From: joylink_fanyuhong <18706759286@163.com>
Date: Tue, 26 Mar 2024 17:30:48 +0800
Subject: [PATCH 1/5] =?UTF-8?q?=E8=BD=A6=E5=BA=93=E9=97=A8=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E6=93=8D=E4=BD=9C&=E7=8A=B6=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/Simulation.ts | 14 ++
.../draw-app/dialogs/CkmOperation.vue | 151 ++++++++++++++
src/components/line-app/StateProperties.vue | 3 +
.../line-app/states/GarageDoorState.vue | 184 ++++++++++++++++++
src/drawApp/commonApp.ts | 10 +-
src/drawApp/graphics/GarageDoorInteraction.ts | 106 +++++++++-
src/drawApp/lineScene.ts | 3 +-
src/graphics/garageDoor/GarageDoor.ts | 22 ++-
src/protos/device_state.ts | 164 +++++++++++++++-
9 files changed, 648 insertions(+), 9 deletions(-)
create mode 100644 src/components/draw-app/dialogs/CkmOperation.vue
create mode 100644 src/components/line-app/states/GarageDoorState.vue
diff --git a/src/api/Simulation.ts b/src/api/Simulation.ts
index 3bcc8d5..ab15288 100644
--- a/src/api/Simulation.ts
+++ b/src/api/Simulation.ts
@@ -430,3 +430,17 @@ export async function updateTrainConn(data: {
}) {
return await api.post(`${UriBase}/train/conn`, data);
}
+
+/** 车库门参数修改 */
+export async function ckmUpdateParams(data: {
+ simulationId: string;
+ mapId: number;
+ deviceId: number;
+ operation: request.Ckm.Operation;
+ param: {
+ force: request.Ckm.Force;
+ fault: request.Ckm.Fault;
+ };
+}) {
+ return await api.put(`${UriBase}/ckm/operation`, data);
+}
diff --git a/src/components/draw-app/dialogs/CkmOperation.vue b/src/components/draw-app/dialogs/CkmOperation.vue
new file mode 100644
index 0000000..07a9df7
--- /dev/null
+++ b/src/components/draw-app/dialogs/CkmOperation.vue
@@ -0,0 +1,151 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/line-app/StateProperties.vue b/src/components/line-app/StateProperties.vue
index d599309..3f7915b 100644
--- a/src/components/line-app/StateProperties.vue
+++ b/src/components/line-app/StateProperties.vue
@@ -28,6 +28,7 @@
+
@@ -56,6 +57,8 @@ import SpksSwitchState from './states/SpksSwitchState.vue';
import { SpksSwitch } from 'src/graphics/spksSwitch/SpksSwitch';
import TransponderState from './states/TransponderState.vue';
import { Transponder } from 'src/graphics/transponder/Transponder';
+import { GarageDoor } from "src/graphics/garageDoor/GarageDoor";
+import GarageDoorState from './states/GarageDoorState'
const lineStore = useLineStore();
diff --git a/src/components/line-app/states/GarageDoorState.vue b/src/components/line-app/states/GarageDoorState.vue
new file mode 100644
index 0000000..f44eb4f
--- /dev/null
+++ b/src/components/line-app/states/GarageDoorState.vue
@@ -0,0 +1,184 @@
+
+
+
+ 车库门状态
+
+
+
+
+ {{ item.label }}
+
+
+
+
+
+
+
+
+
+
+ {{ item.label }}
+
+
+ {{
+ item.formatFn
+ ? item.formatFn(garageDoorState[item.key])
+ : garageDoorState[item.key]
+ }}
+
+
+
+
+
+
+
diff --git a/src/drawApp/commonApp.ts b/src/drawApp/commonApp.ts
index 5cc5549..8a7e5c6 100644
--- a/src/drawApp/commonApp.ts
+++ b/src/drawApp/commonApp.ts
@@ -160,7 +160,10 @@ import { CarWashingDraw } from 'src/graphics/carWashing/CarWashingDrawAssistant'
import { FloodGateData } from './graphics/FloodGateInteraction';
import { FloodGate, FloodGateTemplate } from 'src/graphics/floodGate/FloodGate';
import { FloodGateDraw } from 'src/graphics/floodGate/FloodGateDrawAssistant';
-import { GarageDoorData } from './graphics/GarageDoorInteraction';
+import {
+ GarageDoorData,
+ GarageDoorState,
+} from './graphics/GarageDoorInteraction';
import {
GarageDoor,
GarageDoorTemplate,
@@ -258,7 +261,10 @@ export function initCommonDrawApp(app: IDrawApp) {
);
new CarWashingDraw(app, new CarWashingTemplate(new CarWashingData()));
new FloodGateDraw(app, new FloodGateTemplate(new FloodGateData()));
- new GarageDoorDraw(app, new GarageDoorTemplate(new GarageDoorData()));
+ new GarageDoorDraw(
+ app,
+ new GarageDoorTemplate(new GarageDoorData(), new GarageDoorState())
+ );
DrawSignalInteraction.init(app);
DrawStopPositionInteraction.init(app);
DrawSpksSwitchInteraction.init(app);
diff --git a/src/drawApp/graphics/GarageDoorInteraction.ts b/src/drawApp/graphics/GarageDoorInteraction.ts
index 381b1f8..b54d11c 100644
--- a/src/drawApp/graphics/GarageDoorInteraction.ts
+++ b/src/drawApp/graphics/GarageDoorInteraction.ts
@@ -1,13 +1,25 @@
import * as pb_1 from 'google-protobuf';
-import { FederatedMouseEvent } from 'pixi.js';
+import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
import {
GarageDoor,
IGarageDoorData,
+ IGarageDoorState,
} from 'src/graphics/garageDoor/GarageDoor';
-import { GraphicInteractionPlugin, JlGraphic, IGraphicScene } from 'jl-graphic';
+import {
+ GraphicInteractionPlugin,
+ JlGraphic,
+ IGraphicScene,
+ MenuItemOptions,
+ ContextMenu,
+} from 'jl-graphic';
import { graphicData } from 'src/protos/stationLayoutGraphics';
-import { GraphicDataBase } from './GraphicDataBase';
+import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
+import { useLineStore } from 'src/stores/line-store';
+import { Dialog } from 'quasar';
+import CkmOperation from 'src/components/draw-app/dialogs/CkmOperation.vue';
+import { state } from 'src/protos/device_state';
+import { request } from 'src/protos/request';
export class GarageDoorData extends GraphicDataBase implements IGarageDoorData {
constructor(data?: graphicData.GarageDoor) {
@@ -54,10 +66,76 @@ export class GarageDoorData extends GraphicDataBase implements IGarageDoorData {
}
}
+export class GarageDoorState
+ extends GraphicStateBase
+ implements IGarageDoorState
+{
+ constructor(proto?: state.CkmState) {
+ let states;
+ if (proto) {
+ states = proto;
+ } else {
+ states = new state.CkmState();
+ }
+ super(states, GarageDoor.Type);
+ }
+ get code(): string {
+ return this.states.id + '';
+ }
+ get id(): number {
+ return this.states.id;
+ }
+ set id(id: number) {
+ this.states.id = id;
+ }
+ get mgj() {
+ return this.states.mgj;
+ }
+ set mgj(v: boolean) {
+ this.states.mgj = v;
+ }
+ get stateLoss(): boolean {
+ //状态丢失
+ return this.states.stateLoss;
+ }
+ set stateLoss(v: boolean) {
+ this.states.stateLoss = v;
+ }
+ get param(): request.CkmParam {
+ return this.states.param;
+ }
+ set param(param: request.CkmParam) {
+ this.states.param = param;
+ }
+ get states(): state.CkmState {
+ return this.getState();
+ }
+ clone(): GarageDoorState {
+ return new GarageDoorState(this.states.cloneMessage());
+ }
+ copyFrom(data: GraphicStateBase): void {
+ pb_1.Message.copyInto(data._state, this._state);
+ }
+ eq(data: GraphicStateBase): boolean {
+ return pb_1.Message.equals(this._state, data._state);
+ }
+}
+
+const setCkmrParam: MenuItemOptions = { name: '设置参数' };
+const ckmOperateMenu: ContextMenu = ContextMenu.init({
+ name: '屏蔽门操作菜单',
+ groups: [
+ {
+ items: [setCkmrParam],
+ },
+ ],
+});
+
export class GarageDoorOperationInteraction extends GraphicInteractionPlugin {
static Name = 'garage_door_operation';
constructor(scene: IGraphicScene) {
super(GarageDoorOperationInteraction.Name, scene);
+ scene.registerMenu(ckmOperateMenu);
}
static init(scene: IGraphicScene) {
return new GarageDoorOperationInteraction(scene);
@@ -85,4 +163,26 @@ export class GarageDoorOperationInteraction extends GraphicInteractionPlugin();
+ if (!garageDoor) return;
+ this.app.updateSelected(garageDoor);
+ const lineStore = useLineStore();
+ setCkmrParam.handler = async () => {
+ if (lineStore.deviceOpreratDialogInstance) return;
+ lineStore.deviceOpreratDialogInstance = Dialog.create({
+ component: CkmOperation,
+ componentProps: {
+ id: garageDoor.id,
+ code: garageDoor.datas.code,
+ garageDoorForceProp: garageDoor.states.param.force,
+ garageDoorFaultProp: garageDoor.states.param.fault,
+ },
+ cancel: true,
+ persistent: true,
+ });
+ };
+ ckmOperateMenu.open(e.global);
+ }
}
diff --git a/src/drawApp/lineScene.ts b/src/drawApp/lineScene.ts
index ced567e..a7ec184 100644
--- a/src/drawApp/lineScene.ts
+++ b/src/drawApp/lineScene.ts
@@ -37,6 +37,7 @@ import {
import {
GarageDoorData,
GarageDoorOperationInteraction,
+ GarageDoorState,
} from './graphics/GarageDoorInteraction';
import {
GarageDoor,
@@ -333,7 +334,7 @@ export function initLineScene(lineApp: IGraphicApp, sceneName: string) {
new AutoReturnBoxState()
),
new CarWashingTemplate(new CarWashingData()),
- new GarageDoorTemplate(new GarageDoorData()),
+ new GarageDoorTemplate(new GarageDoorData(), new GarageDoorState()),
new FloodGateTemplate(new FloodGateData()),
new GarageDoorBoxTemplate(new GarageDoorBoxData()),
];
diff --git a/src/graphics/garageDoor/GarageDoor.ts b/src/graphics/garageDoor/GarageDoor.ts
index 4c0b7c3..933bb7a 100644
--- a/src/graphics/garageDoor/GarageDoor.ts
+++ b/src/graphics/garageDoor/GarageDoor.ts
@@ -1,10 +1,12 @@
import { Graphics } from 'pixi.js';
import {
GraphicData,
+ GraphicState,
JlGraphic,
JlGraphicTemplate,
VectorText,
} from 'jl-graphic';
+import { request } from 'src/protos/request';
export interface IGarageDoorData extends GraphicData {
get code(): string;
@@ -18,6 +20,17 @@ export interface IGarageDoorData extends GraphicData {
eq(other: IGarageDoorData): boolean;
}
+export interface IGarageDoorState extends GraphicState {
+ get id(): number;
+ set id(v: number);
+ get mgj(): boolean; //车库门关闭继电器
+ set mgj(v: boolean);
+ get param(): request.CkmParam;
+ set param(v: request.CkmParam);
+ get stateLoss(): boolean; //状态丢失
+ set stateLoss(v: boolean);
+}
+
const garageConsts = {
codeFontSize: 12,
codeColor: 0xffffff,
@@ -44,6 +57,10 @@ export class GarageDoor extends JlGraphic {
get datas(): IGarageDoorData {
return this.getDatas();
}
+
+ get states(): IGarageDoorState {
+ return this.getStates();
+ }
doRepaint(): void {
const codeGraph = this.codeGraph;
codeGraph.text = this.datas.code;
@@ -88,12 +105,13 @@ export class GarageDoor extends JlGraphic {
}
export class GarageDoorTemplate extends JlGraphicTemplate {
- constructor(dataTemplate: IGarageDoorData) {
- super(GarageDoor.Type, { dataTemplate });
+ constructor(dataTemplate: IGarageDoorData, stateTemplate?: IGarageDoorState) {
+ super(GarageDoor.Type, { dataTemplate, stateTemplate });
}
new(): GarageDoor {
const garageDoor = new GarageDoor();
garageDoor.loadData(this.datas);
+ garageDoor.loadState(this.states);
return garageDoor;
}
}
diff --git a/src/protos/device_state.ts b/src/protos/device_state.ts
index 1228222..86fa582 100644
--- a/src/protos/device_state.ts
+++ b/src/protos/device_state.ts
@@ -6873,6 +6873,145 @@ export namespace state {
}
}
}
+ export class CkmState extends pb_1.Message {
+ #one_of_decls: number[][] = [];
+ constructor(data?: any[] | {
+ id?: number;
+ mgj?: boolean;
+ param?: dependency_3.request.CkmParam;
+ stateLoss?: boolean;
+ }) {
+ super();
+ pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
+ if (!Array.isArray(data) && typeof data == "object") {
+ if ("id" in data && data.id != undefined) {
+ this.id = data.id;
+ }
+ if ("mgj" in data && data.mgj != undefined) {
+ this.mgj = data.mgj;
+ }
+ if ("param" in data && data.param != undefined) {
+ this.param = data.param;
+ }
+ if ("stateLoss" in data && data.stateLoss != undefined) {
+ this.stateLoss = data.stateLoss;
+ }
+ }
+ }
+ get id() {
+ return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
+ }
+ set id(value: number) {
+ pb_1.Message.setField(this, 1, value);
+ }
+ get mgj() {
+ return pb_1.Message.getFieldWithDefault(this, 2, false) as boolean;
+ }
+ set mgj(value: boolean) {
+ pb_1.Message.setField(this, 2, value);
+ }
+ get param() {
+ return pb_1.Message.getWrapperField(this, dependency_3.request.CkmParam, 3) as dependency_3.request.CkmParam;
+ }
+ set param(value: dependency_3.request.CkmParam) {
+ pb_1.Message.setWrapperField(this, 3, value);
+ }
+ get has_param() {
+ return pb_1.Message.getField(this, 3) != null;
+ }
+ get stateLoss() {
+ return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean;
+ }
+ set stateLoss(value: boolean) {
+ pb_1.Message.setField(this, 4, value);
+ }
+ static fromObject(data: {
+ id?: number;
+ mgj?: boolean;
+ param?: ReturnType;
+ stateLoss?: boolean;
+ }): CkmState {
+ const message = new CkmState({});
+ if (data.id != null) {
+ message.id = data.id;
+ }
+ if (data.mgj != null) {
+ message.mgj = data.mgj;
+ }
+ if (data.param != null) {
+ message.param = dependency_3.request.CkmParam.fromObject(data.param);
+ }
+ if (data.stateLoss != null) {
+ message.stateLoss = data.stateLoss;
+ }
+ return message;
+ }
+ toObject() {
+ const data: {
+ id?: number;
+ mgj?: boolean;
+ param?: ReturnType;
+ stateLoss?: boolean;
+ } = {};
+ if (this.id != null) {
+ data.id = this.id;
+ }
+ if (this.mgj != null) {
+ data.mgj = this.mgj;
+ }
+ if (this.param != null) {
+ data.param = this.param.toObject();
+ }
+ if (this.stateLoss != null) {
+ data.stateLoss = this.stateLoss;
+ }
+ return data;
+ }
+ serialize(): Uint8Array;
+ serialize(w: pb_1.BinaryWriter): void;
+ serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
+ const writer = w || new pb_1.BinaryWriter();
+ if (this.id != 0)
+ writer.writeUint32(1, this.id);
+ if (this.mgj != false)
+ writer.writeBool(2, this.mgj);
+ if (this.has_param)
+ writer.writeMessage(3, this.param, () => this.param.serialize(writer));
+ if (this.stateLoss != false)
+ writer.writeBool(4, this.stateLoss);
+ if (!w)
+ return writer.getResultBuffer();
+ }
+ static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CkmState {
+ const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CkmState();
+ while (reader.nextField()) {
+ if (reader.isEndGroup())
+ break;
+ switch (reader.getFieldNumber()) {
+ case 1:
+ message.id = reader.readUint32();
+ break;
+ case 2:
+ message.mgj = reader.readBool();
+ break;
+ case 3:
+ reader.readMessage(message.param, () => message.param = dependency_3.request.CkmParam.deserialize(reader));
+ break;
+ case 4:
+ message.stateLoss = reader.readBool();
+ break;
+ default: reader.skipField();
+ }
+ }
+ return message;
+ }
+ serializeBinary(): Uint8Array {
+ return this.serialize();
+ }
+ static deserializeBinary(bytes: Uint8Array): CkmState {
+ return CkmState.deserialize(bytes);
+ }
+ }
export class VariationStatus extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
@@ -7048,9 +7187,10 @@ export namespace state {
platformState?: PlatformState[];
baliseState?: BaliseState[];
stationQc?: StationQc;
+ ckmStates?: CkmState[];
}) {
super();
- pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], this.#one_of_decls);
+ pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("trainState" in data && data.trainState != undefined) {
this.trainState = data.trainState;
@@ -7091,6 +7231,9 @@ export namespace state {
if ("stationQc" in data && data.stationQc != undefined) {
this.stationQc = data.stationQc;
}
+ if ("ckmStates" in data && data.ckmStates != undefined) {
+ this.ckmStates = data.ckmStates;
+ }
}
}
get trainState() {
@@ -7174,6 +7317,12 @@ export namespace state {
get has_stationQc() {
return pb_1.Message.getField(this, 13) != null;
}
+ get ckmStates() {
+ return pb_1.Message.getRepeatedWrapperField(this, CkmState, 14) as CkmState[];
+ }
+ set ckmStates(value: CkmState[]) {
+ pb_1.Message.setRepeatedWrapperField(this, 14, value);
+ }
static fromObject(data: {
trainState?: ReturnType[];
switchState?: ReturnType[];
@@ -7188,6 +7337,7 @@ export namespace state {
platformState?: ReturnType[];
baliseState?: ReturnType[];
stationQc?: ReturnType;
+ ckmStates?: ReturnType[];
}): AllDevicesStatus {
const message = new AllDevicesStatus({});
if (data.trainState != null) {
@@ -7229,6 +7379,9 @@ export namespace state {
if (data.stationQc != null) {
message.stationQc = StationQc.fromObject(data.stationQc);
}
+ if (data.ckmStates != null) {
+ message.ckmStates = data.ckmStates.map(item => CkmState.fromObject(item));
+ }
return message;
}
toObject() {
@@ -7246,6 +7399,7 @@ export namespace state {
platformState?: ReturnType[];
baliseState?: ReturnType[];
stationQc?: ReturnType;
+ ckmStates?: ReturnType[];
} = {};
if (this.trainState != null) {
data.trainState = this.trainState.map((item: TrainMapState) => item.toObject());
@@ -7286,6 +7440,9 @@ export namespace state {
if (this.stationQc != null) {
data.stationQc = this.stationQc.toObject();
}
+ if (this.ckmStates != null) {
+ data.ckmStates = this.ckmStates.map((item: CkmState) => item.toObject());
+ }
return data;
}
serialize(): Uint8Array;
@@ -7318,6 +7475,8 @@ export namespace state {
writer.writeRepeatedMessage(12, this.baliseState, (item: BaliseState) => item.serialize(writer));
if (this.has_stationQc)
writer.writeMessage(13, this.stationQc, () => this.stationQc.serialize(writer));
+ if (this.ckmStates.length)
+ writer.writeRepeatedMessage(14, this.ckmStates, (item: CkmState) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@@ -7366,6 +7525,9 @@ export namespace state {
case 13:
reader.readMessage(message.stationQc, () => message.stationQc = StationQc.deserialize(reader));
break;
+ case 14:
+ reader.readMessage(message.ckmStates, () => pb_1.Message.addToRepeatedWrapperField(message, 14, CkmState.deserialize(reader), CkmState));
+ break;
default: reader.skipField();
}
}
From 6e1b972d2fa0194ff5658ae94a0f1be556c2aa2e Mon Sep 17 00:00:00 2001
From: joylink_fanyuhong <18706759286@163.com>
Date: Tue, 26 Mar 2024 17:32:28 +0800
Subject: [PATCH 2/5] =?UTF-8?q?=E5=90=8C=E6=AD=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
rts-sim-testing-message | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rts-sim-testing-message b/rts-sim-testing-message
index 86b35d3..f9034ba 160000
--- a/rts-sim-testing-message
+++ b/rts-sim-testing-message
@@ -1 +1 @@
-Subproject commit 86b35d3ead9a269f812b105d8a30a43c019da8bc
+Subproject commit f9034ba53d9b201140e9e43dbe8f5b8faa21633a
From e2ac7e4ae546e7dd501f9f7c5f7086dd97217189 Mon Sep 17 00:00:00 2001
From: joylink_zhaoerwei
Date: Wed, 27 Mar 2024 12:14:15 +0800
Subject: [PATCH 3/5] =?UTF-8?q?=E7=BB=A7=E7=94=B5=E5=99=A8K=E5=8F=98?=
=?UTF-8?q?=E5=A4=A7=E5=86=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/layouts/RelayCabinetLayout/GeneraterCiCjConfig.ts | 2 +-
src/layouts/RelayCabinetLayout/GeneraterCiQdConfig.ts | 2 +-
src/layouts/RelayCabinetLayout/GeneraterRelayLayoutConfig.ts | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/layouts/RelayCabinetLayout/GeneraterCiCjConfig.ts b/src/layouts/RelayCabinetLayout/GeneraterCiCjConfig.ts
index 51db77b..cb5224d 100644
--- a/src/layouts/RelayCabinetLayout/GeneraterCiCjConfig.ts
+++ b/src/layouts/RelayCabinetLayout/GeneraterCiCjConfig.ts
@@ -684,7 +684,7 @@ const garageDoorCjList = [
],
[
{
- code: 'kMJ',
+ code: 'KMJ',
position: PostionType.Q,
},
],
diff --git a/src/layouts/RelayCabinetLayout/GeneraterCiQdConfig.ts b/src/layouts/RelayCabinetLayout/GeneraterCiQdConfig.ts
index 087b2b0..0b60b11 100644
--- a/src/layouts/RelayCabinetLayout/GeneraterCiQdConfig.ts
+++ b/src/layouts/RelayCabinetLayout/GeneraterCiQdConfig.ts
@@ -99,7 +99,7 @@ upScreenDoorQdList.forEach((qdData) => {
const garageDoorQdList = [
{
code: 'CKM',
- refDeviceCodes: [['kMJ'], ['GMJ']],
+ refDeviceCodes: [['KMJ'], ['GMJ']],
},
];
diff --git a/src/layouts/RelayCabinetLayout/GeneraterRelayLayoutConfig.ts b/src/layouts/RelayCabinetLayout/GeneraterRelayLayoutConfig.ts
index 9a7904c..77cd90b 100644
--- a/src/layouts/RelayCabinetLayout/GeneraterRelayLayoutConfig.ts
+++ b/src/layouts/RelayCabinetLayout/GeneraterRelayLayoutConfig.ts
@@ -453,7 +453,7 @@ const garageDoorCombinations = [
model: RelayModelType.JWXC_1700,
},
{
- code: 'kMJ',
+ code: 'KMJ',
model: RelayModelType.JWXC_1700,
},
{
From 0a2641c20fada35b21627c8b42eb1ba796666061 Mon Sep 17 00:00:00 2001
From: joylink_zhaoerwei
Date: Wed, 27 Mar 2024 13:43:00 +0800
Subject: [PATCH 4/5] =?UTF-8?q?=E4=B8=80=E9=94=AE=E7=94=9F=E6=88=90?=
=?UTF-8?q?=E7=BB=A7=E7=94=B5=E5=99=A8=E4=BF=AE=E6=94=B9=EF=BC=9A=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=E8=BE=B9=E7=95=8C=E6=9D=A1=E4=BB=B6=E7=9A=84=E5=88=A4?=
=?UTF-8?q?=E6=96=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/drawApp/relayCabinetLayoutApp.ts | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/drawApp/relayCabinetLayoutApp.ts b/src/drawApp/relayCabinetLayoutApp.ts
index 488d0ff..4ce2a6d 100644
--- a/src/drawApp/relayCabinetLayoutApp.ts
+++ b/src/drawApp/relayCabinetLayoutApp.ts
@@ -435,7 +435,11 @@ export function creatCiCjListByCombinationtype(
ciCjList.cjList[i] = new relayCabinetGraphicData.CjDataSet();
ciCjList.cjList[i].name = 'D' + (i + 1);
for (let j = 0; j < rows; j++) {
- if (i < cols - 1 || (i == cols - 1 && j < allCjData.length % rows)) {
+ if (
+ i < cols - 1 ||
+ (i == cols - 1 && j < allCjData.length % rows) ||
+ (i == cols - 1 && allCjData.length % rows == 0)
+ ) {
ciCjList.cjList[i].bitList[j] = allCjData[i * rows + j];
} else {
ciCjList.cjList[i].bitList[j] = new relayCabinetGraphicData.CjData();
From f21690988d16fe815894dc0e851e51338444349f Mon Sep 17 00:00:00 2001
From: joylink_fanyuhong <18706759286@163.com>
Date: Wed, 27 Mar 2024 14:11:49 +0800
Subject: [PATCH 5/5] =?UTF-8?q?=E8=BD=A6=E5=BA=93=E9=97=A8=E8=B0=83?=
=?UTF-8?q?=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../properties/GarageDoorBoxProperty.vue | 2 +-
src/components/line-app/StateProperties.vue | 8 +++--
.../line-app/states/GarageDoorState.vue | 4 +--
src/configs/UrlManage.ts | 2 +-
src/drawApp/graphics/GarageDoorInteraction.ts | 34 ++++++++-----------
src/drawApp/lineScene.ts | 5 +++
src/graphics/carWashing/CarWashing.ts | 26 ++++++++++++++
src/graphics/floodGate/FloodGate.ts | 27 +++++++++++++++
src/graphics/garageDoor/GarageDoor.ts | 27 +++++++++++++++
.../garageDoor/GarageDoorDrawAssistant.ts | 18 +++++++++-
10 files changed, 125 insertions(+), 28 deletions(-)
diff --git a/src/components/draw-app/properties/GarageDoorBoxProperty.vue b/src/components/draw-app/properties/GarageDoorBoxProperty.vue
index e861091..891e572 100644
--- a/src/components/draw-app/properties/GarageDoorBoxProperty.vue
+++ b/src/components/draw-app/properties/GarageDoorBoxProperty.vue
@@ -23,7 +23,7 @@
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
- label="关联屏蔽门"
+ label="关联车库门"
>
-
+
@@ -57,8 +59,8 @@ import SpksSwitchState from './states/SpksSwitchState.vue';
import { SpksSwitch } from 'src/graphics/spksSwitch/SpksSwitch';
import TransponderState from './states/TransponderState.vue';
import { Transponder } from 'src/graphics/transponder/Transponder';
-import { GarageDoor } from "src/graphics/garageDoor/GarageDoor";
-import GarageDoorState from './states/GarageDoorState'
+import { GarageDoor } from 'src/graphics/garageDoor/GarageDoor';
+import GarageDoorState from './states/GarageDoorState.vue';
const lineStore = useLineStore();
diff --git a/src/components/line-app/states/GarageDoorState.vue b/src/components/line-app/states/GarageDoorState.vue
index f44eb4f..43357c3 100644
--- a/src/components/line-app/states/GarageDoorState.vue
+++ b/src/components/line-app/states/GarageDoorState.vue
@@ -157,8 +157,8 @@ function doGarageDoorOperation(item: {
componentProps: {
id: +garageDoorState.value.id,
code: code.value,
- garageDoorForceProp: garageDoorState.value.param.force,
- garageDoorFaultProp: garageDoorState.value.param.fault,
+ ckmForceProp: garageDoorState.value.param.force,
+ ckmFaultProp: garageDoorState.value.param.fault,
},
cancel: true,
persistent: true,
diff --git a/src/configs/UrlManage.ts b/src/configs/UrlManage.ts
index 815e4f8..8ce526e 100644
--- a/src/configs/UrlManage.ts
+++ b/src/configs/UrlManage.ts
@@ -7,7 +7,7 @@ function getHost(): string {
// return '192.168.3.7:9091';
// return '192.168.3.47:9091';
// return '192.168.3.37:9091';
- // return '192.168.33.207:9091'; // 张骞
+ return '192.168.33.207:9091'; // 张骞
// return '192.168.33.93:9091';
// return '192.168.3.37:9091'; //卫志宏
// return 'test.joylink.club/bjrtsts-service'; // 测试
diff --git a/src/drawApp/graphics/GarageDoorInteraction.ts b/src/drawApp/graphics/GarageDoorInteraction.ts
index b54d11c..ee2b9ee 100644
--- a/src/drawApp/graphics/GarageDoorInteraction.ts
+++ b/src/drawApp/graphics/GarageDoorInteraction.ts
@@ -20,6 +20,7 @@ import { Dialog } from 'quasar';
import CkmOperation from 'src/components/draw-app/dialogs/CkmOperation.vue';
import { state } from 'src/protos/device_state';
import { request } from 'src/protos/request';
+import { GarageDoorGraphicHitArea } from 'src/graphics/garageDoor/GarageDoorDrawAssistant';
export class GarageDoorData extends GraphicDataBase implements IGarageDoorData {
constructor(data?: graphicData.GarageDoor) {
@@ -133,41 +134,34 @@ const ckmOperateMenu: ContextMenu = ContextMenu.init({
export class GarageDoorOperationInteraction extends GraphicInteractionPlugin {
static Name = 'garage_door_operation';
- constructor(scene: IGraphicScene) {
- super(GarageDoorOperationInteraction.Name, scene);
- scene.registerMenu(ckmOperateMenu);
+ constructor(app: IGraphicScene) {
+ super(GarageDoorOperationInteraction.Name, app);
+ app.registerMenu(ckmOperateMenu);
}
- static init(scene: IGraphicScene) {
- return new GarageDoorOperationInteraction(scene);
+ static init(app: IGraphicScene) {
+ return new GarageDoorOperationInteraction(app);
}
filter(...grahpics: JlGraphic[]): GarageDoor[] | undefined {
return grahpics.filter((g): g is GarageDoor => g.type === GarageDoor.Type);
}
bind(g: GarageDoor): void {
g.eventMode = 'static';
+ g.hitArea = new GarageDoorGraphicHitArea(g);
g.cursor = 'pointer';
- g.on('mousedown', this.onPress, this);
+ g.selectable = true;
+ g.on('_rightclick', this.onContextMenu);
}
unbind(g: GarageDoor): void {
g.eventMode = 'none';
g.cursor = 'default';
- g.off('mousedown', this.onPress, this);
- }
- onPress(e: FederatedMouseEvent) {
- const g = e.target as GarageDoor;
- g.on('mouseleave', this.onRelease, this);
- g.on('mouseup', this.onRelease, this);
- }
- onRelease(e: FederatedMouseEvent) {
- const g = e.target as GarageDoor;
- g.off('mouseleave', this.onRelease, this);
- g.off('mouseup', this.onRelease, this);
+ g.selectable = false;
+ g.off('_rightclick', this.onContextMenu);
}
+
onContextMenu(e: FederatedMouseEvent) {
const target = e.target as DisplayObject;
const garageDoor = target.getGraphic();
if (!garageDoor) return;
- this.app.updateSelected(garageDoor);
const lineStore = useLineStore();
setCkmrParam.handler = async () => {
if (lineStore.deviceOpreratDialogInstance) return;
@@ -176,8 +170,8 @@ export class GarageDoorOperationInteraction extends GraphicInteractionPlugin {
+ if (item.id) {
+ states.push(new GarageDoorState(item));
+ }
+ });
storage.allStatus.trainState.forEach((item) => {
// 列车
if (!item.show) {
diff --git a/src/graphics/carWashing/CarWashing.ts b/src/graphics/carWashing/CarWashing.ts
index c88e273..f30f5ca 100644
--- a/src/graphics/carWashing/CarWashing.ts
+++ b/src/graphics/carWashing/CarWashing.ts
@@ -4,7 +4,9 @@ import {
JlGraphic,
JlGraphicTemplate,
VectorText,
+ linePoint,
} from 'jl-graphic';
+import { Section, SectionType } from '../section/Section';
export interface ICarWashingData extends GraphicData {
get code(): string;
@@ -75,6 +77,30 @@ export class CarWashing extends JlGraphic {
);
this.rectBody.endFill();
}
+ buildRelation() {
+ const sections = this.queryStore
+ .queryByType(Section.Type)
+ .filter((s) => s.datas.sectionType === SectionType.Physical);
+ let xj = false;
+ const se = sections.find((section) => {
+ const points = section.linePoints;
+ points.forEach((point, index) => {
+ if (index !== 0) {
+ xj =
+ linePoint(
+ section.localToCanvasPoint(points[index - 1]),
+ section.localToCanvasPoint(point),
+ this.localToCanvasPoint({ x: 0, y: 0 }),
+ 8
+ ) || xj;
+ }
+ });
+ return xj;
+ });
+ if (se) {
+ this.datas.linkSection = se.datas.id;
+ }
+ }
}
export class CarWashingTemplate extends JlGraphicTemplate {
diff --git a/src/graphics/floodGate/FloodGate.ts b/src/graphics/floodGate/FloodGate.ts
index 512f5e6..9a1eadd 100644
--- a/src/graphics/floodGate/FloodGate.ts
+++ b/src/graphics/floodGate/FloodGate.ts
@@ -4,7 +4,9 @@ import {
JlGraphic,
JlGraphicTemplate,
VectorText,
+ linePoint,
} from 'jl-graphic';
+import { Section, SectionType } from '../section/Section';
export interface IFloodGateData extends GraphicData {
get code(): string;
@@ -85,6 +87,31 @@ export class FloodGate extends JlGraphic {
this.lineBody.moveTo(0, -floodGateConsts.bodyRectHeight / 2);
this.lineBody.lineTo(0, floodGateConsts.bodyRectHeight / 2);
}
+
+ buildRelation() {
+ const sections = this.queryStore
+ .queryByType(Section.Type)
+ .filter((s) => s.datas.sectionType === SectionType.Physical);
+ let xj = false;
+ const se = sections.find((section) => {
+ const points = section.linePoints;
+ points.forEach((point, index) => {
+ if (index !== 0) {
+ xj =
+ linePoint(
+ section.localToCanvasPoint(points[index - 1]),
+ section.localToCanvasPoint(point),
+ this.localToCanvasPoint({ x: 0, y: 0 }),
+ 8
+ ) || xj;
+ }
+ });
+ return xj;
+ });
+ if (se) {
+ this.datas.linkSection = se.datas.id;
+ }
+ }
}
export class FloodGateTemplate extends JlGraphicTemplate {
diff --git a/src/graphics/garageDoor/GarageDoor.ts b/src/graphics/garageDoor/GarageDoor.ts
index 933bb7a..6aa6805 100644
--- a/src/graphics/garageDoor/GarageDoor.ts
+++ b/src/graphics/garageDoor/GarageDoor.ts
@@ -5,8 +5,10 @@ import {
JlGraphic,
JlGraphicTemplate,
VectorText,
+ linePoint,
} from 'jl-graphic';
import { request } from 'src/protos/request';
+import { Section, SectionType } from '../section/Section';
export interface IGarageDoorData extends GraphicData {
get code(): string;
@@ -102,6 +104,31 @@ export class GarageDoor extends JlGraphic {
this.lineBody.moveTo(0, -garageConsts.bodyRectHeight / 2);
this.lineBody.lineTo(0, garageConsts.bodyRectHeight / 2);
}
+
+ buildRelation() {
+ const sections = this.queryStore
+ .queryByType(Section.Type)
+ .filter((s) => s.datas.sectionType === SectionType.Physical);
+ let xj = false;
+ const se = sections.find((section) => {
+ const points = section.linePoints;
+ points.forEach((point, index) => {
+ if (index !== 0) {
+ xj =
+ linePoint(
+ section.localToCanvasPoint(points[index - 1]),
+ section.localToCanvasPoint(point),
+ this.localToCanvasPoint({ x: 0, y: 0 }),
+ 8
+ ) || xj;
+ }
+ });
+ return xj;
+ });
+ if (se) {
+ this.datas.linkSection = se.datas.id;
+ }
+ }
}
export class GarageDoorTemplate extends JlGraphicTemplate {
diff --git a/src/graphics/garageDoor/GarageDoorDrawAssistant.ts b/src/graphics/garageDoor/GarageDoorDrawAssistant.ts
index ab07d05..08bdcc0 100644
--- a/src/graphics/garageDoor/GarageDoorDrawAssistant.ts
+++ b/src/graphics/garageDoor/GarageDoorDrawAssistant.ts
@@ -1,4 +1,4 @@
-import { DisplayObject, FederatedMouseEvent, Point } from 'pixi.js';
+import { DisplayObject, FederatedMouseEvent, Point, IHitArea } from 'pixi.js';
import {
AbsorbableLine,
AbsorbablePosition,
@@ -82,6 +82,21 @@ function buildAbsorbablePositions(
return aps;
}
+export class GarageDoorGraphicHitArea implements IHitArea {
+ garageDoor: GarageDoor;
+ constructor(garageDoor: GarageDoor) {
+ this.garageDoor = garageDoor;
+ }
+ contains(x: number, y: number): boolean {
+ const bound = this.garageDoor.getLocalBounds();
+ const maxX = bound.x + bound.width;
+ const minX = bound.x;
+ const maxY = bound.y + bound.height;
+ const minY = bound.y;
+ return maxX >= x && x >= minX && maxY >= y && y >= minY;
+ }
+}
+
export class GarageDoorInteraction extends GraphicInteractionPlugin {
static Name = 'garage_door_transform';
constructor(app: IDrawApp) {
@@ -100,6 +115,7 @@ export class GarageDoorInteraction extends GraphicInteractionPlugin
g.cursor = 'pointer';
g.scalable = true;
g.rotatable = true;
+ g.hitArea = new GarageDoorGraphicHitArea(g);
g.codeGraph.draggable = true;
g.codeGraph.selectable = true;
g.codeGraph.rotatable = true;