fix Coverity issues
This commit is contained in:
parent
40bba1b2e0
commit
de7978434d
|
@ -63,7 +63,8 @@ TaskCreateNodeSet::TaskCreateNodeSet(Fem::FemSetNodesObject *pcObject,QWidget *p
|
|||
tr("Nodes set"),
|
||||
true,
|
||||
parent),
|
||||
pcObject(pcObject)
|
||||
pcObject(pcObject),
|
||||
selectionMode(none)
|
||||
{
|
||||
// we need a separate container widget to add all controls to
|
||||
proxy = new QWidget(this);
|
||||
|
|
|
@ -64,7 +64,7 @@ TYPESYSTEM_SOURCE(Measure::Measurement, Base::BaseClass)
|
|||
|
||||
Measurement::Measurement()
|
||||
{
|
||||
|
||||
measureType = Invalid;
|
||||
}
|
||||
|
||||
Measurement::~Measurement()
|
||||
|
|
|
@ -192,9 +192,9 @@ TaskDatumParameters::TaskDatumParameters(ViewProviderDatum *DatumView,QWidget *p
|
|||
ui->lineRef4->blockSignals(false);
|
||||
ui->listOfModes->blockSignals(false);
|
||||
|
||||
this->iActiveRef = 0;
|
||||
if (pcDatum->Support.getSize() == 0){
|
||||
autoNext = true;
|
||||
this->iActiveRef = 0;
|
||||
} else {
|
||||
autoNext = false;
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ using namespace Gui;
|
|||
|
||||
TaskPocketParameters::TaskPocketParameters(ViewProviderPocket *PocketView,QWidget *parent, bool newObj)
|
||||
: TaskSketchBasedParameters(PocketView, parent, "PartDesign_Pocket",tr("Pocket parameters"))
|
||||
, oldLength(0)
|
||||
{
|
||||
// we need a separate container widget to add all controls to
|
||||
proxy = new QWidget(this);
|
||||
|
|
|
@ -456,25 +456,25 @@ Base::Vector3d SketchObject::getPoint(int GeoId, PointPos PosId) const
|
|||
throw Base::Exception("SketchObject::getPoint. Invalid GeoId was supplied.");
|
||||
const Part::Geometry *geo = getGeometry(GeoId);
|
||||
if (geo->getTypeId() == Part::GeomPoint::getClassTypeId()) {
|
||||
const Part::GeomPoint *p = dynamic_cast<const Part::GeomPoint*>(geo);
|
||||
const Part::GeomPoint *p = static_cast<const Part::GeomPoint*>(geo);
|
||||
if (PosId == start || PosId == mid || PosId == end)
|
||||
return p->getPoint();
|
||||
} else if (geo->getTypeId() == Part::GeomLineSegment::getClassTypeId()) {
|
||||
const Part::GeomLineSegment *lineSeg = dynamic_cast<const Part::GeomLineSegment*>(geo);
|
||||
const Part::GeomLineSegment *lineSeg = static_cast<const Part::GeomLineSegment*>(geo);
|
||||
if (PosId == start)
|
||||
return lineSeg->getStartPoint();
|
||||
else if (PosId == end)
|
||||
return lineSeg->getEndPoint();
|
||||
} else if (geo->getTypeId() == Part::GeomCircle::getClassTypeId()) {
|
||||
const Part::GeomCircle *circle = dynamic_cast<const Part::GeomCircle*>(geo);
|
||||
const Part::GeomCircle *circle = static_cast<const Part::GeomCircle*>(geo);
|
||||
if (PosId == mid)
|
||||
return circle->getCenter();
|
||||
} else if (geo->getTypeId() == Part::GeomEllipse::getClassTypeId()) {
|
||||
const Part::GeomEllipse *ellipse = dynamic_cast<const Part::GeomEllipse*>(geo);
|
||||
const Part::GeomEllipse *ellipse = static_cast<const Part::GeomEllipse*>(geo);
|
||||
if (PosId == mid)
|
||||
return ellipse->getCenter();
|
||||
} else if (geo->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) {
|
||||
const Part::GeomArcOfCircle *aoc = dynamic_cast<const Part::GeomArcOfCircle*>(geo);
|
||||
const Part::GeomArcOfCircle *aoc = static_cast<const Part::GeomArcOfCircle*>(geo);
|
||||
if (PosId == start)
|
||||
return aoc->getStartPoint(/*emulateCCW=*/true);
|
||||
else if (PosId == end)
|
||||
|
@ -482,7 +482,7 @@ Base::Vector3d SketchObject::getPoint(int GeoId, PointPos PosId) const
|
|||
else if (PosId == mid)
|
||||
return aoc->getCenter();
|
||||
} else if (geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()) {
|
||||
const Part::GeomArcOfEllipse *aoc = dynamic_cast<const Part::GeomArcOfEllipse*>(geo);
|
||||
const Part::GeomArcOfEllipse *aoc = static_cast<const Part::GeomArcOfEllipse*>(geo);
|
||||
if (PosId == start)
|
||||
return aoc->getStartPoint(/*emulateCCW=*/true);
|
||||
else if (PosId == end)
|
||||
|
@ -520,7 +520,7 @@ Base::Axis SketchObject::getAxis(int axId) const
|
|||
if ((*geo) && (*geo)->Construction &&
|
||||
(*geo)->getTypeId() == Part::GeomLineSegment::getClassTypeId()) {
|
||||
if (count == axId) {
|
||||
Part::GeomLineSegment *lineSeg = dynamic_cast<Part::GeomLineSegment*>(*geo);
|
||||
Part::GeomLineSegment *lineSeg = static_cast<Part::GeomLineSegment*>(*geo);
|
||||
Base::Vector3d start = lineSeg->getStartPoint();
|
||||
Base::Vector3d end = lineSeg->getEndPoint();
|
||||
return Base::Axis(start, end-start);
|
||||
|
@ -917,8 +917,8 @@ int SketchObject::fillet(int GeoId, PointPos PosId, double radius, bool trim)
|
|||
const Part::Geometry *geo2 = getGeometry(GeoIdList[1]);
|
||||
if (geo1->getTypeId() == Part::GeomLineSegment::getClassTypeId() &&
|
||||
geo2->getTypeId() == Part::GeomLineSegment::getClassTypeId() ) {
|
||||
const Part::GeomLineSegment *lineSeg1 = dynamic_cast<const Part::GeomLineSegment*>(geo1);
|
||||
const Part::GeomLineSegment *lineSeg2 = dynamic_cast<const Part::GeomLineSegment*>(geo2);
|
||||
const Part::GeomLineSegment *lineSeg1 = static_cast<const Part::GeomLineSegment*>(geo1);
|
||||
const Part::GeomLineSegment *lineSeg2 = static_cast<const Part::GeomLineSegment*>(geo2);
|
||||
|
||||
Base::Vector3d midPnt1 = (lineSeg1->getStartPoint() + lineSeg1->getEndPoint()) / 2 ;
|
||||
Base::Vector3d midPnt2 = (lineSeg2->getStartPoint() + lineSeg2->getEndPoint()) / 2 ;
|
||||
|
@ -941,8 +941,8 @@ int SketchObject::fillet(int GeoId1, int GeoId2,
|
|||
const Part::Geometry *geo2 = getGeometry(GeoId2);
|
||||
if (geo1->getTypeId() == Part::GeomLineSegment::getClassTypeId() &&
|
||||
geo2->getTypeId() == Part::GeomLineSegment::getClassTypeId() ) {
|
||||
const Part::GeomLineSegment *lineSeg1 = dynamic_cast<const Part::GeomLineSegment*>(geo1);
|
||||
const Part::GeomLineSegment *lineSeg2 = dynamic_cast<const Part::GeomLineSegment*>(geo2);
|
||||
const Part::GeomLineSegment *lineSeg1 = static_cast<const Part::GeomLineSegment*>(geo1);
|
||||
const Part::GeomLineSegment *lineSeg2 = static_cast<const Part::GeomLineSegment*>(geo2);
|
||||
|
||||
Base::Vector3d filletCenter;
|
||||
if (!Part::findFilletCenter(lineSeg1, lineSeg2, radius, refPnt1, refPnt2, filletCenter))
|
||||
|
@ -1039,7 +1039,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
|||
|
||||
Part::Geometry *geo = geomlist[GeoId];
|
||||
if (geo->getTypeId() == Part::GeomLineSegment::getClassTypeId()) {
|
||||
const Part::GeomLineSegment *lineSeg = dynamic_cast<const Part::GeomLineSegment*>(geo);
|
||||
const Part::GeomLineSegment *lineSeg = static_cast<const Part::GeomLineSegment*>(geo);
|
||||
Base::Vector3d startPnt = lineSeg->getStartPoint();
|
||||
Base::Vector3d endPnt = lineSeg->getEndPoint();
|
||||
Base::Vector3d dir = (endPnt - startPnt).Normalize();
|
||||
|
@ -1192,7 +1192,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
|||
}
|
||||
}
|
||||
} else if (geo->getTypeId() == Part::GeomCircle::getClassTypeId()) {
|
||||
const Part::GeomCircle *circle = dynamic_cast<const Part::GeomCircle*>(geo);
|
||||
const Part::GeomCircle *circle = static_cast<const Part::GeomCircle*>(geo);
|
||||
Base::Vector3d center = circle->getCenter();
|
||||
double theta0 = Base::fmod(atan2(point.y - center.y,point.x - center.x), 2.f*M_PI);
|
||||
if (GeoId1 >= 0 && GeoId2 >= 0) {
|
||||
|
@ -1274,7 +1274,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
|||
return 0;
|
||||
}
|
||||
} else if (geo->getTypeId() == Part::GeomEllipse::getClassTypeId()) {
|
||||
const Part::GeomEllipse *ellipse = dynamic_cast<const Part::GeomEllipse*>(geo);
|
||||
const Part::GeomEllipse *ellipse = static_cast<const Part::GeomEllipse*>(geo);
|
||||
Base::Vector3d center = ellipse->getCenter();
|
||||
double theta0;
|
||||
ellipse->closestParameter(point,theta0);
|
||||
|
@ -1364,7 +1364,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
|||
return 0;
|
||||
}
|
||||
} else if (geo->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) {
|
||||
const Part::GeomArcOfCircle *aoc = dynamic_cast<const Part::GeomArcOfCircle*>(geo);
|
||||
const Part::GeomArcOfCircle *aoc = static_cast<const Part::GeomArcOfCircle*>(geo);
|
||||
Base::Vector3d center = aoc->getCenter();
|
||||
double startAngle, endAngle;
|
||||
aoc->getRange(startAngle, endAngle, /*emulateCCW=*/true);
|
||||
|
@ -1386,8 +1386,8 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
|||
// go through all constraints and replace the point (GeoId,end) with (newGeoId,end)
|
||||
transferConstraints(GeoId, end, newGeoId, end);
|
||||
|
||||
Part::GeomArcOfCircle *aoc1 = dynamic_cast<Part::GeomArcOfCircle*>(geomlist[GeoId]);
|
||||
Part::GeomArcOfCircle *aoc2 = dynamic_cast<Part::GeomArcOfCircle*>(geomlist[newGeoId]);
|
||||
Part::GeomArcOfCircle *aoc1 = static_cast<Part::GeomArcOfCircle*>(geomlist[GeoId]);
|
||||
Part::GeomArcOfCircle *aoc2 = static_cast<Part::GeomArcOfCircle*>(geomlist[newGeoId]);
|
||||
aoc1->setRange(startAngle, startAngle + theta1, /*emulateCCW=*/true);
|
||||
aoc2->setRange(startAngle + theta2, endAngle, /*emulateCCW=*/true);
|
||||
|
||||
|
@ -1487,7 +1487,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
|||
if (theta1 >= 0.001*arcLength && theta1 <= 0.999*arcLength) {
|
||||
if (theta1 > theta0) { // trim arc start
|
||||
delConstraintOnPoint(GeoId, start, false);
|
||||
Part::GeomArcOfCircle *aoc1 = dynamic_cast<Part::GeomArcOfCircle*>(geomlist[GeoId]);
|
||||
Part::GeomArcOfCircle *aoc1 = static_cast<Part::GeomArcOfCircle*>(geomlist[GeoId]);
|
||||
aoc1->setRange(startAngle + theta1, endAngle, /*emulateCCW=*/true);
|
||||
// constrain the trimming point on the corresponding geometry
|
||||
Sketcher::Constraint *newConstr = new Sketcher::Constraint();
|
||||
|
@ -1509,7 +1509,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
|||
}
|
||||
else { // trim arc end
|
||||
delConstraintOnPoint(GeoId, end, false);
|
||||
Part::GeomArcOfCircle *aoc1 = dynamic_cast<Part::GeomArcOfCircle*>(geomlist[GeoId]);
|
||||
Part::GeomArcOfCircle *aoc1 = static_cast<Part::GeomArcOfCircle*>(geomlist[GeoId]);
|
||||
aoc1->setRange(startAngle, startAngle + theta1, /*emulateCCW=*/true);
|
||||
Sketcher::Constraint *newConstr = new Sketcher::Constraint();
|
||||
newConstr->Type = constrType;
|
||||
|
@ -1531,7 +1531,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
|||
}
|
||||
}
|
||||
} else if (geo->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()) {
|
||||
const Part::GeomArcOfEllipse *aoe = dynamic_cast<const Part::GeomArcOfEllipse*>(geo);
|
||||
const Part::GeomArcOfEllipse *aoe = static_cast<const Part::GeomArcOfEllipse*>(geo);
|
||||
Base::Vector3d center = aoe->getCenter();
|
||||
double startAngle, endAngle;
|
||||
aoe->getRange(startAngle, endAngle,/*emulateCCW=*/true);
|
||||
|
@ -1563,8 +1563,8 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
|||
// go through all constraints and replace the point (GeoId,end) with (newGeoId,end)
|
||||
transferConstraints(GeoId, end, newGeoId, end);
|
||||
|
||||
Part::GeomArcOfEllipse *aoe1 = dynamic_cast<Part::GeomArcOfEllipse*>(geomlist[GeoId]);
|
||||
Part::GeomArcOfEllipse *aoe2 = dynamic_cast<Part::GeomArcOfEllipse*>(geomlist[newGeoId]);
|
||||
Part::GeomArcOfEllipse *aoe1 = static_cast<Part::GeomArcOfEllipse*>(geomlist[GeoId]);
|
||||
Part::GeomArcOfEllipse *aoe2 = static_cast<Part::GeomArcOfEllipse*>(geomlist[newGeoId]);
|
||||
aoe1->setRange(startAngle, startAngle + theta1, /*emulateCCW=*/true);
|
||||
aoe2->setRange(startAngle + theta2, endAngle, /*emulateCCW=*/true);
|
||||
|
||||
|
@ -1667,7 +1667,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
|||
if (theta1 >= 0.001*arcLength && theta1 <= 0.999*arcLength) {
|
||||
if (theta1 > theta0) { // trim arc start
|
||||
delConstraintOnPoint(GeoId, start, false);
|
||||
Part::GeomArcOfEllipse *aoe1 = dynamic_cast<Part::GeomArcOfEllipse*>(geomlist[GeoId]);
|
||||
Part::GeomArcOfEllipse *aoe1 = static_cast<Part::GeomArcOfEllipse*>(geomlist[GeoId]);
|
||||
aoe1->setRange(startAngle + theta1, endAngle, /*emulateCCW=*/true);
|
||||
// constrain the trimming point on the corresponding geometry
|
||||
Sketcher::Constraint *newConstr = new Sketcher::Constraint();
|
||||
|
@ -1689,7 +1689,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
|
|||
}
|
||||
else { // trim arc end
|
||||
delConstraintOnPoint(GeoId, end, false);
|
||||
Part::GeomArcOfEllipse *aoe1 = dynamic_cast<Part::GeomArcOfEllipse*>(geomlist[GeoId]);
|
||||
Part::GeomArcOfEllipse *aoe1 = static_cast<Part::GeomArcOfEllipse*>(geomlist[GeoId]);
|
||||
aoe1->setRange(startAngle, startAngle + theta1, /*emulateCCW=*/true);
|
||||
|
||||
if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver
|
||||
|
@ -4090,7 +4090,7 @@ int SketchObject::port_reversedExternalArcs(bool justAnalyze)
|
|||
//we are dealing with a link to an endpoint of external geom
|
||||
Part::Geometry* g = this->ExternalGeo[-geoId-1];
|
||||
if (g->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()){
|
||||
const Part::GeomArcOfCircle *segm = dynamic_cast<const Part::GeomArcOfCircle*>(g);
|
||||
const Part::GeomArcOfCircle *segm = static_cast<const Part::GeomArcOfCircle*>(g);
|
||||
if(segm->isReversedInXY()){
|
||||
//Gotcha! a link to an endpoint of external arc that is reversed.
|
||||
//create a constraint copy, affect it, replace the pointer
|
||||
|
|
Loading…
Reference in New Issue
Block a user