线网车站加颜色选择

This commit is contained in:
joylink_zhaoerwei 2023-10-24 18:06:52 +08:00
parent ef8cabe774
commit cb39384b42
4 changed files with 58 additions and 3 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;
@ -27,7 +30,8 @@ const stationConsts = {
transferRadius: 3.5,
transferWidth: 0.4,
transferColor: '0xff0000',
codeColor: '0xF48815',
codeOrange: '0xF48815',
codeGray: 'D5D5D5',
codeFontSize: 8,
codeOffsetY: 20,
};
@ -117,7 +121,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[] | {