Fixed wrong value of arc length. Fixed wrong spline length.
--HG-- branch : develop
This commit is contained in:
parent
b31002df67
commit
1e70aea0db
|
@ -454,7 +454,7 @@ void VContainer::AddLengthSpline(const QString &name, const qreal &value){
|
|||
}
|
||||
|
||||
void VContainer::AddLengthArc(const qint64 ¢er, 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 ¢er, 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));
|
||||
|
|
|
@ -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 ¢er, const qint64 &id);
|
||||
void AddLengthArc(const QString &name, const qreal &value);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -68,7 +68,7 @@ void VToolArc::Create(const qint64 _id, const qint64 ¢er, 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 ¢er, 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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ VModelingArc* VModelingArc::Create(const qint64 _id, const qint64 ¢er, 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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user