增加link

This commit is contained in:
fan 2023-07-07 16:05:17 +08:00
parent 3ed7b25f57
commit 6e38d31bd2
9 changed files with 600 additions and 2 deletions

@ -1 +1 @@
Subproject commit 1f302648b5a71a82b798b77fe238c5fc6e3081b4
Subproject commit 0a0cb0a77afd9783081c2dc6ba19687b0b3aa0f7

View File

@ -72,6 +72,9 @@
<separator-property
v-else-if="drawStore.selectedGraphicType === Separator.Type"
></separator-property>
<section-link-property
v-else-if="drawStore.selectedGraphicType === SectionLink.Type"
></section-link-property>
</q-card-section>
</template>
</q-card>
@ -96,6 +99,7 @@ import SignalProperty from './properties/SignalProperty.vue';
import TurnoutProperty from './properties/TurnoutProperty.vue';
import SectionProperty from './properties/SectionProperty.vue';
import SeparatorProperty from './properties/SeparatorProperty.vue';
import SectionLinkProperty from './properties/SectionLinkProperty.vue';
import { Link } from 'src/graphics/link/Link';
import { Rect } from 'src/graphics/rect/Rect';
import { Platform } from 'src/graphics/platform/Platform';
@ -108,6 +112,7 @@ import { Section } from 'src/graphics/section/Section';
import { TrainWindow } from 'src/graphics/trainWindow/TrainWindow';
import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting';
import { Separator } from 'src/graphics/separator/Separator';
import { SectionLink } from 'src/graphics/sectionLink/SectionLink';
const drawStore = useDrawStore();
</script>

View File

@ -0,0 +1,44 @@
<template>
<q-form>
<q-input
outlined
readonly
v-model="sectionLinkModel.id"
label="id"
hint=""
/>
<q-input
outlined
v-model="sectionLinkModel.code"
@blur="onUpdate"
label="编号"
/>
</q-form>
</template>
<script setup lang="ts">
import { SectionLink } from 'src/graphics/sectionLink/SectionLink';
import { SectionLinkData } from 'src/drawApp/graphics/SectionLinkInteraction';
import { useDrawStore } from 'src/stores/draw-store';
import { shallowRef, watchEffect } from 'vue';
const drawStore = useDrawStore();
const sectionLinkModel = shallowRef(new SectionLinkData());
watchEffect(() => {
const sectionLink = drawStore.selectedGraphic;
if (sectionLink && sectionLink instanceof SectionLink) {
sectionLinkModel.value = sectionLink.saveData();
}
});
const onUpdate = () => {
const sectionLink = drawStore.selectedGraphic as SectionLink;
if (sectionLink) {
drawStore
.getDrawApp()
.updateGraphicAndRecord(sectionLink, sectionLinkModel.value);
}
};
</script>

View File

@ -0,0 +1,58 @@
import * as pb_1 from 'google-protobuf';
import { GraphicDataBase } from './GraphicDataBase';
import {
ISectionLinkData,
SectionLink,
} from 'src/graphics/sectionLink/SectionLink';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { IPointData } from 'pixi.js';
export class SectionLinkData
extends GraphicDataBase
implements ISectionLinkData
{
constructor(data?: graphicData.SectionLink) {
let sectionLink;
if (!data) {
sectionLink = new graphicData.SectionLink({
common: GraphicDataBase.defaultCommonInfo(SectionLink.Type),
});
} else {
sectionLink = data;
}
super(sectionLink);
}
public get data(): graphicData.SectionLink {
return this.getData<graphicData.SectionLink>();
}
get code(): string {
return this.data.code;
}
set code(v: string) {
this.data.code = v;
}
get points(): IPointData[] {
return this.data.points;
}
set points(points: IPointData[]) {
this.data.points = points.map(
(p) => new graphicData.Point({ x: p.x, y: p.y })
);
}
get refDevice(): string {
return this.data.refDevice;
}
set refDevice(v: string) {
this.data.refDevice = v;
}
clone(): SectionLinkData {
return new SectionLinkData(this.data.cloneMessage());
}
copyFrom(data: SectionLinkData): void {
pb_1.Message.copyInto(data.data, this.data);
}
eq(other: SectionLinkData): boolean {
return pb_1.Message.equals(this.data, other.data);
}
}

View File

