车次窗大小和位置

This commit is contained in:
joylink_zhaoerwei 2023-07-19 17:27:35 +08:00
parent f67255243f
commit 25b4f6d3ea
3 changed files with 71 additions and 10 deletions

View File

@ -5,7 +5,7 @@
:titleColor="`${bgColor}`"
:titleHeight="40"
:fontSize="22"
:width="720"
:width="`${dialogWidth}`"
:height="450"
:bgColor="`${bgColor}`"
>
@ -67,6 +67,7 @@ const mapAlarmMessage = new Map([
]);
const bgColor = 'yellow';
const dialogWidth = window.screen.width * 0.4;
const $q = useQuasar();
const lineNetStore = useLineNetStore();
const alarmInfo = ref({
@ -78,7 +79,9 @@ const alarmInfo = ref({
info: '',
reason: '',
});
alarmInfo.value.time = lineNetStore.alarmInfo[0].alert_time;
alarmInfo.value.time = lineNetStore.alarmInfo[0].alert_time
.substring(0, 19)
.replace('T', ' ');
alarmInfo.value.level = lineNetStore.alarmInfo[0].level;
alarmInfo.value.deviceInfo = lineNetStore.alarmInfo[0].device_info;
alarmInfo.value.info = lineNetStore.alarmInfo[0].info;

View File

@ -3,6 +3,7 @@ import {
GraphicData,
JlGraphic,
JlGraphicTemplate,
distance2,
getRectangleCenter,
} from 'src/jl-graphic';
import { LogicSection } from '../logicSection/LogicSection';
@ -37,7 +38,20 @@ export class TrainWindow extends JlGraphic {
return this.getDatas<ITrainWindowData>();
}
doRepaint(): void {
const width = TrainWindowConsts.width;
const logicSection = this.queryStore.queryById<LogicSection>(
this.datas.refDeviceId[0]
);
let width = TrainWindowConsts.width;
if (logicSection.type == 'LogicSection') {
const ps = logicSection.localToCanvasPoint(logicSection.datas.points[0]);
const pe = logicSection.localToCanvasPoint(
logicSection.datas.points[logicSection.datas.points.length - 1]
);
width =
distance2(ps, pe) < TrainWindowConsts.width
? distance2(ps, pe)
: TrainWindowConsts.width;
}
const rectGraphic = this.rectGraphic;
rectGraphic.clear();
rectGraphic.lineStyle(

View File

@ -20,6 +20,35 @@ import { Section, SectionType } from '../section/Section';
import { LogicSection } from '../logicSection/LogicSection';
import { Platform } from '../platform/Platform';
function graphicsOverlap(
x1: number,
y1: number,
x2: number,
y2: number,
x3: number,
y3: number,
x4: number,
y4: number,
x5: number,
y5: number,
x6: number,
y6: number,
x7: number,
y7: number,
x8: number,
y8: number
) {
if (
Math.max(x1, x2, x3, x4) >= Math.min(x5, x6, x7, x8) &&
Math.min(x1, x2, x3, x4) <= Math.max(x5, x6, x7, x8) &&
Math.max(y1, y2, y3, y4) >= Math.min(y5, y6, y7, y8) &&
Math.min(y1, y2, y3, y4) <= Math.max(y5, y6, y7, y8)
) {
return true;
}
return false;
}
export interface ITrainWindowDrawOptions {
newData: () => ITrainWindowData;
}
@ -113,14 +142,31 @@ export class TrainWindowDraw extends GraphicDrawAssistant<
x,
ps.y - direction * TrainWindowConsts.offsetSection
);
trainWindow.id = GraphicIdGenerator.next();
this.storeGraphic(trainWindow);
const platforms = this.app.queryStore.queryByType<Platform>(Platform.Type);
platforms.forEach((platform) => {
const platformPolygonPoints = platform.localBoundsToCanvasPoints();
const pP = platform.localBoundsToCanvasPoints();
const tP = trainWindow.localBoundsToCanvasPoints();
if (
trainWindow.x > platformPolygonPoints[0].x &&
trainWindow.x < platformPolygonPoints[1].x &&
trainWindow.y > platformPolygonPoints[0].y &&
trainWindow.y < platformPolygonPoints[3].y
graphicsOverlap(
pP[0].x,
pP[0].y,
pP[1].x,
pP[1].y,
pP[2].x,
pP[2].y,
pP[3].x,
pP[3].y,
tP[0].x,
tP[0].y,
tP[1].x,
tP[1].y,
tP[2].x,
tP[2].y,
tP[3].x,
tP[3].y
)
) {
trainWindow.position.set(
x,
@ -128,8 +174,6 @@ export class TrainWindowDraw extends GraphicDrawAssistant<
);
}
});
trainWindow.id = GraphicIdGenerator.next();
this.storeGraphic(trainWindow);
trainWindow.loadRelations();
}
oneGenerates(height: Point) {