一键修改公里标方向

This commit is contained in:
fan 2023-08-10 16:27:16 +08:00
parent 65790da7b6
commit 6674a30070
5 changed files with 127 additions and 35 deletions

View File

@ -163,6 +163,7 @@ watchEffect(() => {
ks.coordinateSystem =
turnoutModel.value.kilometerSystem[i].coordinateSystem;
ks.kilometer = turnoutModel.value.kilometerSystem[i].kilometer;
ks.direction = turnoutModel.value.kilometerSystem[i].direction;
});
}
}

View File

@ -116,7 +116,7 @@ export class SectionLink extends JlGraphic implements ILineGraphic {
);
this.divisionGraphic.moveTo(nextP3.x, nextP3.y);
this.divisionGraphic.lineTo(nextP2.x, nextP2.y);
this.labelGraphic.text = this.datas.code;
this.labelGraphic.text = this.code;
const labelPosition = this.datas?.childTransforms?.find(
(item: IChildTransform) => item.name === this.labelGraphic.name
)?.transform.position;

View File

@ -99,40 +99,6 @@ export interface ISignalState extends GraphicState {
// set lampFailure(v: boolean);
}
// export enum CodeColorEnum {
// defaultCodeColor = '0XFFFFFF',
// }
// const signalCodeConsts = {
// codeFontSize: 11,
// blockedLineWidth: 1,
// blockedColor: '0XFF0000',
// };
// export enum LampEnum {
// lampPostColor = '0xFFFFFF',
// redLamp = '0XFF0000',
// greenLamp = '0X00FF00',
// yellowLamp = '0XFFFF00',
// whiteLamp = '0XFFFFFF',
// blueLamp = '0X0033FF',
// }
// const lampConsts = {
// verticalLampPostLength: 16,
// levelLampPostLength: 4,
// postLineWidth: 3,
// lampRadius: 8,
// };
// const lampConsts = {
// lampRadius: 8,
// logicModeLineWidth: 2,
// logicModeDistance: 5,
// logicModeColor: '0x000000',
// lampLineWidth: 1,
// lampLineColor: '0x3149c3',
// };
export enum SignalColorEnum {
humanControlColor = '0xffff00',
fleetModeColor = '0x00ff00',

View File

@ -11,6 +11,13 @@ import { TrainWindowDraw } from './TrainWindowDrawAssistant';
import { AxleCounting } from '../axleCounting/AxleCounting';
import { AxleCountingDraw } from '../axleCounting/AxleCountingDrawAssistant';
import { useDrawStore } from 'src/stores/draw-store';
import { Signal } from '../signal/Signal';
import { Turnout } from '../turnout/Turnout';
import { Transponder } from '../transponder/Transponder';
import { StopPosition } from '../stopPosition/StopPosition';
import { SlopeKiloMarker } from '../slopeKiloMarker/SlopeKiloMarker';
import { CurvatureKiloMarker } from '../curvatureKiloMarker/CurvatureKiloMarker';
import { graphicData } from 'src/protos/stationLayoutGraphics';
interface IOneClickData extends GraphicData {
get code(): string; // 编号
@ -63,6 +70,96 @@ export class OneClickGenerateDraw extends GraphicDrawAssistant<
TrainWindow.Type
) as TrainWindowDraw;
trainWindowDraw.oneGenerates(this.toCanvasCoordinates(e.global));
} else if (
type === 'KilometerDirectionUpLeft' ||
type === 'KilometerDirectionUpRight'
) {
const axleCountings = this.app.queryStore.queryByType<AxleCounting>(
AxleCounting.Type
);
const signals = this.app.queryStore.queryByType<Signal>(Signal.Type);
const turnouts = this.app.queryStore.queryByType<Turnout>(Turnout.Type);
const transponders = this.app.queryStore.queryByType<Transponder>(
Transponder.Type
);
const stopPositions = this.app.queryStore.queryByType<StopPosition>(
StopPosition.Type
);
const slopeKiloMarkers = this.app.queryStore.queryByType<SlopeKiloMarker>(
SlopeKiloMarker.Type
);
const curvatureKiloMarkers =
this.app.queryStore.queryByType<CurvatureKiloMarker>(
CurvatureKiloMarker.Type
);
[...transponders, ...axleCountings, ...signals, ...stopPositions].forEach(
(elem) => {
if (
(elem.screenToLocalPoint(e.screen).y >= 0 &&
type === 'KilometerDirectionUpLeft') ||
(elem.screenToLocalPoint(e.screen).y < 0 &&
type === 'KilometerDirectionUpRight')
) {
if (elem.datas.kilometerSystem) {
elem.datas.kilometerSystem = new graphicData.KilometerSystem({
kilometer: elem.datas.kilometerSystem.kilometer,
coordinateSystem: elem.datas.kilometerSystem.coordinateSystem,
direction: graphicData.Direction.LEFT,
});
} else {
elem.datas.kilometerSystem = new graphicData.KilometerSystem({
direction: graphicData.Direction.LEFT,
});
}
} else {
if (elem.datas.kilometerSystem) {
elem.datas.kilometerSystem = new graphicData.KilometerSystem({
kilometer: elem.datas.kilometerSystem.kilometer,
coordinateSystem: elem.datas.kilometerSystem.coordinateSystem,
direction: graphicData.Direction.RIGHT,
});
} else {
elem.datas.kilometerSystem = new graphicData.KilometerSystem({
direction: graphicData.Direction.RIGHT,
});
}
}
}
);
[...turnouts, ...slopeKiloMarkers, ...curvatureKiloMarkers].forEach(
(elem) => {
if (
(elem.screenToLocalPoint(e.screen).y >= 0 &&
type === 'KilometerDirectionUpLeft') ||
(elem.screenToLocalPoint(e.screen).y < 0 &&
type === 'KilometerDirectionUpRight')
) {
const kss: graphicData.KilometerSystem[] = [];
elem.datas.kilometerSystem.forEach((ks) => {
kss.push(
new graphicData.KilometerSystem({
kilometer: ks.kilometer,
coordinateSystem: ks.coordinateSystem,
direction: graphicData.Direction.LEFT,
})
);
});
elem.datas.kilometerSystem = kss;
} else {
const kss: graphicData.KilometerSystem[] = [];
elem.datas.kilometerSystem.forEach((ks) => {
kss.push(
new graphicData.KilometerSystem({
kilometer: ks.kilometer,
coordinateSystem: ks.coordinateSystem,
direction: graphicData.Direction.RIGHT,
})
);
});
elem.datas.kilometerSystem = kss;
}
}
);
} else {
const axleCountingDraw = this.app.getDrawAssistant(
AxleCounting.Type

View File

@ -52,6 +52,12 @@
<q-item clickable v-close-popup @click="oneClickCurvature">
<q-item-section>一键生成曲度</q-item-section>
</q-item>
<q-item
clickable
v-close-popup
@click="onClickChangeKilometerDirection"
>一键修改公里标方向</q-item
>
</q-list>
</q-menu>
</q-btn>
@ -451,6 +457,28 @@ function oneClickSlope() {
.getDrawAssistant(Slope.Type) as SlopeDraw;
slopeDraw.oneGenerates();
}
function onClickChangeKilometerDirection() {
$q.dialog({
title: '请选择生成公里标系统方向',
message: '',
options: {
type: 'radio',
model: 'direction',
inline: true,
items: [
{ label: '上左下右', value: 'KilometerDirectionUpLeft' },
{ label: '上右下左', value: 'KilometerDirectionUpRight' },
],
},
cancel: true,
persistent: true,
}).onOk((data) => {
if (data) {
drawStore.oneClickType = data;
drawStore.getDrawApp().interactionPlugin(OneClickGenerate.Type).resume();
}
});
}
function oneClickCurvature() {
//
const curvatureDraw = drawStore