diff --git a/src/Mod/TechDraw/App/DrawPage.cpp b/src/Mod/TechDraw/App/DrawPage.cpp index 5c1d4a6469..bd6af54c75 100644 --- a/src/Mod/TechDraw/App/DrawPage.cpp +++ b/src/Mod/TechDraw/App/DrawPage.cpp @@ -335,46 +335,31 @@ void DrawPage::redrawCommand() updateAllViews(); forceRedraw(false); } -//should really be called "updateMostViews". can still be problems to due execution order. + void DrawPage::updateAllViews() { // Base::Console().Message("DP::updateAllViews()\n"); - std::vector featViews = getAllViews(); - std::vector::iterator it = featViews.begin(); + std::vector featViews = getAllViews(); //unordered list of views within page + //first, make sure all the Parts have been executed so GeometryObjects exist - for(; it != featViews.end(); ++it) { - TechDraw::DrawViewPart *part = dynamic_cast(*it); - TechDraw::DrawViewCollection *collect = dynamic_cast(*it); + for(auto& v: featViews) { + TechDraw::DrawViewPart *part = dynamic_cast(v); if (part) { + //view, section, detail, dpgi part->recomputeFeature(); - } else if (collect) { - collect->recomputeFeature(); } } - //second, make sure all the Dimensions have been executed so Measurements have References - for(it = featViews.begin(); it != featViews.end(); ++it) { - TechDraw::DrawViewDimension *dim = dynamic_cast(*it); - if (dim) { - dim->recomputeFeature(); + //second, do the rest of the views that may depend on a part view + //TODO: check if we have 2 layers of dependency (ex. leader > weld > tile?) + for(auto& v: featViews) { + TechDraw::DrawViewPart *part = dynamic_cast(v); + if (part) { + continue; + } + if (v) { + v->recomputeFeature(); } } - - //third, try to execute all leader lines. may not work if parent DVP isn't ready. - for(it = featViews.begin(); it != featViews.end(); ++it) { - TechDraw::DrawLeaderLine *line = dynamic_cast(*it); - if (line) { - line->recomputeFeature(); - } - } - - //fourth, try to execute all spreadsheets. - for (it = featViews.begin(); it != featViews.end(); ++it) { - TechDraw::DrawViewSpreadsheet *sheet = dynamic_cast(*it); - if (sheet) { - sheet->recomputeFeature(); - } - } - } std::vector DrawPage::getAllViews(void)