summaryrefslogtreecommitdiff
path: root/SANet/SANet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'SANet/SANet.cpp')
-rw-r--r--SANet/SANet.cpp37
1 files changed, 8 insertions, 29 deletions
diff --git a/SANet/SANet.cpp b/SANet/SANet.cpp
index 02432326a9c..61489ddc01b 100644
--- a/SANet/SANet.cpp
+++ b/SANet/SANet.cpp
@@ -223,54 +223,33 @@ void SANet::Network::update_effect_link(TaskID task_ID, CondID cond_ID,
};
-void SANet::Network::print_graphviz(std::basic_ostream<char, std::char_traits<char> >& strm, std::map<std::string, std::string>& graphmap)
+void SANet::Network::print_graphviz(std::basic_ostream<char, std::char_traits<char> >& strm, std::map<std::string, std::string>& graphmap, std::string defaultColor)
{
+ //Go through the task nodes, and if it's without a color, then give it the default. Then write it to the stream.
for (TaskNodeMap::iterator node_iter = task_nodes_.begin ();
node_iter != task_nodes_.end (); node_iter++)
{
std::map<std::string, std::string>::iterator titer = graphmap.find(node_iter->second->get_name());
- if(titer != graphmap.end())
+ if(titer == graphmap.end())
{
- if((*titer).second == "blue" )
- {
- (*titer).second = "cornflowerblue";
-
- }
- else if((*titer).second == "green")
- {
- (*titer).second = "red";
- }
- }
- else
- {
- graphmap[node_iter->second->get_name()] = "grey";
+ graphmap[node_iter->second->get_name()] = defaultColor;
}
strm << "\t" << "\"" << node_iter->second->get_name() << " " << node_iter->first << "\" " << "[shape=box, style=filled, color = " << graphmap[node_iter->second->get_name()] <<"];\n";
}
+ //Go through the cond nodes, and if it's without a color, then give it the default. Then write it to the stream.
for (CondNodeMap::iterator node_iter = cond_nodes_.begin ();
node_iter != cond_nodes_.end (); node_iter++)
{
std::map<std::string, std::string>::iterator citer = graphmap.find(node_iter->second->get_name());
- if(citer != graphmap.end())
- {
- if((*citer).second == "blue" )
- {
- (*citer).second = "cornflowerblue";
-
- }
- else if((*citer).second == "green")
- {
- (*citer).second = "red";
- }
- }
- else
+ if(citer == graphmap.end())
{
- graphmap[node_iter->second->get_name()] = "grey";
+ graphmap[node_iter->second->get_name()] = defaultColor;
}
strm << "\t" << "\"" << node_iter->second->get_name() << " " << node_iter->first << "\" " << "[style=filled, color = " << graphmap[node_iter->second->get_name()] << "];\n";
}
+ //Go through the effect and preconds for the task nodes and link them in the stream
for (TaskNodeMap::iterator node_iter = task_nodes_.begin ();
node_iter != task_nodes_.end (); node_iter++)
{