sectionLInk逻辑关系调整

This commit is contained in:
fan 2023-07-12 13:05:42 +08:00
parent a785296c3b
commit e7fbcc3e3b
9 changed files with 1207 additions and 62 deletions

@ -1 +1 @@
Subproject commit f6f49ec19378c9a9845c53bd4425143f654ae59e
Subproject commit f0f415273f5e188db87ee361e6808e4ec90ceda1

View File

@ -13,6 +13,53 @@
@blur="onUpdate"
label="编号"
/>
<q-checkbox
v-model="sectionLinkModel.up"
label="是否上行"
@update:model-value="onUpdate"
/>
<q-list bordered separator class="rounded-borders">
<q-item>
<q-item-section no-wrap class="q-gutter-y-sm column">
<q-item-label> A端关联设备 </q-item-label>
<div class="q-gutter-sm row">
<q-chip square color="primary" text-color="white">
{{ aSimRef }}
</q-chip>
</div>
</q-item-section>
</q-item>
<q-item>
<q-item-section no-wrap class="q-gutter-y-sm column">
<q-item-label> B端关联设备 </q-item-label>
<div class="q-gutter-sm row">
<q-chip square color="primary" text-color="white">
{{ bSimRef }}
</q-chip>
</div>
</q-item-section>
</q-item>
<q-item>
<q-item-section no-wrap class="q-gutter-y-sm column">
<q-item-label> A端关联端口设备 </q-item-label>
<div class="q-gutter-sm row">
<q-chip square color="primary" text-color="white">
{{ aRef }}
</q-chip>
</div>
</q-item-section>
</q-item>
<q-item>
<q-item-section no-wrap class="q-gutter-y-sm column">
<q-item-label> B端关联端口设备 </q-item-label>
<div class="q-gutter-sm row">
<q-chip square color="primary" text-color="white">
{{ bRef }}
</q-chip>
</div>
</q-item-section>
</q-item>
</q-list>
</q-form>
</template>
@ -20,16 +67,61 @@
import { SectionLink } from 'src/graphics/sectionLink/SectionLink';
import { SectionLinkData } from 'src/drawApp/graphics/SectionLinkInteraction';
import { useDrawStore } from 'src/stores/draw-store';
import { shallowRef, watchEffect } from 'vue';
import { shallowRef, watchEffect, ref } from 'vue';
import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting';
import { Turnout } from 'src/graphics/turnout/Turnout';
const drawStore = useDrawStore();
const sectionLinkModel = shallowRef(new SectionLinkData());
const aSimRef = ref('');
const bSimRef = ref('');
const aRef = ref('');
const bRef = ref('');
watchEffect(() => {
const sectionLink = drawStore.selectedGraphic;
const portList = ['A', 'B', 'C'];
if (sectionLink && sectionLink instanceof SectionLink) {
sectionLinkModel.value = sectionLink.saveData();
aSimRef.value = '';
bSimRef.value = '';
aRef.value = '';
bRef.value = '';
if (sectionLinkModel.value.aSimRef) {
const g = drawStore
.getDrawApp()
.queryStore.queryById(sectionLinkModel.value.aSimRef.id) as
| AxleCounting
| Turnout;
aSimRef.value = g.datas.code;
}
if (sectionLinkModel.value.bSimRef) {
const g = drawStore
.getDrawApp()
.queryStore.queryById(sectionLinkModel.value.bSimRef.id) as
| AxleCounting
| Turnout;
bSimRef.value = g.datas.code;
}
if (sectionLinkModel.value.aRef) {
const g = drawStore
.getDrawApp()
.queryStore.queryById(sectionLinkModel.value.aRef.id) as
| SectionLink
| Turnout;
aRef.value =
g.datas.code + '_' + portList[sectionLinkModel.value.aRef.devicePort];
}
if (sectionLinkModel.value.bRef) {
const g = drawStore
.getDrawApp()
.queryStore.queryById(sectionLinkModel.value.bRef.id) as
| SectionLink
| Turnout;
bRef.value =
g.datas.code + '_' + portList[sectionLinkModel.value.bRef.devicePort];
}
}
});

View File

