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 |
584
|
44 #include "tree-cmd.h" |
|
45 #include "tree-expr.h" |
454
|
46 |
|
47 class |
|
48 tree_plot_command : public tree_command |
|
49 { |
|
50 public: |
|
51 tree_plot_command (void); |
578
|
52 tree_plot_command (subplot_list *plt, int nd); |
|
53 tree_plot_command (subplot_list *plt, plot_limits *rng, int nd); |
454
|
54 |
|
55 ~tree_plot_command (void); |
|
56 |
578
|
57 void eval (void); |
454
|
58 |
581
|
59 void print_code (ostream& os) |
|
60 { |
|
61 os << "<plot command printing not implemented yet>"; |
|
62 } |
|
63 |
454
|
64 private: |
|
65 int ndim; |
578
|
66 plot_limits *range; |
|
67 subplot_list *plot_list; |
454
|
68 }; |
|
69 |
|
70 class |
578
|
71 plot_limits |
454
|
72 { |
|
73 public: |
578
|
74 plot_limits (void); |
|
75 plot_limits (plot_range *xlim); |
|
76 plot_limits (plot_range *xlim, plot_range *ylim); |
|
77 plot_limits (plot_range *xlim, plot_range *ylim, |
|
78 plot_range *zlim); |
454
|
79 |
578
|
80 ~plot_limits (void); |
454
|
81 |
|
82 void print (int print, ostrstream& plot_buf); |
|
83 |
|
84 private: |
578
|
85 plot_range *x_range; |
|
86 plot_range *y_range; |
|
87 plot_range *z_range; |
454
|
88 }; |
|
89 |
|
90 class |
578
|
91 plot_range |
454
|
92 { |
|
93 public: |
578
|
94 plot_range (void); |
|
95 plot_range (tree_expression *l, tree_expression *u); |
454
|
96 |
578
|
97 ~plot_range (void); |
454
|
98 |
|
99 void print (ostrstream& plot_buf); |
|
100 |
|
101 private: |
491
|
102 tree_expression *lower; |
|
103 tree_expression *upper; |
454
|
104 }; |
|
105 |
|
106 class |
578
|
107 subplot_using |
454
|
108 { |
|
109 public: |
578
|
110 subplot_using (void); |
|
111 subplot_using (tree_expression *fmt); |
454
|
112 |
578
|
113 ~subplot_using (void); |
454
|
114 |
578
|
115 subplot_using *set_format (tree_expression *fmt); |
454
|
116 |
578
|
117 subplot_using *add_qualifier (tree_expression *t); |
454
|
118 |
|
119 int print (int ndim, int n_max, ostrstream& plot_buf); |
|
120 |
|
121 private: |
|
122 int qualifier_count; |
491
|
123 tree_expression *x[4]; |
|
124 tree_expression *scanf_fmt; |
454
|
125 }; |
|
126 |
|
127 class |
578
|
128 subplot_style |
454
|
129 { |
|
130 public: |
578
|
131 subplot_style (void); |
|
132 subplot_style (char *s); |
|
133 subplot_style (char *s, tree_expression *lt); |
|
134 subplot_style (char *s, tree_expression *lt, tree_expression *pt); |
454
|
135 |
578
|
136 ~subplot_style (void); |
454
|
137 |
|
138 int print (ostrstream& plot_buf); |
|
139 |
|
140 private: |
|
141 char *style; |
491
|
142 tree_expression *linetype; |
|
143 tree_expression *pointtype; |
454
|
144 }; |
|
145 |
578
|
146 class |
|
147 subplot |
|
148 { |
|
149 public: |
|
150 subplot (void) |
|
151 { |
|
152 plot_data = 0; |
|
153 using = 0; |
|
154 title = 0; |
|
155 style = 0; |
|
156 } |
|
157 |
|
158 subplot (tree_expression *data) |
|
159 { |
|
160 plot_data = data; |
|
161 using = 0; |
|
162 title = 0; |
|
163 style = 0; |
|
164 } |
|
165 |
|
166 subplot (subplot_using *u, tree_expression *t, |
|
167 subplot_style *s) |
|
168 { |
|
169 plot_data = 0; |
|
170 using = u; |
|
171 title = t; |
|
172 style = s; |
|
173 } |
|
174 |
|
175 ~subplot (void) |
|
176 { |
|
177 delete plot_data; |
|
178 delete using; |
|
179 delete title; |
|
180 delete style; |
|
181 } |
|
182 |
|
183 void set_data (tree_expression *data) |
|
184 { plot_data = data; } |
|
185 |
|
186 int print (int ndim, ostrstream& plot_buf); |
|
187 |
|
188 private: |
|
189 tree_expression *plot_data; |
|
190 subplot_using *using; |
|
191 tree_expression *title; |
|
192 subplot_style *style; |
|
193 }; |
|
194 |
|
195 class |
|
196 subplot_list : public SLList<subplot *> |
|
197 { |
|
198 public: |
|
199 subplot_list (void) : SLList<subplot *> () { } |
|
200 subplot_list (subplot *t) : SLList<subplot *> () |
|
201 { append (t); } |
|
202 |
|
203 ~subplot_list (void) |
|
204 { |
|
205 while (! empty ()) |
|
206 { |
|
207 subplot *t = remove_front (); |
|
208 delete t; |
|
209 } |
|
210 } |
|
211 }; |
|
212 |
524
|
213 extern char *save_in_tmp_file (tree_constant& t, int ndim = 2, |
|
214 int parametric = 0); |
|
215 |
|
216 extern void mark_for_deletion (const char *filename); |
|
217 |
|
218 extern void cleanup_tmp_files (void); |
|
219 |
|
220 extern int send_to_plot_stream (const char *cmd); |
|
221 |
|
222 extern void close_plot_stream (void); |
|
223 |
454
|
224 #endif |
|
225 |
|
226 /* |
|
227 ;;; Local Variables: *** |
|
228 ;;; mode: C++ *** |
|
229 ;;; page-delimiter: "^/\\*" *** |
|
230 ;;; End: *** |
|
231 */ |