Refactoring. Fixing warnings.
--HG-- branch : develop
This commit is contained in:
parent
eb87d703a2
commit
728dd00b76
|
@ -68,7 +68,7 @@ VPosition::VPosition(const VContour &gContour, int j, const VLayoutPiece &detail
|
||||||
angle_between(0),
|
angle_between(0),
|
||||||
followGrainline(followGainline)
|
followGrainline(followGainline)
|
||||||
{
|
{
|
||||||
if ((rotationIncrease >= 1 && rotationIncrease <= 180 && 360 % rotationIncrease == 0) == false)
|
if (not (rotationIncrease >= 1 && rotationIncrease <= 180 && 360 % rotationIncrease == 0))
|
||||||
{
|
{
|
||||||
this->rotationIncrease = 180;
|
this->rotationIncrease = 180;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ quint32 VPosition::getPaperIndex() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPosition::setPaperIndex(const quint32 &value)
|
void VPosition::setPaperIndex(quint32 value)
|
||||||
{
|
{
|
||||||
paperIndex = value;
|
paperIndex = value;
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ quint32 VPosition::getFrame() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPosition::setFrame(const quint32 &value)
|
void VPosition::setFrame(quint32 value)
|
||||||
{
|
{
|
||||||
frame = value;
|
frame = value;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ quint32 VPosition::getDetailsCount() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPosition::setDetailsCount(const quint32 &value)
|
void VPosition::setDetailsCount(quint32 value)
|
||||||
{
|
{
|
||||||
detailsCount = value;
|
detailsCount = value;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ void VPosition::DrawDebug(const VContour &contour, const VLayoutPiece &detail, i
|
||||||
paintFrameImage.drawPicture(0, 0, picture);
|
paintFrameImage.drawPicture(0, 0, picture);
|
||||||
paintFrameImage.end();
|
paintFrameImage.end();
|
||||||
|
|
||||||
const QString path = QDir::homePath()+QStringLiteral("/LayoutDebug/")+QString("%1_%2_%3.png").arg(paperIndex)
|
const QString path = QDir::homePath()+QStringLiteral("/LayoutDebug/%1_%2_%3.png").arg(paperIndex)
|
||||||
.arg(detailsCount).arg(frame);
|
.arg(detailsCount).arg(frame);
|
||||||
frameImage.save (path);
|
frameImage.save (path);
|
||||||
}
|
}
|
||||||
|
@ -250,14 +250,7 @@ void VPosition::DrawDebug(const VContour &contour, const VLayoutPiece &detail, i
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int VPosition::Bias(int length, int maxLength)
|
int VPosition::Bias(int length, int maxLength)
|
||||||
{
|
{
|
||||||
if (length < maxLength && length*2 < maxLength)
|
return length < maxLength && length*2 < maxLength ? length : maxLength-length;
|
||||||
{
|
|
||||||
return length;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return maxLength-length;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -430,14 +423,16 @@ VPosition::CrossingType VPosition::Crossing(const VLayoutPiece &detail) const
|
||||||
}
|
}
|
||||||
|
|
||||||
const QPainterPath gPath = gContour.ContourPath();
|
const QPainterPath gPath = gContour.ContourPath();
|
||||||
|
CrossingType crossing = CrossingType::EdgeError;
|
||||||
if (not gPath.intersects(detail.LayoutAllowancePath()) && not gPath.contains(detail.ContourPath()))
|
if (not gPath.intersects(detail.LayoutAllowancePath()) && not gPath.contains(detail.ContourPath()))
|
||||||
{
|
{
|
||||||
return CrossingType::NoIntersection;
|
crossing = CrossingType::NoIntersection;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return CrossingType::Intersection;
|
crossing = CrossingType::Intersection;
|
||||||
}
|
}
|
||||||
|
return crossing;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -448,7 +443,7 @@ bool VPosition::SheetContains(const QRectF &rect) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPosition::CombineEdges(VLayoutPiece &detail, const QLineF &globalEdge, const int &dEdge)
|
void VPosition::CombineEdges(VLayoutPiece &detail, const QLineF &globalEdge, int dEdge)
|
||||||
{
|
{
|
||||||
QLineF detailEdge;
|
QLineF detailEdge;
|
||||||
if (gContour.GetContour().isEmpty())
|
if (gContour.GetContour().isEmpty())
|
||||||
|
|
|
@ -45,16 +45,16 @@ class VPosition : public QRunnable
|
||||||
public:
|
public:
|
||||||
VPosition(const VContour &gContour, int j, const VLayoutPiece &detail, int i, std::atomic_bool *stop, bool rotate,
|
VPosition(const VContour &gContour, int j, const VLayoutPiece &detail, int i, std::atomic_bool *stop, bool rotate,
|
||||||
int rotationIncrease, bool saveLength, bool followGainline);
|
int rotationIncrease, bool saveLength, bool followGainline);
|
||||||
virtual ~VPosition() override{}
|
virtual ~VPosition() override = default;
|
||||||
|
|
||||||
quint32 getPaperIndex() const;
|
quint32 getPaperIndex() const;
|
||||||
void setPaperIndex(const quint32 &value);
|
void setPaperIndex(quint32 value);
|
||||||
|
|
||||||
quint32 getFrame() const;
|
quint32 getFrame() const;
|
||||||
void setFrame(const quint32 &value);
|
void setFrame(quint32 value);
|
||||||
|
|
||||||
quint32 getDetailsCount() const;
|
quint32 getDetailsCount() const;
|
||||||
void setDetailsCount(const quint32 &value);
|
void setDetailsCount(quint32 value);
|
||||||
|
|
||||||
void setDetails(const QVector<VLayoutPiece> &details);
|
void setDetails(const QVector<VLayoutPiece> &details);
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ private:
|
||||||
CrossingType Crossing(const VLayoutPiece &detail) const;
|
CrossingType Crossing(const VLayoutPiece &detail) const;
|
||||||
bool SheetContains(const QRectF &rect) const;
|
bool SheetContains(const QRectF &rect) const;
|
||||||
|
|
||||||
void CombineEdges(VLayoutPiece &detail, const QLineF &globalEdge, const int &dEdge);
|
void CombineEdges(VLayoutPiece &detail, const QLineF &globalEdge, int dEdge);
|
||||||
void RotateEdges(VLayoutPiece &detail, const QLineF &globalEdge, int dEdge, qreal angle) const;
|
void RotateEdges(VLayoutPiece &detail, const QLineF &globalEdge, int dEdge, qreal angle) const;
|
||||||
|
|
||||||
static QPainterPath ShowDirection(const QLineF &edge);
|
static QPainterPath ShowDirection(const QLineF &edge);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user