Fixed wrong value of arc length. Fixed wrong spline length.

--HG--
branch : develop
This commit is contained in:
dismine 2013-10-13 21:51:59 +03:00
parent b31002df67
commit 1e70aea0db
10 changed files with 18 additions and 31 deletions

View File

@ -454,7 +454,7 @@ void VContainer::AddLengthSpline(const QString &name, const qreal &value){
}
void VContainer::AddLengthArc(const qint64 &center, const qint64 &id){
AddLengthArc(GetNameArc(center, id), GetArc(id).GetLength());
AddLengthArc(GetNameArc(center, id), toMM(GetArc(id).GetLength()));
}
void VContainer::AddLengthArc(const QString &name, const qreal &value){
@ -655,7 +655,7 @@ void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId
first = GetModelingPoint(firstPointId);
second = GetModelingPoint(secondPointId);
}
AddLengthLine(nameLine, QLineF(first.toQPointF(), second.toQPointF()).length()/PrintDPI*25.4);
AddLengthLine(nameLine, toMM(QLineF(first.toQPointF(), second.toQPointF()).length()));
nameLine = GetNameLineAngle(firstPointId, secondPointId, mode);
AddLineAngle(nameLine, QLineF(first.toQPointF(), second.toQPointF()).angle());
}
@ -773,7 +773,7 @@ QString VContainer::GetNameArc(const qint64 &center, const qint64 &id, Draw::Dra
} else {
centerPoint = GetModelingPoint(center);
}
return QString ("Arc(%1)%2").arg(centerPoint.name()).arg(id);
return QString ("Arc_%1_%2").arg(centerPoint.name()).arg(id);
}
void VContainer::AddLengthLine(const QString &name, const qreal &value){
@ -781,20 +781,6 @@ void VContainer::AddLengthLine(const QString &name, const qreal &value){
lengthLines[name] = value;
}
void VContainer::AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId, Draw::Draws mode){
QString nameLine = GetNameSpline(firstPointId, secondPointId, mode);
VPointF first;
VPointF second;
if(mode == Draw::Calculation){
first = GetPoint(firstPointId);
second = GetPoint(secondPointId);
} else {
first = GetModelingPoint(firstPointId);
second = GetModelingPoint(secondPointId);
}
AddLengthSpline(nameLine, toMM(QLineF(first.toQPointF(), second.toQPointF()).length()));
}
void VContainer::CreateManTableIGroup (){
AddStandartTableCell("Pkor", VStandartTableCell(84, 0, 3));
AddStandartTableCell("Pkor", VStandartTableCell(84, 0, 3));

View File

@ -72,8 +72,6 @@ public:
void AddStandartTableCell(const QString& name, const VStandartTableCell& cell);
void AddIncrementTableRow(const QString& name, const VIncrementTableRow &cell);
void AddLengthLine(const QString &name, const qreal &value);
void AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId,
Draw::Draws mode = Draw::Calculation);
void AddLengthSpline(const QString &name, const qreal &value);
void AddLengthArc(const qint64 &center, const qint64 &id);
void AddLengthArc(const QString &name, const qreal &value);

View File

@ -326,8 +326,7 @@ qreal VSpline::LengthBezier ( QPointF p1, QPointF p2, QPointF p3, QPointF p4 ) c
for (qint32 i = 1; i < points.count(); ++i){
splinePath.lineTo(points[i]);
}
qreal length = toMM(splinePath.length());
return length;
return splinePath.length();
}
void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2,

View File

