区段绘制 && message更新

This commit is contained in:
Yuan 2023-06-09 18:36:09 +08:00
parent 7686c1d50c
commit ec4eb4b25c
8 changed files with 653 additions and 108 deletions

View File

@ -0,0 +1,45 @@
import * as pb_1 from 'google-protobuf';
import { GraphicDataBase } from './GraphicDataBase';
import { ISectionData } from 'src/graphics/section/Section';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { IPointData } from 'pixi.js';
export class SectionData extends GraphicDataBase implements ISectionData {
constructor(data?: graphicData.Section) {
let section;
if (!data) {
section = new graphicData.Section({
common: GraphicDataBase.defaultCommonInfo(),
});
} else {
section = data;
}
super(section);
}
public get data(): graphicData.Section {
return this.getData<graphicData.Section>();
}
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 })
);
}
clone(): SectionData {
return new SectionData(this.data.cloneMessage());
}
copyFrom(data: SectionData): void {
pb_1.Message.copyInto(data.data, this.data);
}
eq(other: SectionData): boolean {
return pb_1.Message.equals(this.data, other.data);
}
}

View File

@ -38,6 +38,9 @@ import { TurnoutData } from './graphics/TurnoutInteraction';
import { saveDraft, getDraft } from 'src/api/DraftApi'; import { saveDraft, getDraft } from 'src/api/DraftApi';
import { useDrawStore } from 'src/stores/draw-store'; import { useDrawStore } from 'src/stores/draw-store';
import { successNotify, errorNotify } from '../utils/CommonNotify'; import { successNotify, errorNotify } from '../utils/CommonNotify';
import { Section } from 'src/graphics/section/Section';
import { SectionDraw } from 'src/graphics/section/SectionDrawAssistant';
import { SectionData } from './graphics/SectionInteraction';
export function fromStoragePoint(p: graphicData.Point): Point { export function fromStoragePoint(p: graphicData.Point): Point {
return new Point(p.x, p.y); return new Point(p.x, p.y);
@ -124,6 +127,7 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
// new TrainDraw(app, () => { // new TrainDraw(app, () => {
// return new TrainData(); // return new TrainData();
// }), // }),
new SectionDraw(app, () => new SectionData()),
], ],
}); });
@ -233,6 +237,9 @@ export function saveDrawDatas(app: JlDrawApp) {
} else if (Signal.Type === g.type) { } else if (Signal.Type === g.type) {
const signalData = (g as Signal).saveData(); const signalData = (g as Signal).saveData();
storage.signals.push((signalData as SignalData).data); storage.signals.push((signalData as SignalData).data);
} else if (Section.Type === g.type) {
const sectionData = (g as Section).saveData();
storage.section.push((sectionData as SectionData).data);
} }
}); });
const base64 = fromUint8Array(storage.serialize()); const base64 = fromUint8Array(storage.serialize());
@ -293,6 +300,9 @@ export async function loadDrawDatas(app: GraphicApp) {
storage.signals.forEach((signal) => { storage.signals.forEach((signal) => {
datas.push(new SignalData(signal)); datas.push(new SignalData(signal));
}); });
storage.section.forEach((section) => {
datas.push(new SectionData(section));
});
app.loadGraphic(datas); app.loadGraphic(datas);
} else { } else {
app.loadGraphic([]); app.loadGraphic([]);

View File

@ -0,0 +1,76 @@
import { Graphics, IPointData } from 'pixi.js';
import { GraphicData, JlGraphic, JlGraphicTemplate } from 'src/jl-graphic';
import { ILineGraphic } from 'src/jl-graphic/plugins/GraphicEditPlugin';
import { Link } from '../link/Link';
export interface ISectionData extends GraphicData {
get code(): string; // 编号
set code(v: string);
get points(): IPointData[]; // 线坐标点
set points(points: IPointData[]);
clone(): ISectionData;
copyFrom(data: ISectionData): void;
eq(other: ISectionData): boolean;
}
export const SectionConsts = {
lineColor: '#5578b6',
lineWidth: 5,
};
export class Section extends JlGraphic implements ILineGraphic {
static Type = 'Section';
lineGraphic: Graphics;
constructor() {
super(Section.Type);
this.lineGraphic = new Graphics();
this.addChild(this.lineGraphic);
}
doRepaint() {
if (this.datas.points.length < 2) {
throw new Error('Link坐标数据异常');
}
this.lineGraphic.clear();
this.lineGraphic.lineStyle(
SectionConsts.lineWidth,
SectionConsts.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);
}
});
}
getStartPoint() {
return this.datas.points[0];
}
getEndPoint(): IPointData {
return this.datas.points[this.datas.points.length - 1];
}
get datas(): ISectionData {
return this.getDatas<ISectionData>();
}
get linePoints(): IPointData[] {
return this.datas.points;
}
set linePoints(points: IPointData[]) {
const old = this.datas.clone();
old.points = points;
this.updateData(old);
}
}
export class SectionTemplate extends JlGraphicTemplate<Section> {
constructor() {
super(Section.Type);
}
new() {
return new Section();
}
}

