+ fix various warnings with gcc

This commit is contained in:
wmayer 2015-09-01 19:29:39 +02:00
parent 9426a77690
commit 979d1299cc
12 changed files with 92 additions and 134 deletions

View File

@ -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++) {

View File

@ -418,7 +418,7 @@ std::string ViewProviderFemMesh::getElement(const SoDetail* detail) const
else if (detail->getTypeId() == SoPointDetail::getClassTypeId()) {
const SoPointDetail* point_detail = static_cast<const SoPointDetail*>(detail);
int idx = point_detail->getCoordinateIndex();
if (idx < vNodeElementIdx.size()) {
if (idx < static_cast<int>(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);

View File

@ -2028,7 +2028,7 @@ int SketchObject::addCopy(const std::vector<int> &geoIdList, const Base::Vector3
int currentrowfirstgeoid= -1, prevrowstartfirstgeoid = -1, prevfirstgeoid = -1;
Sketcher::PointPos refposId;
Sketcher::PointPos refposId = Sketcher::none;
std::map<int, int> geoIdMap;
@ -2071,7 +2071,6 @@ int SketchObject::addCopy(const std::vector<int> &geoIdList, const Base::Vector3
// Handle Geometry
if(geocopy->getTypeId() == Part::GeomLineSegment::getClassTypeId()){
Part::GeomLineSegment *geosymline = static_cast<Part::GeomLineSegment *>(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<int> &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

View File

@ -587,9 +587,7 @@ void CmdSketcherMirrorSketch::activated(int iMsg)
std::vector<Part::Geometry *> tempgeo = tempsketch->getInternalGeometry();
std::vector<Sketcher::Constraint *> tempconstr = tempsketch->Constraints.getValues();
int nconstraints = tempconstr.size();
std::vector<Part::Geometry *> mirrorgeo (tempgeo.begin()+addedGeometries+1,tempgeo.end());
std::vector<Sketcher::Constraint *> 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<Sketcher::SketchObject*>(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<Sketcher::SketchObject*>(doc->getObject(FeatName.c_str()));
int baseGeometry=0;
int baseConstraints=0;
for (std::vector<Gui::SelectionObject>::const_iterator it=selection.begin(); it != selection.end(); ++it) {
const Sketcher::SketchObject* Obj = static_cast<const Sketcher::SketchObject*>((*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)

View File

@ -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<ViewProviderSketch*>
(Gui::Application::Instance->getViewProvider(obj));
// undo command open
openCommand("Toggle draft from/to draft");

View File

@ -485,7 +485,6 @@ int SketchSelection::setUp(void)
std::vector<Gui::SelectionObject> selection = Gui::Selection().getSelectionEx();
Sketcher::SketchObject *SketchObj=0;
Part::Feature *SupportObj=0;
std::vector<std::string> SketchSubNames;
std::vector<std::string> 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<Part::Feature*>(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<Part::Feature*>(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<std::string>::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<SelIdPair> points;
std::vector<SelIdPair> 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<const Part::GeomEllipse *>(geo1);
@ -1866,7 +1856,6 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg)
const Part::GeomLineSegment *line = static_cast<const Part::GeomLineSegment *>(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<int, double> >::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<ViewProviderSketch*>
(Gui::Application::Instance->getViewProvider(obj));
// undo command open
openCommand("Toggle driving from/to non-driving");

View File

@ -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;

View File

@ -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(ConstrId < static_cast<int>(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<std::string> &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<std::string> &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<std::string> &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<std::string> &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;

View File

@ -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);
}

View File

@ -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;

View File

@ -348,13 +348,11 @@ void TaskSketcherConstrains::on_listWidgetConstraints_itemActivated(QListWidgetI
void TaskSketcherConstrains::on_listWidgetConstraints_updateDrivingStatus(QListWidgetItem *item, bool status)
{
ConstraintItem *it = dynamic_cast<ConstraintItem*>(item);
if (!item) return;
ConstraintItem *citem = dynamic_cast<ConstraintItem*>(item);
if (!citem) return;
Gui::Application::Instance->commandManager().runCommandByName("Sketcher_ToggleDrivingConstraint");
slotConstraintsChanged();
}
void TaskSketcherConstrains::on_listWidgetConstraints_itemChanged(QListWidgetItem *item)

View File

@ -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<Sketcher::Constraint *> &constrlist = getSketchObject()->Constraints.getValues();
Constraint *Constr = constrlist[constNum];
int intGeoCount = getSketchObject()->getHighestCurveIndex() + 1;
int extGeoCount = getSketchObject()->getExternalGeometryCount();
// with memory allocation
const std::vector<Part::Geometry *> 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<SoMaterial *>(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<SoSeparator *>(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<const Part::GeomArcOfCircle *>(geo);
p0 = Base::convertTo<SbVec3f>(arc->getCenter());
Base::Vector3d dir = arc->getEndPoint(/*emulateCCWXY=*/true)-arc->getStartPoint(/*emulateCCWXY=*/true);
arc->getRange(startangle, endangle,/*emulateCCWXY=*/true);
range = endangle - startangle;
}