PartDesign: modernize type checking
This commit is contained in:
@@ -151,7 +151,7 @@ void ShapeBinder::getFilteredReferences(const App::PropertyLinkSubList* prop,
|
||||
//we only allow one part feature, so get the first one we find
|
||||
size_t index = 0;
|
||||
for (auto* it : objs) {
|
||||
if (it && it->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (it && it->isDerivedFrom<Part::Feature>()) {
|
||||
obj = static_cast<Part::Feature*>(it);
|
||||
break;
|
||||
}
|
||||
@@ -182,11 +182,11 @@ void ShapeBinder::getFilteredReferences(const App::PropertyLinkSubList* prop,
|
||||
else {
|
||||
// search for Origin features
|
||||
for (auto* it : objs) {
|
||||
if (it && it->getTypeId().isDerivedFrom(App::Line::getClassTypeId())) {
|
||||
if (it && it->isDerivedFrom<App::Line>()) {
|
||||
obj = static_cast<App::GeoFeature*>(it);
|
||||
break;
|
||||
}
|
||||
else if (it && it->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) {
|
||||
else if (it && it->isDerivedFrom<App::Plane>()) {
|
||||
obj = static_cast<App::GeoFeature*>(it);
|
||||
break;
|
||||
}
|
||||
@@ -199,7 +199,7 @@ Part::TopoShape ShapeBinder::buildShapeFromReferences(App::GeoFeature* obj, std:
|
||||
if (!obj)
|
||||
return TopoDS_Shape();
|
||||
|
||||
if (obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (obj->isDerivedFrom<Part::Feature>()) {
|
||||
Part::Feature* part = static_cast<Part::Feature*>(obj);
|
||||
if (subs.empty())
|
||||
return part->Shape.getValue();
|
||||
@@ -224,14 +224,14 @@ Part::TopoShape ShapeBinder::buildShapeFromReferences(App::GeoFeature* obj, std:
|
||||
return cmp;
|
||||
}
|
||||
}
|
||||
else if (obj->getTypeId().isDerivedFrom(App::Line::getClassTypeId())) {
|
||||
else if (obj->isDerivedFrom<App::Line>()) {
|
||||
gp_Lin line;
|
||||
BRepBuilderAPI_MakeEdge mkEdge(line);
|
||||
Part::TopoShape shape(mkEdge.Shape());
|
||||
shape.setPlacement(obj->Placement.getValue());
|
||||
return shape;
|
||||
}
|
||||
else if (obj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) {
|
||||
else if (obj->isDerivedFrom<App::Plane>()) {
|
||||
gp_Pln plane;
|
||||
BRepBuilderAPI_MakeFace mkFace(plane);
|
||||
Part::TopoShape shape(mkFace.Shape());
|
||||
@@ -273,7 +273,7 @@ void ShapeBinder::slotChangedObject(const App::DocumentObject& Obj, const App::P
|
||||
return;
|
||||
if (!TraceSupport.getValue())
|
||||
return;
|
||||
if (!Prop.getTypeId().isDerivedFrom(App::PropertyPlacement::getClassTypeId()))
|
||||
if (!Prop.isDerivedFrom<App::PropertyPlacement>())
|
||||
return;
|
||||
|
||||
App::GeoFeature* obj = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user