454
|
1 // tree-plot.h -*- C++ -*- |
|
2 /* |
|
3 |
1009
|
4 Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton |
454
|
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 |
1315
|
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
454
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_tree_plot_h) |
|
25 #define octave_tree_plot_h 1 |
|
26 |
1297
|
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 |
872
|
44 #include "dColVector.h" |
|
45 |
|
46 #include "idx-vector.h" |
584
|
47 #include "tree-cmd.h" |
|
48 #include "tree-expr.h" |
454
|
49 |
|
50 class |
|
51 tree_plot_command : public tree_command |
|
52 { |
593
|
53 public: |
454
|
54 tree_plot_command (void); |
578
|
55 tree_plot_command (subplot_list *plt, int nd); |
|
56 tree_plot_command (subplot_list *plt, plot_limits *rng, int nd); |
454
|
57 |
|
58 ~tree_plot_command (void); |
|
59 |
578
|
60 void eval (void); |
454
|
61 |
593
|
62 void print_code (ostream& os); |
581
|
63 |
593
|
64 private: |
454
|
65 int ndim; |
578
|
66 plot_limits *range; |
|
67 subplot_list *plot_list; |
454
|
68 }; |
|
69 |
|
70 class |
593
|
71 plot_limits : public tree_print_code |
454
|
72 { |
593
|
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 |
593
|
84 void print_code (ostream& os); |
|
85 |
|
86 private: |
578
|
87 plot_range *x_range; |
|
88 plot_range *y_range; |
|
89 plot_range *z_range; |
454
|
90 }; |
|
91 |
|
92 class |
593
|
93 plot_range : public tree_print_code |
454
|
94 { |
593
|
95 public: |
578
|
96 plot_range (void); |
|
97 plot_range (tree_expression *l, tree_expression *u); |
454
|
98 |
578
|
99 ~plot_range (void); |
454
|
100 |
|
101 void print (ostrstream& plot_buf); |
|
102 |
593
|
103 void print_code (ostream& os); |
|
104 |
|
105 private: |
491
|
106 tree_expression *lower; |
|
107 tree_expression *upper; |
454
|
108 }; |
|
109 |
|
110 class |
593
|
111 subplot_using : public tree_print_code |
454
|
112 { |
593
|
113 public: |
578
|
114 subplot_using (void); |
|
115 subplot_using (tree_expression *fmt); |
454
|
116 |
578
|
117 ~subplot_using (void); |
454
|
118 |
578
|
119 subplot_using *set_format (tree_expression *fmt); |
454
|
120 |
578
|
121 subplot_using *add_qualifier (tree_expression *t); |
454
|
122 |
872
|
123 int eval (int ndim, int n_max); |
|
124 |
|
125 ColumnVector values (int ndim, int n_max = 0); |
|
126 |
454
|
127 int print (int ndim, int n_max, ostrstream& plot_buf); |
|
128 |
593
|
129 void print_code (ostream& os); |
|
130 |
|
131 private: |
454
|
132 int qualifier_count; |
491
|
133 tree_expression *x[4]; |
|
134 tree_expression *scanf_fmt; |
872
|
135 ColumnVector val; |
454
|
136 }; |
|
137 |
|
138 class |
593
|
139 subplot_style : public tree_print_code |
454
|
140 { |
593
|
141 public: |
578
|
142 subplot_style (void); |
|
143 subplot_style (char *s); |
|
144 subplot_style (char *s, tree_expression *lt); |
|
145 subplot_style (char *s, tree_expression *lt, tree_expression *pt); |
454
|
146 |
578
|
147 ~subplot_style (void); |
454
|
148 |
|
149 int print (ostrstream& plot_buf); |
|
150 |
872
|
151 int errorbars (void); |
|
152 |
593
|
153 void print_code (ostream& os); |
|
154 |
|
155 private: |
454
|
156 char *style; |
491
|
157 tree_expression *linetype; |
|
158 tree_expression *pointtype; |
454
|
159 }; |
|
160 |
578
|
161 class |
593
|
162 subplot : public tree_print_code |
578
|
163 { |
|
164 public: |
878
|
165 subplot (void); |
|
166 subplot (tree_expression *data); |
|
167 subplot (subplot_using *u, tree_expression *t, subplot_style *s); |
578
|
168 |
878
|
169 ~subplot (void); |
578
|
170 |
878
|
171 void set_data (tree_expression *data); |
578
|
172 |
872
|
173 tree_constant extract_plot_data (int ndim, tree_constant& data); |
|
174 |
|
175 int handle_plot_data (int ndim, ostrstream& plot_buf); |
|
176 |
878
|
177 int print (int ndim, ostrstream& plot_buf); |
|
178 |
593
|
179 void print_code (ostream& os); |
|
180 |
578
|
181 private: |
|
182 tree_expression *plot_data; |
999
|
183 subplot_using *using_clause; |
|
184 tree_expression *title_clause; |
|
185 subplot_style *style_clause; |
578
|
186 }; |
|
187 |
|
188 class |
593
|
189 subplot_list : public SLList<subplot *>, public tree_print_code |
578
|
190 { |
|
191 public: |
1227
|
192 subplot_list (void) : SLList<subplot *> (), tree_print_code () { } |
878
|
193 |
1227
|
194 subplot_list (subplot *t) : SLList<subplot *> (), tree_print_code () |
578
|
195 { append (t); } |
|
196 |
|
197 ~subplot_list (void) |
|
198 { |
|
199 while (! empty ()) |
|
200 { |
|
201 subplot *t = remove_front (); |
|
202 delete t; |
|
203 } |
|
204 } |
593
|
205 |
|
206 int print (int ndim, ostrstream& plot_buf); |
|
207 |
|
208 void print_code (ostream& os); |
578
|
209 }; |
|
210 |
524
|
211 extern char *save_in_tmp_file (tree_constant& t, int ndim = 2, |
|
212 int parametric = 0); |
|
213 |
|
214 extern void mark_for_deletion (const char *filename); |
|
215 |
|
216 extern void cleanup_tmp_files (void); |
|
217 |
|
218 extern void close_plot_stream (void); |
|
219 |
1328
|
220 extern void do_external_plotter_cd (const char *newdir); |
|
221 |
454
|
222 #endif |
|
223 |
|
224 /* |
|
225 ;;; Local Variables: *** |
|
226 ;;; mode: C++ *** |
|
227 ;;; page-delimiter: "^/\\*" *** |
|
228 ;;; End: *** |
|
229 */ |