@ -59,6 +59,12 @@ import { toStorageTransform } from './graphics/GraphicDataBase';
import { SeparatorDraw } from 'src/graphics/separator/SeparatorDrawAssistant';
import { Separator, SeparatorTemplate } from 'src/graphics/separator/Separator';
import { SeparatorData } from './graphics/SeparatorInteraction';
import {
SectionLink,
SectionLinkTemplate,
} from 'src/graphics/sectionLink/SectionLink';
import { SectionLinkDraw } from 'src/graphics/sectionLink/SectionLinkDrawAssistant';
import { SectionLinkData } from './graphics/SectionLinkInteraction';
// export function fromStoragePoint(p: graphicData.Point): Point {
// return new Point(p.x, p.y);
@ -164,6 +170,7 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
| OneClickGenerateDraw
| AxleCountingDraw
| SeparatorDraw
| SectionLinkDraw
)[] = [];
if (draftType === 'Line') {
drawAssistants = [
@ -189,6 +196,7 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
new AxleCountingTemplate(new AxleCountingData())
),
new SeparatorDraw(app, new SeparatorTemplate(new SeparatorData())),
new SectionLinkDraw(app, new SectionLinkTemplate(new SectionLinkData())),
];
DrawSignalInteraction.init(app);
}
@ -207,6 +215,11 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
const trainWindows = app.queryStore.queryByType<TrainWindow>(
TrainWindow.Type
);
const sections = app.queryStore.queryByType<Section>(Section.Type);
const sectionLinks = app.queryStore.queryByType<SectionLink>(
SectionLink.Type
);
const turnouts = app.queryStore.queryByType<Turnout>(Turnout.Type);
UndoOptions.handler = () => {
app.opRecord.undo();
};
@ -220,6 +233,15 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
axleCountings.forEach((axleCounting) => {
axleCounting.visible = false;
});
sections.forEach((section) => {
section.visible = false;
});
sectionLinks.forEach((sectionLink) => {
sectionLink.visible = true;
});
turnouts.forEach((turnout) => {
turnout.visible = false;
});
};
twoLayerOptions.handler = () => {
trainWindows.forEach((trainWindow) => {
@ -308,6 +330,9 @@ export function saveDrawDatas(app: JlDrawApp) {
} else if (Separator.Type === g.type) {
const separatorData = (g as Separator).saveData();
storage.separators.push((separatorData as SeparatorData).data);
} else if (SectionLink.Type === g.type) {
const sectionLinkData = (g as SectionLink).saveData();
storage.sectionLinks.push((sectionLinkData as SectionLinkData).data);
}
});
const base64 = fromUint8Array(storage.serialize());
@ -366,6 +391,9 @@ export async function loadDrawDatas(app: GraphicApp) {
storage.separators.forEach((separator) => {
datas.push(new SeparatorData(separator));
});
storage.sectionLinks.forEach((sectionLink) => {
datas.push(new SectionLinkData(sectionLink));
});
app.loadGraphic(datas);
} else {
app.loadGraphic([]);

View File

@ -0,0 +1,106 @@
import { Graphics, IPointData } from 'pixi.js';
import {
GraphicData,
JlGraphic,
JlGraphicTemplate,
VectorText,
IChildTransform,
} from 'src/jl-graphic';
import { ILineGraphic } from 'src/jl-graphic/plugins/GraphicEditPlugin';
export interface ISectionLinkData extends GraphicData {
get code(): string; // 编号
set code(v: string);
get points(): IPointData[];
set points(points: IPointData[]);
get refDevice(): string;
set refDevice(v: string);
clone(): ISectionLinkData;
copyFrom(data: ISectionLinkData): void;
eq(other: ISectionLinkData): boolean;
}
export const SectionLinkConsts = {
lineColor: 0x5578b6,
lineWidth: 5,
};
export class SectionLink extends JlGraphic implements ILineGraphic {
static Type = 'SectionLink';
lineGraphic: Graphics;
labelGraphic: VectorText;
constructor() {
super(SectionLink.Type);
this.lineGraphic = new Graphics();
this.labelGraphic = new VectorText();
this.labelGraphic.setVectorFontSize(14);
this.labelGraphic.anchor.set(0.5);
this.labelGraphic.style.fill = '#0f0';
this.labelGraphic.transformSave = true;
this.labelGraphic.name = 'label';
this.transformSave = true;
this.addChild(this.lineGraphic);
this.addChild(this.labelGraphic);
}
doRepaint() {
if (this.datas.points.length < 2) {
throw new Error('SectionLink坐标数据异常');
}
this.lineGraphic.clear();
this.lineGraphic.lineStyle(
SectionLinkConsts.lineWidth,
SectionLinkConsts.lineColor
);
this.datas.points.forEach((p, i) => {
if (i !== 0) {
this.lineGraphic.lineTo(p.x, p.y);
} else {
this.lineGraphic.moveTo(p.x, p.y);
}
});
this.labelGraphic.text = this.datas.code;
const labelPosition = this.datas?.childTransforms?.find(
(item: IChildTransform) => item.name === this.labelGraphic.name
)?.transform.position;
if (labelPosition) {
this.labelGraphic.position.set(labelPosition.x, labelPosition.y);
} else {
this.labelGraphic.position.set(
this.datas.points[0].x,
this.datas.points[0].y + 20
);
}
}
getStartPoint() {
return this.datas.points[0];
}
getEndPoint(): IPointData {
return this.datas.points[this.datas.points.length - 1];
}
get datas(): ISectionLinkData {
return this.getDatas<ISectionLinkData>();
}
get linePoints(): IPointData[] {
return this.datas.points;
}
set linePoints(points: IPointData[]) {
const old = this.datas.clone();
old.points = points;
this.updateData(old);
}
}
export class SectionLinkTemplate extends JlGraphicTemplate<SectionLink> {
constructor(dataTemplate: ISectionLinkData) {
super(SectionLink.Type, { dataTemplate });
}
new() {
return new SectionLink();
}
}

View File

@ -0,0 +1,183 @@
import {
GraphicApp,
GraphicDrawAssistant,
GraphicInteractionPlugin,
JlDrawApp,
JlGraphic,
linePoint,
GraphicIdGenerator,
} from 'src/jl-graphic';
import {
ISectionLinkData,
SectionLink,
SectionLinkConsts,
SectionLinkTemplate,
} from './SectionLink';
import {
DisplayObject,
FederatedMouseEvent,
Graphics,
IHitArea,
IPointData,
Point,
} from 'pixi.js';
import { Section } from '../section/Section';
import { Turnout } from '../turnout/Turnout';
export class SectionLinkDraw extends GraphicDrawAssistant<
SectionLinkTemplate,
ISectionLinkData
> {
points: Point[] = [];
graphic = new Graphics();
constructor(app: JlDrawApp, template: SectionLinkTemplate) {
super(app, template, 'sym_o_timeline', '不展示');
this.container.addChild(this.graphic);
SectionLinkEditPlugin.init(app, this);
}
onRightClick(): void {
this.createAndStore(true);
}
redraw(cp: Point): void {
if (this.points.length < 1) return;
this.graphic.clear();
this.graphic.lineStyle(
SectionLinkConsts.lineWidth,
SectionLinkConsts.lineColor
);
this.points.forEach((p, i) => {
if (i !== 0) {
this.graphic.lineTo(p.x, p.y);
} else {
this.graphic.moveTo(p.x, p.y);
}
});
this.graphic.lineTo(cp.x, cp.y);
console.log(cp, '000');
}
prepareData(data: ISectionLinkData): boolean {
console.log(this.points, '000');
data.points = this.points;
return true;
}
oneGenerates() {
// localToCanvasPoints
const sectionList = this.app.queryStore.queryByType<Section>(Section.Type);
const turnoutList = this.app.queryStore.queryByType<Turnout>(Turnout.Type);
console.log(sectionList.length, turnoutList.length);
sectionList.forEach((section: Section) => {
const sectionLink = new SectionLink();
sectionLink.loadData(this.graphicTemplate.datas);
sectionLink.id = GraphicIdGenerator.next();
const points: IPointData[] = [];
section.datas.points.forEach((p) => {
points.push(section.localToCanvasPoint(p));
});
sectionLink.datas.points = points;
this.storeGraphic(sectionLink);
});
turnoutList.forEach((turnout: Turnout) => {
const sectionLinkA = new SectionLink();
const sectionLinkB = new SectionLink();
const sectionLinkC = new SectionLink();
sectionLinkA.loadData(this.graphicTemplate.datas);
sectionLinkB.loadData(this.graphicTemplate.datas);
sectionLinkC.loadData(this.graphicTemplate.datas);
const forkP = new Point(turnout.position.x, turnout.position.y);
const pointA = [forkP];
const pointB = [forkP];
const pointC = [forkP];
turnout.datas.pointA.forEach((p) => {
pointA.push(turnout.localToCanvasPoint(p));
});
turnout.datas.pointB.forEach((p) => {
pointB.push(turnout.localToCanvasPoint(p));
});
turnout.datas.pointC.forEach((p) => {
pointC.push(turnout.localToCanvasPoint(p));
});
sectionLinkA.id = GraphicIdGenerator.next();
sectionLinkB.id = GraphicIdGenerator.next();
sectionLinkC.id = GraphicIdGenerator.next();
sectionLinkA.datas.points = pointA;
sectionLinkB.datas.points = pointB;
sectionLinkC.datas.points = pointC;
this.storeGraphic(sectionLinkA);
this.storeGraphic(sectionLinkB);
this.storeGraphic(sectionLinkC);
});
}
clearCache(): void {
this.points = [];
this.graphic.clear();
}
}
class SectionLinkGraphicHitArea implements IHitArea {
section: SectionLink;
constructor(section: SectionLink) {
this.section = section;
}
contains(x: number, y: number): boolean {
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];
if (linePoint(p1, p2, { x, y }, SectionLinkConsts.lineWidth)) {
return true;
}
}
return false;
}
}
export class SectionLinkEditPlugin extends GraphicInteractionPlugin<SectionLink> {
static Name = 'SectionLinkDrag';
drawAssistant: SectionLinkDraw;
constructor(app: GraphicApp, da: SectionLinkDraw) {
super(SectionLinkEditPlugin.Name, app);
this.drawAssistant = da;
}
static init(app: GraphicApp, da: SectionLinkDraw) {
return new SectionLinkEditPlugin(app, da);
}
filter(...grahpics: JlGraphic[]): SectionLink[] | undefined {
return grahpics.filter((g) => g.type == SectionLink.Type) as SectionLink[];
}
bind(g: SectionLink): void {
g.lineGraphic.eventMode = 'static';
g.lineGraphic.cursor = 'pointer';
g.lineGraphic.hitArea = new SectionLinkGraphicHitArea(g);
// g.transformSave = true;
// g.labelGraphic.eventMode = 'static';
// g.labelGraphic.cursor = 'pointer';
// g.labelGraphic.selectable = true;
// g.labelGraphic.draggable = true;
// g.on('selected', this.onSelected, this);
// g.on('unselected', this.onUnselected, this);
// g.on('_rightclick', this.onContextMenu, this);
}
unbind(g: SectionLink): void {
// g.off('selected', this.onSelected, this);
// g.off('unselected', this.onUnselected, this);
// g.off('_rightclick', this.onContextMenu, this);
}
// onContextMenu(e: FederatedMouseEvent) {
// const target = e.target as DisplayObject;
// const section = target.getGraphic() as SectionLink;
// this.app.updateSelected(section);
// }
// onSelected(g: DisplayObject): void {
// const sectionLink = g as SectionLink;
// }
// onUnselected(g: DisplayObject): void {
// const sectionLink = g as SectionLink;
// }
}

