TechDraw: modernize type checking

This commit is contained in:
Florian Foinant-Willig
2023-10-15 21:39:03 +02:00
parent 464ffa7e73
commit 1d8a51b47b
22 changed files with 56 additions and 58 deletions

View File

@@ -877,8 +877,7 @@ gp_Ax2 DrawComplexSection::getCSFromBase(const std::string sectionName) const
// Base::Console().Message("DCS::getCSFromBase()\n");
App::DocumentObject* base = BaseView.getValue();
if (!base
|| !base->getTypeId().isDerivedFrom(
TechDraw::DrawViewPart::getClassTypeId())) {//is second clause necessary?
|| !base->isDerivedFrom<TechDraw::DrawViewPart>()) {//is second clause necessary?
//if this DCS does not have a baseView, we must use the existing SectionCS
return getSectionCS();
}
@@ -966,7 +965,7 @@ bool DrawComplexSection::isBaseValid() const
//complex section is not based on an existing DVP
return true;
}
if (!base->getTypeId().isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) {
if (!base->isDerivedFrom<TechDraw::DrawViewPart>()) {
//this is probably an error somewhere. the valid options are base = a DVP,
//or no base
return false;

View File

@@ -183,7 +183,7 @@ DrawProjGroup* DrawProjGroupItem::getPGroup() const
{
std::vector<App::DocumentObject*> parent = getInList();
for (std::vector<App::DocumentObject*>::iterator it = parent.begin(); it != parent.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(DrawProjGroup::getClassTypeId())) {
if ((*it)->isDerivedFrom<DrawProjGroup>()) {
DrawProjGroup* result = dynamic_cast<TechDraw::DrawProjGroup *>(*it);
return result;
}

View File

@@ -86,7 +86,7 @@ DrawPage* DrawTemplate::getParentPage() const
TechDraw::DrawPage* page(nullptr);
std::vector<App::DocumentObject*> parents = getInList();
for (auto& obj : parents) {
if (obj->getTypeId().isDerivedFrom(DrawPage::getClassTypeId())) {
if (obj->isDerivedFrom<DrawPage>()) {
page = static_cast<TechDraw::DrawPage *>(obj);
break;
}

View File

@@ -303,7 +303,7 @@ int DrawView::countParentPages() const
parentAll.erase(last, parentAll.end());
for (auto& parent : parentAll) {
if (parent->getTypeId().isDerivedFrom(DrawPage::getClassTypeId())) {
if (parent->isDerivedFrom<DrawPage>()) {
count++;
}
}
@@ -320,9 +320,9 @@ DrawPage* DrawView::findParentPage() const
DrawViewCollection *collection = nullptr;
std::vector<App::DocumentObject*> parentsAll = getInList();
for (auto& parent : parentsAll) {
if (parent->getTypeId().isDerivedFrom(DrawPage::getClassTypeId())) {
if (parent->isDerivedFrom<DrawPage>()) {
page = static_cast<TechDraw::DrawPage *>(parent);
} else if (parent->getTypeId().isDerivedFrom(DrawViewCollection::getClassTypeId())) {
} else if (parent->isDerivedFrom<DrawViewCollection>()) {
collection = static_cast<TechDraw::DrawViewCollection *>(parent);
page = collection->findParentPage();
}
@@ -344,9 +344,9 @@ std::vector<DrawPage*> DrawView::findAllParentPages() const
std::vector<App::DocumentObject*> parentsAll = getInList();
for (auto& parent : parentsAll) {
if (parent->getTypeId().isDerivedFrom(DrawPage::getClassTypeId())) {
if (parent->isDerivedFrom<DrawPage>()) {
page = static_cast<TechDraw::DrawPage*>(parent);
} else if (parent->getTypeId().isDerivedFrom(DrawViewCollection::getClassTypeId())) {
} else if (parent->isDerivedFrom<DrawViewCollection>()) {
collection = static_cast<TechDraw::DrawViewCollection *>(parent);
page = collection->findParentPage();
}
@@ -368,7 +368,7 @@ bool DrawView::isInClip()
{
std::vector<App::DocumentObject*> parent = getInList();
for (std::vector<App::DocumentObject*>::iterator it = parent.begin(); it != parent.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(DrawViewClip::getClassTypeId())) {
if ((*it)->isDerivedFrom<DrawViewClip>()) {
return true;
}
}
@@ -380,7 +380,7 @@ DrawViewClip* DrawView::getClipGroup()
std::vector<App::DocumentObject*> parent = getInList();
App::DocumentObject* obj = nullptr;
for (std::vector<App::DocumentObject*>::iterator it = parent.begin(); it != parent.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(DrawViewClip::getClassTypeId())) {
if ((*it)->isDerivedFrom<DrawViewClip>()) {
obj = (*it);
DrawViewClip* result = dynamic_cast<DrawViewClip*>(obj);
return result;
@@ -486,7 +486,7 @@ std::vector<TechDraw::DrawLeaderLine*> DrawView::getLeaders() const
std::vector<TechDraw::DrawLeaderLine*> result;
std::vector<App::DocumentObject*> children = getInList();
for (std::vector<App::DocumentObject*>::iterator it = children.begin(); it != children.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(DrawLeaderLine::getClassTypeId())) {
if ((*it)->isDerivedFrom<DrawLeaderLine>()) {
TechDraw::DrawLeaderLine* lead = dynamic_cast<TechDraw::DrawLeaderLine*>(*it);
result.push_back(lead);
}

View File

@@ -113,7 +113,7 @@ App::DocumentObjectExecReturn *DrawViewClip::execute()
std::vector<App::DocumentObject*> children = Views.getValues();
for (std::vector<App::DocumentObject*>::iterator it = children.begin(); it != children.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(DrawView::getClassTypeId())) {
if ((*it)->isDerivedFrom<DrawView>()) {
TechDraw::DrawView *view = static_cast<TechDraw::DrawView *>(*it);
view->requestPaint();
}
@@ -142,7 +142,7 @@ std::vector<std::string> DrawViewClip::getChildViewNames()
std::vector<std::string> childNames;
std::vector<App::DocumentObject*> children = Views.getValues();
for (std::vector<App::DocumentObject*>::iterator it = children.begin(); it != children.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(DrawView::getClassTypeId())) {
if ((*it)->isDerivedFrom<DrawView>()) {
std::string name = (*it)->getNameInDocument();
childNames.push_back(name);
}

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 {

View File

@@ -141,7 +141,7 @@ App::DocumentObjectExecReturn* DrawViewDetail::execute()
return DrawView::execute();
}
if (!baseObj->getTypeId().isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) {
if (!baseObj->isDerivedFrom<TechDraw::DrawViewPart>()) {
//this can only happen via scripting?
return DrawView::execute();
}

View File

@@ -723,7 +723,7 @@ std::vector<TechDraw::DrawHatch*> DrawViewPart::getHatches() const
std::vector<TechDraw::DrawHatch*> result;
std::vector<App::DocumentObject*> children = getInList();
for (auto& child : children) {
if (child->getTypeId().isDerivedFrom(DrawHatch::getClassTypeId()) && !child->isRemoving()) {
if (child->isDerivedFrom<DrawHatch>() && !child->isRemoving()) {
TechDraw::DrawHatch* hatch = dynamic_cast<TechDraw::DrawHatch*>(child);
result.push_back(hatch);
}
@@ -737,7 +737,7 @@ std::vector<TechDraw::DrawGeomHatch*> DrawViewPart::getGeomHatches() const
std::vector<TechDraw::DrawGeomHatch*> result;
std::vector<App::DocumentObject*> children = getInList();
for (auto& child : children) {
if (child->getTypeId().isDerivedFrom(DrawGeomHatch::getClassTypeId())
if (child->isDerivedFrom<DrawGeomHatch>()
&& !child->isRemoving()) {
TechDraw::DrawGeomHatch* geom = dynamic_cast<TechDraw::DrawGeomHatch*>(child);
result.push_back(geom);
@@ -757,7 +757,7 @@ std::vector<TechDraw::DrawViewDimension*> DrawViewPart::getDimensions() const
std::vector<App::DocumentObject*>::iterator newEnd =
std::unique(children.begin(), children.end());
for (std::vector<App::DocumentObject*>::iterator it = children.begin(); it != newEnd; ++it) {
if ((*it)->getTypeId().isDerivedFrom(DrawViewDimension::getClassTypeId())) {
if ((*it)->isDerivedFrom<DrawViewDimension>()) {
TechDraw::DrawViewDimension* dim = dynamic_cast<TechDraw::DrawViewDimension*>(*it);
result.push_back(dim);
}
@@ -773,7 +773,7 @@ std::vector<TechDraw::DrawViewBalloon*> DrawViewPart::getBalloons() const
std::vector<App::DocumentObject*>::iterator newEnd =
std::unique(children.begin(), children.end());
for (std::vector<App::DocumentObject*>::iterator it = children.begin(); it != newEnd; ++it) {
if ((*it)->getTypeId().isDerivedFrom(DrawViewBalloon::getClassTypeId())) {
if ((*it)->isDerivedFrom<DrawViewBalloon>()) {
TechDraw::DrawViewBalloon* balloon = dynamic_cast<TechDraw::DrawViewBalloon*>(*it);
result.push_back(balloon);
}
@@ -1164,7 +1164,7 @@ std::vector<DrawViewSection*> DrawViewPart::getSectionRefs() const
std::vector<DrawViewSection*> result;
std::vector<App::DocumentObject*> inObjs = getInList();
for (auto& o : inObjs) {
if (o->getTypeId().isDerivedFrom(DrawViewSection::getClassTypeId())) {
if (o->isDerivedFrom<DrawViewSection>()) {
result.push_back(static_cast<TechDraw::DrawViewSection*>(o));
}
}
@@ -1176,7 +1176,7 @@ std::vector<DrawViewDetail*> DrawViewPart::getDetailRefs() const
std::vector<DrawViewDetail*> result;
std::vector<App::DocumentObject*> inObjs = getInList();
for (auto& o : inObjs) {
if (o->getTypeId().isDerivedFrom(DrawViewDetail::getClassTypeId())) {
if (o->isDerivedFrom<DrawViewDetail>()) {
if (!o->isRemoving()) {
result.push_back(static_cast<TechDraw::DrawViewDetail*>(o));
}

View File

@@ -319,8 +319,7 @@ void DrawViewSection::onChanged(const App::Property* prop)
else if (prop == &BaseView) {
// if the BaseView is a Section, then the option of using UsePreviousCut is
// valid.
if (BaseView.getValue() && BaseView.getValue()->getTypeId().isDerivedFrom(
TechDraw::DrawViewSection::getClassTypeId())) {
if (BaseView.getValue() && BaseView.getValue()->isDerivedFrom<TechDraw::DrawViewSection>()) {
UsePreviousCut.setStatus(App::Property::ReadOnly, false);
}
else {
@@ -346,18 +345,18 @@ TopoDS_Shape DrawViewSection::getShapeToCut()
}
TopoDS_Shape shapeToCut;
if (base->getTypeId().isDerivedFrom(TechDraw::DrawViewSection::getClassTypeId())) {
if (base->isDerivedFrom<TechDraw::DrawViewSection>()) {
dvs = static_cast<TechDraw::DrawViewSection*>(base);
shapeToCut = dvs->getShapeToCut();
if (UsePreviousCut.getValue()) {
shapeToCut = dvs->getCutShapeRaw();
}
}
else if (base->getTypeId().isDerivedFrom(TechDraw::DrawViewDetail::getClassTypeId())) {
else if (base->isDerivedFrom<TechDraw::DrawViewDetail>()) {
dvd = static_cast<TechDraw::DrawViewDetail*>(base);
shapeToCut = dvd->getDetailShape();
}
else if (base->getTypeId().isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) {
else if (base->isDerivedFrom<TechDraw::DrawViewPart>()) {
dvp = static_cast<TechDraw::DrawViewPart*>(base);
shapeToCut = dvp->getSourceShape();
if (FuseBeforeCut.getValue()) {
@@ -430,7 +429,7 @@ App::DocumentObjectExecReturn* DrawViewSection::execute()
bool DrawViewSection::isBaseValid() const
{
App::DocumentObject* base = BaseView.getValue();
if (base && base->getTypeId().isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) {
if (base && base->isDerivedFrom<TechDraw::DrawViewPart>()) {
return true;
}
return false;
@@ -683,7 +682,7 @@ void DrawViewSection::postSectionCutTasks()
// Base::Console().Message("DVS::postSectionCutTasks()\n");
std::vector<App::DocumentObject*> children = getInList();
for (auto& c : children) {
if (c->getTypeId().isDerivedFrom(DrawViewPart::getClassTypeId())) {
if (c->isDerivedFrom<DrawViewPart>()) {
// details or sections of this need cut shape
c->recomputeFeature();
}
@@ -1191,7 +1190,7 @@ TopoDS_Face DrawViewSection::getSectionTopoDSFace(int i)
TechDraw::DrawViewPart* DrawViewSection::getBaseDVP() const
{
App::DocumentObject* base = BaseView.getValue();
if (base && base->getTypeId().isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) {
if (base && base->isDerivedFrom<TechDraw::DrawViewPart>()) {
TechDraw::DrawViewPart* baseDVP = static_cast<TechDraw::DrawViewPart*>(base);
return baseDVP;
}

View File

@@ -100,7 +100,7 @@ App::DocumentObjectExecReturn *DrawViewSpreadsheet::execute()
std::string scellend = CellEnd.getValue();
if (!link)
return new App::DocumentObjectExecReturn("No spreadsheet linked");
if (!link->getTypeId().isDerivedFrom(Spreadsheet::Sheet::getClassTypeId()))
if (!link->isDerivedFrom<Spreadsheet::Sheet>())
return new App::DocumentObjectExecReturn("The linked object is not a spreadsheet");
if (scellstart.empty() || scellend.empty())
return new App::DocumentObjectExecReturn("Empty cell value");

View File

@@ -127,7 +127,7 @@ std::vector<DrawTileWeld*> DrawWeldSymbol::getTiles() const
}
for(std::vector<App::DocumentObject *>::iterator it = tiles.begin(); it != tiles.end(); it++) {
if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawTileWeld::getClassTypeId())) {
if ((*it)->isDerivedFrom<TechDraw::DrawTileWeld>()) {
App::DocumentObject* doTemp = (*it);
DrawTileWeld* temp = static_cast<DrawTileWeld*>(doTemp);
result.push_back(temp);

View File

@@ -67,7 +67,7 @@ App::DocumentObjectExecReturn *FeatureProjection::execute()
App::DocumentObject* link = Source.getValue();
if (!link)
return new App::DocumentObjectExecReturn("No object linked");
if (!link->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
if (!link->isDerivedFrom<Part::Feature>())
return new App::DocumentObjectExecReturn("Linked object is not a Part object");
const TopoDS_Shape& shape = static_cast<Part::Feature*>(link)->Shape.getShape().getShape();
if (shape.IsNull())

View File

@@ -68,14 +68,14 @@ std::vector<TopoDS_Shape> ShapeExtractor::getShapes2d(const std::vector<App::Doc
std::vector<App::DocumentObject*> objs = gex->Group.getValues();
for (auto& d: objs) {
if (is2dObject(d)) {
if (d->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
if (d->isDerivedFrom<Part::Feature>()) {
shapes2d.push_back(getLocatedShape(d));
}
}
}
} else {
if (is2dObject(l)) {
if (l->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
if (l->isDerivedFrom<Part::Feature>()) {
shapes2d.push_back(getLocatedShape(l));
} // other 2d objects would go here - Draft objects?
}
@@ -95,7 +95,7 @@ TopoDS_Shape ShapeExtractor::getShapes(const std::vector<App::DocumentObject*> l
if (is2dObject(l) && !include2d) {
continue;
}
if (l->getTypeId().isDerivedFrom(App::Link::getClassTypeId())) {
if (l->isDerivedFrom<App::Link>()) {
App::Link* xLink = dynamic_cast<App::Link*>(l);
std::vector<TopoDS_Shape> xShapes = getXShapes(xLink);
if (!xShapes.empty()) {
@@ -170,7 +170,7 @@ std::vector<TopoDS_Shape> ShapeExtractor::getXShapes(const App::Link* xLink)
bool childNeedsTransform = false;
Base::Placement childPlm;
Base::Matrix4D childScale;
if (l->getTypeId().isDerivedFrom(App::LinkElement::getClassTypeId())) {
if (l->isDerivedFrom<App::LinkElement>()) {
App::LinkElement* cLinkElem = static_cast<App::LinkElement*>(l);
if (cLinkElem->hasPlacement()) {
childPlm = cLinkElem->getLinkPlacementProperty()->getValue();
@@ -254,7 +254,7 @@ std::vector<TopoDS_Shape> ShapeExtractor::getShapesFromObject(const App::Documen
const App::GroupExtension* gex = dynamic_cast<const App::GroupExtension*>(docObj);
App::Property* gProp = docObj->getPropertyByName("Group");
App::Property* sProp = docObj->getPropertyByName("Shape");
if (docObj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
if (docObj->isDerivedFrom<Part::Feature>()) {
result.push_back(getLocatedShape(docObj));
} else if (gex) { //is a group extension
std::vector<App::DocumentObject*> objs = gex->Group.getValues();

View File

@@ -132,7 +132,7 @@ private:
PyObject* item = (*it).ptr();
if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) {
App::DocumentObject* obj = static_cast<App::DocumentObjectPy*>(item)->getDocumentObjectPtr();
if (obj->getTypeId().isDerivedFrom(TechDraw::DrawPage::getClassTypeId())) {
if (obj->isDerivedFrom<TechDraw::DrawPage>()) {
page = static_cast<TechDraw::DrawPage*>(obj);
Gui::Document* activeGui = Gui::Application::Instance->getDocument(page->getDocument());
Gui::ViewProvider* vp = activeGui->getViewProvider(obj);

View File

@@ -98,7 +98,7 @@ QVariant QGIProjGroup::itemChange(GraphicsItemChange change, const QVariant &val
QGIView* gView = dynamic_cast<QGIView *>(childItem);
if(gView) {
TechDraw::DrawView *fView = gView->getViewObject();
if(fView->getTypeId().isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())) {
if(fView->isDerivedFrom<TechDraw::DrawProjGroupItem>()) {
TechDraw::DrawProjGroupItem *projItemPtr = static_cast<TechDraw::DrawProjGroupItem *>(fView);
QString type = QString::fromLatin1(projItemPtr->Type.getValueAsString());

View File

@@ -910,7 +910,7 @@ void QGSPage::findMissingViews(const std::vector<App::DocumentObject*>& list,
if (!hasQView(*it))
missing.push_back(*it);
if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawViewCollection::getClassTypeId())) {
if ((*it)->isDerivedFrom<TechDraw::DrawViewCollection>()) {
std::vector<App::DocumentObject*> missingChildViews;
TechDraw::DrawViewCollection* collection =
dynamic_cast<TechDraw::DrawViewCollection*>(*it);

View File

@@ -69,10 +69,10 @@ std::vector<App::DocumentObject*> ViewProviderAnnotation::claimChildren() const
try {
for (std::vector<App::DocumentObject*>::const_iterator it = views.begin();
it != views.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawViewBalloon::getClassTypeId())) {
if ((*it)->isDerivedFrom<TechDraw::DrawViewBalloon>()) {
temp.push_back((*it));
}
else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId())) {
else if ((*it)->isDerivedFrom<TechDraw::DrawLeaderLine>()) {
temp.push_back((*it));
}
}

View File

@@ -135,7 +135,7 @@ void ViewProviderDrawingView::show()
if (!obj || obj->isRestoring())
return;
if (obj->getTypeId().isDerivedFrom(TechDraw::DrawView::getClassTypeId())) {
if (obj->isDerivedFrom<TechDraw::DrawView>()) {
QGIView* qView = getQView();
if (qView) {
qView->draw();
@@ -151,7 +151,7 @@ void ViewProviderDrawingView::hide()
if (!obj || obj->isRestoring())
return;
if (obj->getTypeId().isDerivedFrom(TechDraw::DrawView::getClassTypeId())) {
if (obj->isDerivedFrom<TechDraw::DrawView>()) {
QGIView* qView = getQView();
if (qView) {
//note: hiding an item in the scene clears its selection status

View File

@@ -142,9 +142,9 @@ std::vector<App::DocumentObject*> ViewProviderLeader::claimChildren() const
const std::vector<App::DocumentObject *> &views = getFeature()->getInList();
try {
for(std::vector<App::DocumentObject *>::const_iterator it = views.begin(); it != views.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawRichAnno::getClassTypeId())) {
if ((*it)->isDerivedFrom<TechDraw::DrawRichAnno>()) {
temp.push_back((*it));
} else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawWeldSymbol::getClassTypeId())) {
} else if ((*it)->isDerivedFrom<TechDraw::DrawWeldSymbol>()) {
temp.push_back((*it));
}
}

View File

@@ -64,7 +64,7 @@ void ViewProviderViewClip::show()
App::DocumentObject* obj = getObject();
if (!obj || obj->isRestoring())
return;
if (obj->getTypeId().isDerivedFrom(TechDraw::DrawViewClip::getClassTypeId())) {
if (obj->isDerivedFrom<TechDraw::DrawViewClip>()) {
std::vector<App::DocumentObject*> inp = obj->getInList();
for (std::vector<App::DocumentObject*>::iterator it = inp.begin(); it != inp.end(); ++it)
(*it)->touch();
@@ -79,7 +79,7 @@ void ViewProviderViewClip::hide()
App::DocumentObject* obj = getObject();
if (!obj || obj->isRestoring())
return;
if (obj->getTypeId().isDerivedFrom(TechDraw::DrawViewClip::getClassTypeId())) {
if (obj->isDerivedFrom<TechDraw::DrawViewClip>()) {
std::vector<App::DocumentObject*> inp = obj->getInList();
for (std::vector<App::DocumentObject*>::iterator it = inp.begin(); it != inp.end(); ++it)
(*it)->touch();

View File

@@ -199,7 +199,7 @@ std::vector<App::DocumentObject*> ViewProviderViewPart::claimChildren() const
const std::vector<App::DocumentObject *> &views = getViewPart()->getInList();
try {
for(std::vector<App::DocumentObject *>::const_iterator it = views.begin(); it != views.end(); ++it) {
if((*it)->getTypeId().isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())) {
if((*it)->isDerivedFrom<TechDraw::DrawViewDimension>()) {
//TODO: make a list, then prune it. should be faster?
bool skip = false;
std::string dimName = (*it)->getNameInDocument();
@@ -213,15 +213,15 @@ std::vector<App::DocumentObject*> ViewProviderViewPart::claimChildren() const
if (!skip) {
temp.push_back(*it);
}
} else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawHatch::getClassTypeId())) {
} else if ((*it)->isDerivedFrom<TechDraw::DrawHatch>()) {
temp.push_back((*it));
} else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawGeomHatch::getClassTypeId())) {
} else if ((*it)->isDerivedFrom<TechDraw::DrawGeomHatch>()) {
temp.push_back((*it));
} else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawViewBalloon::getClassTypeId())) {
} else if ((*it)->isDerivedFrom<TechDraw::DrawViewBalloon>()) {
temp.push_back((*it));
} else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawRichAnno::getClassTypeId())) {
} else if ((*it)->isDerivedFrom<TechDraw::DrawRichAnno>()) {
temp.push_back((*it));
} else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId())) {
} else if ((*it)->isDerivedFrom<TechDraw::DrawLeaderLine>()) {
temp.push_back((*it));
}
}

View File

@@ -82,7 +82,7 @@ std::vector<App::DocumentObject*> ViewProviderWeld::claimChildren() const
const std::vector<App::DocumentObject *> &tiles = getFeature()->getInList();
try {
for(std::vector<App::DocumentObject *>::const_iterator it = tiles.begin(); it != tiles.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawTile::getClassTypeId())) {
if ((*it)->isDerivedFrom<TechDraw::DrawTile>()) {
temp.push_back((*it));
}
}