This commit is contained in:
fan 2023-12-15 09:54:51 +08:00
parent 4f1e58aac6
commit c343e80428
3 changed files with 266 additions and 4 deletions

View File

@ -366,6 +366,84 @@ export function saveDrawDatas(app: IDrawApp) {
storage.logicSections.push((logicSectionData as LogicSectionData).data);
}
});
storage.Platforms.forEach((item) => {
item.common.nid = +item.common.id;
item.nrefStation = +item.refStation;
item.nrefSectionId = +item.refSectionId;
});
storage.axleCountings.forEach((item) => {
item.common.nid = +item.common.id;
item.axleCountingRef = item.axleCountingRef.map((child) => {
child.nid = +child.id;
return child;
});
});
storage.iscsFans.forEach((item) => {
item.common.nid = +item.common.id;
});
storage.links.forEach((item) => {
item.common.nid = +item.common.id;
});
storage.logicSections.forEach((item) => {
item.common.nid = +item.common.id;
});
storage.pathLines.forEach((item) => {
item.common.nid = +item.common.id;
});
storage.polygons.forEach((item) => {
item.common.nid = +item.common.id;
});
storage.rects.forEach((item) => {
item.common.nid = +item.common.id;
});
storage.runLines.forEach((item) => {
item.common.nid = +item.common.id;
item.nlinkPathLines = item.linkPathLines.map((child) => +child);
});
storage.section.forEach((item) => {
item.common.nid = +item.common.id;
if (item.paRef) {
item.paRef.nid = +item.paRef.id;
}
if (item.pbRef) {
item.pbRef.nid = +item.pbRef.id;
}
item.nchildren = item.children.map((child) => +child);
});
storage.separators.forEach((item) => {
item.common.nid = +item.common.id;
});
storage.signals.forEach((item) => {
item.common.nid = +item.common.id;
});
storage.stationLines.forEach((item) => {
item.common.nid = +item.common.id;
});
storage.stations.forEach((item) => {
item.common.nid = +item.common.id;
});
storage.train.forEach((item) => {
item.common.nid = +item.common.id;
});
storage.trainLines.forEach((item) => {
item.common.nid = +item.common.id;
});
storage.trainWindows.forEach((item) => {
item.common.nid = +item.common.id;
item.nrefDeviceId = item.refDeviceId.map((child) => +child);
});
storage.turnouts.forEach((item) => {
item.common.nid = +item.common.id;
if (item.paRef) {
item.paRef.nid = +item.paRef.id;
}
if (item.pbRef) {
item.pbRef.nid = +item.pbRef.id;
}
if (item.pcRef) {
item.pcRef.nid = +item.pcRef.id;
}
});
const base64 = fromUint8Array(storage.serialize());
console.log('保存数据', storage);
// localStorage.setItem(StorageKey, base64);

View File

