计轴区段补线

This commit is contained in:
joylink_zhaoerwei 2023-07-10 10:04:53 +08:00
parent 658ab9efb1
commit 0df2fd6fac

View File

@ -132,49 +132,53 @@ export class AxleCountingSectionDraw extends GraphicDrawAssistant<
}
}
});
const fourTurnout: Turnout[] = [];
const fourAxleCounting: AxleCounting[] = [];
hasfourTurnout.forEach((axleCountings) => {
const axleCountingRelations =
axleCountings[0].relationManage.getRelationsOfGraphicAndOtherType(
axleCountings[0],
Turnout.Type
);
axleCountingRelations.forEach((relation) => {
const refDevice = relation.getOtherGraphic<Section>(axleCountings[0]);
fourTurnout;
axleCountings.forEach((axleCounting) => {
//计轴关联的道岔
const axleCountingRelations =
axleCounting.relationManage.getRelationsOfGraphicAndOtherType(
axleCounting,
Turnout.Type
);
axleCountingRelations.forEach((relation) => {
const refTurnout = relation.getOtherGraphic<Turnout>(axleCounting);
//道岔关联的计轴
const turnoutRelations =
refTurnout.relationManage.getRelationsOfGraphicAndOtherType(
refTurnout,
AxleCounting.Type
);
turnoutRelations.forEach((relation) => {
const refAxleCounting =
relation.getOtherGraphic<AxleCounting>(refTurnout);
if (
refAxleCounting.id !== axleCountings[0].id &&
refAxleCounting.id !== axleCountings[1].id
) {
fourAxleCounting.push(refAxleCounting);
}
});
});
});
});
/* axleCountings.sort((a, b) => a.x - b.x);
const downAxleCountings = axleCountings.filter((point) => {
return point.y > 350;
});
for (let i = 0; i < downAxleCountings.length - 1; i++) {
const firstRef = downAxleCountings[i].datas.axleCountingRef.map(
(ref) => ref.id
);
const nextRef = downAxleCountings[i + 1].datas.axleCountingRef.map(
(ref) => ref.id
);
let nextNextRef: string[] = [];
if (i + 2 < downAxleCountings.length) {
nextNextRef = downAxleCountings[i + 2].datas.axleCountingRef.map(
(ref) => ref.id
);
for (let x = 0; x < fourAxleCounting.length; x += 4) {
const AxleCountings = fourAxleCounting.slice(x, x + 4);
for (let y = 0; y < 4; y++) {
if (fourAxleCounting[x].id == AxleCountings[y].id) continue;
if (fourAxleCounting[x].y == AxleCountings[y].y) {
this.draw([fourAxleCounting[x], AxleCountings[y]]);
break;
}
}
if (hasCommonElements(firstRef, nextRef)) {
this.draw([downAxleCountings[i], downAxleCountings[i + 1]]);
} else if (
hasSamePosition(
downAxleCountings[i + 1].position,
downAxleCountings[i + 2].position
) &&
hasCommonElements(firstRef, nextNextRef)
) {
this.draw([downAxleCountings[i], downAxleCountings[i + 2]]);
i += 2;
for (let y = 0; y < 4; y++) {
if (fourAxleCounting[x + 1].id == AxleCountings[y].id) continue;
if (fourAxleCounting[x + 1].y == AxleCountings[y].y) {
this.draw([fourAxleCounting[x + 1], AxleCountings[y]]);
break;
}
}
} */
}
}
}