This commit is contained in:
fan 2023-06-08 10:22:18 +08:00
commit 2d9a400266
10 changed files with 577 additions and 44 deletions

View File

@ -0,0 +1,75 @@
import { ITrunoutData } from 'src/graphics/turnout/Turnout';
import * as pb_1 from 'google-protobuf';
import { GraphicDataBase } from './GraphicDataBase';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { IPointData } from 'pixi.js';
import { GraphicData } from 'src/jl-graphic';
export class TurnoutData extends GraphicDataBase implements ITrunoutData {
constructor(data?: graphicData.Turnout) {
let turnout;
if (!data) {
turnout = new graphicData.Turnout({
common: GraphicDataBase.defaultCommonInfo(),
});
} else {
turnout = data;
}
super(turnout);
}
get data(): graphicData.Turnout {
return this.getData<graphicData.Turnout>();
}
get code(): string {
return this.data.code;
}
set code(v: string) {
this.data.code = v;
}
get lineWidth(): number {
return this.data.lineWidth;
}
set lineWidth(v: number) {
this.data.lineWidth = v;
}
get lineColor(): string {
return this.data.lineColor;
}
set lineColor(v: string) {
this.data.lineColor = v;
}
get forkPoint(): IPointData {
return this.data.forkPoint;
}
set forkPoint(v: IPointData) {
this.data.forkPoint = new graphicData.Point({ x: v.x, y: v.y });
}
get pointA(): IPointData {
return this.data.pointA;
}
set pointA(v: IPointData) {
this.data.pointA = new graphicData.Point({ x: v.x, y: v.y });
}
get pointB(): IPointData {
return this.data.pointB;
}
set pointB(v: IPointData) {
this.data.pointB = new graphicData.Point({ x: v.x, y: v.y });
}
get pointC(): IPointData {
return this.data.pointC;
}
set pointC(v: IPointData) {
this.data.pointC = new graphicData.Point({ x: v.x, y: v.y });
}
clone(): TurnoutData {
return new TurnoutData(this.data.cloneMessage());
}
copyFrom(data: TurnoutData): void {
pb_1.Message.copyInto(data.data, this.data);
}
eq(other: TurnoutData): boolean {
return pb_1.Message.equals(this.data, other.data);
}
}

View File