View File

@ -0,0 +1,139 @@
import {
GraphicApp,
GraphicDrawAssistant,
GraphicInteractionPlugin,
JlDrawApp,
JlGraphic,
linePoint,
} from 'src/jl-graphic';
import {
ISectionData,
Section,
SectionConsts,
SectionTemplate,
} from './Section';
import {
DisplayObject,
FederatedMouseEvent,
Graphics,
IHitArea,
Point,
} from 'pixi.js';
import { PolylineEditPlugin } from 'src/jl-graphic/plugins/GraphicEditPlugin';
export class SectionDraw extends GraphicDrawAssistant<
SectionTemplate,
ISectionData
> {
points: Point[] = [];
graphic = new Graphics();
constructor(app: JlDrawApp, createData: () => ISectionData) {
super(
app,
new SectionTemplate(),
createData,
'sym_o_timeline',
'区段Section'
);
this.container.addChild(this.graphic);
SectionPointEditPlugin.init(app);
}
onLeftDown(e: FederatedMouseEvent): void {
const { x, y } = this.toCanvasCoordinates(e.global);
const p = new Point(x, y);
// this.points.pop();
this.points.push(p);
}
onRightClick(): void {
this.createAndStore(true);
}
redraw(cp: Point): void {
if (this.points.length < 1) return;
this.graphic.clear();
this.graphic.lineStyle(SectionConsts.lineWidth, SectionConsts.lineColor);
// this.points.push(cp);
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);
}
prepareData(data: ISectionData): boolean {
data.points = this.points;
return true;
}
clearCache(): void {
this.points = [];
this.graphic.clear();
}
}
class SectionGraphicHitArea implements IHitArea {
section: Section;
constructor(section: Section) {
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 }, SectionConsts.lineWidth)) {
return true;
}
}
return false;
}
}
export class SectionPointEditPlugin extends GraphicInteractionPlugin<Section> {
static Name = 'SectionPointDrag';
constructor(app: GraphicApp) {
super(SectionPointEditPlugin.Name, app);
}
static init(app: GraphicApp) {
return new SectionPointEditPlugin(app);
}
filter(...grahpics: JlGraphic[]): Section[] | undefined {
return grahpics.filter((g) => g.type == Section.Type) as Section[];
}
bind(g: Section): void {
g.lineGraphic.eventMode = 'static';
g.lineGraphic.cursor = 'pointer';
g.lineGraphic.hitArea = new SectionGraphicHitArea(g);
g.on('selected', this.onSelected, this);
g.on('unselected', this.onUnselected, this);
}
unbind(g: Section): void {
g.off('selected', this.onSelected, this);
g.off('unselected', this.onUnselected, this);
}
onSelected(g: DisplayObject): void {
const section = g as Section;
let lep = section.getAssistantAppend<PolylineEditPlugin>(
PolylineEditPlugin.Name
);
if (!lep) {
lep = new PolylineEditPlugin(section);
section.addAssistantAppend(lep);
}
lep.showAll();
}
onUnselected(g: DisplayObject): void {
const section = g as Section;
const lep = section.getAssistantAppend<PolylineEditPlugin>(
PolylineEditPlugin.Name
);
if (lep) {
lep.hideAll();
}
}
}

View File

