Fixed vera++ warnings.

--HG--
branch : feature
This commit is contained in:
dismine 2013-12-31 10:44:54 +02:00
parent 8e82a80463
commit 3b1a654581
20 changed files with 106 additions and 89 deletions

View File

@ -36,7 +36,7 @@ qint64 VContainer::_id = 0;
VContainer::VContainer() VContainer::VContainer()
:base(QHash<QString, qint32>()), gObjects(QHash<qint64, VGObject *>()), :base(QHash<QString, qint32>()), gObjects(QHash<qint64, VGObject *>()),
standartTable(QHash<QString, VStandartTableRow>()), incrementTable(QHash<QString, VIncrementTableRow>()), standartTable(QHash<QString, VStandartTableRow>()), incrementTable(QHash<QString, VIncrementTableRow>()),
lengthLines(QHash<QString, qreal>()),lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()), lengthLines(QHash<QString, qreal>()), lineAngles(QHash<QString, qreal>()), lengthSplines(QHash<QString, qreal>()),
lengthArcs(QHash<QString, qreal>()), details(QHash<qint64, VDetail>()) lengthArcs(QHash<QString, qreal>()), details(QHash<qint64, VDetail>())
{ {
SetSize(500); SetSize(500);
@ -77,24 +77,24 @@ void VContainer::setData(const VContainer &data)
while (i.hasNext()) while (i.hasNext())
{ {
i.next(); i.next();
switch(i.value()->getType()) switch (i.value()->getType())
{ {
case(GObject::Arc): case (GObject::Arc):
{ {
CopyGObject<VArc>(data, i.key()); CopyGObject<VArc>(data, i.key());
break; break;
} }
case(GObject::Point): case (GObject::Point):
{ {
CopyGObject<VPointF>(data, i.key()); CopyGObject<VPointF>(data, i.key());
break; break;
} }
case(GObject::Spline): case (GObject::Spline):
{ {
CopyGObject<VSpline>(data, i.key()); CopyGObject<VSpline>(data, i.key());
break; break;
} }
case(GObject::SplinePath): case (GObject::SplinePath):
{ {
CopyGObject<VSplinePath>(data, i.key()); CopyGObject<VSplinePath>(data, i.key());
break; break;
@ -625,7 +625,7 @@ void VContainer::Clear()
void VContainer::ClearObject() void VContainer::ClearObject()
{ {
if(gObjects.size()>0) if (gObjects.size()>0)
{ {
qDeleteAll(gObjects); qDeleteAll(gObjects);
} }
@ -715,7 +715,7 @@ void VContainer::UpdateGObject(qint64 id, VGObject* obj)
UpdateObject(gObjects, id, obj); UpdateObject(gObjects, id, obj);
} }
void VContainer::UpdateDetail(qint64 id,VDetail detail) void VContainer::UpdateDetail(qint64 id, VDetail detail)
{ {
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
details[id] = detail; details[id] = detail;

View File

@ -31,8 +31,9 @@
#include "dialogtool.h" #include "dialogtool.h"
namespace Ui { namespace Ui
class DialogCutSpline; {
class DialogCutSpline;
} }
class DialogCutSpline : public DialogTool class DialogCutSpline : public DialogTool

View File

@ -31,8 +31,9 @@
#include "dialogtool.h" #include "dialogtool.h"
namespace Ui { namespace Ui
class DialogCutSplinePath; {
class DialogCutSplinePath;
} }
class DialogCutSplinePath : public DialogTool class DialogCutSplinePath : public DialogTool

View File

@ -75,7 +75,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const
if (i.key() != id) if (i.key() != id)
{ {
VGObject *obj = i.value(); VGObject *obj = i.value();
if(obj->getType() == GObject::Point && obj->getMode() == Draw::Calculation) if (obj->getType() == GObject::Point && obj->getMode() == Draw::Calculation)
{ {
const VPointF *point = data->GeometricObject<const VPointF *>(i.key()); const VPointF *point = data->GeometricObject<const VPointF *>(i.key());
box->addItem(point->name(), i.key()); box->addItem(point->name(), i.key());
@ -93,12 +93,12 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode
while (i.hasNext()) while (i.hasNext())
{ {
i.next(); i.next();
if(cut == ComboMode::CutSpline) if (cut == ComboMode::CutSpline)
{ {
if (i.key() != id + 1 && i.key() != id + 2) if (i.key() != id + 1 && i.key() != id + 2)
{ {
VGObject *obj = i.value(); VGObject *obj = i.value();
if(obj->getType() == GObject::Spline && obj->getMode() == Draw::Calculation) if (obj->getType() == GObject::Spline && obj->getMode() == Draw::Calculation)
{ {
const VSpline *spl = data->GeometricObject<const VSpline *>(i.key()); const VSpline *spl = data->GeometricObject<const VSpline *>(i.key());
box->addItem(spl->name(), i.key()); box->addItem(spl->name(), i.key());
@ -110,7 +110,7 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode
if (i.key() != id) if (i.key() != id)
{ {
VGObject *obj = i.value(); VGObject *obj = i.value();
if(obj->getType() == GObject::Spline && obj->getMode() == Draw::Calculation) if (obj->getType() == GObject::Spline && obj->getMode() == Draw::Calculation)
{ {
const VSpline *spl = data->GeometricObject<const VSpline *>(i.key()); const VSpline *spl = data->GeometricObject<const VSpline *>(i.key());
box->addItem(spl->name(), i.key()); box->addItem(spl->name(), i.key());
@ -129,12 +129,12 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id, Combo
while (i.hasNext()) while (i.hasNext())
{ {
i.next(); i.next();
if(cut == ComboMode::CutSpline) if (cut == ComboMode::CutSpline)
{ {
if (i.key() != id + 1 && i.key() != id + 2) if (i.key() != id + 1 && i.key() != id + 2)
{ {
VGObject *obj = i.value(); VGObject *obj = i.value();
if(obj->getType() == GObject::SplinePath && obj->getMode() == Draw::Calculation) if (obj->getType() == GObject::SplinePath && obj->getMode() == Draw::Calculation)
{ {
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(i.key()); const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(i.key());
box->addItem(splPath->name(), i.key()); box->addItem(splPath->name(), i.key());
@ -146,7 +146,7 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id, Combo
if (i.key() != id) if (i.key() != id)
{ {
VGObject *obj = i.value(); VGObject *obj = i.value();
if(obj->getType() == GObject::SplinePath && obj->getMode() == Draw::Calculation) if (obj->getType() == GObject::SplinePath && obj->getMode() == Draw::Calculation)
{ {
const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(i.key()); const VSplinePath *splPath = data->GeometricObject<const VSplinePath *>(i.key());
box->addItem(splPath->name(), i.key()); box->addItem(splPath->name(), i.key());

View File

@ -47,7 +47,7 @@ DialogUnionDetails::~DialogUnionDetails()
void DialogUnionDetails::ChoosedObject(qint64 id, const Scene::Scenes &type) void DialogUnionDetails::ChoosedObject(qint64 id, const Scene::Scenes &type)
{ {
if(numberD == 0) if (numberD == 0)
{ {
ChoosedDetail(id, type, d1, d1P1, d1P2); ChoosedDetail(id, type, d1, d1P1, d1P2);
} }
@ -98,13 +98,13 @@ void DialogUnionDetails::ChoosedDetail(const qint64 &id, const Scene::Scenes &ty
} }
if (numberP == 1) if (numberP == 1)
{ {
if(id == p1) if (id == p1)
{ {
return; return;
} }
p2 = id; p2 = id;
++numberD; ++numberD;
if(numberD > 1) if (numberD > 1)
{ {
++numberP; ++numberP;
emit ToolTip(""); emit ToolTip("");

View File

@ -31,8 +31,9 @@
#include "dialogtool.h" #include "dialogtool.h"
namespace Ui { namespace Ui
class DialogUnionDetails; {
class DialogUnionDetails;
} }
class DialogUnionDetails : public DialogTool class DialogUnionDetails : public DialogTool

View File

@ -40,8 +40,8 @@ VArc::VArc ()
VArc::VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2, VArc::VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2,
QString formulaF2, qint64 idObject, Draw::Draws mode) QString formulaF2, qint64 idObject, Draw::Draws mode)
: VGObject(GObject::Arc, idObject, mode), f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), : VGObject(GObject::Arc, idObject, mode), f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2),
formulaRadius(formulaRadius),center(center) radius(radius), formulaRadius(formulaRadius), center(center)
{ {
//TODO Change name of arc in formula. Name now not unique. //TODO Change name of arc in formula. Name now not unique.
_name = QString ("Arc_%1").arg(this->GetCenter().name()); _name = QString ("Arc_%1").arg(this->GetCenter().name());

View File

@ -111,4 +111,3 @@ void VDetail::setId(const qint64 &id)
{ {
_id = id; _id = id;
} }

View File

@ -74,8 +74,8 @@ VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm
} }
VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, qint64 idObject, Draw::Draws mode) VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, qint64 idObject, Draw::Draws mode)
:VGObject(GObject::Spline, idObject, mode), p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), kAsm2(1), :VGObject(GObject::Spline, idObject, mode), p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1),
kCurve(1) kAsm2(1), kCurve(1)
{ {
CreateName(); CreateName();
@ -145,7 +145,7 @@ QLineF::IntersectType VSpline::CrossingSplLine ( const QLineF &line, QPointF *in
qreal VSpline::LengthT(qreal t) const qreal VSpline::LengthT(qreal t) const
{ {
if(t < 0 || t > 1) if (t < 0 || t > 1)
{ {
qWarning()<<"Wrong value t."; qWarning()<<"Wrong value t.";
return 0; return 0;
@ -180,7 +180,7 @@ qreal VSpline::LengthT(qreal t) const
QPointF VSpline::CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3 ) const QPointF VSpline::CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3 ) const
{ {
//Always need return two splines, so we must correct wrong length. //Always need return two splines, so we must correct wrong length.
if(length < GetLength()*0.02) if (length < GetLength()*0.02)
{ {
length = GetLength()*0.02; length = GetLength()*0.02;
} }
@ -199,7 +199,8 @@ QPointF VSpline::CutSpline ( qreal length, QPointF &spl1p2, QPointF &spl1p3, QPo
{ {
parT = parT + step; parT = parT + step;
qreal splLength = LengthT(parT); qreal splLength = LengthT(parT);
if(splLength >= length || parT > 1){ if (splLength >= length || parT > 1)
{
break; break;
} }
} }

View File

@ -174,14 +174,14 @@ const VSplinePoint &VSplinePath::at(ptrdiff_t indx) const
QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2, QPointF &spl1p3, QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2, QPointF &spl1p3,
QPointF &spl2p2, QPointF &spl2p3) const QPointF &spl2p2, QPointF &spl2p3) const
{ {
if(Count() < 2) if (Count() < 2)
{ {
throw VException(tr("Can't cut spline path with one point")); throw VException(tr("Can't cut spline path with one point"));
} }
//Always need return two spline paths, so we must correct wrong length. //Always need return two spline paths, so we must correct wrong length.
qreal fullLength = GetLength(); qreal fullLength = GetLength();
if(length < fullLength * 0.02) if (length < fullLength * 0.02)
{ {
length = fullLength * 0.02; length = fullLength * 0.02;
} }
@ -196,7 +196,7 @@ QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF
VSpline spl = VSpline(path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(), VSpline spl = VSpline(path[i-1].P(), path[i].P(), path[i-1].Angle2(), path[i].Angle1(), path[i-1].KAsm2(),
path[i].KAsm1(), kCurve); path[i].KAsm1(), kCurve);
fullLength += spl.GetLength(); fullLength += spl.GetLength();
if(fullLength > length) if (fullLength > length)
{ {
p1 = i-1; p1 = i-1;
p2 = i; p2 = i;

View File

@ -1084,7 +1084,7 @@ void MainWindow::SetEnableTool(bool enable)
{ {
bool drawTools = false; bool drawTools = false;
bool modelingTools = false; bool modelingTools = false;
if(mode == Draw::Calculation) if (mode == Draw::Calculation)
{ {
drawTools = enable; drawTools = enable;
} }

View File

@ -259,7 +259,7 @@ void VToolCutSpline::RefreshSpline(VSimpleSpline *spline, qint64 splid, SimpleSp
QPainterPath path; QPainterPath path;
path.addPath(spl->GetPath()); path.addPath(spl->GetPath());
path.setFillRule( Qt::WindingFill ); path.setFillRule( Qt::WindingFill );
if(tr == SimpleSpline::FirstPoint) if (tr == SimpleSpline::FirstPoint)
{ {
path.translate(-spl->GetP1().toQPointF().x(), -spl->GetP1().toQPointF().y()); path.translate(-spl->GetP1().toQPointF().x(), -spl->GetP1().toQPointF().y());
} }

View File

@ -120,13 +120,15 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
Q_ASSERT(splPath1); Q_ASSERT(splPath1);
VSplinePath *splPath2 = new VSplinePath(); VSplinePath *splPath2 = new VSplinePath();
Q_ASSERT(splPath2); Q_ASSERT(splPath2);
for(qint32 i = 0; i < splPath->CountPoint(); i++) for (qint32 i = 0; i < splPath->CountPoint(); i++)
{ {
if(i <= p1 && i < p2){ if (i <= p1 && i < p2)
if(i == p1) {
if (i == p1)
{ {
splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1(), spl1.GetKasm1())); splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1(), spl1.GetKasm1()));
VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2()+180, spl2.GetKasm1()); VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2()+180,
spl2.GetKasm1());
splPath1->append(cutPoint); splPath1->append(cutPoint);
continue; continue;
} }
@ -134,7 +136,7 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
} }
else else
{ {
if(i == p2) if (i == p2)
{ {
VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1(), spl2.GetKasm1()); VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1(), spl2.GetKasm1());
splPath2->append(cutPoint); splPath2->append(cutPoint);
@ -169,13 +171,15 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
Q_ASSERT(splPath1 != 0); Q_ASSERT(splPath1 != 0);
VSplinePath *splPath2 = new VSplinePath(); VSplinePath *splPath2 = new VSplinePath();
Q_ASSERT(splPath2 != 0); Q_ASSERT(splPath2 != 0);
for(qint32 i = 0; i < splPath->CountPoint(); i++) for (qint32 i = 0; i < splPath->CountPoint(); i++)
{ {
if(i <= p1 && i < p2){ if (i <= p1 && i < p2)
if(i == p1) {
if (i == p1)
{ {
splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1(), spl1.GetKasm1())); splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1(), spl1.GetKasm1()));
VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2()+180, spl2.GetKasm1()); VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2()+180,
spl2.GetKasm1());
splPath1->append(cutPoint); splPath1->append(cutPoint);
continue; continue;
} }
@ -183,7 +187,7 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
} }
else else
{ {
if(i == p2) if (i == p2)
{ {
VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1(), spl2.GetKasm1()); VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1(), spl2.GetKasm1());
splPath2->append(cutPoint); splPath2->append(cutPoint);
@ -326,7 +330,7 @@ void VToolCutSplinePath::RefreshSpline(VSimpleSpline *spline, qint64 splPathid,
QPainterPath path; QPainterPath path;
path.addPath(splPath->GetPath()); path.addPath(splPath->GetPath());
path.setFillRule( Qt::WindingFill ); path.setFillRule( Qt::WindingFill );
if(tr == SimpleSpline::FirstPoint) if (tr == SimpleSpline::FirstPoint)
{ {
VSpline spl = splPath->GetSpline(1); VSpline spl = splPath->GetSpline(1);
path.translate(-spl.GetP1().toQPointF().x(), -spl.GetP1().toQPointF().y()); path.translate(-spl.GetP1().toQPointF().x(), -spl.GetP1().toQPointF().y());

View File

@ -63,7 +63,7 @@ VToolUnionDetails::VToolUnionDetails(VDomDocument *doc, VContainer *data, const
void VToolUnionDetails::CorectPoints(const VDetail &detail, qint64 &p1, qint64 &p2) void VToolUnionDetails::CorectPoints(const VDetail &detail, qint64 &p1, qint64 &p2)
{ {
if(p1 == p2) if (p1 == p2)
{ {
qWarning()<<"Union points equal."; qWarning()<<"Union points equal.";
return; return;
@ -72,21 +72,21 @@ void VToolUnionDetails::CorectPoints(const VDetail &detail, qint64 &p1, qint64 &
bool p2flag = false; bool p2flag = false;
for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) for (ptrdiff_t i = 0; i< detail.CountNode(); ++i)
{ {
if(detail.at(i).getTypeTool() == Tool::NodePoint) if (detail.at(i).getTypeTool() == Tool::NodePoint)
{ {
if(p1 == detail.at(i).getId()) if (p1 == detail.at(i).getId())
{ {
p1flag = true; p1flag = true;
} }
if(p2 == detail.at(i).getId()) if (p2 == detail.at(i).getId())
{ {
p2flag = true; p2flag = true;
} }
if(p1flag == true && p2flag == false) if (p1flag == true && p2flag == false)
{ {
return; return;
} }
if(p2flag == true && p1flag == false) if (p2flag == true && p1flag == false)
{ {
qint64 p = p1; qint64 p = p1;
p1 = p2; p1 = p2;
@ -108,7 +108,7 @@ void VToolUnionDetails::AddToNewDetail(VContainer *data, VDetail newDetail, cons
{ {
case (Tool::NodePoint): case (Tool::NodePoint):
{ {
if( qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && (pRotate == 0)) if ( qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && (pRotate == 0))
{ {
id = det.at(i).getId(); id = det.at(i).getId();
} }
@ -125,7 +125,7 @@ void VToolUnionDetails::AddToNewDetail(VContainer *data, VDetail newDetail, cons
break; break;
case (Tool::NodeArc): case (Tool::NodeArc):
{ {
if(qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0)
{ {
id = det.at(i).getId(); id = det.at(i).getId();
} }
@ -156,7 +156,7 @@ void VToolUnionDetails::AddToNewDetail(VContainer *data, VDetail newDetail, cons
break; break;
case (Tool::NodeSpline): case (Tool::NodeSpline):
{ {
if(qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0)
{ {
id = det.at(i).getId(); id = det.at(i).getId();
} }
@ -188,7 +188,7 @@ void VToolUnionDetails::AddToNewDetail(VContainer *data, VDetail newDetail, cons
break; break;
case (Tool::NodeSplinePath): case (Tool::NodeSplinePath):
{ {
if(qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0)
{ {
id = det.at(i).getId(); id = det.at(i).getId();
} }
@ -205,22 +205,26 @@ void VToolUnionDetails::AddToNewDetail(VContainer *data, VDetail newDetail, cons
VPointF *p1 = new VPointF(spline.GetP1()); VPointF *p1 = new VPointF(spline.GetP1());
Q_ASSERT(p1 != 0); Q_ASSERT(p1 != 0);
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle); BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
angle);
qint64 idP1 = data->AddGObject(p1); qint64 idP1 = data->AddGObject(p1);
VPointF p2 = VPointF(spline.GetP2()); VPointF p2 = VPointF(spline.GetP2());
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle); BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
angle);
VPointF p3 = VPointF(spline.GetP3()); VPointF p3 = VPointF(spline.GetP3());
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle); BiasRotatePoint(&p3, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
angle);
VPointF *p4 = new VPointF(spline.GetP4()); VPointF *p4 = new VPointF(spline.GetP4());
Q_ASSERT(p4 != 0); Q_ASSERT(p4 != 0);
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle); BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
angle);
qint64 idP4 = data->AddGObject(p4); qint64 idP4 = data->AddGObject(p4);
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve()); VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve());
if(i==1) if (i==1)
{ {
path->append(VSplinePoint(*p1, splinePath->at(i-1).KAsm1(), spl.GetAngle1(), path->append(VSplinePoint(*p1, splinePath->at(i-1).KAsm1(), spl.GetAngle1(),
splinePath->at(i-1).KAsm1())); splinePath->at(i-1).KAsm1()));
@ -252,7 +256,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
{ {
case (Tool::NodePoint): case (Tool::NodePoint):
{ {
if(qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0)
{ {
++idCount; ++idCount;
} }
@ -268,7 +272,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
break; break;
case (Tool::NodeArc): case (Tool::NodeArc):
{ {
if(qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0)
{ {
++idCount; ++idCount;
} }
@ -281,7 +285,8 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle); BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle);
VPointF *center = new VPointF(arc->GetCenter()); VPointF *center = new VPointF(arc->GetCenter());
Q_ASSERT(center != 0); Q_ASSERT(center != 0);
BiasRotatePoint(center, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle); BiasRotatePoint(center, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
angle);
QLineF l1(center->toQPointF(), p1.toQPointF()); QLineF l1(center->toQPointF(), p1.toQPointF());
QLineF l2(center->toQPointF(), p2.toQPointF()); QLineF l2(center->toQPointF(), p2.toQPointF());
@ -296,7 +301,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
break; break;
case (Tool::NodeSpline): case (Tool::NodeSpline):
{ {
if(qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0)
{ {
++idCount; ++idCount;
} }
@ -329,7 +334,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
break; break;
case (Tool::NodeSplinePath): case (Tool::NodeSplinePath):
{ {
if(qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0)
{ {
++idCount; ++idCount;
} }
@ -346,22 +351,26 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
VPointF *p1 = new VPointF(spline.GetP1()); VPointF *p1 = new VPointF(spline.GetP1());
Q_ASSERT(p1 != 0); Q_ASSERT(p1 != 0);
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle); BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
angle);
qint64 idP1 = data->AddGObject(p1); qint64 idP1 = data->AddGObject(p1);
VPointF p2 = VPointF(spline.GetP2()); VPointF p2 = VPointF(spline.GetP2());
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle); BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
angle);
VPointF p3 = VPointF(spline.GetP3()); VPointF p3 = VPointF(spline.GetP3());
BiasRotatePoint(&p3, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle); BiasRotatePoint(&p3, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
angle);
VPointF *p4 = new VPointF(spline.GetP4()); VPointF *p4 = new VPointF(spline.GetP4());
Q_ASSERT(p4 != 0); Q_ASSERT(p4 != 0);
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(), angle); BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
angle);
qint64 idP4 = data->AddGObject(p4); qint64 idP4 = data->AddGObject(p4);
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve()); VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve());
if(i==1) if (i==1)
{ {
path->append(VSplinePoint(*p1, splinePath->at(i-1).KAsm1(), spl.GetAngle1(), path->append(VSplinePoint(*p1, splinePath->at(i-1).KAsm1(), spl.GetAngle1(),
splinePath->at(i-1).KAsm1())); splinePath->at(i-1).KAsm1()));
@ -386,10 +395,10 @@ void VToolUnionDetails::BiasRotatePoint(VPointF *point, const qreal &dx, const q
{ {
point->setX(point->x()+dx); point->setX(point->x()+dx);
point->setY(point->y()+dy); point->setY(point->y()+dy);
QLineF l(pRotate, point->toQPointF()); QLineF line(pRotate, point->toQPointF());
l.setAngle(angle); line.setAngle(angle);
point->setX(l.p2().x()); point->setX(line.p2().x());
point->setY(l.p2().y()); point->setY(line.p2().y());
} }
void VToolUnionDetails::Create(QSharedPointer<DialogUnionDetails> &dialog, VMainGraphicsScene *scene, VDomDocument *doc, void VToolUnionDetails::Create(QSharedPointer<DialogUnionDetails> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
@ -439,7 +448,7 @@ void VToolUnionDetails::Create(const qint64 _id, const VDetail &d1, const VDetai
} }
if(typeCreation == Tool::FromGui) if (typeCreation == Tool::FromGui)
{ {
//Update corected points //Update corected points
qint64 d1P1 = unionDetails->getD1P1(); qint64 d1P1 = unionDetails->getD1P1();

View File

@ -40,7 +40,8 @@ VItem::VItem (const QPainterPath & path, int numInList, QGraphicsItem * parent )
void VItem::checkItemChange() void VItem::checkItemChange()
{ {
QRectF rect; QRectF rect;
if(paper == 0){ if (paper == 0)
{
qDebug()<<"Don't set paper for detail!!!!"; qDebug()<<"Don't set paper for detail!!!!";
rect = this->scene()->sceneRect(); rect = this->scene()->sceneRect();
} }

View File

@ -32,7 +32,7 @@
VSimpleSpline::VSimpleSpline(qint64 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) VSimpleSpline::VSimpleSpline(qint64 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent)
:QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor) :QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor)
{ {
if(factor == 0) if (factor == 0)
{ {
setPen(QPen(Qt::black, widthHairLine)); setPen(QPen(Qt::black, widthHairLine));
} }
@ -56,7 +56,7 @@ void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
if(factor == 0) if (factor == 0)
{ {
this->setPen(QPen(*currentColor, widthMainLine)); this->setPen(QPen(*currentColor, widthMainLine));
} }
@ -69,7 +69,7 @@ void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
void VSimpleSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void VSimpleSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
if(factor == 0) if (factor == 0)
{ {
this->setPen(QPen(*currentColor, widthHairLine)); this->setPen(QPen(*currentColor, widthHairLine));
} }