From d040a656b437c615bf706600f1722cb29798a132 Mon Sep 17 00:00:00 2001 From: "luz.paz" Date: Thu, 7 Feb 2019 07:37:19 -0500 Subject: [PATCH] Typos cont. + whitespace --- src/Mod/Sketcher/Gui/CommandCreateGeo.cpp | 524 +++++++++++----------- 1 file changed, 262 insertions(+), 262 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 4d082a468c..71348bd7f3 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -106,17 +106,17 @@ Base::Vector2d GetCircleCenter (const Base::Vector2d &p1, const Base::Vector2d & double uu = u*u; double vv = v*v; double ww = w*w; - + double uv = -(u*v); double vw = -(v*w); double uw = -(u*w); - + double w0 = (2 * sqrt(uu * ww - uw * uw) * uw / (uu * ww)); double w1 = (2 * sqrt(uu * vv - uv * uv) * uv / (uu * vv)); double w2 = (2 * sqrt(vv * ww - vw * vw) * vw / (vv * ww)); - + double wx = w0 + w1 + w2; - + if( wx == 0) THROWM(Base::ValueError,"Points are collinear"); @@ -167,29 +167,29 @@ void removeRedundantHorizontalVertical(Sketcher::SketchObject* psketch, std::vector &sug2) { if(!sug1.empty() && !sug2.empty()) { - + bool rmvhorvert = false; - + // we look for: // 1. Coincident to external on both endpoints // 2. Coincident in one endpoint to origin and pointonobject/tangent to an axis on the other auto detectredundant = [psketch](std::vector &sug, bool &ext, bool &orig, bool &axis) { - + ext = false; orig = false; axis = false; - + for(std::vector::const_iterator it = sug.begin(); it!=sug.end(); ++it) { if( (*it).Type == Sketcher::Coincident && ext == false) { const std::map coincidents = psketch->getAllCoincidentPoints((*it).GeoId, (*it).PosId); if(!coincidents.empty()) { ext = coincidents.begin()->first < 0; // the keys are ordered, so if the first is negative, it is coincident with external - + std::map::const_iterator geoId1iterator; - + geoId1iterator = coincidents.find(-1); - + if( geoId1iterator != coincidents.end()) { if( (*geoId1iterator).second == Sketcher::start ) orig = true; @@ -203,20 +203,20 @@ void removeRedundantHorizontalVertical(Sketcher::SketchObject* psketch, else if( (*it).Type == Sketcher::PointOnObject && axis == false) { axis = (((*it).GeoId == -1 && (*it).PosId == Sketcher::none) || ((*it).GeoId == -2 && (*it).PosId == Sketcher::none)); } - + } }; - + bool firstext = false, secondext = false, firstorig = false, secondorig = false, firstaxis = false, secondaxis = false; - + detectredundant(sug1, firstext, firstorig, firstaxis); detectredundant(sug2, secondext, secondorig, secondaxis); - - + + rmvhorvert = ((firstext && secondext) || // coincident with external on both endpoints (firstorig && secondaxis) || // coincident origin and point on object on other (secondorig && firstaxis)); - + if(rmvhorvert) { for(std::vector::reverse_iterator it = sug2.rbegin(); it!=sug2.rend(); ++it) { if( (*it).Type == Sketcher::Horizontal || (*it).Type == Sketcher::Vertical) { @@ -365,8 +365,8 @@ public: ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); bool avoidredundant = hGrp->GetBool("AvoidRedundantAutoconstraints",true); - - if(avoidredundant) + + if(avoidredundant) removeRedundantHorizontalVertical(static_cast(sketchgui->getObject()),sugConstr1,sugConstr2); // add auto constraints for the line segment start @@ -393,12 +393,12 @@ public: EditCurve.resize(2); applyCursor(); /* It is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the - * right button of the mouse */ + * right button of the mouse */ } else{ - sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider + sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider } } return true; @@ -630,15 +630,15 @@ public: EditCurve.resize(5); applyCursor(); /* this is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the * right button of the mouse */ } else{ - sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider + sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider } - - + + } return true; } @@ -772,7 +772,7 @@ public: TRANSITION_MODE_Perpendicular_L, TRANSITION_MODE_Perpendicular_R }; - + enum SNAP_MODE { SNAP_MODE_Free, @@ -794,7 +794,7 @@ public: // SEGMENT_MODE_Arc, TRANSITION_MODE_Perpendicular_R SnapMode = SNAP_MODE_Free; - + Base::Vector2d onSketchPos; if (SegmentMode == SEGMENT_MODE_Line) onSketchPos = EditCurve[EditCurve.size()-1]; @@ -911,12 +911,12 @@ public: } } else if (SegmentMode == SEGMENT_MODE_Arc) { - + if(QApplication::keyboardModifiers() == Qt::ControlModifier) SnapMode = SNAP_MODE_45Degree; else SnapMode = SNAP_MODE_Free; - + Base::Vector2d Tangent; if (TransitionMode == TRANSITION_MODE_Tangent) Tangent = Base::Vector2d(dirVec.x,dirVec.y); @@ -959,7 +959,7 @@ public: arcAngle -= 2*M_PI; if (arcRadius < 0 && arcAngle < 0) arcAngle += 2*M_PI; - + if (SnapMode == SNAP_MODE_45Degree) arcAngle = round(arcAngle / (M_PI/4)) * M_PI/4; @@ -997,7 +997,7 @@ public: EditCurve[0] = onSketchPos; // this may be overwritten if previousCurve is found virtualsugConstr1 = sugConstr1; // store original autoconstraints. - + // here we check if there is a preselected point and // we set up a transition from the neighbouring segment. // (peviousCurve, previousPosId, dirVec, TransitionMode) @@ -1037,10 +1037,10 @@ public: resetPositionText(); EditCurve.clear(); sketchgui->drawEdit(EditCurve); - + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); bool continuousMode = hGrp->GetBool("ContinuousCreationMode",true); - + if(continuousMode){ // This code enables the continuous creation mode. Mode=STATUS_SEEK_First; @@ -1055,17 +1055,17 @@ public: EditCurve.clear(); sketchgui->drawEdit(EditCurve); EditCurve.resize(2); - applyCursor(); + applyCursor(); /* this is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the - * right button of the mouse */ + * right button of the mouse */ return true; } else{ sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider return true; - } + } } Mode = STATUS_Do; @@ -1105,7 +1105,7 @@ public: Base::Console().Error("Failed to add line: %s\n", e.what()); Gui::Command::abortCommand(); } - + firstsegment=false; } else if (SegmentMode == SEGMENT_MODE_Arc) { // We're dealing with an Arc @@ -1129,7 +1129,7 @@ public: Base::Console().Error("Failed to add arc: %s\n", e.what()); Gui::Command::abortCommand(); } - + firstsegment=false; } @@ -1173,7 +1173,7 @@ public: tryAutoRecomputeIfNotSolve(static_cast(sketchgui->getObject())); } - + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); bool avoidredundant = hGrp->GetBool("AvoidRedundantAutoconstraints",true); @@ -1198,7 +1198,7 @@ public: createAutoConstraints(sugConstr, getHighestCurveIndex(), Sketcher::end); sugConstr2.clear(); } - + tryAutoRecomputeIfNotSolve(static_cast(sketchgui->getObject())); unsetCursor(); @@ -1224,11 +1224,11 @@ public: EditCurve.clear(); sketchgui->drawEdit(EditCurve); EditCurve.resize(2); - applyCursor(); + applyCursor(); /* this is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the - * right button of the mouse */ + * right button of the mouse */ } else{ sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider @@ -1242,7 +1242,7 @@ public: createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::start); sugConstr1.clear(); } - + if(avoidredundant) { if (SegmentMode == SEGMENT_MODE_Line) { // avoid redundant constraints. @@ -1256,7 +1256,7 @@ public: virtualsugConstr1 = sugConstr2; // these are the initial constraints for the next iteration. if (sugConstr2.size() > 0) { - createAutoConstraints(sugConstr2, getHighestCurveIndex(), + createAutoConstraints(sugConstr2, getHighestCurveIndex(), (SegmentMode == SEGMENT_MODE_Arc && startAngle > endAngle) ? Sketcher::start : Sketcher::end); sugConstr2.clear(); @@ -1292,15 +1292,15 @@ public: } return true; } - + virtual void quit(void) { // We must see if we need to create a B-spline before cancelling everything // and now just like any other Handler, - + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); - + bool continuousMode = hGrp->GetBool("ContinuousCreationMode",true); - + if (firstsegment) { // user when right-clicking with no segment in really wants to exit DrawSketchHandler::quit(); @@ -1329,7 +1329,7 @@ public: } } } - + protected: SELECT_MODE Mode; SEGMENT_MODE SegmentMode; @@ -1343,12 +1343,12 @@ protected: Sketcher::PointPos firstPosId; Sketcher::PointPos previousPosId; // the latter stores those constraints that a first point would have been given in absence of the transition mechanism - std::vector sugConstr1, sugConstr2, virtualsugConstr1; + std::vector sugConstr1, sugConstr2, virtualsugConstr1; Base::Vector2d CenterPoint; Base::Vector3d dirVec; double startAngle, endAngle, arcRadius; - + bool firstsegment; void updateTransitionData(int GeoId, Sketcher::PointPos PosId) { @@ -1544,7 +1544,7 @@ public: SbString text; text.sprintf(" (%.1fR,%.1fdeg)", radius, arcAngle * 180 / M_PI); setPositionText(onSketchPos, text); - + sketchgui->drawEdit(EditCurve); if (seekAutoConstraint(sugConstr3, onSketchPos, Base::Vector2d(0.0,0.0))) { renderSuggestConstraintsCursor(sugConstr3); @@ -1650,12 +1650,12 @@ public: EditCurve.resize(2); applyCursor(); /* this is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the * right button of the mouse */ } else{ - sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider + sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider } } return true; @@ -1807,7 +1807,7 @@ public: */ try { CenterPoint = EditCurve[30] = GetCircleCenter(FirstPoint, SecondPoint, onSketchPos); - + radius = (SecondPoint - CenterPoint).Length(); double angle1 = GetPointAngle(CenterPoint, FirstPoint); @@ -1961,13 +1961,13 @@ public: EditCurve.resize(2); applyCursor(); /* this is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the * right button of the mouse */ } else{ - sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider - } + sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider + } } return true; } @@ -2266,13 +2266,13 @@ public: EditCurve.resize(34); applyCursor(); /* this is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the * right button of the mouse */ } else{ - sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider - } + sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider + } } return true; } @@ -2445,7 +2445,7 @@ public: if (mode == STATUS_SEEK_PERIAPSIS) { setPositionText(onSketchPos); if (seekAutoConstraint(sugConstr1, onSketchPos, Base::Vector2d(0.f,0.f), - AutoConstraint::CURVE)) { + AutoConstraint::CURVE)) { renderSuggestConstraintsCursor(sugConstr1); return; } @@ -3053,7 +3053,7 @@ private: return; } - + Gui::Command::commitCommand(); if (method == CENTER_PERIAPSIS_B) { @@ -3071,12 +3071,12 @@ private: sugConstr3.clear(); } } - + if (method == PERIAPSIS_APOAPSIS_B) { if (sugConstr1.size() > 0) { createAutoConstraints(sugConstr1, currentgeoid, Sketcher::none); sugConstr1.clear(); - } + } if (sugConstr2.size() > 0) { createAutoConstraints(sugConstr2, currentgeoid, Sketcher::none); sugConstr2.clear(); @@ -3099,24 +3099,24 @@ private: } editCurve.clear(); sketchgui->drawEdit(editCurve); - + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); bool continuousMode = hGrp->GetBool("ContinuousCreationMode",true); - + if(continuousMode){ // This code enables the continuous creation mode. editCurve.resize(33); applyCursor(); /* It is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the - * right button of the mouse */ + * right button of the mouse */ } else{ - sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider + sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider } - + } }; @@ -3277,20 +3277,20 @@ public: AutoConstraint::CURVE)) { renderSuggestConstraintsCursor(sugConstr2); return; - } + } } - else if (Mode==STATUS_SEEK_Third) { + else if (Mode==STATUS_SEEK_Third) { // angle between the major axis of the ellipse and the X axis double a = (EditCurve[1]-EditCurve[0]).Length(); double phi = atan2(EditCurve[1].y-EditCurve[0].y,EditCurve[1].x-EditCurve[0].x); - + // This is the angle at cursor point double angleatpoint = acos((onSketchPos.x-EditCurve[0].x+(onSketchPos.y-EditCurve[0].y)*tan(phi))/(a*(cos(phi)+tan(phi)*sin(phi)))); double b=(onSketchPos.y-EditCurve[0].y-a*cos(angleatpoint)*sin(phi))/(sin(angleatpoint)*cos(phi)); - + for (int i=1; i < 16; i++) { double angle = i*M_PI/16.0; - double rx = a * cos(angle) * cos(phi) - b * sin(angle) * sin(phi); + double rx = a * cos(angle) * cos(phi) - b * sin(angle) * sin(phi); double ry = a * cos(angle) * sin(phi) + b * sin(angle) * cos(phi); EditCurve[1+i] = Base::Vector2d(EditCurve[0].x + rx, EditCurve[0].y + ry); EditCurve[17+i] = Base::Vector2d(EditCurve[0].x - rx, EditCurve[0].y - ry); @@ -3313,24 +3313,24 @@ public: // angle between the major axis of the ellipse and the X axis double a = (axisPoint-centerPoint).Length(); double phi = atan2(axisPoint.y-centerPoint.y,axisPoint.x-centerPoint.x); - + // This is the angle at cursor point double angleatpoint = acos((startingPoint.x-centerPoint.x+(startingPoint.y-centerPoint.y)*tan(phi))/(a*(cos(phi)+tan(phi)*sin(phi)))); double b=abs((startingPoint.y-centerPoint.y-a*cos(angleatpoint)*sin(phi))/(sin(angleatpoint)*cos(phi))); - + double rxs = startingPoint.x - centerPoint.x; double rys = startingPoint.y - centerPoint.y; startAngle = atan2(a*(rys*cos(phi)-rxs*sin(phi)), b*(rxs*cos(phi)+rys*sin(phi))); // eccentric anomaly angle - + double angle1 = atan2(a*((onSketchPos.y - centerPoint.y)*cos(phi)-(onSketchPos.x - centerPoint.x)*sin(phi)), b*((onSketchPos.x - centerPoint.x)*cos(phi)+(onSketchPos.y - centerPoint.y)*sin(phi)))- startAngle; - + double angle2 = angle1 + (angle1 < 0. ? 2 : -2) * M_PI ; arcAngle = abs(angle1-arcAngle) < abs(angle2-arcAngle) ? angle1 : angle2; - + for (int i=0; i < 34; i++) { double angle = startAngle+i*arcAngle/34.0; - double rx = a * cos(angle) * cos(phi) - b * sin(angle) * sin(phi); + double rx = a * cos(angle) * cos(phi) - b * sin(angle) * sin(phi); double ry = a * cos(angle) * sin(phi) + b * sin(angle) * cos(phi); EditCurve[i] = Base::Vector2d(centerPoint.x + rx, centerPoint.y + ry); } @@ -3348,9 +3348,9 @@ public: return; } } - - - + + + applyCursor(); } @@ -3360,7 +3360,7 @@ public: EditCurve[0] = onSketchPos; centerPoint = onSketchPos; Mode = STATUS_SEEK_Second; - } + } else if(Mode==STATUS_SEEK_Second) { EditCurve[1] = onSketchPos; axisPoint = onSketchPos; @@ -3371,10 +3371,10 @@ public: arcAngle = 0.; arcAngle_t= 0.; Mode = STATUS_SEEK_Fourth; - } + } else { // Fourth endPoint = onSketchPos; - + Mode = STATUS_Close; } return true; @@ -3386,23 +3386,23 @@ public: if (Mode==STATUS_Close) { unsetCursor(); resetPositionText(); - + // angle between the major axis of the ellipse and the X axisEllipse double a = (axisPoint-centerPoint).Length(); double phi = atan2(axisPoint.y-centerPoint.y,axisPoint.x-centerPoint.x); - + // This is the angle at cursor point double angleatpoint = acos((startingPoint.x-centerPoint.x+(startingPoint.y-centerPoint.y)*tan(phi))/(a*(cos(phi)+tan(phi)*sin(phi)))); double b=abs((startingPoint.y-centerPoint.y-a*cos(angleatpoint)*sin(phi))/(sin(angleatpoint)*cos(phi))); - + double angle1 = atan2(a*((endPoint.y - centerPoint.y)*cos(phi)-(endPoint.x - centerPoint.x)*sin(phi)), b*((endPoint.x - centerPoint.x)*cos(phi)+(endPoint.y - centerPoint.y)*sin(phi)))- startAngle; - + double angle2 = angle1 + (angle1 < 0. ? 2 : -2) * M_PI ; arcAngle = abs(angle1-arcAngle) < abs(angle2-arcAngle) ? angle1 : angle2; - + bool isOriginalArcCCW=true; - + if (arcAngle > 0) endAngle = startAngle + arcAngle; else { @@ -3410,11 +3410,11 @@ public: startAngle += arcAngle; isOriginalArcCCW=false; } - + Base::Vector2d majAxisDir,minAxisDir,minAxisPoint,majAxisPoint; // We always create a CCW ellipse, because we want our XY reference system to be in the +X +Y direction // Our normal will then always be in the +Z axis (local +Z axis of the sketcher) - + if(a>b) { // force second semidiameter to be perpendicular to first semidiamater @@ -3431,7 +3431,7 @@ public: Base::Vector2d perp(minAxisDir.y,-minAxisDir.x); perp.Normalize(); perp.Scale(abs(b)); - majAxisPoint = centerPoint+perp; + majAxisPoint = centerPoint+perp; minAxisPoint = centerPoint+minAxisDir; endAngle += M_PI/2; startAngle += M_PI/2; @@ -3509,13 +3509,13 @@ public: EditCurve.resize(34); applyCursor(); /* this is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the * right button of the mouse */ } else{ - sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider - } + sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider + } } return true; } @@ -3607,7 +3607,7 @@ public: enum SelectMode { STATUS_SEEK_First, /**< enum value ----. */ STATUS_SEEK_Second, /**< enum value ----. */ - STATUS_SEEK_Third, /**< enum value ----. */ + STATUS_SEEK_Third, /**< enum value ----. */ STATUS_SEEK_Fourth, /**< enum value ----. */ STATUS_Close }; @@ -3644,31 +3644,31 @@ public: return; } } - else if (Mode==STATUS_SEEK_Third) { + else if (Mode==STATUS_SEEK_Third) { // angle between the major axis of the hyperbola and the X axis double a = (axisPoint-centerPoint).Length(); double phi = atan2(axisPoint.y-centerPoint.y,axisPoint.x-centerPoint.x); - + // This is the angle at cursor point double angleatpoint = acosh(((onSketchPos.x-centerPoint.x)*cos(phi)+(onSketchPos.y-centerPoint.y)*sin(phi))/a); double b=(onSketchPos.y-centerPoint.y-a*cosh(angleatpoint)*sin(phi))/(sinh(angleatpoint)*cos(phi)); - + if(!boost::math::isnan(b)){ for (int i=15; i >= -15; i--) { // P(U) = O + MajRad*Cosh(U)*XDir + MinRad*Sinh(U)*YDir //double angle = i*M_PI/16.0; double angle=i*angleatpoint/15; - double rx = a * cosh(angle) * cos(phi) - b * sinh(angle) * sin(phi); + double rx = a * cosh(angle) * cos(phi) - b * sinh(angle) * sin(phi); double ry = a * cosh(angle) * sin(phi) + b * sinh(angle) * cos(phi); EditCurve[15+i] = Base::Vector2d(centerPoint.x + rx, centerPoint.y + ry); } - + // Display radius for user SbString text; text.sprintf(" (%.1fR,%.1fR)", a, b); setPositionText(onSketchPos, text); } - + sketchgui->drawEdit(EditCurve); if (seekAutoConstraint(sugConstr3, onSketchPos, Base::Vector2d(0.f,0.f))) { renderSuggestConstraintsCursor(sugConstr3); @@ -3679,25 +3679,25 @@ public: // angle between the major axis of the hyperbola and the X axis double a = (axisPoint-centerPoint).Length(); double phi = atan2(axisPoint.y-centerPoint.y,axisPoint.x-centerPoint.x); - + // This is the angle at cursor point double angleatstartingpoint = acosh(((startingPoint.x-centerPoint.x)*cos(phi)+(startingPoint.y-centerPoint.y)*sin(phi))/a); double b=(startingPoint.y-centerPoint.y-a*cosh(angleatstartingpoint)*sin(phi))/(sinh(angleatstartingpoint)*cos(phi)); - + double startAngle = angleatstartingpoint; - + //double angleatpoint = acosh(((onSketchPos.x-centerPoint.x)*cos(phi)+(onSketchPos.y-centerPoint.y)*sin(phi))/a); - + double angleatpoint = atanh( (((onSketchPos.y-centerPoint.y)*cos(phi)-(onSketchPos.x-centerPoint.x)*sin(phi))*a) / (((onSketchPos.x-centerPoint.x)*cos(phi)+(onSketchPos.y-centerPoint.y)*sin(phi))*b) ); - + /*double angle1 = angleatpoint - startAngle; - + double angle2 = angle1 + (angle1 < 0. ? 2 : -2) * M_PI ; arcAngle = abs(angle1-arcAngle) < abs(angle2-arcAngle) ? angle1 : angle2;*/ - + arcAngle = angleatpoint - startAngle; - + //if(!boost::math::isnan(angle1) && !boost::math::isnan(angle2)){ if (!boost::math::isnan(arcAngle)) { EditCurve.resize(33); @@ -3705,7 +3705,7 @@ public: // P(U) = O + MajRad*Cosh(U)*XDir + MinRad*Sinh(U)*YDir //double angle=i*angleatpoint/16; double angle = startAngle+i*arcAngle/32.0; - double rx = a * cosh(angle) * cos(phi) - b * sinh(angle) * sin(phi); + double rx = a * cosh(angle) * cos(phi) - b * sinh(angle) * sin(phi); double ry = a * cosh(angle) * sin(phi) + b * sinh(angle) * cos(phi); EditCurve[i] = Base::Vector2d(centerPoint.x + rx, centerPoint.y + ry); } @@ -3736,7 +3736,7 @@ public: centerPoint = onSketchPos; EditCurve.resize(2); Mode = STATUS_SEEK_Second; - } + } else if(Mode==STATUS_SEEK_Second) { EditCurve[1] = onSketchPos; axisPoint = onSketchPos; @@ -3748,10 +3748,10 @@ public: arcAngle = 0.; arcAngle_t= 0.; Mode = STATUS_SEEK_Fourth; - } + } else { // Fourth endPoint = onSketchPos; - + Mode = STATUS_Close; } return true; @@ -3762,26 +3762,26 @@ public: if (Mode==STATUS_Close) { unsetCursor(); resetPositionText(); - - + + // angle between the major axis of the hyperbola and the X axis double a = (axisPoint-centerPoint).Length(); double phi = atan2(axisPoint.y-centerPoint.y,axisPoint.x-centerPoint.x); - + // This is the angle at cursor point double angleatstartingpoint = acosh(((startingPoint.x-centerPoint.x)*cos(phi)+(startingPoint.y-centerPoint.y)*sin(phi))/a); double b=(startingPoint.y-centerPoint.y-a*cosh(angleatstartingpoint)*sin(phi))/(sinh(angleatstartingpoint)*cos(phi)); - + double startAngle = angleatstartingpoint; - + //double angleatpoint = acosh(((onSketchPos.x-centerPoint.x)*cos(phi)+(onSketchPos.y-centerPoint.y)*sin(phi))/a); - + double endAngle = atanh( (((endPoint.y-centerPoint.y)*cos(phi)-(endPoint.x-centerPoint.x)*sin(phi))*a) / (((endPoint.x-centerPoint.x)*cos(phi)+(endPoint.y-centerPoint.y)*sin(phi))*b) ); - - + + bool isOriginalArcCCW=true; - + if (arcAngle > 0) endAngle = startAngle + arcAngle; else { @@ -3789,11 +3789,11 @@ public: startAngle += arcAngle; isOriginalArcCCW=false; } - + Base::Vector2d majAxisDir,minAxisDir,minAxisPoint,majAxisPoint; // We always create a CCW hyperbola, because we want our XY reference system to be in the +X +Y direction // Our normal will then always be in the +Z axis (local +Z axis of the sketcher) - + if(a>b) { // force second semidiameter to be perpendicular to first semidiamater @@ -3810,7 +3810,7 @@ public: Base::Vector2d perp(minAxisDir.y,-minAxisDir.x); perp.Normalize(); perp.Scale(abs(b)); - majAxisPoint = centerPoint+perp; + majAxisPoint = centerPoint+perp; minAxisPoint = centerPoint+minAxisDir; endAngle += M_PI/2; startAngle += M_PI/2; @@ -3834,7 +3834,7 @@ public: minAxisPoint.x, minAxisPoint.y, centerPoint.x, centerPoint.y, startAngle, endAngle, - geometryCreationMode==Construction?"True":"False"); + geometryCreationMode==Construction?"True":"False"); currentgeoid++; @@ -3892,12 +3892,12 @@ public: EditCurve.resize(34); applyCursor(); /* It is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the - * right button of the mouse */ + * right button of the mouse */ } else{ - sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider + sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider } } return true; @@ -3934,7 +3934,7 @@ void CmdSketcherCreateArcOfHyperbola::activated(int /*iMsg*/) bool CmdSketcherCreateArcOfHyperbola::isActive(void) { return isCreateGeoActive(getActiveGuiDocument()); -} +} /* XPM */ static const char *cursor_createarcofparabola[]={ @@ -4039,7 +4039,7 @@ public: // 0.f); // This is the angle at cursor point - double u = + double u = ( cos(phi) * (onSketchPos.y - axisPoint.y) - (onSketchPos.x - axisPoint.x) * sin(phi)); for (int i=15; i >= -15; i--) { @@ -4072,12 +4072,12 @@ public: // 0.f); // This is the angle at starting point - double ustartpoint = + double ustartpoint = ( cos(phi) * (startingPoint.y - axisPoint.y) - (startingPoint.x - axisPoint.x) * sin(phi)); double startAngle = ustartpoint; - double u = + double u = ( cos(phi) * (onSketchPos.y - axisPoint.y) - (onSketchPos.x - axisPoint.x) * sin(phi)); @@ -4117,7 +4117,7 @@ public: focusPoint = onSketchPos; EditCurve.resize(2); Mode = STATUS_SEEK_Second; - } + } else if(Mode==STATUS_SEEK_Second) { EditCurve[1] = onSketchPos; axisPoint = onSketchPos; @@ -4129,7 +4129,7 @@ public: arcAngle = 0.; arcAngle_t= 0.; Mode = STATUS_SEEK_Fourth; - } + } else { // Fourth endPoint = onSketchPos; Mode = STATUS_Close; @@ -4145,10 +4145,10 @@ public: double phi = atan2(focusPoint.y-axisPoint.y,focusPoint.x-axisPoint.x); - double ustartpoint = + double ustartpoint = ( cos(phi) * (startingPoint.y - axisPoint.y) - (startingPoint.x - axisPoint.x) * sin(phi)); - double uendpoint = + double uendpoint = ( cos(phi) * (endPoint.y - axisPoint.y) - (endPoint.x - axisPoint.x) * sin(phi)); double startAngle = ustartpoint; @@ -4188,7 +4188,7 @@ public: "App.ActiveDocument.%s.exposeInternalGeometry(%d)", sketchgui->getObject()->getNameInDocument(), currentgeoid); - + } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what()); @@ -4237,12 +4237,12 @@ public: EditCurve.resize(34); applyCursor(); /* It is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the - * right button of the mouse */ + * right button of the mouse */ } else { - sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider + sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider } } return true; @@ -4342,13 +4342,13 @@ Gui::Action * CmdSketcherCompCreateConic::createAction(void) /// @todo replace with correct icon QAction* ellipseBy3Points = pcAction->addAction(QString()); ellipseBy3Points->setIcon(Gui::BitmapFactory().pixmap("Sketcher_CreateEllipse_3points")); - + QAction* arcofellipse = pcAction->addAction(QString()); arcofellipse->setIcon(Gui::BitmapFactory().pixmap("Sketcher_Elliptical_Arc")); - + QAction* arcofhyperbola = pcAction->addAction(QString()); arcofhyperbola->setIcon(Gui::BitmapFactory().pixmap("Sketcher_Hyperbolic_Arc")); - + QAction* arcofparabola = pcAction->addAction(QString()); arcofparabola->setIcon(Gui::BitmapFactory().pixmap("Sketcher_Parabolic_Arc")); @@ -4415,11 +4415,11 @@ void CmdSketcherCompCreateConic::languageChange() QAction* arcofhyperbola = a[3]; arcofhyperbola->setText(QApplication::translate("CmdSketcherCompCreateConic","Arc of hyperbola by center, major radius, endpoints")); arcofhyperbola->setToolTip(QApplication::translate("Sketcher_CreateArcOfHyperbola","Create an arc of hyperbola by its center, major radius, endpoints")); - arcofhyperbola->setStatusTip(QApplication::translate("Sketcher_CreateArcOfHyperbola","Create an arc of hyperbola by its center, major radius, endpoints")); + arcofhyperbola->setStatusTip(QApplication::translate("Sketcher_CreateArcOfHyperbola","Create an arc of hyperbola by its center, major radius, endpoints")); QAction* arcofparabola = a[4]; arcofparabola->setText(QApplication::translate("CmdSketcherCompCreateConic","Arc of parabola by focus, vertex, endpoints")); arcofparabola->setToolTip(QApplication::translate("Sketcher_CreateArcOfParabola","Create an arc of parabola by its focus, vertex, endpoints")); - arcofparabola->setStatusTip(QApplication::translate("Sketcher_CreateArcOfParabola","Create an arc of parabola by its focus, vertex, endpoints")); + arcofparabola->setStatusTip(QApplication::translate("Sketcher_CreateArcOfParabola","Create an arc of parabola by its focus, vertex, endpoints")); } bool CmdSketcherCompCreateConic::isActive(void) @@ -4518,7 +4518,7 @@ public: SbString text; text.sprintf(" (%.1f,%.1fdeg)", length, angle * 180 / M_PI); setPositionText(EditCurve[EditCurve.size()-1], text); - + if (seekAutoConstraint(sugConstr[CurrentConstraint], onSketchPos, Base::Vector2d(0.f,0.f))) { renderSuggestConstraintsCursor(sugConstr[CurrentConstraint]); return; @@ -4538,30 +4538,30 @@ public: // insert circle point for pole, defer internal alignment constraining. try { - + Gui::Command::openCommand("Add Pole circle"); - + //Add pole Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),10),True)", sketchgui->getObject()->getNameInDocument(), EditCurve[0].x,EditCurve[0].y); - + } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what()); Gui::Command::abortCommand(); - + static_cast(sketchgui->getObject())->solve(); - + return false; } - + //Gui::Command::commitCommand(); - + //static_cast(sketchgui->getObject())->solve(); - + FirstPoleGeoId = getHighestCurveIndex(); - + // add auto constraints on pole if (sugConstr[CurrentConstraint].size() > 0) { createAutoConstraints(sugConstr[CurrentConstraint], FirstPoleGeoId, Sketcher::mid, false); @@ -4576,33 +4576,33 @@ public: } else if (Mode == STATUS_SEEK_ADDITIONAL_CONTROLPOINTS) { EditCurve[EditCurve.size()-1] = onSketchPos; - + // check if coincident with first pole for(std::vector::const_iterator it = sugConstr[CurrentConstraint].begin(); it != sugConstr[CurrentConstraint].end(); it++) { if( (*it).Type == Sketcher::Coincident && (*it).GeoId == FirstPoleGeoId && (*it).PosId == Sketcher::mid ) { - + IsClosed = true; } } if (IsClosed) { Mode = STATUS_CLOSE; - + if (ConstrMethod == 1) { // if periodic we do not need the last pole EditCurve.pop_back(); sugConstr.pop_back(); return true; } - - + + } - + // insert circle point for pole, defer internal alignment constraining. try { - + //Gui::Command::openCommand("Add Pole circle"); - + //Add pole double guess = (EditCurve[1]-EditCurve[0]).Length()/6; @@ -4628,7 +4628,7 @@ public: Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),10),True)", sketchgui->getObject()->getNameInDocument(), EditCurve[EditCurve.size()-1].x,EditCurve[EditCurve.size()-1].y); - + if(EditCurve.size() == 2) { Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('Radius',%d,%f)) ", sketchgui->getObject()->getNameInDocument(), FirstPoleGeoId, guess ); @@ -4641,23 +4641,23 @@ public: catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what()); Gui::Command::abortCommand(); - + static_cast(sketchgui->getObject())->solve(); - + return false; } - + //Gui::Command::commitCommand(); - + //static_cast(sketchgui->getObject())->solve(); - + // add auto constraints on pole if (sugConstr[CurrentConstraint].size() > 0) { createAutoConstraints(sugConstr[CurrentConstraint], FirstPoleGeoId + EditCurve.size()-1, Sketcher::mid, false); } - + //static_cast(sketchgui->getObject())->solve(); - + if (!IsClosed) { EditCurve.resize(EditCurve.size() + 1); // add one place for a pole std::vector sugConstrN; @@ -4705,7 +4705,7 @@ public: controlpoints.c_str(), ConstrMethod == 0 ?"False":"True", geometryCreationMode==Construction?"True":"False"); */ - + // {"poles", "mults", "knots", "periodic", "degree", "weights", "CheckRational", NULL}; Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.addGeometry(Part.BSplineCurve" @@ -4740,24 +4740,24 @@ public: // Constraint pole circles to B-spline. std::stringstream cstream; - + cstream << "conList = []\n"; - + for (size_t i = 0; i < EditCurve.size(); i++) { - cstream << "conList.append(Sketcher.Constraint('InternalAlignment:Sketcher::BSplineControlPoint'," << FirstPoleGeoId+i + cstream << "conList.append(Sketcher.Constraint('InternalAlignment:Sketcher::BSplineControlPoint'," << FirstPoleGeoId+i << "," << Sketcher::mid << "," << currentgeoid << "," << i << "))\n"; } - + cstream << "App.ActiveDocument."<< sketchgui->getObject()->getNameInDocument() << ".addConstraint(conList)\n"; - + Gui::Command::doCommand(Gui::Command::Doc, cstream.str().c_str()); - + // for showing the knots on creation Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.exposeInternalGeometry(%d)", sketchgui->getObject()->getNameInDocument(), currentgeoid); - + } catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what()); @@ -4782,27 +4782,27 @@ public: sketchgui->drawEdit(EditCurve); EditCurve.resize(2); applyCursor(); - + sugConstr.clear(); - + std::vector sugConstr1; sugConstr.push_back(sugConstr1); - + CurrentConstraint=0; IsClosed=false; - + /* It is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the - * right button of the mouse */ + * right button of the mouse */ } else{ - sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider + sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider } } return true; } - + virtual void quit(void) { // We must see if we need to create a B-spline before cancelling everything // and now just like any other Handler, @@ -4820,7 +4820,7 @@ public: else if(CurrentConstraint == 1) { // if we just have one point and we can not close anything, then cancel this creation but continue according to continuous mode //sketchgui->getDocument()->undo(1); - + Gui::Command::abortCommand(); tryAutoRecomputeIfNotSolve(static_cast(sketchgui->getObject())); @@ -4835,12 +4835,12 @@ public: sketchgui->drawEdit(EditCurve); EditCurve.resize(2); applyCursor(); - + sugConstr.clear(); - + std::vector sugConstr1; sugConstr.push_back(sugConstr1); - + CurrentConstraint=0; IsClosed=false; } @@ -4849,14 +4849,14 @@ public: DrawSketchHandler::quit(); } } - + protected: SELECT_MODE Mode; std::vector EditCurve; std::vector> sugConstr; - + int CurrentConstraint; int ConstrMethod; bool IsClosed; @@ -5023,12 +5023,12 @@ void CmdSketcherCompCreateBSpline::updateAction(int mode) void CmdSketcherCompCreateBSpline::languageChange() { Command::languageChange(); - + if (!_pcAction) return; Gui::ActionGroup* pcAction = qobject_cast(_pcAction); QList a = pcAction->actions(); - + QAction* bspline = a[0]; bspline->setText(QApplication::translate("Sketcher_CreateBSpline","B-spline by control points")); bspline->setToolTip(QApplication::translate("Sketcher_CreateBSpline","Create a B-spline by control points")); @@ -5121,7 +5121,7 @@ public: } } else if (Mode == STATUS_SEEK_Second || Mode == STATUS_SEEK_Third) { - try + try { if (Mode == STATUS_SEEK_Second) CenterPoint = EditCurve[N+1] = (onSketchPos - FirstPoint)/2 + FirstPoint; @@ -5139,7 +5139,7 @@ public: } // Beginning and end of curve should be exact EditCurve[0] = EditCurve[N] = onSketchPos; - + // Display radius and start angle // This lineAngle will report counter-clockwise from +X, not relatively SbString text; @@ -5253,12 +5253,12 @@ public: EditCurve.resize(2); applyCursor(); /* this is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the * right button of the mouse */ } else{ - sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider + sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider } } return true; @@ -5396,7 +5396,7 @@ bool CmdSketcherCompCreateCircle::isActive(void) { return isCreateGeoActive(getActiveGuiDocument()); } - + // ====================================================================================== @@ -5502,13 +5502,13 @@ public: // This code enables the continuous creation mode. applyCursor(); /* It is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the - * right button of the mouse */ + * right button of the mouse */ } else{ - sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider - } + sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider + } } return true; } @@ -5806,14 +5806,14 @@ public: else if (Mode==STATUS_SEEK_Second) { int secondCurve = GeoId; Base::Vector2d secondPos = onSketchPos; - + Base::Vector3d refPnt1(firstPos.x, firstPos.y, 0.f); Base::Vector3d refPnt2(secondPos.x, secondPos.y, 0.f); - + const Part::Geometry *geom1 = sketchgui->getSketchObject()->getGeometry(firstCurve); double radius = 0; - + if( geom->getTypeId() == Part::GeomLineSegment::getClassTypeId() && geom1->getTypeId() == Part::GeomLineSegment::getClassTypeId()) { // guess fillet radius @@ -5825,7 +5825,7 @@ public: radius = Part::suggestFilletRadius(lineSeg1, lineSeg2, refPnt1, refPnt2); if (radius < 0) return false; - + construction=lineSeg1->Construction && lineSeg2->Construction; } else { // other supported curves @@ -5833,11 +5833,11 @@ public: (sketchgui->getSketchObject()->getGeometry(firstCurve)); const Part::Geometry *geo2 = static_cast (sketchgui->getSketchObject()->getGeometry(secondCurve)); - - construction=geo1->Construction && geo2->Construction; + + construction=geo1->Construction && geo2->Construction; } - - + + int currentgeoid= getHighestCurveIndex(); // create fillet between lines @@ -5868,14 +5868,14 @@ public: } tryAutoRecompute(static_cast(sketchgui->getObject())); - + if(construction) { Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.toggleConstruction(%d) ", sketchgui->getObject()->getNameInDocument(), - currentgeoid+1); + currentgeoid+1); } - + Gui::Selection().clearSelection(); Mode = STATUS_SEEK_First; @@ -6116,7 +6116,7 @@ namespace SketcherGui { geom->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) return true; } - return false; + return false; } void setDisabled(bool isDisabled) { @@ -6351,7 +6351,7 @@ public: } else if (Mode == STATUS_SEEK_Second) { try { Gui::Command::openCommand("Extend edge"); - Gui::Command::doCommand(Gui::Command::Doc, + Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.extend(%d, %f, %d)\n", // GeoId, increment, PointPos sketchgui->getObject()->getNameInDocument(), BaseGeoId, Increment, ExtendFromStart ? Sketcher::start : Sketcher::end); @@ -6378,7 +6378,7 @@ public: EditCurve.resize(2); applyCursor(); /* this is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the * right button of the mouse */ } else{ @@ -6590,7 +6590,7 @@ public: { Q_UNUSED(onSketchPos); /* this is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the * right button of the mouse */ return true; @@ -6614,17 +6614,17 @@ public: sketchgui->getObject()->getNameInDocument(), msg.pObjectName, msg.pSubName); Gui::Command::commitCommand(); - + // adding external geometry does not require a solve() per se (the DoF is the same), // however a solve is required to update the amount of solver geometry, because we only // redraw a changed Sketch if the solver geometry amount is the same as the SkethObject // geometry amount (as this avoids other issues). // This solver is a very low cost one anyway (there is actually nothing to solve). tryAutoRecomputeIfNotSolve(static_cast(sketchgui->getObject())); - + Gui::Selection().clearSelection(); /* this is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the * right button of the mouse */ } @@ -6677,11 +6677,11 @@ namespace SketcherGui { CarbonCopySelection(App::DocumentObject* obj) : Gui::SelectionFilterGate((Gui::SelectionFilter*)0), object(obj) {} - + bool allow(App::Document *pDoc, App::DocumentObject *pObj, const char *sSubName) { Q_UNUSED(sSubName); - + Sketcher::SketchObject *sketch = static_cast(object); sketch->setAllowOtherBody(QApplication::keyboardModifiers() == Qt::ControlModifier || QApplication::keyboardModifiers() == (Qt::ControlModifier | Qt::AltModifier)); sketch->setAllowUnaligned(QApplication::keyboardModifiers() == (Qt::ControlModifier | Qt::AltModifier)); @@ -6721,7 +6721,7 @@ namespace SketcherGui { } return false; } - // Carbon copy only works on sketchs that do not disallowed (e.g. would produce a circular reference) + // Carbon copy only works on sketches that are not disallowed (e.g. would produce a circular reference) return true; } }; @@ -6766,7 +6766,7 @@ static const char *cursor_carboncopy[]={ "..*+...............*.++.........", "..++++++++++++++++++............", "................................"}; - + class DrawSketchHandlerCarbonCopy: public DrawSketchHandler { public: @@ -6775,59 +6775,59 @@ static const char *cursor_carboncopy[]={ { Gui::Selection().rmvSelectionGate(); } - + virtual void activated(ViewProviderSketch *sketchgui) { sketchgui->setAxisPickStyle(false); Gui::MDIView *mdi = Gui::Application::Instance->activeDocument()->getActiveView(); Gui::View3DInventorViewer *viewer; viewer = static_cast(mdi)->getViewer(); - + SoNode* root = viewer->getSceneGraph(); static_cast(root)->selectionRole.setValue(true); - + Gui::Selection().clearSelection(); Gui::Selection().rmvSelectionGate(); Gui::Selection().addSelectionGate(new CarbonCopySelection(sketchgui->getObject())); setCrosshairColor(); setCursor(QPixmap(cursor_carboncopy),7,7); } - + virtual void deactivated(ViewProviderSketch *sketchgui) { sketchgui->setAxisPickStyle(true); } - + virtual void mouseMove(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); if (Gui::Selection().getPreselection().pObjectName) applyCursor(); } - + virtual bool pressButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); return true; } - + virtual bool releaseButton(Base::Vector2d onSketchPos) { Q_UNUSED(onSketchPos); /* this is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the * right button of the mouse */ return true; } - + virtual bool onSelectionChanged(const Gui::SelectionChanges& msg) { if (msg.Type == Gui::SelectionChanges::AddSelection) { App::DocumentObject* obj = sketchgui->getObject()->getDocument()->getObject(msg.pObjectName); if (obj == NULL) throw Base::ValueError("Sketcher: Carbon Copy: Invalid object in selection"); - + if (obj->getTypeId() == Sketcher::SketchObject::getClassTypeId()) { try { @@ -6835,14 +6835,14 @@ static const char *cursor_carboncopy[]={ Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.carbonCopy(\"%s\",%s)", sketchgui->getObject()->getNameInDocument(), msg.pObjectName, geometryCreationMode==Construction?"True":"False"); - + Gui::Command::commitCommand(); - + tryAutoRecomputeIfNotSolve(static_cast(sketchgui->getObject())); - + Gui::Selection().clearSelection(); /* this is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the * right button of the mouse */ } @@ -6856,9 +6856,9 @@ static const char *cursor_carboncopy[]={ return false; } }; - + DEF_STD_CMD_AU(CmdSketcherCarbonCopy); - + CmdSketcherCarbonCopy::CmdSketcherCarbonCopy() : Command("Sketcher_CarbonCopy") { @@ -6872,18 +6872,18 @@ static const char *cursor_carboncopy[]={ sAccel = "C,C"; eType = ForEdit; } - + void CmdSketcherCarbonCopy::activated(int iMsg) { Q_UNUSED(iMsg); ActivateHandler(getActiveGuiDocument(), new DrawSketchHandlerCarbonCopy()); } - + bool CmdSketcherCarbonCopy::isActive(void) { return isCreateGeoActive(getActiveGuiDocument()); } - + void CmdSketcherCarbonCopy::updateAction(int mode) { switch (mode) { @@ -7110,7 +7110,7 @@ public: } ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); bool continuousMode = hGrp->GetBool("ContinuousCreationMode",true); - + if(continuousMode){ // This code enables the continuous creation mode. Mode=STATUS_SEEK_First; @@ -7119,12 +7119,12 @@ public: EditCurve.resize(36); applyCursor(); /* this is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the * right button of the mouse */ } else{ - sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider + sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider } } return true; @@ -7315,7 +7315,7 @@ public: Corners, StartPos.x,StartPos.y,EditCurve[0].x,EditCurve[0].y, geometryCreationMode==Construction?"True":"False"); - + Gui::Command::commitCommand(); // add auto constraints at the center of the polygon @@ -7350,13 +7350,13 @@ public: EditCurve.resize(Corners+1); applyCursor(); /* this is ok not to call to purgeHandler - * in continuous creation mode because the + * in continuous creation mode because the * handler is destroyed by the quit() method on pressing the * right button of the mouse */ } else{ - sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider - } + sketchgui->purgeHandler(); // no code after this line, Handler get deleted in ViewProvider + } } return true; }