TechDraw: Fix child of linked view.
This commit is contained in:
committed by
WandererFan
parent
156ae209f5
commit
4f3bb4e543
@@ -366,8 +366,13 @@ std::vector<App::DocumentObject*> DrawPage::getViews() const
|
||||
std::vector<App::DocumentObject*> views = Views.getValues();
|
||||
std::vector<App::DocumentObject*> allViews;
|
||||
for (auto& v : views) {
|
||||
bool addChildren = false;
|
||||
|
||||
if (v->isDerivedFrom<App::Link>()) {
|
||||
// In the case of links, child object of the view need to be added since
|
||||
// they are not in the page Views property.
|
||||
v = static_cast<App::Link*>(v)->getLinkedObject();
|
||||
addChildren = true;
|
||||
}
|
||||
|
||||
if (!v->isDerivedFrom<DrawView>()) {
|
||||
@@ -375,6 +380,14 @@ std::vector<App::DocumentObject*> DrawPage::getViews() const
|
||||
}
|
||||
|
||||
allViews.push_back(v);
|
||||
|
||||
if (addChildren) {
|
||||
for (auto* dep : v->getInList()) {
|
||||
if (dep && dep->isDerivedFrom<TechDraw::DrawView>()) {
|
||||
allViews.push_back(dep);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return allViews;
|
||||
}
|
||||
|
||||
@@ -385,16 +385,16 @@ std::vector<DrawPage*> DrawView::findAllParentPages() const
|
||||
{
|
||||
std::vector<DrawPage*> pages;
|
||||
|
||||
for (auto parent : getInList()) {
|
||||
if (parent->isDerivedFrom<App::Link>()) {
|
||||
for (auto& linkParent : parent->getInList()) {
|
||||
if (linkParent->isDerivedFrom<DrawPage>()
|
||||
|| linkParent->isDerivedFrom<DrawViewCollection>()) {
|
||||
parent = linkParent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto parent : getInList()) {
|
||||
if (parent->isDerivedFrom<App::Link>()) {
|
||||
for (auto& linkParent : parent->getInList()) {
|
||||
if (linkParent->isDerivedFrom<DrawPage>()
|
||||
|| linkParent->isDerivedFrom<DrawViewCollection>()) {
|
||||
parent = linkParent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parent->isDerivedFrom<DrawPage>()) {
|
||||
pages.emplace_back(static_cast<TechDraw::DrawPage*>(parent));
|
||||
@@ -415,9 +415,8 @@ std::vector<DrawPage*> DrawView::findAllParentPages() const
|
||||
|
||||
bool DrawView::isInClip()
|
||||
{
|
||||
std::vector<App::DocumentObject*> parent = getInList();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = parent.begin(); it != parent.end(); ++it) {
|
||||
if ((*it)->isDerivedFrom<DrawViewClip>()) {
|
||||
for (auto* parent : getInList()) {
|
||||
if (parent->isDerivedFrom<DrawViewClip>()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -440,14 +439,9 @@ DrawView *DrawView::claimParent() const
|
||||
|
||||
DrawViewClip* DrawView::getClipGroup()
|
||||
{
|
||||
std::vector<App::DocumentObject*> parent = getInList();
|
||||
App::DocumentObject* obj = nullptr;
|
||||
for (std::vector<App::DocumentObject*>::iterator it = parent.begin(); it != parent.end(); ++it) {
|
||||
if ((*it)->isDerivedFrom<DrawViewClip>()) {
|
||||
obj = (*it);
|
||||
DrawViewClip* result = dynamic_cast<DrawViewClip*>(obj);
|
||||
return result;
|
||||
|
||||
for (auto* obj : getInList()) {
|
||||
if (obj->isDerivedFrom<DrawViewClip>()) {
|
||||
return dynamic_cast<DrawViewClip*>(obj);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
@@ -455,14 +449,11 @@ DrawViewClip* DrawView::getClipGroup()
|
||||
|
||||
DrawViewCollection *DrawView::getCollection() const
|
||||
{
|
||||
std::vector<App::DocumentObject *> parents = getInList();
|
||||
for (auto it = parents.begin(); it != parents.end(); ++it) {
|
||||
auto parentCollection = dynamic_cast<DrawViewCollection *>(*it);
|
||||
if (parentCollection) {
|
||||
return parentCollection;
|
||||
for (auto* obj : getInList()) {
|
||||
if (obj->isDerivedFrom<DrawViewCollection>()) {
|
||||
return dynamic_cast<DrawViewCollection*>(obj);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user