diff --git a/bj-rtss-message b/bj-rtss-message index 3121207..5ead82f 160000 --- a/bj-rtss-message +++ b/bj-rtss-message @@ -1 +1 @@ -Subproject commit 31212079c61ac18638a6b93fda81388f4ad5a733 +Subproject commit 5ead82f5bfc0fe13025cfc89d4a825c4a3105565 diff --git a/src/components/draw-app/DrawProperties.vue b/src/components/draw-app/DrawProperties.vue index 17fb7bb..5c5536a 100644 --- a/src/components/draw-app/DrawProperties.vue +++ b/src/components/draw-app/DrawProperties.vue @@ -7,9 +7,6 @@ - @@ -42,9 +39,6 @@ diff --git a/src/components/draw-app/properties/PlatformProperty.vue b/src/components/draw-app/properties/PlatformProperty.vue index dd085c6..7f672db 100644 --- a/src/components/draw-app/properties/PlatformProperty.vue +++ b/src/components/draw-app/properties/PlatformProperty.vue @@ -1,6 +1,20 @@ - - diff --git a/src/drawApp/graphics/LinkInteraction.ts b/src/drawApp/graphics/LinkInteraction.ts deleted file mode 100644 index cd28295..0000000 --- a/src/drawApp/graphics/LinkInteraction.ts +++ /dev/null @@ -1,182 +0,0 @@ -import * as pb_1 from 'google-protobuf'; -import { IPointData, DisplayObject, FederatedMouseEvent } from 'pixi.js'; -import { ILinkData, Link } from 'src/graphics/link/Link'; -import { graphicData } from 'src/protos/stationLayoutGraphics'; -import { GraphicDataBase } from './GraphicDataBase'; -import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu'; -import { MenuItemOptions } from 'src/jl-graphic/ui/Menu'; -import { - GraphicApp, - GraphicInteractionPlugin, - JlGraphic, -} from 'src/jl-graphic'; -import { - addWayPoint, - clearWayPoint, - getWaypointRangeIndex, - PolylineEditPlugin, - removeLineWayPoint, -} from 'src/jl-graphic/plugins/GraphicEditPlugin'; - -export class LinkData extends GraphicDataBase implements ILinkData { - constructor(data?: graphicData.Link) { - let link; - if (!data) { - link = new graphicData.Link({ - common: GraphicDataBase.defaultCommonInfo(Link.Type), - }); - } else { - link = data; - } - super(link); - } - - public get data(): graphicData.Link { - return this.getData(); - } - - get code(): string { - return this.data.code; - } - set code(v: string) { - this.data.code = v; - } - get curve(): boolean { - return this.data.curve; - } - set curve(v: boolean) { - this.data.curve = v; - } - get curveNumber(): number { - return this.data.curve ? 1 : 0; - } - set curveNumber(v: number) { - this.data.curve = v === 0 ? false : true; - } - get segmentsCount(): number { - return this.data.segmentsCount; - } - set segmentsCount(v: number) { - this.data.segmentsCount = v; - } - get points(): IPointData[] { - return this.data.points; - } - set points(points: IPointData[]) { - this.data.points = points.map( - (p) => new graphicData.Point({ x: p.x, y: p.y }) - ); - } - get lineWidth(): number { - return this.data.lineWidth; - } - set lineWidth(v: number) { - this.data.lineWidth = v; - } - get lineColor(): string { - return this.data.lineColor; - } - set lineColor(v: string) { - this.data.lineColor = v; - } - clone(): LinkData { - return new LinkData(this.data.cloneMessage()); - } - copyFrom(data: LinkData): void { - pb_1.Message.copyInto(data.data, this.data); - } - eq(other: LinkData): boolean { - return pb_1.Message.equals(this.data, other.data); - } -} - -export const addWaypointConfig: MenuItemOptions = { - name: '添加路径点', -}; -export const removeWaypointConfig: MenuItemOptions = { - name: '移除路径点', -}; -export const clearWaypointsConfig: MenuItemOptions = { - name: '清除所有路径点', -}; - -const LinkEditMenu: ContextMenu = ContextMenu.init({ - name: '轨道编辑菜单', - groups: [ - { - items: [addWaypointConfig, clearWaypointsConfig], - }, - ], -}); -const EpEditMenu: ContextMenu = ContextMenu.init({ - name: '轨道编辑菜单2', - groups: [ - { - items: [removeWaypointConfig, clearWaypointsConfig], - }, - ], -}); - -export class DrawLinkPlugin extends GraphicInteractionPlugin { - static Name = 'link_draw_right_menu'; - constructor(app: GraphicApp) { - super(DrawLinkPlugin.Name, app); - app.registerMenu(LinkEditMenu); - app.registerMenu(EpEditMenu); - } - static init(app: GraphicApp) { - return new DrawLinkPlugin(app); - } - filter(...grahpics: JlGraphic[]): Link[] | undefined { - return grahpics.filter((g) => g.type === Link.Type).map((g) => g as Link); - } - bind(g: Link): void { - g.on('_rightclick', this.onContextMenu, this); - g.on('selected', this.onSelected, this); - } - - unbind(g: Link): void { - g.off('_rightclick', this.onContextMenu, this); - g.off('selected', this.onSelected, this); - } - - onSelected(g: DisplayObject) { - const polylineEditPlugin = g.assistantAppendMap.get( - PolylineEditPlugin.Name - ) as PolylineEditPlugin; - const link = g.getGraphic() as Link; - polylineEditPlugin.editedPoints.forEach((ep, index) => { - ep.on('rightclick', (e: FederatedMouseEvent) => { - this.app.registerMenu(EpEditMenu); - removeWaypointConfig.handler = () => { - removeLineWayPoint(link, index); - }; - clearWaypointsConfig.handler = () => { - clearWayPoint(link, false); - }; - EpEditMenu.open(e.global); - }); - }); - } - onContextMenu(e: FederatedMouseEvent) { - const target = e.target as DisplayObject; - const link = target.getGraphic() as Link; - this.app.updateSelected(link); - - addWaypointConfig.handler = () => { - const linePoints = link.linePoints; - const p = link.screenToLocalPoint(e.global); - const { start, end } = getWaypointRangeIndex( - linePoints, - false, - p, - link.datas.lineWidth - ); - addWayPoint(link, false, start, end, p); - }; - clearWaypointsConfig.handler = () => { - clearWayPoint(link, false); - }; - LinkEditMenu.open(e.global); - } -} diff --git a/src/drawApp/graphics/PlatformInteraction.ts b/src/drawApp/graphics/PlatformInteraction.ts index a65b744..2f46651 100644 --- a/src/drawApp/graphics/PlatformInteraction.ts +++ b/src/drawApp/graphics/PlatformInteraction.ts @@ -51,6 +51,18 @@ export class PlatformData extends GraphicDataBase implements IPlatformData { set direction(v: string) { this.data.direction = v; } + get index(): number { + return this.data.index; + } + set index(v: number) { + this.data.index = v; + } + get refStationIndex(): number { + return this.data.refStationIndex; + } + set refStationIndex(v: number) { + this.data.refStationIndex = v; + } clone(): PlatformData { return new PlatformData(this.data.cloneMessage()); diff --git a/src/drawApp/graphics/SignalInteraction.ts b/src/drawApp/graphics/SignalInteraction.ts index 658dede..9d4e59f 100644 --- a/src/drawApp/graphics/SignalInteraction.ts +++ b/src/drawApp/graphics/SignalInteraction.ts @@ -50,6 +50,12 @@ export class SignalData extends GraphicDataBase implements ISignalData { set kilometerSystem(v: KilometerSystem) { this.data.kilometerSystem = new graphicData.KilometerSystem(v); } + get index(): number { + return this.data.index; + } + set index(v: number) { + this.data.index = v; + } clone(): SignalData { return new SignalData(this.data.cloneMessage()); } diff --git a/src/drawApp/graphics/StationInteraction.ts b/src/drawApp/graphics/StationInteraction.ts index b2e188c..92efb61 100644 --- a/src/drawApp/graphics/StationInteraction.ts +++ b/src/drawApp/graphics/StationInteraction.ts @@ -57,6 +57,12 @@ export class StationData extends GraphicDataBase implements IStationData { set concentrationStations(v: boolean) { this.data.concentrationStations = v; } + get index(): number { + return this.data.index; + } + set index(v: number) { + this.data.index = v; + } clone(): StationData { return new StationData(this.data.cloneMessage()); } diff --git a/src/drawApp/graphics/TurnoutInteraction.ts b/src/drawApp/graphics/TurnoutInteraction.ts index 2ee0e90..a11f490 100644 --- a/src/drawApp/graphics/TurnoutInteraction.ts +++ b/src/drawApp/graphics/TurnoutInteraction.ts @@ -86,6 +86,12 @@ export class TurnoutData extends GraphicDataBase implements ITurnoutData { (v) => new graphicData.KilometerSystem(v) ); } + get index(): number { + return this.data.index; + } + set index(v: number) { + this.data.index = v; + } clone(): TurnoutData { return new TurnoutData(this.data.cloneMessage()); } diff --git a/src/graphics/platform/Platform.ts b/src/graphics/platform/Platform.ts index 0163f62..348c7fd 100644 --- a/src/graphics/platform/Platform.ts +++ b/src/graphics/platform/Platform.ts @@ -17,6 +17,10 @@ export interface IPlatformData extends GraphicData { set hasdoor(v: boolean); get direction(): string; // 屏蔽门上下 set direction(v: string); + get index(): number; + set index(v: number); + get refStationIndex(): number; + set refStationIndex(v: number); clone(): IPlatformData; copyFrom(data: IPlatformData): void; eq(other: IPlatformData): boolean; diff --git a/src/graphics/signal/Signal.ts b/src/graphics/signal/Signal.ts index 52a86ec..fb164e2 100644 --- a/src/graphics/signal/Signal.ts +++ b/src/graphics/signal/Signal.ts @@ -24,6 +24,8 @@ export interface ISignalData extends GraphicData { set mirror(v: boolean); get kilometerSystem(): KilometerSystem; set kilometerSystem(v: KilometerSystem); + get index(): number; + set index(v: number); clone(): ISignalData; copyFrom(data: ISignalData): void; eq(other: ISignalData): boolean; diff --git a/src/graphics/station/Station.ts b/src/graphics/station/Station.ts index 4bd135c..407c3a3 100644 --- a/src/graphics/station/Station.ts +++ b/src/graphics/station/Station.ts @@ -17,6 +17,8 @@ export interface IStationData extends GraphicData { set hasControl(v: boolean); get concentrationStations(): boolean; ////是否集中站 set concentrationStations(v: boolean); + get index(): number; + set index(v: number); clone(): IStationData; copyFrom(data: IStationData): void; eq(other: IStationData): boolean; diff --git a/src/graphics/turnout/Turnout.ts b/src/graphics/turnout/Turnout.ts index 2a69175..3a7b6ca 100644 --- a/src/graphics/turnout/Turnout.ts +++ b/src/graphics/turnout/Turnout.ts @@ -35,6 +35,8 @@ export interface ITurnoutData extends GraphicData { set pcRef(ref: IRelatedRefData | undefined); get kilometerSystem(): KilometerSystem[]; set kilometerSystem(v: KilometerSystem[]); + get index(): number; + set index(v: number); clone(): ITurnoutData; copyFrom(data: ITurnoutData): void; eq(other: ITurnoutData): boolean; diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts index abe9019..eba1a38 100644 --- a/src/protos/stationLayoutGraphics.ts +++ b/src/protos/stationLayoutGraphics.ts @@ -941,6 +941,8 @@ export namespace graphicData { code?: string; hasdoor?: boolean; direction?: string; + index?: number; + refStationIndex?: number; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); @@ -957,6 +959,12 @@ export namespace graphicData { if ("direction" in data && data.direction != undefined) { this.direction = data.direction; } + if ("index" in data && data.index != undefined) { + this.index = data.index; + } + if ("refStationIndex" in data && data.refStationIndex != undefined) { + this.refStationIndex = data.refStationIndex; + } } } get common() { @@ -986,11 +994,25 @@ export namespace graphicData { set direction(value: string) { pb_1.Message.setField(this, 4, value); } + get index() { + return pb_1.Message.getFieldWithDefault(this, 5, 0) as number; + } + set index(value: number) { + pb_1.Message.setField(this, 5, value); + } + get refStationIndex() { + return pb_1.Message.getFieldWithDefault(this, 6, 0) as number; + } + set refStationIndex(value: number) { + pb_1.Message.setField(this, 6, value); + } static fromObject(data: { common?: ReturnType; code?: string; hasdoor?: boolean; direction?: string; + index?: number; + refStationIndex?: number; }): Platform { const message = new Platform({}); if (data.common != null) { @@ -1005,6 +1027,12 @@ export namespace graphicData { if (data.direction != null) { message.direction = data.direction; } + if (data.index != null) { + message.index = data.index; + } + if (data.refStationIndex != null) { + message.refStationIndex = data.refStationIndex; + } return message; } toObject() { @@ -1013,6 +1041,8 @@ export namespace graphicData { code?: string; hasdoor?: boolean; direction?: string; + index?: number; + refStationIndex?: number; } = {}; if (this.common != null) { data.common = this.common.toObject(); @@ -1026,6 +1056,12 @@ export namespace graphicData { if (this.direction != null) { data.direction = this.direction; } + if (this.index != null) { + data.index = this.index; + } + if (this.refStationIndex != null) { + data.refStationIndex = this.refStationIndex; + } return data; } serialize(): Uint8Array; @@ -1040,6 +1076,10 @@ export namespace graphicData { writer.writeBool(3, this.hasdoor); if (this.direction.length) writer.writeString(4, this.direction); + if (this.index != 0) + writer.writeInt32(5, this.index); + if (this.refStationIndex != 0) + writer.writeInt32(6, this.refStationIndex); if (!w) return writer.getResultBuffer(); } @@ -1061,6 +1101,12 @@ export namespace graphicData { case 4: message.direction = reader.readString(); break; + case 5: + message.index = reader.readInt32(); + break; + case 6: + message.refStationIndex = reader.readInt32(); + break; default: reader.skipField(); } } @@ -1081,6 +1127,7 @@ export namespace graphicData { hasControl?: boolean; concentrationStations?: boolean; kilometerSystem?: KilometerSystem; + index?: number; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); @@ -1100,6 +1147,9 @@ export namespace graphicData { if ("kilometerSystem" in data && data.kilometerSystem != undefined) { this.kilometerSystem = data.kilometerSystem; } + if ("index" in data && data.index != undefined) { + this.index = data.index; + } } } get common() { @@ -1138,12 +1188,19 @@ export namespace graphicData { get has_kilometerSystem() { return pb_1.Message.getField(this, 6) != null; } + get index() { + return pb_1.Message.getFieldWithDefault(this, 7, 0) as number; + } + set index(value: number) { + pb_1.Message.setField(this, 7, value); + } static fromObject(data: { common?: ReturnType; code?: string; hasControl?: boolean; concentrationStations?: boolean; kilometerSystem?: ReturnType; + index?: number; }): Station { const message = new Station({}); if (data.common != null) { @@ -1161,6 +1218,9 @@ export namespace graphicData { if (data.kilometerSystem != null) { message.kilometerSystem = KilometerSystem.fromObject(data.kilometerSystem); } + if (data.index != null) { + message.index = data.index; + } return message; } toObject() { @@ -1170,6 +1230,7 @@ export namespace graphicData { hasControl?: boolean; concentrationStations?: boolean; kilometerSystem?: ReturnType; + index?: number; } = {}; if (this.common != null) { data.common = this.common.toObject(); @@ -1186,6 +1247,9 @@ export namespace graphicData { if (this.kilometerSystem != null) { data.kilometerSystem = this.kilometerSystem.toObject(); } + if (this.index != null) { + data.index = this.index; + } return data; } serialize(): Uint8Array; @@ -1202,6 +1266,8 @@ export namespace graphicData { writer.writeBool(4, this.concentrationStations); if (this.has_kilometerSystem) writer.writeMessage(6, this.kilometerSystem, () => this.kilometerSystem.serialize(writer)); + if (this.index != 0) + writer.writeInt32(7, this.index); if (!w) return writer.getResultBuffer(); } @@ -1226,6 +1292,9 @@ export namespace graphicData { case 6: reader.readMessage(message.kilometerSystem, () => message.kilometerSystem = KilometerSystem.deserialize(reader)); break; + case 7: + message.index = reader.readInt32(); + break; default: reader.skipField(); } } @@ -1531,6 +1600,7 @@ export namespace graphicData { pbRef?: RelatedRef; pcRef?: RelatedRef; kilometerSystem?: KilometerSystem[]; + index?: number; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [6, 7, 8, 13], this.#one_of_decls); @@ -1562,6 +1632,9 @@ export namespace graphicData { if ("kilometerSystem" in data && data.kilometerSystem != undefined) { this.kilometerSystem = data.kilometerSystem; } + if ("index" in data && data.index != undefined) { + this.index = data.index; + } } } get common() { @@ -1630,6 +1703,12 @@ export namespace graphicData { set kilometerSystem(value: KilometerSystem[]) { pb_1.Message.setRepeatedWrapperField(this, 13, value); } + get index() { + return pb_1.Message.getFieldWithDefault(this, 14, 0) as number; + } + set index(value: number) { + pb_1.Message.setField(this, 14, value); + } static fromObject(data: { common?: ReturnType; code?: string; @@ -1640,6 +1719,7 @@ export namespace graphicData { pbRef?: ReturnType; pcRef?: ReturnType; kilometerSystem?: ReturnType[]; + index?: number; }): Turnout { const message = new Turnout({}); if (data.common != null) { @@ -1669,6 +1749,9 @@ export namespace graphicData { if (data.kilometerSystem != null) { message.kilometerSystem = data.kilometerSystem.map(item => KilometerSystem.fromObject(item)); } + if (data.index != null) { + message.index = data.index; + } return message; } toObject() { @@ -1682,6 +1765,7 @@ export namespace graphicData { pbRef?: ReturnType; pcRef?: ReturnType; kilometerSystem?: ReturnType[]; + index?: number; } = {}; if (this.common != null) { data.common = this.common.toObject(); @@ -1710,6 +1794,9 @@ export namespace graphicData { if (this.kilometerSystem != null) { data.kilometerSystem = this.kilometerSystem.map((item: KilometerSystem) => item.toObject()); } + if (this.index != null) { + data.index = this.index; + } return data; } serialize(): Uint8Array; @@ -1734,6 +1821,8 @@ export namespace graphicData { writer.writeMessage(11, this.pcRef, () => this.pcRef.serialize(writer)); if (this.kilometerSystem.length) writer.writeRepeatedMessage(13, this.kilometerSystem, (item: KilometerSystem) => item.serialize(writer)); + if (this.index != 0) + writer.writeInt32(14, this.index); if (!w) return writer.getResultBuffer(); } @@ -1770,6 +1859,9 @@ export namespace graphicData { case 13: reader.readMessage(message.kilometerSystem, () => pb_1.Message.addToRepeatedWrapperField(message, 13, KilometerSystem.deserialize(reader), KilometerSystem)); break; + case 14: + message.index = reader.readInt32(); + break; default: reader.skipField(); } } @@ -1879,6 +1971,7 @@ export namespace graphicData { code?: string; mirror?: boolean; kilometerSystem?: KilometerSystem; + index?: number; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); @@ -1895,6 +1988,9 @@ export namespace graphicData { if ("kilometerSystem" in data && data.kilometerSystem != undefined) { this.kilometerSystem = data.kilometerSystem; } + if ("index" in data && data.index != undefined) { + this.index = data.index; + } } } get common() { @@ -1927,11 +2023,18 @@ export namespace graphicData { get has_kilometerSystem() { return pb_1.Message.getField(this, 6) != null; } + get index() { + return pb_1.Message.getFieldWithDefault(this, 7, 0) as number; + } + set index(value: number) { + pb_1.Message.setField(this, 7, value); + } static fromObject(data: { common?: ReturnType; code?: string; mirror?: boolean; kilometerSystem?: ReturnType; + index?: number; }): Signal { const message = new Signal({}); if (data.common != null) { @@ -1946,6 +2049,9 @@ export namespace graphicData { if (data.kilometerSystem != null) { message.kilometerSystem = KilometerSystem.fromObject(data.kilometerSystem); } + if (data.index != null) { + message.index = data.index; + } return message; } toObject() { @@ -1954,6 +2060,7 @@ export namespace graphicData { code?: string; mirror?: boolean; kilometerSystem?: ReturnType; + index?: number; } = {}; if (this.common != null) { data.common = this.common.toObject(); @@ -1967,6 +2074,9 @@ export namespace graphicData { if (this.kilometerSystem != null) { data.kilometerSystem = this.kilometerSystem.toObject(); } + if (this.index != null) { + data.index = this.index; + } return data; } serialize(): Uint8Array; @@ -1981,6 +2091,8 @@ export namespace graphicData { writer.writeBool(3, this.mirror); if (this.has_kilometerSystem) writer.writeMessage(6, this.kilometerSystem, () => this.kilometerSystem.serialize(writer)); + if (this.index != 0) + writer.writeInt32(7, this.index); if (!w) return writer.getResultBuffer(); } @@ -2002,6 +2114,9 @@ export namespace graphicData { case 6: reader.readMessage(message.kilometerSystem, () => message.kilometerSystem = KilometerSystem.deserialize(reader)); break; + case 7: + message.index = reader.readInt32(); + break; default: reader.skipField(); } }