@ -10,12 +10,9 @@ export class LineNetTrainOffset extends pb_1.Message {
lineId?: number; lineId?: number;
Group_id?: string; Group_id?: string;
dir?: number; dir?: number;
initType?: boolean;
offset?: number;
destinationId?: number;
backId?: number;
show?: boolean; show?: boolean;
rate?: number; windowNo?: number;
windowOffset?: number;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -29,23 +26,14 @@ export class LineNetTrainOffset extends pb_1.Message {
if ("dir" in data && data.dir != undefined) { if ("dir" in data && data.dir != undefined) {
this.dir = data.dir; this.dir = data.dir;
} }
if ("initType" in data && data.initType != undefined) {
this.initType = data.initType;
}
if ("offset" in data && data.offset != undefined) {
this.offset = data.offset;
}
if ("destinationId" in data && data.destinationId != undefined) {
this.destinationId = data.destinationId;
}
if ("backId" in data && data.backId != undefined) {
this.backId = data.backId;
}
if ("show" in data && data.show != undefined) { if ("show" in data && data.show != undefined) {
this.show = data.show; this.show = data.show;
} }
if ("rate" in data && data.rate != undefined) { if ("windowNo" in data && data.windowNo != undefined) {
this.rate = data.rate; this.windowNo = data.windowNo;
}
if ("windowOffset" in data && data.windowOffset != undefined) {
this.windowOffset = data.windowOffset;
} }
} }
} }
@ -67,52 +55,31 @@ export class LineNetTrainOffset extends pb_1.Message {
set dir(value: number) { set dir(value: number) {
pb_1.Message.setField(this, 3, value); pb_1.Message.setField(this, 3, value);
} }
get initType() { get show() {
return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean; return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean;
} }
set initType(value: boolean) { set show(value: boolean) {
pb_1.Message.setField(this, 4, value); pb_1.Message.setField(this, 4, value);
} }
get offset() { get windowNo() {
return pb_1.Message.getFieldWithDefault(this, 5, 0) as number; return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
} }
set offset(value: number) { set windowNo(value: number) {
pb_1.Message.setField(this, 5, value); pb_1.Message.setField(this, 5, value);
} }
get destinationId() { get windowOffset() {
return pb_1.Message.getFieldWithDefault(this, 6, 0) as number; return pb_1.Message.getFieldWithDefault(this, 6, 0) as number;
} }
set destinationId(value: number) { set windowOffset(value: number) {
pb_1.Message.setField(this, 6, value); pb_1.Message.setField(this, 6, value);
} }
get backId() {
return pb_1.Message.getFieldWithDefault(this, 7, 0) as number;
}
set backId(value: number) {
pb_1.Message.setField(this, 7, value);
}
get show() {
return pb_1.Message.getFieldWithDefault(this, 8, false) as boolean;
}
set show(value: boolean) {
pb_1.Message.setField(this, 8, value);
}
get rate() {
return pb_1.Message.getFieldWithDefault(this, 9, 0) as number;
}
set rate(value: number) {
pb_1.Message.setField(this, 9, value);
}
static fromObject(data: { static fromObject(data: {
lineId?: number; lineId?: number;
Group_id?: string; Group_id?: string;
dir?: number; dir?: number;
initType?: boolean;
offset?: number;
destinationId?: number;
backId?: number;
show?: boolean; show?: boolean;
rate?: number; windowNo?: number;
windowOffset?: number;
}): LineNetTrainOffset { }): LineNetTrainOffset {
const message = new LineNetTrainOffset({}); const message = new LineNetTrainOffset({});
if (data.lineId != null) { if (data.lineId != null) {
@ -124,23 +91,14 @@ export class LineNetTrainOffset extends pb_1.Message {
if (data.dir != null) { if (data.dir != null) {
message.dir = data.dir; message.dir = data.dir;
} }
if (data.initType != null) {
message.initType = data.initType;
}
if (data.offset != null) {
message.offset = data.offset;
}
if (data.destinationId != null) {
message.destinationId = data.destinationId;
}
if (data.backId != null) {
message.backId = data.backId;
}
if (data.show != null) { if (data.show != null) {
message.show = data.show; message.show = data.show;
} }
if (data.rate != null) { if (data.windowNo != null) {
message.rate = data.rate; message.windowNo = data.windowNo;
}
if (data.windowOffset != null) {
message.windowOffset = data.windowOffset;
} }
return message; return message;
} }
@ -149,12 +107,9 @@ export class LineNetTrainOffset extends pb_1.Message {
lineId?: number; lineId?: number;
Group_id?: string; Group_id?: string;
dir?: number; dir?: number;
initType?: boolean;
offset?: number;
destinationId?: number;
backId?: number;
show?: boolean; show?: boolean;
rate?: number; windowNo?: number;
windowOffset?: number;
} = {}; } = {};
if (this.lineId != null) { if (this.lineId != null) {
data.lineId = this.lineId; data.lineId = this.lineId;
@ -165,23 +120,14 @@ export class LineNetTrainOffset extends pb_1.Message {
if (this.dir != null) { if (this.dir != null) {
data.dir = this.dir; data.dir = this.dir;
} }
if (this.initType != null) {
data.initType = this.initType;
}
if (this.offset != null) {
data.offset = this.offset;
}
if (this.destinationId != null) {
data.destinationId = this.destinationId;
}
if (this.backId != null) {
data.backId = this.backId;
}
if (this.show != null) { if (this.show != null) {
data.show = this.show; data.show = this.show;
} }
if (this.rate != null) { if (this.windowNo != null) {
data.rate = this.rate; data.windowNo = this.windowNo;
}
if (this.windowOffset != null) {
data.windowOffset = this.windowOffset;
} }
return data; return data;
} }
@ -195,18 +141,12 @@ export class LineNetTrainOffset extends pb_1.Message {
writer.writeString(2, this.Group_id); writer.writeString(2, this.Group_id);
if (this.dir != 0) if (this.dir != 0)
writer.writeInt32(3, this.dir); writer.writeInt32(3, this.dir);
if (this.initType != false)
writer.writeBool(4, this.initType);
if (this.offset != 0)
writer.writeInt32(5, this.offset);
if (this.destinationId != 0)
writer.writeInt32(6, this.destinationId);
if (this.backId != 0)
writer.writeInt32(7, this.backId);
if (this.show != false) if (this.show != false)
writer.writeBool(8, this.show); writer.writeBool(4, this.show);
if (this.rate != 0) if (this.windowNo != 0)
writer.writeFloat(9, this.rate); writer.writeInt32(5, this.windowNo);
if (this.windowOffset != 0)
writer.writeInt32(6, this.windowOffset);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -226,22 +166,13 @@ export class LineNetTrainOffset extends pb_1.Message {
message.dir = reader.readInt32(); message.dir = reader.readInt32();
break; break;
case 4: case 4:
message.initType = reader.readBool();
break;
case 5:
message.offset = reader.readInt32();
break;
case 6:
message.destinationId = reader.readInt32();
break;
case 7:
message.backId = reader.readInt32();
break;
case 8:
message.show = reader.readBool(); message.show = reader.readBool();
break; break;
case 9: case 5:
message.rate = reader.readFloat(); message.windowNo = reader.readInt32();
break;
case 6:
message.windowOffset = reader.readInt32();
break; break;
default: reader.skipField(); default: reader.skipField();
} }

View File

@ -1546,6 +1546,7 @@ export namespace state {
ipSingleSwitchStusBlocked2?: boolean; ipSingleSwitchStusBlocked2?: boolean;
ipSingleSwitchStusLostIndication?: boolean; ipSingleSwitchStusLostIndication?: boolean;
id?: string; id?: string;
speedLimit?: number;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -1634,6 +1635,9 @@ export namespace state {
if ("id" in data && data.id != undefined) { if ("id" in data && data.id != undefined) {
this.id = data.id; this.id = data.id;
} }
if ("speedLimit" in data && data.speedLimit != undefined) {
this.speedLimit = data.speedLimit;
}
} }
} }
get ipSingleSwitchStusCiOccupied() { get ipSingleSwitchStusCiOccupied() {
@ -1804,6 +1808,12 @@ export namespace state {
set id(value: string) { set id(value: string) {
pb_1.Message.setField(this, 28, value); pb_1.Message.setField(this, 28, value);
} }
get speedLimit() {
return pb_1.Message.getFieldWithDefault(this, 29, 0) as number;
}
set speedLimit(value: number) {
pb_1.Message.setField(this, 29, value);
}
static fromObject(data: { static fromObject(data: {
ipSingleSwitchStusCiOccupied?: boolean; ipSingleSwitchStusCiOccupied?: boolean;
ipSingleSwitchStusCbtcOccupied?: boolean; ipSingleSwitchStusCbtcOccupied?: boolean;
@ -1833,6 +1843,7 @@ export namespace state {
ipSingleSwitchStusBlocked2?: boolean; ipSingleSwitchStusBlocked2?: boolean;
ipSingleSwitchStusLostIndication?: boolean; ipSingleSwitchStusLostIndication?: boolean;
id?: string; id?: string;
speedLimit?: number;
}): Switch { }): Switch {
const message = new Switch({}); const message = new Switch({});
if (data.ipSingleSwitchStusCiOccupied != null) { if (data.ipSingleSwitchStusCiOccupied != null) {
@ -1919,6 +1930,9 @@ export namespace state {
if (data.id != null) { if (data.id != null) {
message.id = data.id; message.id = data.id;
} }
if (data.speedLimit != null) {
message.speedLimit = data.speedLimit;
}
return message; return message;
} }
toObject() { toObject() {
@ -1951,6 +1965,7 @@ export namespace state {
ipSingleSwitchStusBlocked2?: boolean; ipSingleSwitchStusBlocked2?: boolean;
ipSingleSwitchStusLostIndication?: boolean; ipSingleSwitchStusLostIndication?: boolean;
id?: string; id?: string;
speedLimit?: number;
} = {}; } = {};
if (this.ipSingleSwitchStusCiOccupied != null) { if (this.ipSingleSwitchStusCiOccupied != null) {
data.ipSingleSwitchStusCiOccupied = this.ipSingleSwitchStusCiOccupied; data.ipSingleSwitchStusCiOccupied = this.ipSingleSwitchStusCiOccupied;
@ -2036,6 +2051,9 @@ export namespace state {
if (this.id != null) { if (this.id != null) {
data.id = this.id; data.id = this.id;
} }
if (this.speedLimit != null) {
data.speedLimit = this.speedLimit;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -2098,6 +2116,8 @@ export namespace state {
writer.writeBool(27, this.ipSingleSwitchStusLostIndication); writer.writeBool(27, this.ipSingleSwitchStusLostIndication);
if (this.id.length) if (this.id.length)
writer.writeString(28, this.id); writer.writeString(28, this.id);
if (this.speedLimit != 0)
writer.writeInt32(29, this.speedLimit);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -2191,6 +2211,9 @@ export namespace state {
case 28: case 28:
message.id = reader.readString(); message.id = reader.readString();
break; break;
case 29:
message.speedLimit = reader.readInt32();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }
@ -2218,6 +2241,8 @@ export namespace state {
overlap?: boolean; overlap?: boolean;
blocked?: boolean; blocked?: boolean;
id?: string; id?: string;
speedLimit?: number;
limitType?: number;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -2258,6 +2283,12 @@ export namespace state {
if ("id" in data && data.id != undefined) { if ("id" in data && data.id != undefined) {
this.id = data.id; this.id = data.id;
} }
if ("speedLimit" in data && data.speedLimit != undefined) {
this.speedLimit = data.speedLimit;
}
if ("limitType" in data && data.limitType != undefined) {
this.limitType = data.limitType;
}
} }
} }
get ciOccupied() { get ciOccupied() {
@ -2332,6 +2363,18 @@ export namespace state {
set id(value: string) { set id(value: string) {
pb_1.Message.setField(this, 12, value); pb_1.Message.setField(this, 12, value);
} }
get speedLimit() {
return pb_1.Message.getFieldWithDefault(this, 13, 0) as number;
}
set speedLimit(value: number) {
pb_1.Message.setField(this, 13, value);
}
get limitType() {
return pb_1.Message.getFieldWithDefault(this, 14, 0) as number;
}
set limitType(value: number) {
pb_1.Message.setField(this, 14, value);
}
static fromObject(data: { static fromObject(data: {
ciOccupied?: boolean; ciOccupied?: boolean;
cbtcOccupied?: boolean; cbtcOccupied?: boolean;
@ -2345,6 +2388,8 @@ export namespace state {
overlap?: boolean; overlap?: boolean;
blocked?: boolean; blocked?: boolean;
id?: string; id?: string;
speedLimit?: number;
limitType?: number;
}): Track { }): Track {
const message = new Track({}); const message = new Track({});
if (data.ciOccupied != null) { if (data.ciOccupied != null) {
@ -2383,6 +2428,12 @@ export namespace state {
if (data.id != null) { if (data.id != null) {
message.id = data.id; message.id = data.id;
} }
if (data.speedLimit != null) {
message.speedLimit = data.speedLimit;
}
if (data.limitType != null) {
message.limitType = data.limitType;
}
return message; return message;
} }
toObject() { toObject() {
@ -2399,6 +2450,8 @@ export namespace state {
overlap?: boolean; overlap?: boolean;
blocked?: boolean; blocked?: boolean;
id?: string; id?: string;
speedLimit?: number;
limitType?: number;
} = {}; } = {};
if (this.ciOccupied != null) { if (this.ciOccupied != null) {
data.ciOccupied = this.ciOccupied; data.ciOccupied = this.ciOccupied;
@ -2436,6 +2489,12 @@ export namespace state {
if (this.id != null) { if (this.id != null) {
data.id = this.id; data.id = this.id;
} }
if (this.speedLimit != null) {
data.speedLimit = this.speedLimit;
}
if (this.limitType != null) {
data.limitType = this.limitType;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -2466,6 +2525,10 @@ export namespace state {
writer.writeBool(11, this.blocked); writer.writeBool(11, this.blocked);
if (this.id.length) if (this.id.length)
writer.writeString(12, this.id); writer.writeString(12, this.id);
if (this.speedLimit != 0)
writer.writeFloat(13, this.speedLimit);
if (this.limitType != 0)
writer.writeInt32(14, this.limitType);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -2511,6 +2574,12 @@ export namespace state {
case 12: case 12:
message.id = reader.readString(); message.id = reader.readString();
break; break;
case 13:
message.speedLimit = reader.readFloat();
break;
case 14:
message.limitType = reader.readInt32();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }
@ -2540,6 +2609,8 @@ export namespace state {
upTrainSkipstop?: boolean; upTrainSkipstop?: boolean;
downTrainSkipstop?: boolean; downTrainSkipstop?: boolean;
id?: string; id?: string;
nextSectionRunTime?: number;
nextSectionRunLevel?: number;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -2586,6 +2657,12 @@ export namespace state {
if ("id" in data && data.id != undefined) { if ("id" in data && data.id != undefined) {
this.id = data.id; this.id = data.id;
} }
if ("nextSectionRunTime" in data && data.nextSectionRunTime != undefined) {
this.nextSectionRunTime = data.nextSectionRunTime;
}
if ("nextSectionRunLevel" in data && data.nextSectionRunLevel != undefined) {
this.nextSectionRunLevel = data.nextSectionRunLevel;
}
} }
} }
get emergstop() { get emergstop() {
@ -2672,6 +2749,18 @@ export namespace state {
set id(value: string) { set id(value: string) {
pb_1.Message.setField(this, 14, value); pb_1.Message.setField(this, 14, value);
} }
get nextSectionRunTime() {
return pb_1.Message.getFieldWithDefault(this, 15, 0) as number;
}
set nextSectionRunTime(value: number) {
pb_1.Message.setField(this, 15, value);
}
get nextSectionRunLevel() {
return pb_1.Message.getFieldWithDefault(this, 16, 0) as number;
}
set nextSectionRunLevel(value: number) {
pb_1.Message.setField(this, 16, value);
}
static fromObject(data: { static fromObject(data: {
emergstop?: boolean; emergstop?: boolean;
trainberth?: boolean; trainberth?: boolean;
@ -2687,6 +2776,8 @@ export namespace state {
upTrainSkipstop?: boolean; upTrainSkipstop?: boolean;
downTrainSkipstop?: boolean; downTrainSkipstop?: boolean;
id?: string; id?: string;
nextSectionRunTime?: number;
nextSectionRunLevel?: number;
}): Platform { }): Platform {
const message = new Platform({}); const message = new Platform({});
if (data.emergstop != null) { if (data.emergstop != null) {
@ -2731,6 +2822,12 @@ export namespace state {
if (data.id != null) { if (data.id != null) {
message.id = data.id; message.id = data.id;
} }
if (data.nextSectionRunTime != null) {
message.nextSectionRunTime = data.nextSectionRunTime;
}
if (data.nextSectionRunLevel != null) {
message.nextSectionRunLevel = data.nextSectionRunLevel;
}
return message; return message;
} }
toObject() { toObject() {
@ -2749,6 +2846,8 @@ export namespace state {
upTrainSkipstop?: boolean; upTrainSkipstop?: boolean;
downTrainSkipstop?: boolean; downTrainSkipstop?: boolean;
id?: string; id?: string;
nextSectionRunTime?: number;
nextSectionRunLevel?: number;
} = {}; } = {};
if (this.emergstop != null) { if (this.emergstop != null) {
data.emergstop = this.emergstop; data.emergstop = this.emergstop;
@ -2792,6 +2891,12 @@ export namespace state {
if (this.id != null) { if (this.id != null) {
data.id = this.id; data.id = this.id;
} }
if (this.nextSectionRunTime != null) {
data.nextSectionRunTime = this.nextSectionRunTime;
}
if (this.nextSectionRunLevel != null) {
data.nextSectionRunLevel = this.nextSectionRunLevel;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -2826,6 +2931,10 @@ export namespace state {
writer.writeBool(13, this.downTrainSkipstop); writer.writeBool(13, this.downTrainSkipstop);
if (this.id.length) if (this.id.length)
writer.writeString(14, this.id); writer.writeString(14, this.id);
if (this.nextSectionRunTime != 0)
writer.writeInt32(15, this.nextSectionRunTime);
if (this.nextSectionRunLevel != 0)
writer.writeInt32(16, this.nextSectionRunLevel);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -2877,6 +2986,12 @@ export namespace state {
case 14: case 14:
message.id = reader.readString(); message.id = reader.readString();
break; break;
case 15:
message.nextSectionRunTime = reader.readInt32();
break;
case 16:
message.nextSectionRunLevel = reader.readInt32();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }
@ -4236,4 +4351,94 @@ export namespace state {
return TrainMode.deserialize(bytes); return TrainMode.deserialize(bytes);
} }
} }
export class OccNccFepNetwork extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
id?: string;
active?: 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 ("id" in data && data.id != undefined) {
this.id = data.id;
}
if ("active" in data && data.active != undefined) {
this.active = data.active;
}
}
}
get id() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set id(value: string) {
pb_1.Message.setField(this, 1, value);
}
get active() {
return pb_1.Message.getFieldWithDefault(this, 2, false) as boolean;
}
set active(value: boolean) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
id?: string;
active?: boolean;
}): OccNccFepNetwork {
const message = new OccNccFepNetwork({});
if (data.id != null) {
message.id = data.id;
}
if (data.active != null) {
message.active = data.active;
}
return message;
}
toObject() {
const data: {
id?: string;
active?: boolean;
} = {};
if (this.id != null) {
data.id = this.id;
}
if (this.active != null) {
data.active = this.active;
}
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.id.length)
writer.writeString(1, this.id);
if (this.active != false)
writer.writeBool(2, this.active);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): OccNccFepNetwork {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new OccNccFepNetwork();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.id = reader.readString();
break;
case 2:
message.active = reader.readBool();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): OccNccFepNetwork {
return OccNccFepNetwork.deserialize(bytes);
}
}
} }

View File

@ -17,9 +17,10 @@ export namespace graphicData {
train?: Train[]; train?: Train[];
signals?: Signal[]; signals?: Signal[];
turnouts?: Turnout[]; turnouts?: Turnout[];
section?: Section[];
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6, 7, 8, 9], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6, 7, 8, 9, 10], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") { if (!Array.isArray(data) && typeof data == "object") {
if ("canvas" in data && data.canvas != undefined) { if ("canvas" in data && data.canvas != undefined) {
this.canvas = data.canvas; this.canvas = data.canvas;
@ -48,6 +49,9 @@ export namespace graphicData {
if ("turnouts" in data && data.turnouts != undefined) { if ("turnouts" in data && data.turnouts != undefined) {
this.turnouts = data.turnouts; this.turnouts = data.turnouts;
} }
if ("section" in data && data.section != undefined) {
this.section = data.section;
}
} }
} }
get canvas() { get canvas() {
@ -107,6 +111,12 @@ export namespace graphicData {
set turnouts(value: Turnout[]) { set turnouts(value: Turnout[]) {
pb_1.Message.setRepeatedWrapperField(this, 9, value); pb_1.Message.setRepeatedWrapperField(this, 9, value);
} }
get section() {
return pb_1.Message.getRepeatedWrapperField(this, Section, 10) as Section[];
}
set section(value: Section[]) {
pb_1.Message.setRepeatedWrapperField(this, 10, value);
}
static fromObject(data: { static fromObject(data: {
canvas?: ReturnType<typeof Canvas.prototype.toObject>; canvas?: ReturnType<typeof Canvas.prototype.toObject>;
links?: ReturnType<typeof Link.prototype.toObject>[]; links?: ReturnType<typeof Link.prototype.toObject>[];
@ -117,6 +127,7 @@ export namespace graphicData {
train?: ReturnType<typeof Train.prototype.toObject>[]; train?: ReturnType<typeof Train.prototype.toObject>[];
signals?: ReturnType<typeof Signal.prototype.toObject>[]; signals?: ReturnType<typeof Signal.prototype.toObject>[];
turnouts?: ReturnType<typeof Turnout.prototype.toObject>[]; turnouts?: ReturnType<typeof Turnout.prototype.toObject>[];
section?: ReturnType<typeof Section.prototype.toObject>[];
}): RtssGraphicStorage { }): RtssGraphicStorage {
const message = new RtssGraphicStorage({}); const message = new RtssGraphicStorage({});
if (data.canvas != null) { if (data.canvas != null) {
@ -146,6 +157,9 @@ export namespace graphicData {
if (data.turnouts != null) { if (data.turnouts != null) {
message.turnouts = data.turnouts.map(item => Turnout.fromObject(item)); message.turnouts = data.turnouts.map(item => Turnout.fromObject(item));
} }
if (data.section != null) {
message.section = data.section.map(item => Section.fromObject(item));
}
return message; return message;
} }
toObject() { toObject() {
@ -159,6 +173,7 @@ export namespace graphicData {
train?: ReturnType<typeof Train.prototype.toObject>[]; train?: ReturnType<typeof Train.prototype.toObject>[];
signals?: ReturnType<typeof Signal.prototype.toObject>[]; signals?: ReturnType<typeof Signal.prototype.toObject>[];
turnouts?: ReturnType<typeof Turnout.prototype.toObject>[]; turnouts?: ReturnType<typeof Turnout.prototype.toObject>[];
section?: ReturnType<typeof Section.prototype.toObject>[];
} = {}; } = {};
if (this.canvas != null) { if (this.canvas != null) {
data.canvas = this.canvas.toObject(); data.canvas = this.canvas.toObject();
@ -187,6 +202,9 @@ export namespace graphicData {
if (this.turnouts != null) { if (this.turnouts != null) {
data.turnouts = this.turnouts.map((item: Turnout) => item.toObject()); data.turnouts = this.turnouts.map((item: Turnout) => item.toObject());
} }
if (this.section != null) {
data.section = this.section.map((item: Section) => item.toObject());
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -211,6 +229,8 @@ export namespace graphicData {
writer.writeRepeatedMessage(8, this.signals, (item: Signal) => item.serialize(writer)); writer.writeRepeatedMessage(8, this.signals, (item: Signal) => item.serialize(writer));
if (this.turnouts.length) if (this.turnouts.length)
writer.writeRepeatedMessage(9, this.turnouts, (item: Turnout) => item.serialize(writer)); 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 (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -247,6 +267,9 @@ export namespace graphicData {
case 9: case 9:
reader.readMessage(message.turnouts, () => pb_1.Message.addToRepeatedWrapperField(message, 9, Turnout.deserialize(reader), Turnout)); reader.readMessage(message.turnouts, () => pb_1.Message.addToRepeatedWrapperField(message, 9, Turnout.deserialize(reader), Turnout));
break; break;
case 10:
reader.readMessage(message.section, () => pb_1.Message.addToRepeatedWrapperField(message, 10, Section.deserialize(reader), Section));
break;
default: reader.skipField(); default: reader.skipField();
} }
} }
@ -2061,4 +2084,120 @@ export namespace graphicData {
return Signal.deserialize(bytes); return Signal.deserialize(bytes);
} }
} }
export class Section extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
common?: CommonInfo;
code?: string;
points?: Point[];
}) {
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;
}
}
}
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);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
points?: ReturnType<typeof Point.prototype.toObject>[];
}): Section {
const message = new Section({});
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));
}
return message;
}
toObject() {
const data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
points?: ReturnType<typeof Point.prototype.toObject>[];
} = {};
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());
}
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 (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Section {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Section();
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;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Section {
return Section.deserialize(bytes);
}
}
} }

@ -1 +1 @@
Subproject commit a8afc44290373cc61ad855327637032102fd10a0 Subproject commit 6c78a70743779784b1f81ec34cf3eb0156f3a292