Merge branch 'master' of https://git.code.tencent.com/beijing-rtss-test/bj-rtss-client
This commit is contained in:
commit
4939a196e4
@ -61,6 +61,8 @@ const tableRef = ref<QTable>();
|
||||
const deviceTypeMap = {
|
||||
1: '道岔',
|
||||
5: '信号机',
|
||||
6: '车站',
|
||||
7: '屏蔽门',
|
||||
};
|
||||
const columns: QTable['columns'] = [
|
||||
{
|
||||
|
@ -17,14 +17,6 @@
|
||||
@blur="onUpdate"
|
||||
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">
|
||||
@ -36,6 +28,16 @@
|
||||
</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<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">
|
||||
{{ sectionRelation }}
|
||||
</q-chip>
|
||||
</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-form>
|
||||
</template>
|
||||
@ -47,6 +49,7 @@ 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';
|
||||
import { Section } from 'src/graphics/section/Section';
|
||||
|
||||
const drawStore = useDrawStore();
|
||||
const { data: platformModel, onUpdate } = useFormData(
|
||||
@ -61,7 +64,18 @@ const stationRelation = computed(() => {
|
||||
.map((relation) => relation.getOtherGraphic<Station>(platform).datas.code);
|
||||
let refStation;
|
||||
if (refStations) {
|
||||
return (refStation = refStations[0]);
|
||||
refStation = refStations[0];
|
||||
}
|
||||
return refStation;
|
||||
});
|
||||
const sectionRelation = computed(() => {
|
||||
const platform = drawStore.selectedGraphic as Platform;
|
||||
const refSections = platform?.relationManage
|
||||
.getRelationsOfGraphicAndOtherType(platform, Section.Type)
|
||||
.map((relation) => relation.getOtherGraphic<Section>(platform).datas.code);
|
||||
let refStation;
|
||||
if (refSections) {
|
||||
refStation = refSections[0];
|
||||
}
|
||||
return refStation;
|
||||
});
|
||||
|
@ -131,6 +131,8 @@ const handleState = ref('新建设备关联继电器');
|
||||
const optionsType = [
|
||||
{ label: '道岔', value: graphicData.RelatedRef.DeviceType.Turnout },
|
||||
{ label: '信号机', value: graphicData.RelatedRef.DeviceType.signal },
|
||||
{ label: '车站', value: graphicData.RelatedRef.DeviceType.station },
|
||||
{ label: '屏蔽门', value: graphicData.RelatedRef.DeviceType.ScreenDoor },
|
||||
];
|
||||
|
||||
let selectGraphic: JlGraphic[] = [];
|
||||
|
@ -11,7 +11,6 @@
|
||||
autogrow
|
||||
/>
|
||||
<q-input
|
||||
v-if="screenDoorModel.hasdoor"
|
||||
outlined
|
||||
v-model.number="screenDoorModel.sonDoorAmount"
|
||||
type="number"
|
||||
@ -56,7 +55,7 @@ const platformRelation = computed(() => {
|
||||
);
|
||||
let refStation;
|
||||
if (refStations) {
|
||||
return (refStation = refStations[0]);
|
||||
refStation = refStations[0];
|
||||
}
|
||||
return refStation;
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<q-form class="q-gutter-sm">
|
||||
<q-input outlined readonly v-model="stationModel.id" label="id" hint="" />
|
||||
<q-input outlined readonly v-model="stationModel.id" label="id" />
|
||||
<q-input
|
||||
outlined
|
||||
label="车站名称"
|
||||
|
@ -7,8 +7,6 @@ import {
|
||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||
import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
|
||||
import { state } from 'src/protos/device_state';
|
||||
import { MenuItemOptions } from 'src/jl-graphic/ui/Menu';
|
||||
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
|
||||
import {
|
||||
IGraphicScene,
|
||||
GraphicInteractionPlugin,
|
||||
@ -46,11 +44,11 @@ export class PlatformData extends GraphicDataBase implements IPlatformData {
|
||||
set index(v: number) {
|
||||
this.data.index = v;
|
||||
}
|
||||
get refStation(): string {
|
||||
return this.data.refStation;
|
||||
get platformRef(): graphicData.RelatedRef[] {
|
||||
return this.data.platformRef;
|
||||
}
|
||||
set refStation(v: string) {
|
||||
this.data.refStation = v;
|
||||
set platformRef(points: graphicData.RelatedRef[]) {
|
||||
this.data.platformRef = points;
|
||||
}
|
||||
|
||||
clone(): PlatformData {
|
||||
@ -92,86 +90,10 @@ export class PlatformState extends GraphicStateBase implements IPlatformState {
|
||||
}
|
||||
}
|
||||
|
||||
const holdConfig: MenuItemOptions = {
|
||||
name: '扣车',
|
||||
};
|
||||
const removeHoldrConfig: MenuItemOptions = {
|
||||
name: '取消扣车',
|
||||
};
|
||||
// const batchHoldConfig: MenuItemOptions = {
|
||||
// name: '批量扣车',
|
||||
// };
|
||||
// const removeBatchHoldConfig: MenuItemOptions = {
|
||||
// name: '批量取消扣车',
|
||||
// };
|
||||
// const earlyDepartureConfig: MenuItemOptions = {
|
||||
// name: '提前发车',
|
||||
// };
|
||||
const skipStopConfig: MenuItemOptions = {
|
||||
name: '设置跳停',
|
||||
};
|
||||
const removeSkipStopConfig: MenuItemOptions = {
|
||||
name: '取消跳停',
|
||||
};
|
||||
const dockTimeConfig: MenuItemOptions = {
|
||||
name: '设置停站时间',
|
||||
};
|
||||
const operatingLevelConfig: MenuItemOptions = {
|
||||
name: '设置运行等级',
|
||||
};
|
||||
// const numberOfRegionalTrainsConfig: MenuItemOptions = {
|
||||
// name: '区间列车数量限制',
|
||||
// };
|
||||
// const removeNumberOfRegionalTrainsConfig: MenuItemOptions = {
|
||||
// name: '取消区间列车数量限制',
|
||||
// };
|
||||
// const platformMessadeConfig: MenuItemOptions = {
|
||||
// name: '站台详细信息',
|
||||
// };
|
||||
|
||||
const PlatformOperateMenu: ContextMenu = ContextMenu.init({
|
||||
name: '站台操作菜单',
|
||||
groups: [
|
||||
{
|
||||
items: [
|
||||
holdConfig,
|
||||
removeHoldrConfig,
|
||||
skipStopConfig,
|
||||
removeSkipStopConfig,
|
||||
dockTimeConfig,
|
||||
operatingLevelConfig,
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// const dispatchPlatformOperateMenu: ContextMenu = ContextMenu.init({
|
||||
// name: '调度仿真站台操作菜单',
|
||||
// groups: [
|
||||
// {
|
||||
// items: [
|
||||
// holdConfig,
|
||||
// removeHoldrConfig,
|
||||
// batchHoldConfig,
|
||||
// removeBatchHoldConfig,
|
||||
// earlyDepartureConfig,
|
||||
// skipStopConfig,
|
||||
// removeSkipStopConfig,
|
||||
// dockTimeConfig,
|
||||
// operatingLevelConfig,
|
||||
// numberOfRegionalTrainsConfig,
|
||||
// removeNumberOfRegionalTrainsConfig,
|
||||
// platformMessadeConfig,
|
||||
// ],
|
||||
// },
|
||||
// ],
|
||||
// });
|
||||
|
||||
export class PlatformOperateInteraction extends GraphicInteractionPlugin<Platform> {
|
||||
static Name = 'platform_operate_menu';
|
||||
constructor(app: IGraphicScene) {
|
||||
super(PlatformOperateInteraction.Name, app);
|
||||
app.registerMenu(PlatformOperateMenu);
|
||||
}
|
||||
static init(app: IGraphicScene) {
|
||||
return new PlatformOperateInteraction(app);
|
||||
@ -196,37 +118,4 @@ export class PlatformOperateInteraction extends GraphicInteractionPlugin<Platfor
|
||||
onLeftClick() {
|
||||
useLineStore().stateProCountIncrease();
|
||||
}
|
||||
// onContextMenu(e: FederatedMouseEvent) {
|
||||
// const target = e.target as DisplayObject;
|
||||
// const platform = target.getGraphic() as Platform;
|
||||
// this.app.updateSelected(platform);
|
||||
// holdConfig.handler = () => {
|
||||
// platform.states.upOccHold = true;
|
||||
// platform.states.emergstop = true;
|
||||
// platform.doRepaint();
|
||||
// };
|
||||
// removeHoldrConfig.handler = () => {
|
||||
// platform.states.upOccHold = false;
|
||||
// platform.states.emergstop = false;
|
||||
// platform.doRepaint();
|
||||
// };
|
||||
// skipStopConfig.handler = () => {
|
||||
// platform.states.upSkipstop = true;
|
||||
// platform.doRepaint();
|
||||
// };
|
||||
// removeSkipStopConfig.handler = () => {
|
||||
// platform.states.upSkipstop = false;
|
||||
// platform.doRepaint();
|
||||
// };
|
||||
// dockTimeConfig.handler = () => {
|
||||
// platform.states.stopTime = 30;
|
||||
// platform.doRepaint();
|
||||
// };
|
||||
// operatingLevelConfig.handler = () => {
|
||||
// platform.states.nextSectionRunLevel = 2;
|
||||
// platform.doRepaint();
|
||||
// };
|
||||
|
||||
// PlatformOperateMenu.open(e.global);
|
||||
// }
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import { Turnout, TurnoutPort } from './turnout/Turnout';
|
||||
import { Section, SectionPort } from './section/Section';
|
||||
import { TrainWindow } from './trainWindow/TrainWindow';
|
||||
import { AxleCounting } from './axleCounting/AxleCounting';
|
||||
import { Station } from './station/Station';
|
||||
import { ScreenDoor } from './screenDoor/ScreenDoor';
|
||||
/**
|
||||
*
|
||||
* @param polygon
|
||||
@ -85,6 +87,8 @@ export function createRelatedRefProto(
|
||||
[Turnout.Type, graphicData.RelatedRef.DeviceType.Turnout],
|
||||
[TrainWindow.Type, graphicData.RelatedRef.DeviceType.TrainWindow],
|
||||
[AxleCounting.Type, graphicData.RelatedRef.DeviceType.AxleCounting],
|
||||
[Station.Type, graphicData.RelatedRef.DeviceType.station],
|
||||
[ScreenDoor.Type, graphicData.RelatedRef.DeviceType.ScreenDoor],
|
||||
]);
|
||||
const protoDeviceType = typeMap.get(type);
|
||||
if (protoDeviceType === undefined) throw Error(`输入的type有误: ${type}`);
|
||||
|
@ -1,91 +1,38 @@
|
||||
import { Color, Container, Graphics, Point, Rectangle } from 'pixi.js';
|
||||
import { Color, Container, Graphics, Rectangle } from 'pixi.js';
|
||||
import {
|
||||
GraphicAnimation,
|
||||
GraphicData,
|
||||
GraphicState,
|
||||
JlGraphic,
|
||||
JlGraphicTemplate,
|
||||
VectorText,
|
||||
calculateMirrorPoint,
|
||||
distance2,
|
||||
getRectangleCenter,
|
||||
} from 'src/jl-graphic';
|
||||
import { Station } from '../station/Station';
|
||||
import { createRelatedRefProto } from '../CommonGraphics';
|
||||
import { IRelatedRefData } from '../CommonGraphics';
|
||||
import { Section } from '../section/Section';
|
||||
|
||||
export interface IPlatformData extends GraphicData {
|
||||
get code(): string; // 编号
|
||||
set code(v: string);
|
||||
get index(): number;
|
||||
set index(v: number);
|
||||
get refStation(): string; // 关联的车站
|
||||
set refStation(v: string);
|
||||
get platformRef(): IRelatedRefData[]; // 关联的车站和物理区段
|
||||
set platformRef(v: IRelatedRefData[]);
|
||||
clone(): IPlatformData;
|
||||
copyFrom(data: IPlatformData): void;
|
||||
eq(other: IPlatformData): boolean;
|
||||
}
|
||||
export interface IPlatformState extends GraphicState {
|
||||
id?: string;
|
||||
// get emergstop(): boolean; //紧急关闭
|
||||
// set emergstop(v: boolean);
|
||||
// get trainberth(): boolean; //列车停站
|
||||
// set trainberth(v: boolean);
|
||||
// get close(): boolean; //站台关闭,清客
|
||||
// set close(v: boolean);
|
||||
// get upHold(): boolean; //上行方向车站扣车
|
||||
// set upHold(v: boolean);
|
||||
// get downHold(): boolean; //下行方向车站扣车
|
||||
// set downHold(v: boolean);
|
||||
// get upOccHold(): boolean; //上行方向中心扣车
|
||||
// set upOccHold(v: boolean);
|
||||
// get downOccHold(): boolean; //下行方向中心扣车
|
||||
// set downOccHold(v: boolean);
|
||||
// get psdOpen(): boolean; //屏蔽门开
|
||||
// set psdOpen(v: boolean);
|
||||
// get psdCut(): boolean; //屏蔽门切除
|
||||
// set psdCut(v: boolean);
|
||||
// get upSkipstop(): boolean; //上行方向跳停
|
||||
// set upSkipstop(v: boolean);
|
||||
// get downSkipstop(): boolean; //下行方向跳停
|
||||
// set downSkipstop(v: boolean);
|
||||
// get upTrainSkipstop(): boolean; //上行方向指定列车跳停
|
||||
// set upTrainSkipstop(v: boolean);
|
||||
// get downTrainSkipstop(): boolean; //下行方向指定列车跳停
|
||||
// set downTrainSkipstop(v: boolean);
|
||||
// get nextSectionRunTime(): number; //下一区间运行时间
|
||||
// set nextSectionRunTime(v: number);
|
||||
// get nextSectionRunLevel(): number; //下一区间运行等级
|
||||
// set nextSectionRunLevel(v: number);
|
||||
// get stopTime(): number; //停站时间
|
||||
// set stopTime(v: number);
|
||||
}
|
||||
|
||||
//站台颜色
|
||||
export enum PlatformColorEnum {
|
||||
grey = '0x7F7F7F', //站台没有列车停站
|
||||
yellow = '0xfbff00', //列车在站台停站
|
||||
blue = '0xC0C0FE', //列车在站台跳停
|
||||
white = '0xffffff',
|
||||
lozengeRed = '0xff0000', //站台旁的菱形图标
|
||||
whiteNumbers = '0xffffff', //站台旁白色数字
|
||||
whiteCircle = '0xffffff', //H字符旁的圆圈
|
||||
HCharYellow = '0xfbff00', //站台旁的扣字
|
||||
HCharWhite = '0xffffff',
|
||||
HCharRed = '0xff0000',
|
||||
SCharBlue = '0x00FFCC', ////站台旁的跳字
|
||||
doorGreen = '0x00FF00', //屏蔽门的颜色
|
||||
doorRed = '0xff0000',
|
||||
doorBlue = '0x4048C4',
|
||||
}
|
||||
|
||||
const platformConsts = {
|
||||
width: 90,
|
||||
height: 20,
|
||||
lineWidth: 3,
|
||||
besideFontSize: 12,
|
||||
doorOpenSpacing: 15,
|
||||
doorPlatformSpacing: 17,
|
||||
besideSpacing: 10,
|
||||
circleRadius: 9,
|
||||
smallDoorWidth: 10,
|
||||
white: '0xffffff', //站台颜色
|
||||
};
|
||||
|
||||
//子元素--矩形
|
||||
@ -99,171 +46,22 @@ export class rectGraphic extends Container {
|
||||
}
|
||||
draw(state: IPlatformState): void {
|
||||
const rectGraphic = this.rectGraphic;
|
||||
rectGraphic.clear();
|
||||
const fillColor = PlatformColorEnum.white;
|
||||
if (state) {
|
||||
// fillColor = PlatformColorEnum.yellow;
|
||||
}
|
||||
// if (state.upSkipstop || state.downSkipstop) {
|
||||
// fillColor = PlatformColorEnum.grey;
|
||||
// }
|
||||
rectGraphic.lineStyle(platformConsts.lineWidth, new Color(fillColor));
|
||||
rectGraphic.beginFill(fillColor, 1);
|
||||
rectGraphic.drawRect(0, 0, platformConsts.width, platformConsts.height);
|
||||
rectGraphic.endFill;
|
||||
const rectP = new Rectangle(
|
||||
0,
|
||||
0,
|
||||
platformConsts.width,
|
||||
platformConsts.height
|
||||
const fillColor = platformConsts.white;
|
||||
rectGraphic
|
||||
.clear()
|
||||
.lineStyle(platformConsts.lineWidth, new Color(fillColor))
|
||||
.beginFill(fillColor, 1)
|
||||
.drawRect(0, 0, platformConsts.width, platformConsts.height).endFill;
|
||||
rectGraphic.pivot = getRectangleCenter(
|
||||
new Rectangle(0, 0, platformConsts.width, platformConsts.height)
|
||||
);
|
||||
rectGraphic.pivot = getRectangleCenter(rectP);
|
||||
}
|
||||
clear(): void {
|
||||
this.rectGraphic.clear();
|
||||
}
|
||||
}
|
||||
//子元素--字符
|
||||
class codeGraph extends Container {
|
||||
static Type = 'Code';
|
||||
hold: VectorText = new VectorText(''); //扣车
|
||||
runLevel: VectorText = new VectorText(''); //运行等级
|
||||
runTime: VectorText = new VectorText(''); //运行时间
|
||||
stopTime: VectorText = new VectorText(''); //停站时间
|
||||
skipStop: VectorText = new VectorText(''); //调停
|
||||
circle: Graphics = new Graphics();
|
||||
constructor() {
|
||||
super();
|
||||
this.addChild(this.hold);
|
||||
this.addChild(this.runLevel);
|
||||
this.addChild(this.stopTime);
|
||||
this.addChild(this.runTime);
|
||||
this.addChild(this.skipStop);
|
||||
this.addChild(this.circle);
|
||||
this.hold.setVectorFontSize(platformConsts.besideFontSize);
|
||||
this.runLevel.setVectorFontSize(platformConsts.besideFontSize);
|
||||
this.stopTime.setVectorFontSize(platformConsts.besideFontSize);
|
||||
this.runTime.setVectorFontSize(platformConsts.besideFontSize);
|
||||
this.skipStop.setVectorFontSize(platformConsts.besideFontSize);
|
||||
}
|
||||
draw(): void {
|
||||
//扣车
|
||||
const hold = this.hold;
|
||||
hold.text = '扣';
|
||||
hold.anchor.set(0.5);
|
||||
hold.position.set(
|
||||
-platformConsts.width / 2 -
|
||||
platformConsts.lineWidth / 2 -
|
||||
(platformConsts.besideSpacing * 2) / 3,
|
||||
-(platformConsts.height * 3) / 4
|
||||
);
|
||||
hold.style.fill = PlatformColorEnum.HCharWhite;
|
||||
//区间运行等级状态
|
||||
const runLevel = this.runLevel;
|
||||
runLevel.anchor.set(0.5);
|
||||
runLevel.position.set(
|
||||
-platformConsts.width / 2 -
|
||||
platformConsts.lineWidth / 2 -
|
||||
platformConsts.besideSpacing,
|
||||
(-platformConsts.height * 4) / 5
|
||||
);
|
||||
runLevel.style.fill = PlatformColorEnum.yellow;
|
||||
//区间运行时间
|
||||
const runTime = this.runTime;
|
||||
runTime.anchor.set(0.5);
|
||||
runTime.position.set(
|
||||
platformConsts.width / 2 +
|
||||
platformConsts.lineWidth / 2 +
|
||||
platformConsts.besideSpacing,
|
||||
-platformConsts.besideSpacing
|
||||
);
|
||||
runTime.style.fill = PlatformColorEnum.whiteNumbers;
|
||||
//停站时间
|
||||
const stopTime = this.stopTime;
|
||||
stopTime.anchor.set(0.5);
|
||||
stopTime.position.set(
|
||||
-platformConsts.width / 2 -
|
||||
platformConsts.lineWidth / 2 -
|
||||
platformConsts.besideSpacing,
|
||||
0
|
||||
);
|
||||
stopTime.style.fill = PlatformColorEnum.whiteNumbers;
|
||||
//跳停
|
||||
const skipStop = this.skipStop;
|
||||
skipStop.text = '跳';
|
||||
skipStop.anchor.set(0.5);
|
||||
const ps = calculateMirrorPoint(new Point(0, 0), hold.position);
|
||||
skipStop.position.set(ps.x + 4, ps.y);
|
||||
skipStop.style.fill = PlatformColorEnum.SCharBlue;
|
||||
const circle = this.circle;
|
||||
circle.clear();
|
||||
circle.lineStyle(1, PlatformColorEnum.SCharBlue);
|
||||
circle.drawCircle(0, 0, platformConsts.circleRadius);
|
||||
circle.position.copyFrom(skipStop.position);
|
||||
hold.visible = false;
|
||||
runLevel.visible = false;
|
||||
stopTime.visible = false;
|
||||
runTime.visible = false;
|
||||
skipStop.visible = false;
|
||||
circle.visible = false;
|
||||
}
|
||||
clear(): void {
|
||||
this.hold.destroy();
|
||||
}
|
||||
// changeState(stateData: IPlatformState): void {
|
||||
// if (
|
||||
// stateData.upHold ||
|
||||
// stateData.upOccHold ||
|
||||
// stateData.downHold ||
|
||||
// stateData.downOccHold
|
||||
// ) {
|
||||
// this.hold.text = '扣';
|
||||
// this.hold.visible = true;
|
||||
// //上行扣车
|
||||
// if (stateData.upHold) {
|
||||
// this.hold.style.fill = PlatformColorEnum.HCharYellow;
|
||||
// }
|
||||
// if (stateData.upOccHold) {
|
||||
// this.hold.style.fill = PlatformColorEnum.HCharWhite;
|
||||
// }
|
||||
// if (stateData.upHold && stateData.upOccHold) {
|
||||
// this.hold.style.fill = PlatformColorEnum.HCharRed;
|
||||
// }
|
||||
// //下行扣车
|
||||
// if (stateData.downHold) {
|
||||
// this.hold.style.fill = PlatformColorEnum.HCharYellow;
|
||||
// }
|
||||
// if (stateData.downOccHold) {
|
||||
// this.hold.style.fill = PlatformColorEnum.HCharWhite;
|
||||
// }
|
||||
// if (stateData.downHold && stateData.downOccHold) {
|
||||
// this.hold.style.fill = PlatformColorEnum.HCharRed;
|
||||
// }
|
||||
// }
|
||||
// //运行等级
|
||||
// if (stateData.nextSectionRunLevel) {
|
||||
// this.runLevel.visible = true;
|
||||
// this.runLevel.text = stateData.nextSectionRunLevel;
|
||||
// }
|
||||
// //运行时间
|
||||
// if (stateData.nextSectionRunTime) {
|
||||
// this.runTime.visible = false;
|
||||
// this.runTime.text = stateData.nextSectionRunTime;
|
||||
// }
|
||||
// //停站时间
|
||||
// if (stateData.stopTime) {
|
||||
// this.stopTime.visible = true;
|
||||
// this.stopTime.text = stateData.stopTime;
|
||||
// }
|
||||
// //跳停
|
||||
// if (stateData.upSkipstop || stateData.downSkipstop) {
|
||||
// this.skipStop.visible = true;
|
||||
// this.circle.visible = true;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
//子元素--站台旁菱形图标
|
||||
class emergClose extends JlGraphic {
|
||||
/* class emergClose extends JlGraphic {
|
||||
static Type = 'emergClose';
|
||||
lozenge: Graphics;
|
||||
deltaTime = 0;
|
||||
@ -316,32 +114,28 @@ class emergClose extends JlGraphic {
|
||||
});
|
||||
return flashAnmiation;
|
||||
}
|
||||
// changeState(id: string, stateData: IPlatformState): void {
|
||||
// let redFlash = this.animation(`${id}emergClose_red_flash`);
|
||||
// if (stateData.emergstop) {
|
||||
// if (!redFlash) {
|
||||
// redFlash = this.createFlashAnmiation(`${id}emergClose_red_flash`);
|
||||
// this.addAnimation(redFlash);
|
||||
// }
|
||||
// redFlash.resume();
|
||||
// } else {
|
||||
// if (redFlash) {
|
||||
// redFlash.pause();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
changeState(id: string, stateData: IPlatformState): void {
|
||||
let redFlash = this.animation(`${id}emergClose_red_flash`);
|
||||
if (stateData.emergstop) {
|
||||
if (!redFlash) {
|
||||
redFlash = this.createFlashAnmiation(`${id}emergClose_red_flash`);
|
||||
this.addAnimation(redFlash);
|
||||
}
|
||||
redFlash.resume();
|
||||
} else {
|
||||
if (redFlash) {
|
||||
redFlash.pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
export class Platform extends JlGraphic {
|
||||
static Type = 'Platform';
|
||||
platformGraphic: rectGraphic = new rectGraphic();
|
||||
emergClose: emergClose = new emergClose();
|
||||
codeGraph: codeGraph = new codeGraph();
|
||||
rectGraphic: rectGraphic = new rectGraphic();
|
||||
constructor() {
|
||||
super(Platform.Type);
|
||||
this.addChild(this.platformGraphic);
|
||||
this.addChild(this.emergClose);
|
||||
this.addChild(this.codeGraph);
|
||||
this.addChild(this.rectGraphic);
|
||||
}
|
||||
|
||||
get datas(): IPlatformData {
|
||||
@ -354,27 +148,7 @@ export class Platform extends JlGraphic {
|
||||
return this.datas.index + '';
|
||||
}
|
||||
doRepaint(): void {
|
||||
this.platformGraphic.draw(this.states);
|
||||
this.emergClose.draw();
|
||||
this.codeGraph.draw();
|
||||
this.emergClose.position.set(
|
||||
0,
|
||||
-platformConsts.height / 2 -
|
||||
platformConsts.doorPlatformSpacing -
|
||||
platformConsts.height / 3
|
||||
);
|
||||
this.codeGraph.position.set(0, 0);
|
||||
//站台方向
|
||||
/* if (this.datas.direction == 'down') {
|
||||
const psChange = [
|
||||
this.emergClose,
|
||||
...this.codeGraph.children,
|
||||
];
|
||||
psChange.forEach((g) => {
|
||||
g.position.copyFrom(calculateMirrorPoint(new Point(0, 0), g.position));
|
||||
});
|
||||
} */
|
||||
// this.changeState();
|
||||
this.rectGraphic.draw(this.states);
|
||||
}
|
||||
buildRelation() {
|
||||
const stationas = this.queryStore.queryByType<Station>(Station.Type);
|
||||
@ -385,40 +159,58 @@ export class Platform extends JlGraphic {
|
||||
break;
|
||||
}
|
||||
}
|
||||
const sections = this.queryStore.queryByType<Section>(Section.Type);
|
||||
const minDistanceRefSections: Section[] = [];
|
||||
sections.forEach((section) => {
|
||||
const sP = section.localBoundsToCanvasPoints();
|
||||
if (this.x > sP[0].x && this.x < sP[1].x) {
|
||||
minDistanceRefSections.push(section);
|
||||
}
|
||||
});
|
||||
const refSection = minDistanceRefSections.reduce((prev, cur) => {
|
||||
return distance2(prev.position, this.position) >
|
||||
distance2(cur.position, this.position)
|
||||
? cur
|
||||
: prev;
|
||||
});
|
||||
if (refSection) {
|
||||
this.relationManage.addRelation(this, refSection);
|
||||
}
|
||||
}
|
||||
saveRelations() {
|
||||
const platformRef = [];
|
||||
const refStation = this.relationManage
|
||||
.getRelationsOfGraphicAndOtherType(this, Station.Type)
|
||||
.map((relation) => relation.getOtherGraphic<Station>(this).datas.id);
|
||||
if (refStation.length) {
|
||||
this.datas.refStation = refStation[0];
|
||||
platformRef.push(createRelatedRefProto(Station.Type, refStation[0]));
|
||||
}
|
||||
const refSection = this.relationManage
|
||||
.getRelationsOfGraphicAndOtherType(this, Section.Type)
|
||||
.map((relation) => relation.getOtherGraphic<Section>(this).datas.id);
|
||||
if (refStation.length) {
|
||||
platformRef.push(createRelatedRefProto(Section.Type, refSection[0]));
|
||||
}
|
||||
this.datas.platformRef = platformRef;
|
||||
}
|
||||
loadRelations() {
|
||||
if (this.datas.refStation) {
|
||||
if (this.datas.platformRef.length) {
|
||||
this.datas.platformRef.forEach((device) => {
|
||||
this.relationManage.addRelation(
|
||||
this,
|
||||
this.queryStore.queryById<Station>(this.datas.refStation)
|
||||
this.queryStore.queryById(device.id)
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
// changeState(): void {
|
||||
// this.doorGraphic.changeState(this.states);
|
||||
// this.emergClose.changeState(this.id, this.states);
|
||||
// this.codeGraph.changeState(this.states);
|
||||
// }
|
||||
}
|
||||
|
||||
export class PlatformTemplate extends JlGraphicTemplate<Platform> {
|
||||
hasdoor: boolean;
|
||||
direction: string;
|
||||
constructor(dataTemplate: IPlatformData, stateTemplate: IPlatformState) {
|
||||
super(Platform.Type, {
|
||||
dataTemplate,
|
||||
stateTemplate,
|
||||
});
|
||||
this.hasdoor = true;
|
||||
this.direction = 'up';
|
||||
}
|
||||
new(): Platform {
|
||||
const platform = new Platform();
|
||||
|
@ -37,9 +37,6 @@ export class PlatformDraw extends GraphicDrawAssistant<
|
||||
this.platformGraphic.doRepaint();
|
||||
}
|
||||
|
||||
clearCache(): void {
|
||||
//this.platformGraphic.clear();
|
||||
}
|
||||
onLeftDown(e: FederatedPointerEvent): void {
|
||||
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
|
||||
this.createAndStore(true);
|
||||
|
@ -117,14 +117,10 @@ export class ScreenDoor extends JlGraphic {
|
||||
}
|
||||
|
||||
export class ScreenDoorTemplate extends JlGraphicTemplate<ScreenDoor> {
|
||||
hasdoor: boolean;
|
||||
direction: string;
|
||||
constructor(dataTemplate: IScreenDoorData) {
|
||||
super(ScreenDoor.Type, {
|
||||
dataTemplate,
|
||||
});
|
||||
this.hasdoor = true;
|
||||
this.direction = 'up';
|
||||
}
|
||||
new(): ScreenDoor {
|
||||
const screenDoor = new ScreenDoor();
|
||||
|
@ -53,12 +53,11 @@ function buildAbsorbablePositions(
|
||||
): AbsorbablePosition[] {
|
||||
const aps: AbsorbablePosition[] = [];
|
||||
const platforms = screenDoor.queryStore.queryByType<Platform>(Platform.Type);
|
||||
const { width, height } = screenDoor.getGraphicApp().canvas;
|
||||
const { height } = screenDoor.getGraphicApp().canvas;
|
||||
platforms.forEach((platform) => {
|
||||
const ps = platform.datas.transform.position;
|
||||
const xs = new AbsorbableLine({ x: 0, y: ps.y }, { x: width, y: ps.y });
|
||||
const ys = new AbsorbableLine({ x: ps.x, y: 0 }, { x: ps.x, y: height });
|
||||
aps.push(xs, ys);
|
||||
aps.push(ys);
|
||||
});
|
||||
return aps;
|
||||
}
|
||||
|
@ -1315,10 +1315,10 @@ export namespace graphicData {
|
||||
common?: CommonInfo;
|
||||
code?: string;
|
||||
index?: number;
|
||||
refStation?: string;
|
||||
platformRef?: RelatedRef[];
|
||||
}) {
|
||||
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, [8], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("common" in data && data.common != undefined) {
|
||||
this.common = data.common;
|
||||
@ -1329,8 +1329,8 @@ export namespace graphicData {
|
||||
if ("index" in data && data.index != undefined) {
|
||||
this.index = data.index;
|
||||
}
|
||||
if ("refStation" in data && data.refStation != undefined) {
|
||||
this.refStation = data.refStation;
|
||||
if ("platformRef" in data && data.platformRef != undefined) {
|
||||
this.platformRef = data.platformRef;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1355,17 +1355,17 @@ export namespace graphicData {
|
||||
set index(value: number) {
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
}
|
||||
get refStation() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 8, "") as string;
|
||||
get platformRef() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, RelatedRef, 8) as RelatedRef[];
|
||||
}
|
||||
set refStation(value: string) {
|
||||
pb_1.Message.setField(this, 8, value);
|
||||
set platformRef(value: RelatedRef[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 8, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
index?: number;
|
||||
refStation?: string;
|
||||
platformRef?: ReturnType<typeof RelatedRef.prototype.toObject>[];
|
||||
}): Platform {
|
||||
const message = new Platform({});
|
||||
if (data.common != null) {
|
||||
@ -1377,8 +1377,8 @@ export namespace graphicData {
|
||||
if (data.index != null) {
|
||||
message.index = data.index;
|
||||
}
|
||||
if (data.refStation != null) {
|
||||
message.refStation = data.refStation;
|
||||
if (data.platformRef != null) {
|
||||
message.platformRef = data.platformRef.map(item => RelatedRef.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
@ -1387,7 +1387,7 @@ export namespace graphicData {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
index?: number;
|
||||
refStation?: string;
|
||||
platformRef?: ReturnType<typeof RelatedRef.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.common != null) {
|
||||
data.common = this.common.toObject();
|
||||
@ -1398,8 +1398,8 @@ export namespace graphicData {
|
||||
if (this.index != null) {
|
||||
data.index = this.index;
|
||||
}
|
||||
if (this.refStation != null) {
|
||||
data.refStation = this.refStation;
|
||||
if (this.platformRef != null) {
|
||||
data.platformRef = this.platformRef.map((item: RelatedRef) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@ -1413,8 +1413,8 @@ export namespace graphicData {
|
||||
writer.writeString(2, this.code);
|
||||
if (this.index != 0)
|
||||
writer.writeInt32(5, this.index);
|
||||
if (this.refStation.length)
|
||||
writer.writeString(8, this.refStation);
|
||||
if (this.platformRef.length)
|
||||
writer.writeRepeatedMessage(8, this.platformRef, (item: RelatedRef) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -1434,7 +1434,7 @@ export namespace graphicData {
|
||||
message.index = reader.readInt32();
|
||||
break;
|
||||
case 8:
|
||||
message.refStation = reader.readString();
|
||||
reader.readMessage(message.platformRef, () => pb_1.Message.addToRepeatedWrapperField(message, 8, RelatedRef.deserialize(reader), RelatedRef));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
@ -3275,7 +3275,9 @@ export namespace graphicData {
|
||||
TrainWindow = 2,
|
||||
AxleCounting = 3,
|
||||
SectionLink = 4,
|
||||
signal = 5
|
||||
signal = 5,
|
||||
station = 6,
|
||||
ScreenDoor = 7
|
||||
}
|
||||
export enum DevicePort {
|
||||
A = 0,
|
||||
|
Loading…
Reference in New Issue
Block a user