Coverity Scan.
--HG-- branch : release
This commit is contained in:
parent
850d51adac
commit
8b0de7504f
|
@ -28,10 +28,13 @@
|
|||
|
||||
#include "vtoolpoint.h"
|
||||
#include <QKeyEvent>
|
||||
#include <QLoggingCategory>
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../visualization/vgraphicssimpletextitem.h"
|
||||
#include "../../undocommands/movelabel.h"
|
||||
|
||||
Q_LOGGING_CATEGORY(vToolPoint, "v.toolPoint")
|
||||
|
||||
const QString VToolPoint::TagName = QStringLiteral("point");
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -79,12 +82,21 @@ void VToolPoint::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VToolPoint::name() const
|
||||
{
|
||||
return VAbstractTool::data.GeometricObject<VPointF>(id)->name();
|
||||
try
|
||||
{
|
||||
return VAbstractTool::data.GeometricObject<VPointF>(id)->name();
|
||||
}
|
||||
catch (const VExceptionBadId &e)
|
||||
{
|
||||
qCDebug(vToolPoint)<<"Error!"<<"Couldn't get point name."<<e.ErrorMessage()<<e.DetailedInformation();
|
||||
return QString("");// Return empty string for property browser
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPoint::setName(const QString &name)
|
||||
{
|
||||
// Don't know if need check name here.
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
obj->setName(name);
|
||||
SaveOption(obj);
|
||||
|
|
|
@ -239,15 +239,8 @@ QLineF VContour::GlobalEdge(int i) const
|
|||
return QLineF();
|
||||
}
|
||||
|
||||
if (n <= 0)
|
||||
{
|
||||
return axis;
|
||||
}
|
||||
else
|
||||
{
|
||||
const qreal nShift = axis.length()/n;
|
||||
return QLineF(nShift*(i-1), 0, nShift*i, 0);
|
||||
}
|
||||
const qreal nShift = axis.length()/n;
|
||||
return QLineF(nShift*(i-1), 0, nShift*i, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -580,22 +580,24 @@ QVector<QPointF> VPosition::CutEdge(const QLineF &edge, unsigned int shift)
|
|||
points.append(edge.p1());
|
||||
points.append(edge.p2());
|
||||
}
|
||||
|
||||
const int n = qFloor(edge.length()/shift);
|
||||
|
||||
if (n <= 0)
|
||||
{
|
||||
points.append(edge.p1());
|
||||
points.append(edge.p2());
|
||||
}
|
||||
else
|
||||
{
|
||||
const qreal nShift = edge.length()/n;
|
||||
for (int i = 1; i <= n+1; ++i)
|
||||
const int n = qFloor(edge.length()/shift);
|
||||
|
||||
if (n <= 0)
|
||||
{
|
||||
QLineF l1 = edge;
|
||||
l1.setLength(nShift*(i-1));
|
||||
points.append(l1.p2());
|
||||
points.append(edge.p1());
|
||||
points.append(edge.p2());
|
||||
}
|
||||
else
|
||||
{
|
||||
const qreal nShift = edge.length()/n;
|
||||
for (int i = 1; i <= n+1; ++i)
|
||||
{
|
||||
QLineF l1 = edge;
|
||||
l1.setLength(nShift*(i-1));
|
||||
points.append(l1.p2());
|
||||
}
|
||||
}
|
||||
}
|
||||
return points;
|
||||
|
|
Loading…
Reference in New Issue
Block a user