This commit is contained in:
wmayer
2024-11-03 00:05:49 +01:00
parent bd813f1df0
commit 97ce877883
2 changed files with 18 additions and 7 deletions

View File

@@ -120,7 +120,14 @@ void Document::exportGraphviz(std::ostream& out) const
*/
std::string getId(const DocumentObject * docObj) {
return std::string((docObj)->getDocument()->getName()) + "#" + docObj->getNameInDocument();
std::string id;
if (docObj->isAttachedToDocument()) {
auto doc = docObj->getDocument();
id.append(doc->getName());
id.append("#");
id.append(docObj->getNameInDocument());
}
return id;
}
/**
@@ -437,11 +444,14 @@ void Document::exportGraphviz(std::ostream& out) const
if (obj) {
std::map<std::string,Vertex>::const_iterator item = GlobalVertexList.find(getId(obj));
if (item == GlobalVertexList.end())
add(obj,
std::string(obj->getDocument()->getName()) + "#" + obj->getNameInDocument(),
std::string(obj->getDocument()->getName()) + "#" + obj->Label.getValue(),
CSSubgraphs);
if (item == GlobalVertexList.end()) {
if (obj->isAttachedToDocument()) {
add(obj,
std::string(obj->getDocument()->getName()) + "#" + obj->getNameInDocument(),
std::string(obj->getDocument()->getName()) + "#" + obj->Label.getValue(),
CSSubgraphs);
}
}
}
}
}