remove features that are useless without this DVP hatches, geomhatches, dimensions, ...
| 1236 | //! remove features that are useless without this DVP |
| 1237 | //! hatches, geomhatches, dimensions, ... |
| 1238 | void DrawViewPart::unsetupObject() |
| 1239 | { |
| 1240 | // Base::Console().message("DVP::unsetupObject()\n"); |
| 1241 | nowUnsetting = true; |
| 1242 | App::Document* doc = getDocument(); |
| 1243 | std::string docName = doc->getName(); |
| 1244 | |
| 1245 | // Remove the View's Hatches from document |
| 1246 | std::vector<TechDraw::DrawHatch*> hatches = getHatches(); |
| 1247 | std::vector<TechDraw::DrawHatch*>::iterator it = hatches.begin(); |
| 1248 | for (; it != hatches.end(); it++) { |
| 1249 | std::string viewName = (*it)->getNameInDocument(); |
| 1250 | Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")", |
| 1251 | docName.c_str(), viewName.c_str()); |
| 1252 | } |
| 1253 | |
| 1254 | // Remove the View's GeomHatches from document |
| 1255 | std::vector<TechDraw::DrawGeomHatch*> gHatches = getGeomHatches(); |
| 1256 | std::vector<TechDraw::DrawGeomHatch*>::iterator it2 = gHatches.begin(); |
| 1257 | for (; it2 != gHatches.end(); it2++) { |
| 1258 | std::string viewName = (*it2)->getNameInDocument(); |
| 1259 | Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")", |
| 1260 | docName.c_str(), viewName.c_str()); |
| 1261 | } |
| 1262 | |
| 1263 | // Remove Dimensions which reference this DVP |
| 1264 | // must use page->removeObject first |
| 1265 | TechDraw::DrawPage* page = findParentPage(); |
| 1266 | if (page) { |
| 1267 | std::vector<TechDraw::DrawViewDimension*> dims = getDimensions(); |
| 1268 | std::vector<TechDraw::DrawViewDimension*>::iterator it3 = dims.begin(); |
| 1269 | for (; it3 != dims.end(); it3++) { |
| 1270 | page->removeView(*it3); |
| 1271 | const char* name = (*it3)->getNameInDocument(); |
| 1272 | if (name) { |
| 1273 | Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")", |
| 1274 | docName.c_str(), name); |
| 1275 | } |
| 1276 | } |
| 1277 | } |
| 1278 | |
| 1279 | // Remove Balloons which reference this DVP |
| 1280 | // must use page->removeObject first |
| 1281 | page = findParentPage(); |
| 1282 | if (page) { |
| 1283 | std::vector<TechDraw::DrawViewBalloon*> balloons = getBalloons(); |
| 1284 | std::vector<TechDraw::DrawViewBalloon*>::iterator it3 = balloons.begin(); |
| 1285 | for (; it3 != balloons.end(); it3++) { |
| 1286 | page->removeView(*it3); |
| 1287 | const char* name = (*it3)->getNameInDocument(); |
| 1288 | if (name) { |
| 1289 | Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")", |
| 1290 | docName.c_str(), name); |
| 1291 | } |
| 1292 | } |
| 1293 | } |
| 1294 | } |
| 1295 |
nothing calls this directly
no test coverage detected