@ -68,7 +68,7 @@ void VToolArc::Create(const qint64 _id, const qint64 &center, const QString &rad
QString errorMsg;
qreal result = cal.eval(radius, &errorMsg);
if(errorMsg.isEmpty()){
calcRadius = result*PrintDPI/25.4;
calcRadius = toPixel(result);
}
errorMsg.clear();
@ -87,10 +87,10 @@ void VToolArc::Create(const qint64 _id, const qint64 &center, const QString &rad
qint64 id = _id;
if(typeCreation == Tool::FromGui){
id = data->AddArc(arc);
data->AddLengthArc(data->GetNameArc(center,id), arc.GetLength());
data->AddLengthArc(data->GetNameArc(center,id), toMM(arc.GetLength()));
} else {
data->UpdateArc(id, arc);
data->AddLengthArc(data->GetNameArc(center,id), arc.GetLength());
data->AddLengthArc(data->GetNameArc(center,id), toMM(arc.GetLength()));
if(parse != Document::FullParse){
doc->UpdateToolData(id, data);
}

View File

@ -94,10 +94,10 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c
qint64 id = _id;
if(typeCreation == Tool::FromGui){
id = data->AddSpline(spline);
data->AddLengthSpline(data->GetNameSpline(p1, p4), spline.GetLength());
data->AddLengthSpline(data->GetNameSpline(p1, p4), toMM(spline.GetLength()));
} else {
data->UpdateSpline(id, spline);
data->AddLengthSpline(data->GetNameSpline(p1, p4), spline.GetLength());
data->AddLengthSpline(data->GetNameSpline(p1, p4), toMM(spline.GetLength()));
if(parse != Document::FullParse){
doc->UpdateToolData(id, data);
}

View File

@ -82,10 +82,10 @@ void VToolSplinePath::Create(const qint64 _id, const VSplinePath &path, VMainGra
qint64 id = _id;
if(typeCreation == Tool::FromGui){
id = data->AddSplinePath(path);
data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength());
data->AddLengthSpline(data->GetNameSplinePath(path), toMM(path.GetLength()));
} else {
data->UpdateSplinePath(id, path);
data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength());
data->AddLengthSpline(data->GetNameSplinePath(path), toMM(path.GetLength()));
if(parse != Document::FullParse){
doc->UpdateToolData(id, data);
}

View File

@ -94,7 +94,7 @@ VModelingArc* VModelingArc::Create(const qint64 _id, const qint64 &center, const
doc->UpdateToolData(id, data);
}
}
data->AddLengthArc(data->GetNameArc(center,id, Draw::Modeling), arc.GetLength());
data->AddLengthArc(data->GetNameArc(center,id, Draw::Modeling), toMM(arc.GetLength()));
if(parse == Document::FullParse){
toolArc = new VModelingArc(doc, data, id, typeCreation);
doc->AddTool(id, toolArc);

View File

@ -102,7 +102,7 @@ VModelingSpline *VModelingSpline::Create(const qint64 _id, const qint64 &p1, con
doc->UpdateToolData(id, data);
}
}
data->AddLengthSpline(data->GetNameSpline(p1, p4, Draw::Modeling), spline.GetLength());
data->AddLengthSpline(data->GetNameSpline(p1, p4, Draw::Modeling), toMM(spline.GetLength()));
if(parse == Document::FullParse){
spl = new VModelingSpline(doc, data, id, typeCreation);
doc->AddTool(id, spl);

View File

@ -89,7 +89,7 @@ VModelingSplinePath * VModelingSplinePath::Create(const qint64 _id, const VSplin
doc->UpdateToolData(id, data);
}
}
data->AddLengthSpline(data->GetNameSplinePath(path), path.GetLength());
data->AddLengthSpline(data->GetNameSplinePath(path), toMM(path.GetLength()));
if(parse == Document::FullParse){
spl = new VModelingSplinePath(doc, data, id, typeCreation);
doc->AddTool(id, spl);

View File

@ -444,15 +444,19 @@ void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsSce
if(!domElement.isNull()){
if(domElement.tagName() == "point"){
ParsePointElement(scene, domElement, parse, domElement.attribute("type", ""), mode);
continue;
}
if(domElement.tagName() == "line"){
ParseLineElement(scene, domElement, parse, mode);
continue;
}
if(domElement.tagName() == "spline"){
ParseSplineElement(scene, domElement, parse, domElement.attribute("type", ""), mode);
continue;
}
if(domElement.tagName() == "arc"){
ParseArcElement(scene, domElement, parse, domElement.attribute("type", ""), mode);
continue;
}
}
}