道岔占用显示调整 && 区段状态展示

This commit is contained in:
Yuan 2023-11-14 10:29:51 +08:00
parent 91984105e5
commit 5e58b5c87e
3 changed files with 35 additions and 37 deletions

View File

@ -43,13 +43,24 @@
/> />
</q-form> </q-form>
<q-list dense bordered padding class="rounded-borders q-my-sm"> <q-list dense bordered padding class="rounded-borders q-my-sm">
<q-item>
<q-item-section>
<q-checkbox
dense
v-model="sectionState.occupied"
outlined
label="是否占用"
:disable="true"
/>
</q-item-section>
</q-item>
<q-item> <q-item>
<q-item-section> <q-item-section>
<q-checkbox <q-checkbox
dense dense
v-model="sectionState.axleFault" v-model="sectionState.axleFault"
outlined outlined
label="是否故障占用" label="是否计轴故障"
:disable="true" :disable="true"
/> />
</q-item-section> </q-item-section>
@ -70,7 +81,13 @@ import { SectionStates } from 'src/drawApp/graphics/SectionInteraction';
const $q = useQuasar(); const $q = useQuasar();
const lineStore = useLineStore(); const lineStore = useLineStore();
const sectionState = ref({ id: '', index: 0, code: '', axleFault: false }); const sectionState = ref({
id: '',
index: 0,
code: '',
axleFault: false,
occupied: false,
});
watch( watch(
() => lineStore.selectedGraphics, () => lineStore.selectedGraphics,
@ -83,6 +100,7 @@ watch(
index: 0, index: 0,
code: '', code: '',
axleFault: false, axleFault: false,
occupied: false,
}; };
} }
} }
@ -97,6 +115,7 @@ function setSectionState(section: Section) {
index: section.datas.index, index: section.datas.index,
code: section.datas.code, code: section.datas.code,
axleFault: section.states.axleFault ?? false, axleFault: section.states.axleFault ?? false,
occupied: section.states.occupied ?? false,
}; };
} }
@ -168,6 +187,7 @@ watch(
id: find.id, id: find.id,
code: find.code, code: find.code,
axleFault: find.axleFault, axleFault: find.axleFault,
occupied: find.occupied,
}; };
} }
} }

View File

