浙大网新增加信标

This commit is contained in:
fan 2023-11-10 09:23:52 +08:00
parent 215fc16318
commit 4a864aa9c3
11 changed files with 529 additions and 27 deletions

@ -1 +1 @@
Subproject commit 3dddb31503eddd794b391a2e17c4f0e11467c2f6
Subproject commit c04ff2635f94513857bbd1e923591a1c131e1cc7

View File

@ -51,4 +51,7 @@
<circle cx="15" cy="15" r="14.5" stroke="white"/>
<circle cx="15" cy="15" r="6" fill="white"/>
</symbol>
<symbol id="icon-beacon" viewBox="-10 -10 60 60" fill="none">
<path d="M22.0055 37.9832L0.354889 0.483154L43.6562 0.483154L22.0055 37.9832Z" fill="white"/>
</symbol>
</svg>

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -118,6 +118,9 @@
<TrackLogicSectionProperty
v-else-if="drawStore.selectedGraphicType === TrackLogicSection.Type"
></TrackLogicSectionProperty>
<beacon-property
v-else-if="drawStore.selectedGraphicType === Beacon.Type"
></beacon-property>
</q-card-section>
</template>
<template v-else-if="drawStore.selectedGraphics.length > 1">
@ -177,6 +180,8 @@ import { Link } from 'src/graphics/link/Link';
import LinkProperty from './properties/LinkProperty.vue';
import { Curvature } from 'src/graphics/curvature/Curvature';
import CurvatureProperty from './properties/CurvatureProperty.vue';
import { Beacon } from 'src/graphics/beacon/Beacon';
import BeaconProperty from './properties/BeaconProperty.vue';
import { CurvatureKiloMarker } from 'src/graphics/curvatureKiloMarker/CurvatureKiloMarker';
import TrackSectionProperty from './properties/TrackSectionProperty.vue';
import { TrackSection } from 'src/graphics/trackSection/TrackSection';

View File

@ -0,0 +1,40 @@
<template>
<q-form>
<q-input outlined readonly v-model="beaconModel.id" label="id" hint="" />
<q-input
outlined
class="q-mt-sm"
v-model="beaconModel.code"
@blur="onUpdate"
label="编号"
/>
<q-select
outlined
class="q-mt-sm"
style="margin-top: 10px"
v-model="beaconModel.type"
:options="typeList"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="类型"
></q-select>
</q-form>
</template>
<script setup lang="ts">
import { useFormData } from 'src/components/DrawAppFormUtils';
import { useDrawStore } from 'src/stores/draw-store';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { BeaconData } from 'src/drawApp/graphics/BeaconInteraction';
const { data: beaconModel, onUpdate } = useFormData(
new BeaconData(),
useDrawStore().getDrawApp()
);
const typeList = [
{ label: '静态信标', value: graphicData.Beacon.BeaconType.Static },
{ label: '动态信标', value: graphicData.Beacon.BeaconType.Dynamic },
];
</script>

View File

