Skip to content

Commit

Permalink
Fix Dimension double child collection
Browse files Browse the repository at this point in the history
if a dimension references 2 geometries in a View - ie
Vertex-Vertex - only count it as 1 child of View
  • Loading branch information
WandererFan authored and wwmayer committed May 10, 2017
1 parent 7628089 commit 5cc00e0
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp
Expand Up @@ -124,14 +124,19 @@ std::vector<App::DocumentObject*> ViewProviderViewPart::claimChildren(void) cons
try {
for(std::vector<App::DocumentObject *>::const_iterator it = views.begin(); it != views.end(); ++it) {
if((*it)->getTypeId().isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())) {
TechDraw::DrawViewDimension *dim = dynamic_cast<TechDraw::DrawViewDimension *>(*it);
const std::vector<App::DocumentObject *> &refs = dim->References2D.getValues();
for(std::vector<App::DocumentObject *>::const_iterator it = refs.begin(); it != refs.end(); ++it) {
if(strcmp(getViewPart()->getNameInDocument(), (*it)->getNameInDocument()) == 0) { //wf: isn't this test redundant?
temp.push_back(dim); // if a dim is in the inlist,
// it's a child of this ViewPart??
//TODO: make a list, then prune it. should be faster?
bool skip = false;
std::string dimName = (*it)->getNameInDocument();
for (auto& t: temp) { //only add dim once even if it references 2 geometries
std::string tName = t->getNameInDocument();
if (dimName == tName) {
skip = true;
break;
}
}
if (!skip) {
temp.push_back(*it);
}
} else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawHatch::getClassTypeId())) {
temp.push_back((*it));
} else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawGeomHatch::getClassTypeId())) {
Expand Down

0 comments on commit 5cc00e0

Please sign in to comment.