Little optimization for the layout generator.
--HG-- branch : develop
This commit is contained in:
parent
09d2b96e73
commit
dd586bf01e
|
@ -302,6 +302,14 @@ const QPointF &VContour::at(int i) const
|
||||||
return d->globalContour.at(i);
|
return d->globalContour.at(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QRectF VContour::BoundingRect() const
|
||||||
|
{
|
||||||
|
QVector<QPointF> points = GetContour();
|
||||||
|
points.append(points.first());
|
||||||
|
return QPolygonF(points).boundingRect();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VContour::AppendWhole(QVector<QPointF> &contour, const VLayoutDetail &detail, int detJ) const
|
void VContour::AppendWhole(QVector<QPointF> &contour, const VLayoutDetail &detail, int detJ) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,6 +39,7 @@ class VContourData;
|
||||||
class QPointF;
|
class QPointF;
|
||||||
class VLayoutDetail;
|
class VLayoutDetail;
|
||||||
class QLineF;
|
class QLineF;
|
||||||
|
class QRectF;
|
||||||
|
|
||||||
class VContour
|
class VContour
|
||||||
{
|
{
|
||||||
|
@ -73,6 +74,8 @@ public:
|
||||||
|
|
||||||
const QPointF & at(int i) const;
|
const QPointF & at(int i) const;
|
||||||
|
|
||||||
|
QRectF BoundingRect() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSharedDataPointer<VContourData> d;
|
QSharedDataPointer<VContourData> d;
|
||||||
|
|
||||||
|
|
|
@ -410,6 +410,14 @@ bool VPosition::CheckRotationEdges(VLayoutDetail &detail, int j, int dEdge, int
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPosition::CrossingType VPosition::Crossing(const VLayoutDetail &detail, const int &globalI, const int &detailI) const
|
VPosition::CrossingType VPosition::Crossing(const VLayoutDetail &detail, const int &globalI, const int &detailI) const
|
||||||
{
|
{
|
||||||
|
const QRectF dRect = detail.BoundingRect();
|
||||||
|
const QRectF gRect = gContour.BoundingRect();
|
||||||
|
if (not gRect.intersects(dRect))
|
||||||
|
{
|
||||||
|
// This we can determine efficiently.
|
||||||
|
return CrossingType::NoIntersection;
|
||||||
|
}
|
||||||
|
|
||||||
int globalEdgesCount = gContour.GlobalEdgesCount();
|
int globalEdgesCount = gContour.GlobalEdgesCount();
|
||||||
if (globalEdgesCount == 0)
|
if (globalEdgesCount == 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user