From 007bc1466fa1c05ae7032ea1d792b0f7c27bb58f Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 10 Jan 2015 15:47:46 +0200 Subject: [PATCH] Layout paper. Main algorithm. --HG-- branch : feature --- src/libs/vlayout/vlayout.pri | 7 +- src/libs/vlayout/vlayoutdetail.cpp | 95 ++++- src/libs/vlayout/vlayoutdetail.h | 8 +- src/libs/vlayout/vlayoutpaper.cpp | 564 +++++++++++++++++++++++++++++ src/libs/vlayout/vlayoutpaper.h | 91 +++++ src/libs/vlayout/vlayoutpaper_p.h | 78 ++++ 6 files changed, 830 insertions(+), 13 deletions(-) create mode 100644 src/libs/vlayout/vlayoutpaper.cpp create mode 100644 src/libs/vlayout/vlayoutpaper.h create mode 100644 src/libs/vlayout/vlayoutpaper_p.h diff --git a/src/libs/vlayout/vlayout.pri b/src/libs/vlayout/vlayout.pri index c7ab13fdd..fe1d8e5ae 100644 --- a/src/libs/vlayout/vlayout.pri +++ b/src/libs/vlayout/vlayout.pri @@ -8,10 +8,13 @@ HEADERS += \ $$PWD/vabstractdetail.h \ $$PWD/vabstractdetail_p.h \ $$PWD/vlayoutdetail_p.h \ - $$PWD/vlayoutdef.h + $$PWD/vlayoutdef.h \ + $$PWD/vlayoutpaper.h \ + vlayoutpaper_p.h SOURCES += \ $$PWD/stable.cpp \ $$PWD/vlayoutgenerator.cpp \ $$PWD/vlayoutdetail.cpp \ - $$PWD/vabstractdetail.cpp + $$PWD/vabstractdetail.cpp \ + $$PWD/vlayoutpaper.cpp diff --git a/src/libs/vlayout/vlayoutdetail.cpp b/src/libs/vlayout/vlayoutdetail.cpp index 1e0c2dcd4..74d3a3b80 100644 --- a/src/libs/vlayout/vlayoutdetail.cpp +++ b/src/libs/vlayout/vlayoutdetail.cpp @@ -65,6 +65,11 @@ QVector VLayoutDetail::GetContour() const void VLayoutDetail::SetCountour(const QVector &points) { d->contour = points; + // Contour can't be closed + if (d->contour.first() == d->contour.last()) + { + d->contour.removeLast(); + } } //--------------------------------------------------------------------------------------------------------------------- @@ -77,6 +82,11 @@ QVector VLayoutDetail::GetSeamAllowencePoints() const void VLayoutDetail::SetSeamAllowencePoints(const QVector &points) { d->seamAllowence = points; + // Seam allowence can't be closed + if (d->seamAllowence.first() == d->seamAllowence.last()) + { + d->seamAllowence.removeLast(); + } } //--------------------------------------------------------------------------------------------------------------------- @@ -110,23 +120,39 @@ void VLayoutDetail::SetLayoutWidth(const qreal &value) } //--------------------------------------------------------------------------------------------------------------------- -void VLayoutDetail::translate(qreal dx, qreal dy) +void VLayoutDetail::Translate(qreal dx, qreal dy) { - const QMatrix m = d->matrix.translate(dx, dy); - d->matrix = m; + d->matrix = d->matrix.translate(dx, dy); } //--------------------------------------------------------------------------------------------------------------------- -void VLayoutDetail::rotate(qreal degrees) +void VLayoutDetail::Rotate(const QPointF &originPoint, qreal degrees) { - const QMatrix m = d->matrix.rotate(degrees); - d->matrix = m; + Translate(-originPoint.x(), -originPoint.y()); + d->matrix = d->matrix.rotate(degrees); + Translate(originPoint.x(), originPoint.y()); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VLayoutDetail::Mirror(const QLineF &edge) +{ + if (edge.isNull()) + { + return; + } + + QLineF axis = QLineF(edge.x1(), edge.y1(), 100, edge.y2()); // Ox axis + + qreal angle = edge.angleTo(axis); + Rotate(edge.p1(), angle); + d->matrix = d->matrix.scale(d->matrix.m11()*-1, d->matrix.m22()); + Rotate(edge.p1(), 360 - angle); } //--------------------------------------------------------------------------------------------------------------------- int VLayoutDetail::EdgesCount() const { - return d->layoutAllowence.count()-1; + return d->layoutAllowence.count(); } //--------------------------------------------------------------------------------------------------------------------- @@ -136,8 +162,49 @@ QLineF VLayoutDetail::Edge(int i) const { // Doesn't exist such edge return QLineF(); } - const QLineF line(d->layoutAllowence.at(i-1), d->layoutAllowence.at(i)); - return line; + const QVector points = GetLayoutAllowence(); + QLineF edge; + if (i < EdgesCount()) + { + edge = QLineF(points.at(i-1), points.at(i)); + } + else + { + edge = QLineF(points.at(EdgesCount()-1), points.at(0)); + } + return edge; +} + +//--------------------------------------------------------------------------------------------------------------------- +int VLayoutDetail::EdgeByPoint(const QPointF &p1) const +{ + if (p1.isNull()) + { + return 0; + } + + if (EdgesCount() < 3) + { + return 0; + } + + const QVector points = GetLayoutAllowence(); + for (int i=0; i< points.size(); i++) + { + if (points.at(i) == p1) + { + return i+1; + } + } + return 0; // Did not find edge +} + +//--------------------------------------------------------------------------------------------------------------------- +QRectF VLayoutDetail::BoundingRect() const +{ + QVector points = GetLayoutAllowence(); + points.append(points.first()); + return QPolygonF(points).boundingRect(); } //--------------------------------------------------------------------------------------------------------------------- @@ -168,5 +235,15 @@ QVector VLayoutDetail::Map(const QVector &points) const { p.append(d->matrix.map(points.at(i))); } + + if (d->matrix.m11() < 0) + { + QList list = p.toList(); + for(int k=0, s=list.size(), max=(s/2); k d; diff --git a/src/libs/vlayout/vlayoutpaper.cpp b/src/libs/vlayout/vlayoutpaper.cpp new file mode 100644 index 000000000..d3d7cd962 --- /dev/null +++ b/src/libs/vlayout/vlayoutpaper.cpp @@ -0,0 +1,564 @@ +/************************************************************************ + ** + ** @file vlayoutpaper.cpp + ** @author Roman Telezhynskyi + ** @date 7 1, 2015 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "vlayoutpaper.h" +#include "vlayoutpaper_p.h" + +#include +#include + +class BestResult +{ +public: + BestResult(); + + void NewResult(qint64 square, int i, int j, const QMatrix &matrix); + + qint64 BestSquare() const; + int GContourEdge() const; + int DetailEdge() const; + QMatrix Matrix() const; + bool ValideResult() const; + +private: + // All nedded information about best result + int resI; // Edge of global contour + int resJ; // Edge of detail + QMatrix resMatrix; // Matrix for rotation and translation detail + qint64 resSquare; // Best square size (least). For begin set max value. + bool valideResult; +}; + +//===================================================BestResult======================================================== +//--------------------------------------------------------------------------------------------------------------------- +BestResult::BestResult() + :resI(0), resJ(0), resMatrix(QMatrix()), resSquare(LLONG_MAX),valideResult(false) +{} + +//--------------------------------------------------------------------------------------------------------------------- +void BestResult::NewResult(qint64 square, int i, int j, const QMatrix &matrix) +{ + if (square <= resSquare && square > 0) + { + resI = i; + resJ = j; + resMatrix = matrix; + resSquare = square; + valideResult = true; + } +} + +//--------------------------------------------------------------------------------------------------------------------- +qint64 BestResult::BestSquare() const +{ + return resSquare; +} + +//--------------------------------------------------------------------------------------------------------------------- +int BestResult::GContourEdge() const +{ + return resI; +} + +//--------------------------------------------------------------------------------------------------------------------- +int BestResult::DetailEdge() const +{ + return resJ; +} + +//--------------------------------------------------------------------------------------------------------------------- +QMatrix BestResult::Matrix() const +{ + return resMatrix; +} + +//--------------------------------------------------------------------------------------------------------------------- +bool BestResult::ValideResult() const +{ + return valideResult; +} + +//===================================================VLayoutPaper====================================================== +//--------------------------------------------------------------------------------------------------------------------- +VLayoutPaper::VLayoutPaper() + :d(new VLayoutPaperData) +{} + +//--------------------------------------------------------------------------------------------------------------------- +VLayoutPaper::VLayoutPaper(int height, int width) + :d(new VLayoutPaperData(height, width)) +{} + +//--------------------------------------------------------------------------------------------------------------------- +VLayoutPaper::VLayoutPaper(const VLayoutPaper &paper) + :d (paper.d) +{} + +//--------------------------------------------------------------------------------------------------------------------- +VLayoutPaper &VLayoutPaper::operator=(const VLayoutPaper &paper) +{ + if ( &paper == this ) + { + return *this; + } + d = paper.d; + return *this; +} + +//--------------------------------------------------------------------------------------------------------------------- +VLayoutPaper::~VLayoutPaper() +{} + +//--------------------------------------------------------------------------------------------------------------------- +int VLayoutPaper::GetHeight() const +{ + return d->paperHeight; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VLayoutPaper::SetHeight(int height) +{ + d->paperHeight = height; +} + +//--------------------------------------------------------------------------------------------------------------------- +int VLayoutPaper::GetWidth() const +{ + return d->paperWidth; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VLayoutPaper::SetWidth(int width) +{ + d->paperWidth = width; +} + +//--------------------------------------------------------------------------------------------------------------------- +bool VLayoutPaper::ArrangeDetail(const VLayoutDetail &detail) +{ + // First need set size of paper + if (d->paperHeight <= 0 || d->paperWidth <= 0) + { + return false; + } + + if (detail.EdgesCount() < 3) + { + return false;//Not enough edges + } + + if (Count() == 0) + { + return AddToBlankSheet(detail); + } + else + { + return AddToSheet(detail); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +int VLayoutPaper::Count() const +{ + return d->details.count(); +} + +//--------------------------------------------------------------------------------------------------------------------- +bool VLayoutPaper::AddToBlankSheet(const VLayoutDetail &detail) +{ + BestResult bestResult; + + // We should use copy of the detail. + VLayoutDetail workDetail = detail; + + for (int i=1; i<= detail.EdgesCount(); i++) + { + int dEdge = i;// For mirror detail edge will be different + if (CheckPosition(workDetail, 1, dEdge)) + { + const QRectF rec = workDetail.BoundingRect(); + if (SheetContains(rec)) + { + bestResult.NewResult(static_cast(rec.width()*rec.height()), 1, dEdge, workDetail.GetMatrix()); + } + else + { + continue; // Outside of sheet. + } + } + } + + if (bestResult.ValideResult()) + { + VLayoutDetail workDetail = detail; + workDetail.SetMatrix(bestResult.Matrix());// Don't forget set matrix + d->details.append(workDetail); + // First detail, just simple take all points + d->globalContour = workDetail.GetLayoutAllowence(); + } + + return bestResult.ValideResult(); // Do we have the best result? +} + +//--------------------------------------------------------------------------------------------------------------------- +bool VLayoutPaper::AddToSheet(const VLayoutDetail &detail) +{ + BestResult bestResult; + + for (int j=1; j <= EdgesCount(); ++j) + { + // We should use copy of the detail. + VLayoutDetail workDetail = detail; + + for (int i=1; i<= workDetail.EdgesCount(); i++) + { + int dEdge = i;// For mirror detail edge will be different + if (CheckPosition(workDetail, j, dEdge)) + { + if (SheetContains(workDetail.BoundingRect())) + { + QVector newGContour = UniteWithContour(workDetail, j, dEdge); + newGContour.append(newGContour.first()); + const QRectF rec = QPolygonF(newGContour).boundingRect(); + bestResult.NewResult(static_cast(rec.width()*rec.height()), j, dEdge, + workDetail.GetMatrix()); + } + else + { + continue; // Outside of sheet. + } + } + } + } + + if (bestResult.ValideResult()) + { + VLayoutDetail workDetail = detail; + workDetail.SetMatrix(bestResult.Matrix());// Don't forget set matrix + const QVector newGContour = UniteWithContour(workDetail, bestResult.GContourEdge(), + bestResult.DetailEdge()); + if (newGContour.isEmpty()) + { + return false; + } + d->details.append(workDetail); + // First detail, just simple take all points + d->globalContour = newGContour; + } + + return bestResult.ValideResult(); // Do we have the best result? +} + +//--------------------------------------------------------------------------------------------------------------------- +bool VLayoutPaper::CheckPosition(VLayoutDetail &detail, int j, int &dEdge) const +{ + const QLineF globalEdge = GlobalEdge(j); + bool flagMirror = false; + bool flagSquare = false; + + CombineEdges(detail, globalEdge, dEdge); + + switch (Crossing(detail, j, dEdge)) + { + case CrossingType::EdgeError: + return false; + case CrossingType::Intersection: + detail.Mirror(globalEdge); + flagMirror = true; + break; + case CrossingType::NoIntersection: + { + switch (InsideContour(detail, dEdge)) + { + case InsideType::EdgeError: + return false; + case InsideType::Inside: + detail.Mirror(globalEdge); + flagMirror = true; + break; + case InsideType::Outside: + flagSquare = true; + break; + default: + break; + } + } + default: + break; + } + + if (flagMirror) + { + dEdge = detail.EdgeByPoint(globalEdge.p2()); + if (dEdge <= 0) + { + return false; + } + + switch (Crossing(detail, j, dEdge)) + { + case CrossingType::EdgeError: + return false; + case CrossingType::Intersection: + flagSquare = false; + break; + case CrossingType::NoIntersection: + { + switch (InsideContour(detail, dEdge)) + { + case InsideType::EdgeError: + return false; + case InsideType::Inside: + flagSquare = false; + break; + case InsideType::Outside: + flagSquare = true; + break; + default: + break; + } + } + default: + break; + } + } + return flagSquare; +} + +//--------------------------------------------------------------------------------------------------------------------- +VLayoutPaper::CrossingType VLayoutPaper::Crossing(const VLayoutDetail &detail, int globalI, int detailI) const +{ + int globalEdgesCount = EdgesCount(); + if (globalEdgesCount == 0) + { + globalEdgesCount = 1;// For blank sheet + } + + const int detailEdgesCount = detail.EdgesCount(); + if (detailEdgesCount < 3) + { + return CrossingType::EdgeError; + } + + for(int i = 1; i <= globalEdgesCount; i++) + { + const QLineF globalEdge = GlobalEdge(i); + if (globalEdge.isNull()) // Got null edge + { + return CrossingType::EdgeError; + } + + for(int j = 1; j <= detailEdgesCount; j++) + { + if (i == globalI && j == detailI) + { + continue; + } + + const QLineF detailEdge = detail.Edge(j); + if (detailEdge.isNull()) // Got null edge + { + return CrossingType::EdgeError; + } + + QPointF xPoint; + QLineF::IntersectType type = globalEdge.intersect(detailEdge, &xPoint); + + if (type == QLineF::BoundedIntersection) + { + return CrossingType::Intersection; + } + } + } + + return CrossingType::NoIntersection; +} + +//--------------------------------------------------------------------------------------------------------------------- +VLayoutPaper::InsideType VLayoutPaper::InsideContour(const VLayoutDetail &detail, int detailI) const +{ + if (detail.EdgesCount() < 3) + { + return InsideType::EdgeError; + } + + const QVector lPoints = detail.GetLayoutAllowence(); + + const QLineF detailEdge = detail.Edge(detailI); + if (detailEdge.isNull()) // Got null edge + { + return InsideType::EdgeError; + } + + if (d->details.isEmpty()) + { + const QLineF globalEdge = GlobalEdge(1); + for(int i = 0; i < lPoints.count(); i++) + { + if (CheckSide(globalEdge, lPoints.at(i)) < 0) + { + return InsideType::Inside; + } + } + } + else + { + const QPolygonF gPoly = GlobalPolygon(); + for(int i = 0; i < lPoints.count(); i++) + { + const QPointF p = lPoints.at(i); + if (p.isNull()) + { + return InsideType::EdgeError; + } + + if (p != detailEdge.p1() && p != detailEdge.p2()) + { + if (gPoly.containsPoint(p, Qt::OddEvenFill)) + { + return InsideType::Inside; + } + } + } + } + return InsideType::Outside; +} + +//--------------------------------------------------------------------------------------------------------------------- +qreal VLayoutPaper::CheckSide(const QLineF &edge, const QPointF &p) const +{ + return (edge.x2() - edge.x1()) * (p.y() - edge.y1()) - (edge.y2() - edge.y1()) * (p.x() - edge.x1()); +} + +//--------------------------------------------------------------------------------------------------------------------- +bool VLayoutPaper::SheetContains(const QRectF &rect) const +{ + const QRectF bRect(0, 0, d->paperWidth, d->paperHeight); + return bRect.contains(rect); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VLayoutPaper::CombineEdges(VLayoutDetail &detail, const QLineF &globalEdge, int dEdge) const +{ + QLineF detailEdge = detail.Edge(dEdge); + + // Find distance between two edges for two begin vertex. + const qreal dx = globalEdge.x2() - detailEdge.x2(); + const qreal dy = globalEdge.y2() - detailEdge.y2(); + + detailEdge.translate(dx, dy); // Use values for translate detail edge. + + const qreal angle_between = globalEdge.angleTo(detailEdge); // Seek angle between two edges. + + // Now we move detail to position near to global contour edge. + detail.Translate(dx, dy); + detail.Rotate(globalEdge.p2(), angle_between); +} + +//--------------------------------------------------------------------------------------------------------------------- +QVector VLayoutPaper::UniteWithContour(const VLayoutDetail &detail, int globalI, int detJ) const +{ + if (d->globalContour.isEmpty()) + { + return detail.GetLayoutAllowence(); + } + + if (globalI <= 0 || globalI > EdgesCount()) + { + return QVector(); + } + + if (detJ <= 0 || detJ > detail.EdgesCount()) + { + return QVector(); + } + + QVector newContour; + for(int i=0; i < d->globalContour.count(); ++i) + { + newContour.append(d->globalContour.at(i)); + ++i; + if (i==globalI) + { + const QVector dPoints = detail.GetLayoutAllowence(); + const int nD = dPoints.count(); + int processedPoints = 0; + int j = detJ; + do + { + if (j > nD-1) + { + j=0; + } + newContour.append(dPoints.at(j)); + ++processedPoints; + ++j; + }while (processedPointsdetails.isEmpty()) + { + // Because sheet is blank we have one global edge for all cases - Ox axis. + return QLineF(0, 0, d->paperWidth, 0); + } + + if (i < 1 || i > EdgesCount()) + { // Doesn't exist such edge + return QLineF(); + } + QLineF edge; + if (i < EdgesCount()) + { + edge = QLineF(d->globalContour.at(i-1), d->globalContour.at(i)); + } + else + { // Closed countour + edge = QLineF(d->globalContour.at(EdgesCount()-1), d->globalContour.at(0)); + } + return edge; +} + +//--------------------------------------------------------------------------------------------------------------------- +int VLayoutPaper::EdgesCount() const +{ + return d->globalContour.count(); +} + +//--------------------------------------------------------------------------------------------------------------------- +QPolygonF VLayoutPaper::GlobalPolygon() const +{ + QVector points = d->globalContour; + points.append(points.first()); + return QPolygonF(points); +} diff --git a/src/libs/vlayout/vlayoutpaper.h b/src/libs/vlayout/vlayoutpaper.h new file mode 100644 index 000000000..5e231fc0e --- /dev/null +++ b/src/libs/vlayout/vlayoutpaper.h @@ -0,0 +1,91 @@ +/************************************************************************ + ** + ** @file vlayoutpaper.h + ** @author Roman Telezhynskyi + ** @date 7 1, 2015 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef VLAYOUTPAPER_H +#define VLAYOUTPAPER_H + +#include + +class VLayoutPaperData; +class VLayoutDetail; +class QPointF; +class QLineF; +class QPolygonF; + +class VLayoutPaper +{ +public: + VLayoutPaper(); + VLayoutPaper(int height, int width); + VLayoutPaper(const VLayoutPaper &paper); + VLayoutPaper &operator=(const VLayoutPaper &paper); + virtual ~VLayoutPaper(); + + int GetHeight() const; + void SetHeight(int height); + + int GetWidth() const; + void SetWidth(int width); + + bool ArrangeDetail(const VLayoutDetail &detail); + int Count() const; +private: + QSharedDataPointer d; + + enum class CrossingType : char + { + NoIntersection = 0, + Intersection = 1, + EdgeError = 2 + }; + + enum class InsideType : char + { + Outside = 0, + Inside = 1, + EdgeError = 2 + }; + + bool AddToBlankSheet(const VLayoutDetail &detail); + bool AddToSheet(const VLayoutDetail &detail); + + bool CheckPosition(VLayoutDetail &detail, int j, int &dEdge) const; + CrossingType Crossing(const VLayoutDetail &detail, int globalI, int detailI) const; + InsideType InsideContour(const VLayoutDetail &detail, int detailI) const; + qreal CheckSide(const QLineF &edge, const QPointF &p) const; + bool SheetContains(const QRectF &rect) const; + void CombineEdges(VLayoutDetail &detail, const QLineF &globalEdge, int dEdge) const; + QVector UniteWithContour(const VLayoutDetail &detail, int globalI, int detJ) const; + + QLineF GlobalEdge(int i) const; + int EdgesCount() const; + + QPolygonF GlobalPolygon() const; +}; + +#endif // VLAYOUTPAPER_H diff --git a/src/libs/vlayout/vlayoutpaper_p.h b/src/libs/vlayout/vlayoutpaper_p.h new file mode 100644 index 000000000..3a9e3b23b --- /dev/null +++ b/src/libs/vlayout/vlayoutpaper_p.h @@ -0,0 +1,78 @@ +/************************************************************************ + ** + ** @file vlayoutpaper_p.h + ** @author Roman Telezhynskyi + ** @date 8 1, 2015 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef VLAYOUTPAPER_P_H +#define VLAYOUTPAPER_P_H + +#include +#include +#include + +#include "vlayoutdetail.h" + +#ifdef Q_CC_GNU + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Weffc++" +#endif + +class VLayoutPaperData : public QSharedData +{ +public: + VLayoutPaperData() + :details(QVector()), globalContour(QVector()), paperHeight(0), paperWidth(0) + {} + + VLayoutPaperData(int height, int width) + :details(QVector()), globalContour(QVector()), paperHeight(height), paperWidth(width) + {} + + VLayoutPaperData(const VLayoutPaperData &paper) + :QSharedData(paper), details(paper.details), globalContour(paper.globalContour), paperHeight(paper.paperHeight), + paperWidth(paper.paperWidth) + {} + + ~VLayoutPaperData() {} + + /** @brief details list of arranged details. */ + QVector details; + + /** @brief globalContour list of global points contour. */ + QVector globalContour; + + /** @brief paperHeight height of paper in pixels*/ + int paperHeight; + + /** @brief paperWidth width of paper in pixels*/ + int paperWidth; +}; + +#ifdef Q_CC_GNU + #pragma GCC diagnostic pop +#endif + +#endif // VLAYOUTPAPER_P_H