通过集中区分割线一键关联集中站
This commit is contained in:
parent
96c7c9212f
commit
b274d20525
@ -649,14 +649,62 @@ function oneClickRelateCentralizedStation() {
|
||||
containDeviceIds = Array.from(new Set(containDeviceIds));
|
||||
});
|
||||
|
||||
if (rightDatas.refRightStationId) {
|
||||
const containDevices = containDeviceIds.map((id) => {
|
||||
return drawApp.queryStore.queryById(id);
|
||||
});
|
||||
handleCentralizedStationsData(containDevices, [
|
||||
const signals = drawApp.queryStore
|
||||
.queryByType<Signal>(Signal.Type)
|
||||
.filter((g) => containDeviceIds.includes(g.datas.refDev.id));
|
||||
const transponders = drawApp.queryStore
|
||||
.queryByType<Transponder>(Transponder.Type)
|
||||
.filter((g) => containDeviceIds.includes(g.datas.TransponderRef.id));
|
||||
const axleCountings = drawApp.queryStore
|
||||
.queryByType<AxleCounting>(AxleCounting.Type)
|
||||
.filter((g) => {
|
||||
const axleCountingRefId = g.datas.axleCountingRef.map(
|
||||
(ref) => ref.id
|
||||
);
|
||||
if (
|
||||
findCommonElements([axleCountingRefId, containDeviceIds]).length
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
const allSetCentralizedStationsDevice = [
|
||||
...containDevices,
|
||||
...signals,
|
||||
...transponders,
|
||||
...axleCountings,
|
||||
];
|
||||
allSetCentralizedStationsDevice.forEach(
|
||||
(g) => ((g as Signal).datas.centralizedStations = [])
|
||||
);
|
||||
handleCentralizedStationsData(allSetCentralizedStationsDevice, [
|
||||
rightDatas.refRightStationId,
|
||||
]);
|
||||
}
|
||||
}
|
||||
//区段边界的计轴单独处理
|
||||
const axleCountings = drawApp.queryStore
|
||||
.queryByType<AxleCounting>(AxleCounting.Type)
|
||||
.filter(
|
||||
(g) =>
|
||||
g.datas.type ==
|
||||
graphicData.AxleCounting.TypeDetectionPoint.SectionBoundary
|
||||
);
|
||||
axleCountings.forEach((g) => {
|
||||
if (g.datas.axleCountingRef.length == 2) {
|
||||
const centralizedStations: string[] = [];
|
||||
g.datas.axleCountingRef.forEach((ref) => {
|
||||
const section = drawApp.queryStore.queryById<Section>(ref.id);
|
||||
centralizedStations.push(...section.datas.centralizedStations);
|
||||
});
|
||||
g.datas.centralizedStations = Array.from(new Set(centralizedStations));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//相同的编号后缀-道岔、信号机、区段
|
||||
const commonCodeEndings = ref('_');
|
||||
|
@ -4,6 +4,7 @@ import {
|
||||
JlGraphic,
|
||||
JlGraphicTemplate,
|
||||
calculateDistanceFromPointToLine,
|
||||
getRectangleCenter,
|
||||
} from 'src/jl-graphic';
|
||||
import { ILineGraphic } from 'src/jl-graphic/plugins/GraphicEditPlugin';
|
||||
import { SectionGraphic } from '../sectionGraphic/SectionGraphic';
|
||||
@ -133,11 +134,17 @@ export class ConcentrationDividingLine
|
||||
nodeConWithSecs.sort((a, b) => {
|
||||
const sectionAId =
|
||||
a.leftSectionId !== '' ? a.leftSectionId : a.rightSectionId;
|
||||
const sectionA = this.queryStore.queryById<Section>(sectionAId);
|
||||
const sectionBId =
|
||||
b.leftSectionId !== '' ? b.leftSectionId : b.rightSectionId;
|
||||
const sectionB = this.queryStore.queryById<Section>(sectionBId);
|
||||
return (
|
||||
this.queryStore.queryById<Section>(sectionAId).position.y -
|
||||
this.queryStore.queryById<Section>(sectionBId).position.y
|
||||
sectionA.localToCanvasPoint(
|
||||
getRectangleCenter(sectionA.getLocalBounds())
|
||||
).y -
|
||||
sectionB.localToCanvasPoint(
|
||||
getRectangleCenter(sectionB.getLocalBounds())
|
||||
).y
|
||||
);
|
||||
});
|
||||
this.datas.nodeConWithSecs = nodeConWithSecs;
|
||||
|
Loading…
Reference in New Issue
Block a user