KWWidgets
|
00001 /*========================================================================= 00002 00003 Module: $RCSfile: vtkKWStateMachineDOTWriter.h,v $ 00004 00005 Copyright (c) Kitware, Inc. 00006 All rights reserved. 00007 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00008 00009 This software is distributed WITHOUT ANY WARRANTY; without even 00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00011 PURPOSE. See the above copyright notice for more information. 00012 00013 =========================================================================*/ 00014 // .NAME vtkKWStateMachineDOTWriter - a state machine DOT writer. 00015 // .SECTION Description 00016 // This class is a state machine writer for the DOT format, based on the 00017 // reference document: http://www.graphviz.org/Documentation/dotguide.pdf 00018 // The resulting file can be rendered using dot: 00019 // dot -T png -o foo.png foo.txt 00020 // It can also be used directly from a Wiki page if your MediaWiki supports 00021 // the GraphViz extension (http://meta.wikimedia.org/wiki/GraphViz). 00022 // A state machine is defined by a set of states, a set of inputs and a 00023 // transition matrix that defines for each pair of (state,input) what is 00024 // the next state to assume. 00025 // .SECTION Thanks 00026 // This work is part of the National Alliance for Medical Image 00027 // Computing (NAMIC), funded by the National Institutes of Health 00028 // through the NIH Roadmap for Medical Research, Grant U54 EB005149. 00029 // Information on the National Centers for Biomedical Computing 00030 // can be obtained from http://nihroadmap.nih.gov/bioinformatics. 00031 // .SECTION See Also 00032 // vtkKWStateMachineWriter vtkKWStateMachine 00033 00034 #ifndef __vtkKWStateMachineDOTWriter_h 00035 #define __vtkKWStateMachineDOTWriter_h 00036 00037 #include "vtkKWStateMachineWriter.h" 00038 00039 class KWWidgets_EXPORT vtkKWStateMachineDOTWriter : public vtkKWStateMachineWriter 00040 { 00041 public: 00042 static vtkKWStateMachineDOTWriter* New(); 00043 vtkTypeRevisionMacro(vtkKWStateMachineDOTWriter, vtkKWStateMachineWriter); 00044 void PrintSelf(ostream& os, vtkIndent indent); 00045 00046 // Description: 00047 // Write state machine representation to stream or file. 00048 // Returns 1 on success and 0 on failure. 00049 virtual int WriteToStream(ostream& os); 00050 virtual int WriteToFile(const char *filename); 00051 00052 // Description: 00053 // Set/Get the font name used for state labels. Defaults to Helvetica. 00054 // It is best to stick to Times, Helvetica, Courier or Symbol 00055 vtkGetStringMacro(StateFontName); 00056 vtkSetStringMacro(StateFontName); 00057 00058 // Description: 00059 // Set/Get the font size used for state labels. Defaults to 9. 00060 vtkSetClampMacro(StateFontSize, int, 2, 200); 00061 vtkGetMacro(StateFontSize, int); 00062 00063 // Description: 00064 // Set/Get the font color used for state labels. Defaults to black. 00065 vtkSetVector3Macro(StateFontColor,double); 00066 vtkGetVector3Macro(StateFontColor,double); 00067 00068 // Description: 00069 // Set/Get the font name used for input labels. Defaults to Helvetica. 00070 // It is best to stick to Times, Helvetica, Courier or Symbol 00071 vtkGetStringMacro(InputFontName); 00072 vtkSetStringMacro(InputFontName); 00073 00074 // Description: 00075 // Set/Get the font size used for input labels. Defaults to 8. 00076 vtkSetClampMacro(InputFontSize, int, 2, 200); 00077 vtkGetMacro(InputFontSize, int); 00078 00079 // Description: 00080 // Set/Get the font color used for input labels. Defaults to blue. 00081 vtkSetVector3Macro(InputFontColor,double); 00082 vtkGetVector3Macro(InputFontColor,double); 00083 00084 // Description: 00085 // Set/Get graph label (at the bottom of the graph). 00086 vtkGetStringMacro(GraphLabel); 00087 vtkSetStringMacro(GraphLabel); 00088 00089 // Description: 00090 // Set/Get the font name used for graph labels. Defaults to Helvetica. 00091 // Graph labels do not include state or input labels. 00092 // It is best to stick to Times, Helvetica, Courier or Symbol 00093 vtkGetStringMacro(GraphFontName); 00094 vtkSetStringMacro(GraphFontName); 00095 00096 // Description: 00097 // Set/Get the font size used for graph labels. Defaults to 12. 00098 // Graph labels do not include state or input labels. 00099 vtkSetClampMacro(GraphFontSize, int, 2, 200); 00100 vtkGetMacro(GraphFontSize, int); 00101 00102 // Description: 00103 // Set/Get the font color used for graph labels. Defaults to black. 00104 // Graph labels do not include state or input labels. 00105 vtkSetVector3Macro(GraphFontColor,double); 00106 vtkGetVector3Macro(GraphFontColor,double); 00107 00108 // Description: 00109 // Set/Get the preferred graph direction. Defaults to top to bottom. 00110 //BTX 00111 enum 00112 { 00113 GraphDirectionTopToBottom, 00114 GraphDirectionLeftToRight 00115 }; 00116 //ETX 00117 vtkSetClampMacro(GraphDirection, int, GraphDirectionTopToBottom, GraphDirectionLeftToRight); 00118 vtkGetMacro(GraphDirection, int); 00119 virtual void SetGraphDirectionToTopToBottom(); 00120 virtual void SetGraphDirectionToLeftToRight(); 00121 00122 // Description: 00123 // Set/Get if the all states should be put at the same rank. 00124 // If GraphDirection is TopToBottom, all nodes will share the same rank 00125 // horizontally, except the clusters which will still be set up in a 00126 // vertical fashion. If the GraphDirection is LeftToRight, all nodes 00127 // will share the same rank vertically, except the clusters which will still 00128 // be set up in a horizontal fashion. Experiment :) 00129 vtkBooleanMacro(PutStatesAtSameRank, int); 00130 vtkGetMacro(PutStatesAtSameRank, int); 00131 vtkSetMacro(PutStatesAtSameRank, int); 00132 00133 // Description: 00134 // Set/Get if the callbacks/commands associated to the state and 00135 // transitions should be shown (default) or hidden. 00136 vtkBooleanMacro(CommandVisibility, int); 00137 vtkGetMacro(CommandVisibility, int); 00138 vtkSetMacro(CommandVisibility, int); 00139 00140 // Description: 00141 // Set/Get the font name used for cluster labels. Defaults to Helvetica. 00142 // It is best to stick to Times, Helvetica, Courier or Symbol 00143 vtkGetStringMacro(ClusterFontName); 00144 vtkSetStringMacro(ClusterFontName); 00145 00146 // Description: 00147 // Set/Get the font size used for cluster labels. Defaults to 10. 00148 vtkSetClampMacro(ClusterFontSize, int, 2, 200); 00149 vtkGetMacro(ClusterFontSize, int); 00150 00151 // Description: 00152 // Set/Get the font color used for cluster labels. Defaults to black. 00153 vtkSetVector3Macro(ClusterFontColor,double); 00154 vtkGetVector3Macro(ClusterFontColor,double); 00155 00156 protected: 00157 vtkKWStateMachineDOTWriter(); 00158 ~vtkKWStateMachineDOTWriter(); 00159 00160 char *GraphLabel; 00161 char *GraphFontName; 00162 int GraphFontSize; 00163 double GraphFontColor[3]; 00164 int GraphDirection; 00165 00166 char *StateFontName; 00167 int StateFontSize; 00168 double StateFontColor[3]; 00169 00170 char *InputFontName; 00171 int InputFontSize; 00172 double InputFontColor[3]; 00173 00174 char *ClusterFontName; 00175 int ClusterFontSize; 00176 double ClusterFontColor[3]; 00177 00178 int PutStatesAtSameRank; 00179 int CommandVisibility; 00180 00181 private: 00182 00183 vtkKWStateMachineDOTWriter(const vtkKWStateMachineDOTWriter&); // Not implemented 00184 void operator=(const vtkKWStateMachineDOTWriter&); // Not implemented 00185 }; 00186 00187 #endif