Shows global contour.
For debugging purposes. * * * Show nodes on global contour. --HG-- branch : develop
This commit is contained in:
parent
715389d35d
commit
c2672b4b69
|
@ -1539,6 +1539,7 @@ void MainWindow::CleanLayout()
|
||||||
scenes.clear();
|
scenes.clear();
|
||||||
shadows.clear();
|
shadows.clear();
|
||||||
papers.clear();
|
papers.clear();
|
||||||
|
gcontours.clear();
|
||||||
ui->listWidget->clear();
|
ui->listWidget->clear();
|
||||||
SetLayoutModeActions();
|
SetLayoutModeActions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,6 +108,21 @@ void RemoveLayoutPath(const QString &path, bool usedNotExistedDir)
|
||||||
dir.rmpath(QChar('.'));
|
dir.rmpath(QChar('.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Q_DECL_UNUSED void InsertGlobalContours(const QList<QGraphicsScene *> &scenes, const QList<QGraphicsItem *> &gcontours);
|
||||||
|
void InsertGlobalContours(const QList<QGraphicsScene *> &scenes, const QList<QGraphicsItem *> &gcontours)
|
||||||
|
{
|
||||||
|
if (scenes.size() != gcontours.size())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < scenes.size(); ++i)
|
||||||
|
{
|
||||||
|
scenes.at(i)->addItem(gcontours.at(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -122,6 +137,7 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
|
||||||
shadows(),
|
shadows(),
|
||||||
scenes(),
|
scenes(),
|
||||||
details(),
|
details(),
|
||||||
|
gcontours(),
|
||||||
detailsOnLayout(),
|
detailsOnLayout(),
|
||||||
undoAction(nullptr),
|
undoAction(nullptr),
|
||||||
redoAction(nullptr),
|
redoAction(nullptr),
|
||||||
|
@ -228,6 +244,9 @@ bool MainWindowsNoGUI::LayoutSettings(VLayoutGenerator& lGenerator)
|
||||||
detailsOnLayout = lGenerator.GetAllDetails();// All details items
|
detailsOnLayout = lGenerator.GetAllDetails();// All details items
|
||||||
shadows = CreateShadows(papers);
|
shadows = CreateShadows(papers);
|
||||||
scenes = CreateScenes(papers, shadows, details);
|
scenes = CreateScenes(papers, shadows, details);
|
||||||
|
//Uncomment to debug, shows global contour
|
||||||
|
// gcontours = lGenerator.GetGlobalContours(); // uncomment for debugging
|
||||||
|
// InsertGlobalContours(scenes, gcontours); // uncomment for debugging
|
||||||
PrepareSceneList();
|
PrepareSceneList();
|
||||||
ignorePrinterFields = not lGenerator.IsUsePrinterFields();
|
ignorePrinterFields = not lGenerator.IsUsePrinterFields();
|
||||||
margins = lGenerator.GetPrinterFields();
|
margins = lGenerator.GetPrinterFields();
|
||||||
|
|
|
@ -99,6 +99,7 @@ protected:
|
||||||
QList<QGraphicsItem *> shadows;
|
QList<QGraphicsItem *> shadows;
|
||||||
QList<QGraphicsScene *> scenes;
|
QList<QGraphicsScene *> scenes;
|
||||||
QList<QList<QGraphicsItem *> > details;
|
QList<QList<QGraphicsItem *> > details;
|
||||||
|
QList<QGraphicsItem *> gcontours;
|
||||||
|
|
||||||
QVector<QVector<VLayoutPiece> > detailsOnLayout;
|
QVector<QVector<VLayoutPiece> > detailsOnLayout;
|
||||||
|
|
||||||
|
|
|
@ -221,6 +221,17 @@ QList<QGraphicsItem *> VLayoutGenerator::GetPapersItems() const
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QList<QGraphicsItem *> VLayoutGenerator::GetGlobalContours() const
|
||||||
|
{
|
||||||
|
QList<QGraphicsItem *> list;
|
||||||
|
for (auto &paper : papers)
|
||||||
|
{
|
||||||
|
list.append(paper.GetGlobalContour());
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QList<QList<QGraphicsItem *> > VLayoutGenerator::GetAllDetailsItems() const
|
QList<QList<QGraphicsItem *> > VLayoutGenerator::GetAllDetailsItems() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,6 +83,7 @@ public:
|
||||||
LayoutErrors State() const;
|
LayoutErrors State() const;
|
||||||
|
|
||||||
Q_REQUIRED_RESULT QList<QGraphicsItem *> GetPapersItems() const;
|
Q_REQUIRED_RESULT QList<QGraphicsItem *> GetPapersItems() const;
|
||||||
|
Q_REQUIRED_RESULT QList<QGraphicsItem *> GetGlobalContours() const;
|
||||||
Q_REQUIRED_RESULT QList<QList<QGraphicsItem *>> GetAllDetailsItems() const;
|
Q_REQUIRED_RESULT QList<QList<QGraphicsItem *>> GetAllDetailsItems() const;
|
||||||
|
|
||||||
QVector<QVector<VLayoutPiece>> GetAllDetails() const;
|
QVector<QVector<VLayoutPiece>> GetAllDetails() const;
|
||||||
|
|
|
@ -366,6 +366,32 @@ QGraphicsRectItem *VLayoutPaper::GetPaperItem(bool autoCrop, bool textAsPaths) c
|
||||||
return paper;
|
return paper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QGraphicsPathItem *VLayoutPaper::GetGlobalContour() const
|
||||||
|
{
|
||||||
|
// contour
|
||||||
|
const QVector<QPointF> points = d->globalContour.GetContour();
|
||||||
|
|
||||||
|
QPainterPath path;
|
||||||
|
if (points.size() > 0)
|
||||||
|
{
|
||||||
|
path.moveTo(points.at(0));
|
||||||
|
for (auto point : points)
|
||||||
|
{
|
||||||
|
path.lineTo(point);
|
||||||
|
}
|
||||||
|
path.lineTo(points.at(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
const qreal radius = 1;
|
||||||
|
for (auto point : points)
|
||||||
|
{
|
||||||
|
path.addEllipse(point.x()-radius, point.y()-radius, radius*2, radius*2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new QGraphicsPathItem(path);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QList<QGraphicsItem *> VLayoutPaper::GetItemDetails(bool textAsPaths) const
|
QList<QGraphicsItem *> VLayoutPaper::GetItemDetails(bool textAsPaths) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <QTypeInfo>
|
#include <QTypeInfo>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
#include <QGraphicsPathItem>
|
||||||
|
|
||||||
#include "vlayoutdef.h"
|
#include "vlayoutdef.h"
|
||||||
|
|
||||||
|
@ -92,6 +93,7 @@ public:
|
||||||
bool ArrangeDetail(const VLayoutPiece &detail, std::atomic_bool &stop);
|
bool ArrangeDetail(const VLayoutPiece &detail, std::atomic_bool &stop);
|
||||||
int Count() const;
|
int Count() const;
|
||||||
Q_REQUIRED_RESULT QGraphicsRectItem *GetPaperItem(bool autoCrop, bool textAsPaths) const;
|
Q_REQUIRED_RESULT QGraphicsRectItem *GetPaperItem(bool autoCrop, bool textAsPaths) const;
|
||||||
|
Q_REQUIRED_RESULT QGraphicsPathItem *GetGlobalContour() const;
|
||||||
Q_REQUIRED_RESULT QList<QGraphicsItem *> GetItemDetails(bool textAsPaths) const;
|
Q_REQUIRED_RESULT QList<QGraphicsItem *> GetItemDetails(bool textAsPaths) const;
|
||||||
|
|
||||||
QVector<VLayoutPiece> GetDetails() const;
|
QVector<VLayoutPiece> GetDetails() const;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user