diff --git a/src/components/draw-app/properties/ScreenDoorProperty.vue b/src/components/draw-app/properties/ScreenDoorProperty.vue
index 739e5a2..a08ac14 100644
--- a/src/components/draw-app/properties/ScreenDoorProperty.vue
+++ b/src/components/draw-app/properties/ScreenDoorProperty.vue
@@ -17,6 +17,56 @@
@blur="onUpdate"
label="子屏蔽门的数量"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -39,6 +89,7 @@ import { useDrawStore } from 'src/stores/draw-store';
import { computed } from 'vue';
import { ScreenDoor } from 'src/graphics/screenDoor/ScreenDoor';
import { Platform } from 'src/graphics/platform/Platform';
+import { graphicData } from 'src/protos/stationLayoutGraphics';
const drawStore = useDrawStore();
const { data: screenDoorModel, onUpdate } = useFormData(
@@ -59,4 +110,19 @@ const platformRelation = computed(() => {
}
return refStation;
});
+
+function addScreenDoorGroup() {
+ screenDoorModel.screenDoorGroupList = [
+ ...screenDoorModel.screenDoorGroupList,
+ new graphicData.ScreenDoorGroup(),
+ ];
+}
+
+function deleteScreenDoorGroup(index: number) {
+ const screenDoor = drawStore.selectedGraphic as ScreenDoor;
+ const data = screenDoor.datas.clone().screenDoorGroupList;
+ data.splice(index, 1);
+ screenDoor.datas.screenDoorGroupList = data;
+ screenDoorModel.screenDoorGroupList = data;
+}
diff --git a/src/drawApp/graphics/ScreenDoorInteraction.ts b/src/drawApp/graphics/ScreenDoorInteraction.ts
index 359109e..2b8c7a7 100644
--- a/src/drawApp/graphics/ScreenDoorInteraction.ts
+++ b/src/drawApp/graphics/ScreenDoorInteraction.ts
@@ -40,6 +40,14 @@ export class ScreenDoorData extends GraphicDataBase implements IScreenDoorData {
set sonDoorAmount(v: number) {
this.data.sonDoorAmount = v;
}
+ get screenDoorGroupList(): graphicData.ScreenDoorGroup[] {
+ return this.data.screenDoorGroupList.length > 0
+ ? this.data.screenDoorGroupList
+ : (this.data.screenDoorGroupList = [new graphicData.ScreenDoorGroup()]);
+ }
+ set screenDoorGroupList(groupList: graphicData.ScreenDoorGroup[]) {
+ this.data.screenDoorGroupList = groupList;
+ }
clone(): ScreenDoorData {
return new ScreenDoorData(this.data.cloneMessage());
diff --git a/src/graphics/platform/Platform.ts b/src/graphics/platform/Platform.ts
index 77c014a..a96d5bf 100644
--- a/src/graphics/platform/Platform.ts
+++ b/src/graphics/platform/Platform.ts
@@ -188,7 +188,7 @@ export class Platform extends JlGraphic {
const refSection = this.relationManage
.getRelationsOfGraphicAndOtherType(this, Section.Type)
.map((relation) => relation.getOtherGraphic(this).datas.id);
- if (refStation.length) {
+ if (refSection.length) {
platformRef.push(createRelatedRefProto(Section.Type, refSection[0]));
}
this.datas.platformRef = platformRef;
diff --git a/src/graphics/screenDoor/ScreenDoor.ts b/src/graphics/screenDoor/ScreenDoor.ts
index 5c1dea1..494089e 100644
--- a/src/graphics/screenDoor/ScreenDoor.ts
+++ b/src/graphics/screenDoor/ScreenDoor.ts
@@ -4,8 +4,10 @@ import {
JlGraphic,
JlGraphicTemplate,
VectorText,
+ distance2,
} from 'src/jl-graphic';
import { Platform } from '../platform/Platform';
+import { graphicData } from 'src/protos/stationLayoutGraphics';
export interface IScreenDoorData extends GraphicData {
get code(): string; // 编号
@@ -14,6 +16,8 @@ export interface IScreenDoorData extends GraphicData {
set refPlatform(v: string);
get sonDoorAmount(): number; //子屏蔽门的数量
set sonDoorAmount(v: number);
+ get screenDoorGroupList(): graphicData.ScreenDoorGroup[]; //编组列表
+ set screenDoorGroupList(v: graphicData.ScreenDoorGroup[]);
clone(): IScreenDoorData;
copyFrom(data: IScreenDoorData): void;
eq(other: IScreenDoorData): boolean;
@@ -44,15 +48,15 @@ class smallDoorGraphic extends Container {
screenDoorConsts.smallDoorWidth * i;
const smallDoorGraphic = this.smallDoorGraphic;
const lineColor = screenDoorConsts.doorGreen;
- const direction = 'down';
+ const direction = 'up';
smallDoorGraphic
.lineStyle(screenDoorConsts.lineWidth, new Color(lineColor))
.moveTo(start, 0)
.lineTo(start + screenDoorConsts.smallDoorWidth - 3, 0);
- if (direction == 'down') {
- this.labelGraphic.text = data.sonDoorAmount - i;
- } else {
+ if (direction == 'up') {
this.labelGraphic.text = i + 1;
+ } else {
+ this.labelGraphic.text = data.sonDoorAmount - i;
}
this.labelGraphic.style.fill = 'red';
if (i % 2 == 0) {
@@ -89,13 +93,22 @@ export class ScreenDoor extends JlGraphic {
}
}
buildRelation() {
- const stationas = this.queryStore.queryByType(Platform.Type);
- for (let i = 0; i < stationas.length; i++) {
- const sP = stationas[i].localBoundsToCanvasPoints();
+ const platforms = this.queryStore.queryByType(Platform.Type);
+ const minDistanceRefPlatform: Platform[] = [];
+ platforms.forEach((platform) => {
+ const sP = platform.localBoundsToCanvasPoints();
if (this.x > sP[0].x && this.x < sP[1].x) {
- this.relationManage.addRelation(this, stationas[i]);
- break;
+ minDistanceRefPlatform.push(platform);
}
+ });
+ const refPlatform = minDistanceRefPlatform.reduce((prev, cur) => {
+ return distance2(prev.position, this.position) >
+ distance2(cur.position, this.position)
+ ? cur
+ : prev;
+ });
+ if (refPlatform) {
+ this.relationManage.addRelation(this, refPlatform);
}
}
saveRelations() {
diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts
index 078a94a..7a0545b 100644
--- a/src/protos/stationLayoutGraphics.ts
+++ b/src/protos/stationLayoutGraphics.ts
@@ -1455,9 +1455,10 @@ export namespace graphicData {
code?: string;
sonDoorAmount?: number;
refPlatform?: string;
+ screenDoorGroupList?: ScreenDoorGroup[];
}) {
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, [5], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("common" in data && data.common != undefined) {
this.common = data.common;
@@ -1471,6 +1472,9 @@ export namespace graphicData {
if ("refPlatform" in data && data.refPlatform != undefined) {
this.refPlatform = data.refPlatform;
}
+ if ("screenDoorGroupList" in data && data.screenDoorGroupList != undefined) {
+ this.screenDoorGroupList = data.screenDoorGroupList;
+ }
}
}
get common() {
@@ -1500,11 +1504,18 @@ export namespace graphicData {
set refPlatform(value: string) {
pb_1.Message.setField(this, 4, value);
}
+ get screenDoorGroupList() {
+ return pb_1.Message.getRepeatedWrapperField(this, ScreenDoorGroup, 5) as ScreenDoorGroup[];
+ }
+ set screenDoorGroupList(value: ScreenDoorGroup[]) {
+ pb_1.Message.setRepeatedWrapperField(this, 5, value);
+ }
static fromObject(data: {
common?: ReturnType;
code?: string;
sonDoorAmount?: number;
refPlatform?: string;
+ screenDoorGroupList?: ReturnType[];
}): ScreenDoor {
const message = new ScreenDoor({});
if (data.common != null) {
@@ -1519,6 +1530,9 @@ export namespace graphicData {
if (data.refPlatform != null) {
message.refPlatform = data.refPlatform;
}
+ if (data.screenDoorGroupList != null) {
+ message.screenDoorGroupList = data.screenDoorGroupList.map(item => ScreenDoorGroup.fromObject(item));
+ }
return message;
}
toObject() {
@@ -1527,6 +1541,7 @@ export namespace graphicData {
code?: string;
sonDoorAmount?: number;
refPlatform?: string;
+ screenDoorGroupList?: ReturnType[];
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@@ -1540,6 +1555,9 @@ export namespace graphicData {
if (this.refPlatform != null) {
data.refPlatform = this.refPlatform;
}
+ if (this.screenDoorGroupList != null) {
+ data.screenDoorGroupList = this.screenDoorGroupList.map((item: ScreenDoorGroup) => item.toObject());
+ }
return data;
}
serialize(): Uint8Array;
@@ -1554,6 +1572,8 @@ export namespace graphicData {
writer.writeInt32(3, this.sonDoorAmount);
if (this.refPlatform.length)
writer.writeString(4, this.refPlatform);
+ if (this.screenDoorGroupList.length)
+ writer.writeRepeatedMessage(5, this.screenDoorGroupList, (item: ScreenDoorGroup) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@@ -1575,6 +1595,9 @@ export namespace graphicData {
case 4:
message.refPlatform = reader.readString();
break;
+ case 5:
+ reader.readMessage(message.screenDoorGroupList, () => pb_1.Message.addToRepeatedWrapperField(message, 5, ScreenDoorGroup.deserialize(reader), ScreenDoorGroup));
+ break;
default: reader.skipField();
}
}
@@ -1587,6 +1610,119 @@ export namespace graphicData {
return ScreenDoor.deserialize(bytes);
}
}
+ export class ScreenDoorGroup extends pb_1.Message {
+ #one_of_decls: number[][] = [];
+ constructor(data?: any[] | {
+ trainGroupAmount?: number;
+ startSmallDoor?: number;
+ endSmallDoor?: number;
+ }) {
+ super();
+ pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
+ if (!Array.isArray(data) && typeof data == "object") {
+ if ("trainGroupAmount" in data && data.trainGroupAmount != undefined) {
+ this.trainGroupAmount = data.trainGroupAmount;
+ }
+ if ("startSmallDoor" in data && data.startSmallDoor != undefined) {
+ this.startSmallDoor = data.startSmallDoor;
+ }
+ if ("endSmallDoor" in data && data.endSmallDoor != undefined) {
+ this.endSmallDoor = data.endSmallDoor;
+ }
+ }
+ }
+ get trainGroupAmount() {
+ return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
+ }
+ set trainGroupAmount(value: number) {
+ pb_1.Message.setField(this, 1, value);
+ }
+ get startSmallDoor() {
+ return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
+ }
+ set startSmallDoor(value: number) {
+ pb_1.Message.setField(this, 2, value);
+ }
+ get endSmallDoor() {
+ return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
+ }
+ set endSmallDoor(value: number) {
+ pb_1.Message.setField(this, 3, value);
+ }
+ static fromObject(data: {
+ trainGroupAmount?: number;
+ startSmallDoor?: number;
+ endSmallDoor?: number;
+ }): ScreenDoorGroup {
+ const message = new ScreenDoorGroup({});
+ if (data.trainGroupAmount != null) {
+ message.trainGroupAmount = data.trainGroupAmount;
+ }
+ if (data.startSmallDoor != null) {
+ message.startSmallDoor = data.startSmallDoor;
+ }
+ if (data.endSmallDoor != null) {
+ message.endSmallDoor = data.endSmallDoor;
+ }
+ return message;
+ }
+ toObject() {
+ const data: {
+ trainGroupAmount?: number;
+ startSmallDoor?: number;
+ endSmallDoor?: number;
+ } = {};
+ if (this.trainGroupAmount != null) {
+ data.trainGroupAmount = this.trainGroupAmount;
+ }
+ if (this.startSmallDoor != null) {
+ data.startSmallDoor = this.startSmallDoor;
+ }
+ if (this.endSmallDoor != null) {
+ data.endSmallDoor = this.endSmallDoor;
+ }
+ 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.trainGroupAmount != 0)
+ writer.writeInt32(1, this.trainGroupAmount);
+ if (this.startSmallDoor != 0)
+ writer.writeInt32(2, this.startSmallDoor);
+ if (this.endSmallDoor != 0)
+ writer.writeInt32(3, this.endSmallDoor);
+ if (!w)
+ return writer.getResultBuffer();
+ }
+ static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ScreenDoorGroup {
+ const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ScreenDoorGroup();
+ while (reader.nextField()) {
+ if (reader.isEndGroup())
+ break;
+ switch (reader.getFieldNumber()) {
+ case 1:
+ message.trainGroupAmount = reader.readInt32();
+ break;
+ case 2:
+ message.startSmallDoor = reader.readInt32();
+ break;
+ case 3:
+ message.endSmallDoor = reader.readInt32();
+ break;
+ default: reader.skipField();
+ }
+ }
+ return message;
+ }
+ serializeBinary(): Uint8Array {
+ return this.serialize();
+ }
+ static deserializeBinary(bytes: Uint8Array): ScreenDoorGroup {
+ return ScreenDoorGroup.deserialize(bytes);
+ }
+ }
export class Station extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {