diff --git a/bj-rtss-message b/bj-rtss-message new file mode 160000 index 0000000..f12288d --- /dev/null +++ b/bj-rtss-message @@ -0,0 +1 @@ +Subproject commit f12288dffe11443fbf16c02b9e1f39f3b44ceda2 diff --git a/graphic-pixi b/graphic-pixi index 1f30264..0a0cb0a 160000 --- a/graphic-pixi +++ b/graphic-pixi @@ -1 +1 @@ -Subproject commit 1f302648b5a71a82b798b77fe238c5fc6e3081b4 +Subproject commit 0a0cb0a77afd9783081c2dc6ba19687b0b3aa0f7 diff --git a/src/boot/axios.ts b/src/boot/axios.ts index 3fe93a6..414e620 100644 --- a/src/boot/axios.ts +++ b/src/boot/axios.ts @@ -66,7 +66,7 @@ export class ApiError { // "export default () => {}" function below (which runs individually // for each client) const api = axios.create({ baseURL: getHttpBase() }); - +let isOpenDialog = false; // 认证弹窗是否打开 export default boot(({ app, router }) => { // for use inside Vue files (Options API) through this.$axios and this.$api @@ -86,14 +86,20 @@ export default boot(({ app, router }) => { return response; }, (err) => { - if (err.response && err.response.status === 401) { + if (err.response && err.response.status === 401 && !isOpenDialog) { + isOpenDialog = true; Dialog.create({ title: '认证失败', message: '认证失败或登录超时,请重新登录', persistent: true, - }).onOk(() => { - router.push({ name: 'login' }); - }); + }) + .onOk(() => { + router.push({ name: 'login' }); + isOpenDialog = false; + }) + .onCancel(() => { + isOpenDialog = false; + }); } return Promise.reject(ApiError.from(err)); } diff --git a/src/components/draw-app/DrawProperties.vue b/src/components/draw-app/DrawProperties.vue index 32b0b66..788d6ee 100644 --- a/src/components/draw-app/DrawProperties.vue +++ b/src/components/draw-app/DrawProperties.vue @@ -22,6 +22,9 @@ + @@ -69,9 +72,17 @@ + + @@ -92,10 +103,12 @@ import StationProperty from './properties/StationProperty.vue'; // import TrainProperty from './properties/TrainProperty.vue'; import TrainWindowProperty from './properties/TrainWindowProperty.vue'; import AxleCountingProperty from './properties/AxleCountingProperty.vue'; +import AxleCountingSectionProperty from './properties/AxleCountingSectionProperty.vue'; import SignalProperty from './properties/SignalProperty.vue'; import TurnoutProperty from './properties/TurnoutProperty.vue'; import SectionProperty from './properties/SectionProperty.vue'; import SeparatorProperty from './properties/SeparatorProperty.vue'; +import SectionLinkProperty from './properties/SectionLinkProperty.vue'; import { Link } from 'src/graphics/link/Link'; import { Rect } from 'src/graphics/rect/Rect'; import { Platform } from 'src/graphics/platform/Platform'; @@ -107,7 +120,9 @@ import { Turnout } from 'src/graphics/turnout/Turnout'; import { Section } from 'src/graphics/section/Section'; import { TrainWindow } from 'src/graphics/trainWindow/TrainWindow'; import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting'; +import { AxleCountingSection } from 'src/graphics/axleCountingSection/AxleCountingSection'; import { Separator } from 'src/graphics/separator/Separator'; +import { SectionLink } from 'src/graphics/sectionLink/SectionLink'; const drawStore = useDrawStore(); diff --git a/src/components/draw-app/properties/AxleCountingSectionProperty.vue b/src/components/draw-app/properties/AxleCountingSectionProperty.vue new file mode 100644 index 0000000..9d3cf5c --- /dev/null +++ b/src/components/draw-app/properties/AxleCountingSectionProperty.vue @@ -0,0 +1,119 @@ + + + diff --git a/src/components/draw-app/properties/SectionLinkProperty.vue b/src/components/draw-app/properties/SectionLinkProperty.vue new file mode 100644 index 0000000..1052c01 --- /dev/null +++ b/src/components/draw-app/properties/SectionLinkProperty.vue @@ -0,0 +1,44 @@ + + + diff --git a/src/drawApp/graphics/AxleCountingSectionInteraction.ts b/src/drawApp/graphics/AxleCountingSectionInteraction.ts new file mode 100644 index 0000000..72d3770 --- /dev/null +++ b/src/drawApp/graphics/AxleCountingSectionInteraction.ts @@ -0,0 +1,63 @@ +import * as pb_1 from 'google-protobuf'; +import { GraphicDataBase } from './GraphicDataBase'; +import { + IAxleCountingSectionData, + AxleCountingSection, +} from 'src/graphics/axleCountingSection/AxleCountingSection'; +import { graphicData } from 'src/protos/stationLayoutGraphics'; +import { IPointData } from 'pixi.js'; + +export class AxleCountingSectionData + extends GraphicDataBase + implements IAxleCountingSectionData +{ + constructor(data?: graphicData.AxleCountingSection) { + let axleCountingSection; + if (!data) { + axleCountingSection = new graphicData.AxleCountingSection({ + common: GraphicDataBase.defaultCommonInfo(AxleCountingSection.Type), + }); + } else { + axleCountingSection = data; + } + super(axleCountingSection); + } + public get data(): graphicData.AxleCountingSection { + return this.getData(); + } + get code(): string { + return this.data.code; + } + set code(v: string) { + this.data.code = 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 paRef(): graphicData.RelatedRef { + return this.data.paRef; + } + set paRef(ref: graphicData.RelatedRef) { + this.data.paRef = ref; + } + get pbRef(): graphicData.RelatedRef { + return this.data.pbRef; + } + set pbRef(ref: graphicData.RelatedRef) { + this.data.pbRef = ref; + } + clone(): AxleCountingSectionData { + return new AxleCountingSectionData(this.data.cloneMessage()); + } + copyFrom(data: AxleCountingSectionData): void { + pb_1.Message.copyInto(data.data, this.data); + } + eq(other: AxleCountingSectionData): boolean { + return pb_1.Message.equals(this.data, other.data); + } +} diff --git a/src/drawApp/graphics/SectionLinkInteraction.ts b/src/drawApp/graphics/SectionLinkInteraction.ts new file mode 100644 index 0000000..c7d0d38 --- /dev/null +++ b/src/drawApp/graphics/SectionLinkInteraction.ts @@ -0,0 +1,58 @@ +import * as pb_1 from 'google-protobuf'; +import { GraphicDataBase } from './GraphicDataBase'; +import { + ISectionLinkData, + SectionLink, +} from 'src/graphics/sectionLink/SectionLink'; +import { graphicData } from 'src/protos/stationLayoutGraphics'; +import { IPointData } from 'pixi.js'; + +export class SectionLinkData + extends GraphicDataBase + implements ISectionLinkData +{ + constructor(data?: graphicData.SectionLink) { + let sectionLink; + if (!data) { + sectionLink = new graphicData.SectionLink({ + common: GraphicDataBase.defaultCommonInfo(SectionLink.Type), + }); + } else { + sectionLink = data; + } + super(sectionLink); + } + public get data(): graphicData.SectionLink { + return this.getData(); + } + get code(): string { + return this.data.code; + } + set code(v: string) { + this.data.code = 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 refDevice(): string { + return this.data.refDevice; + } + set refDevice(v: string) { + this.data.refDevice = v; + } + + clone(): SectionLinkData { + return new SectionLinkData(this.data.cloneMessage()); + } + copyFrom(data: SectionLinkData): void { + pb_1.Message.copyInto(data.data, this.data); + } + eq(other: SectionLinkData): boolean { + return pb_1.Message.equals(this.data, other.data); + } +} diff --git a/src/drawApp/index.ts b/src/drawApp/index.ts index 11bc736..04db814 100644 --- a/src/drawApp/index.ts +++ b/src/drawApp/index.ts @@ -46,6 +46,12 @@ import { } from 'src/graphics/axleCounting/AxleCounting'; import { AxleCountingDraw } from 'src/graphics/axleCounting/AxleCountingDrawAssistant'; import { AxleCountingData } from './graphics/AxleCountingInteraction'; +import { + AxleCountingSection, + AxleCountingSectionTemplate, +} from 'src/graphics/axleCountingSection/AxleCountingSection'; +import { AxleCountingSectionDraw } from 'src/graphics/axleCountingSection/AxleCountingSectionAssistant'; +import { AxleCountingSectionData } from './graphics/AxleCountingSectionInteraction'; import { Turnout, TurnoutTemplate } from 'src/graphics/turnout/Turnout'; import { TurnoutDraw } from 'src/graphics/turnout/TurnoutDrawAssistant'; import { TurnoutData, TurnoutStates } from './graphics/TurnoutInteraction'; @@ -59,6 +65,12 @@ import { toStorageTransform } from './graphics/GraphicDataBase'; import { SeparatorDraw } from 'src/graphics/separator/SeparatorDrawAssistant'; import { Separator, SeparatorTemplate } from 'src/graphics/separator/Separator'; import { SeparatorData } from './graphics/SeparatorInteraction'; +import { + SectionLink, + SectionLinkTemplate, +} from 'src/graphics/sectionLink/SectionLink'; +import { SectionLinkDraw } from 'src/graphics/sectionLink/SectionLinkDrawAssistant'; +import { SectionLinkData } from './graphics/SectionLinkInteraction'; // export function fromStoragePoint(p: graphicData.Point): Point { // return new Point(p.x, p.y); @@ -164,6 +176,8 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp { | OneClickGenerateDraw | AxleCountingDraw | SeparatorDraw + | SectionLinkDraw + | AxleCountingSectionDraw )[] = []; if (draftType === 'Line') { drawAssistants = [ @@ -192,6 +206,11 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp { new AxleCountingTemplate(new AxleCountingData()) ), new SeparatorDraw(app, new SeparatorTemplate(new SeparatorData())), + new SectionLinkDraw(app, new SectionLinkTemplate(new SectionLinkData())), + new AxleCountingSectionDraw( + app, + new AxleCountingSectionTemplate(new AxleCountingSectionData()) + ), ]; DrawSignalInteraction.init(app); } @@ -210,6 +229,11 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp { const trainWindows = app.queryStore.queryByType( TrainWindow.Type ); + const sections = app.queryStore.queryByType
(Section.Type); + const sectionLinks = app.queryStore.queryByType( + SectionLink.Type + ); + const turnouts = app.queryStore.queryByType(Turnout.Type); UndoOptions.handler = () => { app.opRecord.undo(); }; @@ -223,6 +247,15 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp { axleCountings.forEach((axleCounting) => { axleCounting.visible = false; }); + sections.forEach((section) => { + section.visible = false; + }); + sectionLinks.forEach((sectionLink) => { + sectionLink.visible = true; + }); + turnouts.forEach((turnout) => { + turnout.visible = false; + }); }; twoLayerOptions.handler = () => { trainWindows.forEach((trainWindow) => { @@ -311,6 +344,14 @@ export function saveDrawDatas(app: JlDrawApp) { } else if (Separator.Type === g.type) { const separatorData = (g as Separator).saveData(); storage.separators.push((separatorData as SeparatorData).data); + } else if (SectionLink.Type === g.type) { + const sectionLinkData = (g as SectionLink).saveData(); + storage.sectionLinks.push((sectionLinkData as SectionLinkData).data); + } else if (AxleCountingSection.Type === g.type) { + const axleCountingSectionData = (g as AxleCountingSection).saveData(); + storage.axleCountingSections.push( + (axleCountingSectionData as AxleCountingSectionData).data + ); } }); const base64 = fromUint8Array(storage.serialize()); @@ -369,6 +410,12 @@ export async function loadDrawDatas(app: GraphicApp) { storage.separators.forEach((separator) => { datas.push(new SeparatorData(separator)); }); + storage.sectionLinks.forEach((sectionLink) => { + datas.push(new SectionLinkData(sectionLink)); + }); + storage.axleCountingSections.forEach((axleCountingSection) => { + datas.push(new AxleCountingSectionData(axleCountingSection)); + }); app.loadGraphic(datas); } else { app.loadGraphic([]); diff --git a/src/graphics/axleCounting/AxleCountingDrawAssistant.ts b/src/graphics/axleCounting/AxleCountingDrawAssistant.ts index b7b38b7..3c62ab5 100644 --- a/src/graphics/axleCounting/AxleCountingDrawAssistant.ts +++ b/src/graphics/axleCounting/AxleCountingDrawAssistant.ts @@ -115,10 +115,7 @@ export class AxleCountingDraw extends GraphicDrawAssistant< if (graphic.type == 'Turnout') { axleCounting.position.set(ps.x, ps.y); } else { - axleCounting.position.set( - ps.x, - ps.y - AxleCountingConsts.offsetSection * direction - ); + axleCounting.position.set(ps.x, ps.y); } axleCounting.id = GraphicIdGenerator.next(); axleCounting.datas.axleCountingRef = [refData2, refData1]; @@ -142,10 +139,7 @@ export class AxleCountingDraw extends GraphicDrawAssistant< if (graphic.type == 'Turnout') { axleCounting.position.set(ps.x, ps.y); } else { - axleCounting.position.set( - ps.x, - ps.y - AxleCountingConsts.offsetSection * direction - ); + axleCounting.position.set(ps.x, ps.y); } axleCounting.id = GraphicIdGenerator.next(); axleCounting.datas.axleCountingRef = [refData]; diff --git a/src/graphics/axleCountingSection/AxleCountingSection.ts b/src/graphics/axleCountingSection/AxleCountingSection.ts new file mode 100644 index 0000000..3c445b8 --- /dev/null +++ b/src/graphics/axleCountingSection/AxleCountingSection.ts @@ -0,0 +1,122 @@ +import { Graphics, IPointData } from 'pixi.js'; +import { + GraphicData, + GraphicRelationParam, + JlGraphic, + JlGraphicTemplate, + VectorText, +} from 'src/jl-graphic'; +import { IRelatedRefData, protoPort2Data } from '../CommonGraphics'; +import { SectionPort } from '../section/Section'; + +export interface IAxleCountingSectionData extends GraphicData { + get code(): string; // 编号 + set code(v: string); + get points(): IPointData[]; // 线坐标点 + set points(points: IPointData[]); + get paRef(): IRelatedRefData | undefined; + set paRef(ref: IRelatedRefData | undefined); + get pbRef(): IRelatedRefData | undefined; + set pbRef(ref: IRelatedRefData | undefined); + clone(): IAxleCountingSectionData; + copyFrom(data: IAxleCountingSectionData): void; + eq(other: IAxleCountingSectionData): boolean; +} + +export const AxleCountingSectionConsts = { + lineColor: '0xff0000', + lineWidth: 2, +}; + +export class AxleCountingSection extends JlGraphic { + static Type = 'AxleCountingSection'; + lineGraphic: Graphics; + labelGraphic: VectorText; + constructor() { + super(AxleCountingSection.Type); + this.lineGraphic = new Graphics(); + this.labelGraphic = new VectorText(); + this.labelGraphic.setVectorFontSize(14); + this.labelGraphic.anchor.set(0.5); + this.labelGraphic.style.fill = '#0f0'; + this.labelGraphic.transformSave = true; + this.labelGraphic.name = 'label'; + this.transformSave = true; + this.addChild(this.lineGraphic); + this.addChild(this.labelGraphic); + } + + get datas(): IAxleCountingSectionData { + return this.getDatas(); + } + doRepaint(): void { + if (this.datas.points.length < 2) { + throw new Error('AxleCountingSection坐标数据异常'); + } + this.lineGraphic.clear(); + this.lineGraphic.lineStyle( + AxleCountingSectionConsts.lineWidth, + AxleCountingSectionConsts.lineColor + ); + this.datas.points.forEach((p, i) => { + if (i !== 0) { + this.lineGraphic.lineTo(p.x, p.y); + } else { + this.lineGraphic.moveTo(p.x, p.y); + } + }); + this.labelGraphic.text = this.datas.code; + const labelPosition = this.datas.childTransforms?.find( + (t) => t.name === this.labelGraphic.name + )?.transform.position; + if (labelPosition) { + this.labelGraphic.position.set(labelPosition.x, labelPosition.y); + } else { + this.labelGraphic.position.set( + this.datas.points[0].x, + this.datas.points[0].y + 20 + ); + } + } + get linePoints(): IPointData[] { + return this.datas.points; + } + set linePoints(points: IPointData[]) { + const old = this.datas.clone(); + old.points = points; + this.updateData(old); + } + loadRelations() { + if (this.datas?.paRef?.id) { + this.relationManage.addRelation( + new GraphicRelationParam(this, SectionPort.A), + new GraphicRelationParam( + this.queryStore.queryById(this.datas.paRef.id), + protoPort2Data(this.datas.paRef.devicePort) + ) + ); + } + if (this.datas?.pbRef?.id) { + this.relationManage.addRelation( + new GraphicRelationParam(this, SectionPort.B), + new GraphicRelationParam( + this.queryStore.queryById(this.datas.pbRef.id), + protoPort2Data(this.datas.pbRef.devicePort) + ) + ); + } + } +} + +export class AxleCountingSectionTemplate extends JlGraphicTemplate { + constructor(dataTemplate: IAxleCountingSectionData) { + super(AxleCountingSection.Type, { + dataTemplate, + }); + } + new(): AxleCountingSection { + const axleCountingSection = new AxleCountingSection(); + axleCountingSection.loadData(this.datas); + return axleCountingSection; + } +} diff --git a/src/graphics/axleCountingSection/AxleCountingSectionAssistant.ts b/src/graphics/axleCountingSection/AxleCountingSectionAssistant.ts new file mode 100644 index 0000000..a0da3ce --- /dev/null +++ b/src/graphics/axleCountingSection/AxleCountingSectionAssistant.ts @@ -0,0 +1,266 @@ +import { + FederatedPointerEvent, + IHitArea, + IPoint, + IPointData, + Point, +} from 'pixi.js'; +import { + AbsorbableLine, + AbsorbablePosition, + GraphicDrawAssistant, + GraphicIdGenerator, + GraphicInteractionPlugin, + JlDrawApp, + JlGraphic, + linePoint, +} from 'src/jl-graphic'; + +import { + IAxleCountingSectionData, + AxleCountingSection, + AxleCountingSectionTemplate, + AxleCountingSectionConsts, +} from './AxleCountingSection'; +import { AxleCounting } from '../axleCounting/AxleCounting'; +import { Section } from '../section/Section'; +import { Turnout } from '../turnout/Turnout'; +import { createRelatedRefProto } from '../CommonGraphics'; + +function hasCommonElements(arr1: string[], arr2: string[]): boolean { + for (let i = 0; i < arr1.length; i++) { + if (arr2.includes(arr1[i])) { + return true; + } + } + return false; +} + +function hasSamePosition(point1: IPointData, point2: IPointData): boolean { + if ( + Math.abs(point1.x - point2.x) < 20 && + Math.abs(point1.y - point2.y) < 20 + ) { + return true; + } + return false; +} + +export interface IAxleCountingSectionDrawOptions { + newData: () => IAxleCountingSectionData; +} + +export class AxleCountingSectionDraw extends GraphicDrawAssistant< + AxleCountingSectionTemplate, + IAxleCountingSectionData +> { + codeGraph: AxleCountingSection; + constructor(app: JlDrawApp, template: AxleCountingSectionTemplate) { + super(app, template, 'sym_o_circle', '不展示'); + this.codeGraph = this.graphicTemplate.new(); + this.container.addChild(this.codeGraph); + AxleCountingSectionInteraction.init(app); + } + + bind(): void { + super.bind(); + this.codeGraph.loadData(this.graphicTemplate.datas); + this.codeGraph.doRepaint(); + } + + clearCache(): void { + //this.codeGraph.destroy(); + } + onLeftDown(e: FederatedPointerEvent): void { + this.container.position.copyFrom(this.toCanvasCoordinates(e.global)); + this.createAndStore(true); + } + + redraw(p: Point): void { + this.container.position.copyFrom(p); + } + prepareData(data: IAxleCountingSectionData): boolean { + data.transform = this.container.saveTransform(); + return true; + } + draw(graphics: AxleCounting[]) { + /* const paRefPs = this.app.queryStore.queryById( + graphics[0].datas.axleCountingRef[0].id + ); + const RepbRefPs = this.app.queryStore.queryById( + graphics[1].datas.axleCountingRef[0].id + ); */ + const axleCountingSection = new AxleCountingSection(); + axleCountingSection.loadData(this.graphicTemplate.datas); + axleCountingSection.datas.points = [ + graphics[0].position, + graphics[1].position, + ]; + axleCountingSection.id = GraphicIdGenerator.next(); + const paRef = createRelatedRefProto(graphics[0].type, graphics[0].id); + const pbRef = createRelatedRefProto(graphics[1].type, graphics[1].id); + axleCountingSection.datas.paRef = paRef; + axleCountingSection.datas.pbRef = pbRef; + this.storeGraphic(axleCountingSection); + axleCountingSection.loadRelations(); + } + + oneGenerates() { + const axleCountingSectionAll = + this.app.queryStore.queryByType( + AxleCountingSection.Type + ); + this.app.deleteGraphics(...axleCountingSectionAll); + const axleCountings = this.app.queryStore.queryByType( + AxleCounting.Type + ); + const hasfourTurnout: AxleCounting[][] = []; + axleCountings.forEach((axleCounting) => { + const refDeviceTarget = axleCounting.datas.axleCountingRef.map( + (ref) => ref.id + ); + for (let i = 0; i < axleCountings.length - 1; i++) { + if (axleCountings[i].id == axleCounting.id) return; + const refDevice = axleCountings[i].datas.axleCountingRef.map( + (ref) => ref.id + ); + if (hasCommonElements(refDeviceTarget, refDevice)) { + this.draw([axleCounting, axleCountings[i]]); + } + if (hasSamePosition(axleCounting, axleCountings[i])) { + hasfourTurnout.push([axleCounting, axleCountings[i]]); + } + } + }); + const fourTurnout: Turnout[] = []; + hasfourTurnout.forEach((axleCountings) => { + const axleCountingRelations = + axleCountings[0].relationManage.getRelationsOfGraphicAndOtherType( + axleCountings[0], + Turnout.Type + ); + axleCountingRelations.forEach((relation) => { + const refDevice = relation.getOtherGraphic
(axleCountings[0]); + fourTurnout; + }); + }); + + /* axleCountings.sort((a, b) => a.x - b.x); + const downAxleCountings = axleCountings.filter((point) => { + return point.y > 350; + }); + for (let i = 0; i < downAxleCountings.length - 1; i++) { + const firstRef = downAxleCountings[i].datas.axleCountingRef.map( + (ref) => ref.id + ); + const nextRef = downAxleCountings[i + 1].datas.axleCountingRef.map( + (ref) => ref.id + ); + let nextNextRef: string[] = []; + if (i + 2 < downAxleCountings.length) { + nextNextRef = downAxleCountings[i + 2].datas.axleCountingRef.map( + (ref) => ref.id + ); + } + if (hasCommonElements(firstRef, nextRef)) { + this.draw([downAxleCountings[i], downAxleCountings[i + 1]]); + } else if ( + hasSamePosition( + downAxleCountings[i + 1].position, + downAxleCountings[i + 2].position + ) && + hasCommonElements(firstRef, nextNextRef) + ) { + this.draw([downAxleCountings[i], downAxleCountings[i + 2]]); + i += 2; + } + } */ + } +} + +function buildAbsorbablePositions( + axleCountingSection: AxleCountingSection +): AbsorbablePosition[] { + const aps: AbsorbablePosition[] = []; + const axleCountingSections = + axleCountingSection.queryStore.queryByType( + AxleCountingSection.Type + ); + const { width } = axleCountingSection.getGraphicApp().canvas; + axleCountingSections.forEach((other) => { + if (other.id == axleCountingSection.id) { + return; + } + const ps = other.datas.transform.position; + const xs = new AbsorbableLine({ x: 0, y: ps.y }, { x: width, y: ps.y }); + aps.push(xs); + }); + return aps; +} + +class AxleCountingSectionGraphicHitArea implements IHitArea { + axleCountingSection: AxleCountingSection; + constructor(axleCountingSection: AxleCountingSection) { + this.axleCountingSection = axleCountingSection; + } + contains(x: number, y: number): boolean { + for (let i = 1; i < this.axleCountingSection.datas.points.length; i++) { + const p1 = this.axleCountingSection.datas.points[i - 1]; + const p2 = this.axleCountingSection.datas.points[i]; + if (linePoint(p1, p2, { x, y }, AxleCountingSectionConsts.lineWidth)) { + return true; + } + } + return false; + } +} + +export class AxleCountingSectionInteraction extends GraphicInteractionPlugin { + static Name = 'AxleCountingSection_transform'; + constructor(app: JlDrawApp) { + super(AxleCountingSectionInteraction.Name, app); + } + static init(app: JlDrawApp) { + return new AxleCountingSectionInteraction(app); + } + filter(...grahpics: JlGraphic[]): AxleCountingSection[] | undefined { + return grahpics + .filter((g) => g.type === AxleCountingSection.Type) + .map((g) => g as AxleCountingSection); + } + bind(g: AxleCountingSection): void { + g.eventMode = 'static'; + g.cursor = 'pointer'; + g.scalable = true; + g.transformSave = true; + g.lineGraphic.eventMode = 'static'; + g.lineGraphic.cursor = 'pointer'; + g.lineGraphic.hitArea = new AxleCountingSectionGraphicHitArea(g); + g.labelGraphic.eventMode = 'static'; + g.labelGraphic.cursor = 'pointer'; + g.labelGraphic.selectable = true; + g.labelGraphic.draggable = true; + g.on('selected', this.onSelected, this); + } + unbind(g: AxleCountingSection): void { + g.eventMode = 'none'; + g.scalable = false; + g.rotatable = false; + g.lineGraphic.eventMode = 'none'; + g.lineGraphic.draggable = false; + g.lineGraphic.selectable = false; + g.lineGraphic.transformSave = false; + g.labelGraphic.eventMode = 'none'; + g.labelGraphic.draggable = false; + g.labelGraphic.selectable = false; + g.labelGraphic.transformSave = false; + g.off('selected', this.onSelected, this); + } + onSelected(): void { + const AxleCountingSection = this.app + .selectedGraphics[0] as AxleCountingSection; + this.app.setOptions({ + absorbablePositions: buildAbsorbablePositions(AxleCountingSection), + }); + } +} diff --git a/src/graphics/sectionLink/SectionLink.ts b/src/graphics/sectionLink/SectionLink.ts new file mode 100644 index 0000000..5be55ea --- /dev/null +++ b/src/graphics/sectionLink/SectionLink.ts @@ -0,0 +1,106 @@ +import { Graphics, IPointData } from 'pixi.js'; +import { + GraphicData, + JlGraphic, + JlGraphicTemplate, + VectorText, + IChildTransform, +} from 'src/jl-graphic'; +import { ILineGraphic } from 'src/jl-graphic/plugins/GraphicEditPlugin'; + +export interface ISectionLinkData extends GraphicData { + get code(): string; // 编号 + set code(v: string); + get points(): IPointData[]; + set points(points: IPointData[]); + get refDevice(): string; + set refDevice(v: string); + clone(): ISectionLinkData; + copyFrom(data: ISectionLinkData): void; + eq(other: ISectionLinkData): boolean; +} + +export const SectionLinkConsts = { + lineColor: 0x5578b6, + lineWidth: 5, +}; + +export class SectionLink extends JlGraphic implements ILineGraphic { + static Type = 'SectionLink'; + lineGraphic: Graphics; + labelGraphic: VectorText; + + constructor() { + super(SectionLink.Type); + this.lineGraphic = new Graphics(); + this.labelGraphic = new VectorText(); + this.labelGraphic.setVectorFontSize(14); + this.labelGraphic.anchor.set(0.5); + this.labelGraphic.style.fill = '#0f0'; + this.labelGraphic.transformSave = true; + this.labelGraphic.name = 'label'; + this.transformSave = true; + this.addChild(this.lineGraphic); + this.addChild(this.labelGraphic); + } + + doRepaint() { + if (this.datas.points.length < 2) { + throw new Error('SectionLink坐标数据异常'); + } + + this.lineGraphic.clear(); + this.lineGraphic.lineStyle( + SectionLinkConsts.lineWidth, + SectionLinkConsts.lineColor + ); + this.datas.points.forEach((p, i) => { + if (i !== 0) { + this.lineGraphic.lineTo(p.x, p.y); + } else { + this.lineGraphic.moveTo(p.x, p.y); + } + }); + this.labelGraphic.text = this.datas.code; + const labelPosition = this.datas?.childTransforms?.find( + (item: IChildTransform) => item.name === this.labelGraphic.name + )?.transform.position; + if (labelPosition) { + this.labelGraphic.position.set(labelPosition.x, labelPosition.y); + } else { + this.labelGraphic.position.set( + this.datas.points[0].x, + this.datas.points[0].y + 20 + ); + } + } + + getStartPoint() { + return this.datas.points[0]; + } + getEndPoint(): IPointData { + return this.datas.points[this.datas.points.length - 1]; + } + + get datas(): ISectionLinkData { + return this.getDatas(); + } + + get linePoints(): IPointData[] { + return this.datas.points; + } + set linePoints(points: IPointData[]) { + const old = this.datas.clone(); + old.points = points; + this.updateData(old); + } +} + +export class SectionLinkTemplate extends JlGraphicTemplate { + constructor(dataTemplate: ISectionLinkData) { + super(SectionLink.Type, { dataTemplate }); + } + new() { + return new SectionLink(); + } +} diff --git a/src/graphics/sectionLink/SectionLinkDrawAssistant.ts b/src/graphics/sectionLink/SectionLinkDrawAssistant.ts new file mode 100644 index 0000000..8856825 --- /dev/null +++ b/src/graphics/sectionLink/SectionLinkDrawAssistant.ts @@ -0,0 +1,183 @@ +import { + GraphicApp, + GraphicDrawAssistant, + GraphicInteractionPlugin, + JlDrawApp, + JlGraphic, + linePoint, + GraphicIdGenerator, +} from 'src/jl-graphic'; +import { + ISectionLinkData, + SectionLink, + SectionLinkConsts, + SectionLinkTemplate, +} from './SectionLink'; +import { + DisplayObject, + FederatedMouseEvent, + Graphics, + IHitArea, + IPointData, + Point, +} from 'pixi.js'; +import { Section } from '../section/Section'; +import { Turnout } from '../turnout/Turnout'; + +export class SectionLinkDraw extends GraphicDrawAssistant< + SectionLinkTemplate, + ISectionLinkData +> { + points: Point[] = []; + graphic = new Graphics(); + + constructor(app: JlDrawApp, template: SectionLinkTemplate) { + super(app, template, 'sym_o_timeline', '不展示'); + this.container.addChild(this.graphic); + + SectionLinkEditPlugin.init(app, this); + } + + onRightClick(): void { + this.createAndStore(true); + } + + redraw(cp: Point): void { + if (this.points.length < 1) return; + this.graphic.clear(); + this.graphic.lineStyle( + SectionLinkConsts.lineWidth, + SectionLinkConsts.lineColor + ); + this.points.forEach((p, i) => { + if (i !== 0) { + this.graphic.lineTo(p.x, p.y); + } else { + this.graphic.moveTo(p.x, p.y); + } + }); + this.graphic.lineTo(cp.x, cp.y); + console.log(cp, '000'); + } + + prepareData(data: ISectionLinkData): boolean { + console.log(this.points, '000'); + data.points = this.points; + return true; + } + oneGenerates() { + // localToCanvasPoints + const sectionList = this.app.queryStore.queryByType
(Section.Type); + const turnoutList = this.app.queryStore.queryByType(Turnout.Type); + console.log(sectionList.length, turnoutList.length); + sectionList.forEach((section: Section) => { + const sectionLink = new SectionLink(); + sectionLink.loadData(this.graphicTemplate.datas); + sectionLink.id = GraphicIdGenerator.next(); + const points: IPointData[] = []; + section.datas.points.forEach((p) => { + points.push(section.localToCanvasPoint(p)); + }); + sectionLink.datas.points = points; + this.storeGraphic(sectionLink); + }); + turnoutList.forEach((turnout: Turnout) => { + const sectionLinkA = new SectionLink(); + const sectionLinkB = new SectionLink(); + const sectionLinkC = new SectionLink(); + sectionLinkA.loadData(this.graphicTemplate.datas); + sectionLinkB.loadData(this.graphicTemplate.datas); + sectionLinkC.loadData(this.graphicTemplate.datas); + const forkP = new Point(turnout.position.x, turnout.position.y); + const pointA = [forkP]; + const pointB = [forkP]; + const pointC = [forkP]; + turnout.datas.pointA.forEach((p) => { + pointA.push(turnout.localToCanvasPoint(p)); + }); + turnout.datas.pointB.forEach((p) => { + pointB.push(turnout.localToCanvasPoint(p)); + }); + turnout.datas.pointC.forEach((p) => { + pointC.push(turnout.localToCanvasPoint(p)); + }); + sectionLinkA.id = GraphicIdGenerator.next(); + sectionLinkB.id = GraphicIdGenerator.next(); + sectionLinkC.id = GraphicIdGenerator.next(); + sectionLinkA.datas.points = pointA; + sectionLinkB.datas.points = pointB; + sectionLinkC.datas.points = pointC; + this.storeGraphic(sectionLinkA); + this.storeGraphic(sectionLinkB); + this.storeGraphic(sectionLinkC); + }); + } + clearCache(): void { + this.points = []; + this.graphic.clear(); + } +} + +class SectionLinkGraphicHitArea implements IHitArea { + section: SectionLink; + constructor(section: SectionLink) { + this.section = section; + } + contains(x: number, y: number): boolean { + for (let i = 1; i < this.section.datas.points.length; i++) { + const p1 = this.section.datas.points[i - 1]; + const p2 = this.section.datas.points[i]; + if (linePoint(p1, p2, { x, y }, SectionLinkConsts.lineWidth)) { + return true; + } + } + return false; + } +} + +export class SectionLinkEditPlugin extends GraphicInteractionPlugin { + static Name = 'SectionLinkDrag'; + drawAssistant: SectionLinkDraw; + + constructor(app: GraphicApp, da: SectionLinkDraw) { + super(SectionLinkEditPlugin.Name, app); + this.drawAssistant = da; + } + static init(app: GraphicApp, da: SectionLinkDraw) { + return new SectionLinkEditPlugin(app, da); + } + filter(...grahpics: JlGraphic[]): SectionLink[] | undefined { + return grahpics.filter((g) => g.type == SectionLink.Type) as SectionLink[]; + } + bind(g: SectionLink): void { + g.lineGraphic.eventMode = 'static'; + g.lineGraphic.cursor = 'pointer'; + g.lineGraphic.hitArea = new SectionLinkGraphicHitArea(g); + // g.transformSave = true; + // g.labelGraphic.eventMode = 'static'; + // g.labelGraphic.cursor = 'pointer'; + // g.labelGraphic.selectable = true; + // g.labelGraphic.draggable = true; + // g.on('selected', this.onSelected, this); + // g.on('unselected', this.onUnselected, this); + // g.on('_rightclick', this.onContextMenu, this); + } + unbind(g: SectionLink): void { + // g.off('selected', this.onSelected, this); + // g.off('unselected', this.onUnselected, this); + // g.off('_rightclick', this.onContextMenu, this); + } + + // onContextMenu(e: FederatedMouseEvent) { + // const target = e.target as DisplayObject; + // const section = target.getGraphic() as SectionLink; + // this.app.updateSelected(section); + // } + + // onSelected(g: DisplayObject): void { + // const sectionLink = g as SectionLink; + // } + // onUnselected(g: DisplayObject): void { + // const sectionLink = g as SectionLink; + // } +} diff --git a/src/layouts/DrawLayout.vue b/src/layouts/DrawLayout.vue index e6b6726..e00e11f 100644 --- a/src/layouts/DrawLayout.vue +++ b/src/layouts/DrawLayout.vue @@ -24,6 +24,16 @@ 一键生成计轴 + + 一键生成Link + + + 一键生成计轴区段 + @@ -186,6 +196,10 @@ import { ApiError } from 'src/boot/axios'; import { OneClickGenerate } from 'src/graphics/trainWindow/oneClickDrawAssistant'; import { Separator } from 'src/graphics/separator/Separator'; import { SeparatorDraw } from 'src/graphics/separator/SeparatorDrawAssistant'; +import { SectionLink } from 'src/graphics/sectionLink/SectionLink'; +import { SectionLinkDraw } from 'src/graphics/sectionLink/SectionLinkDrawAssistant'; +import { AxleCountingSection } from 'src/graphics/axleCountingSection/AxleCountingSection'; +import { AxleCountingSectionDraw } from 'src/graphics/axleCountingSection/AxleCountingSectionAssistant'; const route = useRoute(); const router = useRouter(); @@ -328,6 +342,20 @@ function oneClickAxleCounting() { drawStore.oneClickType = 'AxleCounting'; drawStore.getDrawApp().interactionPlugin(OneClickGenerate.Type).resume(); } +function oneClickAxleCountingSection() { + //一键生成计轴区段 + const axleCountingSectionDraw = drawStore + .getDrawApp() + .getDrawAssistant(AxleCountingSection.Type) as AxleCountingSectionDraw; + axleCountingSectionDraw.oneGenerates(); +} +function oneClickLink() { + drawStore.oneClickType = 'SectionLink'; + const draw = drawStore + .getDrawApp() + .getDrawAssistant(SectionLink.Type) as SectionLinkDraw; + draw.oneGenerates(); +} function backConfirm() { router.go(-1); diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts index 5beab30..17a6ae5 100644 --- a/src/protos/stationLayoutGraphics.ts +++ b/src/protos/stationLayoutGraphics.ts @@ -18,17 +18,15 @@ export namespace graphicData { signals?: Signal[]; turnouts?: Turnout[]; section?: Section[]; - stationLines?: StationLine[]; - runLines?: RunLine[]; - trainLines?: TrainLine[]; - pathLines?: PathLine[]; polygons?: Polygon[]; trainWindows?: TrainWindow[]; axleCountings?: AxleCounting[]; separators?: Separator[]; + sectionLinks?: SectionLink[]; + axleCountingSections?: AxleCountingSection[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("canvas" in data && data.canvas != undefined) { this.canvas = data.canvas; @@ -60,18 +58,6 @@ export namespace graphicData { if ("section" in data && data.section != undefined) { this.section = data.section; } - if ("stationLines" in data && data.stationLines != undefined) { - this.stationLines = data.stationLines; - } - if ("runLines" in data && data.runLines != undefined) { - this.runLines = data.runLines; - } - if ("trainLines" in data && data.trainLines != undefined) { - this.trainLines = data.trainLines; - } - if ("pathLines" in data && data.pathLines != undefined) { - this.pathLines = data.pathLines; - } if ("polygons" in data && data.polygons != undefined) { this.polygons = data.polygons; } @@ -84,6 +70,12 @@ export namespace graphicData { if ("separators" in data && data.separators != undefined) { this.separators = data.separators; } + if ("sectionLinks" in data && data.sectionLinks != undefined) { + this.sectionLinks = data.sectionLinks; + } + if ("axleCountingSections" in data && data.axleCountingSections != undefined) { + this.axleCountingSections = data.axleCountingSections; + } } } get canvas() { @@ -149,53 +141,41 @@ export namespace graphicData { set section(value: Section[]) { pb_1.Message.setRepeatedWrapperField(this, 10, value); } - get stationLines() { - return pb_1.Message.getRepeatedWrapperField(this, StationLine, 11) as StationLine[]; - } - set stationLines(value: StationLine[]) { - pb_1.Message.setRepeatedWrapperField(this, 11, value); - } - get runLines() { - return pb_1.Message.getRepeatedWrapperField(this, RunLine, 12) as RunLine[]; - } - set runLines(value: RunLine[]) { - pb_1.Message.setRepeatedWrapperField(this, 12, value); - } - get trainLines() { - return pb_1.Message.getRepeatedWrapperField(this, TrainLine, 13) as TrainLine[]; - } - set trainLines(value: TrainLine[]) { - pb_1.Message.setRepeatedWrapperField(this, 13, value); - } - get pathLines() { - return pb_1.Message.getRepeatedWrapperField(this, PathLine, 14) as PathLine[]; - } - set pathLines(value: PathLine[]) { - pb_1.Message.setRepeatedWrapperField(this, 14, value); - } get polygons() { - return pb_1.Message.getRepeatedWrapperField(this, Polygon, 15) as Polygon[]; + return pb_1.Message.getRepeatedWrapperField(this, Polygon, 11) as Polygon[]; } set polygons(value: Polygon[]) { - pb_1.Message.setRepeatedWrapperField(this, 15, value); + pb_1.Message.setRepeatedWrapperField(this, 11, value); } get trainWindows() { - return pb_1.Message.getRepeatedWrapperField(this, TrainWindow, 16) as TrainWindow[]; + return pb_1.Message.getRepeatedWrapperField(this, TrainWindow, 12) as TrainWindow[]; } set trainWindows(value: TrainWindow[]) { - pb_1.Message.setRepeatedWrapperField(this, 16, value); + pb_1.Message.setRepeatedWrapperField(this, 12, value); } get axleCountings() { - return pb_1.Message.getRepeatedWrapperField(this, AxleCounting, 17) as AxleCounting[]; + return pb_1.Message.getRepeatedWrapperField(this, AxleCounting, 13) as AxleCounting[]; } set axleCountings(value: AxleCounting[]) { - pb_1.Message.setRepeatedWrapperField(this, 17, value); + pb_1.Message.setRepeatedWrapperField(this, 13, value); } get separators() { - return pb_1.Message.getRepeatedWrapperField(this, Separator, 18) as Separator[]; + return pb_1.Message.getRepeatedWrapperField(this, Separator, 14) as Separator[]; } set separators(value: Separator[]) { - pb_1.Message.setRepeatedWrapperField(this, 18, value); + pb_1.Message.setRepeatedWrapperField(this, 14, value); + } + get sectionLinks() { + return pb_1.Message.getRepeatedWrapperField(this, SectionLink, 15) as SectionLink[]; + } + set sectionLinks(value: SectionLink[]) { + pb_1.Message.setRepeatedWrapperField(this, 15, value); + } + get axleCountingSections() { + return pb_1.Message.getRepeatedWrapperField(this, AxleCountingSection, 16) as AxleCountingSection[]; + } + set axleCountingSections(value: AxleCountingSection[]) { + pb_1.Message.setRepeatedWrapperField(this, 16, value); } static fromObject(data: { canvas?: ReturnType; @@ -208,14 +188,12 @@ export namespace graphicData { signals?: ReturnType[]; turnouts?: ReturnType[]; section?: ReturnType[]; - stationLines?: ReturnType[]; - runLines?: ReturnType[]; - trainLines?: ReturnType[]; - pathLines?: ReturnType[]; polygons?: ReturnType[]; trainWindows?: ReturnType[]; axleCountings?: ReturnType[]; separators?: ReturnType[]; + sectionLinks?: ReturnType[]; + axleCountingSections?: ReturnType[]; }): RtssGraphicStorage { const message = new RtssGraphicStorage({}); if (data.canvas != null) { @@ -248,18 +226,6 @@ export namespace graphicData { if (data.section != null) { message.section = data.section.map(item => Section.fromObject(item)); } - if (data.stationLines != null) { - message.stationLines = data.stationLines.map(item => StationLine.fromObject(item)); - } - if (data.runLines != null) { - message.runLines = data.runLines.map(item => RunLine.fromObject(item)); - } - if (data.trainLines != null) { - message.trainLines = data.trainLines.map(item => TrainLine.fromObject(item)); - } - if (data.pathLines != null) { - message.pathLines = data.pathLines.map(item => PathLine.fromObject(item)); - } if (data.polygons != null) { message.polygons = data.polygons.map(item => Polygon.fromObject(item)); } @@ -272,6 +238,12 @@ export namespace graphicData { if (data.separators != null) { message.separators = data.separators.map(item => Separator.fromObject(item)); } + if (data.sectionLinks != null) { + message.sectionLinks = data.sectionLinks.map(item => SectionLink.fromObject(item)); + } + if (data.axleCountingSections != null) { + message.axleCountingSections = data.axleCountingSections.map(item => AxleCountingSection.fromObject(item)); + } return message; } toObject() { @@ -286,14 +258,12 @@ export namespace graphicData { signals?: ReturnType[]; turnouts?: ReturnType[]; section?: ReturnType[]; - stationLines?: ReturnType[]; - runLines?: ReturnType[]; - trainLines?: ReturnType[]; - pathLines?: ReturnType[]; polygons?: ReturnType[]; trainWindows?: ReturnType[]; axleCountings?: ReturnType[]; separators?: ReturnType[]; + sectionLinks?: ReturnType[]; + axleCountingSections?: ReturnType[]; } = {}; if (this.canvas != null) { data.canvas = this.canvas.toObject(); @@ -325,18 +295,6 @@ export namespace graphicData { if (this.section != null) { data.section = this.section.map((item: Section) => item.toObject()); } - if (this.stationLines != null) { - data.stationLines = this.stationLines.map((item: StationLine) => item.toObject()); - } - if (this.runLines != null) { - data.runLines = this.runLines.map((item: RunLine) => item.toObject()); - } - if (this.trainLines != null) { - data.trainLines = this.trainLines.map((item: TrainLine) => item.toObject()); - } - if (this.pathLines != null) { - data.pathLines = this.pathLines.map((item: PathLine) => item.toObject()); - } if (this.polygons != null) { data.polygons = this.polygons.map((item: Polygon) => item.toObject()); } @@ -349,6 +307,12 @@ export namespace graphicData { if (this.separators != null) { data.separators = this.separators.map((item: Separator) => item.toObject()); } + if (this.sectionLinks != null) { + data.sectionLinks = this.sectionLinks.map((item: SectionLink) => item.toObject()); + } + if (this.axleCountingSections != null) { + data.axleCountingSections = this.axleCountingSections.map((item: AxleCountingSection) => item.toObject()); + } return data; } serialize(): Uint8Array; @@ -375,22 +339,18 @@ export namespace graphicData { writer.writeRepeatedMessage(9, this.turnouts, (item: Turnout) => item.serialize(writer)); if (this.section.length) writer.writeRepeatedMessage(10, this.section, (item: Section) => item.serialize(writer)); - if (this.stationLines.length) - writer.writeRepeatedMessage(11, this.stationLines, (item: StationLine) => item.serialize(writer)); - if (this.runLines.length) - writer.writeRepeatedMessage(12, this.runLines, (item: RunLine) => item.serialize(writer)); - if (this.trainLines.length) - writer.writeRepeatedMessage(13, this.trainLines, (item: TrainLine) => item.serialize(writer)); - if (this.pathLines.length) - writer.writeRepeatedMessage(14, this.pathLines, (item: PathLine) => item.serialize(writer)); if (this.polygons.length) - writer.writeRepeatedMessage(15, this.polygons, (item: Polygon) => item.serialize(writer)); + writer.writeRepeatedMessage(11, this.polygons, (item: Polygon) => item.serialize(writer)); if (this.trainWindows.length) - writer.writeRepeatedMessage(16, this.trainWindows, (item: TrainWindow) => item.serialize(writer)); + writer.writeRepeatedMessage(12, this.trainWindows, (item: TrainWindow) => item.serialize(writer)); if (this.axleCountings.length) - writer.writeRepeatedMessage(17, this.axleCountings, (item: AxleCounting) => item.serialize(writer)); + writer.writeRepeatedMessage(13, this.axleCountings, (item: AxleCounting) => item.serialize(writer)); if (this.separators.length) - writer.writeRepeatedMessage(18, this.separators, (item: Separator) => item.serialize(writer)); + writer.writeRepeatedMessage(14, this.separators, (item: Separator) => item.serialize(writer)); + if (this.sectionLinks.length) + writer.writeRepeatedMessage(15, this.sectionLinks, (item: SectionLink) => item.serialize(writer)); + if (this.axleCountingSections.length) + writer.writeRepeatedMessage(16, this.axleCountingSections, (item: AxleCountingSection) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -431,28 +391,22 @@ export namespace graphicData { reader.readMessage(message.section, () => pb_1.Message.addToRepeatedWrapperField(message, 10, Section.deserialize(reader), Section)); break; case 11: - reader.readMessage(message.stationLines, () => pb_1.Message.addToRepeatedWrapperField(message, 11, StationLine.deserialize(reader), StationLine)); + reader.readMessage(message.polygons, () => pb_1.Message.addToRepeatedWrapperField(message, 11, Polygon.deserialize(reader), Polygon)); break; case 12: - reader.readMessage(message.runLines, () => pb_1.Message.addToRepeatedWrapperField(message, 12, RunLine.deserialize(reader), RunLine)); + reader.readMessage(message.trainWindows, () => pb_1.Message.addToRepeatedWrapperField(message, 12, TrainWindow.deserialize(reader), TrainWindow)); break; case 13: - reader.readMessage(message.trainLines, () => pb_1.Message.addToRepeatedWrapperField(message, 13, TrainLine.deserialize(reader), TrainLine)); + reader.readMessage(message.axleCountings, () => pb_1.Message.addToRepeatedWrapperField(message, 13, AxleCounting.deserialize(reader), AxleCounting)); break; case 14: - reader.readMessage(message.pathLines, () => pb_1.Message.addToRepeatedWrapperField(message, 14, PathLine.deserialize(reader), PathLine)); + reader.readMessage(message.separators, () => pb_1.Message.addToRepeatedWrapperField(message, 14, Separator.deserialize(reader), Separator)); break; case 15: - reader.readMessage(message.polygons, () => pb_1.Message.addToRepeatedWrapperField(message, 15, Polygon.deserialize(reader), Polygon)); + reader.readMessage(message.sectionLinks, () => pb_1.Message.addToRepeatedWrapperField(message, 15, SectionLink.deserialize(reader), SectionLink)); break; case 16: - reader.readMessage(message.trainWindows, () => pb_1.Message.addToRepeatedWrapperField(message, 16, TrainWindow.deserialize(reader), TrainWindow)); - break; - case 17: - reader.readMessage(message.axleCountings, () => pb_1.Message.addToRepeatedWrapperField(message, 17, AxleCounting.deserialize(reader), AxleCounting)); - break; - case 18: - reader.readMessage(message.separators, () => pb_1.Message.addToRepeatedWrapperField(message, 18, Separator.deserialize(reader), Separator)); + reader.readMessage(message.axleCountingSections, () => pb_1.Message.addToRepeatedWrapperField(message, 16, AxleCountingSection.deserialize(reader), AxleCountingSection)); break; default: reader.skipField(); } @@ -1980,145 +1934,6 @@ export namespace graphicData { return Station.deserialize(bytes); } } - export class StationLine extends pb_1.Message { - #one_of_decls: number[][] = []; - constructor(data?: any[] | { - common?: CommonInfo; - code?: string; - hasTransfer?: boolean; - hideName?: boolean; - }) { - super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); - if (!Array.isArray(data) && typeof data == "object") { - if ("common" in data && data.common != undefined) { - this.common = data.common; - } - if ("code" in data && data.code != undefined) { - this.code = data.code; - } - if ("hasTransfer" in data && data.hasTransfer != undefined) { - this.hasTransfer = data.hasTransfer; - } - if ("hideName" in data && data.hideName != undefined) { - this.hideName = data.hideName; - } - } - } - get common() { - return pb_1.Message.getWrapperField(this, CommonInfo, 1) as CommonInfo; - } - set common(value: CommonInfo) { - pb_1.Message.setWrapperField(this, 1, value); - } - get has_common() { - return pb_1.Message.getField(this, 1) != null; - } - get code() { - return pb_1.Message.getFieldWithDefault(this, 2, "") as string; - } - set code(value: string) { - pb_1.Message.setField(this, 2, value); - } - get hasTransfer() { - return pb_1.Message.getFieldWithDefault(this, 3, false) as boolean; - } - set hasTransfer(value: boolean) { - pb_1.Message.setField(this, 3, value); - } - get hideName() { - return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean; - } - set hideName(value: boolean) { - pb_1.Message.setField(this, 4, value); - } - static fromObject(data: { - common?: ReturnType; - code?: string; - hasTransfer?: boolean; - hideName?: boolean; - }): StationLine { - const message = new StationLine({}); - if (data.common != null) { - message.common = CommonInfo.fromObject(data.common); - } - if (data.code != null) { - message.code = data.code; - } - if (data.hasTransfer != null) { - message.hasTransfer = data.hasTransfer; - } - if (data.hideName != null) { - message.hideName = data.hideName; - } - return message; - } - toObject() { - const data: { - common?: ReturnType; - code?: string; - hasTransfer?: boolean; - hideName?: boolean; - } = {}; - if (this.common != null) { - data.common = this.common.toObject(); - } - if (this.code != null) { - data.code = this.code; - } - if (this.hasTransfer != null) { - data.hasTransfer = this.hasTransfer; - } - if (this.hideName != null) { - data.hideName = this.hideName; - } - return data; - } - serialize(): Uint8Array; - serialize(w: pb_1.BinaryWriter): void; - serialize(w?: pb_1.BinaryWriter): Uint8Array | void { - const writer = w || new pb_1.BinaryWriter(); - if (this.has_common) - writer.writeMessage(1, this.common, () => this.common.serialize(writer)); - if (this.code.length) - writer.writeString(2, this.code); - if (this.hasTransfer != false) - writer.writeBool(3, this.hasTransfer); - if (this.hideName != false) - writer.writeBool(4, this.hideName); - if (!w) - return writer.getResultBuffer(); - } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): StationLine { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new StationLine(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - reader.readMessage(message.common, () => message.common = CommonInfo.deserialize(reader)); - break; - case 2: - message.code = reader.readString(); - break; - case 3: - message.hasTransfer = reader.readBool(); - break; - case 4: - message.hideName = reader.readBool(); - break; - default: reader.skipField(); - } - } - return message; - } - serializeBinary(): Uint8Array { - return this.serialize(); - } - static deserializeBinary(bytes: Uint8Array): StationLine { - return StationLine.deserialize(bytes); - } - } export class TrainWindow extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { @@ -2470,99 +2285,6 @@ export namespace graphicData { return Train.deserialize(bytes); } } - export class TrainLine extends pb_1.Message { - #one_of_decls: number[][] = []; - constructor(data?: any[] | { - common?: CommonInfo; - code?: string; - }) { - super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); - if (!Array.isArray(data) && typeof data == "object") { - if ("common" in data && data.common != undefined) { - this.common = data.common; - } - if ("code" in data && data.code != undefined) { - this.code = data.code; - } - } - } - get common() { - return pb_1.Message.getWrapperField(this, CommonInfo, 1) as CommonInfo; - } - set common(value: CommonInfo) { - pb_1.Message.setWrapperField(this, 1, value); - } - get has_common() { - return pb_1.Message.getField(this, 1) != null; - } - get code() { - return pb_1.Message.getFieldWithDefault(this, 2, "") as string; - } - set code(value: string) { - pb_1.Message.setField(this, 2, value); - } - static fromObject(data: { - common?: ReturnType; - code?: string; - }): TrainLine { - const message = new TrainLine({}); - if (data.common != null) { - message.common = CommonInfo.fromObject(data.common); - } - if (data.code != null) { - message.code = data.code; - } - return message; - } - toObject() { - const data: { - common?: ReturnType; - code?: string; - } = {}; - if (this.common != null) { - data.common = this.common.toObject(); - } - if (this.code != null) { - data.code = this.code; - } - return data; - } - serialize(): Uint8Array; - serialize(w: pb_1.BinaryWriter): void; - serialize(w?: pb_1.BinaryWriter): Uint8Array | void { - const writer = w || new pb_1.BinaryWriter(); - if (this.has_common) - writer.writeMessage(1, this.common, () => this.common.serialize(writer)); - if (this.code.length) - writer.writeString(2, this.code); - if (!w) - return writer.getResultBuffer(); - } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TrainLine { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TrainLine(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - reader.readMessage(message.common, () => message.common = CommonInfo.deserialize(reader)); - break; - case 2: - message.code = reader.readString(); - break; - default: reader.skipField(); - } - } - return message; - } - serializeBinary(): Uint8Array { - return this.serialize(); - } - static deserializeBinary(bytes: Uint8Array): TrainLine { - return TrainLine.deserialize(bytes); - } - } export class IscsFan extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { @@ -3151,237 +2873,6 @@ export namespace graphicData { return Signal.deserialize(bytes); } } - export class RunLine extends pb_1.Message { - #one_of_decls: number[][] = []; - constructor(data?: any[] | { - common?: CommonInfo; - code?: string; - points?: Point[]; - nameColor?: string; - nameBgColor?: string; - containSta?: string[]; - linkPathLines?: string[]; - lineId?: string; - }) { - super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 8, 9], this.#one_of_decls); - if (!Array.isArray(data) && typeof data == "object") { - if ("common" in data && data.common != undefined) { - this.common = data.common; - } - if ("code" in data && data.code != undefined) { - this.code = data.code; - } - if ("points" in data && data.points != undefined) { - this.points = data.points; - } - if ("nameColor" in data && data.nameColor != undefined) { - this.nameColor = data.nameColor; - } - if ("nameBgColor" in data && data.nameBgColor != undefined) { - this.nameBgColor = data.nameBgColor; - } - if ("containSta" in data && data.containSta != undefined) { - this.containSta = data.containSta; - } - if ("linkPathLines" in data && data.linkPathLines != undefined) { - this.linkPathLines = data.linkPathLines; - } - if ("lineId" in data && data.lineId != undefined) { - this.lineId = data.lineId; - } - } - } - get common() { - return pb_1.Message.getWrapperField(this, CommonInfo, 1) as CommonInfo; - } - set common(value: CommonInfo) { - pb_1.Message.setWrapperField(this, 1, value); - } - get has_common() { - return pb_1.Message.getField(this, 1) != null; - } - get code() { - return pb_1.Message.getFieldWithDefault(this, 2, "") as string; - } - set code(value: string) { - pb_1.Message.setField(this, 2, value); - } - get points() { - return pb_1.Message.getRepeatedWrapperField(this, Point, 3) as Point[]; - } - set points(value: Point[]) { - pb_1.Message.setRepeatedWrapperField(this, 3, value); - } - get nameColor() { - return pb_1.Message.getFieldWithDefault(this, 4, "") as string; - } - set nameColor(value: string) { - pb_1.Message.setField(this, 4, value); - } - get nameBgColor() { - return pb_1.Message.getFieldWithDefault(this, 5, "") as string; - } - set nameBgColor(value: string) { - pb_1.Message.setField(this, 5, value); - } - get containSta() { - return pb_1.Message.getFieldWithDefault(this, 8, []) as string[]; - } - set containSta(value: string[]) { - pb_1.Message.setField(this, 8, value); - } - get linkPathLines() { - return pb_1.Message.getFieldWithDefault(this, 9, []) as string[]; - } - set linkPathLines(value: string[]) { - pb_1.Message.setField(this, 9, value); - } - get lineId() { - return pb_1.Message.getFieldWithDefault(this, 10, "") as string; - } - set lineId(value: string) { - pb_1.Message.setField(this, 10, value); - } - static fromObject(data: { - common?: ReturnType; - code?: string; - points?: ReturnType[]; - nameColor?: string; - nameBgColor?: string; - containSta?: string[]; - linkPathLines?: string[]; - lineId?: string; - }): RunLine { - const message = new RunLine({}); - if (data.common != null) { - message.common = CommonInfo.fromObject(data.common); - } - if (data.code != null) { - message.code = data.code; - } - if (data.points != null) { - message.points = data.points.map(item => Point.fromObject(item)); - } - if (data.nameColor != null) { - message.nameColor = data.nameColor; - } - if (data.nameBgColor != null) { - message.nameBgColor = data.nameBgColor; - } - if (data.containSta != null) { - message.containSta = data.containSta; - } - if (data.linkPathLines != null) { - message.linkPathLines = data.linkPathLines; - } - if (data.lineId != null) { - message.lineId = data.lineId; - } - return message; - } - toObject() { - const data: { - common?: ReturnType; - code?: string; - points?: ReturnType[]; - nameColor?: string; - nameBgColor?: string; - containSta?: string[]; - linkPathLines?: string[]; - lineId?: string; - } = {}; - if (this.common != null) { - data.common = this.common.toObject(); - } - if (this.code != null) { - data.code = this.code; - } - if (this.points != null) { - data.points = this.points.map((item: Point) => item.toObject()); - } - if (this.nameColor != null) { - data.nameColor = this.nameColor; - } - if (this.nameBgColor != null) { - data.nameBgColor = this.nameBgColor; - } - if (this.containSta != null) { - data.containSta = this.containSta; - } - if (this.linkPathLines != null) { - data.linkPathLines = this.linkPathLines; - } - if (this.lineId != null) { - data.lineId = this.lineId; - } - return data; - } - serialize(): Uint8Array; - serialize(w: pb_1.BinaryWriter): void; - serialize(w?: pb_1.BinaryWriter): Uint8Array | void { - const writer = w || new pb_1.BinaryWriter(); - if (this.has_common) - writer.writeMessage(1, this.common, () => this.common.serialize(writer)); - if (this.code.length) - writer.writeString(2, this.code); - if (this.points.length) - writer.writeRepeatedMessage(3, this.points, (item: Point) => item.serialize(writer)); - if (this.nameColor.length) - writer.writeString(4, this.nameColor); - if (this.nameBgColor.length) - writer.writeString(5, this.nameBgColor); - if (this.containSta.length) - writer.writeRepeatedString(8, this.containSta); - if (this.linkPathLines.length) - writer.writeRepeatedString(9, this.linkPathLines); - if (this.lineId.length) - writer.writeString(10, this.lineId); - if (!w) - return writer.getResultBuffer(); - } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): RunLine { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new RunLine(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - reader.readMessage(message.common, () => message.common = CommonInfo.deserialize(reader)); - break; - case 2: - message.code = reader.readString(); - break; - case 3: - reader.readMessage(message.points, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Point.deserialize(reader), Point)); - break; - case 4: - message.nameColor = reader.readString(); - break; - case 5: - message.nameBgColor = reader.readString(); - break; - case 8: - pb_1.Message.addToRepeatedField(message, 8, reader.readString()); - break; - case 9: - pb_1.Message.addToRepeatedField(message, 9, reader.readString()); - break; - case 10: - message.lineId = reader.readString(); - break; - default: reader.skipField(); - } - } - return message; - } - serializeBinary(): Uint8Array { - return this.serialize(); - } - static deserializeBinary(bytes: Uint8Array): RunLine { - return RunLine.deserialize(bytes); - } - } export class Section extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { @@ -3719,168 +3210,6 @@ export namespace graphicData { return KilometerPoint.deserialize(bytes); } } - export class PathLine extends pb_1.Message { - #one_of_decls: number[][] = []; - constructor(data?: any[] | { - common?: CommonInfo; - code?: string; - points?: Point[]; - isUp?: boolean; - kilometerPoints?: KilometerPoint[]; - }) { - super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 5], this.#one_of_decls); - if (!Array.isArray(data) && typeof data == "object") { - if ("common" in data && data.common != undefined) { - this.common = data.common; - } - if ("code" in data && data.code != undefined) { - this.code = data.code; - } - if ("points" in data && data.points != undefined) { - this.points = data.points; - } - if ("isUp" in data && data.isUp != undefined) { - this.isUp = data.isUp; - } - if ("kilometerPoints" in data && data.kilometerPoints != undefined) { - this.kilometerPoints = data.kilometerPoints; - } - } - } - get common() { - return pb_1.Message.getWrapperField(this, CommonInfo, 1) as CommonInfo; - } - set common(value: CommonInfo) { - pb_1.Message.setWrapperField(this, 1, value); - } - get has_common() { - return pb_1.Message.getField(this, 1) != null; - } - get code() { - return pb_1.Message.getFieldWithDefault(this, 2, "") as string; - } - set code(value: string) { - pb_1.Message.setField(this, 2, value); - } - get points() { - return pb_1.Message.getRepeatedWrapperField(this, Point, 3) as Point[]; - } - set points(value: Point[]) { - pb_1.Message.setRepeatedWrapperField(this, 3, value); - } - get isUp() { - return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean; - } - set isUp(value: boolean) { - pb_1.Message.setField(this, 4, value); - } - get kilometerPoints() { - return pb_1.Message.getRepeatedWrapperField(this, KilometerPoint, 5) as KilometerPoint[]; - } - set kilometerPoints(value: KilometerPoint[]) { - pb_1.Message.setRepeatedWrapperField(this, 5, value); - } - static fromObject(data: { - common?: ReturnType; - code?: string; - points?: ReturnType[]; - isUp?: boolean; - kilometerPoints?: ReturnType[]; - }): PathLine { - const message = new PathLine({}); - if (data.common != null) { - message.common = CommonInfo.fromObject(data.common); - } - if (data.code != null) { - message.code = data.code; - } - if (data.points != null) { - message.points = data.points.map(item => Point.fromObject(item)); - } - if (data.isUp != null) { - message.isUp = data.isUp; - } - if (data.kilometerPoints != null) { - message.kilometerPoints = data.kilometerPoints.map(item => KilometerPoint.fromObject(item)); - } - return message; - } - toObject() { - const data: { - common?: ReturnType; - code?: string; - points?: ReturnType[]; - isUp?: boolean; - kilometerPoints?: ReturnType[]; - } = {}; - if (this.common != null) { - data.common = this.common.toObject(); - } - if (this.code != null) { - data.code = this.code; - } - if (this.points != null) { - data.points = this.points.map((item: Point) => item.toObject()); - } - if (this.isUp != null) { - data.isUp = this.isUp; - } - if (this.kilometerPoints != null) { - data.kilometerPoints = this.kilometerPoints.map((item: KilometerPoint) => item.toObject()); - } - return data; - } - serialize(): Uint8Array; - serialize(w: pb_1.BinaryWriter): void; - serialize(w?: pb_1.BinaryWriter): Uint8Array | void { - const writer = w || new pb_1.BinaryWriter(); - if (this.has_common) - writer.writeMessage(1, this.common, () => this.common.serialize(writer)); - if (this.code.length) - writer.writeString(2, this.code); - if (this.points.length) - writer.writeRepeatedMessage(3, this.points, (item: Point) => item.serialize(writer)); - if (this.isUp != false) - writer.writeBool(4, this.isUp); - if (this.kilometerPoints.length) - writer.writeRepeatedMessage(5, this.kilometerPoints, (item: KilometerPoint) => item.serialize(writer)); - if (!w) - return writer.getResultBuffer(); - } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): PathLine { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new PathLine(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - reader.readMessage(message.common, () => message.common = CommonInfo.deserialize(reader)); - break; - case 2: - message.code = reader.readString(); - break; - case 3: - reader.readMessage(message.points, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Point.deserialize(reader), Point)); - break; - case 4: - message.isUp = reader.readBool(); - break; - case 5: - reader.readMessage(message.kilometerPoints, () => pb_1.Message.addToRepeatedWrapperField(message, 5, KilometerPoint.deserialize(reader), KilometerPoint)); - break; - default: reader.skipField(); - } - } - return message; - } - serializeBinary(): Uint8Array { - return this.serialize(); - } - static deserializeBinary(bytes: Uint8Array): PathLine { - return PathLine.deserialize(bytes); - } - } export class RelatedRef extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { @@ -4123,4 +3452,311 @@ export namespace graphicData { return Separator.deserialize(bytes); } } + export class SectionLink extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + common?: CommonInfo; + code?: string; + points?: Point[]; + refDevice?: string; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("common" in data && data.common != undefined) { + this.common = data.common; + } + if ("code" in data && data.code != undefined) { + this.code = data.code; + } + if ("points" in data && data.points != undefined) { + this.points = data.points; + } + if ("refDevice" in data && data.refDevice != undefined) { + this.refDevice = data.refDevice; + } + } + } + get common() { + return pb_1.Message.getWrapperField(this, CommonInfo, 1) as CommonInfo; + } + set common(value: CommonInfo) { + pb_1.Message.setWrapperField(this, 1, value); + } + get has_common() { + return pb_1.Message.getField(this, 1) != null; + } + get code() { + return pb_1.Message.getFieldWithDefault(this, 2, "") as string; + } + set code(value: string) { + pb_1.Message.setField(this, 2, value); + } + get points() { + return pb_1.Message.getRepeatedWrapperField(this, Point, 3) as Point[]; + } + set points(value: Point[]) { + pb_1.Message.setRepeatedWrapperField(this, 3, value); + } + get refDevice() { + return pb_1.Message.getFieldWithDefault(this, 4, "") as string; + } + set refDevice(value: string) { + pb_1.Message.setField(this, 4, value); + } + static fromObject(data: { + common?: ReturnType; + code?: string; + points?: ReturnType[]; + refDevice?: string; + }): SectionLink { + const message = new SectionLink({}); + if (data.common != null) { + message.common = CommonInfo.fromObject(data.common); + } + if (data.code != null) { + message.code = data.code; + } + if (data.points != null) { + message.points = data.points.map(item => Point.fromObject(item)); + } + if (data.refDevice != null) { + message.refDevice = data.refDevice; + } + return message; + } + toObject() { + const data: { + common?: ReturnType; + code?: string; + points?: ReturnType[]; + refDevice?: string; + } = {}; + if (this.common != null) { + data.common = this.common.toObject(); + } + if (this.code != null) { + data.code = this.code; + } + if (this.points != null) { + data.points = this.points.map((item: Point) => item.toObject()); + } + if (this.refDevice != null) { + data.refDevice = this.refDevice; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_common) + writer.writeMessage(1, this.common, () => this.common.serialize(writer)); + if (this.code.length) + writer.writeString(2, this.code); + if (this.points.length) + writer.writeRepeatedMessage(3, this.points, (item: Point) => item.serialize(writer)); + if (this.refDevice.length) + writer.writeString(4, this.refDevice); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SectionLink { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SectionLink(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.common, () => message.common = CommonInfo.deserialize(reader)); + break; + case 2: + message.code = reader.readString(); + break; + case 3: + reader.readMessage(message.points, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Point.deserialize(reader), Point)); + break; + case 4: + message.refDevice = reader.readString(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): SectionLink { + return SectionLink.deserialize(bytes); + } + } + export class AxleCountingSection extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + common?: CommonInfo; + code?: string; + points?: Point[]; + paRef?: RelatedRef; + pbRef?: RelatedRef; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("common" in data && data.common != undefined) { + this.common = data.common; + } + if ("code" in data && data.code != undefined) { + this.code = data.code; + } + if ("points" in data && data.points != undefined) { + this.points = data.points; + } + if ("paRef" in data && data.paRef != undefined) { + this.paRef = data.paRef; + } + if ("pbRef" in data && data.pbRef != undefined) { + this.pbRef = data.pbRef; + } + } + } + get common() { + return pb_1.Message.getWrapperField(this, CommonInfo, 1) as CommonInfo; + } + set common(value: CommonInfo) { + pb_1.Message.setWrapperField(this, 1, value); + } + get has_common() { + return pb_1.Message.getField(this, 1) != null; + } + get code() { + return pb_1.Message.getFieldWithDefault(this, 2, "") as string; + } + set code(value: string) { + pb_1.Message.setField(this, 2, value); + } + get points() { + return pb_1.Message.getRepeatedWrapperField(this, Point, 3) as Point[]; + } + set points(value: Point[]) { + pb_1.Message.setRepeatedWrapperField(this, 3, value); + } + get paRef() { + return pb_1.Message.getWrapperField(this, RelatedRef, 4) as RelatedRef; + } + set paRef(value: RelatedRef) { + pb_1.Message.setWrapperField(this, 4, value); + } + get has_paRef() { + return pb_1.Message.getField(this, 4) != null; + } + get pbRef() { + return pb_1.Message.getWrapperField(this, RelatedRef, 5) as RelatedRef; + } + set pbRef(value: RelatedRef) { + pb_1.Message.setWrapperField(this, 5, value); + } + get has_pbRef() { + return pb_1.Message.getField(this, 5) != null; + } + static fromObject(data: { + common?: ReturnType; + code?: string; + points?: ReturnType[]; + paRef?: ReturnType; + pbRef?: ReturnType; + }): AxleCountingSection { + const message = new AxleCountingSection({}); + if (data.common != null) { + message.common = CommonInfo.fromObject(data.common); + } + if (data.code != null) { + message.code = data.code; + } + if (data.points != null) { + message.points = data.points.map(item => Point.fromObject(item)); + } + if (data.paRef != null) { + message.paRef = RelatedRef.fromObject(data.paRef); + } + if (data.pbRef != null) { + message.pbRef = RelatedRef.fromObject(data.pbRef); + } + return message; + } + toObject() { + const data: { + common?: ReturnType; + code?: string; + points?: ReturnType[]; + paRef?: ReturnType; + pbRef?: ReturnType; + } = {}; + if (this.common != null) { + data.common = this.common.toObject(); + } + if (this.code != null) { + data.code = this.code; + } + if (this.points != null) { + data.points = this.points.map((item: Point) => item.toObject()); + } + if (this.paRef != null) { + data.paRef = this.paRef.toObject(); + } + if (this.pbRef != null) { + data.pbRef = this.pbRef.toObject(); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_common) + writer.writeMessage(1, this.common, () => this.common.serialize(writer)); + if (this.code.length) + writer.writeString(2, this.code); + if (this.points.length) + writer.writeRepeatedMessage(3, this.points, (item: Point) => item.serialize(writer)); + if (this.has_paRef) + writer.writeMessage(4, this.paRef, () => this.paRef.serialize(writer)); + if (this.has_pbRef) + writer.writeMessage(5, this.pbRef, () => this.pbRef.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): AxleCountingSection { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new AxleCountingSection(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.common, () => message.common = CommonInfo.deserialize(reader)); + break; + case 2: + message.code = reader.readString(); + break; + case 3: + reader.readMessage(message.points, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Point.deserialize(reader), Point)); + break; + case 4: + reader.readMessage(message.paRef, () => message.paRef = RelatedRef.deserialize(reader)); + break; + case 5: + reader.readMessage(message.pbRef, () => message.pbRef = RelatedRef.deserialize(reader)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): AxleCountingSection { + return AxleCountingSection.deserialize(bytes); + } + } }