Note Views might be removed from document elsewhere so need to check if a View is still in Document here
| 279 | |
| 280 | //Note Views might be removed from document elsewhere so need to check if a View is still in Document here |
| 281 | int DrawPage::removeView(App::DocumentObject* docObj) |
| 282 | { |
| 283 | if (!docObj->isDerivedFrom<DrawView>() && !docObj->isDerivedFrom<App::Link>()) { |
| 284 | return -1; |
| 285 | } |
| 286 | |
| 287 | App::Document* doc = docObj->getDocument(); |
| 288 | if (!doc) { |
| 289 | return -1; |
| 290 | } |
| 291 | |
| 292 | if (!docObj->isAttachedToDocument()) { |
| 293 | return -1; |
| 294 | } |
| 295 | std::vector<App::DocumentObject*> newViews; |
| 296 | for (auto* view : Views.getValues()) { |
| 297 | App::Document* viewDoc = view->getDocument(); |
| 298 | if (!viewDoc) { |
| 299 | continue; |
| 300 | } |
| 301 | |
| 302 | std::string viewName = docObj->getNameInDocument(); |
| 303 | if (viewName.compare(view->getNameInDocument()) != 0) { |
| 304 | newViews.push_back(view); |
| 305 | } |
| 306 | } |
| 307 | Views.setValues(newViews); |
| 308 | return Views.getSize(); |
| 309 | } |
| 310 | |
| 311 | void DrawPage::requestPaint(void) { signalGuiPaint(this); } |
| 312 |
no test coverage detected