Be more pedantic. Show warning for case where Valentina cannot build a seam

allowance.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-10-22 14:43:06 +03:00
parent fb4d935ac4
commit 1d0b5790ae
5 changed files with 11 additions and 9 deletions

View File

@ -30,6 +30,7 @@
#include "vabstractpiece_p.h"
#include "../vmisc/vabstractapplication.h"
#include "../vgeometry/vpointf.h"
#include "../ifc/exception/vexception.h"
#include <QLineF>
#include <QSet>
@ -861,7 +862,7 @@ void VAbstractPiece::SetSAWidth(qreal value)
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal width)
QVector<QPointF> VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal width, const QString &name)
{
if (width < 0)
{
@ -874,7 +875,8 @@ QVector<QPointF> VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal wid
points = CorrectEquidistantPoints(points);
if ( points.size() < 3 )
{
qDebug()<<"Not enough points for building the equidistant.";
const QString errorMsg = QObject::tr("Piece '%1'. Not enough points to build seam allowance.").arg(name);
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
return QVector<QPointF>();
}

View File

@ -183,7 +183,7 @@ public:
qreal GetMy() const;
void SetMy(qreal value);
static QVector<QPointF> Equidistant(QVector<VSAPoint> points, qreal width);
static QVector<QPointF> Equidistant(QVector<VSAPoint> points, qreal width, const QString &name);
static qreal SumTrapezoids(const QVector<QPointF> &points);
static QVector<QPointF> CheckLoops(const QVector<QPointF> &points);
static QVector<QPointF> EkvPoint(QVector<QPointF> points, const VSAPoint &p1Line1, VSAPoint p2Line1,

View File

@ -902,7 +902,7 @@ void VLayoutPiece::SetLayoutAllowancePoints()
{
if (IsSeamAllowance() && not IsSeamAllowanceBuiltIn())
{
d->layoutAllowance = Equidistant(PrepareAllowance(GetSeamAllowancePoints()), d->layoutWidth);
d->layoutAllowance = Equidistant(PrepareAllowance(GetSeamAllowancePoints()), d->layoutWidth, GetName());
if (d->layoutAllowance.isEmpty() == false)
{
d->layoutAllowance.removeLast();
@ -910,7 +910,7 @@ void VLayoutPiece::SetLayoutAllowancePoints()
}
else
{
d->layoutAllowance = Equidistant(PrepareAllowance(GetContourPoints()), d->layoutWidth);
d->layoutAllowance = Equidistant(PrepareAllowance(GetContourPoints()), d->layoutWidth, GetName());
if (d->layoutAllowance.isEmpty() == false)
{
d->layoutAllowance.removeLast();

View File

@ -473,7 +473,7 @@ QVector<QPointF> VPiece::SeamAllowancePoints(const VContainer *data) const
}
}
return Equidistant(pointsEkv, width);
return Equidistant(pointsEkv, width, GetName());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -132,7 +132,7 @@ void TST_VAbstractPiece::EquidistantRemoveLoop() const
QFETCH(qreal, width);
QFETCH(QVector<QPointF>, ekvOrig);
const QVector<QPointF> ekv = VAbstractPiece::Equidistant(points, width);
const QVector<QPointF> ekv = VAbstractPiece::Equidistant(points, width, QString());
// Begin comparison
Comparison(ekv, ekvOrig);
@ -4922,7 +4922,7 @@ void TST_VAbstractPiece::BrokenDetailEquidistant() const
QFETCH(qreal, width);
QFETCH(QVector<QPointF>, ekvOrig);
const QVector<QPointF> ekv = VAbstractPiece::Equidistant(points, width);// Take result
const QVector<QPointF> ekv = VAbstractPiece::Equidistant(points, width, QString());// Take result
// Begin comparison
Comparison(ekv, ekvOrig);
@ -4951,7 +4951,7 @@ void TST_VAbstractPiece::EquidistantAngleType() const
QFETCH(qreal, width);
QFETCH(QVector<QPointF>, ekvOrig);
const QVector<QPointF> ekv = VAbstractPiece::Equidistant(points, width);// Take result
const QVector<QPointF> ekv = VAbstractPiece::Equidistant(points, width, QString());// Take result
// Begin comparison
Comparison(ekv, ekvOrig);