Rename class VLayoutDetail.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-01-22 11:02:02 +02:00
parent c6f529992b
commit 10a13a499d
18 changed files with 154 additions and 154 deletions

View File

@ -60,7 +60,7 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent) MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
: VAbstractMainWindow(parent), listDetails(QVector<VLayoutDetail>()), currentScene(nullptr), tempSceneLayout(nullptr), : VAbstractMainWindow(parent), listDetails(QVector<VLayoutPiece>()), currentScene(nullptr), tempSceneLayout(nullptr),
pattern(new VContainer(qApp->TrVars(), qApp->patternUnitP())), doc(nullptr), papers(QList<QGraphicsItem *>()), pattern(new VContainer(qApp->TrVars(), qApp->patternUnitP())), doc(nullptr), papers(QList<QGraphicsItem *>()),
shadows(QList<QGraphicsItem *>()), scenes(QList<QGraphicsScene *>()), details(QList<QList<QGraphicsItem *> >()), shadows(QList<QGraphicsItem *>()), scenes(QList<QGraphicsScene *>()), details(QList<QList<QGraphicsItem *> >()),
undoAction(nullptr), redoAction(nullptr), actionDockWidgetToolOptions(nullptr), actionDockWidgetGroups(nullptr), undoAction(nullptr), redoAction(nullptr), actionDockWidgetToolOptions(nullptr), actionDockWidgetGroups(nullptr),
@ -475,7 +475,7 @@ void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VPiece> *det
QHash<quint32, VPiece>::const_iterator i = details->constBegin(); QHash<quint32, VPiece>::const_iterator i = details->constBegin();
while (i != details->constEnd()) while (i != details->constEnd())
{ {
listDetails.append(VLayoutDetail::Create(i.value(), pattern)); listDetails.append(VLayoutPiece::Create(i.value(), pattern));
++i; ++i;
} }
} }

View File

@ -32,7 +32,7 @@
#include <QMainWindow> #include <QMainWindow>
#include <QPrinter> #include <QPrinter>
#include "../vlayout/vlayoutdetail.h" #include "../vlayout/vlayoutpiece.h"
#include "xml/vpattern.h" #include "xml/vpattern.h"
#include "dialogs/dialogsavelayout.h" #include "dialogs/dialogsavelayout.h"
#include "../vlayout/vlayoutgenerator.h" #include "../vlayout/vlayoutgenerator.h"
@ -58,7 +58,7 @@ public slots:
void PrintOrigin(); void PrintOrigin();
void PrintTiled(); void PrintTiled();
protected: protected:
QVector<VLayoutDetail> listDetails; QVector<VLayoutPiece> listDetails;
/** @brief currentScene pointer to current scene. */ /** @brief currentScene pointer to current scene. */
QGraphicsScene *currentScene; QGraphicsScene *currentScene;

View File

