This commit is contained in:
fan 2023-06-08 14:20:20 +08:00
commit 2806c4c1f2
11 changed files with 325 additions and 918 deletions

View File

@ -35,7 +35,7 @@ export async function pageQuery(
* @param params * @param params
* @returns * @returns
*/ */
export function createDraft(draftData: { name: string }) { export function createDraft(draftData: { name: string; type: string }) {
return api.post(`${DraftUriBase}`, draftData); return api.post(`${DraftUriBase}`, draftData);
} }
@ -82,3 +82,12 @@ export function saveDraft(
) { ) {
return api.put(`${DraftUriBase}/${id}`, data); return api.put(`${DraftUriBase}/${id}`, data);
} }
/**
* 稿
* @param data
* @returns
*/
export function saveAsDraft(id: number, data: { name: string }) {
return api.post(`${DraftUriBase}/${id}/saveAs`, data);
}

View File

@ -1,39 +1,6 @@
<template> <template>
<q-form> <q-form>
<q-input outlined readonly v-model="platformModel.id" label="id" hint="" /> <q-input outlined readonly v-model="platformModel.id" label="id" hint="" />
<q-input
outlined
v-model.number="platformModel.lineWidth"
type="number"
@blur="onUpdate"
label="线宽"
lazy-rules
:rules="[(val) => (val && val > 0) || '画布宽必须大于0']"
/>
<q-input
outlined
v-model="platformModel.lineColor"
@blur="onUpdate"
label="线色"
lazy-rules
:rules="[(val) => (val && val.length > 0) || '线色不能为空']"
>
<template v-slot:append>
<q-icon name="colorize" class="cursor-pointer">
<q-popup-proxy cover transition-show="scale" transition-hide="scale">
<q-color
v-model="platformModel.lineColor"
@change="
(val) => {
platformModel.lineColor = val;
onUpdate();
}
"
/>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
<q-select <q-select
outlined outlined
@blur="onUpdate" @blur="onUpdate"
@ -44,9 +11,9 @@
<q-select <q-select
outlined outlined
@blur="onUpdate" @blur="onUpdate"
v-model="trainDirection" v-model="direction"
:options="optionsDirection" :options="optionsDirection"
label="行驶方向" label="方向"
/> />
</q-form> </q-form>
</template> </template>
@ -61,19 +28,19 @@ const drawStore = useDrawStore();
const platformModel = reactive(new PlatformData()); const platformModel = reactive(new PlatformData());
const hasDoor = ref('是'); const hasDoor = ref('是');
const optionsDoor = ['是', '否']; const optionsDoor = ['是', '否'];
const trainDirection = ref('向左'); const direction = ref('向上');
const optionsDirection = ['向左', '向右']; const optionsDirection = ['向上', '向下'];
enum showSelect { enum showSelect {
= 'true', = 'true',
= 'false', = 'false',
= 'left', = 'up',
= 'right', = 'down',
} }
enum showSelectData { enum showSelectData {
true = '是', true = '是',
false = '否', false = '否',
left = '向左', up = '向上',
right = '向右', down = '向下',
} }
drawStore.$subscribe; drawStore.$subscribe;
@ -83,9 +50,7 @@ watch(
if (val && val.type == Platform.Type) { if (val && val.type == Platform.Type) {
platformModel.copyFrom(val.saveData() as PlatformData); platformModel.copyFrom(val.saveData() as PlatformData);
hasDoor.value = (showSelectData as never)[platformModel.hasdoor + '']; hasDoor.value = (showSelectData as never)[platformModel.hasdoor + ''];
trainDirection.value = (showSelectData as never)[ direction.value = (showSelectData as never)[platformModel.direction];
platformModel.trainDirection
];
} }
} }
); );
@ -95,15 +60,13 @@ onMounted(() => {
if (platform) { if (platform) {
platformModel.copyFrom(platform.saveData()); platformModel.copyFrom(platform.saveData());
hasDoor.value = (showSelectData as never)[platformModel.hasdoor + '']; hasDoor.value = (showSelectData as never)[platformModel.hasdoor + ''];
trainDirection.value = (showSelectData as never)[ direction.value = (showSelectData as never)[platformModel.direction];
platformModel.trainDirection
];
} }
}); });
function onUpdate() { function onUpdate() {
platformModel.hasdoor = JSON.parse((showSelect as never)[hasDoor.value]); platformModel.hasdoor = JSON.parse((showSelect as never)[hasDoor.value]);
platformModel.trainDirection = (showSelect as never)[trainDirection.value]; platformModel.direction = (showSelect as never)[direction.value];
const platform = drawStore.selectedGraphic as Platform; const platform = drawStore.selectedGraphic as Platform;
if (platform) { if (platform) {
drawStore.getDrawApp().updateGraphicAndRecord(platform, platformModel); drawStore.getDrawApp().updateGraphicAndRecord(platform, platformModel);

View File

@ -8,39 +8,6 @@
v-model="stationModel.code" v-model="stationModel.code"
lazy-rules lazy-rules
/> />
<q-input
outlined
v-model.number="stationModel.codeFontSize"
type="number"
@blur="onUpdate"
label="字体大小"
lazy-rules
:rules="[(val) => (val && val > 0) || '字体大小必须大于0']"
/>
<q-input
outlined
v-model="stationModel.codeColor"
@blur="onUpdate"
label="字体颜色"
lazy-rules
:rules="[(val) => (val && val.length > 0) || '线色不能为空']"
>
<template v-slot:append>
<q-icon name="colorize" class="cursor-pointer">
<q-popup-proxy cover transition-show="scale" transition-hide="scale">
<q-color
v-model="stationModel.codeColor"
@change="
(val) => {
stationModel.codeColor = val;
onUpdate();
}
"
/>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
<q-select <q-select
outlined outlined
@blur="onUpdate" @blur="onUpdate"
@ -74,80 +41,6 @@
</div> </div>
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-input
outlined
v-model.number="stationModel.radius"
type="number"
@blur="onUpdate"
label="半径"
lazy-rules
:rules="[(val) => (val && val > 0) || '半径大小必须大于0']"
/>
<q-input
outlined
v-model="stationModel.fillColor"
@blur="onUpdate"
label="填充颜色"
lazy-rules
:rules="[(val) => (val && val.length > 0) || '线色不能为空']"
>
<template v-slot:append>
<q-icon name="colorize" class="cursor-pointer">
<q-popup-proxy
cover
transition-show="scale"
transition-hide="scale"
>
<q-color
v-model="stationModel.fillColor"
@change="
(val) => {
stationModel.fillColor = val;
onUpdate();
}
"
/>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
<q-input
outlined
v-model.number="stationModel.borderWidth"
type="number"
@blur="onUpdate"
label="边框宽度"
lazy-rules
:rules="[(val) => (val && val > 0) || '画布宽必须大于0']"
/>
<q-input
outlined
v-model="stationModel.borderColor"
@blur="onUpdate"
label="边框颜色"
lazy-rules
:rules="[(val) => (val && val.length > 0) || '线色不能为空']"
>
<template v-slot:append>
<q-icon name="colorize" class="cursor-pointer">
<q-popup-proxy
cover
transition-show="scale"
transition-hide="scale"
>
<q-color
v-model="stationModel.borderColor"
@change="
(val) => {
stationModel.borderColor = val;
onUpdate();
}
"
/>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
</div> </div>
</q-form> </q-form>
</template> </template>

View File

@ -1,5 +1,4 @@
import * as pb_1 from 'google-protobuf'; import * as pb_1 from 'google-protobuf';
import { IPointData } from 'pixi.js';
import { IPlatformData } from 'src/graphics/platform/Platform'; import { IPlatformData } from 'src/graphics/platform/Platform';
import { graphicData } from 'src/protos/stationLayoutGraphics'; import { graphicData } from 'src/protos/stationLayoutGraphics';
import { GraphicDataBase } from './GraphicDataBase'; import { GraphicDataBase } from './GraphicDataBase';
@ -33,47 +32,11 @@ export class PlatformData extends GraphicDataBase implements IPlatformData {
set hasdoor(v: boolean) { set hasdoor(v: boolean) {
this.data.hasdoor = v; this.data.hasdoor = v;
} }
get trainDirection(): string { get direction(): string {
return this.data.trainDirection; return this.data.direction;
} }
set trainDirection(v: string) { set direction(v: string) {
this.data.trainDirection = v; this.data.direction = 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 lineColorDoor(): string {
return this.data.lineColorDoor;
}
set lineColorDoor(v: string) {
this.data.lineColorDoor = v;
}
get point(): IPointData {
return this.data.point;
}
set point(point: IPointData) {
this.data.point = new graphicData.Point({ x: point.x, y: point.y });
}
get width(): number {
return this.data.width;
}
set width(v: number) {
this.data.width = v;
}
get height(): number {
return this.data.height;
}
set height(v: number) {
this.data.height = v;
} }
clone(): PlatformData { clone(): PlatformData {

View File

@ -32,48 +32,6 @@ export class StationData extends GraphicDataBase implements IStationData {
set hasCircle(v: boolean) { set hasCircle(v: boolean) {
this.data.hasCircle = v; this.data.hasCircle = v;
} }
get radius(): number {
return this.data.radius;
}
set radius(v: number) {
this.data.radius = v;
}
get borderWidth(): number {
return this.data.borderWidth;
}
set borderWidth(v: number) {
this.data.borderWidth = v;
}
get borderColor(): string {
return this.data.borderColor;
}
set borderColor(v: string) {
this.data.borderColor = v;
}
get fillColor(): string {
return this.data.fillColor;
}
set fillColor(v: string) {
this.data.fillColor = v;
}
get codeColor(): string {
return this.data.codeColor;
}
set codeColor(v: string) {
this.data.codeColor = v;
}
get codeFontSize(): number {
return this.data.codeFontSize;
}
set codeFontSize(v: number) {
this.data.codeFontSize = v;
}
get point(): IPointData {
return this.data.point;
}
set point(point: IPointData) {
this.data.point = new graphicData.Point({ x: point.x, y: point.y });
}
get circlePoint(): IPointData { get circlePoint(): IPointData {
return this.data.circlePoint; return this.data.circlePoint;
} }

View File

@ -1,4 +1,4 @@
import { Color, Graphics, IPointData, Rectangle } from 'pixi.js'; import { Color, Container, Graphics, Rectangle } from 'pixi.js';
import { import {
GraphicData, GraphicData,
JlGraphic, JlGraphic,
@ -12,20 +12,8 @@ export interface IPlatformData extends GraphicData {
set code(v: string); set code(v: string);
get hasdoor(): boolean; // 是否有屏蔽门 get hasdoor(): boolean; // 是否有屏蔽门
set hasdoor(v: boolean); set hasdoor(v: boolean);
get trainDirection(): string; // 行驶方向--屏蔽门上下 get direction(): string; // 屏蔽门上下
set trainDirection(v: string); set direction(v: string);
get lineWidth(): number; // 线宽
set lineWidth(v: number);
get lineColor(): string; // 站台线色
set lineColor(v: string);
get lineColorDoor(): string; // 屏蔽门线色
set lineColorDoor(v: string);
get point(): IPointData; // 位置坐标
set point(point: IPointData);
get width(): number; // 宽度
set width(v: number);
get height(): number; // 高度
set height(v: number);
clone(): IPlatformData; clone(): IPlatformData;
copyFrom(data: IPlatformData): void; copyFrom(data: IPlatformData): void;
eq(other: IPlatformData): boolean; eq(other: IPlatformData): boolean;
@ -56,146 +44,241 @@ const platformConsts = {
besideSpacing: 10, besideSpacing: 10,
}; };
export class Platform extends JlGraphic { export interface childJlGraphic extends Container {
static Type = 'Platform'; clear(): void;
draw(): void;
}
platformGraphic: Graphics; //子元素--矩形
export class rectGraphic extends Container {
static Type = 'RectPlatForm';
rectGraphic: Graphics;
constructor() {
super();
this.rectGraphic = new Graphics();
this.addChild(this.rectGraphic);
}
draw(): void {
const rectGraphic = this.rectGraphic;
rectGraphic.clear();
rectGraphic.lineStyle(
platformConsts.lineWidth,
new Color(PlatformColorEnum.yellow)
);
rectGraphic.beginFill(PlatformColorEnum.yellow, 1);
rectGraphic.drawRect(0, 0, platformConsts.width, platformConsts.height);
rectGraphic.endFill;
const rectP = new Rectangle(
0,
0,
platformConsts.width,
platformConsts.width
);
rectGraphic.pivot = getRectangleCenter(rectP);
rectGraphic.position.set(
0,
platformConsts.height / 2 + platformConsts.doorPlatformSpacing
);
}
clear(): void {
this.rectGraphic.clear();
}
}
//子元素--门
export class doorGraphic extends Container {
static Type = 'Door';
doorGraphic: Graphics; doorGraphic: Graphics;
doorCloseGraphic: Graphics; doorCloseGraphic: Graphics;
besideGraphic: Graphics;
codeGraph: VectorText = new VectorText(''); //站台旁数字、字符
constructor() { constructor() {
super(Platform.Type); super();
this.platformGraphic = new Graphics();
this.doorGraphic = new Graphics(); this.doorGraphic = new Graphics();
this.doorCloseGraphic = new Graphics(); this.doorCloseGraphic = new Graphics();
this.besideGraphic = new Graphics();
this.addChild(this.platformGraphic);
this.addChild(this.doorGraphic); this.addChild(this.doorGraphic);
this.addChild(this.doorCloseGraphic); this.addChild(this.doorCloseGraphic);
}
draw(): void {
const doorGraphic = this.doorGraphic;
const doorCloseGraphic = this.doorCloseGraphic;
doorGraphic.clear();
doorCloseGraphic.clear();
doorGraphic.lineStyle(
platformConsts.lineWidth,
new Color(PlatformColorEnum.doorBlue)
);
doorGraphic.moveTo(
-platformConsts.width / 2 - platformConsts.lineWidth / 2,
0
);
doorGraphic.lineTo(-platformConsts.doorOpenSpacing, 0);
doorGraphic.moveTo(platformConsts.doorOpenSpacing, 0);
doorGraphic.lineTo(
platformConsts.width / 2 + platformConsts.lineWidth / 2,
0
);
//屏蔽门闭合
doorCloseGraphic.lineStyle(
platformConsts.lineWidth,
new Color(PlatformColorEnum.doorBlue)
);
doorCloseGraphic.moveTo(-platformConsts.doorOpenSpacing, 0);
doorCloseGraphic.lineTo(platformConsts.doorOpenSpacing, 0);
doorGraphic.position.set(
0,
-platformConsts.height / 2 - platformConsts.doorPlatformSpacing
);
doorCloseGraphic.position.set(
0,
-platformConsts.height / 2 - platformConsts.doorPlatformSpacing
);
}
openDoor(): void {
this.doorCloseGraphic.visible = false;
}
clear(): void {
this.doorGraphic.clear();
this.doorCloseGraphic.clear();
}
}
//子元素--字符
class codeGraph extends Container {
static Type = 'Code';
character: VectorText = new VectorText(''); //站台旁字符H或P
characterN: VectorText = new VectorText(''); //站台旁数字
constructor() {
super();
this.addChild(this.character);
this.addChild(this.characterN);
this.character.setVectorFontSize(platformConsts.besideFontSize);
this.characterN.setVectorFontSize(platformConsts.besideFontSize);
}
draw(): void {
const character = this.character;
character.text = 'H';
character.anchor.set(0.5);
character.position.set(
-platformConsts.width / 2 -
platformConsts.lineWidth / 2 -
platformConsts.besideSpacing,
0
);
character.style.fill = PlatformColorEnum.HCharYellow;
const characterN = this.characterN;
characterN.text = '9';
characterN.anchor.set(0.5);
characterN.position.set(
-platformConsts.width / 2 -
platformConsts.lineWidth / 2 -
platformConsts.besideSpacing,
(-platformConsts.besideSpacing * 3) / 2
);
characterN.style.fill = PlatformColorEnum.HCharYellow;
}
clear(): void {
this.character.destroy();
}
}
//子元素--站台旁菱形图标
class besideGraphic extends Container {
static Type = 'BesideGraphic';
besideGraphic: Graphics;
constructor() {
super();
this.besideGraphic = new Graphics();
this.addChild(this.besideGraphic);
}
draw(): void {
const besideGraphic = this.besideGraphic;
besideGraphic.clear();
besideGraphic.lineStyle(1, new Color(PlatformColorEnum.lozengeRed));
besideGraphic.drawRect(
0,
0,
platformConsts.height / 4,
platformConsts.height / 4
);
const rect = new Rectangle(
0,
0,
platformConsts.height / 4,
platformConsts.height / 4
);
besideGraphic.pivot = getRectangleCenter(rect);
besideGraphic.rotation = Math.PI / 4;
besideGraphic.position.set(
-platformConsts.width / 2 -
platformConsts.lineWidth / 2 -
platformConsts.besideSpacing,
0
);
}
clear(): void {
this.besideGraphic.clear();
}
}
export class Platform extends JlGraphic {
static Type = 'Platform';
platformGraphic: childJlGraphic = new rectGraphic();
doorGraphic: childJlGraphic = new doorGraphic();
besideGraphic: childJlGraphic = new besideGraphic();
codeGraph: childJlGraphic = new codeGraph();
constructor() {
super(Platform.Type);
this.addChild(this.platformGraphic);
this.addChild(this.doorGraphic);
this.addChild(this.besideGraphic); this.addChild(this.besideGraphic);
this.addChild(this.codeGraph); this.addChild(this.codeGraph);
this.codeGraph.setVectorFontSize(platformConsts.besideFontSize);
} }
get datas(): IPlatformData { get datas(): IPlatformData {
return this.getDatas<IPlatformData>(); return this.getDatas<IPlatformData>();
} }
doRepaint(): void { doRepaint(): void {
const width = this.datas.width; this.doorGraphic.clear();
const height = this.datas.height;
//屏蔽门
const doorGraphic = this.doorGraphic;
const doorCloseGraphic = this.doorCloseGraphic;
doorGraphic.clear();
doorCloseGraphic.clear();
if (this.datas.hasdoor) { if (this.datas.hasdoor) {
doorGraphic.lineStyle( this.doorGraphic.draw();
this.datas.lineWidth,
new Color(this.datas.lineColorDoor)
);
doorGraphic.moveTo(-width / 2 - this.datas.lineWidth / 2, 0);
doorGraphic.lineTo(-platformConsts.doorOpenSpacing, 0);
doorGraphic.moveTo(platformConsts.doorOpenSpacing, 0);
doorGraphic.lineTo(width / 2 + this.datas.lineWidth / 2, 0);
//屏蔽门闭合
doorCloseGraphic.lineStyle(
this.datas.lineWidth,
new Color(this.datas.lineColorDoor)
);
doorCloseGraphic.moveTo(-platformConsts.doorOpenSpacing, 0);
doorCloseGraphic.lineTo(platformConsts.doorOpenSpacing, 0);
doorGraphic.position.set(
0,
-height / 2 - platformConsts.doorPlatformSpacing
);
doorCloseGraphic.position.set(
0,
-height / 2 - platformConsts.doorPlatformSpacing
);
} }
//站台 this.platformGraphic.draw();
const platformGraphic = this.platformGraphic; this.besideGraphic.draw();
platformGraphic.clear(); this.codeGraph.draw();
platformGraphic.lineStyle( this.doorGraphic.position.set(0, 0);
this.datas.lineWidth, this.besideGraphic.position.set(0, 0);
new Color(this.datas.lineColor) this.codeGraph.position.set(0, 0);
);
platformGraphic.beginFill(this.datas.lineColor, 1);
platformGraphic.drawRect(0, 0, this.datas.width, this.datas.height);
platformGraphic.endFill;
const rectP = new Rectangle(0, 0, this.datas.width, this.datas.height);
platformGraphic.pivot = getRectangleCenter(rectP);
this.position.set(this.datas.point.x, this.datas.point.y);
//站台旁菱形图标
const besideGraphic = this.besideGraphic;
besideGraphic.clear();
besideGraphic.lineStyle(1, new Color(PlatformColorEnum.lozengeRed));
besideGraphic.drawRect(0, 0, this.datas.height / 4, this.datas.height / 4);
const rect = new Rectangle(
0,
0,
this.datas.height / 4,
this.datas.height / 4
);
besideGraphic.pivot = getRectangleCenter(rect);
besideGraphic.rotation = Math.PI / 4;
besideGraphic.position.set(
-width / 2 - this.datas.lineWidth / 2 - platformConsts.besideSpacing,
0
);
//站台旁的数字、字符
const codeGraph = this.codeGraph;
codeGraph.text = 'H';
codeGraph.anchor.set(0.5);
codeGraph.position.set(
-width / 2 - this.datas.lineWidth / 2 - platformConsts.besideSpacing,
0
);
codeGraph.style.fill = PlatformColorEnum.HCharYellow;
//站台方向 //站台方向
if (this.datas.trainDirection == 'right') { if (this.datas.direction == 'down') {
doorGraphic.position.set( this.doorGraphic.position.set(
0, 0,
height / 2 + platformConsts.doorPlatformSpacing platformConsts.height + platformConsts.doorPlatformSpacing * 2
); );
doorCloseGraphic.position.set( this.besideGraphic.position.set(
0, platformConsts.width +
height / 2 + platformConsts.doorPlatformSpacing platformConsts.lineWidth +
); platformConsts.besideSpacing * 2,
besideGraphic.position.set(
width / 2 + this.datas.lineWidth / 2 + platformConsts.besideSpacing,
0 0
); );
codeGraph.position.set( this.codeGraph.position.set(
width / 2 + this.datas.lineWidth / 2 + platformConsts.besideSpacing, platformConsts.width +
platformConsts.lineWidth +
platformConsts.besideSpacing * 2,
0 0
); );
this.codeGraph.children[1].position.set(
-platformConsts.width / 2 -
platformConsts.lineWidth / 2 -
platformConsts.besideSpacing,
(platformConsts.besideSpacing * 3) / 2
);
} }
//子元素显隐
doorCloseGraphic.visible = false;
/* besideGraphic.visible = false;
codeGraph.visible = false; */
} }
} }
export class PlatformTemplate extends JlGraphicTemplate<Platform> { export class PlatformTemplate extends JlGraphicTemplate<Platform> {
hasdoor: boolean; hasdoor: boolean;
trainDirection: string; direction: string;
lineWidth: number;
lineColor: string;
lineColorDoor: string;
width: number;
height: number;
constructor() { constructor() {
super(Platform.Type); super(Platform.Type);
this.hasdoor = true; this.hasdoor = true;
this.trainDirection = 'left'; this.direction = 'up';
this.lineWidth = platformConsts.lineWidth;
this.lineColor = PlatformColorEnum.yellow;
this.lineColorDoor = PlatformColorEnum.doorBlue;
this.width = platformConsts.width;
this.height = platformConsts.height;
} }
new(): Platform { new(): Platform {
return new Platform(); return new Platform();

View File

@ -1,19 +1,19 @@
import { import { FederatedPointerEvent, Point } from 'pixi.js';
Color,
FederatedPointerEvent,
Graphics,
Point,
Rectangle,
} from 'pixi.js';
import { import {
GraphicDrawAssistant, GraphicDrawAssistant,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlDrawApp, JlDrawApp,
JlGraphic, JlGraphic,
getRectangleCenter,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
import { IPlatformData, Platform, PlatformTemplate } from './Platform'; import {
IPlatformData,
Platform,
PlatformTemplate,
rectGraphic,
doorGraphic,
childJlGraphic,
} from './Platform';
export interface IPlatformDrawOptions { export interface IPlatformDrawOptions {
newData: () => IPlatformData; newData: () => IPlatformData;
@ -24,8 +24,8 @@ export class PlatformDraw extends GraphicDrawAssistant<
IPlatformData IPlatformData
> { > {
point: Point = new Point(0, 0); point: Point = new Point(0, 0);
platformGraphic: Graphics = new Graphics(); platformGraphic: childJlGraphic = new rectGraphic();
doorGraphic: Graphics = new Graphics(); doorGraphic: childJlGraphic = new doorGraphic();
constructor(app: JlDrawApp, createData: () => IPlatformData) { constructor(app: JlDrawApp, createData: () => IPlatformData) {
super( super(
@ -37,12 +37,13 @@ export class PlatformDraw extends GraphicDrawAssistant<
); );
this.container.addChild(this.platformGraphic); this.container.addChild(this.platformGraphic);
this.container.addChild(this.doorGraphic); this.container.addChild(this.doorGraphic);
this.graphicTemplate.hasdoor = true;
platformInteraction.init(app); platformInteraction.init(app);
} }
bind(): void { bind(): void {
super.bind(); super.bind();
this.platformGraphic.draw();
this.doorGraphic.draw();
} }
unbind(): void { unbind(): void {
super.unbind(); super.unbind();
@ -60,44 +61,15 @@ export class PlatformDraw extends GraphicDrawAssistant<
} }
redraw(p: Point): void { redraw(p: Point): void {
const template = this.graphicTemplate; this.doorGraphic.position.copyFrom(p);
//屏蔽门 this.platformGraphic.position.copyFrom(p);
if (template.hasdoor) {
const doorGraphic = this.doorGraphic;
doorGraphic.clear();
doorGraphic.lineStyle(
template.lineWidth,
new Color(template.lineColorDoor)
);
const width = template.width;
const height = template.height;
doorGraphic.moveTo(-width / 2 - template.lineWidth / 2, -height / 2 - 10);
doorGraphic.lineTo(width / 2 + template.lineWidth / 2, -height / 2 - 10);
doorGraphic.position.set(p.x, p.y);
} }
//站台
const platformGraphic = this.platformGraphic;
platformGraphic.clear();
this.point.set(p.x, p.y);
const rect = new Rectangle(0, 0, template.width, template.height);
platformGraphic.pivot = getRectangleCenter(rect);
platformGraphic.lineStyle(template.lineWidth, template.lineColor);
platformGraphic.beginFill(template.lineColor, 1);
platformGraphic.drawRect(0, 0, template.width, template.height);
platformGraphic.endFill;
platformGraphic.position.set(this.point.x, this.point.y);
}
prepareData(data: IPlatformData): boolean { prepareData(data: IPlatformData): boolean {
const template = this.graphicTemplate; const template = this.graphicTemplate;
data.hasdoor = template.hasdoor; data.hasdoor = template.hasdoor;
data.trainDirection = template.trainDirection; data.direction = template.direction;
data.point = this.point; data.transform = this.platformGraphic.saveTransform();
data.lineWidth = template.lineWidth;
data.lineColor = template.lineColor;
data.lineColorDoor = template.lineColorDoor;
data.width = template.width;
data.height = template.height;
return true; return true;
} }
} }

View File

@ -5,26 +5,13 @@ import {
JlGraphicTemplate, JlGraphicTemplate,
VectorText, VectorText,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
import { StationDraw } from './StationDrawAssistant';
export interface IStationData extends GraphicData { export interface IStationData extends GraphicData {
get code(): string; // 编号 get code(): string; // 编号
set code(v: string); set code(v: string);
get hasCircle(): boolean; // 是否有圆圈--线网图 get hasCircle(): boolean; // 是否有圆圈--线网图
set hasCircle(v: boolean); set hasCircle(v: boolean);
get radius(): number; // 半径
set radius(v: number);
get borderWidth(): number; // 线宽
set borderWidth(v: number);
get borderColor(): string; // 圆边框线色
set borderColor(v: string);
get fillColor(): string; // 圆填充颜色
set fillColor(v: string);
get codeColor(): string; // 车站字体颜色
set codeColor(v: string);
get codeFontSize(): number; // 车站字体大小
set codeFontSize(v: number);
get point(): IPointData; // 位置坐标
set point(point: IPointData);
get circlePoint(): IPointData; // 位置坐标 get circlePoint(): IPointData; // 位置坐标
set circlePoint(point: IPointData); set circlePoint(point: IPointData);
clone(): IStationData; clone(): IStationData;
@ -32,13 +19,22 @@ export interface IStationData extends GraphicData {
eq(other: IStationData): boolean; eq(other: IStationData): boolean;
} }
const stationConsts = {
radius: 5,
borderWidth: 1,
borderColor: '0xff0000',
fillColor: '0xff0000',
codeColor: '0xF48815',
codeFontSize: 22,
lineWidth: 3,
};
export class Station extends JlGraphic { export class Station extends JlGraphic {
static Type = 'station'; static Type = 'station';
codeGraph: VectorText = new VectorText(''); //站台旁数字、字符 codeGraph: VectorText = new VectorText(''); //车站名
circleGraphic: Graphics; circleGraphic: Graphics = new Graphics();
constructor() { constructor() {
super(Station.Type); super(Station.Type);
this.circleGraphic = new Graphics();
this.addChild(this.codeGraph); this.addChild(this.codeGraph);
this.addChild(this.circleGraphic); this.addChild(this.circleGraphic);
} }
@ -46,54 +42,39 @@ export class Station extends JlGraphic {
get datas(): IStationData { get datas(): IStationData {
return this.getDatas<IStationData>(); return this.getDatas<IStationData>();
} }
doRepaint(): void { static draw(station: Station | StationDraw, datas?: IStationData): void {
this.circleGraphic.clear(); station.circleGraphic.clear();
this.position.set(this.datas.point.x, this.datas.point.y); const codeGraph = station.codeGraph;
const codeGraph = this.codeGraph; codeGraph.text = datas?.code || '车站Station';
if (this.datas.code == '') { codeGraph.style.fill = stationConsts.codeColor;
codeGraph.text = '车站Station'; codeGraph.setVectorFontSize(stationConsts.codeFontSize);
} else {
codeGraph.text = this.datas.code;
}
codeGraph.style.fill = this.datas.codeColor;
codeGraph.setVectorFontSize(this.datas.codeFontSize);
codeGraph.anchor.set(0.5); codeGraph.anchor.set(0.5);
if (this.datas.hasCircle) { if (datas?.hasCircle) {
const circleGraphic = this.circleGraphic; const circleGraphic = station.circleGraphic;
circleGraphic.lineStyle( circleGraphic.lineStyle(
this.datas.borderWidth, stationConsts.borderWidth,
new Color(this.datas.borderColor) new Color(stationConsts.borderColor)
); );
circleGraphic.beginFill(this.datas.fillColor, 1); circleGraphic.beginFill(stationConsts.fillColor, 1);
circleGraphic.drawCircle(0, 0, this.datas.radius); circleGraphic.drawCircle(0, 0, stationConsts.radius);
circleGraphic.endFill; circleGraphic.endFill;
circleGraphic.position.set( circleGraphic.position.set(datas.circlePoint.x, datas.circlePoint.y);
this.datas.circlePoint.x,
this.datas.circlePoint.y
);
} }
} }
doRepaint(): void {
Station.draw(this, this.datas);
}
} }
export class StationTemplate extends JlGraphicTemplate<Station> { export class StationTemplate extends JlGraphicTemplate<Station> {
hasCircle: boolean; hasCircle: boolean;
radius: number; radius: number;
borderWidth: number;
borderColor: string;
fillColor: string;
codeColor: string;
codeFontSize: number;
circlePoint: IPointData; circlePoint: IPointData;
constructor() { constructor() {
super(Station.Type); super(Station.Type);
this.hasCircle = false; this.hasCircle = false;
this.radius = 5; this.radius = stationConsts.radius;
this.borderWidth = 1; this.circlePoint = new Point(0, -15);
this.borderColor = '0xff0000';
this.fillColor = '0xff0000';
this.codeColor = '0xF48815';
this.codeFontSize = 22;
this.circlePoint = new Point(0, -20);
} }
new(): Station { new(): Station {
return new Station(); return new Station();

View File

@ -1,4 +1,4 @@
import { FederatedPointerEvent, Point } from 'pixi.js'; import { FederatedPointerEvent, Point, Graphics } from 'pixi.js';
import { import {
GraphicDrawAssistant, GraphicDrawAssistant,
GraphicInteractionPlugin, GraphicInteractionPlugin,
@ -19,6 +19,7 @@ export class StationDraw extends GraphicDrawAssistant<
> { > {
point: Point = new Point(0, 0); point: Point = new Point(0, 0);
codeGraph: VectorText = new VectorText(''); codeGraph: VectorText = new VectorText('');
circleGraphic: Graphics = new Graphics();
constructor(app: JlDrawApp, createData: () => IStationData) { constructor(app: JlDrawApp, createData: () => IStationData) {
super( super(
@ -34,13 +35,14 @@ export class StationDraw extends GraphicDrawAssistant<
bind(): void { bind(): void {
super.bind(); super.bind();
Station.draw(this);
} }
unbind(): void { unbind(): void {
super.unbind(); super.unbind();
} }
clearCache(): void { clearCache(): void {
//this.codeGraph.clear(); //this.codeGraph.destroy();
} }
onLeftDown(e: FederatedPointerEvent): void { onLeftDown(e: FederatedPointerEvent): void {
const { x, y } = this.toCanvasCoordinates(e.global); const { x, y } = this.toCanvasCoordinates(e.global);
@ -50,23 +52,12 @@ export class StationDraw extends GraphicDrawAssistant<
} }
redraw(p: Point): void { redraw(p: Point): void {
const codeGraph = this.codeGraph; this.codeGraph.position.copyFrom(p);
codeGraph.text = '车站Station';
codeGraph.anchor.set(0.5);
codeGraph.style.fill = '0xf48815';
codeGraph.position.set(p.x, p.y);
codeGraph.setVectorFontSize(22);
} }
prepareData(data: IStationData): boolean { prepareData(data: IStationData): boolean {
const template = this.graphicTemplate; const template = this.graphicTemplate;
data.point = this.point; data.transform = this.codeGraph.saveTransform();
data.hasCircle = template.hasCircle; data.hasCircle = template.hasCircle;
data.radius = template.radius;
data.borderWidth = template.borderWidth;
data.borderColor = template.borderColor;
data.fillColor = template.fillColor;
data.codeColor = template.codeColor;
data.codeFontSize = template.codeFontSize;
data.circlePoint = template.circlePoint; data.circlePoint = template.circlePoint;
return true; return true;
} }

View File

@ -60,14 +60,25 @@
<q-card style="width: 300px"> <q-card style="width: 300px">
<q-card-section> <q-card-section>
<div class="text-h6">新建草稿图</div> <div class="text-h6">新建草稿图</div>
</q-card-section> <q-form @submit="onCreate" class="q-gutter-md">
<q-input
<q-card-section> outlined
<q-input outlined label="名称" v-model="draftName" /> label="名称"
v-model="draftName"
lazy-rules
:rules="[(val) => val.length > 0 || '请输入名称!']"
/>
<q-select
v-model="createType"
:options="typeOptions"
emit-value
label="类型"
/>
</q-form>
</q-card-section> </q-card-section>
<q-card-actions align="right"> <q-card-actions align="right">
<q-btn color="primary" label="创建" @click="onCreate" /> <q-btn color="primary" label="创建" type="submit" />
<q-btn label="取消" v-close-popup /> <q-btn label="取消" v-close-popup />
</q-card-actions> </q-card-actions>
</q-card> </q-card>
@ -204,6 +215,7 @@ async function onCreate() {
try { try {
await createDraft({ await createDraft({
name: draftName.value, name: draftName.value,
type: createType.value,
}); });
createFormShow.value = false; createFormShow.value = false;
tableRef.value.requestServerInteraction(); // tableRef.value.requestServerInteraction(); //
@ -273,4 +285,9 @@ async function deleteData(row: any) {
operateDisabled.value = false; operateDisabled.value = false;
}); });
} }
const typeOptions = [
{ label: '线路', value: 'Line' },
{ label: '线网', value: 'LineNetwork' },
];
const createType = ref('Line');
</script> </script>

View File

@ -1313,17 +1313,10 @@ export namespace graphicData {
common?: CommonInfo; common?: CommonInfo;
code?: string; code?: string;
hasdoor?: boolean; hasdoor?: boolean;
trainDirection?: string; direction?: string;
lineWidth?: number;
lineColor?: string;
lineColorDoor?: string;
point?: Point;
width?: number;
height?: number;
orbitCode?: string[];
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [11], this.#one_of_decls); 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) { if ("common" in data && data.common != undefined) {
this.common = data.common; this.common = data.common;
@ -1334,29 +1327,8 @@ export namespace graphicData {
if ("hasdoor" in data && data.hasdoor != undefined) { if ("hasdoor" in data && data.hasdoor != undefined) {
this.hasdoor = data.hasdoor; this.hasdoor = data.hasdoor;
} }
if ("trainDirection" in data && data.trainDirection != undefined) { if ("direction" in data && data.direction != undefined) {
this.trainDirection = data.trainDirection; this.direction = data.direction;
}
if ("lineWidth" in data && data.lineWidth != undefined) {
this.lineWidth = data.lineWidth;
}
if ("lineColor" in data && data.lineColor != undefined) {
this.lineColor = data.lineColor;
}
if ("lineColorDoor" in data && data.lineColorDoor != undefined) {
this.lineColorDoor = data.lineColorDoor;
}
if ("point" in data && data.point != undefined) {
this.point = data.point;
}
if ("width" in data && data.width != undefined) {
this.width = data.width;
}
if ("height" in data && data.height != undefined) {
this.height = data.height;
}
if ("orbitCode" in data && data.orbitCode != undefined) {
this.orbitCode = data.orbitCode;
} }
} }
} }
@ -1381,69 +1353,17 @@ export namespace graphicData {
set hasdoor(value: boolean) { set hasdoor(value: boolean) {
pb_1.Message.setField(this, 3, value); pb_1.Message.setField(this, 3, value);
} }
get trainDirection() { get direction() {
return pb_1.Message.getFieldWithDefault(this, 4, "") as string; return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
} }
set trainDirection(value: string) { set direction(value: string) {
pb_1.Message.setField(this, 4, value); pb_1.Message.setField(this, 4, value);
} }
get lineWidth() {
return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
}
set lineWidth(value: number) {
pb_1.Message.setField(this, 5, value);
}
get lineColor() {
return pb_1.Message.getFieldWithDefault(this, 6, "") as string;
}
set lineColor(value: string) {
pb_1.Message.setField(this, 6, value);
}
get lineColorDoor() {
return pb_1.Message.getFieldWithDefault(this, 7, "") as string;
}
set lineColorDoor(value: string) {
pb_1.Message.setField(this, 7, value);
}
get point() {
return pb_1.Message.getWrapperField(this, Point, 8) as Point;
}
set point(value: Point) {
pb_1.Message.setWrapperField(this, 8, value);
}
get has_point() {
return pb_1.Message.getField(this, 8) != null;
}
get width() {
return pb_1.Message.getFieldWithDefault(this, 9, 0) as number;
}
set width(value: number) {
pb_1.Message.setField(this, 9, value);
}
get height() {
return pb_1.Message.getFieldWithDefault(this, 10, 0) as number;
}
set height(value: number) {
pb_1.Message.setField(this, 10, value);
}
get orbitCode() {
return pb_1.Message.getFieldWithDefault(this, 11, []) as string[];
}
set orbitCode(value: string[]) {
pb_1.Message.setField(this, 11, value);
}
static fromObject(data: { static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>; common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string; code?: string;
hasdoor?: boolean; hasdoor?: boolean;
trainDirection?: string; direction?: string;
lineWidth?: number;
lineColor?: string;
lineColorDoor?: string;
point?: ReturnType<typeof Point.prototype.toObject>;
width?: number;
height?: number;
orbitCode?: string[];
}): Platform { }): Platform {
const message = new Platform({}); const message = new Platform({});
if (data.common != null) { if (data.common != null) {
@ -1455,29 +1375,8 @@ export namespace graphicData {
if (data.hasdoor != null) { if (data.hasdoor != null) {
message.hasdoor = data.hasdoor; message.hasdoor = data.hasdoor;
} }
if (data.trainDirection != null) { if (data.direction != null) {
message.trainDirection = data.trainDirection; message.direction = data.direction;
}
if (data.lineWidth != null) {
message.lineWidth = data.lineWidth;
}
if (data.lineColor != null) {
message.lineColor = data.lineColor;
}
if (data.lineColorDoor != null) {
message.lineColorDoor = data.lineColorDoor;
}
if (data.point != null) {
message.point = Point.fromObject(data.point);
}
if (data.width != null) {
message.width = data.width;
}
if (data.height != null) {
message.height = data.height;
}
if (data.orbitCode != null) {
message.orbitCode = data.orbitCode;
} }
return message; return message;
} }
@ -1486,14 +1385,7 @@ export namespace graphicData {
common?: ReturnType<typeof CommonInfo.prototype.toObject>; common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string; code?: string;
hasdoor?: boolean; hasdoor?: boolean;
trainDirection?: string; direction?: string;
lineWidth?: number;
lineColor?: string;
lineColorDoor?: string;
point?: ReturnType<typeof Point.prototype.toObject>;
width?: number;
height?: number;
orbitCode?: string[];
} = {}; } = {};
if (this.common != null) { if (this.common != null) {
data.common = this.common.toObject(); data.common = this.common.toObject();
@ -1504,29 +1396,8 @@ export namespace graphicData {
if (this.hasdoor != null) { if (this.hasdoor != null) {
data.hasdoor = this.hasdoor; data.hasdoor = this.hasdoor;
} }
if (this.trainDirection != null) { if (this.direction != null) {
data.trainDirection = this.trainDirection; data.direction = this.direction;
}
if (this.lineWidth != null) {
data.lineWidth = this.lineWidth;
}
if (this.lineColor != null) {
data.lineColor = this.lineColor;
}
if (this.lineColorDoor != null) {
data.lineColorDoor = this.lineColorDoor;
}
if (this.point != null) {
data.point = this.point.toObject();
}
if (this.width != null) {
data.width = this.width;
}
if (this.height != null) {
data.height = this.height;
}
if (this.orbitCode != null) {
data.orbitCode = this.orbitCode;
} }
return data; return data;
} }
@ -1540,22 +1411,8 @@ export namespace graphicData {
writer.writeString(2, this.code); writer.writeString(2, this.code);
if (this.hasdoor != false) if (this.hasdoor != false)
writer.writeBool(3, this.hasdoor); writer.writeBool(3, this.hasdoor);
if (this.trainDirection.length) if (this.direction.length)
writer.writeString(4, this.trainDirection); writer.writeString(4, this.direction);
if (this.lineWidth != 0)
writer.writeInt32(5, this.lineWidth);
if (this.lineColor.length)
writer.writeString(6, this.lineColor);
if (this.lineColorDoor.length)
writer.writeString(7, this.lineColorDoor);
if (this.has_point)
writer.writeMessage(8, this.point, () => this.point.serialize(writer));
if (this.width != 0)
writer.writeFloat(9, this.width);
if (this.height != 0)
writer.writeFloat(10, this.height);
if (this.orbitCode.length)
writer.writeRepeatedString(11, this.orbitCode);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -1575,28 +1432,7 @@ export namespace graphicData {
message.hasdoor = reader.readBool(); message.hasdoor = reader.readBool();
break; break;
case 4: case 4:
message.trainDirection = reader.readString(); message.direction = reader.readString();
break;
case 5:
message.lineWidth = reader.readInt32();
break;
case 6:
message.lineColor = reader.readString();
break;
case 7:
message.lineColorDoor = reader.readString();
break;
case 8:
reader.readMessage(message.point, () => message.point = Point.deserialize(reader));
break;
case 9:
message.width = reader.readFloat();
break;
case 10:
message.height = reader.readFloat();
break;
case 11:
pb_1.Message.addToRepeatedField(message, 11, reader.readString());
break; break;
default: reader.skipField(); default: reader.skipField();
} }
@ -1616,13 +1452,6 @@ export namespace graphicData {
common?: CommonInfo; common?: CommonInfo;
code?: string; code?: string;
hasCircle?: boolean; hasCircle?: boolean;
radius?: number;
borderWidth?: number;
borderColor?: string;
fillColor?: string;
codeColor?: string;
codeFontSize?: number;
point?: Point;
circlePoint?: Point; circlePoint?: Point;
}) { }) {
super(); super();
@ -1637,27 +1466,6 @@ export namespace graphicData {
if ("hasCircle" in data && data.hasCircle != undefined) { if ("hasCircle" in data && data.hasCircle != undefined) {
this.hasCircle = data.hasCircle; this.hasCircle = data.hasCircle;
} }
if ("radius" in data && data.radius != undefined) {
this.radius = data.radius;
}
if ("borderWidth" in data && data.borderWidth != undefined) {
this.borderWidth = data.borderWidth;
}
if ("borderColor" in data && data.borderColor != undefined) {
this.borderColor = data.borderColor;
}
if ("fillColor" in data && data.fillColor != undefined) {
this.fillColor = data.fillColor;
}
if ("codeColor" in data && data.codeColor != undefined) {
this.codeColor = data.codeColor;
}
if ("codeFontSize" in data && data.codeFontSize != undefined) {
this.codeFontSize = data.codeFontSize;
}
if ("point" in data && data.point != undefined) {
this.point = data.point;
}
if ("circlePoint" in data && data.circlePoint != undefined) { if ("circlePoint" in data && data.circlePoint != undefined) {
this.circlePoint = data.circlePoint; this.circlePoint = data.circlePoint;
} }
@ -1684,71 +1492,19 @@ export namespace graphicData {
set hasCircle(value: boolean) { set hasCircle(value: boolean) {
pb_1.Message.setField(this, 3, value); pb_1.Message.setField(this, 3, value);
} }
get radius() {
return pb_1.Message.getFieldWithDefault(this, 4, 0) as number;
}
set radius(value: number) {
pb_1.Message.setField(this, 4, value);
}
get borderWidth() {
return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
}
set borderWidth(value: number) {
pb_1.Message.setField(this, 5, value);
}
get borderColor() {
return pb_1.Message.getFieldWithDefault(this, 6, "") as string;
}
set borderColor(value: string) {
pb_1.Message.setField(this, 6, value);
}
get fillColor() {
return pb_1.Message.getFieldWithDefault(this, 7, "") as string;
}
set fillColor(value: string) {
pb_1.Message.setField(this, 7, value);
}
get codeColor() {
return pb_1.Message.getFieldWithDefault(this, 8, "") as string;
}
set codeColor(value: string) {
pb_1.Message.setField(this, 8, value);
}
get codeFontSize() {
return pb_1.Message.getFieldWithDefault(this, 9, 0) as number;
}
set codeFontSize(value: number) {
pb_1.Message.setField(this, 9, value);
}
get point() {
return pb_1.Message.getWrapperField(this, Point, 10) as Point;
}
set point(value: Point) {
pb_1.Message.setWrapperField(this, 10, value);
}
get has_point() {
return pb_1.Message.getField(this, 10) != null;
}
get circlePoint() { get circlePoint() {
return pb_1.Message.getWrapperField(this, Point, 11) as Point; return pb_1.Message.getWrapperField(this, Point, 4) as Point;
} }
set circlePoint(value: Point) { set circlePoint(value: Point) {
pb_1.Message.setWrapperField(this, 11, value); pb_1.Message.setWrapperField(this, 4, value);
} }
get has_circlePoint() { get has_circlePoint() {
return pb_1.Message.getField(this, 11) != null; return pb_1.Message.getField(this, 4) != null;
} }
static fromObject(data: { static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>; common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string; code?: string;
hasCircle?: boolean; hasCircle?: boolean;
radius?: number;
borderWidth?: number;
borderColor?: string;
fillColor?: string;
codeColor?: string;
codeFontSize?: number;
point?: ReturnType<typeof Point.prototype.toObject>;
circlePoint?: ReturnType<typeof Point.prototype.toObject>; circlePoint?: ReturnType<typeof Point.prototype.toObject>;
}): Station { }): Station {
const message = new Station({}); const message = new Station({});
@ -1761,27 +1517,6 @@ export namespace graphicData {
if (data.hasCircle != null) { if (data.hasCircle != null) {
message.hasCircle = data.hasCircle; message.hasCircle = data.hasCircle;
} }
if (data.radius != null) {
message.radius = data.radius;
}
if (data.borderWidth != null) {
message.borderWidth = data.borderWidth;
}
if (data.borderColor != null) {
message.borderColor = data.borderColor;
}
if (data.fillColor != null) {
message.fillColor = data.fillColor;
}
if (data.codeColor != null) {
message.codeColor = data.codeColor;
}
if (data.codeFontSize != null) {
message.codeFontSize = data.codeFontSize;
}
if (data.point != null) {
message.point = Point.fromObject(data.point);
}
if (data.circlePoint != null) { if (data.circlePoint != null) {
message.circlePoint = Point.fromObject(data.circlePoint); message.circlePoint = Point.fromObject(data.circlePoint);
} }
@ -1792,13 +1527,6 @@ export namespace graphicData {
common?: ReturnType<typeof CommonInfo.prototype.toObject>; common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string; code?: string;
hasCircle?: boolean; hasCircle?: boolean;
radius?: number;
borderWidth?: number;
borderColor?: string;
fillColor?: string;
codeColor?: string;
codeFontSize?: number;
point?: ReturnType<typeof Point.prototype.toObject>;
circlePoint?: ReturnType<typeof Point.prototype.toObject>; circlePoint?: ReturnType<typeof Point.prototype.toObject>;
} = {}; } = {};
if (this.common != null) { if (this.common != null) {
@ -1810,27 +1538,6 @@ export namespace graphicData {
if (this.hasCircle != null) { if (this.hasCircle != null) {
data.hasCircle = this.hasCircle; data.hasCircle = this.hasCircle;
} }
if (this.radius != null) {
data.radius = this.radius;
}
if (this.borderWidth != null) {
data.borderWidth = this.borderWidth;
}
if (this.borderColor != null) {
data.borderColor = this.borderColor;
}
if (this.fillColor != null) {
data.fillColor = this.fillColor;
}
if (this.codeColor != null) {
data.codeColor = this.codeColor;
}
if (this.codeFontSize != null) {
data.codeFontSize = this.codeFontSize;
}
if (this.point != null) {
data.point = this.point.toObject();
}
if (this.circlePoint != null) { if (this.circlePoint != null) {
data.circlePoint = this.circlePoint.toObject(); data.circlePoint = this.circlePoint.toObject();
} }
@ -1846,22 +1553,8 @@ export namespace graphicData {
writer.writeString(2, this.code); writer.writeString(2, this.code);
if (this.hasCircle != false) if (this.hasCircle != false)
writer.writeBool(3, this.hasCircle); writer.writeBool(3, this.hasCircle);
if (this.radius != 0)
writer.writeInt32(4, this.radius);
if (this.borderWidth != 0)
writer.writeInt32(5, this.borderWidth);
if (this.borderColor.length)
writer.writeString(6, this.borderColor);
if (this.fillColor.length)
writer.writeString(7, this.fillColor);
if (this.codeColor.length)
writer.writeString(8, this.codeColor);
if (this.codeFontSize != 0)
writer.writeInt32(9, this.codeFontSize);
if (this.has_point)
writer.writeMessage(10, this.point, () => this.point.serialize(writer));
if (this.has_circlePoint) if (this.has_circlePoint)
writer.writeMessage(11, this.circlePoint, () => this.circlePoint.serialize(writer)); writer.writeMessage(4, this.circlePoint, () => this.circlePoint.serialize(writer));
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -1881,27 +1574,6 @@ export namespace graphicData {
message.hasCircle = reader.readBool(); message.hasCircle = reader.readBool();
break; break;
case 4: case 4:
message.radius = reader.readInt32();
break;
case 5:
message.borderWidth = reader.readInt32();
break;
case 6:
message.borderColor = reader.readString();
break;
case 7:
message.fillColor = reader.readString();
break;
case 8:
message.codeColor = reader.readString();
break;
case 9:
message.codeFontSize = reader.readInt32();
break;
case 10:
reader.readMessage(message.point, () => message.point = Point.deserialize(reader));
break;
case 11:
reader.readMessage(message.circlePoint, () => message.circlePoint = Point.deserialize(reader)); reader.readMessage(message.circlePoint, () => message.circlePoint = Point.deserialize(reader));
break; break;
default: reader.skipField(); default: reader.skipField();
@ -2514,10 +2186,6 @@ export namespace graphicData {
constructor(data?: any[] | { constructor(data?: any[] | {
common?: CommonInfo; common?: CommonInfo;
code?: string; code?: string;
codeColor?: string;
codeFontSize?: number;
point?: Point;
direction?: string;
}) { }) {
super(); 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, [], this.#one_of_decls);
@ -2528,18 +2196,6 @@ export namespace graphicData {
if ("code" in data && data.code != undefined) { if ("code" in data && data.code != undefined) {
this.code = data.code; this.code = data.code;
} }
if ("codeColor" in data && data.codeColor != undefined) {
this.codeColor = data.codeColor;
}
if ("codeFontSize" in data && data.codeFontSize != undefined) {
this.codeFontSize = data.codeFontSize;
}
if ("point" in data && data.point != undefined) {
this.point = data.point;
}
if ("direction" in data && data.direction != undefined) {
this.direction = data.direction;
}
} }
} }
get common() { get common() {
@ -2557,40 +2213,9 @@ export namespace graphicData {
set code(value: string) { set code(value: string) {
pb_1.Message.setField(this, 2, value); pb_1.Message.setField(this, 2, value);
} }
get codeColor() {
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
}
set codeColor(value: string) {
pb_1.Message.setField(this, 3, value);
}
get codeFontSize() {
return pb_1.Message.getFieldWithDefault(this, 4, 0) as number;
}
set codeFontSize(value: number) {
pb_1.Message.setField(this, 4, value);
}
get point() {
return pb_1.Message.getWrapperField(this, Point, 5) as Point;
}
set point(value: Point) {
pb_1.Message.setWrapperField(this, 5, value);
}
get has_point() {
return pb_1.Message.getField(this, 5) != null;
}
get direction() {
return pb_1.Message.getFieldWithDefault(this, 6, "") as string;
}
set direction(value: string) {
pb_1.Message.setField(this, 6, value);
}
static fromObject(data: { static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>; common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string; code?: string;
codeColor?: string;
codeFontSize?: number;
point?: ReturnType<typeof Point.prototype.toObject>;
direction?: string;
}): Signal { }): Signal {
const message = new Signal({}); const message = new Signal({});
if (data.common != null) { if (data.common != null) {
@ -2599,28 +2224,12 @@ export namespace graphicData {
if (data.code != null) { if (data.code != null) {
message.code = data.code; message.code = data.code;
} }
if (data.codeColor != null) {
message.codeColor = data.codeColor;
}
if (data.codeFontSize != null) {
message.codeFontSize = data.codeFontSize;
}
if (data.point != null) {
message.point = Point.fromObject(data.point);
}
if (data.direction != null) {
message.direction = data.direction;
}
return message; return message;
} }
toObject() { toObject() {
const data: { const data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>; common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string; code?: string;
codeColor?: string;
codeFontSize?: number;
point?: ReturnType<typeof Point.prototype.toObject>;
direction?: string;
} = {}; } = {};
if (this.common != null) { if (this.common != null) {
data.common = this.common.toObject(); data.common = this.common.toObject();
@ -2628,18 +2237,6 @@ export namespace graphicData {
if (this.code != null) { if (this.code != null) {
data.code = this.code; data.code = this.code;
} }
if (this.codeColor != null) {
data.codeColor = this.codeColor;
}
if (this.codeFontSize != null) {
data.codeFontSize = this.codeFontSize;
}
if (this.point != null) {
data.point = this.point.toObject();
}
if (this.direction != null) {
data.direction = this.direction;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -2650,14 +2247,6 @@ export namespace graphicData {
writer.writeMessage(1, this.common, () => this.common.serialize(writer)); writer.writeMessage(1, this.common, () => this.common.serialize(writer));
if (this.code.length) if (this.code.length)
writer.writeString(2, this.code); writer.writeString(2, this.code);
if (this.codeColor.length)
writer.writeString(3, this.codeColor);
if (this.codeFontSize != 0)
writer.writeInt32(4, this.codeFontSize);
if (this.has_point)
writer.writeMessage(5, this.point, () => this.point.serialize(writer));
if (this.direction.length)
writer.writeString(6, this.direction);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -2673,18 +2262,6 @@ export namespace graphicData {
case 2: case 2:
message.code = reader.readString(); message.code = reader.readString();
break; break;
case 3:
message.codeColor = reader.readString();
break;
case 4:
message.codeFontSize = reader.readInt32();
break;
case 5:
reader.readMessage(message.point, () => message.point = Point.deserialize(reader));
break;
case 6:
message.direction = reader.readString();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }