Merge branch 'master' of git.code.tencent.com:xian-ncc-da/xian-ncc-da-client
This commit is contained in:
commit
773010b73e
@ -67,16 +67,20 @@ enum showSelect {
|
||||
否 = 'false',
|
||||
向上 = 'up',
|
||||
向下 = 'down',
|
||||
上行 = 'upLink',
|
||||
下行 = 'downLink',
|
||||
}
|
||||
enum showUp {
|
||||
上行 = 'true',
|
||||
下行 = 'false',
|
||||
}
|
||||
enum showSelectData {
|
||||
true = '是',
|
||||
false = '否',
|
||||
up = '向上',
|
||||
down = '向下',
|
||||
upLink = '上行',
|
||||
downLink = '下行',
|
||||
}
|
||||
enum showUpData {
|
||||
true = '上行',
|
||||
false = '下行',
|
||||
}
|
||||
|
||||
drawStore.$subscribe;
|
||||
@ -87,7 +91,7 @@ watch(
|
||||
platformModel.copyFrom(val.saveData() as PlatformData);
|
||||
hasDoor.value = (showSelectData as never)[platformModel.hasdoor + ''];
|
||||
direction.value = (showSelectData as never)[platformModel.direction];
|
||||
upAndDown.value = (showSelectData as never)[platformModel.upAndDown];
|
||||
upAndDown.value = (showUpData as never)[platformModel.up + ''];
|
||||
if (platformModel.refStation) {
|
||||
const refStation = val.queryStore.queryById<Station>(
|
||||
platformModel.refStation
|
||||
@ -104,7 +108,7 @@ onMounted(() => {
|
||||
platformModel.copyFrom(platform.saveData());
|
||||
hasDoor.value = (showSelectData as never)[platformModel.hasdoor + ''];
|
||||
direction.value = (showSelectData as never)[platformModel.direction];
|
||||
upAndDown.value = (showSelectData as never)[platformModel.upAndDown];
|
||||
upAndDown.value = (showUpData as never)[platformModel.up + ''];
|
||||
if (platformModel.refStation) {
|
||||
const refStation = platform.queryStore.queryById<Station>(
|
||||
platformModel.refStation
|
||||
@ -117,7 +121,7 @@ onMounted(() => {
|
||||
function onUpdate() {
|
||||
platformModel.hasdoor = JSON.parse((showSelect as never)[hasDoor.value]);
|
||||
platformModel.direction = (showSelect as never)[direction.value];
|
||||
platformModel.upAndDown = (showSelect as never)[upAndDown.value];
|
||||
platformModel.up = JSON.parse((showUp as never)[upAndDown.value]);
|
||||
const platform = drawStore.selectedGraphic as Platform;
|
||||
if (platform) {
|
||||
drawStore.getDrawApp().updateGraphicAndRecord(platform, platformModel);
|
||||
|
@ -53,11 +53,11 @@ export class PlatformData extends GraphicDataBase implements IPlatformData {
|
||||
set direction(v: string) {
|
||||
this.data.direction = v;
|
||||
}
|
||||
get upAndDown(): string {
|
||||
return this.data.upAndDown;
|
||||
get up(): boolean {
|
||||
return this.data.up;
|
||||
}
|
||||
set upAndDown(v: string) {
|
||||
this.data.upAndDown = v;
|
||||
set up(v: boolean) {
|
||||
this.data.up = v;
|
||||
}
|
||||
get refStation(): string {
|
||||
return this.data.refStation;
|
||||
|
@ -85,6 +85,7 @@ import {
|
||||
LogicSectionTemplate,
|
||||
} from 'src/graphics/logicSection/LogicSection';
|
||||
import { LogicSectionData } from './graphics/LogicSectionInteraction';
|
||||
import { FederatedMouseEvent } from 'pixi.js';
|
||||
|
||||
// export function fromStoragePoint(p: graphicData.Point): Point {
|
||||
// return new Point(p.x, p.y);
|
||||
@ -116,34 +117,89 @@ import { LogicSectionData } from './graphics/LogicSectionInteraction';
|
||||
// });
|
||||
// }
|
||||
|
||||
const UndoOptions: MenuItemOptions = {
|
||||
name: '撤销',
|
||||
};
|
||||
const RedoOptions: MenuItemOptions = {
|
||||
name: '重做',
|
||||
};
|
||||
const SelectAllOptions: MenuItemOptions = {
|
||||
name: '全选',
|
||||
};
|
||||
const JumpStaitonOptions: MenuItemOptions = {
|
||||
name: '车站',
|
||||
};
|
||||
|
||||
const DefaultCanvasMenu = new ContextMenu({
|
||||
name: '绘制-画布菜单',
|
||||
groups: [
|
||||
{
|
||||
items: [UndoOptions, RedoOptions],
|
||||
},
|
||||
{
|
||||
items: [SelectAllOptions],
|
||||
},
|
||||
{
|
||||
items: [JumpStaitonOptions],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
function constructMenu(app: JlDrawApp): (e: FederatedMouseEvent) => void {
|
||||
const UndoOptions: MenuItemOptions = {
|
||||
name: '撤销',
|
||||
};
|
||||
const RedoOptions: MenuItemOptions = {
|
||||
name: '重做',
|
||||
};
|
||||
const SelectAllOptions: MenuItemOptions = {
|
||||
name: '全选',
|
||||
};
|
||||
const JumpStaitonOptions: MenuItemOptions = {
|
||||
name: '车站',
|
||||
};
|
||||
const draftType = useDrawStore().$state.draftType;
|
||||
const DefaultCanvasMenu =
|
||||
draftType === 'Line'
|
||||
? new ContextMenu({
|
||||
name: '绘制-画布菜单',
|
||||
groups: [
|
||||
{
|
||||
items: [UndoOptions, RedoOptions],
|
||||
},
|
||||
{
|
||||
items: [SelectAllOptions],
|
||||
},
|
||||
{
|
||||
items: [JumpStaitonOptions],
|
||||
},
|
||||
],
|
||||
})
|
||||
: new ContextMenu({
|
||||
name: '绘制-画布菜单',
|
||||
groups: [
|
||||
{
|
||||
items: [UndoOptions, RedoOptions],
|
||||
},
|
||||
{
|
||||
items: [SelectAllOptions],
|
||||
},
|
||||
],
|
||||
});
|
||||
// 画布右键菜单
|
||||
app.registerMenu(DefaultCanvasMenu);
|
||||
// FederatedMouseEvent
|
||||
const handleRightClick = (e: FederatedMouseEvent) => {
|
||||
UndoOptions.disabled = !app.opRecord.hasUndo;
|
||||
RedoOptions.disabled = !app.opRecord.hasRedo;
|
||||
UndoOptions.handler = () => {
|
||||
app.opRecord.undo();
|
||||
};
|
||||
RedoOptions.handler = () => {
|
||||
app.opRecord.redo();
|
||||
};
|
||||
SelectAllOptions.handler = () => {
|
||||
app.selectAllGraphics();
|
||||
};
|
||||
if (draftType === 'Line') {
|
||||
const stations = app.queryStore.queryByType<Station>(Station.Type);
|
||||
const jumpStaitonItems: MenuItemOptions[] = [];
|
||||
stations.forEach((station) => {
|
||||
const item: MenuItemOptions = {
|
||||
name: station.datas.code,
|
||||
handler: () => {
|
||||
app.makeGraphicCenterShow(station);
|
||||
},
|
||||
};
|
||||
jumpStaitonItems.push(item);
|
||||
});
|
||||
JumpStaitonOptions.subMenu = {
|
||||
name: '车站列表',
|
||||
groups: [
|
||||
{
|
||||
name: '车站列表',
|
||||
items: jumpStaitonItems,
|
||||
},
|
||||
],
|
||||
};
|
||||
DefaultCanvasMenu.update();
|
||||
}
|
||||
DefaultCanvasMenu.open(e.global);
|
||||
};
|
||||
return handleRightClick;
|
||||
}
|
||||
let drawApp: JlDrawApp | null = null;
|
||||
|
||||
export function getDrawApp(): JlDrawApp | null {
|
||||
@ -161,7 +217,6 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
|
||||
drawApp = new JlDrawApp(dom);
|
||||
const app = drawApp;
|
||||
//根据草稿图类型加载绘图工具
|
||||
const draftType = useDrawStore().$state.draftType;
|
||||
let drawAssistants: (
|
||||
| PlatformDraw
|
||||
| StationDraw
|
||||
@ -180,6 +235,7 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
|
||||
| AxleCountingDraw
|
||||
| SeparatorDraw
|
||||
)[] = [];
|
||||
const draftType = useDrawStore().$state.draftType;
|
||||
if (draftType === 'Line') {
|
||||
drawAssistants = [
|
||||
new PlatformDraw(
|
||||
@ -228,44 +284,10 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
|
||||
}
|
||||
|
||||
app.setOptions({ drawAssistants: drawAssistants });
|
||||
|
||||
// 画布右键菜单
|
||||
app.registerMenu(DefaultCanvasMenu);
|
||||
const handleRIghtClick = constructMenu(app);
|
||||
app.canvas.on('_rightclick', (e) => {
|
||||
if (app._drawing) return;
|
||||
UndoOptions.disabled = !app.opRecord.hasUndo;
|
||||
RedoOptions.disabled = !app.opRecord.hasRedo;
|
||||
UndoOptions.handler = () => {
|
||||
app.opRecord.undo();
|
||||
};
|
||||
RedoOptions.handler = () => {
|
||||
app.opRecord.redo();
|
||||
};
|
||||
SelectAllOptions.handler = () => {
|
||||
app.selectAllGraphics();
|
||||
};
|
||||
const stations = app.queryStore.queryByType<Station>(Station.Type);
|
||||
const jumpStaitonItems: MenuItemOptions[] = [];
|
||||
stations.forEach((station) => {
|
||||
const item: MenuItemOptions = {
|
||||
name: station.datas.code,
|
||||
handler: () => {
|
||||
app.makeGraphicCenterShow(station);
|
||||
},
|
||||
};
|
||||
jumpStaitonItems.push(item);
|
||||
});
|
||||
JumpStaitonOptions.subMenu = {
|
||||
name: '车站列表',
|
||||
groups: [
|
||||
{
|
||||
name: '车站列表',
|
||||
items: jumpStaitonItems,
|
||||
},
|
||||
],
|
||||
};
|
||||
DefaultCanvasMenu.update();
|
||||
DefaultCanvasMenu.open(e.global);
|
||||
handleRIghtClick(e);
|
||||
});
|
||||
app.addKeyboardListener(
|
||||
new KeyListener({
|
||||
|
@ -17,8 +17,8 @@ export interface IPlatformData extends GraphicData {
|
||||
set hasdoor(v: boolean);
|
||||
get direction(): string; // 屏蔽门上下
|
||||
set direction(v: string);
|
||||
get upAndDown(): string; // 站台上下行
|
||||
set upAndDown(v: string);
|
||||
get up(): boolean; // 站台上下行
|
||||
set up(v: boolean);
|
||||
get refStation(): string; // 关联的车站
|
||||
set refStation(v: string);
|
||||
clone(): IPlatformData;
|
||||
|
@ -173,8 +173,9 @@ export class Station extends JlGraphic {
|
||||
const kilometerGraph = this.kilometerGraph;
|
||||
const controlGraphic = this.controlGraphic;
|
||||
controlGraphic.clear();
|
||||
codeGraph.text =
|
||||
`${this.datas?.name}(${this.datas?.code})` || '车站Station';
|
||||
codeGraph.text = this.datas?.code
|
||||
? `${this.datas?.name}(${this.datas?.code})`
|
||||
: `${this.datas?.name}`;
|
||||
codeGraph.style.fill = stationConsts.codeColor;
|
||||
codeGraph.setVectorFontSize(stationConsts.codeFontSize);
|
||||
codeGraph.anchor.set(0.5);
|
||||
|
@ -19,6 +19,7 @@ import {
|
||||
import { Section, SectionType } from '../section/Section';
|
||||
import { LogicSection } from '../logicSection/LogicSection';
|
||||
import { Platform } from '../platform/Platform';
|
||||
import { Turnout } from '../turnout/Turnout';
|
||||
|
||||
function graphicsOverlap(
|
||||
x1: number,
|
||||
@ -135,13 +136,19 @@ export class TrainWindowDraw extends GraphicDrawAssistant<
|
||||
trainWindow.loadData(this.graphicTemplate.datas);
|
||||
if (section.type == 'LogicSection') {
|
||||
trainWindow.datas.refDeviceId = [section.id];
|
||||
trainWindow.position.set(
|
||||
x,
|
||||
ps.y - direction * TrainWindowConsts.offsetSection
|
||||
);
|
||||
} else {
|
||||
trainWindow.datas.refDeviceId = (section as Section).datas.children;
|
||||
const refTurnout = (section as Section).datas.children;
|
||||
trainWindow.datas.refDeviceId = refTurnout;
|
||||
const turnout = this.app.queryStore.queryById<Turnout>(refTurnout[0]);
|
||||
trainWindow.position.set(
|
||||
x,
|
||||
turnout.y - direction * TrainWindowConsts.offsetSection
|
||||
);
|
||||
}
|
||||
trainWindow.position.set(
|
||||
x,
|
||||
ps.y - direction * TrainWindowConsts.offsetSection
|
||||
);
|
||||
trainWindow.id = GraphicIdGenerator.next();
|
||||
this.storeGraphic(trainWindow);
|
||||
const platforms = this.app.queryStore.queryByType<Platform>(Platform.Type);
|
||||
|
@ -1706,8 +1706,8 @@ export namespace graphicData {
|
||||
code?: string;
|
||||
hasdoor?: boolean;
|
||||
direction?: string;
|
||||
upAndDown?: string;
|
||||
refStation?: string;
|
||||
up?: boolean;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
@ -1724,12 +1724,12 @@ export namespace graphicData {
|
||||
if ("direction" in data && data.direction != undefined) {
|
||||
this.direction = data.direction;
|
||||
}
|
||||
if ("upAndDown" in data && data.upAndDown != undefined) {
|
||||
this.upAndDown = data.upAndDown;
|
||||
}
|
||||
if ("refStation" in data && data.refStation != undefined) {
|
||||
this.refStation = data.refStation;
|
||||
}
|
||||
if ("up" in data && data.up != undefined) {
|
||||
this.up = data.up;
|
||||
}
|
||||
}
|
||||
}
|
||||
get common() {
|
||||
@ -1759,25 +1759,25 @@ export namespace graphicData {
|
||||
set direction(value: string) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get upAndDown() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 5, "") as string;
|
||||
}
|
||||
set upAndDown(value: string) {
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
}
|
||||
get refStation() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 6, "") as string;
|
||||
}
|
||||
set refStation(value: string) {
|
||||
pb_1.Message.setField(this, 6, value);
|
||||
}
|
||||
get up() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 7, false) as boolean;
|
||||
}
|
||||
set up(value: boolean) {
|
||||
pb_1.Message.setField(this, 7, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
hasdoor?: boolean;
|
||||
direction?: string;
|
||||
upAndDown?: string;
|
||||
refStation?: string;
|
||||
up?: boolean;
|
||||
}): Platform {
|
||||
const message = new Platform({});
|
||||
if (data.common != null) {
|
||||
@ -1792,12 +1792,12 @@ export namespace graphicData {
|
||||
if (data.direction != null) {
|
||||
message.direction = data.direction;
|
||||
}
|
||||
if (data.upAndDown != null) {
|
||||
message.upAndDown = data.upAndDown;
|
||||
}
|
||||
if (data.refStation != null) {
|
||||
message.refStation = data.refStation;
|
||||
}
|
||||
if (data.up != null) {
|
||||
message.up = data.up;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -1806,8 +1806,8 @@ export namespace graphicData {
|
||||
code?: string;
|
||||
hasdoor?: boolean;
|
||||
direction?: string;
|
||||
upAndDown?: string;
|
||||
refStation?: string;
|
||||
up?: boolean;
|
||||
} = {};
|
||||
if (this.common != null) {
|
||||
data.common = this.common.toObject();
|
||||
@ -1821,12 +1821,12 @@ export namespace graphicData {
|
||||
if (this.direction != null) {
|
||||
data.direction = this.direction;
|
||||
}
|
||||
if (this.upAndDown != null) {
|
||||
data.upAndDown = this.upAndDown;
|
||||
}
|
||||
if (this.refStation != null) {
|
||||
data.refStation = this.refStation;
|
||||
}
|
||||
if (this.up != null) {
|
||||
data.up = this.up;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -1841,10 +1841,10 @@ export namespace graphicData {
|
||||
writer.writeBool(3, this.hasdoor);
|
||||
if (this.direction.length)
|
||||
writer.writeString(4, this.direction);
|
||||
if (this.upAndDown.length)
|
||||
writer.writeString(5, this.upAndDown);
|
||||
if (this.refStation.length)
|
||||
writer.writeString(6, this.refStation);
|
||||
if (this.up != false)
|
||||
writer.writeBool(7, this.up);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -1866,12 +1866,12 @@ export namespace graphicData {
|
||||
case 4:
|
||||
message.direction = reader.readString();
|
||||
break;
|
||||
case 5:
|
||||
message.upAndDown = reader.readString();
|
||||
break;
|
||||
case 6:
|
||||
message.refStation = reader.readString();
|
||||
break;
|
||||
case 7:
|
||||
message.up = reader.readBool();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user