站台增加关联车站和子屏蔽门数量可变
This commit is contained in:
parent
9183c50135
commit
2d93b7ff6a
@ -35,7 +35,10 @@
|
||||
<script setup lang="ts">
|
||||
import DraggableDialog from 'src/components/common/DraggableDialog.vue';
|
||||
import { RelayCabinetData } from 'src/drawApp/relayCabinetGraphics/RelayCabinetInteraction';
|
||||
import { RelayData } from 'src/drawApp/relayCabinetGraphics/RelayInteraction';
|
||||
import {
|
||||
RelayData,
|
||||
RelayState,
|
||||
} from 'src/drawApp/relayCabinetGraphics/RelayInteraction';
|
||||
import { Relay } from 'src/graphics/relay/Relay';
|
||||
import {
|
||||
RelayCabinet,
|
||||
@ -107,6 +110,7 @@ function oneClickRelay() {
|
||||
if (j == numCols - 1 && remainder !== 0 && i >= remainder) break;
|
||||
const relay = new Relay();
|
||||
relay.loadData(new RelayData());
|
||||
relay.loadState(new RelayState());
|
||||
relay.id = GraphicIdGenerator.next();
|
||||
relay.position.set(
|
||||
relayCabinet.x -
|
||||
|
@ -8,13 +8,6 @@
|
||||
@blur="onUpdate"
|
||||
label="索引"
|
||||
/>
|
||||
<q-input
|
||||
outlined
|
||||
v-model.number="platformModel.refStationIndex"
|
||||
type="number"
|
||||
@blur="onUpdate"
|
||||
label="对应车站索引"
|
||||
/>
|
||||
<q-select
|
||||
outlined
|
||||
@blur="onUpdate"
|
||||
@ -33,6 +26,26 @@
|
||||
:options="optionsDirection"
|
||||
label="方向"
|
||||
/>
|
||||
<q-input
|
||||
v-if="platformModel.hasdoor"
|
||||
outlined
|
||||
v-model.number="platformModel.sonDoorAmount"
|
||||
type="number"
|
||||
@blur="onUpdate"
|
||||
label="子屏蔽门的数量"
|
||||
/>
|
||||
<q-list bordered separator class="rounded-borders">
|
||||
<q-item>
|
||||
<q-item-section no-wrap class="q-gutter-y-sm column">
|
||||
<q-item-label> 关联的车站 </q-item-label>
|
||||
<div class="q-gutter-sm row">
|
||||
<q-chip square color="primary" text-color="white">
|
||||
{{ stationRelation }}
|
||||
</q-chip>
|
||||
</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-form>
|
||||
</template>
|
||||
|
||||
@ -40,7 +53,15 @@
|
||||
import { PlatformData } from 'src/drawApp/graphics/PlatformInteraction';
|
||||
import { useFormData } from 'src/components/DrawAppFormUtils';
|
||||
import { useDrawStore } from 'src/stores/draw-store';
|
||||
import { computed } from 'vue';
|
||||
import { Station } from 'src/graphics/station/Station';
|
||||
import { Platform } from 'src/graphics/platform/Platform';
|
||||
|
||||
const drawStore = useDrawStore();
|
||||
const { data: platformModel, onUpdate } = useFormData(
|
||||
new PlatformData(),
|
||||
drawStore.getDrawApp()
|
||||
);
|
||||
const optionsDoor = [
|
||||
{ label: '是', value: true },
|
||||
{ label: '否', value: false },
|
||||
@ -50,8 +71,15 @@ const optionsDirection = [
|
||||
{ label: '向下', value: 'down' },
|
||||
];
|
||||
|
||||
const { data: platformModel, onUpdate } = useFormData(
|
||||
new PlatformData(),
|
||||
useDrawStore().getDrawApp()
|
||||
);
|
||||
const stationRelation = computed(() => {
|
||||
const platform = drawStore.selectedGraphic as Platform;
|
||||
const refStations = platform?.relationManage
|
||||
.getRelationsOfGraphicAndOtherType(platform, Station.Type)
|
||||
.map((relation) => relation.getOtherGraphic<Station>(platform).datas.code);
|
||||
let refStation;
|
||||
if (refStations) {
|
||||
return (refStation = refStations[0]);
|
||||
}
|
||||
return refStation;
|
||||
});
|
||||
</script>
|
||||
|
@ -58,11 +58,17 @@ export class PlatformData extends GraphicDataBase implements IPlatformData {
|
||||
set index(v: number) {
|
||||
this.data.index = v;
|
||||
}
|
||||
get refStationIndex(): number {
|
||||
return this.data.refStationIndex;
|
||||
get refStation(): string {
|
||||
return this.data.refStation;
|
||||
}
|
||||
set refStationIndex(v: number) {
|
||||
this.data.refStationIndex = v;
|
||||
set refStation(v: string) {
|
||||
this.data.refStation = v;
|
||||
}
|
||||
get sonDoorAmount(): number {
|
||||
return this.data.sonDoorAmount;
|
||||
}
|
||||
set sonDoorAmount(v: number) {
|
||||
this.data.sonDoorAmount = v;
|
||||
}
|
||||
|
||||
clone(): PlatformData {
|
||||
|
@ -9,6 +9,7 @@ import {
|
||||
calculateMirrorPoint,
|
||||
getRectangleCenter,
|
||||
} from 'src/jl-graphic';
|
||||
import { Station } from '../station/Station';
|
||||
|
||||
export interface IPlatformData extends GraphicData {
|
||||
get code(): string; // 编号
|
||||
@ -19,8 +20,10 @@ export interface IPlatformData extends GraphicData {
|
||||
set direction(v: string);
|
||||
get index(): number;
|
||||
set index(v: number);
|
||||
get refStationIndex(): number;
|
||||
set refStationIndex(v: number);
|
||||
get refStation(): string; // 关联的车站
|
||||
set refStation(v: string);
|
||||
get sonDoorAmount(): number; //子屏蔽门的数量
|
||||
set sonDoorAmount(v: number);
|
||||
clone(): IPlatformData;
|
||||
copyFrom(data: IPlatformData): void;
|
||||
eq(other: IPlatformData): boolean;
|
||||
@ -139,19 +142,23 @@ class smallDoorGraphic extends Container {
|
||||
this.addChild(this.smallDoorGraphic);
|
||||
this.addChild(this.labelGraphic);
|
||||
}
|
||||
draw(direction: string, stateData: IPlatformState, i: number): void {
|
||||
draw(data: IPlatformData, stateData: IPlatformState, i: number): void {
|
||||
const sonDoorAmount = data?.sonDoorAmount || 30;
|
||||
const start =
|
||||
-platformConsts.smallDoorWidth * 15 + platformConsts.smallDoorWidth * i;
|
||||
(-platformConsts.smallDoorWidth * sonDoorAmount) / 2 +
|
||||
platformConsts.smallDoorWidth * i;
|
||||
const smallDoorGraphic = this.smallDoorGraphic;
|
||||
const lineColor = PlatformColorEnum.doorGreen;
|
||||
// if (stateData.psdCut) {
|
||||
// lineColor = PlatformColorEnum.doorRed;
|
||||
// }
|
||||
smallDoorGraphic.lineStyle(platformConsts.lineWidth, new Color(lineColor));
|
||||
smallDoorGraphic.moveTo(start, 0);
|
||||
smallDoorGraphic.lineTo(start + platformConsts.smallDoorWidth - 3, 0);
|
||||
const direction = data.direction;
|
||||
smallDoorGraphic
|
||||
.lineStyle(platformConsts.lineWidth, new Color(lineColor))
|
||||
.moveTo(start, 0)
|
||||
.lineTo(start + platformConsts.smallDoorWidth - 3, 0);
|
||||
if (direction == 'down') {
|
||||
this.labelGraphic.text = 30 - i;
|
||||
this.labelGraphic.text = sonDoorAmount - i;
|
||||
} else {
|
||||
this.labelGraphic.text = i + 1;
|
||||
}
|
||||
@ -167,10 +174,11 @@ export class doorGraphic extends Container {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
draw(direction: string, stateData: IPlatformState): void {
|
||||
for (let i = 0; i < 30; i++) {
|
||||
draw(data: IPlatformData, stateData: IPlatformState): void {
|
||||
const sonDoorAmount = data?.sonDoorAmount || 30;
|
||||
for (let i = 0; i < sonDoorAmount; i++) {
|
||||
const smallDoor = new smallDoorGraphic();
|
||||
smallDoor.draw(direction, stateData, i);
|
||||
smallDoor.draw(data, stateData, i);
|
||||
this.addChild(smallDoor);
|
||||
}
|
||||
}
|
||||
@ -423,7 +431,7 @@ export class Platform extends JlGraphic {
|
||||
doRepaint(): void {
|
||||
this.doorGraphic.clear();
|
||||
if (this.datas.hasdoor) {
|
||||
this.doorGraphic.draw(this.datas.direction, this.states);
|
||||
this.doorGraphic.draw(this.datas, this.states);
|
||||
}
|
||||
this.platformGraphic.draw(this.states);
|
||||
this.emergClose.draw();
|
||||
@ -453,6 +461,32 @@ export class Platform extends JlGraphic {
|
||||
}
|
||||
// this.changeState();
|
||||
}
|
||||
buildRelation() {
|
||||
const stationas = this.queryStore.queryByType<Station>(Station.Type);
|
||||
for (let i = 0; i < stationas.length; i++) {
|
||||
const sP = stationas[i].localBoundsToCanvasPoints();
|
||||
if (this.x > sP[0].x && this.x < sP[1].x) {
|
||||
this.relationManage.addRelation(this, stationas[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
saveRelations() {
|
||||
const refStation = this.relationManage
|
||||
.getRelationsOfGraphicAndOtherType(this, Station.Type)
|
||||
.map((relation) => relation.getOtherGraphic<Station>(this).datas.id);
|
||||
if (refStation.length) {
|
||||
this.datas.refStation = refStation[0];
|
||||
}
|
||||
}
|
||||
loadRelations() {
|
||||
if (this.datas.refStation) {
|
||||
this.relationManage.addRelation(
|
||||
this,
|
||||
this.queryStore.queryById<Station>(this.datas.refStation)
|
||||
);
|
||||
}
|
||||
}
|
||||
// changeState(): void {
|
||||
// this.doorGraphic.changeState(this.states);
|
||||
// this.emergClose.changeState(this.id, this.states);
|
||||
|
@ -10,7 +10,7 @@ import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
|
||||
export interface IRelayData extends GraphicData {
|
||||
get code(): string; // 编号
|
||||
set code(v: string);
|
||||
get newModel(): relayCabinetGraphicData.Relay.ModelType; // 计轴、区段边界
|
||||
get newModel(): relayCabinetGraphicData.Relay.ModelType; // 型号
|
||||
set newModel(v: relayCabinetGraphicData.Relay.ModelType);
|
||||
clone(): IRelayData;
|
||||
copyFrom(data: IRelayData): void;
|
||||
|
@ -1271,7 +1271,8 @@ export namespace graphicData {
|
||||
hasdoor?: boolean;
|
||||
direction?: string;
|
||||
index?: number;
|
||||
refStationIndex?: number;
|
||||
refStation?: string;
|
||||
sonDoorAmount?: number;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
@ -1291,8 +1292,11 @@ export namespace graphicData {
|
||||
if ("index" in data && data.index != undefined) {
|
||||
this.index = data.index;
|
||||
}
|
||||
if ("refStationIndex" in data && data.refStationIndex != undefined) {
|
||||
this.refStationIndex = data.refStationIndex;
|
||||
if ("refStation" in data && data.refStation != undefined) {
|
||||
this.refStation = data.refStation;
|
||||
}
|
||||
if ("sonDoorAmount" in data && data.sonDoorAmount != undefined) {
|
||||
this.sonDoorAmount = data.sonDoorAmount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1329,11 +1333,17 @@ export namespace graphicData {
|
||||
set index(value: number) {
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
}
|
||||
get refStationIndex() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 6, 0) as number;
|
||||
get refStation() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 8, "") as string;
|
||||
}
|
||||
set refStationIndex(value: number) {
|
||||
pb_1.Message.setField(this, 6, value);
|
||||
set refStation(value: string) {
|
||||
pb_1.Message.setField(this, 8, value);
|
||||
}
|
||||
get sonDoorAmount() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 9, 0) as number;
|
||||
}
|
||||
set sonDoorAmount(value: number) {
|
||||
pb_1.Message.setField(this, 9, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
@ -1341,7 +1351,8 @@ export namespace graphicData {
|
||||
hasdoor?: boolean;
|
||||
direction?: string;
|
||||
index?: number;
|
||||
refStationIndex?: number;
|
||||
refStation?: string;
|
||||
sonDoorAmount?: number;
|
||||
}): Platform {
|
||||
const message = new Platform({});
|
||||
if (data.common != null) {
|
||||
@ -1359,8 +1370,11 @@ export namespace graphicData {
|
||||
if (data.index != null) {
|
||||
message.index = data.index;
|
||||
}
|
||||
if (data.refStationIndex != null) {
|
||||
message.refStationIndex = data.refStationIndex;
|
||||
if (data.refStation != null) {
|
||||
message.refStation = data.refStation;
|
||||
}
|
||||
if (data.sonDoorAmount != null) {
|
||||
message.sonDoorAmount = data.sonDoorAmount;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
@ -1371,7 +1385,8 @@ export namespace graphicData {
|
||||
hasdoor?: boolean;
|
||||
direction?: string;
|
||||
index?: number;
|
||||
refStationIndex?: number;
|
||||
refStation?: string;
|
||||
sonDoorAmount?: number;
|
||||
} = {};
|
||||
if (this.common != null) {
|
||||
data.common = this.common.toObject();
|
||||
@ -1388,8 +1403,11 @@ export namespace graphicData {
|
||||
if (this.index != null) {
|
||||
data.index = this.index;
|
||||
}
|
||||
if (this.refStationIndex != null) {
|
||||
data.refStationIndex = this.refStationIndex;
|
||||
if (this.refStation != null) {
|
||||
data.refStation = this.refStation;
|
||||
}
|
||||
if (this.sonDoorAmount != null) {
|
||||
data.sonDoorAmount = this.sonDoorAmount;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@ -1407,8 +1425,10 @@ export namespace graphicData {
|
||||
writer.writeString(4, this.direction);
|
||||
if (this.index != 0)
|
||||
writer.writeInt32(5, this.index);
|
||||
if (this.refStationIndex != 0)
|
||||
writer.writeInt32(6, this.refStationIndex);
|
||||
if (this.refStation.length)
|
||||
writer.writeString(8, this.refStation);
|
||||
if (this.sonDoorAmount != 0)
|
||||
writer.writeInt32(9, this.sonDoorAmount);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -1433,8 +1453,11 @@ export namespace graphicData {
|
||||
case 5:
|
||||
message.index = reader.readInt32();
|
||||
break;
|
||||
case 6:
|
||||
message.refStationIndex = reader.readInt32();
|
||||
case 8:
|
||||
message.refStation = reader.readString();
|
||||
break;
|
||||
case 9:
|
||||
message.sonDoorAmount = reader.readInt32();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user