代码同步

This commit is contained in:
Yuan 2023-07-13 17:59:54 +08:00
parent 240e75262f
commit 3c04f8ee4a
5 changed files with 40 additions and 8 deletions

@ -1 +1 @@
Subproject commit 3612e0fc16a52ee1b9aa0c7422908fc0784c08d1 Subproject commit 0a7e6144bad3d943b5adfec4595c70209d8b1127

View File

@ -543,8 +543,13 @@ export class GraphicApp extends EventEmitter<GraphicAppEvents> {
g.loadState(state); g.loadState(state);
this.addGraphics(g); this.addGraphics(g);
} else { } else {
list.forEach((g) => { // 调整逻辑:所有图形对象状态数据更新完后再统一重绘
g.updateStates(state); list
.filter((g) => {
return g.updateStates(state);
})
.forEach((g) => {
g.repaint();
}); });
} }
}); });

View File

@ -902,7 +902,7 @@ export abstract class JlGraphic extends Container {
this.onStateChange(state, old); this.onStateChange(state, old);
stateChange = true; stateChange = true;
this.emit('stateupdate', this.getStates(), old); this.emit('stateupdate', this.getStates(), old);
this.repaint(); // this.repaint();
} }
return stateChange; return stateChange;
} }
@ -912,8 +912,12 @@ export abstract class JlGraphic extends Container {
onStateChange(newVal: GraphicState, old?: GraphicState): void {} onStateChange(newVal: GraphicState, old?: GraphicState): void {}
repaint(): void { repaint(): void {
try {
this.doRepaint(); this.doRepaint();
this.emit('repaint', this); this.emit('repaint', this);
} catch (e) {
console.error(`设备id=${this.id},type=${this.type}重绘逻辑异常`, e);
}
} }
/** /**

View File

@ -3727,6 +3727,7 @@ export namespace graphicData {
points?: Point[]; points?: Point[];
isUp?: boolean; isUp?: boolean;
kilometerPoints?: KilometerPoint[]; kilometerPoints?: KilometerPoint[];
aToB?: boolean;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 5], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 5], this.#one_of_decls);
@ -3746,6 +3747,9 @@ export namespace graphicData {
if ("kilometerPoints" in data && data.kilometerPoints != undefined) { if ("kilometerPoints" in data && data.kilometerPoints != undefined) {
this.kilometerPoints = data.kilometerPoints; this.kilometerPoints = data.kilometerPoints;
} }
if ("aToB" in data && data.aToB != undefined) {
this.aToB = data.aToB;
}
} }
} }
get common() { get common() {
@ -3781,12 +3785,19 @@ export namespace graphicData {
set kilometerPoints(value: KilometerPoint[]) { set kilometerPoints(value: KilometerPoint[]) {
pb_1.Message.setRepeatedWrapperField(this, 5, value); pb_1.Message.setRepeatedWrapperField(this, 5, value);
} }
get aToB() {
return pb_1.Message.getFieldWithDefault(this, 6, false) as boolean;
}
set aToB(value: boolean) {
pb_1.Message.setField(this, 6, value);
}
static fromObject(data: { static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>; common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string; code?: string;
points?: ReturnType<typeof Point.prototype.toObject>[]; points?: ReturnType<typeof Point.prototype.toObject>[];
isUp?: boolean; isUp?: boolean;
kilometerPoints?: ReturnType<typeof KilometerPoint.prototype.toObject>[]; kilometerPoints?: ReturnType<typeof KilometerPoint.prototype.toObject>[];
aToB?: boolean;
}): PathLine { }): PathLine {
const message = new PathLine({}); const message = new PathLine({});
if (data.common != null) { if (data.common != null) {
@ -3804,6 +3815,9 @@ export namespace graphicData {
if (data.kilometerPoints != null) { if (data.kilometerPoints != null) {
message.kilometerPoints = data.kilometerPoints.map(item => KilometerPoint.fromObject(item)); message.kilometerPoints = data.kilometerPoints.map(item => KilometerPoint.fromObject(item));
} }
if (data.aToB != null) {
message.aToB = data.aToB;
}
return message; return message;
} }
toObject() { toObject() {
@ -3813,6 +3827,7 @@ export namespace graphicData {
points?: ReturnType<typeof Point.prototype.toObject>[]; points?: ReturnType<typeof Point.prototype.toObject>[];
isUp?: boolean; isUp?: boolean;
kilometerPoints?: ReturnType<typeof KilometerPoint.prototype.toObject>[]; kilometerPoints?: ReturnType<typeof KilometerPoint.prototype.toObject>[];
aToB?: boolean;
} = {}; } = {};
if (this.common != null) { if (this.common != null) {
data.common = this.common.toObject(); data.common = this.common.toObject();
@ -3829,6 +3844,9 @@ export namespace graphicData {
if (this.kilometerPoints != null) { if (this.kilometerPoints != null) {
data.kilometerPoints = this.kilometerPoints.map((item: KilometerPoint) => item.toObject()); data.kilometerPoints = this.kilometerPoints.map((item: KilometerPoint) => item.toObject());
} }
if (this.aToB != null) {
data.aToB = this.aToB;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -3845,6 +3863,8 @@ export namespace graphicData {
writer.writeBool(4, this.isUp); writer.writeBool(4, this.isUp);
if (this.kilometerPoints.length) if (this.kilometerPoints.length)
writer.writeRepeatedMessage(5, this.kilometerPoints, (item: KilometerPoint) => item.serialize(writer)); writer.writeRepeatedMessage(5, this.kilometerPoints, (item: KilometerPoint) => item.serialize(writer));
if (this.aToB != false)
writer.writeBool(6, this.aToB);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -3869,6 +3889,9 @@ export namespace graphicData {
case 5: case 5:
reader.readMessage(message.kilometerPoints, () => pb_1.Message.addToRepeatedWrapperField(message, 5, KilometerPoint.deserialize(reader), KilometerPoint)); reader.readMessage(message.kilometerPoints, () => pb_1.Message.addToRepeatedWrapperField(message, 5, KilometerPoint.deserialize(reader), KilometerPoint));
break; break;
case 6:
message.aToB = reader.readBool();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }

@ -1 +1 @@
Subproject commit 2d4a7c97fe9a0f5694932918e10a90248a60422b Subproject commit e8ac23070828a1eca3bd68b6f78e4e419123d139