Bad API in class LayoutDetail. Fixed checking seam allowence points.
--HG-- branch : release
This commit is contained in:
parent
d287e63790
commit
2b711c5f8f
|
@ -395,6 +395,11 @@ QVector<QPointF> VDetail::ContourPoints(const VContainer *data) const
|
|||
QVector<QPointF> VDetail::SeamAllowancePoints(const VContainer *data) const
|
||||
{
|
||||
QVector<QPointF> pointsEkv;
|
||||
if (getSeamAllowance() == false)
|
||||
{
|
||||
return pointsEkv;
|
||||
}
|
||||
|
||||
for (int i = 0; i< CountNode(); ++i)
|
||||
{
|
||||
switch (at(i).getTypeTool())
|
||||
|
@ -402,14 +407,11 @@ QVector<QPointF> VDetail::SeamAllowancePoints(const VContainer *data) const
|
|||
case (Tool::NodePoint):
|
||||
{
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(at(i).getId());
|
||||
if (getSeamAllowance() == true)
|
||||
{
|
||||
QPointF pEkv = point->toQPointF();
|
||||
pEkv.setX(pEkv.x()+at(i).getMx());
|
||||
pEkv.setY(pEkv.y()+at(i).getMy());
|
||||
pointsEkv.append(pEkv);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (Tool::NodeArc):
|
||||
case (Tool::NodeSpline):
|
||||
|
@ -421,11 +423,8 @@ QVector<QPointF> VDetail::SeamAllowancePoints(const VContainer *data) const
|
|||
const QPointF end = EndSegment(data, i);
|
||||
|
||||
QVector<QPointF> nodePoints = curve->GetSegmentPoints(begin, end, at(i).getReverse());
|
||||
if (getSeamAllowance() == true)
|
||||
{
|
||||
pointsEkv << biasPoints(nodePoints, at(i).getMx(), at(i).getMy());
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
qDebug()<<"Get wrong tool type. Ignore."<< static_cast<char>(at(i).getTypeTool());
|
||||
|
@ -433,8 +432,6 @@ QVector<QPointF> VDetail::SeamAllowancePoints(const VContainer *data) const
|
|||
}
|
||||
}
|
||||
|
||||
if (getSeamAllowance() == true)
|
||||
{
|
||||
if (getClosed() == true)
|
||||
{
|
||||
pointsEkv = Equidistant(pointsEkv, EquidistantType::CloseEquidistant, qApp->toPixel(getWidth()));
|
||||
|
@ -443,7 +440,6 @@ QVector<QPointF> VDetail::SeamAllowancePoints(const VContainer *data) const
|
|||
{
|
||||
pointsEkv = Equidistant(pointsEkv, EquidistantType::OpenEquidistant, qApp->toPixel(getWidth()));
|
||||
}
|
||||
}
|
||||
return pointsEkv;
|
||||
}
|
||||
|
||||
|
|
|
@ -1906,8 +1906,7 @@ void MainWindow::ActionLayout(bool checked)
|
|||
idetail.next();
|
||||
VLayoutDetail det = VLayoutDetail();
|
||||
det.SetCountourPoints(idetail.value().ContourPoints(pattern));
|
||||
det.SetSeamAllowencePoints(idetail.value().SeamAllowancePoints(pattern));
|
||||
det.setSeamAllowance(idetail.value().getSeamAllowance());
|
||||
det.SetSeamAllowencePoints(idetail.value().SeamAllowancePoints(pattern), idetail.value().getSeamAllowance());
|
||||
det.setName(idetail.value().getName());
|
||||
det.setWidth(qApp->toPixel(idetail.value().getWidth()));
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <QGraphicsItem>
|
||||
#include <QPainterPath>
|
||||
#include <QtMath>
|
||||
#include <QDebug>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VLayoutDetail::VLayoutDetail()
|
||||
|
@ -85,9 +86,14 @@ QVector<QPointF> VLayoutDetail::GetSeamAllowencePoints() const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutDetail::SetSeamAllowencePoints(const QVector<QPointF> &points)
|
||||
void VLayoutDetail::SetSeamAllowencePoints(const QVector<QPointF> &points, bool seamAllowence)
|
||||
{
|
||||
if (seamAllowence)
|
||||
{
|
||||
setSeamAllowance(seamAllowence);
|
||||
d->seamAllowence = points;
|
||||
if (not d->seamAllowence.isEmpty())
|
||||
{
|
||||
// Seam allowence can't be closed
|
||||
if (d->seamAllowence.first() == d->seamAllowence.last())
|
||||
{
|
||||
|
@ -96,6 +102,13 @@ void VLayoutDetail::SetSeamAllowencePoints(const QVector<QPointF> &points)
|
|||
|
||||
d->seamAllowence = RemoveDublicates(RoundPoints(d->seamAllowence));
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning()<<"Seam allowence is empty.";
|
||||
setSeamAllowance(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QPointF> VLayoutDetail::GetLayoutAllowencePoints() const
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
void SetCountourPoints(const QVector<QPointF> &points);
|
||||
|
||||
QVector<QPointF> GetSeamAllowencePoints() const;
|
||||
void SetSeamAllowencePoints(const QVector<QPointF> &points);
|
||||
void SetSeamAllowencePoints(const QVector<QPointF> &points, bool seamAllowence = true);
|
||||
|
||||
QVector<QPointF> GetLayoutAllowencePoints() const;
|
||||
void SetLayoutAllowencePoints();
|
||||
|
|
Loading…
Reference in New Issue
Block a user