diff --git a/src/components/draw-app/DrawProperties.vue b/src/components/draw-app/DrawProperties.vue
index 788d6ee..17fb7bb 100644
--- a/src/components/draw-app/DrawProperties.vue
+++ b/src/components/draw-app/DrawProperties.vue
@@ -77,6 +77,10 @@
drawStore.selectedGraphicType === AxleCountingSection.Type
"
>
+
+
@@ -104,6 +108,7 @@ import StationProperty from './properties/StationProperty.vue';
import TrainWindowProperty from './properties/TrainWindowProperty.vue';
import AxleCountingProperty from './properties/AxleCountingProperty.vue';
import AxleCountingSectionProperty from './properties/AxleCountingSectionProperty.vue';
+import LogicSectionProperty from './properties/LogicSectionProperty.vue';
import SignalProperty from './properties/SignalProperty.vue';
import TurnoutProperty from './properties/TurnoutProperty.vue';
import SectionProperty from './properties/SectionProperty.vue';
@@ -121,6 +126,7 @@ import { Section } from 'src/graphics/section/Section';
import { TrainWindow } from 'src/graphics/trainWindow/TrainWindow';
import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting';
import { AxleCountingSection } from 'src/graphics/axleCountingSection/AxleCountingSection';
+import { LogicSection } from 'src/graphics/logicSection/LogicSection';
import { Separator } from 'src/graphics/separator/Separator';
import { SectionLink } from 'src/graphics/sectionLink/SectionLink';
diff --git a/src/components/draw-app/properties/LogicSectionProperty.vue b/src/components/draw-app/properties/LogicSectionProperty.vue
new file mode 100644
index 0000000..93c9545
--- /dev/null
+++ b/src/components/draw-app/properties/LogicSectionProperty.vue
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+ 关联的计轴区段
+
+
+ {{ item }}
+
+
+
+
+
+
+
+
+
diff --git a/src/drawApp/graphics/LogicSectionInteraction.ts b/src/drawApp/graphics/LogicSectionInteraction.ts
index a800c88..a8bef9f 100644
--- a/src/drawApp/graphics/LogicSectionInteraction.ts
+++ b/src/drawApp/graphics/LogicSectionInteraction.ts
@@ -11,7 +11,7 @@ export class LogicSectionData
extends GraphicDataBase
implements ILogicSectionData
{
- constructor(data?: graphicData.AxleCountingSection) {
+ constructor(data?: graphicData.LogicSection) {
let logicSection;
if (!data) {
logicSection = new graphicData.AxleCountingSection({
@@ -22,8 +22,8 @@ export class LogicSectionData
}
super(logicSection);
}
- public get data(): graphicData.AxleCountingSection {
- return this.getData();
+ public get data(): graphicData.LogicSection {
+ return this.getData();
}
get code(): string {
return this.data.code;
@@ -39,17 +39,17 @@ export class LogicSectionData
(p) => new graphicData.Point({ x: p.x, y: p.y })
);
}
- get paRef(): graphicData.RelatedRef {
- return this.data.paRef;
+ get axleSectionId(): string {
+ return this.data.axleSectionId;
}
- set paRef(ref: graphicData.RelatedRef) {
- this.data.paRef = ref;
+ set axleSectionId(v: string) {
+ this.data.axleSectionId = v;
}
- get pbRef(): graphicData.RelatedRef {
- return this.data.pbRef;
+ get indexNumber(): number {
+ return this.data.indexNumber;
}
- set pbRef(ref: graphicData.RelatedRef) {
- this.data.pbRef = ref;
+ set indexNumber(v: number) {
+ this.data.indexNumber = v;
}
clone(): LogicSectionData {
return new LogicSectionData(this.data.cloneMessage());
diff --git a/src/graphics/logicSection/LogicSection.ts b/src/graphics/logicSection/LogicSection.ts
index 3e6ec3d..2001de4 100644
--- a/src/graphics/logicSection/LogicSection.ts
+++ b/src/graphics/logicSection/LogicSection.ts
@@ -6,18 +6,16 @@ import {
JlGraphicTemplate,
VectorText,
} from 'src/jl-graphic';
-import { IRelatedRefData, protoPort2Data } from '../CommonGraphics';
-import { SectionPort } from '../section/Section';
export interface ILogicSectionData extends GraphicData {
get code(): string; // 编号
set code(v: string);
get points(): IPointData[]; // 线坐标点
set points(points: IPointData[]);
- get paRef(): IRelatedRefData | undefined;
- set paRef(ref: IRelatedRefData | undefined);
- get pbRef(): IRelatedRefData | undefined;
- set pbRef(ref: IRelatedRefData | undefined);
+ get axleSectionId(): string; // 计轴区段ID
+ set axleSectionId(v: string);
+ get indexNumber(): number; // 索引编号
+ set indexNumber(v: number);
clone(): ILogicSectionData;
copyFrom(data: ILogicSectionData): void;
eq(other: ILogicSectionData): boolean;
@@ -87,23 +85,13 @@ export class LogicSection extends JlGraphic {
this.updateData(old);
}
loadRelations() {
- if (this.datas?.paRef?.id) {
- this.relationManage.addRelation(
- new GraphicRelationParam(this, SectionPort.A),
- new GraphicRelationParam(
- this.queryStore.queryById(this.datas.paRef.id),
- protoPort2Data(this.datas.paRef.devicePort)
- )
- );
- }
- if (this.datas?.pbRef?.id) {
- this.relationManage.addRelation(
- new GraphicRelationParam(this, SectionPort.B),
- new GraphicRelationParam(
- this.queryStore.queryById(this.datas.pbRef.id),
- protoPort2Data(this.datas.pbRef.devicePort)
- )
- );
+ if (this.datas?.axleSectionId) {
+ const axleSection = this.queryStore.queryById(this.datas.axleSectionId);
+ axleSection &&
+ this.relationManage.addRelation(
+ new GraphicRelationParam(this),
+ new GraphicRelationParam(axleSection)
+ );
}
}
}
diff --git a/src/graphics/logicSection/LogicSectionDrawAssistant.ts b/src/graphics/logicSection/LogicSectionDrawAssistant.ts
index d04d76f..489d767 100644
--- a/src/graphics/logicSection/LogicSectionDrawAssistant.ts
+++ b/src/graphics/logicSection/LogicSectionDrawAssistant.ts
@@ -1,7 +1,5 @@
-import { FederatedPointerEvent, IHitArea, IPointData, Point } from 'pixi.js';
+import { FederatedPointerEvent, IHitArea, Point } from 'pixi.js';
import {
- AbsorbableLine,
- AbsorbablePosition,
GraphicDrawAssistant,
GraphicIdGenerator,
GraphicInteractionPlugin,
@@ -16,28 +14,9 @@ import {
LogicSectionTemplate,
LogicSectionConsts,
} from './LogicSection';
-import { AxleCounting } from '../axleCounting/AxleCounting';
import { Turnout } from '../turnout/Turnout';
-import { createRelatedRefProto } from '../CommonGraphics';
-
-function hasCommonElements(arr1: string[], arr2: string[]) {
- for (let i = 0; i < arr1.length; i++) {
- if (arr2.includes(arr1[i])) {
- return arr1[i];
- }
- }
- return false;
-}
-
-function hasSamePosition(point1: IPointData, point2: IPointData): boolean {
- if (
- Math.abs(point1.x - point2.x) < 20 &&
- Math.abs(point1.y - point2.y) < 20
- ) {
- return true;
- }
- return false;
-}
+import { LogicSectionData } from 'src/drawApp/graphics/LogicSectionInteraction';
+import { AxleCountingSection } from '../axleCountingSection/AxleCountingSection';
export interface ILogicSectionDrawOptions {
newData: () => ILogicSectionData;
@@ -76,20 +55,10 @@ export class LogicSectionDraw extends GraphicDrawAssistant<
data.transform = this.container.saveTransform();
return true;
}
- draw(graphics: JlGraphic[], map: Map) {
- if (
- map.has(`${graphics[0].id}+${graphics[1].id}`) ||
- map.has(`${graphics[1].id}+${graphics[0].id}`)
- )
- return;
+ draw(data: ILogicSectionData) {
const logicSection = new LogicSection();
- logicSection.loadData(this.graphicTemplate.datas);
- logicSection.datas.points = [graphics[0].position, graphics[1].position];
+ logicSection.loadData(data);
logicSection.id = GraphicIdGenerator.next();
- const paRef = createRelatedRefProto(graphics[0].type, graphics[0].id);
- const pbRef = createRelatedRefProto(graphics[1].type, graphics[1].id);
- logicSection.datas.paRef = paRef;
- logicSection.datas.pbRef = pbRef;
this.storeGraphic(logicSection);
logicSection.loadRelations();
}
@@ -99,118 +68,38 @@ export class LogicSectionDraw extends GraphicDrawAssistant<
const logicSections = this.app.queryStore.queryByType(
LogicSection.Type
);
+ // this.app.deleteGraphics(...logicSections);
+ // return;
logicSections.forEach((logicSection) => {
- map.set(
- `${logicSection.datas.paRef?.id}+${logicSection.datas.pbRef?.id}`,
- 1
- );
+ map.set(`${logicSection.datas.axleSectionId}`, 1);
});
- const axleCountings = this.app.queryStore.queryByType(
- AxleCounting.Type
- );
- const hasfourTurnout: AxleCounting[][] = [];
- axleCountings.forEach((axleCounting) => {
- const refDeviceTarget = axleCounting.datas.axleCountingRef.map(
- (ref) => ref.id
+ const axleCountingSections =
+ this.app.queryStore.queryByType(
+ AxleCountingSection.Type
);
- for (let i = 0; i < axleCountings.length - 1; i++) {
- if (axleCountings[i].id == axleCounting.id) return;
- const refDevice = axleCountings[i].datas.axleCountingRef.map(
- (ref) => ref.id
- );
- const commonElementId = hasCommonElements(refDeviceTarget, refDevice);
- if (commonElementId) {
- const commonElement = this.app.queryStore.queryById(commonElementId);
- let draw = true;
- if (commonElement.type == 'Turnout') {
- let targetPort, port;
- axleCounting.datas.axleCountingRef.forEach((ref) => {
- if (ref.id == commonElementId) {
- targetPort = ref.devicePort;
- }
- });
- axleCountings[i].datas.axleCountingRef.forEach((ref) => {
- if (ref.id == commonElementId) {
- port = ref.devicePort;
- }
- });
- if (
- (targetPort == 1 && port == 2) ||
- (targetPort == 2 && port == 1)
- ) {
- draw = false;
- }
- }
- if (draw) {
- this.draw([axleCounting, axleCountings[i]], map);
- }
- }
- if (hasSamePosition(axleCounting, axleCountings[i])) {
- hasfourTurnout.push([axleCounting, axleCountings[i]]);
- }
+ axleCountingSections.forEach((axleCountingSection) => {
+ if (map.has(`${axleCountingSection.id}`)) {
+ return;
}
- });
- const fourAxleCounting: AxleCounting[] = [];
- hasfourTurnout.forEach((axleCountings) => {
- axleCountings.forEach((axleCounting) => {
- //计轴关联的道岔
- const axleCountingRelations =
- axleCounting.relationManage.getRelationsOfGraphicAndOtherType(
- axleCounting,
- Turnout.Type
- );
- axleCountingRelations.forEach((relation) => {
- const refTurnout = relation.getOtherGraphic(axleCounting);
- //道岔关联的计轴
- const turnoutRelations =
- refTurnout.relationManage.getRelationsOfGraphicAndOtherType(
- refTurnout,
- AxleCounting.Type
- );
- turnoutRelations.forEach((relation) => {
- const refAxleCounting =
- relation.getOtherGraphic(refTurnout);
- if (
- refAxleCounting.id !== axleCountings[0].id &&
- refAxleCounting.id !== axleCountings[1].id
- ) {
- fourAxleCounting.push(refAxleCounting);
- }
- });
+ const turnoutPosRef = axleCountingSection.datas.turnoutPosRef;
+ if (turnoutPosRef.length > 0) {
+ turnoutPosRef.forEach((turnout) => {
+ if (turnout.position == 1) {
+ const t = this.app.queryStore.queryById(turnout.id) as Turnout;
+ const data = new LogicSectionData();
+ data.points = [
+ t.position,
+ ...t.localToCanvasPoints(...t.datas.pointC),
+ ];
+ data.axleSectionId = axleCountingSection.id;
+ this.draw(data);
+ }
});
- });
- });
- for (let x = 0; x < fourAxleCounting.length; x += 4) {
- const AxleCountings = fourAxleCounting.slice(x, x + 4);
- for (let y = 0; y < 4; y++) {
- if (fourAxleCounting[x].id == AxleCountings[y].id) continue;
- if (fourAxleCounting[x].y == AxleCountings[y].y) {
- this.draw([fourAxleCounting[x], AxleCountings[y]], map);
- break;
- }
}
- for (let y = 0; y < 4; y++) {
- if (fourAxleCounting[x + 1].id == AxleCountings[y].id) continue;
- if (fourAxleCounting[x + 1].y == AxleCountings[y].y) {
- this.draw([fourAxleCounting[x + 1], AxleCountings[y]], map);
- break;
- }
- }
- }
- const turnouts = this.app.queryStore.queryByType(Turnout.Type);
- turnouts.forEach((turnout) => {
- const turnoutRelations =
- turnout.relationManage.getRelationsOfGraphicAndOtherType(
- turnout,
- AxleCounting.Type
- );
- turnoutRelations.forEach((ref) => {
- const t = ref.getRelationParam(turnout);
- const other = ref.getOtherGraphic(turnout) as AxleCounting;
- if (t.param == 'C') {
- this.draw([turnout, other], map);
- }
- });
+ const data = new LogicSectionData();
+ data.points = axleCountingSection.datas.points;
+ data.axleSectionId = axleCountingSection.id;
+ this.draw(data);
});
}
}
diff --git a/src/protos/device_state.ts b/src/protos/device_state.ts
index fa49ba8..6301baa 100644
--- a/src/protos/device_state.ts
+++ b/src/protos/device_state.ts
@@ -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[];
+ removedTrainId?: string[];
+ updatedSwitch?: ReturnType[];
+ updatedSection?: ReturnType[];
+ }): 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[];
+ removedTrainId?: string[];
+ updatedSwitch?: ReturnType[];
+ updatedSection?: ReturnType[];
+ } = {};
+ 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[];
+ switchState?: ReturnType[];
+ sectionState?: ReturnType[];
+ }): 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[];
+ switchState?: ReturnType[];
+ sectionState?: ReturnType[];
+ } = {};
+ 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);
+ }
+ }
}
diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts
index 3956e27..38b5dd2 100644
--- a/src/protos/stationLayoutGraphics.ts
+++ b/src/protos/stationLayoutGraphics.ts
@@ -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[];
sectionLinks?: ReturnType[];
axleCountingSections?: ReturnType[];
- logicSections?: ReturnType[];
+ logicSections?: ReturnType[];
}): 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[];
sectionLinks?: ReturnType[];
axleCountingSections?: ReturnType[];
- logicSections?: ReturnType[];
+ logicSections?: ReturnType[];
} = {};
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();
}
@@ -3941,4 +3941,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;
+ code?: string;
+ points?: ReturnType[];
+ 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;
+ code?: string;
+ points?: ReturnType[];
+ 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);
+ }
+ }
}