Refactoring.

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-25 18:43:32 +03:00
parent 1f9c1e623e
commit 2cf032461d
3 changed files with 13 additions and 18 deletions

View File

@ -140,16 +140,17 @@ VToolArc* VToolArc::Create(const quint32 _id, const quint32 &center, QString &ra
if (typeCreation == Source::FromGui) if (typeCreation == Source::FromGui)
{ {
id = data->AddGObject(arc); id = data->AddGObject(arc);
data->AddLengthArc(id);
} }
else else
{ {
data->UpdateGObject(id, arc); data->UpdateGObject(id, arc);
data->AddLengthArc(id);
if (parse != Document::FullParse) if (parse != Document::FullParse)
{ {
doc->UpdateToolData(id, data); doc->UpdateToolData(id, data);
} }
} }
data->AddLengthArc(id);
VDrawTool::AddRecord(id, Tool::ArcTool, doc); VDrawTool::AddRecord(id, Tool::ArcTool, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {

View File

@ -138,36 +138,31 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
quint32 arc2id = 0; quint32 arc2id = 0;
if (typeCreation == Source::FromGui) if (typeCreation == Source::FromGui)
{ {
VPointF *p = new VPointF(point, pointName, mx, my); id = data->AddGObject(new VPointF(point, pointName, mx, my));
id = data->AddGObject(p); arc1id = data->AddGObject(new VArc(arc1));
arc2id = data->AddGObject(new VArc(arc2));
VArc * ar1 = new VArc(arc1); data->AddLengthArc(arc1id);
arc1id = data->AddGObject(ar1); data->AddLengthArc(arc2id);
VArc * ar2 = new VArc(arc2);
arc2id = data->AddGObject(ar2);
} }
else else
{ {
VPointF *p = new VPointF(point, pointName, mx, my); data->UpdateGObject(id, new VPointF(point, pointName, mx, my));
data->UpdateGObject(id, p);
arc1id = id + 1; arc1id = id + 1;
arc2id = id + 2; arc2id = id + 2;
VArc * ar1 = new VArc(arc1); data->UpdateGObject(arc1id, new VArc(arc1));
data->UpdateGObject(arc1id, ar1); data->UpdateGObject(arc2id, new VArc(arc2));
VArc * ar2 = new VArc(arc2); data->AddLengthArc(arc1id);
data->UpdateGObject(arc2id, ar2); data->AddLengthArc(arc2id);
if (parse != Document::FullParse) if (parse != Document::FullParse)
{ {
doc->UpdateToolData(id, data); doc->UpdateToolData(id, data);
} }
} }
data->AddLengthArc(arc1id);
data->AddLengthArc(arc2id);
VDrawTool::AddRecord(id, Tool::CutArcTool, doc); VDrawTool::AddRecord(id, Tool::CutArcTool, doc);
if (parse == Document::FullParse) if (parse == Document::FullParse)

View File

@ -44,8 +44,7 @@
VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id,
const QString &typeLine, const QString &formula, const quint32 &basePointId, const QString &typeLine, const QString &formula, const quint32 &basePointId,
const qreal &angle, QGraphicsItem *parent) const qreal &angle, QGraphicsItem *parent)
:VToolPoint(doc, data, id, parent), formula(formula), angle(angle), basePointId(basePointId), :VToolPoint(doc, data, id, parent), formula(formula), angle(angle), basePointId(basePointId), mainLine(nullptr)
mainLine(nullptr)
{ {
this->typeLine = typeLine; this->typeLine = typeLine;
Q_ASSERT_X(basePointId > 0, Q_FUNC_INFO, "basePointId <= 0"); Q_ASSERT_X(basePointId > 0, Q_FUNC_INFO, "basePointId <= 0");