This commit is contained in:
fan 2023-10-25 09:24:24 +08:00
commit f769d1148f
4 changed files with 67 additions and 13 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<q-form> <q-form class="q-gutter-sm">
<q-input <q-input
outlined outlined
readonly readonly
@ -30,6 +30,15 @@
map-options map-options
emit-value emit-value
/> />
<q-select
outlined
v-model="stationLineModel.color"
:options="colorOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="站名颜色"
/>
</q-form> </q-form>
</template> </template>
@ -37,6 +46,7 @@
import { useFormData } from 'src/components/DrawAppFormUtils'; import { useFormData } from 'src/components/DrawAppFormUtils';
import { StationLineData } from 'src/drawApp/graphics/StationLineInteraction'; import { StationLineData } from 'src/drawApp/graphics/StationLineInteraction';
import { useDrawStore } from 'src/stores/draw-store'; import { useDrawStore } from 'src/stores/draw-store';
import { graphicData } from 'src/protos/stationLayoutGraphics';
const drawStore = useDrawStore(); const drawStore = useDrawStore();
const { data: stationLineModel, onUpdate } = useFormData( const { data: stationLineModel, onUpdate } = useFormData(
@ -47,4 +57,9 @@ const optionsCircle = [
{ label: '是', value: true }, { label: '是', value: true },
{ label: '否', value: false }, { label: '否', value: false },
]; ];
const colorOptions = [
{ label: '橘黄色', value: graphicData.StationLine.stationColor.orange },
{ label: '灰色', value: graphicData.StationLine.stationColor.gray },
];
</script> </script>

View File

@ -43,6 +43,12 @@ export class StationLineData
set hideName(v: boolean) { set hideName(v: boolean) {
this.data.hideName = v; this.data.hideName = v;
} }
get color(): graphicData.StationLine.stationColor {
return this.data.codeColor;
}
set color(v: graphicData.StationLine.stationColor) {
this.data.codeColor = v;
}
clone(): StationLineData { clone(): StationLineData {
return new StationLineData(this.data.cloneMessage()); return new StationLineData(this.data.cloneMessage());
} }

View File

@ -5,6 +5,7 @@ import {
JlGraphicTemplate, JlGraphicTemplate,
VectorText, VectorText,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
import { graphicData } from 'src/protos/stationLayoutGraphics';
export interface IStationLineData extends GraphicData { export interface IStationLineData extends GraphicData {
get code(): string; // 编号 get code(): string; // 编号
@ -13,6 +14,8 @@ export interface IStationLineData extends GraphicData {
set hasTransfer(v: boolean); set hasTransfer(v: boolean);
get hideName(): boolean; get hideName(): boolean;
set hideName(v: boolean); set hideName(v: boolean);
get color(): graphicData.StationLine.stationColor;
set color(v: graphicData.StationLine.stationColor);
clone(): IStationLineData; clone(): IStationLineData;
copyFrom(data: IStationLineData): void; copyFrom(data: IStationLineData): void;
@ -22,12 +25,13 @@ export interface IStationLineData extends GraphicData {
const stationConsts = { const stationConsts = {
radius: 5, radius: 5,
borderWidth: 1, borderWidth: 1,
borderColor: '0xffffff', circleWhite: '0xffffff',
fillColor: '0xffffff', circleGray: '0xD5D5D5',
transferRadius: 3.5, transferRadius: 3.5,
transferWidth: 0.4, transferWidth: 0.4,
transferColor: '0xff0000', transferColor: '0xff0000',
codeColor: '0xF48815', codeOrange: '0xF48815',
codeGray: '0xD5D5D5',
codeFontSize: 8, codeFontSize: 8,
codeOffsetY: 20, codeOffsetY: 20,
}; };
@ -48,14 +52,13 @@ class circleGraphic extends Container {
} }
draw(datas: IStationLineData): void { draw(datas: IStationLineData): void {
const circle = this.circle; const circle = this.circle;
circle.clear(); const fillColor =
circle.lineStyle( datas.color == 0 ? stationConsts.circleWhite : stationConsts.circleGray;
stationConsts.borderWidth, circle
new Color(stationConsts.borderColor) .clear()
); .lineStyle(stationConsts.borderWidth, new Color(fillColor))
circle.beginFill(stationConsts.fillColor, 1); .beginFill(fillColor, 1)
circle.drawCircle(0, 0, stationConsts.radius); .drawCircle(0, 0, stationConsts.radius).endFill;
circle.endFill;
const arcGraphicUp = this.arcUp; const arcGraphicUp = this.arcUp;
const arcGraphicDown = this.arcDown; const arcGraphicDown = this.arcDown;
const arrowUpGraphic = this.arrowUp; const arrowUpGraphic = this.arrowUp;
@ -117,7 +120,8 @@ export class StationLine extends JlGraphic {
this.circleGraphic.draw(this.datas); this.circleGraphic.draw(this.datas);
const codeGraph = this.codeGraph; const codeGraph = this.codeGraph;
codeGraph.text = this.datas?.code || '车站StationLine'; codeGraph.text = this.datas?.code || '车站StationLine';
codeGraph.style.fill = stationConsts.codeColor; codeGraph.style.fill =
this.datas.color == 0 ? stationConsts.codeOrange : stationConsts.codeGray;
codeGraph.setVectorFontSize(stationConsts.codeFontSize); codeGraph.setVectorFontSize(stationConsts.codeFontSize);
codeGraph.anchor.set(0.5); codeGraph.anchor.set(0.5);
codeGraph.visible = !this.datas.hideName; codeGraph.visible = !this.datas.hideName;

View File

@ -2079,6 +2079,7 @@ export namespace graphicData {
code?: string; code?: string;
hasTransfer?: boolean; hasTransfer?: boolean;
hideName?: boolean; hideName?: boolean;
codeColor?: StationLine.stationColor;
}) { }) {
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);
@ -2095,6 +2096,9 @@ export namespace graphicData {
if ("hideName" in data && data.hideName != undefined) { if ("hideName" in data && data.hideName != undefined) {
this.hideName = data.hideName; this.hideName = data.hideName;
} }
if ("codeColor" in data && data.codeColor != undefined) {
this.codeColor = data.codeColor;
}
} }
} }
get common() { get common() {
@ -2124,11 +2128,18 @@ export namespace graphicData {
set hideName(value: boolean) { set hideName(value: boolean) {
pb_1.Message.setField(this, 4, value); pb_1.Message.setField(this, 4, value);
} }
get codeColor() {
return pb_1.Message.getFieldWithDefault(this, 5, StationLine.stationColor.orange) as StationLine.stationColor;
}
set codeColor(value: StationLine.stationColor) {
pb_1.Message.setField(this, 5, value);
}
static fromObject(data: { static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>; common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string; code?: string;
hasTransfer?: boolean; hasTransfer?: boolean;
hideName?: boolean; hideName?: boolean;
codeColor?: StationLine.stationColor;
}): StationLine { }): StationLine {
const message = new StationLine({}); const message = new StationLine({});
if (data.common != null) { if (data.common != null) {
@ -2143,6 +2154,9 @@ export namespace graphicData {
if (data.hideName != null) { if (data.hideName != null) {
message.hideName = data.hideName; message.hideName = data.hideName;
} }
if (data.codeColor != null) {
message.codeColor = data.codeColor;
}
return message; return message;
} }
toObject() { toObject() {
@ -2151,6 +2165,7 @@ export namespace graphicData {
code?: string; code?: string;
hasTransfer?: boolean; hasTransfer?: boolean;
hideName?: boolean; hideName?: boolean;
codeColor?: StationLine.stationColor;
} = {}; } = {};
if (this.common != null) { if (this.common != null) {
data.common = this.common.toObject(); data.common = this.common.toObject();
@ -2164,6 +2179,9 @@ export namespace graphicData {
if (this.hideName != null) { if (this.hideName != null) {
data.hideName = this.hideName; data.hideName = this.hideName;
} }
if (this.codeColor != null) {
data.codeColor = this.codeColor;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -2178,6 +2196,8 @@ export namespace graphicData {
writer.writeBool(3, this.hasTransfer); writer.writeBool(3, this.hasTransfer);
if (this.hideName != false) if (this.hideName != false)
writer.writeBool(4, this.hideName); writer.writeBool(4, this.hideName);
if (this.codeColor != StationLine.stationColor.orange)
writer.writeEnum(5, this.codeColor);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -2199,6 +2219,9 @@ export namespace graphicData {
case 4: case 4:
message.hideName = reader.readBool(); message.hideName = reader.readBool();
break; break;
case 5:
message.codeColor = reader.readEnum();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }
@ -2211,6 +2234,12 @@ export namespace graphicData {
return StationLine.deserialize(bytes); return StationLine.deserialize(bytes);
} }
} }
export namespace StationLine {
export enum stationColor {
orange = 0,
gray = 1
}
}
export class TrainWindow extends pb_1.Message { export class TrainWindow extends pb_1.Message {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor(data?: any[] | { constructor(data?: any[] | {