分隔符调整
This commit is contained in:
parent
a69a0ff463
commit
3548f75666
@ -18,6 +18,7 @@ import {
|
||||
} from './Separator';
|
||||
import { SeparatorData } from 'src/drawApp/graphics/SeparatorInteraction';
|
||||
import { Turnout } from '../turnout/Turnout';
|
||||
import { LogicSection } from '../logicSection/LogicSection';
|
||||
|
||||
export class SeparatorDraw extends GraphicDrawAssistant<
|
||||
SeparatorTemplate,
|
||||
@ -65,6 +66,7 @@ export class SeparatorDraw extends GraphicDrawAssistant<
|
||||
}
|
||||
const arrType = [Section.Type, Turnout.Type]; // 只统计关联关系是道岔和区段的
|
||||
sections.forEach((section) => {
|
||||
if (section.datas.sectionType == SectionType.TurnoutPhysical) return; // 排除道岔区段
|
||||
const allR = section.relationManage
|
||||
.getRelationsOfGraphic(section)
|
||||
.filter((ref) => {
|
||||
@ -74,20 +76,24 @@ export class SeparatorDraw extends GraphicDrawAssistant<
|
||||
allR.forEach((relation, index) => {
|
||||
const r = relation.getRelationParam(section);
|
||||
const other = relation.getOtherRelationParam(section);
|
||||
if (!section.datas.children.includes(other.g.id)) {
|
||||
if (!section.datas.children.includes(other.g.id + '')) {
|
||||
// 排除物理区段和自身逻辑区段的关联关系
|
||||
port.push(r.param);
|
||||
}
|
||||
section.datas.children.forEach((id, ind) => {
|
||||
if (ind != 0) {
|
||||
const logicSection = this.app.queryStore.queryById(id);
|
||||
if (!rMap.has(id)) {
|
||||
rMap.set(id, { g: logicSection });
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!rMap.has(setKey(r))) {
|
||||
rMap.set(setKey(r), { ...r });
|
||||
}
|
||||
if (!rMap.has(setKey(other))) {
|
||||
rMap.set(setKey(other), { ...other, repetition: true });
|
||||
}
|
||||
if (section.datas.sectionType === SectionType.Logic) {
|
||||
// 逻辑区段没有断路分隔符
|
||||
return;
|
||||
}
|
||||
if (index == allR.length - 1) {
|
||||
if (!port.includes('A')) {
|
||||
rMap.set(`${section.id}_A`, {
|
||||
@ -110,7 +116,13 @@ export class SeparatorDraw extends GraphicDrawAssistant<
|
||||
const allR = turnout.relationManage
|
||||
.getRelationsOfGraphic(turnout)
|
||||
.filter((ref) => {
|
||||
return arrType.includes(ref.getOtherGraphic(turnout).type);
|
||||
const otherG = ref.getOtherGraphic(turnout);
|
||||
return (
|
||||
otherG.type == Turnout.Type ||
|
||||
(otherG.type == Section.Type &&
|
||||
(otherG as Section).datas.sectionType !=
|
||||
SectionType.TurnoutPhysical) // 排除道岔区段
|
||||
);
|
||||
});
|
||||
const port: string[] = [];
|
||||
allR.forEach((relation, index) => {
|
||||
@ -169,7 +181,10 @@ export class SeparatorDraw extends GraphicDrawAssistant<
|
||||
rMap.forEach((item) => {
|
||||
if (!item.repetition) {
|
||||
let p;
|
||||
if (item.g.type == Section.Type) {
|
||||
if (item.g.type == LogicSection.Type) {
|
||||
const ps = item.g.linePoints;
|
||||
p = ps[0];
|
||||
} else if (item.g.type == Section.Type) {
|
||||
p = item.g.getStartPoint();
|
||||
if (item.param == 'B') {
|
||||
p = item.g.getEndPoint();
|
||||
|
Loading…
Reference in New Issue
Block a user