Skip to content

Commit

Permalink
Bugfix: class StandardArrowNet adapted for new layout algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
joern274 committed Nov 9, 2023
1 parent cff610b commit 898bc7e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace hal {
* @param n - The underlying net
* @param l - The lines this GraphicsNet consists of
*/
StandardArrowNet(Net* n, const Lines& l);
StandardArrowNet(Net* n, const Lines& l, const QList<QPointF>& knots = QList<QPointF>());
/**
* Adds an input position.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace hal
{
StandardArrowNet::StandardArrowNet(Net* n, const Lines &l)
: StandardGraphicsNet(n,l), mArrowNet(n)
StandardArrowNet::StandardArrowNet(Net* n, const Lines &l, const QList<QPointF>& knots)
: StandardGraphicsNet(n,l,knots), mArrowNet(n)
{;}

void StandardArrowNet::setInputPosition(const QPointF& pos)
Expand Down
14 changes: 7 additions & 7 deletions plugins/gui/src/graph_widget/layouters/graph_layouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,25 +934,25 @@ namespace hal
case EndpointList::HasGlobalEndpoint:
if (epl.hasInputArrow())
{
StandardArrowNet* san = new StandardArrowNet(n, dnt->mLines);
StandardArrowNet* san = new StandardArrowNet(n, dnt->mLines, dnt->mKnots);
graphicsNet = san;
int yGridPos = mGlobalInputHash.value(dnt->id(), -1);
Q_ASSERT(yGridPos >= 0);
const EndpointCoordinate& epc = mEndpointHash.value(QPoint(mNodeBoundingBox.left(), yGridPos * 2));
san->setInputPosition(QPointF(mCoordX.value(mNodeBoundingBox.left()).lanePosition(-1), epc.lanePosition(0, true)));
san->setInputPosition(QPointF(mCoordX.value(mNodeBoundingBox.left()).lanePosition(0), epc.lanePosition(0, true)));
}
if (epl.hasOutputArrow())
{
if (graphicsNet) mScene->addGraphItem(graphicsNet);
StandardArrowNet* san = new StandardArrowNet(n, dnt->mLines);
StandardArrowNet* san = new StandardArrowNet(n, dnt->mLines, dnt->mKnots);
graphicsNet = san;
int yGridPos = mGlobalOutputHash.value(dnt->id(), -1);
Q_ASSERT(yGridPos >= 0);
QPoint pnt(mNodeBoundingBox.right() + 1, yGridPos * 2);
const EndpointCoordinate& epc = mEndpointHash.value(pnt);
const NetLayoutJunction* nlj = mJunctionHash.value(pnt);
Q_ASSERT(nlj);
san->setOutputPosition(QPointF(mCoordX.value(pnt.x()).lanePosition(nlj->rect().right() + 1), epc.lanePosition(0, true)));
san->setOutputPosition(QPointF(mCoordX.value(pnt.x()).lanePosition(nlj->rect().right()), epc.lanePosition(0, true)));
}
break;
case EndpointList::SourceAndDestination:
Expand Down Expand Up @@ -1400,9 +1400,9 @@ namespace hal

for (const QPoint& pnt : jt.value()->netById(mId).mKnots)
{
float x = scX.lanePosition(pnt.x());
float y = isEndpoint ? epcIt.value().lanePosition(pnt.y(), true) : scY.lanePosition(pnt.y());
mKnots.append(QPointF(x,y));
float xp = scX.lanePosition(pnt.x());
float yp = isEndpoint ? epcIt.value().lanePosition(pnt.y(), true) : scY.lanePosition(pnt.y());
mKnots.append(QPointF(xp,yp));
}
}
}
Expand Down

0 comments on commit 898bc7e

Please sign in to comment.