@ -39,11 +39,35 @@ export class SectionLinkData
(p) => new graphicData.Point({ x: p.x, y: p.y })
);
}
get refDevice(): string {
return this.data.refDevice;
get up(): boolean {
return this.data.up;
}
set refDevice(v: string) {
this.data.refDevice = v;
set up(v: boolean) {
this.data.up = v;
}
get aSimRef(): graphicData.SimpleRef {
return this.data.aSimRef;
}
set aSimRef(v: graphicData.SimpleRef) {
this.data.aSimRef = v;
}
get bSimRef(): graphicData.SimpleRef {
return this.data.bSimRef;
}
set bSimRef(v: graphicData.SimpleRef) {
this.data.bSimRef = v;
}
get aRef(): graphicData.RelatedRef {
return this.data.aRef;
}
set aRef(v: graphicData.RelatedRef) {
this.data.aRef = v;
}
get bRef(): graphicData.RelatedRef {
return this.data.bRef;
}
set bRef(v: graphicData.RelatedRef) {
this.data.bRef = v;
}
clone(): SectionLinkData {

View File

@ -446,9 +446,9 @@ export async function loadDrawDatas(app: GraphicApp) {
storage.axleCountingSections.forEach((axleCountingSection) => {
datas.push(new AxleCountingSectionData(axleCountingSection));
});
storage.logicSections.forEach((logicSection) => {
datas.push(new LogicSectionData(logicSection));
});
// storage.logicSections.forEach((logicSection) => {
// datas.push(new LogicSectionData(logicSection));
// });
await app.loadGraphic(datas);
} else {
app.loadGraphic([]);

View File

@ -114,3 +114,8 @@ export interface IRelatedRefData {
id: string; //关联的设备ID
devicePort: graphicData.RelatedRef.DevicePort; //关联的设备端口
}
export interface ISimpleRefData {
deviceType: graphicData.SimpleRef.DeviceType;
id: string;
}

View File

@ -9,14 +9,23 @@ import {
movePointAlongNormal,
} from 'src/jl-graphic';
import { ILineGraphic } from 'src/jl-graphic/plugins/GraphicEditPlugin';
import { IRelatedRefData, ISimpleRefData } from '../CommonGraphics';
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);
get up(): boolean;
set up(v: boolean);
get aSimRef(): ISimpleRefData;
set aSimRef(v: ISimpleRefData);
get bSimRef(): ISimpleRefData;
set bSimRef(v: ISimpleRefData);
get aRef(): IRelatedRefData;
set aRef(v: IRelatedRefData);
get bRef(): IRelatedRefData;
set bRef(v: IRelatedRefData);
clone(): ISectionLinkData;
copyFrom(data: ISectionLinkData): void;
eq(other: ISectionLinkData): boolean;

View File

@ -25,6 +25,7 @@ import { Section } from '../section/Section';
import { Turnout } from '../turnout/Turnout';
import { AxleCounting } from '../axleCounting/AxleCounting';
import { IRelatedRefData } from '../CommonGraphics';
import { graphicData } from 'src/protos/stationLayoutGraphics';
export class SectionLinkDraw extends GraphicDrawAssistant<
SectionLinkTemplate,
@ -59,15 +60,18 @@ export class SectionLinkDraw extends GraphicDrawAssistant<
}
});
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;
}
generateBySection(section: Section) {
generateBySection(
section: Section,
refData: IRelatedRefData,
axle1: AxleCounting,
axle2: AxleCounting
): SectionLink {
const sectionLink = new SectionLink();
sectionLink.loadData(this.graphicTemplate.datas);
sectionLink.id = GraphicIdGenerator.next();
@ -76,14 +80,57 @@ export class SectionLinkDraw extends GraphicDrawAssistant<
points.push(section.localToCanvasPoint(p));
});
sectionLink.datas.points = points;
const DeviceType = graphicData.SimpleRef.DeviceType;
const refAxle1 = this.buildSimpleRef(axle1.id, DeviceType.AxleCounting);
const refAxle2 = this.buildSimpleRef(axle2.id, DeviceType.AxleCounting);
/**
* link AB端 A端一定在左侧AB端是否倒序
*/
if (points[0].x > points[points.length - 1].x) {
if (refData.devicePort === 0) {
sectionLink.datas.aSimRef = refAxle2;
sectionLink.datas.bSimRef = refAxle1;
} else {
sectionLink.datas.aSimRef = refAxle1;
sectionLink.datas.bSimRef = refAxle2;
}
} else if (points[0].x < points[points.length - 1].x) {
if (refData.devicePort === 0) {
sectionLink.datas.aSimRef = refAxle1;
sectionLink.datas.bSimRef = refAxle2;
} else {
sectionLink.datas.aSimRef = refAxle2;
sectionLink.datas.bSimRef = refAxle1;
}
} else {
throw new Error('无法判断linkAB端');
}
this.storeGraphic(sectionLink);
return sectionLink;
}
generateByTurnoutAxle(turnout: Turnout, port: number) {
generateByTurnoutAxle(
turnout: Turnout,
port: graphicData.RelatedRef.DevicePort,
axle: AxleCounting
): SectionLink {
const sectionLink = new SectionLink();
sectionLink.loadData(this.graphicTemplate.datas);
sectionLink.id = GraphicIdGenerator.next();
const forkP = new Point(turnout.position.x, turnout.position.y);
const points: IPointData[] = [forkP];
const refTurnout = this.buildRelatedRef(
turnout.id,
graphicData.RelatedRef.DeviceType.Turnout,
port
);
const refSimTurnout = this.buildSimpleRef(
turnout.id,
graphicData.SimpleRef.DeviceType.Turnout
);
const refAxle = this.buildSimpleRef(
axle.id,
graphicData.SimpleRef.DeviceType.AxleCounting
);
if (port === 0) {
turnout.datas.pointA.forEach((p) => {
points.push(turnout.localToCanvasPoint(p));
@ -97,10 +144,26 @@ export class SectionLinkDraw extends GraphicDrawAssistant<
points.push(turnout.localToCanvasPoint(p));
});
}
if (points[0].x > points[points.length - 1].x) {
sectionLink.datas.aSimRef = refAxle;
sectionLink.datas.bSimRef = refSimTurnout;
sectionLink.datas.bRef = refTurnout;
} else if (points[0].x < points[points.length - 1].x) {
sectionLink.datas.bSimRef = refAxle;
sectionLink.datas.aSimRef = refSimTurnout;
sectionLink.datas.aRef = refTurnout;
} else {
throw new Error('无法判断linkAB端');
}
sectionLink.datas.points = points;
this.storeGraphic(sectionLink);
return sectionLink;
}
generateByTurnout(turnout: Turnout, port: number, pRef: IRelatedRefData) {
generateByTurnout(
turnout: Turnout,
port: graphicData.RelatedRef.DevicePort,
pRef: IRelatedRefData
) {
const refg = this.app.queryStore.queryById(pRef.id) as Turnout;
const sectionLink = new SectionLink();
sectionLink.loadData(this.graphicTemplate.datas);
@ -108,6 +171,37 @@ export class SectionLinkDraw extends GraphicDrawAssistant<
const forkP1 = new Point(refg.position.x, refg.position.y);
const forkP2 = new Point(turnout.position.x, turnout.position.y);
const points: IPointData[] = [forkP1];
const refTurnout1 = this.buildRelatedRef(
turnout.id,
graphicData.RelatedRef.DeviceType.Turnout,
port
);
const refTurnout2 = this.buildRelatedRef(
pRef.id,
graphicData.RelatedRef.DeviceType.Turnout,
pRef.devicePort
);
const refSimT1 = this.buildSimpleRef(
turnout.id,
graphicData.SimpleRef.DeviceType.Turnout
);
const refSimT2 = this.buildSimpleRef(
pRef.id,
graphicData.SimpleRef.DeviceType.Turnout
);
if (forkP1.x > forkP2.x) {
sectionLink.datas.aSimRef = refSimT2;
sectionLink.datas.bSimRef = refSimT1;
sectionLink.datas.aRef = refTurnout2;
sectionLink.datas.bRef = refTurnout1;
} else if (forkP1.x < forkP2.x) {
sectionLink.datas.aSimRef = refSimT1;
sectionLink.datas.bSimRef = refSimT2;
sectionLink.datas.aRef = refTurnout1;
sectionLink.datas.bRef = refTurnout2;
} else {
throw new Error('无法判断linkAB端');
}
if (pRef.devicePort === 0) {
refg.datas.pointA.forEach((p) => {
points.push(refg.localToCanvasPoint(p));
@ -137,28 +231,154 @@ export class SectionLinkDraw extends GraphicDrawAssistant<
sectionLink.datas.points = points;
this.storeGraphic(sectionLink);
}
/**
* link关系link关联关系提供数据依据
* @param map
* @param axleId
* @param linkId
*/
cacheAxleLinkRelation(
map: Map<string, string[]>,
axleId: string,
linkId: string
) {
const list = map.get(axleId);
if (list) {
list.push(linkId);
map.set(axleId, list);
} else {
map.set(axleId, [linkId]);
}
}
/**
*
* @param id
* @param deviceType
* @returns
*/
buildSimpleRef(id: string, deviceType: graphicData.SimpleRef.DeviceType) {
return new graphicData.SimpleRef({ deviceType, id });
}
/**
*
* @param id
* @param deviceType
* @param devicePort
* @returns
*/
buildRelatedRef(
id: string,
deviceType: graphicData.RelatedRef.DeviceType,
devicePort: graphicData.RelatedRef.DevicePort
): IRelatedRefData {
return new graphicData.RelatedRef({ id, deviceType, devicePort });
}
/**构建link之间的关联关系 */
buildLinkRef(map: Map<string, string[]>) {
const DeviceType = graphicData.RelatedRef.DeviceType;
const DevicePort = graphicData.RelatedRef.DevicePort;
map.forEach((value) => {
if (value.length === 2) {
const link1 = this.app.queryStore.queryById(value[0]) as SectionLink;
const link2 = this.app.queryStore.queryById(value[1]) as SectionLink;
if (link1.datas.aSimRef.id === link2.datas.bSimRef.id) {
link1.datas.aRef = this.buildRelatedRef(
link2.id,
DeviceType.SectionLink,
DevicePort.B
);
link2.datas.bRef = this.buildRelatedRef(
link1.id,
DeviceType.SectionLink,
DevicePort.A
);
} else if (link1.datas.bSimRef.id === link2.datas.aSimRef.id) {
link1.datas.bRef = this.buildRelatedRef(
link2.id,
DeviceType.SectionLink,
DevicePort.A
);
link2.datas.aRef = this.buildRelatedRef(
link1.id,
DeviceType.SectionLink,
DevicePort.B
);
} else if (link1.datas.aSimRef.id === link2.datas.aSimRef.id) {
link1.datas.aRef = this.buildRelatedRef(
link2.id,
DeviceType.SectionLink,
DevicePort.A
);
link2.datas.aRef = this.buildRelatedRef(
link1.id,
DeviceType.SectionLink,
DevicePort.A
);
} else if (link1.datas.bSimRef.id === link2.datas.bSimRef.id) {
link1.datas.bRef = this.buildRelatedRef(
link2.id,
DeviceType.SectionLink,
DevicePort.B
);
link2.datas.bRef = this.buildRelatedRef(
link1.id,
DeviceType.SectionLink,
DevicePort.B
);
} else {
throw new Error('构建link关联关系错误');
}
}
});
}
// cacheTurnoutPort(map: Map<string, string[]>, device) {
// const pList = map.get(deviceId);
// if (pList) {
// pList.push(device.devicePort);
// generated.set(g.id, pList);
// } else {
// generated.set(g.id, [device.devicePort]);
// }
// }
/**
* link
*/
oneGenerates() {
const axleCountingList = this.app.queryStore.queryByType<AxleCounting>(
AxleCounting.Type
);
const turnoutList = this.app.queryStore.queryByType<Turnout>(Turnout.Type);
const generated = new Map();
const axleRefLink: Map<string, string[]> = new Map();
axleCountingList.forEach((axleCounting) => {
axleCounting.datas.axleCountingRef.forEach((device) => {
const g = this.app.queryStore.queryById(device.id);
if (g.type === Section.Type && !generated.get(device.id)) {
const g1 = axleCountingList.find((axleCounting) => {
const s = axleCounting.datas.axleCountingRef.find(
(ref) => ref.id === device.id
const axle1 = axleCountingList.find((axleCountingNew) => {
const s = axleCountingNew.datas.axleCountingRef.find(
(ref) =>
ref.id === device.id && axleCountingNew.id !== axleCounting.id
);
return s;
});
if (g1) {
this.generateBySection(g as Section);
if (axle1) {
const link = this.generateBySection(
g as Section,
device,
axleCounting,
axle1
);
generated.set(g.id, ['A', 'B']);
this.cacheAxleLinkRelation(axleRefLink, axleCounting.id, link.id);
this.cacheAxleLinkRelation(axleRefLink, axle1.id, link.id);
}
} else if (g.type === Turnout.Type) {
this.generateByTurnoutAxle(g as Turnout, device.devicePort);
const link = this.generateByTurnoutAxle(
g as Turnout,
device.devicePort,
axleCounting
);
this.cacheAxleLinkRelation(axleRefLink, axleCounting.id, link.id);
if (generated.get(g.id)) {
const pList = generated.get(g.id);
pList.push(device.devicePort);
@ -210,7 +430,9 @@ export class SectionLinkDraw extends GraphicDrawAssistant<
}
}
});
this.buildLinkRef(axleRefLink);
}
clearCache(): void {
this.points = [];
this.graphic.clear();

View File

@ -509,4 +509,253 @@ export namespace state {
return TrainState.deserialize(bytes);
}
}
export class VariationStatus extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
updatedTrain?: TrainState[];
removedTrainId?: string[];
updatedSwitch?: SwitchState[];
updatedSection?: SectionState[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("updatedTrain" in data && data.updatedTrain != undefined) {
this.updatedTrain = data.updatedTrain;
}
if ("removedTrainId" in data && data.removedTrainId != undefined) {
this.removedTrainId = data.removedTrainId;
}
if ("updatedSwitch" in data && data.updatedSwitch != undefined) {
this.updatedSwitch = data.updatedSwitch;
}
if ("updatedSection" in data && data.updatedSection != undefined) {
this.updatedSection = data.updatedSection;
}
}
}
get updatedTrain() {
return pb_1.Message.getRepeatedWrapperField(this, TrainState, 1) as TrainState[];
}
set updatedTrain(value: TrainState[]) {
pb_1.Message.setRepeatedWrapperField(this, 1, value);
}
get removedTrainId() {
return pb_1.Message.getFieldWithDefault(this, 2, []) as string[];
}
set removedTrainId(value: string[]) {
pb_1.Message.setField(this, 2, value);
}
get updatedSwitch() {
return pb_1.Message.getRepeatedWrapperField(this, SwitchState, 3) as SwitchState[];
}
set updatedSwitch(value: SwitchState[]) {
pb_1.Message.setRepeatedWrapperField(this, 3, value);
}
get updatedSection() {
return pb_1.Message.getRepeatedWrapperField(this, SectionState, 4) as SectionState[];
}
set updatedSection(value: SectionState[]) {
pb_1.Message.setRepeatedWrapperField(this, 4, value);
}
static fromObject(data: {
updatedTrain?: ReturnType<typeof TrainState.prototype.toObject>[];
removedTrainId?: string[];
updatedSwitch?: ReturnType<typeof SwitchState.prototype.toObject>[];
updatedSection?: ReturnType<typeof SectionState.prototype.toObject>[];
}): VariationStatus {
const message = new VariationStatus({});
if (data.updatedTrain != null) {
message.updatedTrain = data.updatedTrain.map(item => TrainState.fromObject(item));
}
if (data.removedTrainId != null) {
message.removedTrainId = data.removedTrainId;
}
if (data.updatedSwitch != null) {
message.updatedSwitch = data.updatedSwitch.map(item => SwitchState.fromObject(item));
}
if (data.updatedSection != null) {
message.updatedSection = data.updatedSection.map(item => SectionState.fromObject(item));
}
return message;
}
toObject() {
const data: {
updatedTrain?: ReturnType<typeof TrainState.prototype.toObject>[];
removedTrainId?: string[];
updatedSwitch?: ReturnType<typeof SwitchState.prototype.toObject>[];
updatedSection?: ReturnType<typeof SectionState.prototype.toObject>[];
} = {};
if (this.updatedTrain != null) {
data.updatedTrain = this.updatedTrain.map((item: TrainState) => item.toObject());
}
if (this.removedTrainId != null) {
data.removedTrainId = this.removedTrainId;
}
if (this.updatedSwitch != null) {
data.updatedSwitch = this.updatedSwitch.map((item: SwitchState) => item.toObject());
}
if (this.updatedSection != null) {
data.updatedSection = this.updatedSection.map((item: SectionState) => 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.updatedTrain.length)
writer.writeRepeatedMessage(1, this.updatedTrain, (item: TrainState) => item.serialize(writer));
if (this.removedTrainId.length)
writer.writeRepeatedString(2, this.removedTrainId);
if (this.updatedSwitch.length)
writer.writeRepeatedMessage(3, this.updatedSwitch, (item: SwitchState) => item.serialize(writer));
if (this.updatedSection.length)
writer.writeRepeatedMessage(4, this.updatedSection, (item: SectionState) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): VariationStatus {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new VariationStatus();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.updatedTrain, () => pb_1.Message.addToRepeatedWrapperField(message, 1, TrainState.deserialize(reader), TrainState));
break;
case 2:
pb_1.Message.addToRepeatedField(message, 2, reader.readString());
break;
case 3:
reader.readMessage(message.updatedSwitch, () => pb_1.Message.addToRepeatedWrapperField(message, 3, SwitchState.deserialize(reader), SwitchState));
break;
case 4:
reader.readMessage(message.updatedSection, () => pb_1.Message.addToRepeatedWrapperField(message, 4, SectionState.deserialize(reader), SectionState));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): VariationStatus {
return VariationStatus.deserialize(bytes);
}
}
export class AllDevicesStatus extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
trainState?: TrainState[];
switchState?: SwitchState[];
sectionState?: SectionState[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("trainState" in data && data.trainState != undefined) {
this.trainState = data.trainState;
}
if ("switchState" in data && data.switchState != undefined) {
this.switchState = data.switchState;
}
if ("sectionState" in data && data.sectionState != undefined) {
this.sectionState = data.sectionState;
}
}
}
get trainState() {
return pb_1.Message.getRepeatedWrapperField(this, TrainState, 1) as TrainState[];
}
set trainState(value: TrainState[]) {
pb_1.Message.setRepeatedWrapperField(this, 1, value);
}
get switchState() {
return pb_1.Message.getRepeatedWrapperField(this, SwitchState, 2) as SwitchState[];
}
set switchState(value: SwitchState[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
get sectionState() {
return pb_1.Message.getRepeatedWrapperField(this, SectionState, 3) as SectionState[];
}
set sectionState(value: SectionState[]) {
pb_1.Message.setRepeatedWrapperField(this, 3, value);
}
static fromObject(data: {
trainState?: ReturnType<typeof TrainState.prototype.toObject>[];
switchState?: ReturnType<typeof SwitchState.prototype.toObject>[];
sectionState?: ReturnType<typeof SectionState.prototype.toObject>[];
}): AllDevicesStatus {
const message = new AllDevicesStatus({});
if (data.trainState != null) {
message.trainState = data.trainState.map(item => TrainState.fromObject(item));
}
if (data.switchState != null) {
message.switchState = data.switchState.map(item => SwitchState.fromObject(item));
}
if (data.sectionState != null) {
message.sectionState = data.sectionState.map(item => SectionState.fromObject(item));
}
return message;
}
toObject() {
const data: {
trainState?: ReturnType<typeof TrainState.prototype.toObject>[];
switchState?: ReturnType<typeof SwitchState.prototype.toObject>[];
sectionState?: ReturnType<typeof SectionState.prototype.toObject>[];
} = {};
if (this.trainState != null) {
data.trainState = this.trainState.map((item: TrainState) => item.toObject());
}
if (this.switchState != null) {
data.switchState = this.switchState.map((item: SwitchState) => item.toObject());
}
if (this.sectionState != null) {
data.sectionState = this.sectionState.map((item: SectionState) => 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.trainState.length)
writer.writeRepeatedMessage(1, this.trainState, (item: TrainState) => item.serialize(writer));
if (this.switchState.length)
writer.writeRepeatedMessage(2, this.switchState, (item: SwitchState) => item.serialize(writer));
if (this.sectionState.length)
writer.writeRepeatedMessage(3, this.sectionState, (item: SectionState) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): AllDevicesStatus {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new AllDevicesStatus();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.trainState, () => pb_1.Message.addToRepeatedWrapperField(message, 1, TrainState.deserialize(reader), TrainState));
break;
case 2:
reader.readMessage(message.switchState, () => pb_1.Message.addToRepeatedWrapperField(message, 2, SwitchState.deserialize(reader), SwitchState));
break;
case 3:
reader.readMessage(message.sectionState, () => pb_1.Message.addToRepeatedWrapperField(message, 3, SectionState.deserialize(reader), SectionState));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): AllDevicesStatus {
return AllDevicesStatus.deserialize(bytes);
}
}
}

View File

@ -24,7 +24,7 @@ export namespace graphicData {
separators?: Separator[];
sectionLinks?: SectionLink[];
axleCountingSections?: AxleCountingSection[];
logicSections?: AxleCountingSection[];
logicSections?: LogicSection[];
}) {
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], this.#one_of_decls);
@ -182,9 +182,9 @@ export namespace graphicData {
pb_1.Message.setRepeatedWrapperField(this, 16, value);
}
get logicSections() {
return pb_1.Message.getRepeatedWrapperField(this, AxleCountingSection, 17) as AxleCountingSection[];
return pb_1.Message.getRepeatedWrapperField(this, LogicSection, 17) as LogicSection[];
}
set logicSections(value: AxleCountingSection[]) {
set logicSections(value: LogicSection[]) {
pb_1.Message.setRepeatedWrapperField(this, 17, value);
}
static fromObject(data: {
@ -204,7 +204,7 @@ export namespace graphicData {
separators?: ReturnType<typeof Separator.prototype.toObject>[];
sectionLinks?: ReturnType<typeof SectionLink.prototype.toObject>[];
axleCountingSections?: ReturnType<typeof AxleCountingSection.prototype.toObject>[];
logicSections?: ReturnType<typeof AxleCountingSection.prototype.toObject>[];
logicSections?: ReturnType<typeof LogicSection.prototype.toObject>[];
}): RtssGraphicStorage {
const message = new RtssGraphicStorage({});
if (data.canvas != null) {
@ -256,7 +256,7 @@ export namespace graphicData {
message.axleCountingSections = data.axleCountingSections.map(item => AxleCountingSection.fromObject(item));
}
if (data.logicSections != null) {
message.logicSections = data.logicSections.map(item => AxleCountingSection.fromObject(item));
message.logicSections = data.logicSections.map(item => LogicSection.fromObject(item));
}
return message;
}
@ -278,7 +278,7 @@ export namespace graphicData {
separators?: ReturnType<typeof Separator.prototype.toObject>[];
sectionLinks?: ReturnType<typeof SectionLink.prototype.toObject>[];
axleCountingSections?: ReturnType<typeof AxleCountingSection.prototype.toObject>[];
logicSections?: ReturnType<typeof AxleCountingSection.prototype.toObject>[];
logicSections?: ReturnType<typeof LogicSection.prototype.toObject>[];
} = {};
if (this.canvas != null) {
data.canvas = this.canvas.toObject();
@ -329,7 +329,7 @@ export namespace graphicData {
data.axleCountingSections = this.axleCountingSections.map((item: AxleCountingSection) => item.toObject());
}
if (this.logicSections != null) {
data.logicSections = this.logicSections.map((item: AxleCountingSection) => item.toObject());
data.logicSections = this.logicSections.map((item: LogicSection) => item.toObject());
}
return data;
}
@ -370,7 +370,7 @@ export namespace graphicData {
if (this.axleCountingSections.length)
writer.writeRepeatedMessage(16, this.axleCountingSections, (item: AxleCountingSection) => item.serialize(writer));
if (this.logicSections.length)
writer.writeRepeatedMessage(17, this.logicSections, (item: AxleCountingSection) => item.serialize(writer));
writer.writeRepeatedMessage(17, this.logicSections, (item: LogicSection) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -429,7 +429,7 @@ export namespace graphicData {
reader.readMessage(message.axleCountingSections, () => pb_1.Message.addToRepeatedWrapperField(message, 16, AxleCountingSection.deserialize(reader), AxleCountingSection));
break;
case 17:
reader.readMessage(message.logicSections, () => pb_1.Message.addToRepeatedWrapperField(message, 17, AxleCountingSection.deserialize(reader), AxleCountingSection));
reader.readMessage(message.logicSections, () => pb_1.Message.addToRepeatedWrapperField(message, 17, LogicSection.deserialize(reader), LogicSection));
break;
default: reader.skipField();
}
@ -2080,6 +2080,7 @@ export namespace graphicData {
code?: string;
kilometerSystem?: KilometerSystem;
axleCountingRef?: RelatedRef[];
indexNumber?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4], this.#one_of_decls);
@ -2096,6 +2097,9 @@ export namespace graphicData {
if ("axleCountingRef" in data && data.axleCountingRef != undefined) {
this.axleCountingRef = data.axleCountingRef;
}
if ("indexNumber" in data && data.indexNumber != undefined) {
this.indexNumber = data.indexNumber;
}
}
}
get common() {
@ -2128,11 +2132,18 @@ export namespace graphicData {
set axleCountingRef(value: RelatedRef[]) {
pb_1.Message.setRepeatedWrapperField(this, 4, value);
}
get indexNumber() {
return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
}
set indexNumber(value: number) {
pb_1.Message.setField(this, 5, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
axleCountingRef?: ReturnType<typeof RelatedRef.prototype.toObject>[];
indexNumber?: number;
}): AxleCounting {
const message = new AxleCounting({});
if (data.common != null) {
@ -2147,6 +2158,9 @@ export namespace graphicData {
if (data.axleCountingRef != null) {
message.axleCountingRef = data.axleCountingRef.map(item => RelatedRef.fromObject(item));
}
if (data.indexNumber != null) {
message.indexNumber = data.indexNumber;
}
return message;
}
toObject() {
@ -2155,6 +2169,7 @@ export namespace graphicData {
code?: string;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
axleCountingRef?: ReturnType<typeof RelatedRef.prototype.toObject>[];
indexNumber?: number;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -2168,6 +2183,9 @@ export namespace graphicData {
if (this.axleCountingRef != null) {
data.axleCountingRef = this.axleCountingRef.map((item: RelatedRef) => item.toObject());
}
if (this.indexNumber != null) {
data.indexNumber = this.indexNumber;
}
return data;
}
serialize(): Uint8Array;
@ -2182,6 +2200,8 @@ export namespace graphicData {
writer.writeMessage(3, this.kilometerSystem, () => this.kilometerSystem.serialize(writer));
if (this.axleCountingRef.length)
writer.writeRepeatedMessage(4, this.axleCountingRef, (item: RelatedRef) => item.serialize(writer));
if (this.indexNumber != 0)
writer.writeInt32(5, this.indexNumber);
if (!w)
return writer.getResultBuffer();
}
@ -2203,6 +2223,9 @@ export namespace graphicData {
case 4:
reader.readMessage(message.axleCountingRef, () => pb_1.Message.addToRepeatedWrapperField(message, 4, RelatedRef.deserialize(reader), RelatedRef));
break;
case 5:
message.indexNumber = reader.readInt32();
break;
default: reader.skipField();
}
}
@ -2905,7 +2928,8 @@ export namespace graphicData {
paRef?: RelatedRef;
pbRef?: RelatedRef;
sectionType?: Section.SectionType;
children?: string[];
axleCountings?: string[];
index?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 7], this.#one_of_decls);
@ -2928,8 +2952,11 @@ export namespace graphicData {
if ("sectionType" in data && data.sectionType != undefined) {
this.sectionType = data.sectionType;
}
if ("children" in data && data.children != undefined) {
this.children = data.children;
if ("axleCountings" in data && data.axleCountings != undefined) {
this.axleCountings = data.axleCountings;
}
if ("index" in data && data.index != undefined) {
this.index = data.index;
}
}
}
@ -2978,12 +3005,18 @@ export namespace graphicData {
set sectionType(value: Section.SectionType) {
pb_1.Message.setField(this, 6, value);
}
get children() {
get axleCountings() {
return pb_1.Message.getFieldWithDefault(this, 7, []) as string[];
}
set children(value: string[]) {
set axleCountings(value: string[]) {
pb_1.Message.setField(this, 7, value);
}
get index() {
return pb_1.Message.getFieldWithDefault(this, 8, 0) as number;
}
set index(value: number) {
pb_1.Message.setField(this, 8, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
@ -2991,7 +3024,8 @@ export namespace graphicData {
paRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
pbRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
sectionType?: Section.SectionType;
children?: string[];
axleCountings?: string[];
index?: number;
}): Section {
const message = new Section({});
if (data.common != null) {
@ -3012,8 +3046,11 @@ export namespace graphicData {
if (data.sectionType != null) {
message.sectionType = data.sectionType;
}
if (data.children != null) {
message.children = data.children;
if (data.axleCountings != null) {
message.axleCountings = data.axleCountings;
}
if (data.index != null) {
message.index = data.index;
}
return message;
}
@ -3025,7 +3062,8 @@ export namespace graphicData {
paRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
pbRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
sectionType?: Section.SectionType;
children?: string[];
axleCountings?: string[];
index?: number;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -3045,8 +3083,11 @@ export namespace graphicData {
if (this.sectionType != null) {
data.sectionType = this.sectionType;
}
if (this.children != null) {
data.children = this.children;
if (this.axleCountings != null) {
data.axleCountings = this.axleCountings;
}
if (this.index != null) {
data.index = this.index;
}
return data;
}
@ -3066,8 +3107,10 @@ export namespace graphicData {
writer.writeMessage(5, this.pbRef, () => this.pbRef.serialize(writer));
if (this.sectionType != Section.SectionType.Physical)
writer.writeEnum(6, this.sectionType);
if (this.children.length)
writer.writeRepeatedString(7, this.children);
if (this.axleCountings.length)
writer.writeRepeatedString(7, this.axleCountings);
if (this.index != 0)
writer.writeInt32(8, this.index);
if (!w)
return writer.getResultBuffer();
}
@ -3098,6 +3141,9 @@ export namespace graphicData {
case 7:
pb_1.Message.addToRepeatedField(message, 7, reader.readString());
break;
case 8:
message.index = reader.readInt32();
break;
default: reader.skipField();
}
}
@ -3113,7 +3159,6 @@ export namespace graphicData {
export namespace Section {
export enum SectionType {
Physical = 0,
Logic = 1,
TurnoutPhysical = 2
}
}
@ -3351,7 +3396,8 @@ export namespace graphicData {
Section = 0,
Turnout = 1,
TrainWindow = 2,
AxleCounting = 3
AxleCounting = 3,
SectionLink = 4
}
export enum DevicePort {
A = 0,
@ -3359,6 +3405,96 @@ export namespace graphicData {
C = 2
}
}
export class TurnoutPosRef extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
id?: string;
position?: number;
}) {
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 ("position" in data && data.position != undefined) {
this.position = data.position;
}
}
}
get id() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set id(value: string) {
pb_1.Message.setField(this, 1, value);
}
get position() {
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
}
set position(value: number) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
id?: string;
position?: number;
}): TurnoutPosRef {
const message = new TurnoutPosRef({});
if (data.id != null) {
message.id = data.id;
}
if (data.position != null) {
message.position = data.position;
}
return message;
}
toObject() {
const data: {
id?: string;
position?: number;
} = {};
if (this.id != null) {
data.id = this.id;
}
if (this.position != null) {
data.position = this.position;
}
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.position != 0)
writer.writeInt32(2, this.position);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TurnoutPosRef {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TurnoutPosRef();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.id = reader.readString();
break;
case 2:
message.position = reader.readInt32();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): TurnoutPosRef {
return TurnoutPosRef.deserialize(bytes);
}
}
export class Separator extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
@ -3475,13 +3611,113 @@ export namespace graphicData {
return Separator.deserialize(bytes);
}
}
export class SimpleRef extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
deviceType?: SimpleRef.DeviceType;
id?: 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 ("deviceType" in data && data.deviceType != undefined) {
this.deviceType = data.deviceType;
}
if ("id" in data && data.id != undefined) {
this.id = data.id;
}
}
}
get deviceType() {
return pb_1.Message.getFieldWithDefault(this, 1, SimpleRef.DeviceType.Turnout) as SimpleRef.DeviceType;
}
set deviceType(value: SimpleRef.DeviceType) {
pb_1.Message.setField(this, 1, value);
}
get id() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set id(value: string) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
deviceType?: SimpleRef.DeviceType;
id?: string;
}): SimpleRef {
const message = new SimpleRef({});
if (data.deviceType != null) {
message.deviceType = data.deviceType;
}
if (data.id != null) {
message.id = data.id;
}
return message;
}
toObject() {
const data: {
deviceType?: SimpleRef.DeviceType;
id?: string;
} = {};
if (this.deviceType != null) {
data.deviceType = this.deviceType;
}
if (this.id != null) {
data.id = this.id;
}
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.deviceType != SimpleRef.DeviceType.Turnout)
writer.writeEnum(1, this.deviceType);
if (this.id.length)
writer.writeString(2, this.id);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SimpleRef {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SimpleRef();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.deviceType = reader.readEnum();
break;
case 2:
message.id = reader.readString();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): SimpleRef {
return SimpleRef.deserialize(bytes);
}
}
export namespace SimpleRef {
export enum DeviceType {
Turnout = 0,
AxleCounting = 1
}
}
export class SectionLink extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
common?: CommonInfo;
code?: string;
points?: Point[];
refDevice?: string;
up?: boolean;
aSimRef?: SimpleRef;
bSimRef?: SimpleRef;
aRef?: RelatedRef;
bRef?: RelatedRef;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls);
@ -3495,8 +3731,20 @@ export namespace graphicData {
if ("points" in data && data.points != undefined) {
this.points = data.points;
}
if ("refDevice" in data && data.refDevice != undefined) {
this.refDevice = data.refDevice;
if ("up" in data && data.up != undefined) {
this.up = data.up;
}
if ("aSimRef" in data && data.aSimRef != undefined) {
this.aSimRef = data.aSimRef;
}
if ("bSimRef" in data && data.bSimRef != undefined) {
this.bSimRef = data.bSimRef;
}
if ("aRef" in data && data.aRef != undefined) {
this.aRef = data.aRef;
}
if ("bRef" in data && data.bRef != undefined) {
this.bRef = data.bRef;
}
}
}
@ -3521,17 +3769,57 @@ export namespace graphicData {
set points(value: Point[]) {
pb_1.Message.setRepeatedWrapperField(this, 3, value);
}
get refDevice() {
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
get up() {
return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean;
}
set refDevice(value: string) {
set up(value: boolean) {
pb_1.Message.setField(this, 4, value);
}
get aSimRef() {
return pb_1.Message.getWrapperField(this, SimpleRef, 5) as SimpleRef;
}
set aSimRef(value: SimpleRef) {
pb_1.Message.setWrapperField(this, 5, value);
}
get has_aSimRef() {
return pb_1.Message.getField(this, 5) != null;
}
get bSimRef() {
return pb_1.Message.getWrapperField(this, SimpleRef, 6) as SimpleRef;
}
set bSimRef(value: SimpleRef) {
pb_1.Message.setWrapperField(this, 6, value);
}
get has_bSimRef() {
return pb_1.Message.getField(this, 6) != null;
}
get aRef() {
return pb_1.Message.getWrapperField(this, RelatedRef, 7) as RelatedRef;
}
set aRef(value: RelatedRef) {
pb_1.Message.setWrapperField(this, 7, value);
}
get has_aRef() {
return pb_1.Message.getField(this, 7) != null;
}
get bRef() {
return pb_1.Message.getWrapperField(this, RelatedRef, 8) as RelatedRef;
}
set bRef(value: RelatedRef) {
pb_1.Message.setWrapperField(this, 8, value);
}
get has_bRef() {
return pb_1.Message.getField(this, 8) != null;
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
points?: ReturnType<typeof Point.prototype.toObject>[];
refDevice?: string;
up?: boolean;
aSimRef?: ReturnType<typeof SimpleRef.prototype.toObject>;
bSimRef?: ReturnType<typeof SimpleRef.prototype.toObject>;
aRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
bRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
}): SectionLink {
const message = new SectionLink({});
if (data.common != null) {
@ -3543,8 +3831,20 @@ export namespace graphicData {
if (data.points != null) {
message.points = data.points.map(item => Point.fromObject(item));
}
if (data.refDevice != null) {
message.refDevice = data.refDevice;
if (data.up != null) {
message.up = data.up;
}
if (data.aSimRef != null) {
message.aSimRef = SimpleRef.fromObject(data.aSimRef);
}
if (data.bSimRef != null) {
message.bSimRef = SimpleRef.fromObject(data.bSimRef);
}
if (data.aRef != null) {
message.aRef = RelatedRef.fromObject(data.aRef);
}
if (data.bRef != null) {
message.bRef = RelatedRef.fromObject(data.bRef);
}
return message;
}
@ -3553,7 +3853,11 @@ export namespace graphicData {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
points?: ReturnType<typeof Point.prototype.toObject>[];
refDevice?: string;
up?: boolean;
aSimRef?: ReturnType<typeof SimpleRef.prototype.toObject>;
bSimRef?: ReturnType<typeof SimpleRef.prototype.toObject>;
aRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
bRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -3564,8 +3868,20 @@ export namespace graphicData {
if (this.points != null) {
data.points = this.points.map((item: Point) => item.toObject());
}
if (this.refDevice != null) {
data.refDevice = this.refDevice;
if (this.up != null) {
data.up = this.up;
}
if (this.aSimRef != null) {
data.aSimRef = this.aSimRef.toObject();
}
if (this.bSimRef != null) {
data.bSimRef = this.bSimRef.toObject();
}
if (this.aRef != null) {
data.aRef = this.aRef.toObject();
}
if (this.bRef != null) {
data.bRef = this.bRef.toObject();
}
return data;
}
@ -3579,8 +3895,16 @@ export namespace graphicData {
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 (this.up != false)
writer.writeBool(4, this.up);
if (this.has_aSimRef)
writer.writeMessage(5, this.aSimRef, () => this.aSimRef.serialize(writer));
if (this.has_bSimRef)
writer.writeMessage(6, this.bSimRef, () => this.bSimRef.serialize(writer));
if (this.has_aRef)
writer.writeMessage(7, this.aRef, () => this.aRef.serialize(writer));
if (this.has_bRef)
writer.writeMessage(8, this.bRef, () => this.bRef.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -3600,7 +3924,19 @@ export namespace graphicData {
reader.readMessage(message.points, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Point.deserialize(reader), Point));
break;
case 4:
message.refDevice = reader.readString();
message.up = reader.readBool();
break;
case 5:
reader.readMessage(message.aSimRef, () => message.aSimRef = SimpleRef.deserialize(reader));
break;
case 6:
reader.readMessage(message.bSimRef, () => message.bSimRef = SimpleRef.deserialize(reader));
break;
case 7:
reader.readMessage(message.aRef, () => message.aRef = RelatedRef.deserialize(reader));
break;
case 8:
reader.readMessage(message.bRef, () => message.bRef = RelatedRef.deserialize(reader));
break;
default: reader.skipField();
}
@ -3622,9 +3958,11 @@ export namespace graphicData {
points?: Point[];
paRef?: RelatedRef;
pbRef?: RelatedRef;
turnoutPos?: TurnoutPosRef[];
indexNumber?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 6], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("common" in data && data.common != undefined) {
this.common = data.common;
@ -3641,6 +3979,12 @@ export namespace graphicData {
if ("pbRef" in data && data.pbRef != undefined) {
this.pbRef = data.pbRef;
}
if ("turnoutPos" in data && data.turnoutPos != undefined) {
this.turnoutPos = data.turnoutPos;
}
if ("indexNumber" in data && data.indexNumber != undefined) {
this.indexNumber = data.indexNumber;
}
}
}
get common() {
@ -3682,12 +4026,26 @@ export namespace graphicData {
get has_pbRef() {
return pb_1.Message.getField(this, 5) != null;
}
get turnoutPos() {
return pb_1.Message.getRepeatedWrapperField(this, TurnoutPosRef, 6) as TurnoutPosRef[];
}
set turnoutPos(value: TurnoutPosRef[]) {
pb_1.Message.setRepeatedWrapperField(this, 6, value);
}
get indexNumber() {
return pb_1.Message.getFieldWithDefault(this, 7, 0) as number;
}
set indexNumber(value: number) {
pb_1.Message.setField(this, 7, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
points?: ReturnType<typeof Point.prototype.toObject>[];
paRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
pbRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
turnoutPos?: ReturnType<typeof TurnoutPosRef.prototype.toObject>[];
indexNumber?: number;
}): AxleCountingSection {
const message = new AxleCountingSection({});
if (data.common != null) {
@ -3705,6 +4063,12 @@ export namespace graphicData {
if (data.pbRef != null) {
message.pbRef = RelatedRef.fromObject(data.pbRef);
}
if (data.turnoutPos != null) {
message.turnoutPos = data.turnoutPos.map(item => TurnoutPosRef.fromObject(item));
}
if (data.indexNumber != null) {
message.indexNumber = data.indexNumber;
}
return message;
}
toObject() {
@ -3714,6 +4078,8 @@ export namespace graphicData {
points?: ReturnType<typeof Point.prototype.toObject>[];
paRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
pbRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
turnoutPos?: ReturnType<typeof TurnoutPosRef.prototype.toObject>[];
indexNumber?: number;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -3730,6 +4096,12 @@ export namespace graphicData {
if (this.pbRef != null) {
data.pbRef = this.pbRef.toObject();
}
if (this.turnoutPos != null) {
data.turnoutPos = this.turnoutPos.map((item: TurnoutPosRef) => item.toObject());
}
if (this.indexNumber != null) {
data.indexNumber = this.indexNumber;
}
return data;
}
serialize(): Uint8Array;
@ -3746,6 +4118,10 @@ export namespace graphicData {
writer.writeMessage(4, this.paRef, () => this.paRef.serialize(writer));
if (this.has_pbRef)
writer.writeMessage(5, this.pbRef, () => this.pbRef.serialize(writer));
if (this.turnoutPos.length)
writer.writeRepeatedMessage(6, this.turnoutPos, (item: TurnoutPosRef) => item.serialize(writer));
if (this.indexNumber != 0)
writer.writeInt32(7, this.indexNumber);
if (!w)
return writer.getResultBuffer();
}
@ -3770,6 +4146,12 @@ export namespace graphicData {
case 5:
reader.readMessage(message.pbRef, () => message.pbRef = RelatedRef.deserialize(reader));
break;
case 6:
reader.readMessage(message.turnoutPos, () => pb_1.Message.addToRepeatedWrapperField(message, 6, TurnoutPosRef.deserialize(reader), TurnoutPosRef));
break;
case 7:
message.indexNumber = reader.readInt32();
break;
default: reader.skipField();
}
}
@ -3782,4 +4164,166 @@ export namespace graphicData {
return AxleCountingSection.deserialize(bytes);
}
}
export class LogicSection extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
common?: CommonInfo;
code?: string;
points?: Point[];
axleSectionId?: string;
indexNumber?: number;
}) {
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 ("axleSectionId" in data && data.axleSectionId != undefined) {
this.axleSectionId = data.axleSectionId;
}
if ("indexNumber" in data && data.indexNumber != undefined) {
this.indexNumber = data.indexNumber;
}
}
}
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 axleSectionId() {
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
}
set axleSectionId(value: string) {
pb_1.Message.setField(this, 4, value);
}
get indexNumber() {
return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
}
set indexNumber(value: number) {
pb_1.Message.setField(this, 5, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
points?: ReturnType<typeof Point.prototype.toObject>[];
axleSectionId?: string;
indexNumber?: number;
}): LogicSection {
const message = new LogicSection({});
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.axleSectionId != null) {
message.axleSectionId = data.axleSectionId;
}
if (data.indexNumber != null) {
message.indexNumber = data.indexNumber;
}
return message;
}
toObject() {
const data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
points?: ReturnType<typeof Point.prototype.toObject>[];
axleSectionId?: string;
indexNumber?: number;
} = {};
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.axleSectionId != null) {
data.axleSectionId = this.axleSectionId;
}
if (this.indexNumber != null) {
data.indexNumber = this.indexNumber;
}
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.axleSectionId.length)
writer.writeString(4, this.axleSectionId);
if (this.indexNumber != 0)
writer.writeInt32(5, this.indexNumber);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): LogicSection {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new LogicSection();
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.axleSectionId = reader.readString();
break;
case 5:
message.indexNumber = reader.readInt32();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): LogicSection {
return LogicSection.deserialize(bytes);
}
}
}