454
|
1 // tree-plot.h -*- C++ -*- |
|
2 /* |
|
3 |
|
4 Copyright (C) 1992, 1993, 1994 John W. Eaton |
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_tree_plot_h) |
|
25 #define octave_tree_plot_h 1 |
|
26 |
|
27 #if defined (__GNUG__) |
|
28 #pragma interface |
|
29 #endif |
|
30 |
581
|
31 #include <iostream.h> |
|
32 |
524
|
33 class tree_command; |
454
|
34 class tree_plot_command; |
578
|
35 class plot_limits; |
|
36 class plot_range; |
|
37 class subplot_using; |
|
38 class subplot_style; |
|
39 class subplot; |
|
40 class subplot_list; |
454
|
41 |
578
|
42 #include <SLList.h> |
|
43 |
524
|
44 #include "tree.h" |
454
|
45 |
|
46 class |
|
47 tree_plot_command : public tree_command |
|
48 { |
|
49 public: |
|
50 tree_plot_command (void); |
578
|
51 tree_plot_command (subplot_list *plt, int nd); |
|
52 tree_plot_command (subplot_list *plt, plot_limits *rng, int nd); |
454
|
53 |
|
54 ~tree_plot_command (void); |
|
55 |
578
|
56 void eval (void); |
454
|
57 |
581
|
58 void print_code (ostream& os) |
|
59 { |
|
60 os << "<plot command printing not implemented yet>"; |
|
61 } |
|
62 |
454
|
63 private: |
|
64 int ndim; |
578
|
65 plot_limits *range; |
|
66 subplot_list *plot_list; |
454
|
67 }; |
|
68 |
|
69 class |
578
|
70 plot_limits |
454
|
71 { |
|
72 public: |
578
|
73 plot_limits (void); |
|
74 plot_limits (plot_range *xlim); |
|
75 plot_limits (plot_range *xlim, plot_range *ylim); |
|
76 plot_limits (plot_range *xlim, plot_range *ylim, |
|
77 plot_range *zlim); |
454
|
78 |
578
|
79 ~plot_limits (void); |
454
|
80 |
|
81 void print (int print, ostrstream& plot_buf); |
|
82 |
|
83 private: |
578
|
84 plot_range *x_range; |
|
85 plot_range *y_range; |
|
86 plot_range *z_range; |
454
|
87 }; |
|
88 |
|
89 class |
578
|
90 plot_range |
454
|
91 { |
|
92 public: |
578
|
93 plot_range (void); |
|
94 plot_range (tree_expression *l, tree_expression *u); |
454
|
95 |
578
|
96 ~plot_range (void); |
454
|
97 |
|
98 void print (ostrstream& plot_buf); |
|
99 |
|
100 private: |
491
|
101 tree_expression *lower; |
|
102 tree_expression *upper; |
454
|
103 }; |
|
104 |
|
105 class |
578
|
106 subplot_using |
454
|
107 { |
|
108 public: |
578
|
109 subplot_using (void); |
|
110 subplot_using (tree_expression *fmt); |
454
|
111 |
578
|
112 ~subplot_using (void); |
454
|
113 |
578
|
114 subplot_using *set_format (tree_expression *fmt); |
454
|
115 |
578
|
116 subplot_using *add_qualifier (tree_expression *t); |
454
|
117 |
|
118 int print (int ndim, int n_max, ostrstream& plot_buf); |
|
119 |
|
120 private: |
|
121 int qualifier_count; |
491
|
122 tree_expression *x[4]; |
|
123 tree_expression *scanf_fmt; |
454
|
124 }; |
|
125 |
|
126 class |
578
|
127 subplot_style |
454
|
128 { |
|
129 public: |
578
|
130 subplot_style (void); |
|
131 subplot_style (char *s); |
|
132 subplot_style (char *s, tree_expression *lt); |
|
133 subplot_style (char *s, tree_expression *lt, tree_expression *pt); |
454
|
134 |
578
|
135 ~subplot_style (void); |
454
|
136 |
|
137 int print (ostrstream& plot_buf); |
|
138 |
|
139 private: |
|
140 char *style; |
491
|
141 tree_expression *linetype; |
|
142 tree_expression *pointtype; |
454
|
143 }; |
|
144 |
578
|
145 class |
|
146 subplot |
|
147 { |
|
148 public: |
|
149 subplot (void) |
|
150 { |
|
151 plot_data = 0; |
|
152 using = 0; |
|
153 title = 0; |
|
154 style = 0; |
|
155 } |
|
156 |
|
157 subplot (tree_expression *data) |
|
158 { |
|
159 plot_data = data; |
|
160 using = 0; |
|
161 title = 0; |
|
162 style = 0; |
|
163 } |
|
164 |
|
165 subplot (subplot_using *u, tree_expression *t, |
|
166 subplot_style *s) |
|
167 { |
|
168 plot_data = 0; |
|
169 using = u; |
|
170 title = t; |
|
171 style = s; |
|
172 } |
|
173 |
|
174 ~subplot (void) |
|
175 { |
|
176 delete plot_data; |
|
177 delete using; |
|
178 delete title; |
|
179 delete style; |
|
180 } |
|
181 |
|
182 void set_data (tree_expression *data) |
|
183 { plot_data = data; } |
|
184 |
|
185 int print (int ndim, ostrstream& plot_buf); |
|
186 |
|
187 private: |
|
188 tree_expression *plot_data; |
|
189 subplot_using *using; |
|
190 tree_expression *title; |
|
191 subplot_style *style; |
|
192 }; |
|
193 |
|
194 class |
|
195 subplot_list : public SLList<subplot *> |
|
196 { |
|
197 public: |
|
198 subplot_list (void) : SLList<subplot *> () { } |
|
199 subplot_list (subplot *t) : SLList<subplot *> () |
|
200 { append (t); } |
|
201 |
|
202 ~subplot_list (void) |
|
203 { |
|
204 while (! empty ()) |
|
205 { |
|
206 subplot *t = remove_front (); |
|
207 delete t; |
|
208 } |
|
209 } |
|
210 }; |
|
211 |
524
|
212 extern char *save_in_tmp_file (tree_constant& t, int ndim = 2, |
|
213 int parametric = 0); |
|
214 |
|
215 extern void mark_for_deletion (const char *filename); |
|
216 |
|
217 extern void cleanup_tmp_files (void); |
|
218 |
|
219 extern int send_to_plot_stream (const char *cmd); |
|
220 |
|
221 extern void close_plot_stream (void); |
|
222 |
454
|
223 #endif |
|
224 |
|
225 /* |
|
226 ;;; Local Variables: *** |
|
227 ;;; mode: C++ *** |
|
228 ;;; page-delimiter: "^/\\*" *** |
|
229 ;;; End: *** |
|
230 */ |