Merge pull request #1256 from ispyisail/fix/route-review-followups

Fix the follow-ups from the review of wire routing (#1245)
This commit is contained in:
Laurent Trinques
2026-10-02 23:14:51 +02:00
committed by GitHub
3 changed files with 15 additions and 7 deletions
+3 -3
View File
@@ -1402,11 +1402,11 @@ bool Conductor::moveSegment(int index, qreal dx, qreal dy)
bool Conductor::setPathPoints(const QList<QPointF> &scene_points)
{
if (scene_points.size() < 2 || !terminal1 || !terminal2) return false;
const auto near = [](const QPointF &a, const QPointF &b) {
const auto isNear = [](const QPointF &a, const QPointF &b) {
return qAbs(a.x() - b.x()) < 0.5 && qAbs(a.y() - b.y()) < 0.5;
};
if (!near(scene_points.first(), terminal1->dockConductor()) ||
!near(scene_points.last(), terminal2->dockConductor()))
if (!isNear(scene_points.first(), terminal1->dockConductor()) ||
!isNear(scene_points.last(), terminal2->dockConductor()))
return false;
QList<QPointF> points;
for (int i = 0; i < scene_points.size(); ++i) {
+7 -2
View File
@@ -1266,8 +1266,13 @@ QString QetScriptApi::applyRoute(Conductor *conductor, const QString &caller)
return QStringLiteral("no-route");
}
if (!conductor->setPathPoints(route.points)) {
log(QStringLiteral("qet.%1: the route found does not join the two terminals; "
"the conductor keeps its path").arg(caller));
// ConductorRouter always gives at least the two terminals and an
// exit point between them, so this is a route that is not a run
// of horizontal and vertical segments from one terminal to the
// other -- a bug in the router, not something the folio did.
log(QStringLiteral("qet.%1: the route found was refused (it must run in "
"horizontal and vertical segments from one terminal to "
"the other); the conductor keeps its path").arg(caller));
return QStringLiteral("no-route");
}
return QStringLiteral("routed");