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> VDetail::SeamAllowancePoints(const VContainer *data) const
|
||||||
{
|
{
|
||||||
QVector<QPointF> pointsEkv;
|
QVector<QPointF> pointsEkv;
|
||||||
|
if (getSeamAllowance() == false)
|
||||||
|
{
|
||||||
|
return pointsEkv;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i< CountNode(); ++i)
|
for (int i = 0; i< CountNode(); ++i)
|
||||||
{
|
{
|
||||||
switch (at(i).getTypeTool())
|
switch (at(i).getTypeTool())
|
||||||
|
@ -402,13 +407,10 @@ QVector<QPointF> VDetail::SeamAllowancePoints(const VContainer *data) const
|
||||||
case (Tool::NodePoint):
|
case (Tool::NodePoint):
|
||||||
{
|
{
|
||||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(at(i).getId());
|
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(at(i).getId());
|
||||||
if (getSeamAllowance() == true)
|
QPointF pEkv = point->toQPointF();
|
||||||
{
|
pEkv.setX(pEkv.x()+at(i).getMx());
|
||||||
QPointF pEkv = point->toQPointF();
|
pEkv.setY(pEkv.y()+at(i).getMy());
|
||||||
pEkv.setX(pEkv.x()+at(i).getMx());
|
pointsEkv.append(pEkv);
|
||||||
pEkv.setY(pEkv.y()+at(i).getMy());
|
|
||||||
pointsEkv.append(pEkv);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (Tool::NodeArc):
|
case (Tool::NodeArc):
|
||||||
|
@ -421,10 +423,7 @@ QVector<QPointF> VDetail::SeamAllowancePoints(const VContainer *data) const
|
||||||
const QPointF end = EndSegment(data, i);
|
const QPointF end = EndSegment(data, i);
|
||||||
|
|
||||||
QVector<QPointF> nodePoints = curve->GetSegmentPoints(begin, end, at(i).getReverse());
|
QVector<QPointF> nodePoints = curve->GetSegmentPoints(begin, end, at(i).getReverse());
|
||||||
if (getSeamAllowance() == true)
|
pointsEkv << biasPoints(nodePoints, at(i).getMx(), at(i).getMy());
|
||||||
{
|
|
||||||
pointsEkv << biasPoints(nodePoints, at(i).getMx(), at(i).getMy());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -433,16 +432,13 @@ QVector<QPointF> VDetail::SeamAllowancePoints(const VContainer *data) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getSeamAllowance() == true)
|
if (getClosed() == true)
|
||||||
{
|
{
|
||||||
if (getClosed() == true)
|
pointsEkv = Equidistant(pointsEkv, EquidistantType::CloseEquidistant, qApp->toPixel(getWidth()));
|
||||||
{
|
}
|
||||||
pointsEkv = Equidistant(pointsEkv, EquidistantType::CloseEquidistant, qApp->toPixel(getWidth()));
|
else
|
||||||
}
|
{
|
||||||
else
|
pointsEkv = Equidistant(pointsEkv, EquidistantType::OpenEquidistant, qApp->toPixel(getWidth()));
|
||||||
{
|
|
||||||
pointsEkv = Equidistant(pointsEkv, EquidistantType::OpenEquidistant, qApp->toPixel(getWidth()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return pointsEkv;
|
return pointsEkv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1906,8 +1906,7 @@ void MainWindow::ActionLayout(bool checked)
|
||||||
idetail.next();
|
idetail.next();
|
||||||
VLayoutDetail det = VLayoutDetail();
|
VLayoutDetail det = VLayoutDetail();
|
||||||
det.SetCountourPoints(idetail.value().ContourPoints(pattern));
|
det.SetCountourPoints(idetail.value().ContourPoints(pattern));
|
||||||
det.SetSeamAllowencePoints(idetail.value().SeamAllowancePoints(pattern));
|
det.SetSeamAllowencePoints(idetail.value().SeamAllowancePoints(pattern), idetail.value().getSeamAllowance());
|
||||||
det.setSeamAllowance(idetail.value().getSeamAllowance());
|
|
||||||
det.setName(idetail.value().getName());
|
det.setName(idetail.value().getName());
|
||||||
det.setWidth(qApp->toPixel(idetail.value().getWidth()));
|
det.setWidth(qApp->toPixel(idetail.value().getWidth()));
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <QPainterPath>
|
#include <QPainterPath>
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutDetail::VLayoutDetail()
|
VLayoutDetail::VLayoutDetail()
|
||||||
|
@ -85,16 +86,28 @@ QVector<QPointF> VLayoutDetail::GetSeamAllowencePoints() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VLayoutDetail::SetSeamAllowencePoints(const QVector<QPointF> &points)
|
void VLayoutDetail::SetSeamAllowencePoints(const QVector<QPointF> &points, bool seamAllowence)
|
||||||
{
|
{
|
||||||
d->seamAllowence = points;
|
if (seamAllowence)
|
||||||
// Seam allowence can't be closed
|
|
||||||
if (d->seamAllowence.first() == d->seamAllowence.last())
|
|
||||||
{
|
{
|
||||||
d->seamAllowence.removeLast();
|
setSeamAllowance(seamAllowence);
|
||||||
}
|
d->seamAllowence = points;
|
||||||
|
if (not d->seamAllowence.isEmpty())
|
||||||
|
{
|
||||||
|
// Seam allowence can't be closed
|
||||||
|
if (d->seamAllowence.first() == d->seamAllowence.last())
|
||||||
|
{
|
||||||
|
d->seamAllowence.removeLast();
|
||||||
|
}
|
||||||
|
|
||||||
d->seamAllowence = RemoveDublicates(RoundPoints(d->seamAllowence));
|
d->seamAllowence = RemoveDublicates(RoundPoints(d->seamAllowence));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning()<<"Seam allowence is empty.";
|
||||||
|
setSeamAllowance(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
void SetCountourPoints(const QVector<QPointF> &points);
|
void SetCountourPoints(const QVector<QPointF> &points);
|
||||||
|
|
||||||
QVector<QPointF> GetSeamAllowencePoints() const;
|
QVector<QPointF> GetSeamAllowencePoints() const;
|
||||||
void SetSeamAllowencePoints(const QVector<QPointF> &points);
|
void SetSeamAllowencePoints(const QVector<QPointF> &points, bool seamAllowence = true);
|
||||||
|
|
||||||
QVector<QPointF> GetLayoutAllowencePoints() const;
|
QVector<QPointF> GetLayoutAllowencePoints() const;
|
||||||
void SetLayoutAllowencePoints();
|
void SetLayoutAllowencePoints();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user