From 524e982b5e5be016ac62b80ad99b4ccd0fb04bed Mon Sep 17 00:00:00 2001 From: Eivind Kvedalen Date: Tue, 3 Feb 2015 00:29:00 +0100 Subject: [PATCH] Added tracking of external documents to dependency tracking code. --- src/App/Document.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/App/Document.cpp b/src/App/Document.cpp index b53b1c7d3..1a9320a84 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -211,6 +211,22 @@ void Document::exportGraphviz(std::ostream& out) VertexObjectList[It->second] = add_vertex(DepList); names.push_back(It->second->Label.getValue()); } + + // Add external document objects + for (std::map::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) { + std::vector OutList = It->second->getOutList(); + for (std::vector::const_iterator It2=OutList.begin();It2!=OutList.end();++It2) { + if (*It2) { + std::map::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 for (std::map::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) { std::vector OutList = It->second->getOutList(); @@ -1251,6 +1267,22 @@ Document::getDependencyList(const std::vector& objs) const Vertex v = add_vertex(DepList); ObjectMap[*it] = v; VertexMap[v] = *it; + } + + for (std::vector::const_iterator it = d->objectArray.begin(); it != d->objectArray.end();++it) { + std::vector outList = (*it)->getOutList(); + for (std::vector::const_iterator jt = outList.begin(); jt != outList.end();++jt) { + if (*jt) { + std::map::const_iterator i = ObjectMap.find(*jt); + + if (i == ObjectMap.end()) { + Vertex v = add_vertex(DepList); + + ObjectMap[*jt] = v; + VertexMap[v] = *jt; + } + } + } } // add the edges @@ -1300,6 +1332,20 @@ void Document::_rebuildDependencyList(void) // add the object as Vertex and remember the index d->VertexObjectList[It->second] = add_vertex(d->DepList); } + + // add the edges + for (std::map::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) { + std::vector OutList = It->second->getOutList(); + for (std::vector::const_iterator It2=OutList.begin();It2!=OutList.end();++It2) { + if (*It2) { + std::map::iterator i = d->VertexObjectList.find(*It2); + + if (i == d->VertexObjectList.end()) + d->VertexObjectList[*It2] = add_vertex(d->DepList); + } + } + } + // add the edges for (std::map::const_iterator It = d->objectMap.begin(); It != d->objectMap.end();++It) { std::vector OutList = It->second->getOutList();