From 8c5ea079d75376c0e786379a82fbd58d857f79e5 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 30 Mar 2015 21:04:44 +0300 Subject: [PATCH] Additional checkings. --HG-- branch : develop --- src/app/geometry/vdetail.cpp | 2 +- src/app/tools/vtooluniondetails.cpp | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/app/geometry/vdetail.cpp b/src/app/geometry/vdetail.cpp index 217d437e6..e1ae4ee30 100644 --- a/src/app/geometry/vdetail.cpp +++ b/src/app/geometry/vdetail.cpp @@ -308,7 +308,7 @@ VDetail VDetail::RemoveEdge(const quint32 &index) const int j2 = this->indexOfNode(p2.getId()); if (j2 == 0) { - j2 = this->CountNode()-1; + j2 = this->CountNode(); } for (int j=j1; jsetMode(Draw::Modeling); const QSharedPointer splinePath = data->GeometricObject(det.at(i).getId()); qint32 k = splinePath->getMaxCountPoints(); + SCASSERT (k >= 3) for (qint32 i = 1; i <= splinePath->Count(); ++i) { VSpline spline(splinePath->at(i-1).P(), splinePath->at(i).P(), @@ -209,22 +210,18 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer splinePath->at(i).KAsm1(), splinePath->GetKCurve()); VPointF *p1 = new VPointF(spline.GetP1()); - BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), - angle); + BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); //quint32 idP1 = data->AddGObject(p1); --k; VPointF p2 = VPointF(spline.GetP2()); - BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), - angle); + BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); VPointF p3 = VPointF(spline.GetP3()); - BiasRotatePoint(&p3, dx, dy, data->GeometricObject(pRotate)->toQPointF(), - angle); + BiasRotatePoint(&p3, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); VPointF *p4 = new VPointF(spline.GetP4()); - BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), - angle); + BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); //quint32 idP4 = data->AddGObject(p4); --k; @@ -595,7 +592,7 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d det1p1.getId(), angle); ++pointsD2; ++j; - } while (pointsD2 <= countNodeD2-skip); + } while (pointsD2 < countNodeD2-skip); } } while (i < countNodeD1); @@ -638,7 +635,7 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d UpdatePoints(id, data, d2.RemoveEdge(indexD2), j, idCount, dx, dy, det1p1.getId(), angle); ++pointsD2; ++j; - } while (pointsD2 <= countNodeD2-skip); + } while (pointsD2 < countNodeD2-skip); } } while (i