集中分割线关联道岔、信号机特殊处理
This commit is contained in:
parent
0d97067e0b
commit
9b73f9b502
@ -68,8 +68,8 @@ const centralizedStations = ref<{ label: string; value: string }[]>([]);
|
|||||||
|
|
||||||
const sectionRelations = computed(() => {
|
const sectionRelations = computed(() => {
|
||||||
const refSectionInfo: { label: string; refSectionInfo: string[] }[] = [
|
const refSectionInfo: { label: string; refSectionInfo: string[] }[] = [
|
||||||
{ label: '左边关联的区段', refSectionInfo: [] },
|
{ label: '左边关联的设备', refSectionInfo: [] },
|
||||||
{ label: '右边关联的区段', refSectionInfo: [] },
|
{ label: '右边关联的设备', refSectionInfo: [] },
|
||||||
];
|
];
|
||||||
enum devicePort {
|
enum devicePort {
|
||||||
'A',
|
'A',
|
||||||
|
@ -12,6 +12,7 @@ import { graphicData } from 'src/protos/stationLayoutGraphics';
|
|||||||
import { Section, SectionPort, SectionType } from '../section/Section';
|
import { Section, SectionPort, SectionType } from '../section/Section';
|
||||||
import { arePolylinesIntersect } from './ConcentrationDividingLineUtils';
|
import { arePolylinesIntersect } from './ConcentrationDividingLineUtils';
|
||||||
import { createRelatedRefProto } from '../CommonGraphics';
|
import { createRelatedRefProto } from '../CommonGraphics';
|
||||||
|
import { Turnout, TurnoutPort } from '../turnout/Turnout';
|
||||||
|
|
||||||
export interface IConcentrationDividingLineData extends GraphicData {
|
export interface IConcentrationDividingLineData extends GraphicData {
|
||||||
get code(): string; // 编号
|
get code(): string; // 编号
|
||||||
@ -34,6 +35,12 @@ export const ConcentrationDividingLineConsts = {
|
|||||||
lineWidth: 2,
|
lineWidth: 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum devicePort {
|
||||||
|
'A',
|
||||||
|
'B',
|
||||||
|
'C',
|
||||||
|
}
|
||||||
|
|
||||||
export class ConcentrationDividingLine
|
export class ConcentrationDividingLine
|
||||||
extends JlGraphic
|
extends JlGraphic
|
||||||
implements ILineGraphic
|
implements ILineGraphic
|
||||||
@ -101,44 +108,59 @@ export class ConcentrationDividingLine
|
|||||||
hasNode.segment2[1],
|
hasNode.segment2[1],
|
||||||
section.localToCanvasPoint(section.getEndPoint())
|
section.localToCanvasPoint(section.getEndPoint())
|
||||||
);
|
);
|
||||||
const relationParam = minA > minB ? 'B' : 'A';
|
const relationParam = minA > minB ? SectionPort.B : SectionPort.A;
|
||||||
const sectionRelations = section.relationManage
|
const portRefOtherDevice =
|
||||||
.getRelationsOfGraphicAndOtherType(section, Section.Type)
|
relationParam == 'A' ? section.datas.paRef : section.datas.pbRef;
|
||||||
.filter(
|
|
||||||
(relation) =>
|
|
||||||
relation.getRelationParam(section).param == relationParam
|
|
||||||
)
|
|
||||||
.map((relation) => relation.getOtherGraphic<Section>(section));
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
sectionRelations.length == 1 &&
|
portRefOtherDevice?.id &&
|
||||||
!hasNodeSection.get(section.id) &&
|
!hasNodeSection.get(section.id) &&
|
||||||
!hasNodeSection.get(sectionRelations[0].id)
|
!hasNodeSection.get(portRefOtherDevice.id)
|
||||||
) {
|
) {
|
||||||
const [leftSectionId, rightSectionId] =
|
const refDevice = this.queryStore.queryById<Turnout | Section>(
|
||||||
relationParam === 'A'
|
portRefOtherDevice?.id
|
||||||
? [sectionRelations[0].id, section.id]
|
);
|
||||||
: [section.id, sectionRelations[0].id];
|
const [leftDevice, rightDevice] =
|
||||||
hasNodeSection.set(leftSectionId, '1');
|
refDevice.localToCanvasPoint(
|
||||||
hasNodeSection.set(rightSectionId, '1');
|
getRectangleCenter(refDevice.getLocalBounds())
|
||||||
|
) <
|
||||||
|
section.localToCanvasPoint(
|
||||||
|
getRectangleCenter(section.getLocalBounds())
|
||||||
|
)
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
device: refDevice,
|
||||||
|
port: devicePort[
|
||||||
|
portRefOtherDevice.devicePort
|
||||||
|
] as TurnoutPort,
|
||||||
|
},
|
||||||
|
{ device: section, port: relationParam },
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
{ device: section, port: relationParam },
|
||||||
|
{
|
||||||
|
device: refDevice,
|
||||||
|
port: devicePort[
|
||||||
|
portRefOtherDevice.devicePort
|
||||||
|
] as TurnoutPort,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
hasNodeSection.set(leftDevice.device.id, '1');
|
||||||
|
hasNodeSection.set(rightDevice.device.id, '1');
|
||||||
nodeConWithSecs.push(
|
nodeConWithSecs.push(
|
||||||
new graphicData.NodeConWithSec({
|
new graphicData.NodeConWithSec({
|
||||||
leftSection: createRelatedRefProto(
|
leftSection: createRelatedRefProto(
|
||||||
Section.Type,
|
leftDevice.device.type,
|
||||||
leftSectionId,
|
leftDevice.device.id,
|
||||||
SectionPort.B
|
leftDevice.port
|
||||||
),
|
),
|
||||||
rightSection: createRelatedRefProto(
|
rightSection: createRelatedRefProto(
|
||||||
Section.Type,
|
rightDevice.device.type,
|
||||||
rightSectionId,
|
rightDevice.device.id,
|
||||||
SectionPort.A
|
rightDevice.port
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
} else if (
|
} else if (!hasNodeSection.get(section.id) && !portRefOtherDevice?.id) {
|
||||||
!hasNodeSection.get(section.id) &&
|
|
||||||
sectionRelations.length == 0
|
|
||||||
) {
|
|
||||||
const [leftSectionId, rightSectionId] =
|
const [leftSectionId, rightSectionId] =
|
||||||
relationParam === 'A' ? ['', section.id] : [section.id, ''];
|
relationParam === 'A' ? ['', section.id] : [section.id, ''];
|
||||||
hasNodeSection.set(section.id, '1');
|
hasNodeSection.set(section.id, '1');
|
||||||
@ -162,10 +184,10 @@ export class ConcentrationDividingLine
|
|||||||
nodeConWithSecs.sort((a, b) => {
|
nodeConWithSecs.sort((a, b) => {
|
||||||
const sectionAId =
|
const sectionAId =
|
||||||
a.leftSection.id !== '' ? a.leftSection.id : a.rightSection.id;
|
a.leftSection.id !== '' ? a.leftSection.id : a.rightSection.id;
|
||||||
const sectionA = this.queryStore.queryById<Section>(sectionAId);
|
const sectionA = this.queryStore.queryById<Section | Turnout>(sectionAId);
|
||||||
const sectionBId =
|
const sectionBId =
|
||||||
b.leftSection.id !== '' ? b.leftSection.id : b.rightSection.id;
|
b.leftSection.id !== '' ? b.leftSection.id : b.rightSection.id;
|
||||||
const sectionB = this.queryStore.queryById<Section>(sectionBId);
|
const sectionB = this.queryStore.queryById<Section | Turnout>(sectionBId);
|
||||||
return (
|
return (
|
||||||
sectionA.localToCanvasPoint(
|
sectionA.localToCanvasPoint(
|
||||||
getRectangleCenter(sectionA.getLocalBounds())
|
getRectangleCenter(sectionA.getLocalBounds())
|
||||||
|
@ -262,6 +262,7 @@ import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting';
|
|||||||
import OtherLineList from 'src/components/draw-app/dialogs/OtherLineList.vue';
|
import OtherLineList from 'src/components/draw-app/dialogs/OtherLineList.vue';
|
||||||
import OtherLineConfig from 'src/components/draw-app/properties/OtherLineConfig.vue';
|
import OtherLineConfig from 'src/components/draw-app/properties/OtherLineConfig.vue';
|
||||||
import SectionDirectionConfig from 'src/components/draw-app/properties/SectionDirectionConfig.vue';
|
import SectionDirectionConfig from 'src/components/draw-app/properties/SectionDirectionConfig.vue';
|
||||||
|
import { distance2 } from 'src/jl-graphic';
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@ -707,7 +708,7 @@ function oneClickRelateCentralizedStation() {
|
|||||||
handleContainDevices(containDeviceIds, [rightDatas.refRightStationId]);
|
handleContainDevices(containDeviceIds, [rightDatas.refRightStationId]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//区段边界的计轴单独处理
|
//区段边界的计轴和信号机单独处理
|
||||||
const axleCountings = drawApp.queryStore
|
const axleCountings = drawApp.queryStore
|
||||||
.queryByType<AxleCounting>(AxleCounting.Type)
|
.queryByType<AxleCounting>(AxleCounting.Type)
|
||||||
.filter(
|
.filter(
|
||||||
@ -726,6 +727,52 @@ function oneClickRelateCentralizedStation() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const signals = drawApp.queryStore.queryByType<Signal>(Signal.Type);
|
||||||
|
concentrationDividingLines.forEach((concentrationDividingLine) => {
|
||||||
|
concentrationDividingLine.datas.nodeConWithSecs.forEach(
|
||||||
|
(nodeConWithSec) => {
|
||||||
|
const ids = [
|
||||||
|
nodeConWithSec.leftSection.id,
|
||||||
|
nodeConWithSec.rightSection.id,
|
||||||
|
];
|
||||||
|
if (ids[0] && ids[1]) {
|
||||||
|
if (
|
||||||
|
nodeConWithSec.leftSection.deviceType ==
|
||||||
|
graphicData.RelatedRef.DeviceType.Section
|
||||||
|
) {
|
||||||
|
handleNodeConWithSec(nodeConWithSec.leftSection, ids);
|
||||||
|
} else {
|
||||||
|
handleNodeConWithSec(nodeConWithSec.rightSection, ids);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleNodeConWithSec(
|
||||||
|
relatedRef: graphicData.RelatedRef,
|
||||||
|
ids: string[]
|
||||||
|
) {
|
||||||
|
const section = drawApp.queryStore.queryById<Section>(relatedRef.id);
|
||||||
|
const portPos =
|
||||||
|
relatedRef.devicePort == graphicData.RelatedRef.DevicePort.A
|
||||||
|
? section.localToCanvasPoint(section.getStartPoint())
|
||||||
|
: section.localToCanvasPoint(section.getEndPoint());
|
||||||
|
signals.forEach((signal) => {
|
||||||
|
if (
|
||||||
|
distance2(portPos, signal.position) < 100 &&
|
||||||
|
ids.includes(signal.datas.refDev.id)
|
||||||
|
) {
|
||||||
|
signal.datas.centralizedStations =
|
||||||
|
ids[0] == signal.datas.refDev.id
|
||||||
|
? drawApp.queryStore.queryById<Section>(ids[1]).datas
|
||||||
|
.centralizedStations
|
||||||
|
: drawApp.queryStore.queryById<Section>(ids[0]).datas
|
||||||
|
.centralizedStations;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function handleContainDevices(
|
function handleContainDevices(
|
||||||
containDeviceIds: string[],
|
containDeviceIds: string[],
|
||||||
centralizedStations: string[]
|
centralizedStations: string[]
|
||||||
|
Loading…
Reference in New Issue
Block a user