Improvement for option "Save layout length".
This option worked only for portrait orientation. In landscape orientation instead of width need save height. Additionally we keep original comaprison for the smallest bounding rect. This creates more humanlike output. --HG-- branch : develop
This commit is contained in:
parent
f678174729
commit
55a3ecb8cb
|
@ -33,7 +33,7 @@
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VBestSquare::VBestSquare(const QSizeF &sheetSize, bool saveLength)
|
VBestSquare::VBestSquare(const QSizeF &sheetSize, bool saveLength)
|
||||||
:resI(0), resJ(0), resMatrix(QMatrix()), bestSize(QSizeF(sheetSize.width()+10, sheetSize.height()+10)),
|
:resI(0), resJ(0), resMatrix(QMatrix()), bestSize(QSizeF(sheetSize.width()+10, sheetSize.height()+10)),
|
||||||
sheetWidth(sheetSize.width()), valideResult(false), resMirror(false), type (BestFrom::Rotation),
|
sheetSize(sheetSize), valideResult(false), resMirror(false), type (BestFrom::Rotation),
|
||||||
saveLength(saveLength)
|
saveLength(saveLength)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -42,10 +42,17 @@ void VBestSquare::NewResult(const QSizeF &candidate, int i, int j, const QTransf
|
||||||
{
|
{
|
||||||
if (saveLength)
|
if (saveLength)
|
||||||
{
|
{
|
||||||
const QSizeF saveLengthSize(sheetWidth, candidate.height());
|
const bool isPortrait = sheetSize.height() >= sheetSize.width();
|
||||||
if (Square(saveLengthSize) <= Square(bestSize) && Square(saveLengthSize) > 0 && type >= this->type)
|
const QSizeF saveSpaceSize = isPortrait ? QSizeF(sheetSize.width(), candidate.height()) :
|
||||||
|
QSizeF(candidate.width(), sheetSize.height());
|
||||||
|
|
||||||
|
const QSizeF saveSpaceBestSize = isPortrait ? QSizeF(sheetSize.width(), bestSize.height()) :
|
||||||
|
QSizeF(bestSize.width(), sheetSize.height());
|
||||||
|
|
||||||
|
if (Square(saveSpaceSize) <= Square(saveSpaceBestSize) && Square(candidate) <= Square(bestSize)
|
||||||
|
&& Square(saveSpaceSize) > 0 && Square(saveSpaceBestSize) > 0 && type >= this->type)
|
||||||
{
|
{
|
||||||
bestSize = saveLengthSize;
|
bestSize = candidate;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,7 +59,7 @@ private:
|
||||||
int resJ; // Edge of detail
|
int resJ; // Edge of detail
|
||||||
QTransform resMatrix; // Matrix for rotation and translation detail
|
QTransform resMatrix; // Matrix for rotation and translation detail
|
||||||
QSizeF bestSize;
|
QSizeF bestSize;
|
||||||
qreal sheetWidth;
|
QSizeF sheetSize;
|
||||||
bool valideResult;
|
bool valideResult;
|
||||||
bool resMirror;
|
bool resMirror;
|
||||||
BestFrom type;
|
BestFrom type;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user