运行线灰线段

This commit is contained in:
fan 2023-10-25 09:24:19 +08:00
parent ef8cabe774
commit 73791597f1
8 changed files with 12723 additions and 2578 deletions

10182
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,65 @@
<!-- eslint-disable vue/no-mutating-props -->
<template>
<q-dialog ref="dialogRef" style="width 800px;">
<q-card
style="max-width: 900px"
:style="{ width: `${80 * props.runLinePoints.length}px` }"
>
<q-card-section> <div class="text-h6">划定端点</div> </q-card-section>
<q-card-section class="q-pt-none">
<q-range
class="q-mt-xl"
v-model="model"
color="purple"
style="padding: 0px 30px; font-size: 10px"
markers
:marker-labels="objMarkerLabel"
:min="0"
:max="props.runLinePoints.length - 1"
/>
</q-card-section>
<q-card-actions align="right" class="text-primary">
<q-btn flat label="取消" @click="onDialogCancel" v-close-popup />
<q-btn flat label="确认" @click="onDialogOK(model)" v-close-popup />
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script setup lang="ts">
import { IPointData } from 'pixi.js';
import { useDialogPluginComponent } from 'quasar';
import { ref, onMounted } from 'vue';
const props = defineProps({
runLinePoints: {
type: Array<IPointData>,
required: true,
},
garyPointIndexs: {
type: Array<number>,
required: true,
},
});
const objMarkerLabel = (val: number) =>
`P${val}[${props.runLinePoints[val].x},${props.runLinePoints[val].y}]`;
const model = ref({
min: 0,
max: 0,
});
onMounted(() => {
console.log(props.garyPointIndexs, '===');
if (props.garyPointIndexs.length) {
model.value = {
min: props.garyPointIndexs[0],
max: props.garyPointIndexs[props.garyPointIndexs.length - 1],
};
}
});
defineEmits([...useDialogPluginComponent.emits]);
const { dialogRef, onDialogOK, onDialogCancel } = useDialogPluginComponent();
</script>
<style scoped></style>

View File

