diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp b/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp index 514676295..d005fc90f 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp @@ -90,7 +90,6 @@ TaskFemConstraintPressure::TaskFemConstraintPressure(ViewProviderFemConstraintPr ui->if_pressure->setMaximum(FLOAT_MAX); //1000 because FreeCAD used kPa internally Base::Quantity p = Base::Quantity(1000 * f, Base::Unit::Stress); - double val = p.getValueAs(Base::Quantity::MegaPascal); ui->if_pressure->setValue(p); ui->lw_references->clear(); for (std::size_t i = 0; i < Objects.size(); i++) { diff --git a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp index 2476e6499..034aba98f 100755 --- a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp @@ -418,7 +418,7 @@ std::string ViewProviderFemMesh::getElement(const SoDetail* detail) const else if (detail->getTypeId() == SoPointDetail::getClassTypeId()) { const SoPointDetail* point_detail = static_cast(detail); int idx = point_detail->getCoordinateIndex(); - if (idx < vNodeElementIdx.size()) { + if (idx < static_cast(vNodeElementIdx.size())) { int vertex = vNodeElementIdx[point_detail->getCoordinateIndex()]; str << "Node" << vertex; } @@ -729,14 +729,12 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop, const SMDS_MeshInfo& info = data->GetMeshInfo(); int numTria = info.NbTriangles(); int numQuad = info.NbQuadrangles(); - int numPoly = info.NbPolygons(); int numVolu = info.NbVolumes(); int numTetr = info.NbTetras(); int numHexa = info.NbHexas(); int numPyrd = info.NbPyramids(); int numPris = info.NbPrisms(); - int numHedr = info.NbPolyhedrons(); bool ShowFaces = (numFaces >0 && numVolu == 0); diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index faf15c612..af093df4e 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -2028,7 +2028,7 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 int currentrowfirstgeoid= -1, prevrowstartfirstgeoid = -1, prevfirstgeoid = -1; - Sketcher::PointPos refposId; + Sketcher::PointPos refposId = Sketcher::none; std::map geoIdMap; @@ -2071,7 +2071,6 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 // Handle Geometry if(geocopy->getTypeId() == Part::GeomLineSegment::getClassTypeId()){ Part::GeomLineSegment *geosymline = static_cast(geocopy); - Base::Vector3d sp = geosymline->getStartPoint(); Base::Vector3d ep = geosymline->getEndPoint(); Base::Vector3d ssp = geosymline->getStartPoint()+double(x)*displacement+double(y)*perpendicularDisplacement; @@ -2220,9 +2219,7 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 // add a construction line Part::GeomLineSegment *constrline= new Part::GeomLineSegment(); - - Base::Vector3d spdisp = Vector3d(); // initializes to 0,0,0 - + Base::Vector3d sp = getPoint(refgeoid,refposId)+ ( ( x == 0 )? (double(x)*displacement+double(y-1)*perpendicularDisplacement): (double(x-1)*displacement+double(y)*perpendicularDisplacement)); // position of the reference point diff --git a/src/Mod/Sketcher/Gui/Command.cpp b/src/Mod/Sketcher/Gui/Command.cpp index c1f8770ce..84c65b802 100644 --- a/src/Mod/Sketcher/Gui/Command.cpp +++ b/src/Mod/Sketcher/Gui/Command.cpp @@ -587,9 +587,7 @@ void CmdSketcherMirrorSketch::activated(int iMsg) std::vector tempgeo = tempsketch->getInternalGeometry(); std::vector tempconstr = tempsketch->Constraints.getValues(); - - int nconstraints = tempconstr.size(); - + std::vector mirrorgeo (tempgeo.begin()+addedGeometries+1,tempgeo.end()); std::vector mirrorconstr (tempconstr.begin()+addedConstraints+1,tempconstr.end()); @@ -642,31 +640,29 @@ void CmdSketcherMergeSketches::activated(int iMsg) qApp->translate("CmdSketcherMergeSketches", "Select at least two sketches, please.")); return; } - - Sketcher::SketchObject* Obj1 = static_cast(selection[0].getObject()); - + App::Document* doc = App::GetApplication().getActiveDocument(); - + // create Sketch std::string FeatName = getUniqueObjectName("Sketch"); - + openCommand("Create a merge Sketch"); doCommand(Doc,"App.activeDocument().addObject('Sketcher::SketchObject','%s')",FeatName.c_str()); - + Sketcher::SketchObject* mergesketch = static_cast(doc->getObject(FeatName.c_str())); - + int baseGeometry=0; int baseConstraints=0; - + for (std::vector::const_iterator it=selection.begin(); it != selection.end(); ++it) { const Sketcher::SketchObject* Obj = static_cast((*it).getObject()); int addedGeometries=mergesketch->addGeometry(Obj->getInternalGeometry()); - + int addedConstraints=mergesketch->addConstraints(Obj->Constraints.getValues()); - + for(int i=0; i<=(addedConstraints-baseConstraints); i++){ Sketcher::Constraint * constraint= mergesketch->Constraints.getValues()[i+baseConstraints]; - + if(constraint->First!=Sketcher::Constraint::GeoUndef || constraint->First==-1 || constraint->First==-2) // not x, y axes or origin constraint->First+=baseGeometry; if(constraint->Second!=Sketcher::Constraint::GeoUndef || constraint->Second==-1 || constraint->Second==-2) // not x, y axes or origin @@ -674,13 +670,12 @@ void CmdSketcherMergeSketches::activated(int iMsg) if(constraint->Third!=Sketcher::Constraint::GeoUndef || constraint->Third==-1 || constraint->Third==-2) // not x, y axes or origin constraint->Third+=baseGeometry; } - + baseGeometry=addedGeometries+1; baseConstraints=addedConstraints+1; } - + doCommand(Gui,"App.activeDocument().recompute()"); - } bool CmdSketcherMergeSketches::isActive(void) diff --git a/src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp b/src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp index c8693a213..d174a3462 100644 --- a/src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp +++ b/src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp @@ -126,11 +126,6 @@ void CmdSketcherToggleConstruction::activated(int iMsg) return; } - // make sure the selected object is the sketch in edit mode - const App::DocumentObject* obj = selection[0].getObject(); - ViewProviderSketch* sketchView = static_cast - (Gui::Application::Instance->getViewProvider(obj)); - // undo command open openCommand("Toggle draft from/to draft"); diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index e9a4e6770..e3a593fd3 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -485,7 +485,6 @@ int SketchSelection::setUp(void) std::vector selection = Gui::Selection().getSelectionEx(); Sketcher::SketchObject *SketchObj=0; - Part::Feature *SupportObj=0; std::vector SketchSubNames; std::vector SupportSubNames; @@ -510,7 +509,6 @@ int SketchSelection::setUp(void) } // assume always a Part::Feature derived object as support assert(selection[1].getObject()->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())); - SupportObj = dynamic_cast(selection[1].getObject()); SketchSubNames = selection[0].getSubNames(); SupportSubNames = selection[1].getSubNames(); @@ -523,7 +521,6 @@ int SketchSelection::setUp(void) } // assume always a Part::Feature derived object as support assert(selection[0].getObject()->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())); - SupportObj = dynamic_cast(selection[0].getObject()); SketchSubNames = selection[1].getSubNames(); SupportSubNames = selection[0].getSubNames(); @@ -533,13 +530,6 @@ int SketchSelection::setUp(void) } } - // colect Sketch geos - for ( std::vector::const_iterator it= SketchSubNames.begin();it!=SketchSubNames.end();++it){ - - - } - - return Items.size(); } @@ -1159,7 +1149,7 @@ void CmdSketcherConstrainPointOnObject::activated(int iMsg) //count curves and points std::vector points; std::vector curves; - for (int i = 0 ; i < SubNames.size() ; i++){ + for (std::size_t i = 0 ; i < SubNames.size() ; i++){ SelIdPair id; getIdsFromName(SubNames[i], Obj, id.GeoId, id.PosId); if (isEdge(id.GeoId, id.PosId)) @@ -1173,8 +1163,8 @@ void CmdSketcherConstrainPointOnObject::activated(int iMsg) openCommand("add point on object constraint"); int cnt = 0; - for (int iPnt = 0; iPnt < points.size(); iPnt++) { - for (int iCrv = 0; iCrv < curves.size(); iCrv++) { + for (std::size_t iPnt = 0; iPnt < points.size(); iPnt++) { + for (std::size_t iCrv = 0; iCrv < curves.size(); iCrv++) { if (checkBothExternal(points[iPnt].GeoId, curves[iCrv].GeoId)){ showNoConstraintBetweenExternal(); continue; @@ -1842,9 +1832,9 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) geo1->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId() ) { Base::Vector3d center; - double majord; - double minord; - double phi; + double majord = 0; + double minord = 0; + double phi = 0; if( geo1->getTypeId() == Part::GeomEllipse::getClassTypeId() ){ const Part::GeomEllipse *ellipse = static_cast(geo1); @@ -1866,7 +1856,6 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) const Part::GeomLineSegment *line = static_cast(geo2); Base::Vector3d point1=line->getStartPoint(); - Base::Vector3d point2=line->getEndPoint(); Base::Vector3d direction=point1-center; double tapprox=atan2(direction.y,direction.x)-phi; // we approximate the eccentric anomally by the polar @@ -2300,7 +2289,7 @@ void CmdSketcherConstrainRadius::activated(int iMsg) // Create the non-driving radius constraints now openCommand("Add radius constraint"); commandopened=true; - unsigned int constrSize; + unsigned int constrSize = 0; for (std::vector< std::pair >::iterator it = externalGeoIdRadiusMap.begin(); it != externalGeoIdRadiusMap.end(); ++it) { Gui::Command::doCommand( @@ -3359,6 +3348,8 @@ void CmdSketcherConstrainInternalAlignment::activated(int iMsg) case Sketcher::EllipseFocus2: focus2=true; break; + default: + break; } } } @@ -3521,6 +3512,8 @@ void CmdSketcherConstrainInternalAlignment::activated(int iMsg) case Sketcher::EllipseFocus2: focus2=true; break; + default: + break; } } } @@ -3719,11 +3712,6 @@ void CmdSketcherToggleDrivingConstraint::activated(int iMsg) return; } - // make sure the selected object is the sketch in edit mode - const App::DocumentObject* obj = selection[0].getObject(); - ViewProviderSketch* sketchView = static_cast - (Gui::Application::Instance->getViewProvider(obj)); - // undo command open openCommand("Toggle driving from/to non-driving"); diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index f81636ff3..df5a9b0c5 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -239,15 +239,13 @@ public: if (Mode==STATUS_End){ unsetCursor(); resetPositionText(); - - int currentgeoid= getHighestCurveIndex(); - + Gui::Command::openCommand("Add sketch line"); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)", sketchgui->getObject()->getNameInDocument(), EditCurve[0].fX,EditCurve[0].fY,EditCurve[1].fX,EditCurve[1].fY, geometryCreationMode==Construction?"True":"False"); - + Gui::Command::commitCommand(); // add auto constraints for the line segment start @@ -261,10 +259,10 @@ public: createAutoConstraints(sugConstr2, getHighestCurveIndex(), Sketcher::end); sugConstr2.clear(); } - + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); bool autoRecompute = hGrp->GetBool("AutoRecompute",false); - + if(autoRecompute) Gui::Command::updateActive(); else @@ -272,10 +270,10 @@ public: 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; @@ -1352,7 +1350,6 @@ public: if (Mode==STATUS_End) { unsetCursor(); resetPositionText(); - int currentgeoid= getHighestCurveIndex(); Gui::Command::openCommand("Add sketch arc"); Gui::Command::doCommand(Gui::Command::Doc, @@ -1650,8 +1647,7 @@ public: if (Mode==STATUS_End) { unsetCursor(); resetPositionText(); - int currentgeoid= getHighestCurveIndex(); - + Gui::Command::openCommand("Add sketch arc"); Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.addGeometry(Part.ArcOfCircle" @@ -1958,7 +1954,6 @@ public: double ry = EditCurve[1].fY - EditCurve[0].fY; unsetCursor(); resetPositionText(); - int currentgeoid= getHighestCurveIndex(); Gui::Command::openCommand("Add sketch circle"); Gui::Command::doCommand(Gui::Command::Doc, @@ -3568,7 +3563,6 @@ public: if (Mode==STATUS_End) { unsetCursor(); resetPositionText(); - int currentgeoid= getHighestCurveIndex(); Gui::Command::openCommand("Add sketch circle"); Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.addGeometry(Part.Circle" @@ -3832,8 +3826,6 @@ public: if (selectionDone){ unsetCursor(); resetPositionText(); - - int currentgeoid= getHighestCurveIndex(); Gui::Command::openCommand("Add sketch point"); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Point(App.Vector(%f,%f,0)))", @@ -4993,14 +4985,11 @@ public: virtual bool releaseButton(Base::Vector2D onSketchPos) { - if (Mode==STATUS_End){ unsetCursor(); resetPositionText(); Gui::Command::openCommand("Add hexagon"); - int currentgeoid= getHighestCurveIndex(); - try { Gui::Command::doCommand(Gui::Command::Doc, "import ProfileLib.RegularPolygon\n" @@ -5011,10 +5000,10 @@ public: geometryCreationMode==Construction?"True":"False"); Gui::Command::commitCommand(); - + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); bool autoRecompute = hGrp->GetBool("AutoRecompute",false); - + // add auto constraints at the center of the polygon if (sugConstr1.size() > 0) { createAutoConstraints(sugConstr1, getHighestCurveIndex(), Sketcher::mid); @@ -5026,7 +5015,7 @@ public: createAutoConstraints(sugConstr2, getHighestCurveIndex() - 1, Sketcher::end); sugConstr2.clear(); } - + if(autoRecompute) Gui::Command::updateActive(); else @@ -5035,17 +5024,17 @@ public: catch (const Base::Exception& e) { Base::Console().Error("%s\n", e.what()); Gui::Command::abortCommand(); - + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); bool autoRecompute = hGrp->GetBool("AutoRecompute",false); - + if(autoRecompute) // toggling does not modify the DoF of the solver, however it may affect features depending on the sketch Gui::Command::updateActive(); } - + 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; diff --git a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp index bd0e74840..a7ae8ad5f 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp @@ -634,7 +634,7 @@ void CmdSketcherSelectElementsAssociatedWithConstraints::activated(int iMsg) if (it->size() > 10 && it->substr(0,10) == "Constraint") { int ConstrId = std::atoi(it->substr(10,4000).c_str()) - 1; - if(ConstrId(vals.size())){ if(vals[ConstrId]->First!=Constraint::GeoUndef){ ss.str(std::string()); @@ -743,8 +743,7 @@ void CmdSketcherRestoreInternalAlignmentGeometry::activated(int iMsg) // get the needed lists and objects const std::vector &SubNames = selection[0].getSubNames(); - const std::vector< Sketcher::Constraint * > &vals = Obj->Constraints.getValues(); - + std::string doc_name = Obj->getDocument()->getName(); std::string obj_name = Obj->getNameInDocument(); std::stringstream ss; @@ -770,7 +769,6 @@ void CmdSketcherRestoreInternalAlignmentGeometry::activated(int iMsg) bool minor=false; bool focus1=false; bool focus2=false; - bool extra_elements=false; int majorelementindex=-1; int minorelementindex=-1; @@ -800,6 +798,8 @@ void CmdSketcherRestoreInternalAlignmentGeometry::activated(int iMsg) focus2=true; focus2elementindex=(*it)->First; break; + default: + break; } } } @@ -880,8 +880,6 @@ void CmdSketcherRestoreInternalAlignmentGeometry::activated(int iMsg) int currentgeoid= Obj->getHighestCurveIndex(); int incrgeo= 0; - int majorindex=-1; - int minorindex=-1; Base::Vector3d center; double majord; @@ -926,7 +924,6 @@ void CmdSketcherRestoreInternalAlignmentGeometry::activated(int iMsg) Gui::Command::doCommand(Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('InternalAlignment:EllipseMajorDiameter',%d,%d)) ", selection[0].getFeatName(),currentgeoid+incrgeo+1,GeoId); // constrain major axis - majorindex=currentgeoid+incrgeo+1; incrgeo++; } if(!minor) @@ -937,7 +934,6 @@ void CmdSketcherRestoreInternalAlignmentGeometry::activated(int iMsg) Gui::Command::doCommand(Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('InternalAlignment:EllipseMinorDiameter',%d,%d)) ", selection[0].getFeatName(),currentgeoid+incrgeo+1,GeoId); // constrain minor axis - minorindex=currentgeoid+incrgeo+1; incrgeo++; } if(!focus1) @@ -1026,7 +1022,6 @@ void CmdSketcherSymmetry::activated(int iMsg) // get the needed lists and objects const std::vector &SubNames = selection[0].getSubNames(); - const std::vector< Sketcher::Constraint * > &vals = Obj->Constraints.getValues(); std::string doc_name = Obj->getDocument()->getName(); std::string obj_name = Obj->getNameInDocument(); @@ -1034,9 +1029,7 @@ void CmdSketcherSymmetry::activated(int iMsg) getSelection().clearSelection(); - int nelements = SubNames.size(); - - int LastGeoId; + int LastGeoId = 0; Sketcher::PointPos LastPointPos = Sketcher::none; const Part::Geometry *LastGeo; typedef enum { invalid = -1, line = 0, point = 1 } GeoType; @@ -1235,8 +1228,17 @@ static const char *cursor_createcopy[]={ class DrawSketchHandlerCopy: public DrawSketchHandler { public: - DrawSketchHandlerCopy(string geoidlist, int origingeoid, Sketcher::PointPos originpos, int nelements, bool clone): geoIdList(geoidlist), OriginGeoId (origingeoid), - OriginPos(originpos), nElements(nelements), Clone(clone), Mode(STATUS_SEEK_First), EditCurve(2){} + DrawSketchHandlerCopy(string geoidlist, int origingeoid, Sketcher::PointPos originpos, int nelements, bool clone) + : Mode(STATUS_SEEK_First) + , geoIdList(geoidlist) + , OriginGeoId(origingeoid) + , OriginPos(originpos) + , nElements(nelements) + , Clone(clone) + , EditCurve(2) + { + } + virtual ~DrawSketchHandlerCopy(){} /// mode table enum SelectMode { @@ -1364,19 +1366,16 @@ void SketcherCopy::activate(bool clone) // get the needed lists and objects const std::vector &SubNames = selection[0].getSubNames(); - const std::vector< Sketcher::Constraint * > &vals = Obj->Constraints.getValues(); - + std::string doc_name = Obj->getDocument()->getName(); std::string obj_name = Obj->getNameInDocument(); std::stringstream ss; getSelection().clearSelection(); - - int nelements = SubNames.size(); - - int LastGeoId; + + int LastGeoId = 0; Sketcher::PointPos LastPointPos = Sketcher::none; - const Part::Geometry *LastGeo; + const Part::Geometry *LastGeo = 0; // create python command with list of elements std::stringstream stream; @@ -1670,10 +1669,22 @@ static const char *cursor_createrectangulararray[]={ { public: DrawSketchHandlerRectangularArray(string geoidlist, int origingeoid, Sketcher::PointPos originpos, int nelements, bool clone, - int rows, int cols, bool constraintSeparation, - bool equalVerticalHorizontalSpacing ): geoIdList(geoidlist), OriginGeoId (origingeoid), Clone(clone), - Rows(rows), Cols(cols), ConstraintSeparation(constraintSeparation), EqualVerticalHorizontalSpacing(equalVerticalHorizontalSpacing), - OriginPos(originpos), nElements(nelements), Mode(STATUS_SEEK_First), EditCurve(2){} + int rows, int cols, bool constraintSeparation, + bool equalVerticalHorizontalSpacing ) + : Mode(STATUS_SEEK_First) + , geoIdList(geoidlist) + , OriginGeoId(origingeoid) + , OriginPos(originpos) + , nElements(nelements) + , Clone(clone) + , Rows(rows) + , Cols(cols) + , ConstraintSeparation(constraintSeparation) + , EqualVerticalHorizontalSpacing(equalVerticalHorizontalSpacing) + , EditCurve(2) + { + } + virtual ~DrawSketchHandlerRectangularArray(){} /// mode table enum SelectMode { @@ -1816,19 +1827,16 @@ void CmdSketcherRectangularArray::activated(int iMsg) // get the needed lists and objects const std::vector &SubNames = selection[0].getSubNames(); - const std::vector< Sketcher::Constraint * > &vals = Obj->Constraints.getValues(); - + std::string doc_name = Obj->getDocument()->getName(); std::string obj_name = Obj->getNameInDocument(); std::stringstream ss; getSelection().clearSelection(); - - int nelements = SubNames.size(); - - int LastGeoId; + + int LastGeoId = 0; Sketcher::PointPos LastPointPos = Sketcher::none; - const Part::Geometry *LastGeo; + const Part::Geometry *LastGeo = 0; // create python command with list of elements std::stringstream stream; diff --git a/src/Mod/Sketcher/Gui/SketchMirrorDialog.cpp b/src/Mod/Sketcher/Gui/SketchMirrorDialog.cpp index 48aae92cb..3467c783f 100644 --- a/src/Mod/Sketcher/Gui/SketchMirrorDialog.cpp +++ b/src/Mod/Sketcher/Gui/SketchMirrorDialog.cpp @@ -38,7 +38,10 @@ using namespace SketcherGui; SketchMirrorDialog::SketchMirrorDialog(void) - : QDialog(Gui::getMainWindow()), ui(new Ui_SketchMirrorDialog), RefGeoid(-1), RefPosid(Sketcher::none) + : QDialog(Gui::getMainWindow()) + , RefGeoid(-1) + , RefPosid(Sketcher::none) + , ui(new Ui_SketchMirrorDialog) { ui->setupUi(this); } diff --git a/src/Mod/Sketcher/Gui/SoDatumLabel.cpp b/src/Mod/Sketcher/Gui/SoDatumLabel.cpp index e0aa667df..b168ace77 100644 --- a/src/Mod/Sketcher/Gui/SoDatumLabel.cpp +++ b/src/Mod/Sketcher/Gui/SoDatumLabel.cpp @@ -488,7 +488,7 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action) glHint(GL_LINE_SMOOTH_HINT,GL_NICEST); } // Position for Datum Text Label - float angle; + float angle = 0; SbVec3f textOffset; @@ -533,13 +533,10 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action) // Get magnitude of angle between horizontal angle = atan2f(dir[1],dir[0]); - bool flip=false; if (angle > M_PI_2+M_PI/12) { angle -= (float)M_PI; - flip = true; } else if (angle <= -M_PI_2+M_PI/12) { angle += (float)M_PI; - flip = true; } textOffset = midpos + norm * length + dir * length2; @@ -654,13 +651,10 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action) // Get magnitude of angle between horizontal angle = atan2f(dir[1],dir[0]); - bool flip=false; if (angle > M_PI_2+M_PI/12) { angle -= (float)M_PI; - flip = true; } else if (angle <= -M_PI_2+M_PI/12) { angle += (float)M_PI; - flip = true; } textOffset = pos; diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp b/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp index 68039df55..de1a9a7d6 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstrains.cpp @@ -348,13 +348,11 @@ void TaskSketcherConstrains::on_listWidgetConstraints_itemActivated(QListWidgetI void TaskSketcherConstrains::on_listWidgetConstraints_updateDrivingStatus(QListWidgetItem *item, bool status) { - ConstraintItem *it = dynamic_cast(item); - if (!item) return; - + ConstraintItem *citem = dynamic_cast(item); + if (!citem) return; + Gui::Application::Instance->commandManager().runCommandByName("Sketcher_ToggleDrivingConstraint"); - slotConstraintsChanged(); - } void TaskSketcherConstrains::on_listWidgetConstraints_itemChanged(QListWidgetItem *item) diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index d310432e0..293db3224 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -1011,7 +1011,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor return false; } - bool preselectChanged; + bool preselectChanged = false; if (Mode != STATUS_SELECT_Point && Mode != STATUS_SELECT_Edge && Mode != STATUS_SELECT_Constraint && @@ -1168,9 +1168,6 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2D &toPo const std::vector &constrlist = getSketchObject()->Constraints.getValues(); Constraint *Constr = constrlist[constNum]; - - int intGeoCount = getSketchObject()->getHighestCurveIndex() + 1; - int extGeoCount = getSketchObject()->getExternalGeometryCount(); // with memory allocation const std::vector geomlist = getSketchObject()->getSolvedSketch().extractGeometry(true, true); @@ -2277,7 +2274,7 @@ void ViewProviderSketch::updateColor(void) // Non DatumLabel Nodes will have a material excluding coincident bool hasMaterial = false; - SoMaterial *m; + SoMaterial *m = 0; if (!hasDatumLabel && type != Sketcher::Coincident && type !=InternalAlignment) { hasMaterial = true; m = dynamic_cast(s->getChild(CONSTRAINT_SEPARATOR_INDEX_MATERIAL_OR_DATUMLABEL)); @@ -2306,7 +2303,6 @@ void ViewProviderSketch::updateColor(void) int cGeoId = edit->CurvIdToGeoId[i]; if(cGeoId == constraint->First) { - int indexes=(edit->CurveSet->numVertices[i]); color[i] = SelectColor; break; } @@ -2644,8 +2640,8 @@ void ViewProviderSketch::drawMergedConstraintIcons(IconQueue iconQueue) QImage compositeIcon; float closest = FLT_MAX; // Closest distance between avPos and any icon - SoImage *thisDest; - SoInfo *thisInfo; + SoImage *thisDest = 0; + SoInfo *thisInfo = 0; // Tracks all constraint IDs that are combined into this icon QString idString; @@ -3163,7 +3159,6 @@ Restart: SoSeparator *sep = dynamic_cast(edit->constrGroup->getChild(i)); const Constraint *Constr = *it; - bool major_radius = false; // this is checked in the radius to reuse code // distinquish different constraint types to build up switch (Constr->Type) { case Horizontal: // write the new position of the Horizontal constraint Same as vertical position. @@ -3786,7 +3781,6 @@ Restart: const Part::GeomArcOfCircle *arc = dynamic_cast(geo); p0 = Base::convertTo(arc->getCenter()); - Base::Vector3d dir = arc->getEndPoint(/*emulateCCWXY=*/true)-arc->getStartPoint(/*emulateCCWXY=*/true); arc->getRange(startangle, endangle,/*emulateCCWXY=*/true); range = endangle - startangle; }