@ -126,9 +126,16 @@ export class TurnoutSection extends Graphics {
break; break;
} }
const gap = this.port === TurnoutPort.A ? 0 : TurnoutConsts.forkLenth; const gap = this.port === TurnoutPort.A ? 0 : TurnoutConsts.forkLenth;
const color = this.turnout.states.occupied let color = TurnoutConsts.lineColor;
? TurnoutConsts.occupiedColor if (this.turnout.states.occupied) {
: TurnoutConsts.lineColor; if (
this.port === TurnoutPort.A ||
(this.turnout.states.dw && this.port === TurnoutPort.B) ||
(this.turnout.states.fw && this.port === TurnoutPort.C)
) {
color = TurnoutConsts.occupiedColor;
}
}
const start = getForkPoint(gap, pList[0]); const start = getForkPoint(gap, pList[0]);
this.clear() this.clear()
.lineStyle(TurnoutConsts.lineWidth, color) .lineStyle(TurnoutConsts.lineWidth, color)
@ -212,30 +219,24 @@ export class Turnout extends JlGraphic {
} }
doRepaint(): void { doRepaint(): void {
// console.log(this.states);
const { pointB, pointC } = this.datas; const { pointB, pointC } = this.datas;
if (this.states.dw) { if (this.states.dw) {
this.graphics.fork.paint(pointB[0]); this.graphics.fork.paint(pointB[0]);
this.graphics.label.style.stroke = TurnoutConsts.normalLabelColor; this.graphics.label.style.stroke = TurnoutConsts.normalLabelColor;
this.graphics.fork.visible = true;
} else if (this.states.fw) { } else if (this.states.fw) {
this.graphics.fork.paint(pointC[0]); this.graphics.fork.paint(pointC[0]);
this.graphics.label.style.stroke = TurnoutConsts.reverseLabelColor; this.graphics.label.style.stroke = TurnoutConsts.reverseLabelColor;
this.graphics.fork.visible = true;
} }
this.graphics.label.text = this.datas.code;
this.graphics.sections.forEach((sectionGraphic) => sectionGraphic.paint()); this.graphics.sections.forEach((sectionGraphic) => sectionGraphic.paint());
this.graphics.label.text = this.datas.code;
if (!this.states.dw && !this.states.fw) { if (!this.states.dw && !this.states.fw) {
// 失表 // 失表
this.graphics.fork.visible = false; this.graphics.fork.visible = false;
} else {
this.graphics.fork.visible = true;
} }
// if (this.states.split) {
// this.initTurnoutSplit();
// } else {
// this.stopTurnoutSplit();
// }
} }
initTurnoutSplit() { initTurnoutSplit() {
// 道岔失表 // 道岔失表

View File

@ -1015,7 +1015,6 @@ export namespace state {
vobcState?: TrainVobcState; vobcState?: TrainVobcState;
trainKilometer?: number; trainKilometer?: number;
controlDelayTime?: number; controlDelayTime?: number;
wheelDiameter?: number;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -1065,9 +1064,6 @@ export namespace state {
if ("controlDelayTime" in data && data.controlDelayTime != undefined) { if ("controlDelayTime" in data && data.controlDelayTime != undefined) {
this.controlDelayTime = data.controlDelayTime; this.controlDelayTime = data.controlDelayTime;
} }
if ("wheelDiameter" in data && data.wheelDiameter != undefined) {
this.wheelDiameter = data.wheelDiameter;
}
} }
} }
get id() { get id() {
@ -1166,12 +1162,6 @@ export namespace state {
set controlDelayTime(value: number) { set controlDelayTime(value: number) {
pb_1.Message.setField(this, 15, value); pb_1.Message.setField(this, 15, value);
} }
get wheelDiameter() {
return pb_1.Message.getFieldWithDefault(this, 16, 0) as number;
}
set wheelDiameter(value: number) {
pb_1.Message.setField(this, 16, value);
}
static fromObject(data: { static fromObject(data: {
id?: string; id?: string;
up?: boolean; up?: boolean;
@ -1188,7 +1178,6 @@ export namespace state {
vobcState?: ReturnType<typeof TrainVobcState.prototype.toObject>; vobcState?: ReturnType<typeof TrainVobcState.prototype.toObject>;
trainKilometer?: number; trainKilometer?: number;
controlDelayTime?: number; controlDelayTime?: number;
wheelDiameter?: number;
}): TrainState { }): TrainState {
const message = new TrainState({}); const message = new TrainState({});
if (data.id != null) { if (data.id != null) {
@ -1236,9 +1225,6 @@ export namespace state {
if (data.controlDelayTime != null) { if (data.controlDelayTime != null) {
message.controlDelayTime = data.controlDelayTime; message.controlDelayTime = data.controlDelayTime;
} }
if (data.wheelDiameter != null) {
message.wheelDiameter = data.wheelDiameter;
}
return message; return message;
} }
toObject() { toObject() {
@ -1258,7 +1244,6 @@ export namespace state {
vobcState?: ReturnType<typeof TrainVobcState.prototype.toObject>; vobcState?: ReturnType<typeof TrainVobcState.prototype.toObject>;
trainKilometer?: number; trainKilometer?: number;
controlDelayTime?: number; controlDelayTime?: number;
wheelDiameter?: number;
} = {}; } = {};
if (this.id != null) { if (this.id != null) {
data.id = this.id; data.id = this.id;
@ -1305,9 +1290,6 @@ export namespace state {
if (this.controlDelayTime != null) { if (this.controlDelayTime != null) {
data.controlDelayTime = this.controlDelayTime; data.controlDelayTime = this.controlDelayTime;
} }
if (this.wheelDiameter != null) {
data.wheelDiameter = this.wheelDiameter;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -1344,8 +1326,6 @@ export namespace state {
writer.writeInt64(14, this.trainKilometer); writer.writeInt64(14, this.trainKilometer);
if (this.controlDelayTime != 0) if (this.controlDelayTime != 0)
writer.writeInt64(15, this.controlDelayTime); writer.writeInt64(15, this.controlDelayTime);
if (this.wheelDiameter != 0)
writer.writeInt32(16, this.wheelDiameter);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -1400,9 +1380,6 @@ export namespace state {
case 15: case 15:
message.controlDelayTime = reader.readInt64(); message.controlDelayTime = reader.readInt64();
break; break;
case 16:
message.wheelDiameter = reader.readInt32();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }