Ignore intersection in vertices of edges.
--HG-- branch : feature
This commit is contained in:
parent
040b9e607b
commit
4fb5a048ca
|
@ -466,11 +466,14 @@ VLayoutPaper::CrossingType VLayoutPaper::Crossing(const VLayoutDetail &detail, i
|
|||
QLineF::IntersectType type = globalEdge.intersect(detailEdge, &xPoint);
|
||||
|
||||
if (type == QLineF::BoundedIntersection)
|
||||
{
|
||||
if (TrueIntersection(globalEdge, detailEdge, xPoint))
|
||||
{
|
||||
return CrossingType::Intersection;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return CrossingType::NoIntersection;
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user