Fem: modernize type checking

This commit is contained in:
Florian Foinant-Willig
2023-10-15 21:39:02 +02:00
parent 24352a7f4c
commit 41080dec5b
10 changed files with 26 additions and 30 deletions

View File

@@ -603,7 +603,7 @@ App::DocumentObject* getObjectByType(const Base::Type type)
if (obj->getTypeId() == type) {
return obj;
}
if (obj->getTypeId() == FemAnalysis::getClassTypeId()) {
if (obj->is<FemAnalysis>()) {
std::vector<App::DocumentObject*> fem = (static_cast<FemAnalysis*>(obj))->Group.getValues();
for (const auto& it : fem) {
if (it->getTypeId().isDerivedFrom(type)) {
@@ -624,7 +624,7 @@ App::DocumentObject* createObjectByType(const Base::Type type)
}
App::DocumentObject* obj = pcDoc->getActiveObject();
if (obj->getTypeId() == FemAnalysis::getClassTypeId()) {
if (obj->is<FemAnalysis>()) {
App::DocumentObject* newobj = pcDoc->addObject(type.getName());
static_cast<FemAnalysis*>(obj)->addObject(newobj);
return newobj;