Added tracking of external documents to dependency tracking code.

This commit is contained in:
Eivind Kvedalen 2015-02-03 00:29:00 +01:00 committed by wmayer
parent e70b859395
commit 524e982b5e

View File

@ -211,6 +211,22 @@ void Document::exportGraphviz(std::ostream& out)
VertexObjectList[It->second] = add_vertex(DepList); VertexObjectList[It->second] = add_vertex(DepList);
names.push_back(It->second->Label.getValue()); names.push_back(It->second->Label.getValue());
} }
// Add external document objects
for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) {
std::vector<DocumentObject*> OutList = It->second->getOutList();
for (std::vector<DocumentObject*>::const_iterator It2=OutList.begin();It2!=OutList.end();++It2) {
if (*It2) {
std::map<DocumentObject*,Vertex>::const_iterator item = VertexObjectList.find(*It2);
if (item == VertexObjectList.end()) {
VertexObjectList[*It2] = add_vertex(DepList);
names.push_back(std::string((*It2)->getDocument()->getName()) + "#" + (*It2)->Label.getValue());
}
}
}
}
// add the edges // add the edges
for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) { for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) {
std::vector<DocumentObject*> OutList = It->second->getOutList(); std::vector<DocumentObject*> OutList = It->second->getOutList();
@ -1253,6 +1269,22 @@ Document::getDependencyList(const std::vector<App::DocumentObject*>& objs) const
VertexMap[v] = *it; VertexMap[v] = *it;
} }
for (std::vector<DocumentObject*>::const_iterator it = d->objectArray.begin(); it != d->objectArray.end();++it) {
std::vector<DocumentObject*> outList = (*it)->getOutList();
for (std::vector<DocumentObject*>::const_iterator jt = outList.begin(); jt != outList.end();++jt) {
if (*jt) {
std::map<DocumentObject*,Vertex>::const_iterator i = ObjectMap.find(*jt);
if (i == ObjectMap.end()) {
Vertex v = add_vertex(DepList);
ObjectMap[*jt] = v;
VertexMap[v] = *jt;
}
}
}
}
// add the edges // add the edges
for (std::vector<DocumentObject*>::const_iterator it = d->objectArray.begin(); it != d->objectArray.end();++it) { for (std::vector<DocumentObject*>::const_iterator it = d->objectArray.begin(); it != d->objectArray.end();++it) {
std::vector<DocumentObject*> outList = (*it)->getOutList(); std::vector<DocumentObject*> outList = (*it)->getOutList();
@ -1300,6 +1332,20 @@ void Document::_rebuildDependencyList(void)
// add the object as Vertex and remember the index // add the object as Vertex and remember the index
d->VertexObjectList[It->second] = add_vertex(d->DepList); d->VertexObjectList[It->second] = add_vertex(d->DepList);
} }
// add the edges
for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) {
std::vector<DocumentObject*> OutList = It->second->getOutList();
for (std::vector<DocumentObject*>::const_iterator It2=OutList.begin();It2!=OutList.end();++It2) {
if (*It2) {
std::map<DocumentObject*,Vertex>::iterator i = d->VertexObjectList.find(*It2);
if (i == d->VertexObjectList.end())
d->VertexObjectList[*It2] = add_vertex(d->DepList);
}
}
}
// add the edges // add the edges
for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) { for (std::map<std::string,DocumentObject*>::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) {
std::vector<DocumentObject*> OutList = It->second->getOutList(); std::vector<DocumentObject*> OutList = It->second->getOutList();