Little optimization for the layout generator.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-03-28 11:22:15 +03:00
parent 09d2b96e73
commit dd586bf01e
3 changed files with 21 additions and 2 deletions

View File

@ -302,6 +302,14 @@ const QPointF &VContour::at(int i) const
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
{

View File

@ -39,6 +39,7 @@ class VContourData;
class QPointF;
class VLayoutDetail;
class QLineF;
class QRectF;
class VContour
{
@ -49,11 +50,11 @@ public:
VContour &operator=(const VContour &contour);
~VContour();
void SetContour(const QVector<QPointF> &contour);
void SetContour(const QVector<QPointF> &contour);
QVector<QPointF> GetContour() const;
quint32 GetShift() const;
void SetShift(quint32 shift);
void SetShift(quint32 shift);
int GetHeight() const;
void SetHeight(int height);
@ -73,6 +74,8 @@ public:
const QPointF & at(int i) const;
QRectF BoundingRect() const;
private:
QSharedDataPointer<VContourData> d;

View File

@ -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
{
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();
if (globalEdgesCount == 0)
{