Introduce mapped versions of methods. In some cases we will do mapping manually.
--HG-- branch : develop
This commit is contained in:
parent
6294dc0748
commit
a87f821327
|
@ -467,11 +467,17 @@ QVector<VLayoutPassmark> VLayoutPiece::Map<VLayoutPassmark>(QVector<VLayoutPassm
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
// cppcheck-suppress unusedFunction
|
||||
QVector<QPointF> VLayoutPiece::GetContourPoints() const
|
||||
QVector<QPointF> VLayoutPiece::GetMappedContourPoints() const
|
||||
{
|
||||
return Map(d->contour);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QPointF> VLayoutPiece::GetContourPoints() const
|
||||
{
|
||||
return d->contour;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutPiece::SetCountourPoints(const QVector<QPointF> &points, bool hideMainPath)
|
||||
{
|
||||
|
@ -481,11 +487,17 @@ void VLayoutPiece::SetCountourPoints(const QVector<QPointF> &points, bool hideMa
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
// cppcheck-suppress unusedFunction
|
||||
QVector<QPointF> VLayoutPiece::GetSeamAllowancePoints() const
|
||||
QVector<QPointF> VLayoutPiece::GetMappedSeamAllowancePoints() const
|
||||
{
|
||||
return Map(d->seamAllowance);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QPointF> VLayoutPiece::GetSeamAllowancePoints() const
|
||||
{
|
||||
return d->seamAllowance;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutPiece::SetSeamAllowancePoints(const QVector<QPointF> &points, bool seamAllowance, bool seamAllowanceBuiltIn)
|
||||
{
|
||||
|
@ -800,8 +812,8 @@ int VLayoutPiece::LayoutEdgeByPoint(const QPointF &p1) const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QRectF VLayoutPiece::DetailBoundingRect() const
|
||||
{
|
||||
return IsSeamAllowance() && not IsSeamAllowanceBuiltIn() ? BoundingRect(GetSeamAllowancePoints()) :
|
||||
BoundingRect(GetContourPoints());
|
||||
return IsSeamAllowance() && not IsSeamAllowanceBuiltIn() ? BoundingRect(GetMappedSeamAllowancePoints()) :
|
||||
BoundingRect(GetMappedContourPoints());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -850,7 +862,7 @@ void VLayoutPiece::SetLayoutAllowancePoints()
|
|||
{
|
||||
if (IsSeamAllowance() && not IsSeamAllowanceBuiltIn())
|
||||
{
|
||||
d->layoutAllowance = Equidistant(PrepareAllowance(GetSeamAllowancePoints()), d->layoutWidth, GetName());
|
||||
d->layoutAllowance = Equidistant(PrepareAllowance(GetMappedSeamAllowancePoints()), d->layoutWidth, GetName());
|
||||
if (d->layoutAllowance.isEmpty() == false)
|
||||
{
|
||||
d->layoutAllowance.removeLast();
|
||||
|
@ -858,7 +870,7 @@ void VLayoutPiece::SetLayoutAllowancePoints()
|
|||
}
|
||||
else
|
||||
{
|
||||
d->layoutAllowance = Equidistant(PrepareAllowance(GetContourPoints()), d->layoutWidth, GetName());
|
||||
d->layoutAllowance = Equidistant(PrepareAllowance(GetMappedContourPoints()), d->layoutWidth, GetName());
|
||||
if (d->layoutAllowance.isEmpty() == false)
|
||||
{
|
||||
d->layoutAllowance.removeLast();
|
||||
|
@ -941,7 +953,7 @@ QPainterPath VLayoutPiece::ContourPath() const
|
|||
// contour
|
||||
if (not IsHideMainPath() || not IsSeamAllowance() || IsSeamAllowanceBuiltIn())
|
||||
{
|
||||
path = PainterPath(GetContourPoints());
|
||||
path = PainterPath(GetMappedContourPoints());
|
||||
}
|
||||
|
||||
// seam allowance
|
||||
|
@ -950,7 +962,7 @@ QPainterPath VLayoutPiece::ContourPath() const
|
|||
if (not IsSeamAllowanceBuiltIn())
|
||||
{
|
||||
// Draw seam allowance
|
||||
QVector<QPointF>points = GetSeamAllowancePoints();
|
||||
QVector<QPointF>points = GetMappedSeamAllowancePoints();
|
||||
|
||||
if (points.last().toPoint() != points.first().toPoint())
|
||||
{
|
||||
|
@ -1218,7 +1230,7 @@ QGraphicsPathItem *VLayoutPiece::GetMainPathItem() const
|
|||
QPainterPath path;
|
||||
|
||||
// contour
|
||||
QVector<QPointF> points = GetContourPoints();
|
||||
QVector<QPointF> points = GetMappedContourPoints();
|
||||
|
||||
path.moveTo(points.at(0));
|
||||
for (qint32 i = 1; i < points.count(); ++i)
|
||||
|
|
|
@ -73,9 +73,11 @@ public:
|
|||
|
||||
static VLayoutPiece Create(const VPiece &piece, const VContainer *pattern);
|
||||
|
||||
QVector<QPointF> GetMappedContourPoints() const;
|
||||
QVector<QPointF> GetContourPoints() const;
|
||||
void SetCountourPoints(const QVector<QPointF> &points, bool hideMainPath = false);
|
||||
|
||||
QVector<QPointF> GetMappedSeamAllowancePoints() const;
|
||||
QVector<QPointF> GetSeamAllowancePoints() const;
|
||||
void SetSeamAllowancePoints(const QVector<QPointF> &points, bool seamAllowance = true,
|
||||
bool seamAllowanceBuiltIn = false);
|
||||
|
|
|
@ -494,7 +494,7 @@ VPosition::CrossingType VPosition::Crossing(const VLayoutPiece &detail) const
|
|||
const QPainterPath layoutAllowancePath = VLayoutPiece::PainterPath(layoutPoints);
|
||||
|
||||
const QVector<QPointF> contourPoints = detail.IsSeamAllowance() && not detail.IsSeamAllowanceBuiltIn() ?
|
||||
detail.GetSeamAllowancePoints() : detail.GetContourPoints();
|
||||
detail.GetMappedSeamAllowancePoints() : detail.GetMappedContourPoints();
|
||||
const QRectF detailBoundingRect = VLayoutPiece::BoundingRect(contourPoints);
|
||||
const QPainterPath contourPath = VLayoutPiece::PainterPath(contourPoints);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ void TST_VLayoutDetail::Case1() const
|
|||
det.SetCountourPoints(InputPointsCase1());
|
||||
|
||||
// Begin comparison
|
||||
Comparison(det.GetContourPoints(), OutputPointsCase1());
|
||||
Comparison(det.GetMappedContourPoints(), OutputPointsCase1());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -122,7 +122,7 @@ void TST_VLayoutDetail::Case2() const
|
|||
det.SetCountourPoints(InputPointsCase2());
|
||||
|
||||
// Begin comparison
|
||||
Comparison(det.GetContourPoints(), OutputPointsCase2());
|
||||
Comparison(det.GetMappedContourPoints(), OutputPointsCase2());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -163,7 +163,7 @@ void TST_VLayoutDetail::Case3() const
|
|||
det.SetCountourPoints(InputPointsCase3());
|
||||
|
||||
// Begin comparison
|
||||
Comparison(det.GetContourPoints(), OutputPointsCase3());
|
||||
Comparison(det.GetMappedContourPoints(), OutputPointsCase3());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user