//this is time consuming. should only be used when there is a problem. //should have been called MDIViewPage::fixWidowAndOrphans() //void MDIViewPage::updateDrawing(bool forceUpdate) void MDIViewPage::updateDrawing(void) { // get all the DrawViews for this page, including the second level ones // if we ever have collections of collections, we'll need to revisit this DrawPage* thisPage = m_vpPage->getDrawPage(); std::vector<App::DocumentObject*> pChildren = thisPage->getAllViews(); // if dv doesn't have a graphic, make one for (auto& dv: pChildren) { if (dv->isRemoving()) { continue; } QGIView* qv = m_view->findQViewForDocObj(dv); if (qv == nullptr) { attachView(dv); } } // if qView doesn't have a Feature on this Page, delete it std::vector<QGIView*> qvs = m_view->getViews(); App::Document* doc = getAppDocument(); for (auto& qv: qvs) { App::DocumentObject* obj = doc->getObject(qv->getViewName()); if (obj == nullptr) { m_view->removeQView(qv); } else { DrawPage* pp = qv->getViewObject()->findParentPage(); if (thisPage != pp) { m_view->removeQView(qv); } } } // Update all the QGIVxxxx // WF: why do we do this? views should be keeping themselves up to date. // const std::vector<QGIView *> &upviews = m_view->getViews(); // for(std::vector<QGIView *>::const_iterator it = upviews.begin(); it != upviews.end(); ++it) { // Base::Console().Message("TRACE - MDIVP::updateDrawing - updating a QGIVxxxx\n"); // if((*it)->getViewObject()->isTouched() || // forceUpdate) { // (*it)->updateView(forceUpdate); // } // } }
PyObject* DrawPagePy::getAllViews(PyObject* args) { (void) args; DrawPage* page = getDrawPagePtr(); std::vector<App::DocumentObject*> allViews = page->getAllViews(); PyObject* ret = PyList_New(0); for (auto&v: allViews) { if (v->isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())) { TechDraw::DrawProjGroupItem* dpgi = static_cast<TechDraw::DrawProjGroupItem*>(v); PyList_Append(ret,new TechDraw::DrawProjGroupItemPy(dpgi)); //is this legit? or need to make new copy of dv? } else if (v->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { TechDraw::DrawViewPart* dvp = static_cast<TechDraw::DrawViewPart*>(v); PyList_Append(ret,new TechDraw::DrawViewPartPy(dvp)); } else if (v->isDerivedFrom(TechDraw::DrawViewAnnotation::getClassTypeId())) { TechDraw::DrawViewAnnotation* dva = static_cast<TechDraw::DrawViewAnnotation*>(v); PyList_Append(ret,new TechDraw::DrawViewAnnotationPy(dva)); } else { TechDraw::DrawView* dv = static_cast<TechDraw::DrawView*>(v); PyList_Append(ret,new TechDraw::DrawViewPy(dv)); } } return ret; }