Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maintenance: remove unstable debugging from layout generation #1223

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions src/libs/vlayout/vlayoutdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,4 @@ enum class BestFrom : char
Rotation = 0,
Combine = 1
};

/* Warning! Debugging doesn't work stable in debug mode. If you need big allocation use release mode. Or disable
* Address Sanitizer.
*/
//#define LAYOUT_DEBUG // Enable debug mode

// This block help rule debug mode. Don't turn all options at the same time!
#ifdef LAYOUT_DEBUG
// Nice looking
# define SHOW_VERTICES // Show contour vertices
# define SHOW_DIRECTION // Show contour direction
# define ARRANGED_PIECES // Show already arranged pieces
//# define SHOW_SHEET // Show sheet rect

// Debugging
# define SHOW_CANDIDATE // Show each position
//# define SHOW_ROTATION // For each position show rotation part
//# define SHOW_COMBINE // For each position show edge combine part
//# define SHOW_MIRROR // For each position show mirror part
//# define SHOW_CANDIDATE_BEST // For only correct positions that pass checks
# define SHOW_BEST // Show only best position for workpiece
#endif//LAYOUT_DEBUG

#endif // VLAYOUTDEF_H
7 changes: 0 additions & 7 deletions src/libs/vlayout/vlayoutgenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,6 @@ void VLayoutGenerator::Generate()
papers.clear();
state = LayoutErrors::NoError;

#ifdef LAYOUT_DEBUG
const QString path = QDir::homePath()+QStringLiteral("/LayoutDebug");
QDir debugDir(path);
debugDir.removeRecursively();
debugDir.mkpath(path);
#endif

emit Start();

if (bank->Prepare())
Expand Down
16 changes: 0 additions & 16 deletions src/libs/vlayout/vlayoutpaper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,6 @@ bool VLayoutPaper::arrangePiece(const VLayoutPiece &piece, std::atomic_bool &sto
d->localRotationIncrease = d->globalRotationIncrease;
}

d->frame = 0;

return AddToSheet(piece, stop);
}

Expand Down Expand Up @@ -275,14 +273,6 @@ bool VLayoutPaper::AddToSheet(const VLayoutPiece &piece, std::atomic_bool &stop)
VPosition *thread = new VPosition(d->globalContour, j, piece, i, &stop, d->localRotate,
d->localRotationIncrease,
d->saveLength);
//Info for debug
#ifdef LAYOUT_DEBUG
thread->setPaperIndex(d->paperIndex);
thread->setFrame(d->frame);
thread->setPieceCount(d->pieces.count());
thread->setPieces(d->pieces);
#endif

thread->setAutoDelete(false);
threads.append(thread);
thread_pool->start(thread);
Expand Down Expand Up @@ -334,12 +324,6 @@ bool VLayoutPaper::SaveResult(const VBestSquare &bestResult, const VLayoutPiece
}
d->pieces.append(workDetail);
d->globalContour.SetContour(newGContour);

#ifdef LAYOUT_DEBUG
# ifdef SHOW_BEST
VPosition::DrawDebug(d->globalContour, workDetail, UINT_MAX, d->paperIndex, d->pieces.count(), d->pieces);
# endif
#endif
}

return bestResult.ValidResult(); // Do we have the best result?
Expand Down
3 changes: 0 additions & 3 deletions src/libs/vlayout/vlayoutpaper_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class VLayoutPaperData : public QSharedData
: pieces(QVector<VLayoutPiece>()),
globalContour(VContour()),
paperIndex(0),
frame(0),
layoutWidth(0),
globalRotate(true),
localRotate(true),
Expand All @@ -84,7 +83,6 @@ class VLayoutPaperData : public QSharedData
: pieces(QVector<VLayoutPiece>()),
globalContour(VContour(height, width)),
paperIndex(0),
frame(0),
layoutWidth(0),
globalRotate(true),
localRotate(true),
Expand All @@ -98,7 +96,6 @@ class VLayoutPaperData : public QSharedData
pieces(paper.pieces),
globalContour(paper.globalContour),
paperIndex(paper.paperIndex),
frame(paper.frame),
layoutWidth(paper.layoutWidth),
globalRotate(paper.globalRotate),
localRotate(paper.localRotate),
Expand Down
Loading
Loading