Ignore intersection in vertices of edges.

--HG--
branch : feature
This commit is contained in:
dismine 2015-01-16 16:22:42 +02:00
parent 040b9e607b
commit 4fb5a048ca
2 changed files with 24 additions and 1 deletions

View file

@ -467,7 +467,10 @@ VLayoutPaper::CrossingType VLayoutPaper::Crossing(const VLayoutDetail &detail, i
if (type == QLineF::BoundedIntersection)
{
return CrossingType::Intersection;
if (TrueIntersection(globalEdge, detailEdge, xPoint))
{
return CrossingType::Intersection;
}
}
}
}
@ -895,6 +898,23 @@ QPainterPath VLayoutPaper::DrawDetails() const
return path;
}
//---------------------------------------------------------------------------------------------------------------------
bool VLayoutPaper::TrueIntersection(const QLineF &gEdge, const QLineF &dEdge, const QPointF &p) const
{
const QPointF pX = RoundedPoint(p);
const QPointF gP1 = RoundedPoint(gEdge.p1());
const QPointF gP2 = RoundedPoint(gEdge.p2());
const QPointF dP1 = RoundedPoint(dEdge.p1());
const QPointF dP2 = RoundedPoint(dEdge.p2());
return pX != gP1 && pX != gP2 && pX != dP1 && pX != dP2;
}
//---------------------------------------------------------------------------------------------------------------------
QPointF VLayoutPaper::RoundedPoint(const QPointF &p) const
{
return QPointF(qRound(p.x()), qRound(p.y()));
}
//---------------------------------------------------------------------------------------------------------------------
QGraphicsItem *VLayoutPaper::GetItem() const
{

View file

@ -110,6 +110,9 @@ private:
QPainterPath DrawContour(const QVector<QPointF> &points) const;
QVector<QPointF> TranslateContour(const QVector<QPointF> &points, qreal dx, qreal dy) const;
QPainterPath DrawDetails() const;
bool TrueIntersection(const QLineF &gEdge, const QLineF &dEdge, const QPointF &p) const;
QPointF RoundedPoint(const QPointF &p) const;
};
#endif // VLAYOUTPAPER_H