1 //////////////////////////////////////////////////////////////////////////////
4 // ADLib, Prop and their related set of tools and documentation are in the
5 // public domain. The author(s) of this software reserve no copyrights on
6 // the source code and any code generated using the tools. You are encouraged
7 // to use ADLib and Prop to develop software, in both academic and commercial
8 // settings, and are welcomed to incorporate any part of ADLib and Prop into
11 // Although you are under no obligation to do so, we strongly recommend that
12 // you give away all software developed using our tools.
14 // We also ask that credit be given to us when ADLib and/or Prop are used in
15 // your programs, and that this notice be preserved intact in all the source
18 // This software is still under development and we welcome(read crave for)
19 // any suggestions and help from the users.
21 // Allen Leung (leunga@cs.nyu.edu)
23 //////////////////////////////////////////////////////////////////////////////
25 #ifndef vcg_visualizer_h
26 #define vcg_visualizer_h
28 #include <AD/generic/generic.h>
34 //////////////////////////////////////////////////////////////////////////////
36 // Visualizer base class
38 //////////////////////////////////////////////////////////////////////////////
41 void operator = (const VCG
&);
44 //////////////////////////////////////////////////////////////////////////
48 //////////////////////////////////////////////////////////////////////////
49 typedef const char * Label
;
50 typedef const char * String
;
51 typedef const struct color
* Color
;
52 typedef const void * Node
;
54 typedef const struct text_mode
* TextMode
;
55 typedef const struct shape
* Shape
;
56 typedef const struct algorithm
* Algorithm
;
57 typedef const struct linestyle
* LineStyle
;
58 typedef const struct arrowstyle
* ArrowStyle
;
59 enum EdgeType
{ NORMAL_EDGE
, BACK_EDGE
, NEAR_EDGE
, BENT_NEAR_EDGE
};
62 ///////////////////////////////////////////////////////////////////////////
64 // Predefined constants
66 ///////////////////////////////////////////////////////////////////////////
67 static Color black
, blue
, red
, green
, yellow
, magenta
, cyan
,
68 white
, darkgrey
, darkblue
, darkred
, darkgreen
,
69 darkyellow
, darkmagneta
, darkcyan
, gold
, lightgrey
,
70 lightblue
, lightred
, lightgreen
, lightyellow
,
71 lightmagenta
, lightcyan
, lilac
, turquoise
, aquamarine
,
72 khaki
, purple
, yellowgreen
, pink
, orange
, orchid
;
74 static TextMode center
, left_justify
, right_justify
;
76 static Shape box
, rhomb
, ellipse
, triangle
;
78 static Algorithm maxdepth
, mindepth
, maxdepthslow
, mindepthslow
,
79 maxdegree
, mindegree
, maxindegree
, minindegree
,
80 maxoutdegree
, minoutdegree
, minbackward
, dfs
, tree
;
82 static LineStyle continuous
, dashed
, dotted
, invisible
;
84 static ArrowStyle solid
, line
, none
;
90 ///////////////////////////////////////////////////////////////////////////
92 // Test whether a node/graph or an edge has already been visited.
94 ///////////////////////////////////////////////////////////////////////////
95 Bool
visited(Node
) const;
96 Bool
visited(Node
, Node
) const;
98 ///////////////////////////////////////////////////////////////////////////
100 // Error handling method
102 ///////////////////////////////////////////////////////////////////////////
103 virtual VCG
& error (const char *, ...);
105 ///////////////////////////////////////////////////////////////////////////
107 // Create graph objects
109 ///////////////////////////////////////////////////////////////////////////
110 virtual VCG
& begin_graph(Graph
);
111 virtual VCG
& end_graph(Graph
);
112 virtual VCG
& begin_node(Node
);
113 virtual VCG
& end_node(Node
);
114 virtual VCG
& begin_edge(Node
, Node
, EdgeType
= NORMAL_EDGE
);
115 virtual VCG
& end_edge(Node
, Node
);
117 VCG
& edge(Node
, Node
, EdgeType
= NORMAL_EDGE
);
118 VCG
& begin_backedge(Node
, Node
);
119 VCG
& begin_nearedge(Node
, Node
);
120 VCG
& begin_bentnearedge(Node
, Node
);
122 ///////////////////////////////////////////////////////////////////////////
124 // Print Graph Description Language(GDL)
126 ///////////////////////////////////////////////////////////////////////////
127 virtual VCG
& print_GDL_on(ostream
&);
129 ///////////////////////////////////////////////////////////////////////////
133 ///////////////////////////////////////////////////////////////////////////
134 VCG
& begin_node_default();
135 VCG
& begin_edge_default();
137 virtual VCG
& attrib(String
,String
);
138 virtual VCG
& attrib_quoted(String
,String
);
139 virtual VCG
& attrib_int(String
,int);
140 virtual VCG
& attrib_bool(String
,Bool
);
142 ///////////////////////////////////////////////////////////////////////////
144 // Common object attributes
146 ///////////////////////////////////////////////////////////////////////////
150 VCG
& textcolor(Color
);
153 VCG
& borderwidth(int);
159 VCG
& textmode(TextMode
);
161 VCG
& vertical_order(int);
162 VCG
& horizontal_order(int);
173 VCG
& classname(String
);
174 VCG
& infoname(String
);
175 VCG
& layoutalgorithm(Algorithm
);
176 VCG
& layout_downfactor(int);
177 VCG
& layout_upfactor(int);
178 VCG
& layout_nearfactor(int);
179 VCG
& layout_splinefactor(int);
180 VCG
& late_edge_labels(Bool
);
181 VCG
& display_edge_labels(Bool
);
182 VCG
& dirty_edge_labels(Bool
);
183 VCG
& finetuning(Bool
);
185 VCG
& thickness(int i
);
186 VCG
& linestyle(LineStyle s
);
187 VCG
& arrowstyle(ArrowStyle s
);
188 VCG
& backarrowstyle(ArrowStyle s
);
189 VCG
& arrowsize(int i
);
190 VCG
& backarrowsize(int i
);
191 VCG
& arrowcolor(Color c
);
192 VCG
& backarrowcolor(Color c
);
193 VCG
& priority(int i
);