fixed typo in code: allowence and greed
--HG-- branch : develop
This commit is contained in:
parent
1fffac502d
commit
55509e523d
|
@ -117,7 +117,7 @@ void VLayoutDetail::SetSeamAllowencePoints(const QVector<QPointF> &points, bool
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<"Seam allowence is empty.";
|
qWarning()<<"Seam allowance is empty.";
|
||||||
setSeamAllowance(false);
|
setSeamAllowance(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -511,7 +511,7 @@ QPainterPath VLayoutDetail::ContourPath() const
|
||||||
}
|
}
|
||||||
path.lineTo(points.at(0));
|
path.lineTo(points.at(0));
|
||||||
|
|
||||||
// seam allowence
|
// seam allowance
|
||||||
if (getSeamAllowance() == true)
|
if (getSeamAllowance() == true)
|
||||||
{
|
{
|
||||||
points = GetSeamAllowencePoints();
|
points = GetSeamAllowencePoints();
|
||||||
|
|
|
@ -67,16 +67,16 @@ public:
|
||||||
/** @brief contour list of contour points. */
|
/** @brief contour list of contour points. */
|
||||||
QVector<QPointF> contour;
|
QVector<QPointF> contour;
|
||||||
|
|
||||||
/** @brief seamAllowence list of seam allowence points. */
|
/** @brief seamAllowence list of seam allowance points. */
|
||||||
QVector<QPointF> seamAllowence;
|
QVector<QPointF> seamAllowence;
|
||||||
|
|
||||||
/** @brief layoutAllowence list of layout allowence points. */
|
/** @brief layoutAllowence list of layout allowance points. */
|
||||||
QVector<QPointF> layoutAllowence;
|
QVector<QPointF> layoutAllowence;
|
||||||
|
|
||||||
/** @brief matrix transformation matrix*/
|
/** @brief matrix transformation matrix*/
|
||||||
QTransform matrix;
|
QTransform matrix;
|
||||||
|
|
||||||
/** @brief layoutWidth value layout allowence width in pixels. */
|
/** @brief layoutWidth value layout allowance width in pixels. */
|
||||||
qreal layoutWidth;
|
qreal layoutWidth;
|
||||||
|
|
||||||
bool mirror;
|
bool mirror;
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPoster::VPoster(const QPrinter *printer)
|
VPoster::VPoster(const QPrinter *printer)
|
||||||
:printer(printer), allowence(static_cast<quint32>(qRound(10./25.4*PrintDPI)))//1 cm
|
:printer(printer), allowance(static_cast<quint32>(qRound(10./25.4*PrintDPI)))//1 cm
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ QVector<QGraphicsItem *> VPoster::Borders(QGraphicsItem *parent, const PosterDat
|
||||||
data.append(line);
|
data.append(line);
|
||||||
|
|
||||||
auto *scissors = new QGraphicsPixmapItem(QPixmap("://scissors_vertical.png"), parent);
|
auto *scissors = new QGraphicsPixmapItem(QPixmap("://scissors_vertical.png"), parent);
|
||||||
scissors->setPos(rec.x(), rec.y() + rec.height()-static_cast<int>(allowence));
|
scissors->setPos(rec.x(), rec.y() + rec.height()-static_cast<int>(allowance));
|
||||||
data.append(scissors);
|
data.append(scissors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,8 +100,8 @@ QVector<QGraphicsItem *> VPoster::Borders(QGraphicsItem *parent, const PosterDat
|
||||||
{// Right border
|
{// Right border
|
||||||
auto *line = new QGraphicsLineItem(parent);
|
auto *line = new QGraphicsLineItem(parent);
|
||||||
line->setPen(pen);
|
line->setPen(pen);
|
||||||
line->setLine(rec.x() + rec.width()-static_cast<int>(allowence), rec.y(),
|
line->setLine(rec.x() + rec.width()-static_cast<int>(allowance), rec.y(),
|
||||||
rec.x() + rec.width()-static_cast<int>(allowence), rec.y() + rec.height());
|
rec.x() + rec.width()-static_cast<int>(allowance), rec.y() + rec.height());
|
||||||
data.append(line);
|
data.append(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ QVector<QGraphicsItem *> VPoster::Borders(QGraphicsItem *parent, const PosterDat
|
||||||
data.append(line);
|
data.append(line);
|
||||||
|
|
||||||
auto *scissors = new QGraphicsPixmapItem(QPixmap("://scissors_horizontal.png"), parent);
|
auto *scissors = new QGraphicsPixmapItem(QPixmap("://scissors_horizontal.png"), parent);
|
||||||
scissors->setPos(rec.x() + rec.width()-static_cast<int>(allowence), rec.y());
|
scissors->setPos(rec.x() + rec.width()-static_cast<int>(allowance), rec.y());
|
||||||
data.append(scissors);
|
data.append(scissors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,15 +122,15 @@ QVector<QGraphicsItem *> VPoster::Borders(QGraphicsItem *parent, const PosterDat
|
||||||
// Bottom border (mandatory)
|
// Bottom border (mandatory)
|
||||||
auto *line = new QGraphicsLineItem(parent);
|
auto *line = new QGraphicsLineItem(parent);
|
||||||
line->setPen(pen);
|
line->setPen(pen);
|
||||||
line->setLine(rec.x(), rec.y() + rec.height()-static_cast<int>(allowence),
|
line->setLine(rec.x(), rec.y() + rec.height()-static_cast<int>(allowance),
|
||||||
rec.x() + rec.width(), rec.y() + rec.height()-static_cast<int>(allowence));
|
rec.x() + rec.width(), rec.y() + rec.height()-static_cast<int>(allowance));
|
||||||
data.append(line);
|
data.append(line);
|
||||||
|
|
||||||
if (img.row == img.rows-1)
|
if (img.row == img.rows-1)
|
||||||
{
|
{
|
||||||
auto *scissors = new QGraphicsPixmapItem(QPixmap("://scissors_horizontal.png"), parent);
|
auto *scissors = new QGraphicsPixmapItem(QPixmap("://scissors_horizontal.png"), parent);
|
||||||
scissors->setPos(rec.x() + rec.width()-static_cast<int>(allowence),
|
scissors->setPos(rec.x() + rec.width()-static_cast<int>(allowance),
|
||||||
rec.y() + rec.height()-static_cast<int>(allowence));
|
rec.y() + rec.height()-static_cast<int>(allowance));
|
||||||
data.append(scissors);
|
data.append(scissors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,8 +140,8 @@ QVector<QGraphicsItem *> VPoster::Borders(QGraphicsItem *parent, const PosterDat
|
||||||
|
|
||||||
const int layoutX = 15;
|
const int layoutX = 15;
|
||||||
const int layoutY = 5;
|
const int layoutY = 5;
|
||||||
labels->setPos(rec.x() + layoutX, rec.y() + rec.height()-static_cast<int>(allowence)+layoutY);
|
labels->setPos(rec.x() + layoutX, rec.y() + rec.height()-static_cast<int>(allowance)+layoutY);
|
||||||
labels->setTextWidth(rec.width()-(static_cast<int>(allowence)+layoutX));
|
labels->setTextWidth(rec.width()-(static_cast<int>(allowance)+layoutX));
|
||||||
|
|
||||||
const QString grid = tr("Grid ( %1 , %2 )").arg(img.row+1).arg(img.column+1);
|
const QString grid = tr("Grid ( %1 , %2 )").arg(img.row+1).arg(img.column+1);
|
||||||
const QString page = tr("Page %1 of %2").arg(img.row*(img.columns)+img.column+1).arg(img.rows*img.columns);
|
const QString page = tr("Page %1 of %2").arg(img.row*(img.columns)+img.column+1).arg(img.rows*img.columns);
|
||||||
|
@ -198,18 +198,18 @@ int VPoster::CountRows(int height) const
|
||||||
// *
|
// *
|
||||||
// ―
|
// ―
|
||||||
|
|
||||||
const int pCount = qCeil(imgLength/pageLength);// Pages count without allowence (or allowence = 0) (3)
|
const int pCount = qCeil(imgLength/pageLength);// Pages count without allowance (or allowance = 0) (3)
|
||||||
|
|
||||||
// Calculate how many pages will be after using allowence.
|
// Calculate how many pages will be after using allowance.
|
||||||
// We know start pages count. This number not enought because
|
// We know start pages count. This number not enought because
|
||||||
// each n-1 pages add (n-1)*allowence length to page (1).
|
// each n-1 pages add (n-1)*allowance length to page (1).
|
||||||
const qreal addionalLength = (pCount-1)*static_cast<int>(allowence); //-V636
|
const qreal addionalLength = (pCount-1)*static_cast<int>(allowance); //-V636
|
||||||
|
|
||||||
// Calculate additional length form pages that will cover this length (2).
|
// Calculate additional length form pages that will cover this length (2).
|
||||||
// In the end add page length (3).
|
// In the end add page length (3).
|
||||||
// Bottom page have mandatory border (4)
|
// Bottom page have mandatory border (4)
|
||||||
return qCeil((addionalLength +
|
return qCeil((addionalLength +
|
||||||
qCeil(addionalLength/pageLength)*static_cast<int>(allowence) + static_cast<int>(allowence) +
|
qCeil(addionalLength/pageLength)*static_cast<int>(allowance) + static_cast<int>(allowance) +
|
||||||
imgLength)/pageLength);
|
imgLength)/pageLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,16 +228,16 @@ int VPoster::CountColumns(int width) const
|
||||||
// |----|
|
// |----|
|
||||||
// ^
|
// ^
|
||||||
// (2)
|
// (2)
|
||||||
const int pCount = qCeil(imgLength/pageLength);// Pages count without allowence (or allowence = 0) (3)
|
const int pCount = qCeil(imgLength/pageLength);// Pages count without allowance (or allowance = 0) (3)
|
||||||
|
|
||||||
// Calculate how many pages will be after using allowence.
|
// Calculate how many pages will be after using allowance.
|
||||||
// We know start pages count. This number not enought because
|
// We know start pages count. This number not enought because
|
||||||
// each n-1 pages add (n-1)*allowence length to page (1).
|
// each n-1 pages add (n-1)*allowance length to page (1).
|
||||||
const qreal addionalLength = (pCount-1)*static_cast<int>(allowence); //-V636
|
const qreal addionalLength = (pCount-1)*static_cast<int>(allowance); //-V636
|
||||||
|
|
||||||
// Calculate additional length form pages that will cover this length (2).
|
// Calculate additional length form pages that will cover this length (2).
|
||||||
// In the end add page length (3).
|
// In the end add page length (3).
|
||||||
return qCeil((addionalLength + qCeil(addionalLength/pageLength)*static_cast<int>(allowence) +
|
return qCeil((addionalLength + qCeil(addionalLength/pageLength)*static_cast<int>(allowance) +
|
||||||
imgLength)/pageLength);
|
imgLength)/pageLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,8 +246,8 @@ PosterData VPoster::Cut(int i, int j, const QRect &imageRect) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(imageRect)
|
Q_UNUSED(imageRect)
|
||||||
|
|
||||||
const int x = j*PageRect().width() - j*static_cast<int>(allowence);
|
const int x = j*PageRect().width() - j*static_cast<int>(allowance);
|
||||||
const int y = i*PageRect().height() - i*static_cast<int>(allowence);
|
const int y = i*PageRect().height() - i*static_cast<int>(allowance);
|
||||||
|
|
||||||
SCASSERT(x <= imageRect.width())
|
SCASSERT(x <= imageRect.width())
|
||||||
SCASSERT(y <= imageRect.height())
|
SCASSERT(y <= imageRect.height())
|
||||||
|
|
|
@ -48,7 +48,7 @@ struct PosterData
|
||||||
rect(){}
|
rect(){}
|
||||||
|
|
||||||
quint32 index; // paper index
|
quint32 index; // paper index
|
||||||
quint32 row; // positions in the greed
|
quint32 row; // positions in the grid
|
||||||
quint32 column;
|
quint32 column;
|
||||||
quint32 rows;
|
quint32 rows;
|
||||||
quint32 columns;
|
quint32 columns;
|
||||||
|
@ -66,7 +66,7 @@ public:
|
||||||
QVector<QGraphicsItem *> Borders(QGraphicsItem *parent, const PosterData &img, int sheets) const;
|
QVector<QGraphicsItem *> Borders(QGraphicsItem *parent, const PosterData &img, int sheets) const;
|
||||||
private:
|
private:
|
||||||
const QPrinter *printer;
|
const QPrinter *printer;
|
||||||
quint32 allowence;
|
quint32 allowance;
|
||||||
|
|
||||||
int CountRows(int height) const;
|
int CountRows(int height) const;
|
||||||
int CountColumns(int width) const;
|
int CountColumns(int width) const;
|
||||||
|
|
|
@ -507,7 +507,7 @@ QPainterPath VDetail::SeamAllowancePath(const VContainer *data) const
|
||||||
const QVector<QPointF> pointsEkv = SeamAllowancePoints(data);
|
const QVector<QPointF> pointsEkv = SeamAllowancePoints(data);
|
||||||
QPainterPath ekv;
|
QPainterPath ekv;
|
||||||
|
|
||||||
// seam allowence
|
// seam allowance
|
||||||
if (getSeamAllowance())
|
if (getSeamAllowance())
|
||||||
{
|
{
|
||||||
if (not pointsEkv.isEmpty())
|
if (not pointsEkv.isEmpty())
|
||||||
|
|
|
@ -100,7 +100,7 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge
|
||||||
{
|
{
|
||||||
ui.doubleSpinBoxSeams->setDecimals(5);
|
ui.doubleSpinBoxSeams->setDecimals(5);
|
||||||
}
|
}
|
||||||
// Default value for seam allowence is 1 cm. But pattern have different units, so just set 1 in dialog not enough.
|
// Default value for seam allowance is 1 cm. But pattern have different units, so just set 1 in dialog not enough.
|
||||||
ui.doubleSpinBoxSeams->setValue(UnitConvertor(1, Unit::Cm, qApp->patternUnit()));
|
ui.doubleSpinBoxSeams->setValue(UnitConvertor(1, Unit::Cm, qApp->patternUnit()));
|
||||||
|
|
||||||
bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
|
bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user