@ -32,7 +32,7 @@
#include "../vmisc/diagnostic.h" #include "../vmisc/diagnostic.h"
#include "../vmisc/logging.h" #include "../vmisc/logging.h"
#include "vlayoutdetail.h" #include "vlayoutpiece.h"
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes") QT_WARNING_DISABLE_CLANG("-Wmissing-prototypes")
@ -52,7 +52,7 @@ QT_WARNING_POP
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VBank::VBank() VBank::VBank()
:details(QVector<VLayoutDetail>()), unsorted(QHash<int, qint64>()), big(QHash<int, qint64>()), :details(QVector<VLayoutPiece>()), unsorted(QHash<int, qint64>()), big(QHash<int, qint64>()),
middle(QHash<int, qint64>()), small(QHash<int, qint64>()), layoutWidth(0), caseType(Cases::CaseDesc), middle(QHash<int, qint64>()), small(QHash<int, qint64>()), layoutWidth(0), caseType(Cases::CaseDesc),
prepare(false), diagonal(0) prepare(false), diagonal(0)
{} {}
@ -71,7 +71,7 @@ void VBank::SetLayoutWidth(const qreal &value)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VBank::SetDetails(const QVector<VLayoutDetail> &details) void VBank::SetDetails(const QVector<VLayoutPiece> &details)
{ {
this->details = details; this->details = details;
Reset(); Reset();
@ -111,7 +111,7 @@ int VBank::GetTiket()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutDetail VBank::GetDetail(int i) const VLayoutPiece VBank::GetDetail(int i) const
{ {
if (i >= 0 && i < details.size()) if (i >= 0 && i < details.size())
{ {
@ -119,7 +119,7 @@ VLayoutDetail VBank::GetDetail(int i) const
} }
else else
{ {
return VLayoutDetail(); return VLayoutPiece();
} }
} }

View File

@ -43,7 +43,7 @@
#endif #endif
class QPointF; class QPointF;
class VLayoutDetail; class VLayoutPiece;
enum class Cases : char { CaseThreeGroup = 0, CaseTwoGroup, CaseDesc, UnknownCase}; enum class Cases : char { CaseThreeGroup = 0, CaseTwoGroup, CaseDesc, UnknownCase};
@ -55,9 +55,9 @@ public:
qreal GetLayoutWidth() const; qreal GetLayoutWidth() const;
void SetLayoutWidth(const qreal &value); void SetLayoutWidth(const qreal &value);
void SetDetails(const QVector<VLayoutDetail> &details); void SetDetails(const QVector<VLayoutPiece> &details);
int GetTiket(); int GetTiket();
VLayoutDetail GetDetail(int i) const; VLayoutPiece GetDetail(int i) const;
void Arranged(int i); void Arranged(int i);
void NotArranged(int i); void NotArranged(int i);
@ -74,7 +74,7 @@ public:
private: private:
Q_DISABLE_COPY(VBank) Q_DISABLE_COPY(VBank)
QVector<VLayoutDetail> details; QVector<VLayoutPiece> details;
QHash<int, qint64> unsorted; QHash<int, qint64> unsorted;
QHash<int, qint64> big; QHash<int, qint64> big;

View File

@ -37,7 +37,7 @@
#include <Qt> #include <Qt>
#include "vcontour_p.h" #include "vcontour_p.h"
#include "vlayoutdetail.h" #include "vlayoutpiece.h"
#include "../vmisc/vmath.h" #include "../vmisc/vmath.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -125,7 +125,7 @@ QSizeF VContour::GetSize() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VContour::UniteWithContour(const VLayoutDetail &detail, int globalI, int detJ, BestFrom type) const QVector<QPointF> VContour::UniteWithContour(const VLayoutPiece &detail, int globalI, int detJ, BestFrom type) const
{ {
QVector<QPointF> newContour; QVector<QPointF> newContour;
if (d->globalContour.isEmpty()) //-V807 if (d->globalContour.isEmpty()) //-V807
@ -333,7 +333,7 @@ QPainterPath VContour::ContourPath() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VContour::AppendWhole(QVector<QPointF> &contour, const VLayoutDetail &detail, int detJ) const void VContour::AppendWhole(QVector<QPointF> &contour, const VLayoutPiece &detail, int detJ) const
{ {
int processedEdges = 0; int processedEdges = 0;
const int nD = detail.LayoutEdgesCount(); const int nD = detail.LayoutEdgesCount();

View File

@ -43,7 +43,7 @@ class QPointF;
class QRectF; class QRectF;
class QSizeF; class QSizeF;
class VContourData; class VContourData;
class VLayoutDetail; class VLayoutPiece;
class VContour class VContour
{ {
@ -68,7 +68,7 @@ public:
QSizeF GetSize() const; QSizeF GetSize() const;
QVector<QPointF> UniteWithContour(const VLayoutDetail &detail, int globalI, int detJ, BestFrom type) const; QVector<QPointF> UniteWithContour(const VLayoutPiece &detail, int globalI, int detJ, BestFrom type) const;
QLineF EmptySheetEdge() const; QLineF EmptySheetEdge() const;
int GlobalEdgesCount() const; int GlobalEdgesCount() const;
@ -85,7 +85,7 @@ public:
private: private:
QSharedDataPointer<VContourData> d; QSharedDataPointer<VContourData> d;
void AppendWhole(QVector<QPointF> &contour, const VLayoutDetail &detail, int detJ) const; void AppendWhole(QVector<QPointF> &contour, const VLayoutPiece &detail, int detJ) const;
}; };
Q_DECLARE_TYPEINFO(VContour, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(VContour, Q_MOVABLE_TYPE);

View File

@ -4,10 +4,8 @@
HEADERS += \ HEADERS += \
$$PWD/stable.h \ $$PWD/stable.h \
$$PWD/vlayoutgenerator.h \ $$PWD/vlayoutgenerator.h \
$$PWD/vlayoutdetail.h \
$$PWD/vabstractdetail.h \ $$PWD/vabstractdetail.h \
$$PWD/vabstractdetail_p.h \ $$PWD/vabstractdetail_p.h \
$$PWD/vlayoutdetail_p.h \
$$PWD/vlayoutdef.h \ $$PWD/vlayoutdef.h \
$$PWD/vlayoutpaper.h \ $$PWD/vlayoutpaper.h \
$$PWD/vlayoutpaper_p.h \ $$PWD/vlayoutpaper_p.h \
@ -20,11 +18,12 @@ HEADERS += \
$$PWD/vposter.h \ $$PWD/vposter.h \
$$PWD/vgraphicsfillitem.h \ $$PWD/vgraphicsfillitem.h \
$$PWD/vabstractpiece.h \ $$PWD/vabstractpiece.h \
$$PWD/vabstractpiece_p.h $$PWD/vabstractpiece_p.h \
$$PWD/vlayoutpiece.h \
$$PWD/vlayoutpiece_p.h
SOURCES += \ SOURCES += \
$$PWD/vlayoutgenerator.cpp \ $$PWD/vlayoutgenerator.cpp \
$$PWD/vlayoutdetail.cpp \
$$PWD/vabstractdetail.cpp \ $$PWD/vabstractdetail.cpp \
$$PWD/vlayoutpaper.cpp \ $$PWD/vlayoutpaper.cpp \
$$PWD/vbank.cpp \ $$PWD/vbank.cpp \
@ -34,6 +33,7 @@ SOURCES += \
$$PWD/vtextmanager.cpp \ $$PWD/vtextmanager.cpp \
$$PWD/vposter.cpp \ $$PWD/vposter.cpp \
$$PWD/vgraphicsfillitem.cpp \ $$PWD/vgraphicsfillitem.cpp \
$$PWD/vabstractpiece.cpp $$PWD/vabstractpiece.cpp \
$$PWD/vlayoutpiece.cpp
win32-msvc*:SOURCES += $$PWD/stable.cpp win32-msvc*:SOURCES += $$PWD/stable.cpp

View File

@ -34,7 +34,7 @@
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "../vmisc/vmath.h" #include "../vmisc/vmath.h"
#include "vlayoutdetail.h" #include "vlayoutpiece.h"
#include "vlayoutpaper.h" #include "vlayoutpaper.h"
class QMarginsF; class QMarginsF;
@ -54,7 +54,7 @@ VLayoutGenerator::~VLayoutGenerator()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutGenerator::SetDetails(const QVector<VLayoutDetail> &details) void VLayoutGenerator::SetDetails(const QVector<VLayoutPiece> &details)
{ {
bank->SetDetails(details); bank->SetDetails(details);
} }
@ -273,7 +273,7 @@ void VLayoutGenerator::GatherPages()
return; return;
} }
QList<QList<VLayoutDetail>> nDetails; QList<QList<VLayoutPiece>> nDetails;
qreal length = 0; qreal length = 0;
int j = 0; // papers count int j = 0; // papers count
@ -328,7 +328,7 @@ void VLayoutGenerator::UnitePages()
} }
QList<qreal> papersLength; QList<qreal> papersLength;
QList<QList<VLayoutDetail> > nDetails; QList<QList<VLayoutPiece> > nDetails;
qreal length = 0; qreal length = 0;
int j = 0; // papers count int j = 0; // papers count
@ -385,7 +385,7 @@ void VLayoutGenerator::UnitePages()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutGenerator::UniteDetails(int j, QList<QList<VLayoutDetail> > &nDetails, qreal length, int i) void VLayoutGenerator::UniteDetails(int j, QList<QList<VLayoutPiece> > &nDetails, qreal length, int i)
{ {
if ((j == 0 && nDetails.isEmpty()) || j >= nDetails.size()) if ((j == 0 && nDetails.isEmpty()) || j >= nDetails.size())
{//First or new details in paper {//First or new details in paper
@ -411,17 +411,17 @@ void VLayoutGenerator::UnitePapers(int j, QList<qreal> &papersLength, qreal leng
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QList<VLayoutDetail> VLayoutGenerator::MoveDetails(qreal length, const QVector<VLayoutDetail> &details) QList<VLayoutPiece> VLayoutGenerator::MoveDetails(qreal length, const QVector<VLayoutPiece> &details)
{ {
if (qFuzzyIsNull(length)) if (qFuzzyIsNull(length))
{ {
return details.toList(); return details.toList();
} }
QList<VLayoutDetail> newDetails; QList<VLayoutPiece> newDetails;
for (int i = 0; i < details.size(); ++i) for (int i = 0; i < details.size(); ++i)
{ {
VLayoutDetail d = details.at(i); VLayoutPiece d = details.at(i);
d.Translate(0, length); d.Translate(0, length);
newDetails.append(d); newDetails.append(d);
} }

View File

@ -50,7 +50,7 @@ class QMarginsF;
#endif #endif
class QGraphicsItem; class QGraphicsItem;
class VLayoutDetail; class VLayoutPiece;
class VLayoutPaper; class VLayoutPaper;
class VLayoutGenerator :public QObject class VLayoutGenerator :public QObject
@ -60,7 +60,7 @@ public:
explicit VLayoutGenerator(QObject *parent = nullptr); explicit VLayoutGenerator(QObject *parent = nullptr);
virtual ~VLayoutGenerator() Q_DECL_OVERRIDE; virtual ~VLayoutGenerator() Q_DECL_OVERRIDE;
void SetDetails(const QVector<VLayoutDetail> &details); void SetDetails(const QVector<VLayoutPiece> &details);
void SetLayoutWidth(qreal width); void SetLayoutWidth(qreal width);
void SetCaseType(Cases caseType); void SetCaseType(Cases caseType);
int DetailsCount(); int DetailsCount();
@ -140,9 +140,9 @@ private:
void GatherPages(); void GatherPages();
void UnitePages(); void UnitePages();
void UniteDetails(int j, QList<QList<VLayoutDetail> > &nDetails, qreal length, int i); void UniteDetails(int j, QList<QList<VLayoutPiece> > &nDetails, qreal length, int i);
void UnitePapers(int j, QList<qreal> &papersLength, qreal length); void UnitePapers(int j, QList<qreal> &papersLength, qreal length);
QList<VLayoutDetail> MoveDetails(qreal length, const QVector<VLayoutDetail> &details); QList<VLayoutPiece> MoveDetails(qreal length, const QVector<VLayoutPiece> &details);
}; };
typedef std::shared_ptr<VLayoutGenerator> VLayoutGeneratorPtr; typedef std::shared_ptr<VLayoutGenerator> VLayoutGeneratorPtr;

View File

@ -45,7 +45,7 @@
#include "vbestsquare.h" #include "vbestsquare.h"
#include "vcontour.h" #include "vcontour.h"
#include "vlayoutdetail.h" #include "vlayoutpiece.h"
#include "vlayoutpaper_p.h" #include "vlayoutpaper_p.h"
#include "vposition.h" #include "vposition.h"
@ -185,7 +185,7 @@ void VLayoutPaper::SetPaperIndex(quint32 index)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VLayoutPaper::ArrangeDetail(const VLayoutDetail &detail, volatile bool &stop) bool VLayoutPaper::ArrangeDetail(const VLayoutPiece &detail, volatile bool &stop)
{ {
// First need set size of paper // First need set size of paper
if (d->globalContour.GetHeight() <= 0 || d->globalContour.GetWidth() <= 0) if (d->globalContour.GetHeight() <= 0 || d->globalContour.GetWidth() <= 0)
@ -221,7 +221,7 @@ int VLayoutPaper::Count() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VLayoutPaper::AddToSheet(const VLayoutDetail &detail, volatile bool &stop) bool VLayoutPaper::AddToSheet(const VLayoutPiece &detail, volatile bool &stop)
{ {
VBestSquare bestResult(d->globalContour.GetSize(), d->saveLength); VBestSquare bestResult(d->globalContour.GetSize(), d->saveLength);
QThreadPool *thread_pool = QThreadPool::globalInstance(); QThreadPool *thread_pool = QThreadPool::globalInstance();
@ -289,11 +289,11 @@ bool VLayoutPaper::AddToSheet(const VLayoutDetail &detail, volatile bool &stop)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VLayoutPaper::SaveResult(const VBestSquare &bestResult, const VLayoutDetail &detail) bool VLayoutPaper::SaveResult(const VBestSquare &bestResult, const VLayoutPiece &detail)
{ {
if (bestResult.ValidResult()) if (bestResult.ValidResult())
{ {
VLayoutDetail workDetail = detail; VLayoutPiece workDetail = detail;
workDetail.SetMatrix(bestResult.Matrix());// Don't forget set matrix workDetail.SetMatrix(bestResult.Matrix());// Don't forget set matrix
workDetail.SetMirror(bestResult.Mirror()); workDetail.SetMirror(bestResult.Mirror());
const QVector<QPointF> newGContour = d->globalContour.UniteWithContour(workDetail, bestResult.GContourEdge(), const QVector<QPointF> newGContour = d->globalContour.UniteWithContour(workDetail, bestResult.GContourEdge(),
@ -369,13 +369,13 @@ QList<QGraphicsItem *> VLayoutPaper::GetItemDetails() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QVector<VLayoutDetail> VLayoutPaper::GetDetails() const QVector<VLayoutPiece> VLayoutPaper::GetDetails() const
{ {
return d->details; return d->details;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutPaper::SetDetails(const QList<VLayoutDetail> &details) void VLayoutPaper::SetDetails(const QList<VLayoutPiece> &details)
{ {
d->details = details.toVector(); d->details = details.toVector();
} }

View File

@ -40,7 +40,7 @@ class QGraphicsItem;
class QGraphicsRectItem; class QGraphicsRectItem;
class QRectF; class QRectF;
class VBestSquare; class VBestSquare;
class VLayoutDetail; class VLayoutPiece;
class VLayoutPaperData; class VLayoutPaperData;
template <typename T> class QList; template <typename T> class QList;
template <typename T> class QVector; template <typename T> class QVector;
@ -77,22 +77,22 @@ public:
void SetPaperIndex(quint32 index); void SetPaperIndex(quint32 index);
bool ArrangeDetail(const VLayoutDetail &detail, volatile bool &stop); bool ArrangeDetail(const VLayoutPiece &detail, volatile bool &stop);
int Count() const; int Count() const;
QGraphicsRectItem *GetPaperItem(bool autoCrop) const Q_REQUIRED_RESULT; QGraphicsRectItem *GetPaperItem(bool autoCrop) const Q_REQUIRED_RESULT;
QList<QGraphicsItem *> GetItemDetails() const Q_REQUIRED_RESULT; QList<QGraphicsItem *> GetItemDetails() const Q_REQUIRED_RESULT;
QVector<VLayoutDetail> GetDetails() const; QVector<VLayoutPiece> GetDetails() const;
void SetDetails(const QList<VLayoutDetail>& details); void SetDetails(const QList<VLayoutPiece>& details);
QRectF DetailsBoundingRect() const; QRectF DetailsBoundingRect() const;
private: private:
QSharedDataPointer<VLayoutPaperData> d; QSharedDataPointer<VLayoutPaperData> d;
bool AddToSheet(const VLayoutDetail &detail, volatile bool &stop); bool AddToSheet(const VLayoutPiece &detail, volatile bool &stop);
bool SaveResult(const VBestSquare &bestResult, const VLayoutDetail &detail); bool SaveResult(const VBestSquare &bestResult, const VLayoutPiece &detail);
}; };

View File

@ -33,7 +33,7 @@
#include <QVector> #include <QVector>
#include <QPointF> #include <QPointF>
#include "vlayoutdetail.h" #include "vlayoutpiece.h"
#include "vcontour.h" #include "vcontour.h"
QT_WARNING_PUSH QT_WARNING_PUSH
@ -43,7 +43,7 @@ class VLayoutPaperData : public QSharedData
{ {
public: public:
VLayoutPaperData() VLayoutPaperData()
: details(QVector<VLayoutDetail>()), : details(QVector<VLayoutPiece>()),
globalContour(VContour()), globalContour(VContour()),
paperIndex(0), paperIndex(0),
frame(0), frame(0),
@ -57,7 +57,7 @@ public:
VLayoutPaperData(int height, VLayoutPaperData(int height,
int width) int width)
: details(QVector<VLayoutDetail>()), : details(QVector<VLayoutPiece>()),
globalContour(VContour(height, width)), globalContour(VContour(height, width)),
paperIndex(0), paperIndex(0),
frame(0), frame(0),
@ -86,7 +86,7 @@ public:
~VLayoutPaperData() {} ~VLayoutPaperData() {}
/** @brief details list of arranged details. */ /** @brief details list of arranged details. */
QVector<VLayoutDetail> details; QVector<VLayoutPiece> details;
/** @brief globalContour list of global points contour. */ /** @brief globalContour list of global points contour. */
VContour globalContour; VContour globalContour;

View File

@ -26,7 +26,7 @@
** **
*************************************************************************/ *************************************************************************/
#include "vlayoutdetail.h" #include "vlayoutpiece.h"
#include <QBrush> #include <QBrush>
#include <QFlags> #include <QFlags>
@ -49,7 +49,7 @@
#include "../vmisc/vabstractapplication.h" #include "../vmisc/vabstractapplication.h"
#include "../vpatterndb/calculator.h" #include "../vpatterndb/calculator.h"
#include "vlayoutdef.h" #include "vlayoutdef.h"
#include "vlayoutdetail_p.h" #include "vlayoutpiece_p.h"
#include "vtextmanager.h" #include "vtextmanager.h"
#include "vgraphicsfillitem.h" #include "vgraphicsfillitem.h"
@ -58,17 +58,17 @@ class QLineF;
class VAbstractPattern; class VAbstractPattern;
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutDetail::VLayoutDetail() VLayoutPiece::VLayoutPiece()
:VAbstractPiece(), d(new VLayoutDetailData) :VAbstractPiece(), d(new VLayoutPieceData)
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutDetail::VLayoutDetail(const VLayoutDetail &detail) VLayoutPiece::VLayoutPiece(const VLayoutPiece &detail)
:VAbstractPiece(detail), d(detail.d) :VAbstractPiece(detail), d(detail.d)
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutDetail &VLayoutDetail::operator=(const VLayoutDetail &detail) VLayoutPiece &VLayoutPiece::operator=(const VLayoutPiece &detail)
{ {
if ( &detail == this ) if ( &detail == this )
{ {
@ -80,13 +80,13 @@ VLayoutDetail &VLayoutDetail::operator=(const VLayoutDetail &detail)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutDetail::~VLayoutDetail() VLayoutPiece::~VLayoutPiece()
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutDetail VLayoutDetail::Create(const VPiece &piece, const VContainer *pattern) VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern)
{ {
VLayoutDetail det = VLayoutDetail(); VLayoutPiece det = VLayoutPiece();
det.SetCountourPoints(piece.MainPathPoints(pattern)); det.SetCountourPoints(piece.MainPathPoints(pattern));
det.SetSeamAllowencePoints(piece.SeamAllowancePoints(pattern), piece.IsSeamAllowance()); det.SetSeamAllowencePoints(piece.SeamAllowancePoints(pattern), piece.IsSeamAllowance());
det.SetName(piece.GetName()); det.SetName(piece.GetName());
@ -120,26 +120,26 @@ VLayoutDetail VLayoutDetail::Create(const VPiece &piece, const VContainer *patte
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
QVector<QPointF> VLayoutDetail::GetContourPoints() const QVector<QPointF> VLayoutPiece::GetContourPoints() const
{ {
return Map(d->contour); return Map(d->contour);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutDetail::SetCountourPoints(const QVector<QPointF> &points) void VLayoutPiece::SetCountourPoints(const QVector<QPointF> &points)
{ {
d->contour = RemoveDublicates(RoundPoints(points)); d->contour = RemoveDublicates(RoundPoints(points));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
QVector<QPointF> VLayoutDetail::GetSeamAllowencePoints() const QVector<QPointF> VLayoutPiece::GetSeamAllowencePoints() const
{ {
return Map(d->seamAllowence); return Map(d->seamAllowence);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutDetail::SetSeamAllowencePoints(const QVector<QPointF> &points, bool seamAllowence) void VLayoutPiece::SetSeamAllowencePoints(const QVector<QPointF> &points, bool seamAllowence)
{ {
if (seamAllowence) if (seamAllowence)
{ {
@ -158,13 +158,13 @@ void VLayoutDetail::SetSeamAllowencePoints(const QVector<QPointF> &points, bool
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VLayoutDetail::GetLayoutAllowencePoints() const QVector<QPointF> VLayoutPiece::GetLayoutAllowencePoints() const
{ {
return Map(d->layoutAllowence); return Map(d->layoutAllowence);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutDetail::SetDetail(const QString& qsName, const VPatternPieceData& data, const QFont &font) void VLayoutPiece::SetDetail(const QString& qsName, const VPatternPieceData& data, const QFont &font)
{ {
d->detailData = data; d->detailData = data;
qreal dAng = qDegreesToRadians(data.GetRotation()); qreal dAng = qDegreesToRadians(data.GetRotation());
@ -190,7 +190,7 @@ void VLayoutDetail::SetDetail(const QString& qsName, const VPatternPieceData& da
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutDetail::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternInfoGeometry& geom, const QFont &font, void VLayoutPiece::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternInfoGeometry& geom, const QFont &font,
qreal dSize, qreal dHeight) qreal dSize, qreal dHeight)
{ {
d->patternGeom = geom; d->patternGeom = geom;
@ -219,7 +219,7 @@ void VLayoutDetail::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternI
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutDetail::SetGrainline(const VGrainlineGeometry& geom, const VContainer& rPattern) void VLayoutPiece::SetGrainline(const VGrainlineGeometry& geom, const VContainer& rPattern)
{ {
d->grainlineGeom = geom; d->grainlineGeom = geom;
qreal dAng; qreal dAng;
@ -286,31 +286,31 @@ void VLayoutDetail::SetGrainline(const VGrainlineGeometry& geom, const VContaine
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QTransform VLayoutDetail::GetMatrix() const QTransform VLayoutPiece::GetMatrix() const
{ {
return d->matrix; return d->matrix;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutDetail::SetMatrix(const QTransform &matrix) void VLayoutPiece::SetMatrix(const QTransform &matrix)
{ {
d->matrix = matrix; d->matrix = matrix;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
qreal VLayoutDetail::GetLayoutWidth() const qreal VLayoutPiece::GetLayoutWidth() const
{ {
return d->layoutWidth; return d->layoutWidth;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutDetail::SetLayoutWidth(const qreal &value) void VLayoutPiece::SetLayoutWidth(const qreal &value)
{ {
d->layoutWidth = value; d->layoutWidth = value;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutDetail::Translate(qreal dx, qreal dy) void VLayoutPiece::Translate(qreal dx, qreal dy)
{ {
QTransform m; QTransform m;
m.translate(dx, dy); m.translate(dx, dy);
@ -318,7 +318,7 @@ void VLayoutDetail::Translate(qreal dx, qreal dy)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutDetail::Rotate(const QPointF &originPoint, qreal degrees) void VLayoutPiece::Rotate(const QPointF &originPoint, qreal degrees)
{ {
QTransform m; QTransform m;
m.translate(originPoint.x(), originPoint.y()); m.translate(originPoint.x(), originPoint.y());
@ -328,7 +328,7 @@ void VLayoutDetail::Rotate(const QPointF &originPoint, qreal degrees)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutDetail::Mirror(const QLineF &edge) void VLayoutPiece::Mirror(const QLineF &edge)
{ {
if (edge.isNull()) if (edge.isNull())
{ {
@ -361,43 +361,43 @@ void VLayoutDetail::Mirror(const QLineF &edge)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VLayoutDetail::DetailEdgesCount() const int VLayoutPiece::DetailEdgesCount() const
{ {
return DetailPath().count(); return DetailPath().count();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VLayoutDetail::LayoutEdgesCount() const int VLayoutPiece::LayoutEdgesCount() const
{ {
return d->layoutAllowence.count(); return d->layoutAllowence.count();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QLineF VLayoutDetail::DetailEdge(int i) const QLineF VLayoutPiece::DetailEdge(int i) const
{ {
return Edge(DetailPath(), i); return Edge(DetailPath(), i);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QLineF VLayoutDetail::LayoutEdge(int i) const QLineF VLayoutPiece::LayoutEdge(int i) const
{ {
return Edge(d->layoutAllowence, i); return Edge(d->layoutAllowence, i);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VLayoutDetail::DetailEdgeByPoint(const QPointF &p1) const int VLayoutPiece::DetailEdgeByPoint(const QPointF &p1) const
{ {
return EdgeByPoint(DetailPath(), p1); return EdgeByPoint(DetailPath(), p1);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VLayoutDetail::LayoutEdgeByPoint(const QPointF &p1) const int VLayoutPiece::LayoutEdgeByPoint(const QPointF &p1) const
{ {
return EdgeByPoint(d->layoutAllowence, p1); return EdgeByPoint(d->layoutAllowence, p1);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QRectF VLayoutDetail::DetailBoundingRect() const QRectF VLayoutPiece::DetailBoundingRect() const
{ {
QVector<QPointF> points; QVector<QPointF> points;
if (IsSeamAllowance()) if (IsSeamAllowance())
@ -414,7 +414,7 @@ QRectF VLayoutDetail::DetailBoundingRect() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QRectF VLayoutDetail::LayoutBoundingRect() const QRectF VLayoutPiece::LayoutBoundingRect() const
{ {
QVector<QPointF> points = GetLayoutAllowencePoints(); QVector<QPointF> points = GetLayoutAllowencePoints();
points.append(points.first()); points.append(points.first());
@ -422,14 +422,14 @@ QRectF VLayoutDetail::LayoutBoundingRect() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
qreal VLayoutDetail::Diagonal() const qreal VLayoutPiece::Diagonal() const
{ {
const QRectF rec = LayoutBoundingRect(); const QRectF rec = LayoutBoundingRect();
return qSqrt(pow(rec.height(), 2) + pow(rec.width(), 2)); return qSqrt(pow(rec.height(), 2) + pow(rec.width(), 2));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VLayoutDetail::isNull() const bool VLayoutPiece::isNull() const
{ {
if (d->contour.isEmpty() == false && d->layoutWidth > 0) if (d->contour.isEmpty() == false && d->layoutWidth > 0)
{ {
@ -449,7 +449,7 @@ bool VLayoutDetail::isNull() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
qint64 VLayoutDetail::Square() const qint64 VLayoutPiece::Square() const
{ {
if (d->layoutAllowence.isEmpty()) //-V807 if (d->layoutAllowence.isEmpty()) //-V807
{ {
@ -463,7 +463,7 @@ qint64 VLayoutDetail::Square() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutDetail::SetLayoutAllowencePoints() void VLayoutPiece::SetLayoutAllowencePoints()
{ {
if (d->layoutWidth > 0) if (d->layoutWidth > 0)
{ {
@ -499,7 +499,7 @@ void VLayoutDetail::SetLayoutAllowencePoints()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VLayoutDetail::Map(const QVector<QPointF> &points) const QVector<QPointF> VLayoutPiece::Map(const QVector<QPointF> &points) const
{ {
QVector<QPointF> p; QVector<QPointF> p;
for (int i = 0; i < points.size(); ++i) for (int i = 0; i < points.size(); ++i)
@ -520,7 +520,7 @@ QVector<QPointF> VLayoutDetail::Map(const QVector<QPointF> &points) const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VLayoutDetail::RoundPoints(const QVector<QPointF> &points) QVector<QPointF> VLayoutPiece::RoundPoints(const QVector<QPointF> &points)
{ {
QVector<QPointF> p; QVector<QPointF> p;
for (int i=0; i < points.size(); ++i) for (int i=0; i < points.size(); ++i)
@ -531,7 +531,7 @@ QVector<QPointF> VLayoutDetail::RoundPoints(const QVector<QPointF> &points)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QPainterPath VLayoutDetail::ContourPath() const QPainterPath VLayoutPiece::ContourPath() const
{ {
QPainterPath path; QPainterPath path;
@ -569,13 +569,13 @@ QPainterPath VLayoutDetail::ContourPath() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutDetail::ClearTextItems() void VLayoutPiece::ClearTextItems()
{ {
d->m_liPP.clear(); d->m_liPP.clear();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutDetail::CreateTextItems() void VLayoutPiece::CreateTextItems()
{ {
ClearTextItems(); ClearTextItems();
// first add detail texts // first add detail texts
@ -696,7 +696,7 @@ void VLayoutDetail::CreateTextItems()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VLayoutDetail::GetTextItemsCount() const int VLayoutPiece::GetTextItemsCount() const
{ {
return d->m_liPP.count(); return d->m_liPP.count();
} }
@ -707,7 +707,7 @@ int VLayoutDetail::GetTextItemsCount() const
* @param i index of the requested item * @param i index of the requested item
* @return pointer to the newly created item. The caller is responsible to delete it. * @return pointer to the newly created item. The caller is responsible to delete it.
*/ */
QGraphicsItem* VLayoutDetail::GetTextItem(int i) const QGraphicsItem* VLayoutPiece::GetTextItem(int i) const
{ {
QGraphicsPathItem* item = new QGraphicsPathItem(); QGraphicsPathItem* item = new QGraphicsPathItem();
QTransform transform = d->matrix; QTransform transform = d->matrix;
@ -751,7 +751,7 @@ QGraphicsItem* VLayoutDetail::GetTextItem(int i) const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QPainterPath VLayoutDetail::LayoutAllowencePath() const QPainterPath VLayoutPiece::LayoutAllowencePath() const
{ {
QPainterPath path; QPainterPath path;
path.setFillRule(Qt::WindingFill); path.setFillRule(Qt::WindingFill);
@ -768,7 +768,7 @@ QPainterPath VLayoutDetail::LayoutAllowencePath() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGraphicsItem *VLayoutDetail::GetItem() const QGraphicsItem *VLayoutPiece::GetItem() const
{ {
QGraphicsPathItem *item = new QGraphicsPathItem(); QGraphicsPathItem *item = new QGraphicsPathItem();
item->setPath(ContourPath()); item->setPath(ContourPath());
@ -776,7 +776,7 @@ QGraphicsItem *VLayoutDetail::GetItem() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGraphicsItem* VLayoutDetail::GetGrainlineItem() const QGraphicsItem* VLayoutPiece::GetGrainlineItem() const
{ {
if (d->grainlinePoints.count() < 2) if (d->grainlinePoints.count() < 2)
{ {
@ -795,7 +795,7 @@ QGraphicsItem* VLayoutDetail::GetGrainlineItem() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VLayoutDetail::DetailPath() const QVector<QPointF> VLayoutPiece::DetailPath() const
{ {
if (IsSeamAllowance()) if (IsSeamAllowance())
{ {
@ -808,7 +808,7 @@ QVector<QPointF> VLayoutDetail::DetailPath() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QVector<VSAPoint> VLayoutDetail::PrepareAllowance(const QVector<QPointF> &points) QVector<VSAPoint> VLayoutPiece::PrepareAllowance(const QVector<QPointF> &points)
{ {
QVector<VSAPoint> allowancePoints; QVector<VSAPoint> allowancePoints;
for(int i = 0; i < points.size(); +i) for(int i = 0; i < points.size(); +i)
@ -819,13 +819,13 @@ QVector<VSAPoint> VLayoutDetail::PrepareAllowance(const QVector<QPointF> &points
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VLayoutDetail::IsMirror() const bool VLayoutPiece::IsMirror() const
{ {
return d->mirror; return d->mirror;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutDetail::SetMirror(bool value) void VLayoutPiece::SetMirror(bool value)
{ {
d->mirror = value; d->mirror = value;
} }
@ -838,7 +838,7 @@ void VLayoutDetail::SetMirror(bool value)
* @param dAng angle of rotation * @param dAng angle of rotation
* @return position of point pt after rotating it around the center for dAng radians * @return position of point pt after rotating it around the center for dAng radians
*/ */
QPointF VLayoutDetail::RotatePoint(const QPointF &ptCenter, const QPointF& pt, qreal dAng) QPointF VLayoutPiece::RotatePoint(const QPointF &ptCenter, const QPointF& pt, qreal dAng)
{ {
QPointF ptDest; QPointF ptDest;
QPointF ptRel = pt - ptCenter; QPointF ptRel = pt - ptCenter;
@ -855,7 +855,7 @@ QPointF VLayoutDetail::RotatePoint(const QPointF &ptCenter, const QPointF& pt, q
* @param points list of 4 label vertices * @param points list of 4 label vertices
* @return list of flipped points * @return list of flipped points
*/ */
QVector<QPointF> VLayoutDetail::Mirror(const QVector<QPointF> &points) const QVector<QPointF> VLayoutPiece::Mirror(const QVector<QPointF> &points) const
{ {
// should only call this method with rectangular shapes // should only call this method with rectangular shapes
Q_ASSERT(points.count() == 4); Q_ASSERT(points.count() == 4);
@ -880,7 +880,7 @@ QVector<QPointF> VLayoutDetail::Mirror(const QVector<QPointF> &points) const
* @param pt2 second point * @param pt2 second point
* @return Euclidian distance between the two points * @return Euclidian distance between the two points
*/ */
qreal VLayoutDetail::GetDistance(const QPointF &pt1, const QPointF &pt2) qreal VLayoutPiece::GetDistance(const QPointF &pt1, const QPointF &pt2)
{ {
const qreal dX = pt1.x() - pt2.x(); const qreal dX = pt1.x() - pt2.x();
const qreal dY = pt1.y() - pt2.y(); const qreal dY = pt1.y() - pt2.y();
@ -889,7 +889,7 @@ qreal VLayoutDetail::GetDistance(const QPointF &pt1, const QPointF &pt2)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QLineF VLayoutDetail::Edge(const QVector<QPointF> &path, int i) const QLineF VLayoutPiece::Edge(const QVector<QPointF> &path, int i) const
{ {
if (i < 1 || i > path.count()) if (i < 1 || i > path.count())
{ // Doesn't exist such edge { // Doesn't exist such edge
@ -923,7 +923,7 @@ QLineF VLayoutDetail::Edge(const QVector<QPointF> &path, int i) const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VLayoutDetail::EdgeByPoint(const QVector<QPointF> &path, const QPointF &p1) const int VLayoutPiece::EdgeByPoint(const QVector<QPointF> &path, const QPointF &p1) const
{ {
if (p1.isNull()) if (p1.isNull())
{ {

View File

@ -55,20 +55,20 @@ class QPointF;
class QRectF; class QRectF;
class QTransform; class QTransform;
class VAbstractPattern; class VAbstractPattern;
class VLayoutDetailData; class VLayoutPieceData;
class VPatternInfoGeometry; class VPatternInfoGeometry;
class VPatternPieceData; class VPatternPieceData;
class VGrainlineGeometry; class VGrainlineGeometry;
class VLayoutDetail :public VAbstractPiece class VLayoutPiece :public VAbstractPiece
{ {
public: public:
VLayoutDetail(); VLayoutPiece();
VLayoutDetail(const VLayoutDetail &detail); VLayoutPiece(const VLayoutPiece &detail);
VLayoutDetail &operator=(const VLayoutDetail &detail); VLayoutPiece &operator=(const VLayoutPiece &detail);
virtual ~VLayoutDetail() Q_DECL_OVERRIDE; virtual ~VLayoutPiece() Q_DECL_OVERRIDE;
static VLayoutDetail Create(const VPiece &piece, const VContainer *pattern); static VLayoutPiece Create(const VPiece &piece, const VContainer *pattern);
QVector<QPointF> GetContourPoints() const; QVector<QPointF> GetContourPoints() const;
void SetCountourPoints(const QVector<QPointF> &points); void SetCountourPoints(const QVector<QPointF> &points);
@ -124,7 +124,7 @@ public:
QGraphicsItem* GetGrainlineItem() const Q_REQUIRED_RESULT; QGraphicsItem* GetGrainlineItem() const Q_REQUIRED_RESULT;
private: private:
QSharedDataPointer<VLayoutDetailData> d; QSharedDataPointer<VLayoutPieceData> d;
QVector<QPointF> DetailPath() const; QVector<QPointF> DetailPath() const;
@ -140,6 +140,6 @@ private:
int EdgeByPoint(const QVector<QPointF> &path, const QPointF &p1) const; int EdgeByPoint(const QVector<QPointF> &path, const QPointF &p1) const;
}; };
Q_DECLARE_TYPEINFO(VLayoutDetail, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(VLayoutPiece, Q_MOVABLE_TYPE);
#endif // VLAYOUTDETAIL_H #endif // VLAYOUTDETAIL_H

View File

@ -43,17 +43,17 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
class VLayoutDetailData : public QSharedData class VLayoutPieceData : public QSharedData
{ {
public: public:
VLayoutDetailData() VLayoutPieceData()
:contour(QVector<QPointF>()), seamAllowence(QVector<QPointF>()), layoutAllowence(QVector<QPointF>()), :contour(QVector<QPointF>()), seamAllowence(QVector<QPointF>()), layoutAllowence(QVector<QPointF>()),
matrix(QMatrix()), layoutWidth(0), mirror(false), detailLabel(QVector<QPointF>()), matrix(QMatrix()), layoutWidth(0), mirror(false), detailLabel(QVector<QPointF>()),
patternInfo(QVector<QPointF>()), grainlinePoints(QVector<QPointF>()), detailData(), patternGeom(), patternInfo(QVector<QPointF>()), grainlinePoints(QVector<QPointF>()), detailData(), patternGeom(),
grainlineGeom(), m_tmDetail(), m_tmPattern(), m_liPP(QList<QPainterPath>()) grainlineGeom(), m_tmDetail(), m_tmPattern(), m_liPP(QList<QPainterPath>())
{} {}
VLayoutDetailData(const VLayoutDetailData &detail) VLayoutPieceData(const VLayoutPieceData &detail)
:QSharedData(detail), contour(detail.contour), seamAllowence(detail.seamAllowence), :QSharedData(detail), contour(detail.contour), seamAllowence(detail.seamAllowence),
layoutAllowence(detail.layoutAllowence), matrix(detail.matrix), layoutAllowence(detail.layoutAllowence), matrix(detail.matrix),
layoutWidth(detail.layoutWidth), mirror(detail.mirror), detailLabel(detail.detailLabel), layoutWidth(detail.layoutWidth), mirror(detail.mirror), detailLabel(detail.detailLabel),
@ -62,7 +62,7 @@ public:
m_tmPattern(detail.m_tmPattern), m_liPP(detail.m_liPP) m_tmPattern(detail.m_tmPattern), m_liPP(detail.m_liPP)
{} {}
~VLayoutDetailData() {} ~VLayoutPieceData() {}
/** @brief contour list of contour points. */ /** @brief contour list of contour points. */
QVector<QPointF> contour; QVector<QPointF> contour;
@ -101,7 +101,7 @@ public:
QList<QPainterPath> m_liPP; QList<QPainterPath> m_liPP;
private: private:
VLayoutDetailData &operator=(const VLayoutDetailData &) Q_DECL_EQ_DELETE; VLayoutPieceData &operator=(const VLayoutPieceData &) Q_DECL_EQ_DELETE;
}; };
QT_WARNING_POP QT_WARNING_POP

View File

@ -50,10 +50,10 @@
#include "../vmisc/vmath.h" #include "../vmisc/vmath.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPosition::VPosition(const VContour &gContour, int j, const VLayoutDetail &detail, int i, volatile bool *stop, VPosition::VPosition(const VContour &gContour, int j, const VLayoutPiece &detail, int i, volatile bool *stop,
bool rotate, int rotationIncrease, bool saveLength) bool rotate, int rotationIncrease, bool saveLength)
:QRunnable(), bestResult(VBestSquare(gContour.GetSize(), saveLength)), gContour(gContour), detail(detail), i(i), :QRunnable(), bestResult(VBestSquare(gContour.GetSize(), saveLength)), gContour(gContour), detail(detail), i(i),
j(j), paperIndex(0), frame(0), detailsCount(0), details(QVector<VLayoutDetail>()), stop(stop), rotate(rotate), j(j), paperIndex(0), frame(0), detailsCount(0), details(QVector<VLayoutPiece>()), stop(stop), rotate(rotate),
rotationIncrease(rotationIncrease), angle_between(0) rotationIncrease(rotationIncrease), angle_between(0)
{ {
if ((rotationIncrease >= 1 && rotationIncrease <= 180 && 360 % rotationIncrease == 0) == false) if ((rotationIncrease >= 1 && rotationIncrease <= 180 && 360 % rotationIncrease == 0) == false)
@ -71,7 +71,7 @@ void VPosition::run()
} }
// We should use copy of the detail. // We should use copy of the detail.
VLayoutDetail workDetail = detail; VLayoutPiece workDetail = detail;
int dEdge = i;// For mirror detail edge will be different int dEdge = i;// For mirror detail edge will be different
if (CheckCombineEdges(workDetail, j, dEdge)) if (CheckCombineEdges(workDetail, j, dEdge))
@ -139,7 +139,7 @@ void VPosition::setDetailsCount(const quint32 &value)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPosition::setDetails(const QVector<VLayoutDetail> &details) void VPosition::setDetails(const QVector<VLayoutPiece> &details)
{ {
this->details = details; this->details = details;
} }
@ -151,8 +151,8 @@ VBestSquare VPosition::getBestResult() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPosition::DrawDebug(const VContour &contour, const VLayoutDetail &detail, int frame, quint32 paperIndex, void VPosition::DrawDebug(const VContour &contour, const VLayoutPiece &detail, int frame, quint32 paperIndex,
int detailsCount, const QVector<VLayoutDetail> &details) int detailsCount, const QVector<VLayoutPiece> &details)
{ {
const int biasWidth = Bias(contour.GetWidth(), QIMAGE_MAX); const int biasWidth = Bias(contour.GetWidth(), QIMAGE_MAX);
const int biasHeight = Bias(contour.GetHeight(), QIMAGE_MAX); const int biasHeight = Bias(contour.GetHeight(), QIMAGE_MAX);
@ -242,7 +242,7 @@ int VPosition::Bias(int length, int maxLength)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPosition::SaveCandidate(VBestSquare &bestResult, const VLayoutDetail &detail, int globalI, int detJ, void VPosition::SaveCandidate(VBestSquare &bestResult, const VLayoutPiece &detail, int globalI, int detJ,
BestFrom type) BestFrom type)
{ {
QVector<QPointF> newGContour = gContour.UniteWithContour(detail, globalI, detJ, type); QVector<QPointF> newGContour = gContour.UniteWithContour(detail, globalI, detJ, type);
@ -252,7 +252,7 @@ void VPosition::SaveCandidate(VBestSquare &bestResult, const VLayoutDetail &deta
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VPosition::CheckCombineEdges(VLayoutDetail &detail, int j, int &dEdge) bool VPosition::CheckCombineEdges(VLayoutPiece &detail, int j, int &dEdge)
{ {
const QLineF globalEdge = gContour.GlobalEdge(j); const QLineF globalEdge = gContour.GlobalEdge(j);
bool flagMirror = false; bool flagMirror = false;
@ -340,7 +340,7 @@ bool VPosition::CheckCombineEdges(VLayoutDetail &detail, int j, int &dEdge)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VPosition::CheckRotationEdges(VLayoutDetail &detail, int j, int dEdge, int angle) const bool VPosition::CheckRotationEdges(VLayoutPiece &detail, int j, int dEdge, int angle) const
{ {
const QLineF globalEdge = gContour.GlobalEdge(j); const QLineF globalEdge = gContour.GlobalEdge(j);
bool flagSquare = false; bool flagSquare = false;
@ -376,7 +376,7 @@ bool VPosition::CheckRotationEdges(VLayoutDetail &detail, int j, int dEdge, int
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPosition::CrossingType VPosition::Crossing(const VLayoutDetail &detail) const VPosition::CrossingType VPosition::Crossing(const VLayoutPiece &detail) const
{ {
const QRectF gRect = gContour.BoundingRect(); const QRectF gRect = gContour.BoundingRect();
if (not gRect.intersects(detail.LayoutBoundingRect()) && not gRect.contains(detail.DetailBoundingRect())) if (not gRect.intersects(detail.LayoutBoundingRect()) && not gRect.contains(detail.DetailBoundingRect()))
@ -404,7 +404,7 @@ bool VPosition::SheetContains(const QRectF &rect) const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPosition::CombineEdges(VLayoutDetail &detail, const QLineF &globalEdge, const int &dEdge) void VPosition::CombineEdges(VLayoutPiece &detail, const QLineF &globalEdge, const int &dEdge)
{ {
QLineF detailEdge; QLineF detailEdge;
if (gContour.GetContour().isEmpty()) if (gContour.GetContour().isEmpty())
@ -433,7 +433,7 @@ void VPosition::CombineEdges(VLayoutDetail &detail, const QLineF &globalEdge, co
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPosition::RotateEdges(VLayoutDetail &detail, const QLineF &globalEdge, int dEdge, int angle) const void VPosition::RotateEdges(VLayoutPiece &detail, const QLineF &globalEdge, int dEdge, int angle) const
{ {
QLineF detailEdge; QLineF detailEdge;
if (gContour.GetContour().isEmpty()) if (gContour.GetContour().isEmpty())
@ -472,7 +472,7 @@ void VPosition::Rotate(int increase)
} }
// We should use copy of the detail. // We should use copy of the detail.
VLayoutDetail workDetail = detail; VLayoutPiece workDetail = detail;
if (CheckRotationEdges(workDetail, j, i, angle)) if (CheckRotationEdges(workDetail, j, i, angle))
{ {
@ -549,7 +549,7 @@ QPainterPath VPosition::DrawContour(const QVector<QPointF> &points)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QPainterPath VPosition::DrawDetails(const QVector<VLayoutDetail> &details) QPainterPath VPosition::DrawDetails(const QVector<VLayoutPiece> &details)
{ {
QPainterPath path; QPainterPath path;
path.setFillRule(Qt::WindingFill); path.setFillRule(Qt::WindingFill);

View File

@ -37,7 +37,7 @@
#include "vbestsquare.h" #include "vbestsquare.h"
#include "vcontour.h" #include "vcontour.h"
#include "vlayoutdef.h" #include "vlayoutdef.h"
#include "vlayoutdetail.h" #include "vlayoutpiece.h"
class QLineF; class QLineF;
class QPainterPath; class QPainterPath;
@ -48,7 +48,7 @@ class QRectF;
class VPosition : public QRunnable class VPosition : public QRunnable
{ {
public: public:
VPosition(const VContour &gContour, int j, const VLayoutDetail &detail, int i, volatile bool *stop, bool rotate, VPosition(const VContour &gContour, int j, const VLayoutPiece &detail, int i, volatile bool *stop, bool rotate,
int rotationIncrease, bool saveLength); int rotationIncrease, bool saveLength);
virtual ~VPosition() Q_DECL_OVERRIDE{} virtual ~VPosition() Q_DECL_OVERRIDE{}
@ -61,12 +61,12 @@ public:
quint32 getDetailsCount() const; quint32 getDetailsCount() const;
void setDetailsCount(const quint32 &value); void setDetailsCount(const quint32 &value);
void setDetails(const QVector<VLayoutDetail> &details); void setDetails(const QVector<VLayoutPiece> &details);
VBestSquare getBestResult() const; VBestSquare getBestResult() const;
static void DrawDebug(const VContour &contour, const VLayoutDetail &detail, int frame, quint32 paperIndex, static void DrawDebug(const VContour &contour, const VLayoutPiece &detail, int frame, quint32 paperIndex,
int detailsCount, const QVector<VLayoutDetail> &details = QVector<VLayoutDetail>()); int detailsCount, const QVector<VLayoutPiece> &details = QVector<VLayoutPiece>());
static int Bias(int length, int maxLength); static int Bias(int length, int maxLength);
@ -74,13 +74,13 @@ private:
Q_DISABLE_COPY(VPosition) Q_DISABLE_COPY(VPosition)
VBestSquare bestResult; VBestSquare bestResult;
const VContour gContour; const VContour gContour;
const VLayoutDetail detail; const VLayoutPiece detail;
int i; int i;
int j; int j;
quint32 paperIndex; quint32 paperIndex;
quint32 frame; quint32 frame;
quint32 detailsCount; quint32 detailsCount;
QVector<VLayoutDetail> details; QVector<VLayoutPiece> details;
volatile bool *stop; volatile bool *stop;
bool rotate; bool rotate;
int rotationIncrease; int rotationIncrease;
@ -105,20 +105,20 @@ private:
virtual void run() Q_DECL_OVERRIDE; virtual void run() Q_DECL_OVERRIDE;
void SaveCandidate(VBestSquare &bestResult, const VLayoutDetail &detail, int globalI, int detJ, BestFrom type); void SaveCandidate(VBestSquare &bestResult, const VLayoutPiece &detail, int globalI, int detJ, BestFrom type);
bool CheckCombineEdges(VLayoutDetail &detail, int j, int &dEdge); bool CheckCombineEdges(VLayoutPiece &detail, int j, int &dEdge);
bool CheckRotationEdges(VLayoutDetail &detail, int j, int dEdge, int angle) const; bool CheckRotationEdges(VLayoutPiece &detail, int j, int dEdge, int angle) const;
CrossingType Crossing(const VLayoutDetail &detail) const; CrossingType Crossing(const VLayoutPiece &detail) const;
bool SheetContains(const QRectF &rect) const; bool SheetContains(const QRectF &rect) const;
void CombineEdges(VLayoutDetail &detail, const QLineF &globalEdge, const int &dEdge); void CombineEdges(VLayoutPiece &detail, const QLineF &globalEdge, const int &dEdge);
void RotateEdges(VLayoutDetail &detail, const QLineF &globalEdge, int dEdge, int angle) const; void RotateEdges(VLayoutPiece &detail, const QLineF &globalEdge, int dEdge, int angle) const;
static QPainterPath ShowDirection(const QLineF &edge); static QPainterPath ShowDirection(const QLineF &edge);
static QPainterPath DrawContour(const QVector<QPointF> &points); static QPainterPath DrawContour(const QVector<QPointF> &points);
static QPainterPath DrawDetails(const QVector<VLayoutDetail> &details); static QPainterPath DrawDetails(const QVector<VLayoutPiece> &details);
void Rotate(int increase); void Rotate(int increase);
}; };

View File

@ -27,7 +27,7 @@
*************************************************************************/ *************************************************************************/
#include "tst_vlayoutdetail.h" #include "tst_vlayoutdetail.h"
#include "../vlayout/vlayoutdetail.h" #include "../vlayout/vlayoutpiece.h"
#include <QtDebug> #include <QtDebug>
@ -56,7 +56,7 @@ void TST_VLayoutDetail::Case1() const
// See issue #304. Layout appears different than my pattern. // See issue #304. Layout appears different than my pattern.
// https://bitbucket.org/dismine/valentina/issue/304/layout-appears-different-than-my-pattern // https://bitbucket.org/dismine/valentina/issue/304/layout-appears-different-than-my-pattern
VLayoutDetail det = VLayoutDetail(); VLayoutPiece det = VLayoutPiece();
det.SetCountourPoints(InputPointsCase1()); det.SetCountourPoints(InputPointsCase1());
// Begin comparison // Begin comparison
@ -118,7 +118,7 @@ QVector<QPointF> TST_VLayoutDetail::OutputPointsCase1() const //-V524
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TST_VLayoutDetail::Case2() const void TST_VLayoutDetail::Case2() const
{ {
VLayoutDetail det = VLayoutDetail(); VLayoutPiece det = VLayoutPiece();
det.SetCountourPoints(InputPointsCase2()); det.SetCountourPoints(InputPointsCase2());
// Begin comparison // Begin comparison
@ -159,7 +159,7 @@ QVector<QPointF> TST_VLayoutDetail::OutputPointsCase2() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TST_VLayoutDetail::Case3() const void TST_VLayoutDetail::Case3() const
{ {
VLayoutDetail det = VLayoutDetail(); VLayoutPiece det = VLayoutPiece();
det.SetCountourPoints(InputPointsCase3()); det.SetCountourPoints(InputPointsCase3());
// Begin comparison // Begin comparison