坡度公里标

This commit is contained in:
Yuan 2023-08-07 15:06:03 +08:00
parent f882c8dfb1
commit 961683116c
12 changed files with 195 additions and 142 deletions

@ -1 +1 @@
Subproject commit 86bf1f0c76ade5866afd8063e8f263ca9eda55a5
Subproject commit b62e9b13e4b667b8f5aa47cae3a4cb7181a4f40c

View File

@ -6,7 +6,18 @@ import { reactive, shallowRef, watchEffect } from 'vue';
const drawStore = useDrawStore();
const kiloMarkerModel = shallowRef(new SlopeKiloMarkerData());
const kilometerSystem = reactive({ coordinateSystem: '', kilometer: 0 });
const kilometerSystem = reactive([
{
coordinateSystem: '',
kilometer: 0,
direction: 0,
},
{
coordinateSystem: '',
kilometer: 0,
direction: 0,
},
]);
const CoordinateSystemOptions = [
{ label: '车辆段', value: 'DEPOT' },
@ -22,11 +33,24 @@ watchEffect(() => {
const kiloMarker = drawStore.selectedGraphic;
if (kiloMarker && kiloMarker instanceof SlopeKiloMarker) {
kiloMarkerModel.value = kiloMarker.saveData();
if (kiloMarkerModel.value.kilometerSystem.length > 0) {
kilometerSystem.forEach((ks, i) => {
ks.coordinateSystem =
kiloMarkerModel.value.kilometerSystem[i].coordinateSystem;
ks.kilometer = kiloMarkerModel.value.kilometerSystem[i].kilometer;
ks.direction = kiloMarkerModel.value.kilometerSystem[i].direction;
});
}
}
});
const onUpdate = () => {
const kiloMarker = drawStore.selectedGraphic as SlopeKiloMarker;
kiloMarkerModel.value.kilometerSystem = kilometerSystem.map((ks) => ({
coordinateSystem: ks.coordinateSystem,
kilometer: ks.kilometer,
direction: ks.direction,
}));
if (kiloMarker) {
drawStore
.getDrawApp()
@ -55,7 +79,7 @@ const onUpdate = () => {
/> -->
<q-select
outlined
v-model="kilometerSystem.coordinateSystem"
v-model="kilometerSystem[0].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@ -64,14 +88,40 @@ const onUpdate = () => {
></q-select>
<q-input
outlined
v-model.number="kilometerSystem.kilometer"
v-model.number="kilometerSystem[0].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="kiloMarkerModel.direction"
v-model="kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-select
outlined
class="q-mt-lg"
v-model="kilometerSystem[1].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
v-model.number="kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="kilometerSystem[1].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"

View File

@ -81,7 +81,7 @@
<script setup lang="ts">
import { SignalData } from 'src/drawApp/graphics/SignalInteraction';
import { Section } from 'src/graphics/section/Section';
import { Signal } from 'src/graphics/signal/Signal';
import { Direction, Signal } from 'src/graphics/signal/Signal';
import { Turnout } from 'src/graphics/turnout/Turnout';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { useDrawStore } from 'src/stores/draw-store';
@ -89,7 +89,11 @@ import { onMounted, reactive, watch } from 'vue';
const drawStore = useDrawStore();
const signalModel = reactive(new SignalData());
const kilometerSystem = reactive({ coordinateSystem: '', kilometer: 0 });
const kilometerSystem = reactive({
coordinateSystem: '',
kilometer: 0,
direction: Direction.LEFT,
});
const sectionList: { label: string; value: string }[] = reactive([]);
const turnoutList: { label: string; value: string }[] = reactive([]);
const refDevData = reactive({
@ -168,6 +172,7 @@ function onUpdate() {
signalModel.kilometerSystem = {
coordinateSystem: kilometerSystem.coordinateSystem,
kilometer: kilometerSystem.kilometer,
direction: kilometerSystem.direction,
};
if (refDevData.id) {
signalModel.refDev = new graphicData.RelatedRef({

View File

@ -80,6 +80,7 @@
<script setup lang="ts">
import { TurnoutData } from 'src/drawApp/graphics/TurnoutInteraction';
import { Section } from 'src/graphics/section/Section';
import { Direction } from 'src/graphics/signal/Signal';
import { Turnout } from 'src/graphics/turnout/Turnout';
import { useDrawStore } from 'src/stores/draw-store';
import { computed, reactive, shallowRef, watchEffect } from 'vue';
@ -93,8 +94,8 @@ const CoordinateSystemOptions = [
];
const turnoutModel = shallowRef(new TurnoutData());
const kilometerSystem = reactive([
{ coordinateSystem: '', kilometer: 0 },
{ coordinateSystem: '', kilometer: 0 },
{ coordinateSystem: '', kilometer: 0, direction: Direction.LEFT },
{ coordinateSystem: '', kilometer: 0, direction: Direction.LEFT },
]);
const sectionRelations = computed(() => {
@ -148,6 +149,7 @@ const onUpdate = () => {
turnoutModel.value.kilometerSystem = kilometerSystem.map((ks) => ({
coordinateSystem: ks.coordinateSystem,
kilometer: ks.kilometer,
direction: ks.direction,
}));
if (turnout) {
drawStore.getDrawApp().updateGraphicAndRecord(turnout, turnoutModel.value);

View File

@ -5,6 +5,7 @@ import {
} from 'src/graphics/slopeKiloMarker/SlopeKiloMarker';
import { GraphicDataBase } from './GraphicDataBase';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { KilometerSystem } from 'src/graphics/signal/Signal';
export class SlopeKiloMarkerData
extends GraphicDataBase
@ -32,17 +33,13 @@ export class SlopeKiloMarkerData
set code(v: string) {
this.data.code = v;
}
get direction(): graphicData.Direction {
return this.data.direction;
}
set direction(v: graphicData.Direction) {
this.data.direction = v;
}
get kilometerSystem(): graphicData.KilometerSystem {
get kilometerSystem(): KilometerSystem[] {
return this.data.kilometerSystem;
}
set kilometerSystem(v: graphicData.KilometerSystem) {
this.data.kilometerSystem = v;
set kilometerSystem(value: KilometerSystem[]) {
this.data.kilometerSystem = value.map(
(v) => new graphicData.KilometerSystem(v)
);
}
clone(): SlopeKiloMarkerData {

View File

@ -208,6 +208,7 @@ const showType = [
EsbButton.Type,
Transponder.Type,
TrainWindow.Type,
SlopeKiloMarker.Type,
Slope.Type,
];
export const drawLayerList = [

View File

@ -278,6 +278,9 @@ export async function loadLineDatas(app: GraphicApp) {
storage.transponders.forEach((transponder) => {
datas.push(new TransponderData(transponder));
});
storage.slopeKiloMarker.forEach((slopeKilometer) => {
datas.push(new SlopeKiloMarkerData(slopeKilometer));
});
await app.loadGraphic(datas);
const alllGraphic = (lineApp as GraphicApp).queryStore.getAllGraphics();

View File

@ -3,6 +3,7 @@ import { Graphics } from 'pixi.js';
export class KilometerMarker extends Graphics {
constructor() {
super();
this.paint();
}
paint() {
this.clear().lineStyle(1, '#fff').moveTo(0, -50).lineTo(0, 50);

View File

@ -10,12 +10,20 @@ import { LampMainBody } from './LampMainBody';
import { drawArrow, IRelatedRefData } from '../CommonGraphics';
import { SignalCode } from './SignalCode';
export enum Direction {
LEFT = 0,
RIGHT = 1,
}
export interface KilometerSystem {
get coordinateSystem(): string;
set coordinateSystem(v: string);
get kilometer(): number;
set kilometer(v: number);
get direction(): Direction;
set direction(v: Direction);
}
export interface ISignalData extends GraphicData {
get code(): string; // 编号
set code(v: string);

View File

@ -1,15 +1,16 @@
import { GraphicData, JlGraphic, JlGraphicTemplate } from 'src/jl-graphic';
import { KilometerMarker } from '../kilometerMarker/KilometerMarker';
import { KilometerSystem } from '../signal/Signal';
import { graphicData } from 'src/protos/stationLayoutGraphics';
export const KiloMarkerConsts = {
size: 50,
};
export interface ISlopeKiloMarkerData extends GraphicData {
get code(): string; // 编号
set code(v: string);
get direction(): graphicData.Direction;
set direction(v: graphicData.Direction);
get kilometerSystem(): KilometerSystem;
set kilometerSystem(v: KilometerSystem);
get kilometerSystem(): KilometerSystem[];
set kilometerSystem(v: KilometerSystem[]);
clone(): ISlopeKiloMarkerData;
copyFrom(data: ISlopeKiloMarkerData): void;
eq(other: ISlopeKiloMarkerData): boolean;
@ -18,6 +19,7 @@ export interface ISlopeKiloMarkerData extends GraphicData {
export class SlopeKiloMarker extends JlGraphic {
static Type = 'SlopeKiloMarker';
graphic: KilometerMarker;
size = KiloMarkerConsts.size;
constructor() {
super(SlopeKiloMarker.Type);
@ -30,6 +32,19 @@ export class SlopeKiloMarker extends JlGraphic {
doRepaint(): void {
this.graphic.paint();
}
getPoint(position: 'up' | 'down' | 'mid') {
const p = this.transform.position.clone();
if (position === 'up') {
p.y -= this.size;
return p;
} else if (position === 'down') {
p.y += this.size;
return p;
} else if (position === 'mid') {
return p;
}
}
}
export class SlopeKiloMarkerTemplate extends JlGraphicTemplate<SlopeKiloMarker> {

View File

@ -38,16 +38,36 @@ export class SlopeKiloMarkerDrawAssistant extends GraphicDrawAssistant<
constructor(app: JlDrawApp, template: SlopeKiloMarkerTemplate) {
super(app, template, 'sym_o_golf_course', '坡度公里标');
this.slopeKiloMarker = this.graphicTemplate.new();
this.container.addChild(this.slopeKiloMarker);
SlopeKiloMarkerInteractionPlugin.init(app);
}
onLeftDown(e: FederatedMouseEvent): void {
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
this.createAndStore(true);
}
redraw(cp: Point): void {
this.slopeKiloMarker.position.copyFrom(cp);
const list = this.app.queryStore.queryByType<SlopeKiloMarker>(
SlopeKiloMarker.Type
);
const ys = list.reduce<number[]>((prev, curr, i) => {
const currentY = curr.datas.transform.position.y;
if (!prev.includes(currentY)) {
return [currentY, ...prev];
} else {
return prev;
}
}, []);
if (list.length) {
const matchY = ys.find(
(y) => Math.abs(cp.y - y) <= this.slopeKiloMarker.size
);
if (matchY) {
this.container.position.set(cp.x, matchY);
} else {
this.container.position.set(cp.x, cp.y);
}
}
}
prepareData(data: ISlopeKiloMarkerData): boolean {
data.transform = this.container.saveTransform();

View File

@ -2950,6 +2950,7 @@ export namespace graphicData {
transponderType?: number;
index?: number;
kilometerSystem?: KilometerSystem;
TransponderRef?: RelatedRef;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -2969,6 +2970,9 @@ export namespace graphicData {
if ("kilometerSystem" in data && data.kilometerSystem != undefined) {
this.kilometerSystem = data.kilometerSystem;
}
if ("TransponderRef" in data && data.TransponderRef != undefined) {
this.TransponderRef = data.TransponderRef;
}
}
}
get common() {
@ -3007,12 +3011,22 @@ export namespace graphicData {
get has_kilometerSystem() {
return pb_1.Message.getField(this, 5) != null;
}
get TransponderRef() {
return pb_1.Message.getWrapperField(this, RelatedRef, 6) as RelatedRef;
}
set TransponderRef(value: RelatedRef) {
pb_1.Message.setWrapperField(this, 6, value);
}
get has_TransponderRef() {
return pb_1.Message.getField(this, 6) != null;
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
transponderType?: number;
index?: number;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
TransponderRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
}): Transponder {
const message = new Transponder({});
if (data.common != null) {
@ -3030,6 +3044,9 @@ export namespace graphicData {
if (data.kilometerSystem != null) {
message.kilometerSystem = KilometerSystem.fromObject(data.kilometerSystem);
}
if (data.TransponderRef != null) {
message.TransponderRef = RelatedRef.fromObject(data.TransponderRef);
}
return message;
}
toObject() {
@ -3039,6 +3056,7 @@ export namespace graphicData {
transponderType?: number;
index?: number;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
TransponderRef?: ReturnType<typeof RelatedRef.prototype.toObject>;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -3055,6 +3073,9 @@ export namespace graphicData {
if (this.kilometerSystem != null) {
data.kilometerSystem = this.kilometerSystem.toObject();
}
if (this.TransponderRef != null) {
data.TransponderRef = this.TransponderRef.toObject();
}
return data;
}
serialize(): Uint8Array;
@ -3071,6 +3092,8 @@ export namespace graphicData {
writer.writeInt32(4, this.index);
if (this.has_kilometerSystem)
writer.writeMessage(5, this.kilometerSystem, () => this.kilometerSystem.serialize(writer));
if (this.has_TransponderRef)
writer.writeMessage(6, this.TransponderRef, () => this.TransponderRef.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -3095,6 +3118,9 @@ export namespace graphicData {
case 5:
reader.readMessage(message.kilometerSystem, () => message.kilometerSystem = KilometerSystem.deserialize(reader));
break;
case 6:
reader.readMessage(message.TransponderRef, () => message.TransponderRef = RelatedRef.deserialize(reader));
break;
default: reader.skipField();
}
}
@ -4579,10 +4605,10 @@ export namespace graphicData {
constructor(data?: any[] | {
common?: CommonInfo;
code?: string;
kilometerSystem?: KilometerSystem;
kilometerSystem?: KilometerSystem[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("common" in data && data.common != undefined) {
this.common = data.common;
@ -4611,18 +4637,15 @@ export namespace graphicData {
pb_1.Message.setField(this, 2, value);
}
get kilometerSystem() {
return pb_1.Message.getWrapperField(this, KilometerSystem, 4) as KilometerSystem;
return pb_1.Message.getRepeatedWrapperField(this, KilometerSystem, 4) as KilometerSystem[];
}
set kilometerSystem(value: KilometerSystem) {
pb_1.Message.setWrapperField(this, 4, value);
}
get has_kilometerSystem() {
return pb_1.Message.getField(this, 4) != null;
set kilometerSystem(value: KilometerSystem[]) {
pb_1.Message.setRepeatedWrapperField(this, 4, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>[];
}): SlopeKiloMarker {
const message = new SlopeKiloMarker({});
if (data.common != null) {
@ -4632,7 +4655,7 @@ export namespace graphicData {
message.code = data.code;
}
if (data.kilometerSystem != null) {
message.kilometerSystem = KilometerSystem.fromObject(data.kilometerSystem);
message.kilometerSystem = data.kilometerSystem.map(item => KilometerSystem.fromObject(item));
}
return message;
}
@ -4640,7 +4663,7 @@ export namespace graphicData {
const data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>[];
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -4649,7 +4672,7 @@ export namespace graphicData {
data.code = this.code;
}
if (this.kilometerSystem != null) {
data.kilometerSystem = this.kilometerSystem.toObject();
data.kilometerSystem = this.kilometerSystem.map((item: KilometerSystem) => item.toObject());
}
return data;
}
@ -4661,8 +4684,8 @@ export namespace graphicData {
writer.writeMessage(1, this.common, () => this.common.serialize(writer));
if (this.code.length)
writer.writeString(2, this.code);
if (this.has_kilometerSystem)
writer.writeMessage(4, this.kilometerSystem, () => this.kilometerSystem.serialize(writer));
if (this.kilometerSystem.length)
writer.writeRepeatedMessage(4, this.kilometerSystem, (item: KilometerSystem) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -4679,7 +4702,7 @@ export namespace graphicData {
message.code = reader.readString();
break;
case 4:
reader.readMessage(message.kilometerSystem, () => message.kilometerSystem = KilometerSystem.deserialize(reader));
reader.readMessage(message.kilometerSystem, () => pb_1.Message.addToRepeatedWrapperField(message, 4, KilometerSystem.deserialize(reader), KilometerSystem));
break;
default: reader.skipField();
}
@ -4698,10 +4721,10 @@ export namespace graphicData {
constructor(data?: any[] | {
common?: CommonInfo;
code?: string;
kilometerSystem?: KilometerSystem;
kilometerSystem?: KilometerSystem[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("common" in data && data.common != undefined) {
this.common = data.common;
@ -4730,18 +4753,15 @@ export namespace graphicData {
pb_1.Message.setField(this, 2, value);
}
get kilometerSystem() {
return pb_1.Message.getWrapperField(this, KilometerSystem, 4) as KilometerSystem;
return pb_1.Message.getRepeatedWrapperField(this, KilometerSystem, 4) as KilometerSystem[];
}
set kilometerSystem(value: KilometerSystem) {
pb_1.Message.setWrapperField(this, 4, value);
}
get has_kilometerSystem() {
return pb_1.Message.getField(this, 4) != null;
set kilometerSystem(value: KilometerSystem[]) {
pb_1.Message.setRepeatedWrapperField(this, 4, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>[];
}): turningRadiusKiloMarker {
const message = new turningRadiusKiloMarker({});
if (data.common != null) {
@ -4751,7 +4771,7 @@ export namespace graphicData {
message.code = data.code;
}
if (data.kilometerSystem != null) {
message.kilometerSystem = KilometerSystem.fromObject(data.kilometerSystem);
message.kilometerSystem = data.kilometerSystem.map(item => KilometerSystem.fromObject(item));
}
return message;
}
@ -4759,7 +4779,7 @@ export namespace graphicData {
const data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>[];
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -4768,7 +4788,7 @@ export namespace graphicData {
data.code = this.code;
}
if (this.kilometerSystem != null) {
data.kilometerSystem = this.kilometerSystem.toObject();
data.kilometerSystem = this.kilometerSystem.map((item: KilometerSystem) => item.toObject());
}
return data;
}
@ -4780,8 +4800,8 @@ export namespace graphicData {
writer.writeMessage(1, this.common, () => this.common.serialize(writer));
if (this.code.length)
writer.writeString(2, this.code);
if (this.has_kilometerSystem)
writer.writeMessage(4, this.kilometerSystem, () => this.kilometerSystem.serialize(writer));
if (this.kilometerSystem.length)
writer.writeRepeatedMessage(4, this.kilometerSystem, (item: KilometerSystem) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -4798,7 +4818,7 @@ export namespace graphicData {
message.code = reader.readString();
break;
case 4:
reader.readMessage(message.kilometerSystem, () => message.kilometerSystem = KilometerSystem.deserialize(reader));
reader.readMessage(message.kilometerSystem, () => pb_1.Message.addToRepeatedWrapperField(message, 4, KilometerSystem.deserialize(reader), KilometerSystem));
break;
default: reader.skipField();
}
@ -4816,34 +4836,22 @@ export namespace graphicData {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
common?: CommonInfo;
code?: string;
points?: Point[];
slopeNumber?: string;
slopeDirection?: string;
slopeLong?: number;
slopeNumber?: number;
refDeviceId?: string[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 7], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 4], 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 ("slopeNumber" in data && data.slopeNumber != undefined) {
this.slopeNumber = data.slopeNumber;
}
if ("slopeDirection" in data && data.slopeDirection != undefined) {
this.slopeDirection = data.slopeDirection;
}
if ("slopeLong" in data && data.slopeLong != undefined) {
this.slopeLong = data.slopeLong;
}
if ("refDeviceId" in data && data.refDeviceId != undefined) {
this.refDeviceId = data.refDeviceId;
}
@ -4858,70 +4866,40 @@ export namespace graphicData {
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[];
return pb_1.Message.getRepeatedWrapperField(this, Point, 2) as Point[];
}
set points(value: Point[]) {
pb_1.Message.setRepeatedWrapperField(this, 3, value);
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
get slopeNumber() {
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
}
set slopeNumber(value: string) {
pb_1.Message.setField(this, 4, value);
}
get slopeDirection() {
return pb_1.Message.getFieldWithDefault(this, 5, "") as string;
}
set slopeDirection(value: string) {
pb_1.Message.setField(this, 5, value);
}
get slopeLong() {
return pb_1.Message.getFieldWithDefault(this, 6, 0) as number;
}
set slopeLong(value: number) {
pb_1.Message.setField(this, 6, value);
set slopeNumber(value: number) {
pb_1.Message.setField(this, 3, value);
}
get refDeviceId() {
return pb_1.Message.getFieldWithDefault(this, 7, []) as string[];
return pb_1.Message.getFieldWithDefault(this, 4, []) as string[];
}
set refDeviceId(value: string[]) {
pb_1.Message.setField(this, 7, value);
pb_1.Message.setField(this, 4, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
points?: ReturnType<typeof Point.prototype.toObject>[];
slopeNumber?: string;
slopeDirection?: string;
slopeLong?: number;
slopeNumber?: number;
refDeviceId?: string[];
}): Slope {
const message = new Slope({});
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.slopeNumber != null) {
message.slopeNumber = data.slopeNumber;
}
if (data.slopeDirection != null) {
message.slopeDirection = data.slopeDirection;
}
if (data.slopeLong != null) {
message.slopeLong = data.slopeLong;
}
if (data.refDeviceId != null) {
message.refDeviceId = data.refDeviceId;
}
@ -4930,31 +4908,19 @@ export namespace graphicData {
toObject() {
const data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
points?: ReturnType<typeof Point.prototype.toObject>[];
slopeNumber?: string;
slopeDirection?: string;
slopeLong?: number;
slopeNumber?: number;
refDeviceId?: 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.slopeNumber != null) {
data.slopeNumber = this.slopeNumber;
}
if (this.slopeDirection != null) {
data.slopeDirection = this.slopeDirection;
}
if (this.slopeLong != null) {
data.slopeLong = this.slopeLong;
}
if (this.refDeviceId != null) {
data.refDeviceId = this.refDeviceId;
}
@ -4966,18 +4932,12 @@ export namespace graphicData {
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.slopeNumber.length)
writer.writeString(4, this.slopeNumber);
if (this.slopeDirection.length)
writer.writeString(5, this.slopeDirection);
if (this.slopeLong != 0)
writer.writeInt64(6, this.slopeLong);
writer.writeRepeatedMessage(2, this.points, (item: Point) => item.serialize(writer));
if (this.slopeNumber != 0)
writer.writeSint32(3, this.slopeNumber);
if (this.refDeviceId.length)
writer.writeRepeatedString(7, this.refDeviceId);
writer.writeRepeatedString(4, this.refDeviceId);
if (!w)
return writer.getResultBuffer();
}
@ -4991,22 +4951,13 @@ export namespace graphicData {
reader.readMessage(message.common, () => message.common = CommonInfo.deserialize(reader));
break;
case 2:
message.code = reader.readString();
reader.readMessage(message.points, () => pb_1.Message.addToRepeatedWrapperField(message, 2, Point.deserialize(reader), Point));
break;
case 3:
reader.readMessage(message.points, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Point.deserialize(reader), Point));
message.slopeNumber = reader.readSint32();
break;
case 4:
message.slopeNumber = reader.readString();
break;
case 5:
message.slopeDirection = reader.readString();
break;
case 6:
message.slopeLong = reader.readInt64();
break;
case 7:
pb_1.Message.addToRepeatedField(message, 7, reader.readString());
pb_1.Message.addToRepeatedField(message, 4, reader.readString());
break;
default: reader.skipField();
}