From 07f464dd60d5488ee7ccd2adbd720efde84008ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Tr=C3=B6ger?= Date: Mon, 30 Jan 2017 22:52:42 +0100 Subject: [PATCH] DependencyGraph: Add colors to coordinate systems --- src/App/Document.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/App/Document.cpp b/src/App/Document.cpp index 98d138f1bd..355f129aa2 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -77,7 +77,6 @@ recompute path. Also enables more complicated dependencies beyond trees. #include #include - #include "Document.h" #include "Application.h" #include "DocumentObject.h" @@ -242,7 +241,7 @@ void Document::exportGraphviz(std::ostream& out) const class GraphCreator { public: - GraphCreator(struct DocumentP* _d) : d(_d), vertex_no(0) { + GraphCreator(struct DocumentP* _d) : d(_d), vertex_no(0), seed(std::random_device()()), distribution(0,255) { build(); } @@ -471,6 +470,11 @@ void Document::exportGraphviz(std::ostream& out) const auto& sub = graph->create_subgraph(); GraphList[cs] = ⊂ get_property(sub, graph_name) = getClusterName(cs); + + std::stringstream stream; + stream << "#" << std::hex << distribution(seed) << distribution(seed) << distribution(seed) << 80; + get_property(sub, graph_graph_attribute)["bgcolor"] = stream.str(); + get_property(sub, graph_graph_attribute)["style"] = "rounded,filled"; setGraphLabel(sub, cs); for(auto obj : cs->getOutList()) { @@ -484,6 +488,7 @@ void Document::exportGraphviz(std::ostream& out) const auto& osub = sub.create_subgraph(); GraphList[origin] = &osub; get_property(osub, graph_name) = getClusterName(origin); + get_property(osub, graph_graph_attribute)["bgcolor"] = "none"; setGraphLabel(osub, origin); } } @@ -730,6 +735,9 @@ void Document::exportGraphviz(std::ostream& out) const std::map GlobalVertexList; std::set objects; std::map GraphList; + //random color generation + std::mt19937 seed; + std::uniform_int_distribution distribution; }; GraphCreator g(d);