From 70a7e067168671fa56d3cf9f5ba292e6c81a0cb8 Mon Sep 17 00:00:00 2001 From: logari81 Date: Sat, 3 Dec 2011 19:29:58 +0000 Subject: [PATCH] + replace -1 with Constraint::GeoUndef git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5214 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d --- src/Mod/Sketcher/App/SketchObject.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index ddcf3f6b3..51432fd8c 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -330,7 +330,7 @@ int SketchObject::delConstraintOnPoint(int GeoId, PointPos PosId, bool onlyCoinc const std::vector &vals = this->Constraints.getValues(); // check if constraints can be redirected to some other point - int replaceGeoId=-1; + int replaceGeoId=Constraint::GeoUndef; PointPos replacePosId=Sketcher::none; if (!onlyCoincident) { for (std::vector::const_iterator it = vals.begin(); it != vals.end(); ++it) { @@ -354,7 +354,7 @@ int SketchObject::delConstraintOnPoint(int GeoId, PointPos PosId, bool onlyCoinc for (std::vector::const_iterator it = vals.begin(); it != vals.end(); ++it) { if ((*it)->Type == Sketcher::Coincident) { if ((*it)->First == GeoId && (*it)->FirstPos == PosId) { - if (replaceGeoId != -1 && + if (replaceGeoId != Constraint::GeoUndef && (replaceGeoId != (*it)->Second || replacePosId != (*it)->SecondPos)) { // redirect this constraint (*it)->First = replaceGeoId; (*it)->FirstPos = replacePosId; @@ -363,7 +363,7 @@ int SketchObject::delConstraintOnPoint(int GeoId, PointPos PosId, bool onlyCoinc continue; // skip this constraint } else if ((*it)->Second == GeoId && (*it)->SecondPos == PosId) { - if (replaceGeoId != -1 && + if (replaceGeoId != Constraint::GeoUndef && (replaceGeoId != (*it)->First || replacePosId != (*it)->FirstPos)) { // redirect this constraint (*it)->Second = replaceGeoId; (*it)->SecondPos = replacePosId; @@ -382,7 +382,7 @@ int SketchObject::delConstraintOnPoint(int GeoId, PointPos PosId, bool onlyCoinc continue; // skip this constraint } else if ((*it)->First == GeoId && (*it)->FirstPos == PosId) { - if (replaceGeoId != -1) { // redirect this constraint + if (replaceGeoId != Constraint::GeoUndef) { // redirect this constraint (*it)->First = replaceGeoId; (*it)->FirstPos = replacePosId; } @@ -390,7 +390,7 @@ int SketchObject::delConstraintOnPoint(int GeoId, PointPos PosId, bool onlyCoinc continue; // skip this constraint } else if ((*it)->Second == GeoId && (*it)->SecondPos == PosId) { - if (replaceGeoId != -1) { // redirect this constraint + if (replaceGeoId != Constraint::GeoUndef) { // redirect this constraint (*it)->Second = replaceGeoId; (*it)->SecondPos = replacePosId; } @@ -400,7 +400,7 @@ int SketchObject::delConstraintOnPoint(int GeoId, PointPos PosId, bool onlyCoinc } else if ((*it)->Type == Sketcher::PointOnObject) { if ((*it)->First == GeoId && (*it)->FirstPos == PosId) { - if (replaceGeoId != -1) { // redirect this constraint + if (replaceGeoId != Constraint::GeoUndef) { // redirect this constraint (*it)->First = replaceGeoId; (*it)->FirstPos = replacePosId; } @@ -575,7 +575,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) assert(GeoId < int(geomlist.size())); - int GeoId1=-1, GeoId2=-1; + int GeoId1=Constraint::GeoUndef, GeoId2=Constraint::GeoUndef; Base::Vector3d point1, point2; Part2DObject::seekTrimPoints(geomlist, GeoId, point, GeoId1, point1, GeoId2, point2); if (GeoId1 < 0 && GeoId2 >= 0) { @@ -1125,7 +1125,7 @@ void SketchObject::onChanged(const App::Property* prop) void SketchObject::getGeoVertexIndex(int VertexId, int &GeoId, PointPos &PosId) { if (VertexId < 0 || VertexId >= (int)VertexId2GeoId.size()) { - GeoId = -1; + GeoId = Constraint::GeoUndef; PosId = none; return; }