@ -0,0 +1,103 @@
import * as pb_1 from 'google-protobuf';
import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
import { Beacon, IBeacon } from 'src/graphics/beacon/Beacon';
import {
IGraphicApp,
GraphicInteractionPlugin,
JlGraphic,
} from 'src/jl-graphic';
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
import { MenuItemOptions } from 'src/jl-graphic/ui/Menu';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { GraphicDataBase } from './GraphicDataBase';
export class BeaconData extends GraphicDataBase implements IBeacon {
constructor(data?: graphicData.Beacon) {
let beacon;
if (!data) {
beacon = new graphicData.Beacon({
common: GraphicDataBase.defaultCommonInfo(Beacon.Type),
});
} else {
beacon = data;
}
super(beacon);
}
public get data(): graphicData.Beacon {
return this.getData<graphicData.Beacon>();
}
get code(): string {
return this.data.code;
}
set code(v: string) {
this.data.code = v;
}
get type(): graphicData.Beacon.BeaconType {
return this.data.type;
}
set type(v: graphicData.Beacon.BeaconType) {
this.data.type = v;
}
get flip(): boolean {
return this.data.flip;
}
set flip(v: boolean) {
this.data.flip = v;
}
clone(): BeaconData {
return new BeaconData(this.data.cloneMessage());
}
copyFrom(data: BeaconData): void {
pb_1.Message.copyInto(data.data, this.data);
}
eq(other: BeaconData): boolean {
return pb_1.Message.equals(this.data, other.data);
}
}
const flipConfig: MenuItemOptions = {
name: '上下翻转',
};
const BeaconEditMenu: ContextMenu = ContextMenu.init({
name: '信标编辑菜单',
groups: [
{
items: [flipConfig],
},
],
});
export class DrawBeaconInteraction extends GraphicInteractionPlugin<Beacon> {
static Name = 'beacon_draw_right_menu';
constructor(app: IGraphicApp) {
super(DrawBeaconInteraction.Name, app);
app.registerMenu(BeaconEditMenu);
}
static init(app: IGraphicApp) {
return new DrawBeaconInteraction(app);
}
filter(...grahpics: JlGraphic[]): Beacon[] | undefined {
return grahpics
.filter((g) => g.type === Beacon.Type)
.map((g) => g as Beacon);
}
bind(g: Beacon): void {
g.on('_rightclick', this.onContextMenu, this);
}
unbind(g: Beacon): void {
g.off('_rightclick', this.onContextMenu, this);
}
onContextMenu(e: FederatedMouseEvent) {
const target = e.target as DisplayObject;
const beacon = target.getGraphic() as Beacon;
this.app.updateSelected(beacon);
flipConfig.handler = () => {
beacon.datas.flip = !beacon.datas.flip;
beacon.repaint();
};
BeaconEditMenu.open(e.global);
}
}

View File

