Backed out changeset: ddb5a308daee
--HG-- branch : develop
This commit is contained in:
parent
ed1439613e
commit
5e091a2a66
|
@ -108,4 +108,10 @@ struct VBestSquareResData
|
||||||
qreal sidePosition{0};
|
qreal sidePosition{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct VCachedPositions
|
||||||
|
{
|
||||||
|
QRectF boundingRect{};
|
||||||
|
QPainterPath layoutAllowancePath{};
|
||||||
|
};
|
||||||
|
|
||||||
#endif // VLAYOUTDEF_H
|
#endif // VLAYOUTDEF_H
|
||||||
|
|
|
@ -266,7 +266,12 @@ bool VLayoutPaper::SaveResult(const VBestSquare &bestResult, const VLayoutPiece
|
||||||
}
|
}
|
||||||
d->details.append(workDetail);
|
d->details.append(workDetail);
|
||||||
d->globalContour.SetContour(newGContour);
|
d->globalContour.SetContour(newGContour);
|
||||||
d->positionsCache.append(VLayoutPiece::PainterPath(workDetail.GetLayoutAllowancePoints()));
|
|
||||||
|
VCachedPositions positionChache;
|
||||||
|
QVector<QPointF> layoutPoints = workDetail.GetLayoutAllowancePoints();
|
||||||
|
positionChache.boundingRect = VLayoutPiece::BoundingRect(layoutPoints);
|
||||||
|
positionChache.layoutAllowancePath = VLayoutPiece::PainterPath(layoutPoints);
|
||||||
|
d->positionsCache.append(positionChache);
|
||||||
}
|
}
|
||||||
else if (bestResult.IsTerminatedByException())
|
else if (bestResult.IsTerminatedByException())
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,7 +72,7 @@ public:
|
||||||
/** @brief details list of arranged details. */
|
/** @brief details list of arranged details. */
|
||||||
QVector<VLayoutPiece> details{};
|
QVector<VLayoutPiece> details{};
|
||||||
|
|
||||||
QVector<QPainterPath> positionsCache{};
|
QVector<VCachedPositions> positionsCache{};
|
||||||
|
|
||||||
/** @brief globalContour list of global points contour. */
|
/** @brief globalContour list of global points contour. */
|
||||||
VContour globalContour{};
|
VContour globalContour{};
|
||||||
|
|
|
@ -325,17 +325,24 @@ VPosition::CrossingType VPosition::Crossing(const VLayoutPiece &detail) const
|
||||||
return CrossingType::NoIntersection;
|
return CrossingType::NoIntersection;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QPainterPath layoutAllowancePath = VLayoutPiece::PainterPath(detail.GetLayoutAllowancePoints());
|
const QVector<QPointF> layoutPoints = detail.GetLayoutAllowancePoints();
|
||||||
|
const QRectF layoutBoundingRect = VLayoutPiece::BoundingRect(layoutPoints);
|
||||||
|
const QPainterPath layoutAllowancePath = VLayoutPiece::PainterPath(layoutPoints);
|
||||||
|
|
||||||
const QVector<QPointF> contourPoints = detail.IsSeamAllowance() && not detail.IsSeamAllowanceBuiltIn() ?
|
const QVector<QPointF> contourPoints = detail.IsSeamAllowance() && not detail.IsSeamAllowanceBuiltIn() ?
|
||||||
detail.GetMappedSeamAllowancePoints() : detail.GetMappedContourPoints();
|
detail.GetMappedSeamAllowancePoints() : detail.GetMappedContourPoints();
|
||||||
|
const QRectF detailBoundingRect = VLayoutPiece::BoundingRect(contourPoints);
|
||||||
const QPainterPath contourPath = VLayoutPiece::PainterPath(contourPoints);
|
const QPainterPath contourPath = VLayoutPiece::PainterPath(contourPoints);
|
||||||
|
|
||||||
for(auto &position : m_data.positionsCache)
|
for(auto &position : m_data.positionsCache)
|
||||||
{
|
{
|
||||||
if (position.contains(contourPath) || position.intersects(layoutAllowancePath))
|
if (position.boundingRect.intersects(layoutBoundingRect) || position.boundingRect.contains(detailBoundingRect))
|
||||||
{
|
{
|
||||||
return CrossingType::Intersection;
|
if (position.layoutAllowancePath.contains(contourPath) ||
|
||||||
|
position.layoutAllowancePath.intersects(layoutAllowancePath))
|
||||||
|
{
|
||||||
|
return CrossingType::Intersection;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ struct VPositionData
|
||||||
bool rotate{false};
|
bool rotate{false};
|
||||||
int rotationNumber{0};
|
int rotationNumber{0};
|
||||||
bool followGrainline{false};
|
bool followGrainline{false};
|
||||||
QVector<QPainterPath> positionsCache{};
|
QVector<VCachedPositions> positionsCache{};
|
||||||
bool isOriginPaperOrientationPortrait{true};
|
bool isOriginPaperOrientationPortrait{true};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user