iMSTK
Interactive Medical Simulation Toolkit
imstkTaskGraphVizWriter.h
1 /*
2 ** This file is part of the Interactive Medical Simulation Toolkit (iMSTK)
3 ** iMSTK is distributed under the Apache License, Version 2.0.
4 ** See accompanying NOTICE for details.
5 */
6 
7 #pragma once
8 
9 #include <memory>
10 #include <string>
11 
12 namespace imstk
13 {
14 class TaskGraph;
15 
23 {
24 public:
25  TaskGraphVizWriter() = default;
26  virtual ~TaskGraphVizWriter() = default;
27 
28 public:
32  void setInput(std::shared_ptr<TaskGraph> graph) { this->m_inputGraph = graph; }
33 
37  void setFileName(std::string fileName) { this->m_fileName = fileName; }
38 
42  void setHighlightCriticalPath(bool highlightCriticalPath) { this->m_highlightCriticalPath = highlightCriticalPath; }
43 
47  void setWriteNodeComputeTimesColor(bool writeNodeComputeTimesColor) { this->m_writeNodeComputeTimesColor = writeNodeComputeTimesColor; }
48 
52  void setWriteNodeComputeTimesText(bool writeNodeComputeTimesText) { this->m_writeNodeComputeTimesText = writeNodeComputeTimesText; }
53 
54  std::shared_ptr<TaskGraph> getInput() const { return m_inputGraph; }
55  const std::string& getFileName() const { return m_fileName; }
56  bool getHighlightCriticalPath() const { return m_highlightCriticalPath; }
57  bool getWriteNodeComputeTimesColor() const { return m_writeNodeComputeTimesColor; }
58  bool getWriteNodeComputeTimesText() const { return m_writeNodeComputeTimesText; }
59 
63  void write();
64 
65 private:
66  std::shared_ptr<TaskGraph> m_inputGraph = nullptr;
67  std::string m_fileName = "";
68  bool m_highlightCriticalPath = false;
69  bool m_writeNodeComputeTimesColor = false;
70  bool m_writeNodeComputeTimesText = false;
71 };
72 } // namespace imstk
void setWriteNodeComputeTimesColor(bool writeNodeComputeTimesColor)
If on, will write the time the node took to complete as a color.
Writes a TaskGraph to an svg file. Produces unique node names from duplicates with postfix...
Compound Geometry.
void write()
Writes the graph to a file given the filename.
void setFileName(std::string fileName)
The filename and path to write too.
void setHighlightCriticalPath(bool highlightCriticalPath)
If on, will highlight the critical path in red.
void setWriteNodeComputeTimesText(bool writeNodeComputeTimesText)
If on, will write the time the node took to complete in name as text.
void setInput(std::shared_ptr< TaskGraph > graph)
The graph to write.