cppcheck.
--HG-- branch : release
This commit is contained in:
parent
22055ab684
commit
850d51adac
|
@ -746,7 +746,7 @@ void VSpline::SetKcurve(qreal factor)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int VSpline::Sign(long double ld) const
|
int VSpline::Sign(long double ld)
|
||||||
{
|
{
|
||||||
if (qAbs(ld)<0.00000000001)
|
if (qAbs(ld)<0.00000000001)
|
||||||
{
|
{
|
||||||
|
@ -774,7 +774,7 @@ int VSpline::Sign(long double ld) const
|
||||||
* 1 - 1 real root + 2 complex;
|
* 1 - 1 real root + 2 complex;
|
||||||
* 2 - 1 real root + complex roots imaginary part is zero (i.e. 2 real roots).
|
* 2 - 1 real root + complex roots imaginary part is zero (i.e. 2 real roots).
|
||||||
*/
|
*/
|
||||||
qint32 VSpline::Cubic(QVector<qreal> &x, qreal a, qreal b, qreal c) const
|
qint32 VSpline::Cubic(QVector<qreal> &x, qreal a, qreal b, qreal c)
|
||||||
{
|
{
|
||||||
//To find cubic equation roots in the case of real coefficients, calculated at the beginning
|
//To find cubic equation roots in the case of real coefficients, calculated at the beginning
|
||||||
const qreal q = (pow(a, 2) - 3*b)/9.;
|
const qreal q = (pow(a, 2) - 3*b)/9.;
|
||||||
|
|
|
@ -83,8 +83,8 @@ private:
|
||||||
void CreateName();
|
void CreateName();
|
||||||
QVector<qreal> CalcT(qreal curveCoord1, qreal curveCoord2, qreal curveCoord3, qreal curveCoord4,
|
QVector<qreal> CalcT(qreal curveCoord1, qreal curveCoord2, qreal curveCoord3, qreal curveCoord4,
|
||||||
qreal pointCoord) const;
|
qreal pointCoord) const;
|
||||||
qint32 Cubic(QVector<qreal> &x, qreal a, qreal b, qreal c) const;
|
static qint32 Cubic(QVector<qreal> &x, qreal a, qreal b, qreal c);
|
||||||
int Sign(long double ld) const;
|
static int Sign(long double ld);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VSPLINE_H
|
#endif // VSPLINE_H
|
||||||
|
|
|
@ -45,7 +45,7 @@ const QString VToolSpline::ToolType = QStringLiteral("simple");
|
||||||
* @param typeCreation way we create this tool.
|
* @param typeCreation way we create this tool.
|
||||||
* @param parent parent object.
|
* @param parent parent object.
|
||||||
*/
|
*/
|
||||||
VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const QString color, const Source &typeCreation,
|
VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const QString &color, const Source &typeCreation,
|
||||||
QGraphicsItem *parent)
|
QGraphicsItem *parent)
|
||||||
:VAbstractSpline(doc, data, id, parent), oldPosition()
|
:VAbstractSpline(doc, data, id, parent), oldPosition()
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,7 +38,7 @@ class VToolSpline:public VAbstractSpline
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VToolSpline (VPattern *doc, VContainer *data, quint32 id, const QString color, const Source &typeCreation,
|
VToolSpline (VPattern *doc, VContainer *data, quint32 id, const QString &color, const Source &typeCreation,
|
||||||
QGraphicsItem * parent = nullptr );
|
QGraphicsItem * parent = nullptr );
|
||||||
virtual ~VToolSpline();
|
virtual ~VToolSpline();
|
||||||
virtual void setDialog();
|
virtual void setDialog();
|
||||||
|
|
|
@ -53,14 +53,15 @@ QString compilerString()
|
||||||
#elif defined(Q_CC_MSVC)
|
#elif defined(Q_CC_MSVC)
|
||||||
if (_MSC_VER >= 1800) // 1800: MSVC 2013 (yearly release cycle)
|
if (_MSC_VER >= 1800) // 1800: MSVC 2013 (yearly release cycle)
|
||||||
{
|
{
|
||||||
return QLatin1String("MSVC ") + QString::number(2008 + ((_MSC_VER / 100) - 13));
|
compiler = QLatin1String("MSVC ") + QString::number(2008 + ((_MSC_VER / 100) - 13));
|
||||||
}
|
}
|
||||||
if (_MSC_VER >= 1500) // 1500: MSVC 2008, 1600: MSVC 2010, ... (2-year release cycle)
|
if (_MSC_VER >= 1500) // 1500: MSVC 2008, 1600: MSVC 2010, ... (2-year release cycle)
|
||||||
{
|
{
|
||||||
return QLatin1String("MSVC ") + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15));
|
return QLatin1String("MSVC ") + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15));
|
||||||
}
|
}
|
||||||
#endif
|
#else
|
||||||
return QLatin1String("<unknown compiler>");
|
return QLatin1String("<unknown compiler>");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -1647,9 +1647,9 @@ void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &do
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
||||||
quint32 id = 0;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
quint32 id = 0;
|
||||||
ToolsCommonAttributes(domElement, id);
|
ToolsCommonAttributes(domElement, id);
|
||||||
const quint32 firstPoint = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR);
|
const quint32 firstPoint = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR);
|
||||||
const quint32 secondPoint = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR);
|
const quint32 secondPoint = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR);
|
||||||
|
@ -2065,7 +2065,6 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
||||||
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
|
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
|
||||||
|
|
||||||
quint32 id = 0;
|
|
||||||
QStringList tools{VToolUnionDetails::ToolType};
|
QStringList tools{VToolUnionDetails::ToolType};
|
||||||
|
|
||||||
switch (tools.indexOf(type))
|
switch (tools.indexOf(type))
|
||||||
|
@ -2073,6 +2072,7 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
|
||||||
case 0: //VToolUnionDetails::ToolType
|
case 0: //VToolUnionDetails::ToolType
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
quint32 id = 0;
|
||||||
ToolsCommonAttributes(domElement, id);
|
ToolsCommonAttributes(domElement, id);
|
||||||
const quint32 indexD1 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD1, "-1");
|
const quint32 indexD1 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD1, "-1");
|
||||||
const quint32 indexD2 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD2, "-1");
|
const quint32 indexD2 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD2, "-1");
|
||||||
|
|
|
@ -366,7 +366,7 @@ QVector<QPointF> VLayoutDetail::Map(const QVector<QPointF> &points) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QPointF> VLayoutDetail::RoundPoints(const QVector<QPointF> &points) const
|
QVector<QPointF> VLayoutDetail::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)
|
||||||
|
|
|
@ -82,7 +82,7 @@ private:
|
||||||
QSharedDataPointer<VLayoutDetailData> d;
|
QSharedDataPointer<VLayoutDetailData> d;
|
||||||
|
|
||||||
QVector<QPointF> Map(const QVector<QPointF> &points) const;
|
QVector<QPointF> Map(const QVector<QPointF> &points) const;
|
||||||
QVector<QPointF> RoundPoints(const QVector<QPointF> &points) const;
|
static QVector<QPointF> RoundPoints(const QVector<QPointF> &points);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VLAYOUTDETAIL_H
|
#endif // VLAYOUTDETAIL_H
|
||||||
|
|
|
@ -258,17 +258,6 @@ bool VLayoutPaper::SaveResult(const VBestSquare &bestResult, const VLayoutDetail
|
||||||
return bestResult.ValideResult(); // Do we have the best result?
|
return bestResult.ValideResult(); // Do we have the best result?
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VLayoutPaper::SaveCandidate(VBestSquare &bestResult, const VLayoutDetail &detail, int globalI, int detJ,
|
|
||||||
BestFrom type)
|
|
||||||
{
|
|
||||||
QVector<QPointF> newGContour = d->globalContour.UniteWithContour(detail, globalI, detJ, type);
|
|
||||||
newGContour.append(newGContour.first());
|
|
||||||
const QRectF rec = QPolygonF(newGContour).boundingRect();
|
|
||||||
bestResult.NewResult(static_cast<qint64>(rec.width()*rec.height()), globalI, detJ,
|
|
||||||
detail.GetMatrix(), detail.IsMirror(), type);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QGraphicsRectItem *VLayoutPaper::GetPaperItem() const
|
QGraphicsRectItem *VLayoutPaper::GetPaperItem() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,6 @@ private:
|
||||||
bool AddToSheet(const VLayoutDetail &detail, bool &stop);
|
bool AddToSheet(const VLayoutDetail &detail, bool &stop);
|
||||||
|
|
||||||
bool SaveResult(const VBestSquare &bestResult, const VLayoutDetail &detail);
|
bool SaveResult(const VBestSquare &bestResult, const VLayoutDetail &detail);
|
||||||
void SaveCandidate(VBestSquare &bestResult, const VLayoutDetail &detail, int globalI, int detJ, BestFrom type);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ VPosition::VPosition(const VContour &gContour, int j, const VLayoutDetail &detai
|
||||||
{
|
{
|
||||||
if ((rotationIncrease >= 1 && rotationIncrease <= 180 && 360 % rotationIncrease == 0) == false)
|
if ((rotationIncrease >= 1 && rotationIncrease <= 180 && 360 % rotationIncrease == 0) == false)
|
||||||
{
|
{
|
||||||
rotationIncrease = 180;
|
this->rotationIncrease = 180;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user