[TD]Allow non-shape views to have children (#20768) (#21099)

* [TD]Allow non-shape views to have children (#20768)

* Update src/Mod/TechDraw/App/DrawView.cpp

Review comment

Co-authored-by: Benjamin Nauck <benjamin@nauck.se>

* Update src/Mod/TechDraw/App/DrawView.cpp

review comment

Co-authored-by: Benjamin Nauck <benjamin@nauck.se>

* Update src/Mod/TechDraw/Gui/ViewProviderDrawingView.cpp

review comment

Co-authored-by: Benjamin Nauck <benjamin@nauck.se>

* Update src/Mod/TechDraw/Gui/ViewProviderDrawingView.cpp

review comment

Co-authored-by: Benjamin Nauck <benjamin@nauck.se>

---------

Co-authored-by: Benjamin Nauck <benjamin@nauck.se>
This commit is contained in:
WandererFan
2025-05-08 10:18:09 -04:00
committed by GitHub
parent 3c25cdc213
commit 9938818d82
4 changed files with 79 additions and 0 deletions

View File

@@ -439,6 +439,26 @@ DrawView *DrawView::claimParent() const
return getCollection();
}
//! return *unique* list of DrawView derived items which consider this DVP to be their 'owner'
//! if a dimension has two references to this dvp, it will appear twice in the inlist, so we need to
//! pick out duplicates.
std::vector<DrawView*> DrawView::getUniqueChildren() const
{
std::vector<DrawView*> result;
auto children = getInList();
std::sort(children.begin(), children.end(), std::less<>());
auto newEnd = std::unique(children.begin(), children.end());
children.erase(newEnd, children.end());
for (auto& child : children) {
auto* childDV = freecad_cast<DrawView*>(child);
if (childDV && childDV->claimParent() == this) {
result.push_back(childDV);
}
}
return result;
}
DrawViewClip* DrawView::getClipGroup()
{
for (auto* obj : getInList()) {