@ -22,6 +22,12 @@ import {
TrackLogicSectionTemplate,
} from 'src/graphics/trackLogicSection/TrackLogicSection';
import { TrackLogicSectionData } from './graphics/TrackLogicSectionInteraction';
import { Beacon, BeaconTemplate } from 'src/graphics/beacon/Beacon';
import {
BeaconData,
DrawBeaconInteraction,
} from './graphics/BeaconInteraction';
import { BeaconDraw } from 'src/graphics/beacon/BeaconDrawAssistant';
import {
initCommonDrawApp,
saveCommonDrawDatas,
@ -53,11 +59,12 @@ export const drawZdwxLayerList = [
...drawCommonLayerList,
{ label: '轨道区段', value: TrackSection.Type, defaultShow: false },
{ label: '轨道逻辑区段', value: TrackLogicSection.Type, defaultShow: false },
{ label: '信标', value: Beacon.Type, defaultShow: true },
];
function initZdwxShowLayer(app: IDrawApp) {
const showTypeList: string[] = [];
drawCommonLayerList.forEach((item) => {
drawZdwxLayerList.forEach((item) => {
if (item.defaultShow) {
showTypeList.push(item.value);
}
@ -94,6 +101,8 @@ export function initZdwxDrawApp(): IDrawApp {
app,
new TrackLogicSectionTemplate(new TrackLogicSectionData())
);
new BeaconDraw(app, new BeaconTemplate(new BeaconData()));
DrawBeaconInteraction.init(app);
app.addKeyboardListener(
new KeyListener({
value: 'KeyS',
@ -128,6 +137,9 @@ export async function loadZdwxDrawDatas(): Promise<IGraphicStorage> {
storage.trackLogicSections.forEach((logicSection) => {
datas.push(new TrackLogicSectionData(logicSection));
});
storage.beacons.forEach((beacon) => {
datas.push(new BeaconData(beacon));
});
refDevicesList = storage.stationRelateDeviceList;
return Promise.resolve({
canvasProperty: storage.canvas,
@ -153,6 +165,9 @@ export function saveZdwxDrawDatas(app: IDrawApp) {
storage.trackLogicSections.push(
(trackLogicSectionData as TrackLogicSectionData).data
);
} else if (Beacon.Type === g.type) {
const beaconData = (g as Beacon).saveData();
storage.beacons.push((beaconData as BeaconData).data);
}
});
const base64 = fromUint8Array(storage.serialize());

View File

@ -0,0 +1,74 @@
import { Color, Graphics } from 'pixi.js';
import { GraphicData, JlGraphic, JlGraphicTemplate } from 'src/jl-graphic';
import { graphicData } from 'src/protos/stationLayoutGraphics';
export interface IBeacon extends GraphicData {
get code(): string;
set code(v: string);
get type(): graphicData.Beacon.BeaconType;
set type(v: graphicData.Beacon.BeaconType);
get flip(): boolean;
set flip(v: boolean);
clone(): IBeacon;
copyFrom(data: IBeacon): void;
eq(other: IBeacon): boolean;
}
const beaconConsts = {
staticColor: 0xff00ff,
dynamicColor: 0x00ffff,
staticRadius: 6,
dynamicRadius: 8,
lineWidth: 2,
};
export class Beacon extends JlGraphic {
static Type = 'beacon';
body: Graphics = new Graphics();
constructor() {
super(Beacon.Type);
this.addChild(this.body);
}
get datas(): IBeacon {
return this.getDatas<IBeacon>();
}
get code(): string {
return this.datas.code;
}
doRepaint(): void {
this.body.clear();
let radius = beaconConsts.staticRadius;
if (this.datas.type === graphicData.Beacon.BeaconType.Static) {
this.body.lineStyle(
beaconConsts.lineWidth,
new Color(beaconConsts.staticColor)
);
} else if (this.datas.type === graphicData.Beacon.BeaconType.Dynamic) {
this.body.beginFill(beaconConsts.dynamicColor, 1);
radius = beaconConsts.dynamicRadius;
}
if (this.body.drawRegularPolygon) {
this.body.drawRegularPolygon(
0,
0,
radius,
3,
Math.PI * (this.datas.flip ? 0 : 1)
);
}
if (this.datas.type === graphicData.Beacon.BeaconType.Dynamic) {
this.body.endFill();
}
}
}
export class BeaconTemplate extends JlGraphicTemplate<Beacon> {
constructor(dataTemplate: IBeacon) {
super(Beacon.Type, { dataTemplate });
}
new(): Beacon {
const beacon = new Beacon();
beacon.loadData(this.datas);
return beacon;
}
}

View File

@ -0,0 +1,115 @@
import { DisplayObject, FederatedMouseEvent, IHitArea, Point } from 'pixi.js';
import {
AbsorbableLine,
AbsorbablePosition,
GraphicDrawAssistant,
GraphicInteractionPlugin,
GraphicTransformEvent,
IDrawApp,
JlGraphic,
} from 'src/jl-graphic';
import { Beacon, BeaconTemplate, IBeacon } from './Beacon';
export interface IBeaconDrawOptions {
newData: () => IBeacon;
}
export class BeaconDraw extends GraphicDrawAssistant<BeaconTemplate, IBeacon> {
_beacon: Beacon | null = null;
constructor(app: IDrawApp, template: BeaconTemplate) {
super(app, template, 'svguse:../../drawIcon.svg#icon-beacon', '信标Beacon');
BeaconInteraction.init(app);
}
public get beacon(): Beacon {
if (!this._beacon) {
this._beacon = this.graphicTemplate.new();
this._beacon.loadData(this.graphicTemplate.datas);
this.container.addChild(this._beacon);
}
return this._beacon;
}
onLeftUp(e: FederatedMouseEvent): void {
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
this.createAndStore(true);
}
redraw(p: Point): void {
this.beacon.repaint();
this.container.position.set(p.x, p.y);
}
prepareData(data: IBeacon): boolean {
data.transform = this.container.saveTransform();
return true;
}
}
/**
* 线
* @param beacon
*/
function buildAbsorbablePositions(beacon: Beacon): AbsorbablePosition[] {
const aps: AbsorbablePosition[] = [];
const beacons = beacon.queryStore.queryByType<Beacon>(Beacon.Type);
const canvas = beacon.getCanvas();
beacons.forEach((item) => {
if (item.id === beacon.id) {
return;
}
const ala = new AbsorbableLine(
new Point(item.x, 0),
new Point(item.x, canvas.height)
);
const alb = new AbsorbableLine(
new Point(0, item.y),
new Point(canvas.width, item.y)
);
aps.push(ala);
aps.push(alb);
});
return aps;
}
export class BeaconGraphicHitArea implements IHitArea {
beacon: Beacon;
constructor(beacon: Beacon) {
this.beacon = beacon;
}
contains(x: number, y: number): boolean {
return Math.pow(x, 2) + Math.pow(y, 2) <= 16;
}
}
export class BeaconInteraction extends GraphicInteractionPlugin<Beacon> {
static Name = 'beacon_transform';
constructor(app: IDrawApp) {
super(BeaconInteraction.Name, app);
}
static init(app: IDrawApp) {
return new BeaconInteraction(app);
}
filter(...grahpics: JlGraphic[]): Beacon[] | undefined {
return grahpics
.filter((g) => g.type === Beacon.Type)
.map((g) => g as Beacon);
}
bind(g: Beacon): void {
g.eventMode = 'static';
g.cursor = 'pointer';
g.scalable = true;
g.rotatable = true;
g.hitArea = new BeaconGraphicHitArea(g);
g.on('transformstart', this.transformstart, this);
}
unbind(g: Beacon): void {
g.eventMode = 'none';
g.scalable = false;
g.rotatable = false;
g.off('transformstart', this.transformstart, this);
}
transformstart(e: GraphicTransformEvent) {
const target = e.target as DisplayObject;
const beacon = target.getGraphic() as Beacon;
beacon.getGraphicApp().setOptions({
absorbablePositions: buildAbsorbablePositions(beacon),
});
}
}

View File

@ -301,6 +301,7 @@ import StationRelateDeviceConfig from 'src/components/draw-app/properties/Statio
import StationRelateDeviceList from 'src/components/draw-app/dialogs/StationRelateDeviceList.vue';
import ScreenDoorConfig from 'src/components/draw-app/properties/ScreenDoorConfig.vue';
import { PictureType } from 'src/protos/picture';
import { Beacon } from 'src/graphics/beacon/Beacon';
const $q = useQuasar();
const route = useRoute();
@ -427,6 +428,7 @@ onMounted(() => {
EsbButton.Type,
SlopeKiloMarker.Type,
CurvatureKiloMarker.Type,
Beacon.Type,
];
drawAssistantsTypes.forEach((type) => {
const drawAssistant = drawStore.getDrawApp().getDrawAssistant(type);
@ -515,7 +517,7 @@ function saveAllDrawDatas() {
base64 = saveJkDrawDatas(drawApp);
break;
case CategoryType.ZDWX:
base64 = saveJkDrawDatas(drawApp);
base64 = saveZdwxDrawDatas(drawApp);
break;
}
saveDrawToServer(base64);

View File

@ -992,7 +992,6 @@ export namespace state {
vobcState?: TrainVobcState;
trainKilometer?: number;
controlDelayTime?: number;
headDeviceUId?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -1042,9 +1041,6 @@ export namespace state {
if ("controlDelayTime" in data && data.controlDelayTime != undefined) {
this.controlDelayTime = data.controlDelayTime;
}
if ("headDeviceUId" in data && data.headDeviceUId != undefined) {
this.headDeviceUId = data.headDeviceUId;
}
}
}
get id() {
@ -1143,12 +1139,6 @@ export namespace state {
set controlDelayTime(value: number) {
pb_1.Message.setField(this, 15, value);
}
get headDeviceUId() {
return pb_1.Message.getFieldWithDefault(this, 16, "") as string;
}
set headDeviceUId(value: string) {
pb_1.Message.setField(this, 16, value);
}
static fromObject(data: {
id?: string;
up?: boolean;
@ -1165,7 +1155,6 @@ export namespace state {
vobcState?: ReturnType<typeof TrainVobcState.prototype.toObject>;
trainKilometer?: number;
controlDelayTime?: number;
headDeviceUId?: string;
}): TrainState {
const message = new TrainState({});
if (data.id != null) {
@ -1213,9 +1202,6 @@ export namespace state {
if (data.controlDelayTime != null) {
message.controlDelayTime = data.controlDelayTime;
}
if (data.headDeviceUId != null) {
message.headDeviceUId = data.headDeviceUId;
}
return message;
}
toObject() {
@ -1235,7 +1221,6 @@ export namespace state {
vobcState?: ReturnType<typeof TrainVobcState.prototype.toObject>;
trainKilometer?: number;
controlDelayTime?: number;
headDeviceUId?: string;
} = {};
if (this.id != null) {
data.id = this.id;
@ -1282,9 +1267,6 @@ export namespace state {
if (this.controlDelayTime != null) {
data.controlDelayTime = this.controlDelayTime;
}
if (this.headDeviceUId != null) {
data.headDeviceUId = this.headDeviceUId;
}
return data;
}
serialize(): Uint8Array;
@ -1321,8 +1303,6 @@ export namespace state {
writer.writeInt64(14, this.trainKilometer);
if (this.controlDelayTime != 0)
writer.writeInt64(15, this.controlDelayTime);
if (this.headDeviceUId.length)
writer.writeString(16, this.headDeviceUId);
if (!w)
return writer.getResultBuffer();
}
@ -1377,9 +1357,6 @@ export namespace state {
case 15:
message.controlDelayTime = reader.readInt64();
break;
case 16:
message.headDeviceUId = reader.readString();
break;
default: reader.skipField();
}
}

View File

@ -42,9 +42,10 @@ export namespace graphicData {
stationRelateDeviceList?: StationRelateDevice[];
sectionCodePointList?: SectionCodePoint[];
screenDoorConfig?: ScreenDoorConfig;
beacons?: Beacon[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4, 5, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34, 35], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4, 5, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34, 35, 37], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("canvas" in data && data.canvas != undefined) {
this.canvas = data.canvas;
@ -136,6 +137,9 @@ export namespace graphicData {
if ("screenDoorConfig" in data && data.screenDoorConfig != undefined) {
this.screenDoorConfig = data.screenDoorConfig;
}
if ("beacons" in data && data.beacons != undefined) {
this.beacons = data.beacons;
}
}
}
get canvas() {
@ -327,6 +331,12 @@ export namespace graphicData {
get has_screenDoorConfig() {
return pb_1.Message.getField(this, 36) != null;
}
get beacons() {
return pb_1.Message.getRepeatedWrapperField(this, Beacon, 37) as Beacon[];
}
set beacons(value: Beacon[]) {
pb_1.Message.setRepeatedWrapperField(this, 37, value);
}
static fromObject(data: {
canvas?: ReturnType<typeof Canvas.prototype.toObject>;
Platforms?: ReturnType<typeof Platform.prototype.toObject>[];
@ -358,6 +368,7 @@ export namespace graphicData {
stationRelateDeviceList?: ReturnType<typeof StationRelateDevice.prototype.toObject>[];
sectionCodePointList?: ReturnType<typeof SectionCodePoint.prototype.toObject>[];
screenDoorConfig?: ReturnType<typeof ScreenDoorConfig.prototype.toObject>;
beacons?: ReturnType<typeof Beacon.prototype.toObject>[];
}): RtssGraphicStorage {
const message = new RtssGraphicStorage({});
if (data.canvas != null) {
@ -450,6 +461,9 @@ export namespace graphicData {
if (data.screenDoorConfig != null) {
message.screenDoorConfig = ScreenDoorConfig.fromObject(data.screenDoorConfig);
}
if (data.beacons != null) {
message.beacons = data.beacons.map(item => Beacon.fromObject(item));
}
return message;
}
toObject() {
@ -484,6 +498,7 @@ export namespace graphicData {
stationRelateDeviceList?: ReturnType<typeof StationRelateDevice.prototype.toObject>[];
sectionCodePointList?: ReturnType<typeof SectionCodePoint.prototype.toObject>[];
screenDoorConfig?: ReturnType<typeof ScreenDoorConfig.prototype.toObject>;
beacons?: ReturnType<typeof Beacon.prototype.toObject>[];
} = {};
if (this.canvas != null) {
data.canvas = this.canvas.toObject();
@ -575,6 +590,9 @@ export namespace graphicData {
if (this.screenDoorConfig != null) {
data.screenDoorConfig = this.screenDoorConfig.toObject();
}
if (this.beacons != null) {
data.beacons = this.beacons.map((item: Beacon) => item.toObject());
}
return data;
}
serialize(): Uint8Array;
@ -641,6 +659,8 @@ export namespace graphicData {
writer.writeRepeatedMessage(35, this.sectionCodePointList, (item: SectionCodePoint) => item.serialize(writer));
if (this.has_screenDoorConfig)
writer.writeMessage(36, this.screenDoorConfig, () => this.screenDoorConfig.serialize(writer));
if (this.beacons.length)
writer.writeRepeatedMessage(37, this.beacons, (item: Beacon) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -740,6 +760,9 @@ export namespace graphicData {
case 36:
reader.readMessage(message.screenDoorConfig, () => message.screenDoorConfig = ScreenDoorConfig.deserialize(reader));
break;
case 37:
reader.readMessage(message.beacons, () => pb_1.Message.addToRepeatedWrapperField(message, 37, Beacon.deserialize(reader), Beacon));
break;
default: reader.skipField();
}
}
@ -6184,6 +6207,151 @@ export namespace graphicData {
return CurvatureKiloMarker.deserialize(bytes);
}
}
export class Beacon extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
common?: CommonInfo;
code?: string;
type?: Beacon.BeaconType;
flip?: boolean;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], 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 ("type" in data && data.type != undefined) {
this.type = data.type;
}
if ("flip" in data && data.flip != undefined) {
this.flip = data.flip;
}
}
}
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 type() {
return pb_1.Message.getFieldWithDefault(this, 3, Beacon.BeaconType.Static) as Beacon.BeaconType;
}
set type(value: Beacon.BeaconType) {
pb_1.Message.setField(this, 3, value);
}
get flip() {
return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean;
}
set flip(value: boolean) {
pb_1.Message.setField(this, 4, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
type?: Beacon.BeaconType;
flip?: boolean;
}): Beacon {
const message = new Beacon({});
if (data.common != null) {
message.common = CommonInfo.fromObject(data.common);
}
if (data.code != null) {
message.code = data.code;
}
if (data.type != null) {
message.type = data.type;
}
if (data.flip != null) {
message.flip = data.flip;
}
return message;
}
toObject() {
const data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
type?: Beacon.BeaconType;
flip?: boolean;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
}
if (this.code != null) {
data.code = this.code;
}
if (this.type != null) {
data.type = this.type;
}
if (this.flip != null) {
data.flip = this.flip;
}
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.type != Beacon.BeaconType.Static)
writer.writeEnum(3, this.type);
if (this.flip != false)
writer.writeBool(4, this.flip);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Beacon {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Beacon();
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:
message.type = reader.readEnum();
break;
case 4:
message.flip = reader.readBool();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Beacon {
return Beacon.deserialize(bytes);
}
}
export namespace Beacon {
export enum BeaconType {
Static = 0,
Dynamic = 1
}
}
export class Slope extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {