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

View File

@ -43,6 +43,12 @@ export class StationLineData
set hideName(v: boolean) {
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 {
return new StationLineData(this.data.cloneMessage());
}

View File

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

View File

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