物理区段

This commit is contained in:
Yuan 2023-07-12 11:23:22 +08:00
parent 658ab9efb1
commit fa599de542
12 changed files with 981 additions and 166 deletions

@ -1 +1 @@
Subproject commit f6f49ec19378c9a9845c53bd4425143f654ae59e
Subproject commit 2a1a7156c02ee902b1801f022ffd8aa6b763c66b

@ -1 +1 @@
Subproject commit a7debf165e24e6200d7c986555f31c721792af38
Subproject commit f89c8eb48de7b2e39a93c4aab9b4e5ff1a9e91b4

View File

@ -3,11 +3,35 @@
<q-input outlined readonly v-model="sectionModel.id" label="id" hint="" />
<q-input
outlined
readonly
v-model="sectionTypeText"
@blur="onUpdate"
label="区段类型"
/>
<q-input
outlined
class="q-mt-lg"
v-model="sectionModel.code"
@blur="onUpdate"
label="编号"
/>
<q-field class="q-mt-lg" outlined label="关联区段" readonly stack-label>
<q-input
outlined
class="q-mt-lg"
v-model.number="sectionModel.index"
@blur="onUpdate"
label="索引"
/>
<q-field
v-if="
sectionModel.sectionType === graphicData.Section.SectionType.Physical
"
class="q-mt-lg"
outlined
label="关联区段"
readonly
stack-label
>
<template #control>
<q-chip
color="primary"
@ -19,7 +43,16 @@
>
</template>
</q-field>
<q-field class="q-mt-lg" outlined label="关联道岔" readonly stack-label>
<q-field
v-if="
sectionModel.sectionType === graphicData.Section.SectionType.Physical
"
class="q-mt-lg"
outlined
label="关联道岔"
readonly
stack-label
>
<template #control>
<q-chip
color="primary"
@ -31,13 +64,37 @@
>
</template>
</q-field>
<q-field
v-if="
sectionModel.sectionType ===
graphicData.Section.SectionType.TurnoutPhysical
"
class="q-mt-lg"
outlined
label="计轴"
readonly
stack-label
>
<template #control>
<q-chip
color="primary"
text-color="white"
v-for="code in axleCountingRelations"
:key="code"
square
>{{ code }}</q-chip
>
</template>
</q-field>
</q-form>
</template>
<script setup lang="ts">
import { SectionData } from 'src/drawApp/graphics/SectionInteraction';
import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting';
import { Section } from 'src/graphics/section/Section';
import { Turnout } from 'src/graphics/turnout/Turnout';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { useDrawStore } from 'src/stores/draw-store';
import { computed, shallowRef, watchEffect } from 'vue';
@ -45,11 +102,15 @@ const drawStore = useDrawStore();
const sectionModel = shallowRef(new SectionData());
const sectionTypeText = computed(() => {
return ['物理区段', '', '道岔物理区段'][sectionModel.value.sectionType];
});
const sectionRelations = computed(() => {
const section = drawStore.selectedGraphic as Section;
const sectionRelations =
section?.relationManage.getRelationsOfGraphicAndOtherType(
section.relationManage.getRelationsOfGraphicAndOtherType(
section,
Section.Type
);
@ -65,7 +126,7 @@ const turnoutRelations = computed(() => {
const section = drawStore.selectedGraphic as Section;
const turnoutRelations =
section?.relationManage.getRelationsOfGraphicAndOtherType(
section.relationManage.getRelationsOfGraphicAndOtherType(
section,
Turnout.Type
);
@ -77,6 +138,20 @@ const turnoutRelations = computed(() => {
);
});
const axleCountingRelations = computed(() => {
const section = drawStore.selectedGraphic as Section;
const axleCountingRelations =
section.relationManage.getRelationsOfGraphicAndOtherType(
section,
AxleCounting.Type
);
console.log(section.relationManage.getRelationsOfGraphic(section));
return axleCountingRelations.map(
(relation) => relation.getOtherGraphic<AxleCounting>(section).datas.code
);
});
watchEffect(() => {
const section = drawStore.selectedGraphic;
if (section && section instanceof Section) {

View File

@ -25,6 +25,12 @@ export class SectionData extends GraphicDataBase implements ISectionData {
set code(v: string) {
this.data.code = v;
}
get index(): number {
return this.data.index;
}
set index(index: number) {
this.data.index = index;
}
get points(): IPointData[] {
return this.data.points;
}
@ -51,11 +57,11 @@ export class SectionData extends GraphicDataBase implements ISectionData {
set sectionType(type: graphicData.Section.SectionType) {
this.data.sectionType = type;
}
get children(): string[] {
return this.data.children;
get axleCountings(): string[] {
return this.data.axleCountings;
}
set children(children: string[]) {
this.data.children = children;
set axleCountings(axleCountings: string[]) {
this.data.axleCountings = axleCountings;
}
clone(): SectionData {
return new SectionData(this.data.cloneMessage());

View File

@ -17,6 +17,7 @@ import {
} from '../CommonGraphics';
import { Turnout } from '../turnout/Turnout';
import Vector2 from 'src/jl-graphic/math/Vector2';
import { AxleCounting } from '../axleCounting/AxleCounting';
export enum SectionType {
Physical = 0,
@ -40,8 +41,10 @@ export interface ISectionData extends GraphicData {
set pbRef(ref: IRelatedRefData | undefined);
get sectionType(): SectionType;
set sectionType(type: SectionType);
get children(): string[];
set children(children: string[]);
get axleCountings(): string[]; //计轴id列表
set axleCountings(axleCountings: string[]);
get index(): number; // 索引
set index(v: number);
clone(): ISectionData;
copyFrom(data: ISectionData): void;
eq(other: ISectionData): boolean;
@ -73,16 +76,15 @@ export class Section extends JlGraphic implements ILineGraphic {
}
doRepaint() {
if (this.datas.points.length < 2) {
if (
this.datas.sectionType === SectionType.Physical &&
this.datas.points.length < 2
) {
throw new Error('Link坐标数据异常');
}
this.lineGraphic.clear();
if (
(this.datas.sectionType === SectionType.Physical &&
this.datas.children.length === 0) /* 未拆分的物理区段 */ ||
this.datas.sectionType === SectionType.Logic /* 逻辑区段 */
) {
if (this.datas.sectionType === SectionType.Physical) {
this.lineGraphic.lineStyle(
SectionConsts.lineWidth,
SectionConsts.lineColor
@ -180,50 +182,52 @@ export class Section extends JlGraphic implements ILineGraphic {
buildRelation() {
this.relationManage.deleteRelationOfGraphicAndOtherType(this, Section.Type);
/** 区段与区段 */
this.queryStore.queryByType<Section>(Section.Type).forEach((section) => {
if (section.id === this.id) return;
let param: SectionPort[] = [];
if (
distance2(
this.localToCanvasPoint(this.getStartPoint()),
section.localToCanvasPoint(section.getStartPoint())
) <= epsilon
) {
param = [SectionPort.A, SectionPort.A];
}
if (
distance2(
this.localToCanvasPoint(this.getEndPoint()),
section.localToCanvasPoint(section.getStartPoint())
) <= epsilon
) {
param = [SectionPort.B, SectionPort.A];
}
if (
distance2(
this.localToCanvasPoint(this.getStartPoint()),
section.localToCanvasPoint(section.getEndPoint())
) <= epsilon
) {
param = [SectionPort.A, SectionPort.B];
}
if (
distance2(
this.localToCanvasPoint(this.getEndPoint()),
section.localToCanvasPoint(section.getEndPoint())
) <= epsilon
) {
param = [SectionPort.B, SectionPort.B];
}
if (param.length) {
this.relationManage.addRelation(
new GraphicRelationParam(this, param[0]),
new GraphicRelationParam(section, param[1])
);
}
});
if (this.datas.sectionType === SectionType.Physical) {
this.queryStore.queryByType<Section>(Section.Type).forEach((section) => {
if (section.id === this.id) return;
let param: SectionPort[] = [];
if (
distance2(
this.localToCanvasPoint(this.getStartPoint()),
section.localToCanvasPoint(section.getStartPoint())
) <= epsilon
) {
param = [SectionPort.A, SectionPort.A];
}
if (
distance2(
this.localToCanvasPoint(this.getEndPoint()),
section.localToCanvasPoint(section.getStartPoint())
) <= epsilon
) {
param = [SectionPort.B, SectionPort.A];
}
if (
distance2(
this.localToCanvasPoint(this.getStartPoint()),
section.localToCanvasPoint(section.getEndPoint())
) <= epsilon
) {
param = [SectionPort.A, SectionPort.B];
}
if (
distance2(
this.localToCanvasPoint(this.getEndPoint()),
section.localToCanvasPoint(section.getEndPoint())
) <= epsilon
) {
param = [SectionPort.B, SectionPort.B];
}
if (param.length) {
this.relationManage.addRelation(
new GraphicRelationParam(this, param[0]),
new GraphicRelationParam(section, param[1])
);
}
});
}
}
saveRelations() {
@ -284,6 +288,14 @@ export class Section extends JlGraphic implements ILineGraphic {
)
);
}
if (this.datas.axleCountings) {
this.datas.axleCountings.forEach((acId) => {
this.relationManage.addRelation(
this,
this.queryStore.queryById<AxleCounting>(acId)
);
});
}
}
}

View File

@ -10,6 +10,7 @@ import {
JlDrawApp,
JlGraphic,
VectorText,
calculateLineMidpoint,
linePoint,
} from 'src/jl-graphic';
import {
@ -43,10 +44,11 @@ import AbsorbablePoint, {
import { Turnout, TurnoutPort } from '../turnout/Turnout';
import { MenuItemOptions } from 'src/jl-graphic/ui/Menu';
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
import { Dialog } from 'quasar';
import { Dialog, date } from 'quasar';
import { SectionData } from 'src/drawApp/graphics/SectionInteraction';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import SectionSplitDialog from 'src/components/draw-app/dialogs/SectionSplitDialog.vue';
import { AxleCounting } from '../axleCounting/AxleCounting';
export class SectionDraw extends GraphicDrawAssistant<
SectionTemplate,
@ -124,6 +126,78 @@ export class SectionDraw extends GraphicDrawAssistant<
this.points = [];
this.graphic.clear();
}
generateTurnoutSection() {
const turnoutIds: string[] = []; /* 已遍历的道岔id列表 */
const dfs = (turnout: Turnout) => {
const axleCountings: AxleCounting[] = [];
const turnouts: Turnout[] = [];
if (turnoutIds.includes(turnout.datas.id)) return;
turnoutIds.push(turnout.datas.id);
turnouts.push(turnout);
Object.values(TurnoutPort).forEach((port) => {
const currentPortRelated = turnout.getGraphicOfPort(port);
if (
currentPortRelated.some((graphic) => graphic instanceof AxleCounting)
) {
const axleCounting = currentPortRelated.find(
(graphic) => graphic instanceof AxleCounting
) as AxleCounting;
axleCountings.push(axleCounting);
} else {
const nextTurnout = currentPortRelated.find(
(graphic) => graphic instanceof Turnout
) as Turnout;
const result = dfs(nextTurnout);
if (result?.axleCountings) {
axleCountings.push(...result.axleCountings);
turnouts.push(...result.turnouts);
}
}
});
return { axleCountings, turnouts };
};
this.app.queryStore
.queryByType<Turnout>(Turnout.Type)
.forEach((turnout) => {
const result = dfs(turnout);
if (!result || !result.axleCountings.length) {
return;
}
const turnoutPhysicalSectionData = new SectionData();
turnoutPhysicalSectionData.id = this.nextId();
turnoutPhysicalSectionData.sectionType =
graphicData.Section.SectionType.TurnoutPhysical;
turnoutPhysicalSectionData.points = result.axleCountings.map((ac) => {
return new Point(ac.position.x, ac.position.y);
});
turnoutPhysicalSectionData.axleCountings = result.axleCountings.map(
(ac) => ac.datas.id
);
turnoutPhysicalSectionData.code = result.turnouts
.map((t) => t.datas.code)
.join('-');
const labelPosition = calculateLineMidpoint(
result.turnouts[0].position,
result.turnouts[1].position
);
labelPosition.y += 20;
const labelTransform = GraphicTransform.default();
labelTransform.position = labelPosition;
turnoutPhysicalSectionData.childTransforms = [
new ChildTransform('label', labelTransform),
];
const g = this.graphicTemplate.new();
g.position.set(turnout.datas.pointC[0].x, turnout.datas.pointC[0].y);
g.loadData(turnoutPhysicalSectionData);
this.storeGraphic(g);
console.log(g);
g.loadRelations();
});
}
}
class SectionGraphicHitArea implements IHitArea {
@ -132,6 +206,9 @@ class SectionGraphicHitArea implements IHitArea {
this.section = section;
}
contains(x: number, y: number): boolean {
if (this.section.datas.sectionType === SectionType.TurnoutPhysical) {
return false;
}
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];
@ -345,8 +422,10 @@ export class SectionPointEditPlugin extends GraphicInteractionPlugin<Section> {
const target = e.target as DisplayObject;
const section = target.getGraphic() as Section;
this.app.updateSelected(section);
if (section.datas.sectionType === SectionType.TurnoutPhysical) {
return;
}
const p = section.screenToLocalPoint(e.global);
addWaypointConfig.handler = () => {
const linePoints = section.linePoints;
const { start, end } = getWaypointRangeIndex(
@ -360,89 +439,77 @@ export class SectionPointEditPlugin extends GraphicInteractionPlugin<Section> {
clearWaypointsConfig.handler = () => {
clearWayPoint(section, false);
};
if (
section.datas.children &&
section.datas.sectionType === SectionType.Physical
) {
splitSectionConfig.disabled = false;
splitSectionConfig.handler = () => {
Dialog.create({
title: '拆分区段',
message: '请选择生成数量和方向',
component: SectionSplitDialog,
cancel: true,
persistent: true,
}).onOk((data: { num: number; dir: 'ltr' | 'rtl' }) => {
const { num, dir } = data;
const sectionData = section.datas;
const points = section.getSplitPoints(num);
const children: Section[] = [];
let codeAppend = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.slice(0, num);
if (
(dir === 'ltr' &&
sectionData.points[0].x >
sectionData.points[sectionData.points.length - 1].x) ||
(dir === 'rtl' &&
sectionData.points[0].x <
sectionData.points[sectionData.points.length - 1].x)
) {
codeAppend = codeAppend.split('').reverse().join('');
}
points.forEach((ps, i) => {
const data = new SectionData();
data.id = this.drawAssistant.nextId();
data.code = `${sectionData.code}-${codeAppend.charAt(i % 26)}`;
data.sectionType = SectionType.Logic;
data.points = ps.map(
(p) => new graphicData.Point({ x: p.x, y: p.y })
);
data.id = this.drawAssistant.nextId();
data.childTransforms = [
new ChildTransform(
'label',
new GraphicTransform(
{
x:
data.points[0].x +
(data.points[1].x - data.points[0].x) / 2,
y:
data.points[0].y +
(data.points[1].y - data.points[0].y) / 2 +
20,
},
{ x: 0, y: 0 },
0,
{ x: 0, y: 0 }
)
),
];
const g = this.drawAssistant.graphicTemplate.new();
g.loadData(data);
this.drawAssistant.storeGraphic(g);
children.push(g);
});
sectionData.children = children.map((g) => g.datas.id);
section.repaint();
section.buildRelation();
section.draggable = false;
children.forEach((c) => c.buildRelation());
this.app.updateSelected(...children);
splitSectionConfig.disabled = false;
splitSectionConfig.handler = () => {
Dialog.create({
title: '拆分区段',
message: '请选择生成数量和方向',
component: SectionSplitDialog,
cancel: true,
persistent: true,
}).onOk((data: { num: number; dir: 'ltr' | 'rtl' }) => {
const { num, dir } = data;
const sectionData = section.datas;
const points = section.getSplitPoints(num);
const children: Section[] = [];
let codeAppend = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.slice(0, num);
if (
(dir === 'ltr' &&
sectionData.points[0].x >
sectionData.points[sectionData.points.length - 1].x) ||
(dir === 'rtl' &&
sectionData.points[0].x <
sectionData.points[sectionData.points.length - 1].x)
) {
codeAppend = codeAppend.split('').reverse().join('');
}
points.forEach((ps, i) => {
const data = new SectionData();
data.id = this.drawAssistant.nextId();
data.code = `${sectionData.code}-${codeAppend.charAt(i % 26)}`;
// data.sectionType = SectionType.Logic;
data.points = ps.map(
(p) => new graphicData.Point({ x: p.x, y: p.y })
);
data.id = this.drawAssistant.nextId();
data.childTransforms = [
new ChildTransform(
'label',
new GraphicTransform(
{
x:
data.points[0].x +
(data.points[1].x - data.points[0].x) / 2,
y:
data.points[0].y +
(data.points[1].y - data.points[0].y) / 2 +
20,
},
{ x: 0, y: 0 },
0,
{ x: 0, y: 0 }
)
),
];
const g = this.drawAssistant.graphicTemplate.new();
g.loadData(data);
this.drawAssistant.storeGraphic(g);
children.push(g);
});
};
} else {
splitSectionConfig.disabled = true;
}
// sectionData.children = children.map((g) => g.datas.id);
section.repaint();
section.buildRelation();
section.draggable = false;
children.forEach((c) => c.buildRelation());
this.app.updateSelected(...children);
});
};
SectionEditMenu.open(e.global);
}
onSelected(g: DisplayObject): void {
const section = g as Section;
if (
section.datas.children.length > 0 &&
section.datas.sectionType === SectionType.Physical
) {
if (section.datas.sectionType === SectionType.TurnoutPhysical) {
return;
}
let lep = section.getAssistantAppend<SectionPolylineEditPlugin>(

View File

@ -375,6 +375,18 @@ export class Turnout extends JlGraphic {
);
}
}
getGraphicOfPort(port: TurnoutPort) {
return this.relationManage
.getRelationsOfGraphic(this)
.filter(
(relation) =>
relation.getRelationParam(this).getParam<TurnoutPort>() === port
)
.map((relation) => {
return relation.getOtherGraphic(this);
});
}
}
export class TurnoutTemplate extends JlGraphicTemplate<Turnout> {

View File

@ -456,13 +456,13 @@ export class JlDrawApp extends GraphicApp {
*
*/
deleteSelectedGraphics() {
const deletes = this.selectedGraphics.slice(
0,
this.selectedGraphics.length
);
this.deleteGraphics(...this.selectedGraphics);
// 删除图形对象操作记录
this.opRecord.record(new GraphicDeleteOperation(this, deletes));
const deletes = this.deleteGraphics(...this.selectedGraphics);
if (deletes.length > 0) {
// 删除图形对象操作记录
this.opRecord.record(new GraphicDeleteOperation(this, deletes));
} else {
console.debug('没有删除元素,不记录');
}
}
updateCanvasAndRecord(data: ICanvasProperties) {

View File

@ -320,6 +320,11 @@ export interface IGraphicAppConfig {
* true
*/
cullable?: boolean;
/**
*
*/
isSupportDeletion?: (g: JlGraphic) => boolean;
}
/**
@ -729,8 +734,19 @@ export class GraphicApp extends EventEmitter<GraphicAppEvents> {
*
* @param graphics
*/
deleteGraphics(...graphics: JlGraphic[]) {
graphics.forEach((g) => this.doDeleteGraphics(g));
deleteGraphics(...graphics: JlGraphic[]): JlGraphic[] {
const dels = graphics.filter((g) => {
if (
this._options?.isSupportDeletion &&
this._options.isSupportDeletion(g)
) {
this.doDeleteGraphics(g);
return true;
}
console.debug(`type=${g.type},id=${g.id}的图形不支持删除`);
return false;
});
return dels;
}
/**

View File

@ -27,6 +27,9 @@
<q-item clickable v-close-popup @click="oneClickLink">
<q-item-section>一键生成Link</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="oneClickTurnoutSection">
<q-item-section>一键生成道岔区段</q-item-section>
</q-item>
<q-item
clickable
v-close-popup
@ -200,6 +203,8 @@ 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';
import { SectionDraw } from 'src/graphics/section/SectionDrawAssistant';
import { Section } from 'src/graphics/section/Section';
const route = useRoute();
const router = useRouter();
@ -353,10 +358,17 @@ function oneClickLink() {
drawStore.oneClickType = 'SectionLink';
const draw = drawStore
.getDrawApp()
.getDrawAssistant(SectionLink.Type) as SectionLinkDraw;
.getDrawAssistant<SectionLinkDraw>(SectionLink.Type);
draw.oneGenerates();
}
function oneClickTurnoutSection() {
const SDA = drawStore
.getDrawApp()
.getDrawAssistant<SectionDraw>(Section.Type);
SDA.generateTurnoutSection();
}
function backConfirm() {
router.go(-1);
}

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,9 +24,10 @@ export namespace graphicData {
separators?: Separator[];
sectionLinks?: SectionLink[];
axleCountingSections?: 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], 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, 17], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("canvas" in data && data.canvas != undefined) {
this.canvas = data.canvas;
@ -76,6 +77,9 @@ export namespace graphicData {
if ("axleCountingSections" in data && data.axleCountingSections != undefined) {
this.axleCountingSections = data.axleCountingSections;
}
if ("logicSections" in data && data.logicSections != undefined) {
this.logicSections = data.logicSections;
}
}
}
get canvas() {
@ -177,6 +181,12 @@ export namespace graphicData {
set axleCountingSections(value: AxleCountingSection[]) {
pb_1.Message.setRepeatedWrapperField(this, 16, value);
}
get logicSections() {
return pb_1.Message.getRepeatedWrapperField(this, LogicSection, 17) as LogicSection[];
}
set logicSections(value: LogicSection[]) {
pb_1.Message.setRepeatedWrapperField(this, 17, value);
}
static fromObject(data: {
canvas?: ReturnType<typeof Canvas.prototype.toObject>;
links?: ReturnType<typeof Link.prototype.toObject>[];
@ -194,6 +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 LogicSection.prototype.toObject>[];
}): RtssGraphicStorage {
const message = new RtssGraphicStorage({});
if (data.canvas != null) {
@ -244,6 +255,9 @@ export namespace graphicData {
if (data.axleCountingSections != null) {
message.axleCountingSections = data.axleCountingSections.map(item => AxleCountingSection.fromObject(item));
}
if (data.logicSections != null) {
message.logicSections = data.logicSections.map(item => LogicSection.fromObject(item));
}
return message;
}
toObject() {
@ -264,6 +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 LogicSection.prototype.toObject>[];
} = {};
if (this.canvas != null) {
data.canvas = this.canvas.toObject();
@ -313,6 +328,9 @@ export namespace graphicData {
if (this.axleCountingSections != null) {
data.axleCountingSections = this.axleCountingSections.map((item: AxleCountingSection) => item.toObject());
}
if (this.logicSections != null) {
data.logicSections = this.logicSections.map((item: LogicSection) => item.toObject());
}
return data;
}
serialize(): Uint8Array;
@ -351,6 +369,8 @@ export namespace graphicData {
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 (this.logicSections.length)
writer.writeRepeatedMessage(17, this.logicSections, (item: LogicSection) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -408,6 +428,9 @@ export namespace graphicData {
case 16:
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, LogicSection.deserialize(reader), LogicSection));
break;
default: reader.skipField();
}
}
@ -2057,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);
@ -2073,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() {
@ -2105,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) {
@ -2124,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() {
@ -2132,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();
@ -2145,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;
@ -2159,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();
}
@ -2180,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();
}
}
@ -2882,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);
@ -2905,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;
}
}
}
@ -2955,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;
@ -2968,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) {
@ -2989,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;
}
@ -3002,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();
@ -3022,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;
}
@ -3043,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();
}
@ -3075,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();
}
}
@ -3090,7 +3159,6 @@ export namespace graphicData {
export namespace Section {
export enum SectionType {
Physical = 0,
Logic = 1,
TurnoutPhysical = 2
}
}
@ -3336,6 +3404,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[] | {
@ -3599,9 +3757,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;
@ -3618,6 +3778,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() {
@ -3659,12 +3825,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) {
@ -3682,6 +3862,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() {
@ -3691,6 +3877,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();
@ -3707,6 +3895,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;
@ -3723,6 +3917,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();
}
@ -3747,6 +3945,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();
}
}
@ -3759,4 +3963,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);
}
}
}