diff --git a/src/container/vcontainer.cpp b/src/container/vcontainer.cpp index c83d2f3fe..9cc2f9419 100644 --- a/src/container/vcontainer.cpp +++ b/src/container/vcontainer.cpp @@ -223,6 +223,7 @@ QVector VContainer::CorrectEquidistantPoints(const QVector &po qWarning()<<"Only three points."; return points; } + //Clear equivalent points for(qint32 i = 0; i VContainer::CorrectEquidistantPoints(const QVector &po correctPoints.append(points.at(i)); } } + if(correctPoints.size()<3) + { + return correctPoints; + } + //Remove point on line + QPointF point; + for(qint32 i = 1; i VArc::GetPoints() const { QVector points; qreal i = 0; - qreal angle = qRound(AngleArc()); + qreal angle = AngleArc(); + qint32 k = static_cast(angle); + qreal s = angle/(k/4); do { QLineF line(center.toQPointF(), GetP1()); line.setAngle(line.angle()+i); points.append(line.p2()); - i = i + 0.1; + i = i + s; + if(i > angle) + { + QLineF line(center.toQPointF(), GetP1()); + line.setAngle(line.angle()+angle); + points.append(line.p2()); + } } while(i <= angle); return points; diff --git a/src/tools/vtooldetail.cpp b/src/tools/vtooldetail.cpp index 97a457680..72d6b4de4 100644 --- a/src/tools/vtooldetail.cpp +++ b/src/tools/vtooldetail.cpp @@ -247,8 +247,7 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const { domElement.setAttribute(AttrMx, QString().setNum(toMM(newPos.x()))); domElement.setAttribute(AttrMy, QString().setNum(toMM(newPos.y()))); - //I don't now why but signal does not work. - doc->FullUpdateTree(); + doc->haveLiteChange(); } } diff --git a/src/tools/vtooluniondetails.cpp b/src/tools/vtooluniondetails.cpp index e3c3c1630..c81edeb96 100644 --- a/src/tools/vtooluniondetails.cpp +++ b/src/tools/vtooluniondetails.cpp @@ -105,6 +105,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai QLineF l1(center->toQPointF(), p1.toQPointF()); QLineF l2(center->toQPointF(), p2.toQPointF()); + center->setMode(Draw::Modeling); qint64 idCenter = data->AddGObject(center); Q_UNUSED(idCenter); VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), @@ -112,12 +113,12 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai QString().setNum(l2.angle())); Q_ASSERT(arc1 != 0); arc1->setMode(Draw::Modeling); - id = data->AddGObject(arc1); + idObject = data->AddGObject(arc1); VArc *arc2 = new VArc(*arc1); Q_ASSERT(arc2 != 0); arc2->setMode(Draw::Modeling); - idObject = data->AddGObject(arc2); + id = data->AddGObject(arc2); VNodeArc::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool); } @@ -242,7 +243,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c { case (Tool::NodePoint): { - if (qFuzzyCompare(dx+1, 1) == false && qFuzzyCompare(dy+1, 1) == false && pRotate != 0) + if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0) { VPointF *point = new VPointF(*data->GeometricObject(det.at(i).getId())); Q_ASSERT(point != 0); @@ -257,7 +258,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c break; case (Tool::NodeArc): { - if (qFuzzyCompare(dx+1, 1) == false && qFuzzyCompare(dy+1, 1) == false && pRotate != 0) + if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0) { const VArc *arc = data->GeometricObject(det.at(i).getId()); VPointF p1 = VPointF(arc->GetP1()); @@ -272,6 +273,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c QLineF l1(center->toQPointF(), p1.toQPointF()); QLineF l2(center->toQPointF(), p2.toQPointF()); ++idCount; + center->setMode(Draw::Modeling); data->UpdateGObject(idDetail+idCount, center); VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(), QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle())); @@ -286,7 +288,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c break; case (Tool::NodeSpline): { - if (qFuzzyCompare(dx+1, 1) == false && qFuzzyCompare(dy+1, 1) == false && pRotate != 0) + if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0) { const VSpline *spline = data->GeometricObject(det.at(i).getId()); @@ -320,7 +322,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c break; case (Tool::NodeSplinePath): { - if (qFuzzyCompare(dx+1, 1) == false && qFuzzyCompare(dy+1, 1) == false && pRotate != 0) + if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0) { VSplinePath *path = new VSplinePath(); Q_ASSERT(path != 0); diff --git a/src/xml/vdomdocument.cpp b/src/xml/vdomdocument.cpp index 631402833..395cdbb87 100644 --- a/src/xml/vdomdocument.cpp +++ b/src/xml/vdomdocument.cpp @@ -1314,7 +1314,6 @@ void VDomDocument::FullUpdateTree() Q_ASSERT(scene != 0); try { - data->ClearGObjects(); Parse(Document::LiteParse, scene, scene); } catch (const std::bad_alloc &)