Merge branch 'master' of git.code.tencent.com:beijing-rtss-test/bj-rtss-client
This commit is contained in:
commit
056d4959d1
@ -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;
|
||||
|
@ -652,13 +652,17 @@ abstract class GraphicSceneBase
|
||||
}
|
||||
|
||||
private async load(): Promise<void> {
|
||||
console.log(this._options.dataLoader, '=====');
|
||||
if (this._options.dataLoader) {
|
||||
const storage = await this._options.dataLoader();
|
||||
console.log(storage, 'storage');
|
||||
if (storage.canvasProperty) {
|
||||
this.canvas.update(storage.canvasProperty);
|
||||
console.log(this.canvas, 'canvas');
|
||||
}
|
||||
if (storage.datas) {
|
||||
await this.loadGraphic(storage.datas);
|
||||
console.log('load');
|
||||
}
|
||||
}
|
||||
this._loaded = true;
|
||||
|
@ -2,26 +2,20 @@
|
||||
<q-layout view="hHh LpR fFf">
|
||||
<q-header reveal class="bg-primary text-white">
|
||||
<q-toolbar>
|
||||
<q-btn-dropdown color="info" label="切换场景">
|
||||
<q-list>
|
||||
<q-item
|
||||
v-for="(item, index) in projectInfo.mapInfoLinks"
|
||||
:key="index"
|
||||
:disable="item.id == lineStore.mapId"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="switchScene(item)"
|
||||
>
|
||||
<q-item-section>
|
||||
<q-item-label>{{ item.name }}</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-btn-dropdown>
|
||||
<q-select
|
||||
dark
|
||||
dense
|
||||
label-color="grey-13"
|
||||
v-model="sceneInfo"
|
||||
@update:model-value="switchScene"
|
||||
:options="sceneOptions"
|
||||
:option-label="(item) => item.name"
|
||||
label="切换场景"
|
||||
></q-select>
|
||||
<q-toolbar-title> {{ projectName }} </q-toolbar-title>
|
||||
<q-btn
|
||||
color="info"
|
||||
label="销毁仿真"
|
||||
color="red"
|
||||
label="结束"
|
||||
class="q-mr-md"
|
||||
@click="destroySimAndBack"
|
||||
/>
|
||||
@ -44,7 +38,7 @@
|
||||
<div id="line-app-container" class="overflow-hidden"></div>
|
||||
</q-page-container>
|
||||
<q-dialog v-model="pslDialog">
|
||||
<q-page-container style="width: 510px; height: 650px; background: #fff">
|
||||
<q-page-container style="width: 1920px; height: 950px">
|
||||
<div id="psl-app-container" class="overflow-hidden"></div>
|
||||
</q-page-container>
|
||||
</q-dialog>
|
||||
@ -62,7 +56,7 @@ import {
|
||||
nextTick,
|
||||
} from 'vue';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { usePslStore } from 'src/stores/psl-store.ts';
|
||||
import { usePslStore } from 'src/stores/psl-store';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { destroySimulation } from 'src/api/Simulation';
|
||||
import StateProperties from 'src/components/line-app/StateProperties.vue';
|
||||
@ -90,6 +84,11 @@ const drawerRight = ref(false);
|
||||
|
||||
const projectName = computed(() => projectInfo.name);
|
||||
|
||||
const sceneOptions = computed(() => {
|
||||
return projectInfo.mapInfoLinks || [];
|
||||
});
|
||||
const sceneInfo = ref();
|
||||
|
||||
function onResize() {
|
||||
const clientWidth = document.documentElement.clientWidth;
|
||||
const clientHeight = document.documentElement.clientHeight;
|
||||
@ -131,6 +130,7 @@ onMounted(async () => {
|
||||
return item.id == lineStore.mapId;
|
||||
});
|
||||
if (find) {
|
||||
sceneInfo.value = find;
|
||||
sceneName = getSceneNameFn(find);
|
||||
}
|
||||
lineStore.addAllScene(projectInfo.mapInfoLinks || []);
|
||||
@ -197,39 +197,53 @@ watch(
|
||||
}
|
||||
);
|
||||
function destroySimAndBack() {
|
||||
$q.dialog({
|
||||
title: '确认',
|
||||
message: `确认结束项目 "${projectName.value}" 吗?`,
|
||||
cancel: true,
|
||||
}).onOk(async () => {
|
||||
try {
|
||||
if (simulationId) {
|
||||
destroySimulation({ simulationId });
|
||||
await destroySimulation({ simulationId });
|
||||
}
|
||||
backConfirm();
|
||||
} catch (err) {
|
||||
const error = err as ApiError;
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: error.title,
|
||||
});
|
||||
backConfirm();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function switchScene(val: MapInfo) {
|
||||
if (val.id == lineStore.mapId) return;
|
||||
scene && scene.unbindDom();
|
||||
lineStore.setMapId(val.id);
|
||||
sceneName = getSceneNameFn(val);
|
||||
lineStore.setSceneName(sceneName);
|
||||
scene = lineApp.getScene(sceneName);
|
||||
const dom = document.getElementById('line-app-container');
|
||||
if (dom) {
|
||||
scene.bindDom(dom);
|
||||
lineApp.switchScene(sceneName, dom);
|
||||
scene = lineApp.getScene(sceneName);
|
||||
scene.reload();
|
||||
}
|
||||
}
|
||||
|
||||
function pslShow() {
|
||||
pslDialog.value = true;
|
||||
const pslApp = usePslStore().initLineApp();
|
||||
nextTick(() => {
|
||||
const dom = document.getElementById('psl-app-container');
|
||||
if (dom) {
|
||||
const pslApp = usePslStore().initLineApp();
|
||||
usePslStore().addAllScene([{ type: 1, id: 145 }]);
|
||||
pslApp.bindDom(dom);
|
||||
usePslStore().setMapId(145);
|
||||
usePslStore().addAllScene([{ type: 1, id: 146 }]);
|
||||
usePslStore().setMapId(146);
|
||||
usePslStore().setSimulationId(simulationId);
|
||||
sceneName = getSceneNameFn({ type: 1, id: 145 });
|
||||
sceneName = getSceneNameFn({ type: 1, id: 146 });
|
||||
usePslStore().setSceneName(sceneName);
|
||||
scene = pslApp.getScene(sceneName);
|
||||
scene.bindDom(dom);
|
||||
scene.reload();
|
||||
dom.style.width = '500px';
|
||||
dom.style.height = '600px';
|
||||
|
@ -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