MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / unsetupObject

Method unsetupObject

src/Mod/TechDraw/App/DrawPage.cpp:421–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419}
420
421void DrawPage::unsetupObject()
422{
423 nowUnsetting = true;
424
425 // Remove the Page's views & template from document
426 App::Document* doc = getDocument();
427 std::string docName = doc->getName();
428 std::string pageName = getNameInDocument();
429
430 try {
431 for (auto& v : Views.getValues()) {
432 //NOTE: the order of objects in Page.Views does not reflect the object hierarchy
433 // this means that a ProjGroup could be deleted before its child ProjGroupItems.
434 // this causes problems when removing objects from document
435 if (v->isAttachedToDocument()) {
436 std::string viewName = v->getNameInDocument();
437 Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")",
438 docName.c_str(), viewName.c_str());
439 }
440 }
441 std::vector<App::DocumentObject*> emptyViews;//probably superfluous
442 Views.setValues(emptyViews);
443 }
444 catch (...) {
445 Base::Console().warning("DP::unsetupObject - %s - error while deleting children\n",
446 getNameInDocument());
447 }
448
449 App::DocumentObject* tmp = Template.getValue();
450 if (tmp) {
451 std::string templateName = Template.getValue()->getNameInDocument();
452 Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")",
453 docName.c_str(), templateName.c_str());
454 }
455 Template.setValue(nullptr);
456}
457
458int DrawPage::getNextBalloonIndex(void)
459{

Callers

nothing calls this directly

Calls 11

runStringArgMethod · 0.80
getDocumentFunction · 0.70
getNameMethod · 0.45
getValuesMethod · 0.45
isAttachedToDocumentMethod · 0.45
getNameInDocumentMethod · 0.45
c_strMethod · 0.45
setValuesMethod · 0.45
warningMethod · 0.45
getValueMethod · 0.45
setValueMethod · 0.45

Tested by

no test coverage detected