From 2621e7064519a186de76e6bd68811ed4e732314b Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 12 Nov 2013 15:04:18 +0200 Subject: [PATCH] VContainer no more create names of VArc, VSpline and VSplinePath. --HG-- branch : develop --- container/vcontainer.cpp | 63 +-------------------- container/vcontainer.h | 8 +-- dialogs/dialogsplinepath.cpp | 1 - tools/drawTools/vtoolarc.cpp | 4 +- tools/drawTools/vtoolspline.cpp | 4 +- tools/drawTools/vtoolsplinepath.cpp | 4 +- tools/modelingTools/vmodelingarc.cpp | 2 +- tools/modelingTools/vmodelingspline.cpp | 2 +- tools/modelingTools/vmodelingsplinepath.cpp | 2 +- 9 files changed, 12 insertions(+), 78 deletions(-) diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index 5a50e0d95..eee1923cc 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -511,9 +511,9 @@ void VContainer::AddLengthSpline(const QString &name, const qreal &value) lengthSplines[name] = value; } -void VContainer::AddLengthArc(const qint64 ¢er, const qint64 &id) +void VContainer::AddLengthArc(const qint64 &id) { - AddLengthArc(GetNameArc(center, id), toMM(GetArc(id).GetLength())); + AddLengthArc(GetArc(id).name(), toMM(GetArc(id).GetLength())); } void VContainer::AddLengthArc(const QString &name, const qreal &value) @@ -705,65 +705,6 @@ QString VContainer::GetNameLineAngle(const qint64 &firstPoint, const qint64 &sec return QString("AngleLine_%1_%2").arg(first.name(), second.name()); } -QString VContainer::GetNameSpline(const qint64 &firstPoint, const qint64 &secondPoint, const Draw::Draws &mode) const -{ - VPointF first; - VPointF second; - if (mode == Draw::Calculation) - { - first = GetPoint(firstPoint); - second = GetPoint(secondPoint); - } - else - { - first = GetModelingPoint(firstPoint); - second = GetModelingPoint(secondPoint); - } - return QString("Spl_%1_%2").arg(first.name(), second.name()); -} - -QString VContainer::GetNameSplinePath(const VSplinePath &path, const Draw::Draws &mode) const -{ - if (path.Count() == 0) - { - return QString(); - } - QString name("SplPath"); - for (qint32 i = 1; i <= path.Count(); ++i) - { - VSpline spl = path.GetSpline(i); - VPointF first; - VPointF second; - if (mode == Draw::Calculation) - { - first = GetPoint(spl.GetP1()); - second = GetPoint(spl.GetP4()); - } - else - { - first = GetModelingPoint(spl.GetP1()); - second = GetModelingPoint(spl.GetP4()); - } - QString splName = QString("_%1_%2").arg(first.name(), second.name()); - name.append(splName); - } - return name; -} - -QString VContainer::GetNameArc(const qint64 ¢er, const qint64 &id, const Draw::Draws &mode) const -{ - VPointF centerPoint; - if (mode == Draw::Calculation) - { - centerPoint = GetPoint(center); - } - else - { - centerPoint = GetModelingPoint(center); - } - return QString ("Arc_%1_%2").arg(centerPoint.name()).arg(id); -} - void VContainer::UpdatePoint(qint64 id, const VPointF &point) { UpdateObject(points, id, point); diff --git a/container/vcontainer.h b/container/vcontainer.h index 1173fbc23..7e135f4c8 100644 --- a/container/vcontainer.h +++ b/container/vcontainer.h @@ -73,7 +73,7 @@ public: {incrementTable[name] = cell;} void AddLengthLine(const QString &name, const qreal &value); void AddLengthSpline(const QString &name, const qreal &value); - void AddLengthArc(const qint64 ¢er, const qint64 &id); + void AddLengthArc(const qint64 &id); void AddLengthArc(const QString &name, const qreal &value); void AddLineAngle(const QString &name, const qreal &value); void AddLine(const qint64 &firstPointId, const qint64 &secondPointId, @@ -88,12 +88,6 @@ public: const Draw::Draws &mode = Draw::Calculation) const; QString GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint, const Draw::Draws &mode = Draw::Calculation) const; - QString GetNameSpline(const qint64 &firstPoint, const qint64 &secondPoint, - const Draw::Draws &mode = Draw::Calculation) const; - QString GetNameSplinePath(const VSplinePath &path, - const Draw::Draws &mode = Draw::Calculation) const; - QString GetNameArc(const qint64 ¢er, const qint64 &id, - const Draw::Draws &mode = Draw::Calculation) const; void UpdatePoint(qint64 id, const VPointF& point); void UpdateModelingPoint(qint64 id, const VPointF& point); void UpdateDetail(qint64 id, const VDetail& detail); diff --git a/dialogs/dialogsplinepath.cpp b/dialogs/dialogsplinepath.cpp index 132e12179..76efb8bd8 100644 --- a/dialogs/dialogsplinepath.cpp +++ b/dialogs/dialogsplinepath.cpp @@ -101,7 +101,6 @@ void DialogSplinePath::DialogAccepted() path.append( qvariant_cast(item->data(Qt::UserRole))); } path.setKCurve(ui->doubleSpinBoxKcurve->value()); - path.setName(data->GetNameSplinePath(path, mode)); emit ToolTip(""); emit DialogClosed(QDialog::Accepted); } diff --git a/tools/drawTools/vtoolarc.cpp b/tools/drawTools/vtoolarc.cpp index 1e3940aa9..6d249cf06 100644 --- a/tools/drawTools/vtoolarc.cpp +++ b/tools/drawTools/vtoolarc.cpp @@ -97,12 +97,12 @@ void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &rad if (typeCreation == Tool::FromGui) { id = data->AddArc(arc); - data->AddLengthArc(data->GetNameArc(center, id), toMM(arc.GetLength())); + data->AddLengthArc(arc.name(), toMM(arc.GetLength())); } else { data->UpdateArc(id, arc); - data->AddLengthArc(data->GetNameArc(center, id), toMM(arc.GetLength())); + data->AddLengthArc(arc.name(), toMM(arc.GetLength())); if (parse != Document::FullParse) { doc->UpdateToolData(id, data); diff --git a/tools/drawTools/vtoolspline.cpp b/tools/drawTools/vtoolspline.cpp index c2324bbe3..65b3c4f7a 100644 --- a/tools/drawTools/vtoolspline.cpp +++ b/tools/drawTools/vtoolspline.cpp @@ -100,12 +100,12 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c if (typeCreation == Tool::FromGui) { id = data->AddSpline(spline); - data->AddLengthSpline(data->GetNameSpline(p1, p4), toMM(spline.GetLength())); + data->AddLengthSpline(spline.name(), toMM(spline.GetLength())); } else { data->UpdateSpline(id, spline); - data->AddLengthSpline(data->GetNameSpline(p1, p4), toMM(spline.GetLength())); + data->AddLengthSpline(spline.name(), toMM(spline.GetLength())); if (parse != Document::FullParse) { doc->UpdateToolData(id, data); diff --git a/tools/drawTools/vtoolsplinepath.cpp b/tools/drawTools/vtoolsplinepath.cpp index 230b9a696..1fc91c843 100644 --- a/tools/drawTools/vtoolsplinepath.cpp +++ b/tools/drawTools/vtoolsplinepath.cpp @@ -90,12 +90,12 @@ void VToolSplinePath::Create(const qint64 _id, const VSplinePath &path, VMainGra if (typeCreation == Tool::FromGui) { id = data->AddSplinePath(path); - data->AddLengthSpline(data->GetNameSplinePath(path), toMM(path.GetLength())); + data->AddLengthSpline(path.name(), toMM(path.GetLength())); } else { data->UpdateSplinePath(id, path); - data->AddLengthSpline(data->GetNameSplinePath(path), toMM(path.GetLength())); + data->AddLengthSpline(path.name(), toMM(path.GetLength())); if (parse != Document::FullParse) { doc->UpdateToolData(id, data); diff --git a/tools/modelingTools/vmodelingarc.cpp b/tools/modelingTools/vmodelingarc.cpp index f1ca4c913..6a64019a2 100644 --- a/tools/modelingTools/vmodelingarc.cpp +++ b/tools/modelingTools/vmodelingarc.cpp @@ -102,7 +102,7 @@ VModelingArc* VModelingArc::Create(const qint64 _id, const qint64 ¢er, const doc->UpdateToolData(id, data); } } - data->AddLengthArc(data->GetNameArc(center, id, Draw::Modeling), toMM(arc.GetLength())); + data->AddLengthArc(arc.name(), toMM(arc.GetLength())); if (parse == Document::FullParse) { toolArc = new VModelingArc(doc, data, id, typeCreation); diff --git a/tools/modelingTools/vmodelingspline.cpp b/tools/modelingTools/vmodelingspline.cpp index 5806b5fc2..65ea14951 100644 --- a/tools/modelingTools/vmodelingspline.cpp +++ b/tools/modelingTools/vmodelingspline.cpp @@ -109,7 +109,7 @@ VModelingSpline *VModelingSpline::Create(const qint64 _id, const qint64 &p1, con doc->UpdateToolData(id, data); } } - data->AddLengthSpline(data->GetNameSpline(p1, p4, Draw::Modeling), toMM(spline.GetLength())); + data->AddLengthSpline(spline.name(), toMM(spline.GetLength())); if (parse == Document::FullParse) { spl = new VModelingSpline(doc, data, id, typeCreation); diff --git a/tools/modelingTools/vmodelingsplinepath.cpp b/tools/modelingTools/vmodelingsplinepath.cpp index 975b8acd8..9706fbfd7 100644 --- a/tools/modelingTools/vmodelingsplinepath.cpp +++ b/tools/modelingTools/vmodelingsplinepath.cpp @@ -100,7 +100,7 @@ VModelingSplinePath * VModelingSplinePath::Create(const qint64 _id, const VSplin doc->UpdateToolData(id, data); } } - data->AddLengthSpline(data->GetNameSplinePath(path), toMM(path.GetLength())); + data->AddLengthSpline(path.name(), toMM(path.GetLength())); if (parse == Document::FullParse) { spl = new VModelingSplinePath(doc, data, id, typeCreation);