[TD] App: remove some superfluous nullptr checks
This commit is contained in:
@@ -70,7 +70,7 @@ std::vector<TopoDS_Shape> ShapeExtractor::getShapes2d(const std::vector<App::Doc
|
||||
}
|
||||
for (auto& l:links) {
|
||||
const App::GroupExtension* gex = dynamic_cast<const App::GroupExtension*>(l);
|
||||
if (gex != nullptr) {
|
||||
if (gex) {
|
||||
std::vector<App::DocumentObject*> objs = gex->Group.getValues();
|
||||
for (auto& d: objs) {
|
||||
if (is2dObject(d)) {
|
||||
@@ -213,7 +213,7 @@ std::vector<TopoDS_Shape> ShapeExtractor::getXShapes(const App::Link* xLink)
|
||||
} else {
|
||||
int depth = 1; //0 is default value, related to recursion of Links???
|
||||
App::DocumentObject* link = xLink->getLink(depth);
|
||||
if (link != nullptr) {
|
||||
if (link) {
|
||||
auto shape = Part::Feature::getShape(link);
|
||||
if(!shape.IsNull()) {
|
||||
if (needsTransform) {
|
||||
@@ -259,7 +259,7 @@ std::vector<TopoDS_Shape> ShapeExtractor::getShapesFromObject(const App::Documen
|
||||
return result;
|
||||
}
|
||||
|
||||
} else if (gex != nullptr) { //is a group extension
|
||||
} else if (gex) { //is a group extension
|
||||
std::vector<App::DocumentObject*> objs = gex->Group.getValues();
|
||||
std::vector<TopoDS_Shape> shapes;
|
||||
for (auto& d: objs) {
|
||||
@@ -269,9 +269,9 @@ std::vector<TopoDS_Shape> ShapeExtractor::getShapesFromObject(const App::Documen
|
||||
}
|
||||
}
|
||||
//the next 2 bits are mostly for Arch module objects
|
||||
} else if (gProp != nullptr) { //has a Group property
|
||||
} else if (gProp) { //has a Group property
|
||||
App::PropertyLinkList* list = dynamic_cast<App::PropertyLinkList*>(gProp);
|
||||
if (list != nullptr) {
|
||||
if (list) {
|
||||
std::vector<App::DocumentObject*> objs = list->getValues();
|
||||
std::vector<TopoDS_Shape> shapes;
|
||||
for (auto& d: objs) {
|
||||
@@ -283,9 +283,9 @@ std::vector<TopoDS_Shape> ShapeExtractor::getShapesFromObject(const App::Documen
|
||||
} else {
|
||||
Base::Console().Log("SE::getShapesFromObject - Group is not a PropertyLinkList!\n");
|
||||
}
|
||||
} else if (sProp != nullptr) { //has a Shape property
|
||||
} else if (sProp) { //has a Shape property
|
||||
Part::PropertyPartShape* shape = dynamic_cast<Part::PropertyPartShape*>(sProp);
|
||||
if (shape != nullptr) {
|
||||
if (shape) {
|
||||
TopoDS_Shape occShape = shape->getValue();
|
||||
result.push_back(occShape);
|
||||
} else {
|
||||
@@ -392,7 +392,7 @@ bool ShapeExtractor::isDraftPoint(App::DocumentObject* obj)
|
||||
bool result = false;
|
||||
//if the docObj doesn't have a Proxy property, it definitely isn't a Draft point
|
||||
App::PropertyPythonObject* proxy = dynamic_cast<App::PropertyPythonObject*>(obj->getPropertyByName("Proxy"));
|
||||
if (proxy != nullptr) {
|
||||
if (proxy) {
|
||||
std::string pp = proxy->toString();
|
||||
// Base::Console().Message("SE::isDraftPoint - pp: %s\n", pp.c_str());
|
||||
if (pp.find("Point") != std::string::npos) {
|
||||
@@ -414,7 +414,7 @@ Base::Vector3d ShapeExtractor::getLocation3dFromFeat(App::DocumentObject* obj)
|
||||
// //if Draft option "use part primitives" is not set are Draft points still PartFeature?
|
||||
|
||||
Part::Feature* pf = dynamic_cast<Part::Feature*>(obj);
|
||||
if (pf != nullptr) {
|
||||
if (pf) {
|
||||
Part::TopoShape pts = pf->Shape.getShape();
|
||||
pts.setPlacement(pf->globalPlacement());
|
||||
TopoDS_Shape ts = pts.getShape();
|
||||
|
||||
Reference in New Issue
Block a user