@ -24,6 +24,7 @@ import {
import { RunLineGraphicHitArea } from 'src/graphics/runLine/RunLineDrawAssistant';
import { Dialog } from 'quasar';
import SetDashLineDialog from '../../components/draw-app/dialogs/SetDashLineDialog.vue';
import SetGaryLineDialog from '../../components/draw-app/dialogs/SetGaryLineDialog.vue';
export class RunLineData extends GraphicDataBase implements IRunLineData {
constructor(data?: graphicData.RunLine) {
@ -90,6 +91,12 @@ export class RunLineData extends GraphicDataBase implements IRunLineData {
set dashPointIndexs(v: number[]) {
this.data.dashPointIndexs = v;
}
get grayPointIndexs(): number[] {
return this.data.grayPointIndexs;
}
set grayPointIndexs(v: number[]) {
this.data.grayPointIndexs = v;
}
clone(): RunLineData {
return new RunLineData(this.data.cloneMessage());
}
@ -113,12 +120,20 @@ export const clearWaypointsConfig: MenuItemOptions = {
export const setDashLineConfig: MenuItemOptions = {
name: '设置虚线段',
};
export const setGrayLineConfig: MenuItemOptions = {
name: '设置灰线段',
};
const RunLineEditMenu: ContextMenu = ContextMenu.init({
name: '运行线编辑菜单',
groups: [
{
items: [addWaypointConfig, clearWaypointsConfig, setDashLineConfig],
items: [
addWaypointConfig,
clearWaypointsConfig,
setDashLineConfig,
setGrayLineConfig,
],
},
],
});
@ -195,7 +210,7 @@ export class DrawRunLinePlugin extends GraphicInteractionPlugin<RunLine> {
};
setDashLineConfig.handler = () => {
Dialog.create({
title: '创建列车',
title: '设置虚线段',
message: '',
component: SetDashLineDialog,
componentProps: {
@ -215,6 +230,29 @@ export class DrawRunLinePlugin extends GraphicInteractionPlugin<RunLine> {
runLine.doRepaint();
});
};
setGrayLineConfig.handler = () => {
console.log(runLine.datas, '11111');
Dialog.create({
title: '设置灰线段',
message: '',
component: SetGaryLineDialog,
componentProps: {
runLinePoints: runLine.datas.points,
garyPointIndexs: runLine.datas.grayPointIndexs,
},
cancel: true,
persistent: true,
}).onOk((data: { min: number; max: number }) => {
const indexList = [];
if (data.min !== data.max) {
for (let i = data.min; i <= data.max; i++) {
indexList.push(i);
}
}
runLine.datas.grayPointIndexs = indexList;
runLine.doRepaint();
});
};
RunLineEditMenu.open(e.global);
}
}

View File

@ -33,6 +33,8 @@ export interface IRunLineData extends GraphicData {
set lineId(v: string);
get dashPointIndexs(): number[];
set dashPointIndexs(v: number[]);
get grayPointIndexs(): number[];
set grayPointIndexs(v: number[]);
clone(): IRunLineData;
copyFrom(data: IRunLineData): void;
@ -41,6 +43,7 @@ export interface IRunLineData extends GraphicData {
export enum RunLineColorEnum {
runLineColor = '0XC1F467',
grayLineColor = '0XCCCCCC',
}
export const runLineConsts = {
@ -91,7 +94,24 @@ export class RunLine extends JlGraphic {
this.lineBody.lineTo(p.x, p.y);
}
const bgColor = '0X' + this.getCanvas().backgroundColor.substring(1);
const bgColor =
'0X' + this.getCanvas().properties.backgroundColor.substring(1);
const grayPoints: IPointData[] = [];
this.datas.grayPointIndexs.forEach((i) => {
grayPoints.push(this.datas.points[i]);
});
if (grayPoints.length > 1) {
this.lineBody.lineStyle({
width: runLineConsts.runLineWidth,
color: RunLineColorEnum.grayLineColor,
join: LINE_JOIN.ROUND,
});
this.lineBody.moveTo(grayPoints[0].x, grayPoints[0].y);
for (let i = 1; i < grayPoints.length; i++) {
this.lineBody.lineTo(grayPoints[i].x, grayPoints[i].y);
}
}
const dashPoints: IPointData[] = [];
this.datas.dashPointIndexs.forEach((i) => {
dashPoints.push(this.datas.points[i]);

View File

@ -31,17 +31,6 @@ export namespace alert {
AXLE_LED_ORANGE_MOST = 16,
SWITCH_LOST_MOST = 17,
TRAIN_EB_ATP = 18,
ALL_LINE_BLUE_DISPLAY = 19,
AXLE_LED_RED_INTERLOCK_AREA = 20,
AXLE_LED_ORANGE_INTERLOCK_AREA = 21,
SWITCH_LOST_INTERLOCK_AREA = 22,
INTERLOCK_LEVEL_ONE = 23
}
export enum TipTimeConfig {
HOLIDAYS_MORN_PEAK = 0,
HOLIDAYS_EVENING_PEAK = 1,
MORN_PEAK = 2,
EVENING_PEARK = 3,
NORMAL_UNPEARK = 4
ALL_LINE_BLUE_DISPLAY = 19
}
}

View File

@ -3255,9 +3255,10 @@ export namespace graphicData {
linkPathLines?: string[];
lineId?: string;
dashPointIndexs?: number[];
grayPointIndexs?: number[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 8, 9, 11], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 8, 9, 11, 12], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("common" in data && data.common != undefined) {
this.common = data.common;
@ -3286,6 +3287,9 @@ export namespace graphicData {
if ("dashPointIndexs" in data && data.dashPointIndexs != undefined) {
this.dashPointIndexs = data.dashPointIndexs;
}
if ("grayPointIndexs" in data && data.grayPointIndexs != undefined) {
this.grayPointIndexs = data.grayPointIndexs;
}
}
}
get common() {
@ -3345,6 +3349,12 @@ export namespace graphicData {
set dashPointIndexs(value: number[]) {
pb_1.Message.setField(this, 11, value);
}
get grayPointIndexs() {
return pb_1.Message.getFieldWithDefault(this, 12, []) as number[];
}
set grayPointIndexs(value: number[]) {
pb_1.Message.setField(this, 12, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
@ -3355,6 +3365,7 @@ export namespace graphicData {
linkPathLines?: string[];
lineId?: string;
dashPointIndexs?: number[];
grayPointIndexs?: number[];
}): RunLine {
const message = new RunLine({});
if (data.common != null) {
@ -3384,6 +3395,9 @@ export namespace graphicData {
if (data.dashPointIndexs != null) {
message.dashPointIndexs = data.dashPointIndexs;
}
if (data.grayPointIndexs != null) {
message.grayPointIndexs = data.grayPointIndexs;
}
return message;
}
toObject() {
@ -3397,6 +3411,7 @@ export namespace graphicData {
linkPathLines?: string[];
lineId?: string;
dashPointIndexs?: number[];
grayPointIndexs?: number[];
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -3425,6 +3440,9 @@ export namespace graphicData {
if (this.dashPointIndexs != null) {
data.dashPointIndexs = this.dashPointIndexs;
}
if (this.grayPointIndexs != null) {
data.grayPointIndexs = this.grayPointIndexs;
}
return data;
}
serialize(): Uint8Array;
@ -3449,6 +3467,8 @@ export namespace graphicData {
writer.writeString(10, this.lineId);
if (this.dashPointIndexs.length)
writer.writePackedInt32(11, this.dashPointIndexs);
if (this.grayPointIndexs.length)
writer.writePackedInt32(12, this.grayPointIndexs);
if (!w)
return writer.getResultBuffer();
}
@ -3485,6 +3505,9 @@ export namespace graphicData {
case 11:
message.dashPointIndexs = reader.readPackedInt32();
break;
case 12:
message.grayPointIndexs = reader.readPackedInt32();
break;
default: reader.skipField();
}
}

@ -1 +1 @@
Subproject commit 7aebba13bf04bf2c59df3595c5650a96e616bef4
Subproject commit fc47b23c360355c00dc42d7a6d5bae1fe0aeb417

4950
yarn.lock

File diff suppressed because it is too large Load Diff