@ -32,6 +32,9 @@ import { StationData } from './graphics/StationInteraction';
import { TrainData } from './graphics/TrainInteraction';
import { SignalData } from './graphics/SignalInteraction';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { Turnout } from 'src/graphics/turnout/Turnout';
import { TurnoutDraw } from 'src/graphics/turnout/TurnoutDrawAssistant';
import { TurnoutData } from './graphics/TurnoutInteraction';
import { saveDraft, getDraft } from 'src/api/DraftApi';
import { useDrawStore } from 'src/stores/draw-store';
import { successNotify, errorNotify } from '../utils/CommonNotify';
@ -115,6 +118,9 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
new SignalDraw(app, () => {
return new SignalData();
}),
new TurnoutDraw(app, () => {
return new TurnoutData();
}),
],
});
@ -146,7 +152,16 @@ export function initDrawApp(dom: HTMLElement): JlDrawApp {
);
app.addKeyboardListener(
new KeyListener({
value: 'KeyS',
value: 'KeyT',
onPress: () => {
console.log(app.interactionPlugin(Turnout.Type));
app.interactionPlugin(Turnout.Type).resume();
},
})
);
app.addKeyboardListener(
new KeyListener({
value: 'KeyO',
onPress: () => {
app.interactionPlugin(Station.Type).resume();
},
@ -201,6 +216,9 @@ export function saveDrawDatas(app: JlDrawApp) {
} else if (Train.Type === g.type) {
const trainData = (g as Train).saveData();
storage.train.push((trainData as TrainData).data);
} else if (Turnout.Type === g.type) {
const turnoutData = (g as Turnout).saveData();
storage.turnouts.push((turnoutData as TurnoutData).data);
} else if (Signal.Type === g.type) {
const signalData = (g as Signal).saveData();
storage.signals.push((signalData as SignalData).data);
@ -258,6 +276,9 @@ export async function loadDrawDatas(app: GraphicApp) {
storage.train.forEach((train) => {
datas.push(new TrainData(train));
});
storage.turnouts.forEach((turnout) => {
datas.push(new TurnoutData(turnout));
});
storage.signals.forEach((signal) => {
datas.push(new SignalData(signal));
});

View File

@ -1,53 +1,120 @@
import { Color, Graphics, IPointData } from 'pixi.js';
import { GraphicData, JlGraphic } from 'src/jl-graphic';
import {
GraphicData,
GraphicState,
JlGraphic,
JlGraphicTemplate,
VectorText,
} from 'src/jl-graphic';
export interface ITrunoutData extends GraphicData {
get code(): string;
set code(code: string);
get lineWidth(): number;
set lineWidth(code: number);
set lineWidth(width: number);
get lineColor(): string;
set lineColor(code: string);
set lineColor(color: string);
get forkPoint(): IPointData;
set forkPoint(point: IPointData);
get pointA(): IPointData;
set pointA(code: IPointData);
set pointA(point: IPointData);
get pointB(): IPointData;
set pointB(code: IPointData);
set pointB(point: IPointData);
get pointC(): IPointData;
set pointC(code: IPointData);
set pointC(point: IPointData);
clone(): ITrunoutData;
copyFrom(data: ITrunoutData): void;
eq(other: ITrunoutData): boolean;
}
export enum TurnoutPosition {
NORMAL = 0,
REVERSE = 1,
}
export interface ITurnoutState extends GraphicState {
position: TurnoutPosition;
}
export class Turnout extends JlGraphic {
static Type = 'Turnout';
graphics: {
forkPoint: {
AB: Graphics;
AC: Graphics;
};
fork: Graphics;
sections: Graphics;
label: VectorText;
};
constructor() {
super(Turnout.Type);
this.graphics = {
forkPoint: { AB: new Graphics(), AC: new Graphics() },
fork: new Graphics(),
sections: new Graphics(),
label: new VectorText(),
};
this.addChild(this.graphics.fork);
this.addChild(this.graphics.sections);
this.graphics.label.anchor.set(0.5);
this.graphics.label.style.fill = '#0f0';
this.graphics.label.setVectorFontSize(16);
this.addChild(this.graphics.label);
}
get datas(): ITrunoutData {
return this.getDatas<ITrunoutData>();
}
get states(): ITurnoutState {
return this.getStates<ITurnoutState>();
}
doRepaint(): void {
const { pointA, pointB, pointC } = this.datas;
const { pointA, pointB, pointC, forkPoint } = this.datas;
const intersectB = Turnout.getIntersectionPoint(forkPoint, 20, pointB);
const intersectC = Turnout.getIntersectionPoint(forkPoint, 20, pointC);
const forkPoint: IPointData = {
x: pointA.x + (pointB.x - pointA.x),
y: pointA.y + (pointB.y - pointA.y),
};
this.graphics.sections
.clear()
.lineStyle(this.datas.lineWidth, new Color(this.datas.lineColor))
.moveTo(pointA.x, pointA.y)
.lineTo(forkPoint.x, forkPoint.y)
.moveTo(pointB.x, pointB.y)
.lineTo(intersectB.x, intersectB.y)
.moveTo(pointC.x, pointC.y)
.lineTo(intersectC.x, intersectC.y);
// this.lineGraphic.clear();
// this.lineGraphic.lineStyle(this.datas.lineWidth, new Color());
this.graphics.fork
.clear()
.lineStyle(this.datas.lineWidth, new Color(this.datas.lineColor))
.moveTo(forkPoint.x, forkPoint.y)
.lineTo(intersectB.x, intersectB.y);
this.graphics.label.text = this.datas.code;
this.graphics.label.position.set(
this.datas.forkPoint.x + 20,
this.datas.forkPoint.y + 20
);
}
static getIntersectionPoint(
c: IPointData,
r: number,
p: IPointData
): IPointData {
const len = Math.sqrt((c.x - p.x) ** 2 + (c.y - p.y) ** 2);
const scale = r / len;
return { x: c.x + scale * (p.x - c.x), y: c.y + scale * (p.y - c.y) };
}
}
export class TurnoutTemplate extends JlGraphicTemplate<Turnout> {
lineWidth: number;
lineColor: string;
constructor() {
super(Turnout.Type);
this.lineWidth = 5;
this.lineColor = '#5578b6';
}
new() {
return new Turnout();
}
}

View File

@ -0,0 +1,144 @@
import {
DraggablePoint,
GraphicApp,
GraphicDrawAssistant,
GraphicInteractionPlugin,
JlDrawApp,
JlGraphic,
linePoint,
} from 'src/jl-graphic';
import { ITrunoutData, Turnout, TurnoutTemplate } from './Turnout';
import {
DisplayObject,
FederatedMouseEvent,
Graphics,
IHitArea,
IPointData,
Point,
} from 'pixi.js';
import { PolylineEditPlugin } from 'src/jl-graphic/plugins/GraphicEditPlugin';
export class TurnoutDraw extends GraphicDrawAssistant<
TurnoutTemplate,
ITrunoutData
> {
graphic = new Graphics();
point: Point = new Point(0, 0);
constructor(app: JlDrawApp, createData: () => ITrunoutData) {
super(app, new TurnoutTemplate(), createData, Turnout.Type, '道岔Turnout');
this.container.addChild(this.graphic);
}
onLeftDown(e: FederatedMouseEvent): void {
console.log(e);
this.createAndStore(true);
}
prepareData(data: ITrunoutData): boolean {
data.forkPoint = this.point;
data.lineColor = this.graphicTemplate.lineColor;
data.lineWidth = this.graphicTemplate.lineWidth;
data.forkPoint = this.point;
const { pointA, pointB, pointC } = this.getDefaultEndPoint(this.point);
data.pointA = pointA;
data.pointB = pointB;
data.pointC = pointC;
data.code = 'AAA';
return true;
}
getDefaultEndPoint(p: IPointData): {
pointA: IPointData;
pointB: IPointData;
pointC: IPointData;
} {
return {
pointA: new Point(p.x + 50, p.y),
pointB: new Point(p.x - 50, p.y),
pointC: new Point(p.x - 50, p.y - 50),
};
}
redraw(cp: Point): void {
const { pointA, pointB, pointC } = this.getDefaultEndPoint(cp);
const intersectC = Turnout.getIntersectionPoint(cp, 20, pointC);
this.graphic
.clear()
.lineStyle(this.graphicTemplate.lineWidth, this.graphicTemplate.lineColor)
.moveTo(pointA.x, pointA.y)
.lineTo(cp.x, cp.y)
.moveTo(pointB.x, pointB.y)
.lineTo(cp.x, cp.y)
.moveTo(pointC.x, pointC.y)
.lineTo(intersectC.x, intersectC.y);
this.point.set(cp.x, cp.y);
}
}
export class TurnoutHitArea implements IHitArea {
turnout: Turnout;
constructor(turnout: Turnout) {
this.turnout = turnout;
}
contains(x: number, y: number): boolean {
const { pointA, pointB, pointC, forkPoint } = this.turnout.datas;
return (
linePoint(pointA, forkPoint, { x, y }, this.turnout.datas.lineWidth) ||
linePoint(pointB, forkPoint, { x, y }, this.turnout.datas.lineWidth) ||
linePoint(pointC, forkPoint, { x, y }, this.turnout.datas.lineWidth)
);
}
}
// function onEditPointCreate(
// g: ILineGraphic,
// dp: DraggablePoint,
// index: number
// ): void {
// const link = g as Link;
// if (index === 0 || index == link.datas.points.length - 1) {
// // 端点
// dp.on('transformstart', (e: GraphicTransformEvent) => {
// if (e.isShift()) {
// link.getGraphicApp().setOptions({
// absorbablePositions: buildAbsorbablePositions(link),
// });
// }
// });
// }
// }
export class TurnoutPointsEditPlugin extends GraphicInteractionPlugin<Turnout> {
static Name = 'TurnoutPointsDrag';
constructor(app: GraphicApp) {
super(TurnoutPointsEditPlugin.Name, app);
}
bind(g: Turnout): void {
g.graphics.sections.eventMode = 'static';
g.graphics.sections.cursor = 'pointer';
g.graphics.fork.eventMode = 'static';
g.graphics.fork.cursor = 'pointer';
g.hitArea = new TurnoutHitArea(g);
g.on('selected', this.onSelected, this);
}
unbind(g: Turnout): void {
g.off('selected', this.onSelected, this);
}
onSelected(g: DisplayObject) {
console.log(g);
// const turnout = g as Turnout;
// let editPlugin = turnout.getAssistantAppend<PolylineEditPlugin>(
// PolylineEditPlugin.Name
// );
// if (!editPlugin) {
// // editPlugin = new PolylineEditPlugin(turnout, { onEditPointCreate });
// // turnout.addAssistantAppend(editPlugin);
// }
}
filter(...grahpics: JlGraphic[]): Turnout[] | undefined {
return grahpics.filter((g) => g.type == Turnout.Type) as Turnout[];
}
}

View File

@ -894,7 +894,8 @@ export class GraphicApp extends EventEmitter<GraphicAppEvents> {
}
}
this.interactionPluginMap.forEach((plugin) => {
plugin.pause();
// plugin.pause();
this.doPauseInteractionPlugin(plugin);
});
this.canvas.destroy(true);
this.viewport.destroy();

View File

@ -2,9 +2,22 @@
<q-layout view="hHh LpR fFf">
<q-header reveal class="bg-primary text-white">
<q-toolbar>
<q-btn dense flat round icon="menu" @click="toggleLeftDrawer" />
<q-toolbar-title>
<q-toolbar-title class="q-gutter-sm">
<q-btn color="accent" label="功能菜单">
<q-menu>
<q-list style="min-width: 100px">
<q-item clickable v-close-popup @click="saveAllDrawDatas">
<q-item-section>保存并校验</q-item-section>
</q-item>
<!-- <q-item clickable v-close-popup>
<q-item-section>另存为</q-item-section>
</q-item> -->
<q-item clickable v-close-popup>
<q-item-section>一键关联</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
<q-btn-toggle
v-model="selectUtil"
color="brown"
@ -23,7 +36,7 @@
</template>
</q-btn-toggle>
</q-toolbar-title>
<q-btn color="info" label="返回" @click="backConfirm" />
<q-btn dense flat round icon="menu" @click="toggleRightDrawer" />
</q-toolbar>
<q-resize-observer @resize="onHeaderResize" />
@ -121,26 +134,19 @@
<script setup lang="ts">
import DrawProperties from 'src/components/draw-app/DrawProperties.vue';
import { getDrawApp, loadDrawDatas } from 'src/drawApp';
import { getDrawApp, loadDrawDatas, saveDrawDatas } from 'src/drawApp';
import { JlDrawApp } from 'src/jl-graphic';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, onUnmounted, reactive, ref } from 'vue';
import { useRoute } from 'vue-router';
import { useRoute, useRouter } from 'vue-router';
const route = useRoute();
const selectUtil = ref();
const utilsOption: ControlItem[] = reactive([]);
const drawSelect = (item: string) => {
getDrawApp()?.interactionPlugin(item).resume();
};
const router = useRouter();
const drawStore = useDrawStore();
const leftDrawerOpen = ref(false);
const rightDrawerOpen = ref(false);
function toggleLeftDrawer() {
leftDrawerOpen.value = !leftDrawerOpen.value;
onResize();
}
function toggleRightDrawer() {
rightDrawerOpen.value = !rightDrawerOpen.value;
onResize();
@ -148,6 +154,12 @@ function toggleRightDrawer() {
const link = ref('outbox');
//
const selectUtil = ref();
const utilsOption: ControlItem[] = reactive([]);
const drawSelect = (item: string) => {
getDrawApp()?.interactionPlugin(item).resume();
};
class ControlItem {
value: string;
slot: string;
@ -229,6 +241,14 @@ function onResize() {
drawApp.onDomResize(canvasWidth.value, canvasHeight.value);
}
}
function saveAllDrawDatas() {
const drawApp = getDrawApp();
saveDrawDatas(drawApp as JlDrawApp);
}
function backConfirm() {
router.go(-1);
}
onUnmounted(() => {
drawStore.destroy();

View File

@ -1,6 +1,7 @@
<template>
<q-layout view="hHh Lpr lFf">
<q-header elevated>
<q-resize-observer @resize="onHeaderResize" />
<q-toolbar>
<q-btn
flat
@ -33,13 +34,16 @@
</q-drawer>
<q-page-container>
<router-view />
<q-resize-observer @resize="onResize" />
<q-scroll-area :style="{ height: scrollHeight + 'px' }">
<router-view :sizeHeight="scrollHeight" />
</q-scroll-area>
</q-page-container>
</q-layout>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { ref, reactive } from 'vue';
import SysMenu from 'src/components/SysMenu.vue';
const leftDrawerOpen = ref(false);
@ -47,4 +51,13 @@ const leftDrawerOpen = ref(false);
function toggleLeftDrawer() {
leftDrawerOpen.value = !leftDrawerOpen.value;
}
const scrollHeight = ref(100);
function onResize() {
scrollHeight.value = window.innerHeight - headerSize.height;
}
const headerSize = reactive({} as { width: number; height: number });
function onHeaderResize(size: { width: number; height: number }) {
headerSize.width = size.width;
headerSize.height = size.height;
}
</script>

View File

@ -3,6 +3,7 @@
<q-table
ref="tableRef"
title="草稿图"
:style="{ height: tableHeight + 'px' }"
:rows="rows"
:columns="columnDefs"
row-key="id"
@ -103,7 +104,7 @@
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import { ref, reactive, onMounted, computed } from 'vue';
import { useQuasar, type QTableColumn } from 'quasar';
import {
pageQuery,
@ -114,6 +115,17 @@ import {
const $q = useQuasar();
const props = withDefaults(
defineProps<{
sizeHeight: number;
}>(),
{ sizeHeight: 500 }
);
const tableHeight = computed(() => {
return props.sizeHeight - 32;
});
onMounted(() => {
tableRef.value.requestServerInteraction();
});

View File

@ -16,9 +16,10 @@ export namespace graphicData {
Rects?: Rect[];
train?: Train[];
signals?: Signal[];
turnouts?: Turnout[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6, 7, 8], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6, 7, 8, 9], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("canvas" in data && data.canvas != undefined) {
this.canvas = data.canvas;
@ -44,6 +45,9 @@ export namespace graphicData {
if ("signals" in data && data.signals != undefined) {
this.signals = data.signals;
}
if ("turnouts" in data && data.turnouts != undefined) {
this.turnouts = data.turnouts;
}
}
}
get canvas() {
@ -97,6 +101,12 @@ export namespace graphicData {
set signals(value: Signal[]) {
pb_1.Message.setRepeatedWrapperField(this, 8, value);
}
get turnouts() {
return pb_1.Message.getRepeatedWrapperField(this, Turnout, 9) as Turnout[];
}
set turnouts(value: Turnout[]) {
pb_1.Message.setRepeatedWrapperField(this, 9, value);
}
static fromObject(data: {
canvas?: ReturnType<typeof Canvas.prototype.toObject>;
links?: ReturnType<typeof Link.prototype.toObject>[];
@ -106,6 +116,7 @@ export namespace graphicData {
Rects?: ReturnType<typeof Rect.prototype.toObject>[];
train?: ReturnType<typeof Train.prototype.toObject>[];
signals?: ReturnType<typeof Signal.prototype.toObject>[];
turnouts?: ReturnType<typeof Turnout.prototype.toObject>[];
}): RtssGraphicStorage {
const message = new RtssGraphicStorage({});
if (data.canvas != null) {
@ -132,6 +143,9 @@ export namespace graphicData {
if (data.signals != null) {
message.signals = data.signals.map(item => Signal.fromObject(item));
}
if (data.turnouts != null) {
message.turnouts = data.turnouts.map(item => Turnout.fromObject(item));
}
return message;
}
toObject() {
@ -144,6 +158,7 @@ export namespace graphicData {
Rects?: ReturnType<typeof Rect.prototype.toObject>[];
train?: ReturnType<typeof Train.prototype.toObject>[];
signals?: ReturnType<typeof Signal.prototype.toObject>[];
turnouts?: ReturnType<typeof Turnout.prototype.toObject>[];
} = {};
if (this.canvas != null) {
data.canvas = this.canvas.toObject();
@ -169,6 +184,9 @@ export namespace graphicData {
if (this.signals != null) {
data.signals = this.signals.map((item: Signal) => item.toObject());
}
if (this.turnouts != null) {
data.turnouts = this.turnouts.map((item: Turnout) => item.toObject());
}
return data;
}
serialize(): Uint8Array;
@ -191,6 +209,8 @@ export namespace graphicData {
writer.writeRepeatedMessage(7, this.train, (item: Train) => item.serialize(writer));
if (this.signals.length)
writer.writeRepeatedMessage(8, this.signals, (item: Signal) => item.serialize(writer));
if (this.turnouts.length)
writer.writeRepeatedMessage(9, this.turnouts, (item: Turnout) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -224,6 +244,9 @@ export namespace graphicData {
case 8:
reader.readMessage(message.signals, () => pb_1.Message.addToRepeatedWrapperField(message, 8, Signal.deserialize(reader), Signal));
break;
case 9:
reader.readMessage(message.turnouts, () => pb_1.Message.addToRepeatedWrapperField(message, 9, Turnout.deserialize(reader), Turnout));
break;
default: reader.skipField();
}
}
@ -2291,23 +2314,162 @@ export namespace graphicData {
}
export class Turnout extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {}) {
constructor(data?: any[] | {
common?: CommonInfo;
code?: string;
forkPoint?: Point;
pointA?: Point;
pointB?: Point;
pointC?: Point;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") { }
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 ("forkPoint" in data && data.forkPoint != undefined) {
this.forkPoint = data.forkPoint;
}
if ("pointA" in data && data.pointA != undefined) {
this.pointA = data.pointA;
}
if ("pointB" in data && data.pointB != undefined) {
this.pointB = data.pointB;
}
if ("pointC" in data && data.pointC != undefined) {
this.pointC = data.pointC;
}
}
}
static fromObject(data: {}): Turnout {
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 forkPoint() {
return pb_1.Message.getWrapperField(this, Point, 5) as Point;
}
set forkPoint(value: Point) {
pb_1.Message.setWrapperField(this, 5, value);
}
get has_forkPoint() {
return pb_1.Message.getField(this, 5) != null;
}
get pointA() {
return pb_1.Message.getWrapperField(this, Point, 6) as Point;
}
set pointA(value: Point) {
pb_1.Message.setWrapperField(this, 6, value);
}
get has_pointA() {
return pb_1.Message.getField(this, 6) != null;
}
get pointB() {
return pb_1.Message.getWrapperField(this, Point, 7) as Point;
}
set pointB(value: Point) {
pb_1.Message.setWrapperField(this, 7, value);
}
get has_pointB() {
return pb_1.Message.getField(this, 7) != null;
}
get pointC() {
return pb_1.Message.getWrapperField(this, Point, 8) as Point;
}
set pointC(value: Point) {
pb_1.Message.setWrapperField(this, 8, value);
}
get has_pointC() {
return pb_1.Message.getField(this, 8) != null;
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
forkPoint?: ReturnType<typeof Point.prototype.toObject>;
pointA?: ReturnType<typeof Point.prototype.toObject>;
pointB?: ReturnType<typeof Point.prototype.toObject>;
pointC?: ReturnType<typeof Point.prototype.toObject>;
}): Turnout {
const message = new Turnout({});
if (data.common != null) {
message.common = CommonInfo.fromObject(data.common);
}
if (data.code != null) {
message.code = data.code;
}
if (data.forkPoint != null) {
message.forkPoint = Point.fromObject(data.forkPoint);
}
if (data.pointA != null) {
message.pointA = Point.fromObject(data.pointA);
}
if (data.pointB != null) {
message.pointB = Point.fromObject(data.pointB);
}
if (data.pointC != null) {
message.pointC = Point.fromObject(data.pointC);
}
return message;
}
toObject() {
const data: {} = {};
const data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
forkPoint?: ReturnType<typeof Point.prototype.toObject>;
pointA?: ReturnType<typeof Point.prototype.toObject>;
pointB?: ReturnType<typeof Point.prototype.toObject>;
pointC?: ReturnType<typeof Point.prototype.toObject>;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
}
if (this.code != null) {
data.code = this.code;
}
if (this.forkPoint != null) {
data.forkPoint = this.forkPoint.toObject();
}
if (this.pointA != null) {
data.pointA = this.pointA.toObject();
}
if (this.pointB != null) {
data.pointB = this.pointB.toObject();
}
if (this.pointC != null) {
data.pointC = this.pointC.toObject();
}
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.has_forkPoint)
writer.writeMessage(5, this.forkPoint, () => this.forkPoint.serialize(writer));
if (this.has_pointA)
writer.writeMessage(6, this.pointA, () => this.pointA.serialize(writer));
if (this.has_pointB)
writer.writeMessage(7, this.pointB, () => this.pointB.serialize(writer));
if (this.has_pointC)
writer.writeMessage(8, this.pointC, () => this.pointC.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -2317,6 +2479,24 @@ export namespace graphicData {
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 5:
reader.readMessage(message.forkPoint, () => message.forkPoint = Point.deserialize(reader));
break;
case 6:
reader.readMessage(message.pointA, () => message.pointA = Point.deserialize(reader));
break;
case 7:
reader.readMessage(message.pointB, () => message.pointB = Point.deserialize(reader));
break;
case 8:
reader.readMessage(message.pointC, () => message.pointC = Point.deserialize(reader));
break;
default: reader.skipField();
}
}

@ -1 +1 @@
Subproject commit f796e22d26890646ea0671fcaa11a571be6cb2fe
Subproject commit 8886bcca5d3c2704ff7c98eade06aae5ae294010