@ -963,6 +963,7 @@ export namespace graphicData {
graphicType?: string;
transform?: Transform;
childTransforms?: ChildTransform[];
nid?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4], this.#one_of_decls);
@ -979,6 +980,9 @@ export namespace graphicData {
if ("childTransforms" in data && data.childTransforms != undefined) {
this.childTransforms = data.childTransforms;
}
if ("nid" in data && data.nid != undefined) {
this.nid = data.nid;
}
}
}
get id() {
@ -1008,11 +1012,18 @@ export namespace graphicData {
set childTransforms(value: ChildTransform[]) {
pb_1.Message.setRepeatedWrapperField(this, 4, value);
}
get nid() {
return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
}
set nid(value: number) {
pb_1.Message.setField(this, 5, value);
}
static fromObject(data: {
id?: string;
graphicType?: string;
transform?: ReturnType<typeof Transform.prototype.toObject>;
childTransforms?: ReturnType<typeof ChildTransform.prototype.toObject>[];
nid?: number;
}): CommonInfo {
const message = new CommonInfo({});
if (data.id != null) {
@ -1027,6 +1038,9 @@ export namespace graphicData {
if (data.childTransforms != null) {
message.childTransforms = data.childTransforms.map(item => ChildTransform.fromObject(item));
}
if (data.nid != null) {
message.nid = data.nid;
}
return message;
}
toObject() {
@ -1035,6 +1049,7 @@ export namespace graphicData {
graphicType?: string;
transform?: ReturnType<typeof Transform.prototype.toObject>;
childTransforms?: ReturnType<typeof ChildTransform.prototype.toObject>[];
nid?: number;
} = {};
if (this.id != null) {
data.id = this.id;
@ -1048,6 +1063,9 @@ export namespace graphicData {
if (this.childTransforms != null) {
data.childTransforms = this.childTransforms.map((item: ChildTransform) => item.toObject());
}
if (this.nid != null) {
data.nid = this.nid;
}
return data;
}
serialize(): Uint8Array;
@ -1062,6 +1080,8 @@ export namespace graphicData {
writer.writeMessage(3, this.transform, () => this.transform.serialize(writer));
if (this.childTransforms.length)
writer.writeRepeatedMessage(4, this.childTransforms, (item: ChildTransform) => item.serialize(writer));
if (this.nid != 0)
writer.writeUint32(5, this.nid);
if (!w)
return writer.getResultBuffer();
}
@ -1083,6 +1103,9 @@ export namespace graphicData {
case 4:
reader.readMessage(message.childTransforms, () => pb_1.Message.addToRepeatedWrapperField(message, 4, ChildTransform.deserialize(reader), ChildTransform));
break;
case 5:
message.nid = reader.readUint32();
break;
default: reader.skipField();
}
}
@ -1708,6 +1731,9 @@ export namespace graphicData {
direction?: string;
refStation?: string;
up?: boolean;
nrefStation?: number;
refSectionId?: string;
nrefSectionId?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -1730,6 +1756,15 @@ export namespace graphicData {
if ("up" in data && data.up != undefined) {
this.up = data.up;
}
if ("nrefStation" in data && data.nrefStation != undefined) {
this.nrefStation = data.nrefStation;
}
if ("refSectionId" in data && data.refSectionId != undefined) {
this.refSectionId = data.refSectionId;
}
if ("nrefSectionId" in data && data.nrefSectionId != undefined) {
this.nrefSectionId = data.nrefSectionId;
}
}
}
get common() {
@ -1771,6 +1806,24 @@ export namespace graphicData {
set up(value: boolean) {
pb_1.Message.setField(this, 7, value);
}
get nrefStation() {
return pb_1.Message.getFieldWithDefault(this, 8, 0) as number;
}
set nrefStation(value: number) {
pb_1.Message.setField(this, 8, value);
}
get refSectionId() {
return pb_1.Message.getFieldWithDefault(this, 9, "") as string;
}
set refSectionId(value: string) {
pb_1.Message.setField(this, 9, value);
}
get nrefSectionId() {
return pb_1.Message.getFieldWithDefault(this, 10, 0) as number;
}
set nrefSectionId(value: number) {
pb_1.Message.setField(this, 10, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
@ -1778,6 +1831,9 @@ export namespace graphicData {
direction?: string;
refStation?: string;
up?: boolean;
nrefStation?: number;
refSectionId?: string;
nrefSectionId?: number;
}): Platform {
const message = new Platform({});
if (data.common != null) {
@ -1798,6 +1854,15 @@ export namespace graphicData {
if (data.up != null) {
message.up = data.up;
}
if (data.nrefStation != null) {
message.nrefStation = data.nrefStation;
}
if (data.refSectionId != null) {
message.refSectionId = data.refSectionId;
}
if (data.nrefSectionId != null) {
message.nrefSectionId = data.nrefSectionId;
}
return message;
}
toObject() {
@ -1808,6 +1873,9 @@ export namespace graphicData {
direction?: string;
refStation?: string;
up?: boolean;
nrefStation?: number;
refSectionId?: string;
nrefSectionId?: number;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -1827,6 +1895,15 @@ export namespace graphicData {
if (this.up != null) {
data.up = this.up;
}
if (this.nrefStation != null) {
data.nrefStation = this.nrefStation;
}
if (this.refSectionId != null) {
data.refSectionId = this.refSectionId;
}
if (this.nrefSectionId != null) {
data.nrefSectionId = this.nrefSectionId;
}
return data;
}
serialize(): Uint8Array;
@ -1845,6 +1922,12 @@ export namespace graphicData {
writer.writeString(6, this.refStation);
if (this.up != false)
writer.writeBool(7, this.up);
if (this.nrefStation != 0)
writer.writeUint32(8, this.nrefStation);
if (this.refSectionId.length)
writer.writeString(9, this.refSectionId);
if (this.nrefSectionId != 0)
writer.writeUint32(10, this.nrefSectionId);
if (!w)
return writer.getResultBuffer();
}
@ -1872,6 +1955,15 @@ export namespace graphicData {
case 7:
message.up = reader.readBool();
break;
case 8:
message.nrefStation = reader.readUint32();
break;
case 9:
message.refSectionId = reader.readString();
break;
case 10:
message.nrefSectionId = reader.readUint32();
break;
default: reader.skipField();
}
}
@ -2246,9 +2338,10 @@ export namespace graphicData {
common?: CommonInfo;
code?: string;
refDeviceId?: string[];
nrefDeviceId?: 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, 4], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("common" in data && data.common != undefined) {
this.common = data.common;
@ -2259,6 +2352,9 @@ export namespace graphicData {
if ("refDeviceId" in data && data.refDeviceId != undefined) {
this.refDeviceId = data.refDeviceId;
}
if ("nrefDeviceId" in data && data.nrefDeviceId != undefined) {
this.nrefDeviceId = data.nrefDeviceId;
}
}
}
get common() {
@ -2282,10 +2378,17 @@ export namespace graphicData {
set refDeviceId(value: string[]) {
pb_1.Message.setField(this, 3, value);
}
get nrefDeviceId() {
return pb_1.Message.getFieldWithDefault(this, 4, []) as number[];
}
set nrefDeviceId(value: number[]) {
pb_1.Message.setField(this, 4, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
refDeviceId?: string[];
nrefDeviceId?: number[];
}): TrainWindow {
const message = new TrainWindow({});
if (data.common != null) {
@ -2297,6 +2400,9 @@ export namespace graphicData {
if (data.refDeviceId != null) {
message.refDeviceId = data.refDeviceId;
}
if (data.nrefDeviceId != null) {
message.nrefDeviceId = data.nrefDeviceId;
}
return message;
}
toObject() {
@ -2304,6 +2410,7 @@ export namespace graphicData {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
refDeviceId?: string[];
nrefDeviceId?: number[];
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -2314,6 +2421,9 @@ export namespace graphicData {
if (this.refDeviceId != null) {
data.refDeviceId = this.refDeviceId;
}
if (this.nrefDeviceId != null) {
data.nrefDeviceId = this.nrefDeviceId;
}
return data;
}
serialize(): Uint8Array;
@ -2326,6 +2436,8 @@ export namespace graphicData {
writer.writeString(2, this.code);
if (this.refDeviceId.length)
writer.writeRepeatedString(3, this.refDeviceId);
if (this.nrefDeviceId.length)
writer.writePackedUint32(4, this.nrefDeviceId);
if (!w)
return writer.getResultBuffer();
}
@ -2344,6 +2456,9 @@ export namespace graphicData {
case 3:
pb_1.Message.addToRepeatedField(message, 3, reader.readString());
break;
case 4:
message.nrefDeviceId = reader.readPackedUint32();
break;
default: reader.skipField();
}
}
@ -3286,9 +3401,10 @@ export namespace graphicData {
dashPointIndexs?: number[];
grayPointIndexs?: number[];
lineColor?: string;
nlinkPathLines?: number[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 8, 9, 11, 12], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 8, 9, 11, 12, 14], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("common" in data && data.common != undefined) {
this.common = data.common;
@ -3323,6 +3439,9 @@ export namespace graphicData {
if ("lineColor" in data && data.lineColor != undefined) {
this.lineColor = data.lineColor;
}
if ("nlinkPathLines" in data && data.nlinkPathLines != undefined) {
this.nlinkPathLines = data.nlinkPathLines;
}
}
}
get common() {
@ -3394,6 +3513,12 @@ export namespace graphicData {
set lineColor(value: string) {
pb_1.Message.setField(this, 13, value);
}
get nlinkPathLines() {
return pb_1.Message.getFieldWithDefault(this, 14, []) as number[];
}
set nlinkPathLines(value: number[]) {
pb_1.Message.setField(this, 14, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
@ -3406,6 +3531,7 @@ export namespace graphicData {
dashPointIndexs?: number[];
grayPointIndexs?: number[];
lineColor?: string;
nlinkPathLines?: number[];
}): RunLine {
const message = new RunLine({});
if (data.common != null) {
@ -3441,6 +3567,9 @@ export namespace graphicData {
if (data.lineColor != null) {
message.lineColor = data.lineColor;
}
if (data.nlinkPathLines != null) {
message.nlinkPathLines = data.nlinkPathLines;
}
return message;
}
toObject() {
@ -3456,6 +3585,7 @@ export namespace graphicData {
dashPointIndexs?: number[];
grayPointIndexs?: number[];
lineColor?: string;
nlinkPathLines?: number[];
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -3490,6 +3620,9 @@ export namespace graphicData {
if (this.lineColor != null) {
data.lineColor = this.lineColor;
}
if (this.nlinkPathLines != null) {
data.nlinkPathLines = this.nlinkPathLines;
}
return data;
}
serialize(): Uint8Array;
@ -3518,6 +3651,8 @@ export namespace graphicData {
writer.writePackedInt32(12, this.grayPointIndexs);
if (this.lineColor.length)
writer.writeString(13, this.lineColor);
if (this.nlinkPathLines.length)
writer.writePackedUint32(14, this.nlinkPathLines);
if (!w)
return writer.getResultBuffer();
}
@ -3560,6 +3695,9 @@ export namespace graphicData {
case 13:
message.lineColor = reader.readString();
break;
case 14:
message.nlinkPathLines = reader.readPackedUint32();
break;
default: reader.skipField();
}
}
@ -3585,9 +3723,10 @@ export namespace graphicData {
children?: string[];
destinationCode?: string;
turning?: boolean;
nchildren?: number[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 7, 8], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 7, 8, 11], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("common" in data && data.common != undefined) {
this.common = data.common;
@ -3619,6 +3758,9 @@ export namespace graphicData {
if ("turning" in data && data.turning != undefined) {
this.turning = data.turning;
}
if ("nchildren" in data && data.nchildren != undefined) {
this.nchildren = data.nchildren;
}
}
}
get common() {
@ -3690,6 +3832,12 @@ export namespace graphicData {
set turning(value: boolean) {
pb_1.Message.setField(this, 10, value);
}
get nchildren() {
return pb_1.Message.getFieldWithDefault(this, 11, []) as number[];
}
set nchildren(value: number[]) {
pb_1.Message.setField(this, 11, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
@ -3701,6 +3849,7 @@ export namespace graphicData {
children?: string[];
destinationCode?: string;
turning?: boolean;
nchildren?: number[];
}): Section {
const message = new Section({});
if (data.common != null) {
@ -3733,6 +3882,9 @@ export namespace graphicData {
if (data.turning != null) {
message.turning = data.turning;
}
if (data.nchildren != null) {
message.nchildren = data.nchildren;
}
return message;
}
toObject() {
@ -3747,6 +3899,7 @@ export namespace graphicData {
children?: string[];
destinationCode?: string;
turning?: boolean;
nchildren?: number[];
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -3778,6 +3931,9 @@ export namespace graphicData {
if (this.turning != null) {
data.turning = this.turning;
}
if (this.nchildren != null) {
data.nchildren = this.nchildren;
}
return data;
}
serialize(): Uint8Array;
@ -3804,6 +3960,8 @@ export namespace graphicData {
writer.writeString(9, this.destinationCode);
if (this.turning != false)
writer.writeBool(10, this.turning);
if (this.nchildren.length)
writer.writePackedUint32(11, this.nchildren);
if (!w)
return writer.getResultBuffer();
}
@ -3843,6 +4001,9 @@ export namespace graphicData {
case 10:
message.turning = reader.readBool();
break;
case 11:
message.nchildren = reader.readPackedUint32();
break;
default: reader.skipField();
}
}
@ -4284,6 +4445,7 @@ export namespace graphicData {
deviceType?: RelatedRef.DeviceType;
id?: string;
devicePort?: RelatedRef.DevicePort;
nid?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -4297,6 +4459,9 @@ export namespace graphicData {
if ("devicePort" in data && data.devicePort != undefined) {
this.devicePort = data.devicePort;
}
if ("nid" in data && data.nid != undefined) {
this.nid = data.nid;
}
}
}
get deviceType() {
@ -4317,10 +4482,17 @@ export namespace graphicData {
set devicePort(value: RelatedRef.DevicePort) {
pb_1.Message.setField(this, 3, value);
}
get nid() {
return pb_1.Message.getFieldWithDefault(this, 4, 0) as number;
}
set nid(value: number) {
pb_1.Message.setField(this, 4, value);
}
static fromObject(data: {
deviceType?: RelatedRef.DeviceType;
id?: string;
devicePort?: RelatedRef.DevicePort;
nid?: number;
}): RelatedRef {
const message = new RelatedRef({});
if (data.deviceType != null) {
@ -4332,6 +4504,9 @@ export namespace graphicData {
if (data.devicePort != null) {
message.devicePort = data.devicePort;
}
if (data.nid != null) {
message.nid = data.nid;
}
return message;
}
toObject() {
@ -4339,6 +4514,7 @@ export namespace graphicData {
deviceType?: RelatedRef.DeviceType;
id?: string;
devicePort?: RelatedRef.DevicePort;
nid?: number;
} = {};
if (this.deviceType != null) {
data.deviceType = this.deviceType;
@ -4349,6 +4525,9 @@ export namespace graphicData {
if (this.devicePort != null) {
data.devicePort = this.devicePort;
}
if (this.nid != null) {
data.nid = this.nid;
}
return data;
}
serialize(): Uint8Array;
@ -4361,6 +4540,8 @@ export namespace graphicData {
writer.writeString(2, this.id);
if (this.devicePort != RelatedRef.DevicePort.A)
writer.writeEnum(3, this.devicePort);
if (this.nid != 0)
writer.writeUint32(4, this.nid);
if (!w)
return writer.getResultBuffer();
}
@ -4379,6 +4560,9 @@ export namespace graphicData {
case 3:
message.devicePort = reader.readEnum();
break;
case 4:
message.nid = reader.readUint32();
break;
default: reader.skipField();
}
}

@ -1 +1 @@
Subproject commit 226023c351e10e7e07cc7c48e1dbde661091b6b5
Subproject commit 4e3b572d415ebd5431d3100417fa3ef6634b17a7