VContainer no more create names of VArc, VSpline and VSplinePath.

--HG--
branch : develop
This commit is contained in:
dismine 2013-11-12 15:04:18 +02:00
parent 8aea1ee3f3
commit 2621e70645
9 changed files with 12 additions and 78 deletions

View File

@ -511,9 +511,9 @@ void VContainer::AddLengthSpline(const QString &name, const qreal &value)
lengthSplines[name] = value;
}
void VContainer::AddLengthArc(const qint64 &center, 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 &center, 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);

View File

@ -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 &center, 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 &center, 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);

View File

@ -101,7 +101,6 @@ void DialogSplinePath::DialogAccepted()
path.append( qvariant_cast<VSplinePoint>(item->data(Qt::UserRole)));
}
path.setKCurve(ui->doubleSpinBoxKcurve->value());
path.setName(data->GetNameSplinePath(path, mode));
emit ToolTip("");
emit DialogClosed(QDialog::Accepted);
}

View File

@ -97,12 +97,12 @@ void VToolArc::Create(const qint64 _id, const qint64 &center, 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);

View File

@ -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);

View File

@ -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);

View File

@ -102,7 +102,7 @@ VModelingArc* VModelingArc::Create(const qint64 _id, const qint64 &center, 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);

View File

@ -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);

View File

@ -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);