TechDraw: modernize type checking

This commit is contained in:
Florian Foinant-Willig
2023-10-15 21:39:03 +02:00
parent 0193e20b26
commit 24352a7f4c
22 changed files with 56 additions and 58 deletions

View File

@@ -114,7 +114,7 @@ void DrawViewCollection::rebuildViewList()
std::vector<App::DocumentObject*> newViews;
std::vector<App::DocumentObject*> children = getOutList();
for (std::vector<App::DocumentObject*>::iterator it = children.begin(); it != children.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(DrawView::getClassTypeId())) {
if ((*it)->isDerivedFrom<DrawView>()) {
bool found = false;
for (auto& v:currViews) {
if (v == (*it)) {
@@ -140,7 +140,7 @@ int DrawViewCollection::countChildren()
const std::vector<App::DocumentObject *> &views = Views.getValues();
for(std::vector<App::DocumentObject *>::const_iterator it = views.begin(); it != views.end(); ++it) {
if((*it)->getTypeId().isDerivedFrom(TechDraw::DrawViewCollection::getClassTypeId())) {
if((*it)->isDerivedFrom<TechDraw::DrawViewCollection>()) {
TechDraw::DrawViewCollection *viewCollection = static_cast<TechDraw::DrawViewCollection *>(*it);
numChildren += viewCollection->countChildren() + 1;
} else {