View File

@ -24,6 +24,9 @@
<q-item clickable v-close-popup @click="oneClickAxleCounting">
<q-item-section>一键生成计轴</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="oneClickLink">
<q-item-section>一键生成Link</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
@ -186,6 +189,8 @@ import { ApiError } from 'src/boot/axios';
import { OneClickGenerate } from 'src/graphics/trainWindow/oneClickDrawAssistant';
import { Separator } from 'src/graphics/separator/Separator';
import { SeparatorDraw } from 'src/graphics/separator/SeparatorDrawAssistant';
import { SectionLink } from 'src/graphics/sectionLink/SectionLink';
import { SectionLinkDraw } from 'src/graphics/sectionLink/SectionLinkDrawAssistant';
const route = useRoute();
const router = useRouter();
@ -328,6 +333,13 @@ function oneClickAxleCounting() {
drawStore.oneClickType = 'AxleCounting';
drawStore.getDrawApp().interactionPlugin(OneClickGenerate.Type).resume();
}
function oneClickLink() {
drawStore.oneClickType = 'SectionLink';
const draw = drawStore
.getDrawApp()
.getDrawAssistant(SectionLink.Type) as SectionLinkDraw;
draw.oneGenerates();
}
function backConfirm() {
router.go(-1);

View File

@ -22,9 +22,10 @@ export namespace graphicData {
trainWindows?: TrainWindow[];
axleCountings?: AxleCounting[];
separators?: Separator[];
sectionLinks?: SectionLink[];
}) {
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], 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], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("canvas" in data && data.canvas != undefined) {
this.canvas = data.canvas;
@ -68,6 +69,9 @@ export namespace graphicData {
if ("separators" in data && data.separators != undefined) {
this.separators = data.separators;
}
if ("sectionLinks" in data && data.sectionLinks != undefined) {
this.sectionLinks = data.sectionLinks;
}
}
}
get canvas() {
@ -157,6 +161,12 @@ export namespace graphicData {
set separators(value: Separator[]) {
pb_1.Message.setRepeatedWrapperField(this, 14, value);
}
get sectionLinks() {
return pb_1.Message.getRepeatedWrapperField(this, SectionLink, 15) as SectionLink[];
}
set sectionLinks(value: SectionLink[]) {
pb_1.Message.setRepeatedWrapperField(this, 15, value);
}
static fromObject(data: {
canvas?: ReturnType<typeof Canvas.prototype.toObject>;
links?: ReturnType<typeof Link.prototype.toObject>[];
@ -172,6 +182,7 @@ export namespace graphicData {
trainWindows?: ReturnType<typeof TrainWindow.prototype.toObject>[];
axleCountings?: ReturnType<typeof AxleCounting.prototype.toObject>[];
separators?: ReturnType<typeof Separator.prototype.toObject>[];
sectionLinks?: ReturnType<typeof SectionLink.prototype.toObject>[];
}): RtssGraphicStorage {
const message = new RtssGraphicStorage({});
if (data.canvas != null) {
@ -216,6 +227,9 @@ export namespace graphicData {
if (data.separators != null) {
message.separators = data.separators.map(item => Separator.fromObject(item));
}
if (data.sectionLinks != null) {
message.sectionLinks = data.sectionLinks.map(item => SectionLink.fromObject(item));
}
return message;
}
toObject() {
@ -234,6 +248,7 @@ export namespace graphicData {
trainWindows?: ReturnType<typeof TrainWindow.prototype.toObject>[];
axleCountings?: ReturnType<typeof AxleCounting.prototype.toObject>[];
separators?: ReturnType<typeof Separator.prototype.toObject>[];
sectionLinks?: ReturnType<typeof SectionLink.prototype.toObject>[];
} = {};
if (this.canvas != null) {
data.canvas = this.canvas.toObject();
@ -277,6 +292,9 @@ export namespace graphicData {
if (this.separators != null) {
data.separators = this.separators.map((item: Separator) => item.toObject());
}
if (this.sectionLinks != null) {
data.sectionLinks = this.sectionLinks.map((item: SectionLink) => item.toObject());
}
return data;
}
serialize(): Uint8Array;
@ -311,6 +329,8 @@ export namespace graphicData {
writer.writeRepeatedMessage(13, this.axleCountings, (item: AxleCounting) => item.serialize(writer));
if (this.separators.length)
writer.writeRepeatedMessage(14, this.separators, (item: Separator) => item.serialize(writer));
if (this.sectionLinks.length)
writer.writeRepeatedMessage(15, this.sectionLinks, (item: SectionLink) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -362,6 +382,9 @@ export namespace graphicData {
case 14:
reader.readMessage(message.separators, () => pb_1.Message.addToRepeatedWrapperField(message, 14, Separator.deserialize(reader), Separator));
break;
case 15:
reader.readMessage(message.sectionLinks, () => pb_1.Message.addToRepeatedWrapperField(message, 15, SectionLink.deserialize(reader), SectionLink));
break;
default: reader.skipField();
}
}
@ -3406,4 +3429,143 @@ export namespace graphicData {
return Separator.deserialize(bytes);
}
}
export class SectionLink extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
common?: CommonInfo;
code?: string;
points?: Point[];
refDevice?: string;
}) {
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 ("refDevice" in data && data.refDevice != undefined) {
this.refDevice = data.refDevice;
}
}
}
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 refDevice() {
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
}
set refDevice(value: string) {
pb_1.Message.setField(this, 4, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
points?: ReturnType<typeof Point.prototype.toObject>[];
refDevice?: string;
}): SectionLink {
const message = new SectionLink({});
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.refDevice != null) {
message.refDevice = data.refDevice;
}
return message;
}
toObject() {
const data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
points?: ReturnType<typeof Point.prototype.toObject>[];
refDevice?: string;
} = {};
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.refDevice != null) {
data.refDevice = this.refDevice;
}
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.refDevice.length)
writer.writeString(4, this.refDevice);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SectionLink {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SectionLink();
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.refDevice = reader.readString();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): SectionLink {
return SectionLink.deserialize(bytes);
}
}
}