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 |
|
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 |
581
|
27 #include <iostream.h> |
|
28 |
524
|
29 class tree_command; |
454
|
30 class tree_plot_command; |
578
|
31 class plot_limits; |
|
32 class plot_range; |
|
33 class subplot_using; |
|
34 class subplot_style; |
|
35 class subplot; |
|
36 class subplot_list; |
454
|
37 |
578
|
38 #include <SLList.h> |
|
39 |
872
|
40 #include "dColVector.h" |
|
41 |
|
42 #include "idx-vector.h" |
584
|
43 #include "tree-cmd.h" |
|
44 #include "tree-expr.h" |
454
|
45 |
|
46 class |
|
47 tree_plot_command : public tree_command |
|
48 { |
593
|
49 public: |
454
|
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 |
593
|
58 void print_code (ostream& os); |
581
|
59 |
593
|
60 private: |
454
|
61 int ndim; |
578
|
62 plot_limits *range; |
|
63 subplot_list *plot_list; |
454
|
64 }; |
|
65 |
|
66 class |
593
|
67 plot_limits : public tree_print_code |
454
|
68 { |
593
|
69 public: |
578
|
70 plot_limits (void); |
|
71 plot_limits (plot_range *xlim); |
|
72 plot_limits (plot_range *xlim, plot_range *ylim); |
|
73 plot_limits (plot_range *xlim, plot_range *ylim, |
|
74 plot_range *zlim); |
454
|
75 |
578
|
76 ~plot_limits (void); |
454
|
77 |
|
78 void print (int print, ostrstream& plot_buf); |
|
79 |
593
|
80 void print_code (ostream& os); |
|
81 |
|
82 private: |
578
|
83 plot_range *x_range; |
|
84 plot_range *y_range; |
|
85 plot_range *z_range; |
454
|
86 }; |
|
87 |
|
88 class |
593
|
89 plot_range : public tree_print_code |
454
|
90 { |
593
|
91 public: |
578
|
92 plot_range (void); |
|
93 plot_range (tree_expression *l, tree_expression *u); |
454
|
94 |
578
|
95 ~plot_range (void); |
454
|
96 |
|
97 void print (ostrstream& plot_buf); |
|
98 |
593
|
99 void print_code (ostream& os); |
|
100 |
|
101 private: |
491
|
102 tree_expression *lower; |
|
103 tree_expression *upper; |
454
|
104 }; |
|
105 |
|
106 class |
593
|
107 subplot_using : public tree_print_code |
454
|
108 { |
593
|
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 |
872
|
119 int eval (int ndim, int n_max); |
|
120 |
|
121 ColumnVector values (int ndim, int n_max = 0); |
|
122 |
454
|
123 int print (int ndim, int n_max, ostrstream& plot_buf); |
|
124 |
593
|
125 void print_code (ostream& os); |
|
126 |
|
127 private: |
454
|
128 int qualifier_count; |
491
|
129 tree_expression *x[4]; |
|
130 tree_expression *scanf_fmt; |
872
|
131 ColumnVector val; |
454
|
132 }; |
|
133 |
|
134 class |
593
|
135 subplot_style : public tree_print_code |
454
|
136 { |
593
|
137 public: |
578
|
138 subplot_style (void); |
|
139 subplot_style (char *s); |
|
140 subplot_style (char *s, tree_expression *lt); |
|
141 subplot_style (char *s, tree_expression *lt, tree_expression *pt); |
454
|
142 |
578
|
143 ~subplot_style (void); |
454
|
144 |
|
145 int print (ostrstream& plot_buf); |
|
146 |
872
|
147 int errorbars (void); |
|
148 |
593
|
149 void print_code (ostream& os); |
|
150 |
|
151 private: |
454
|
152 char *style; |
491
|
153 tree_expression *linetype; |
|
154 tree_expression *pointtype; |
454
|
155 }; |
|
156 |
578
|
157 class |
593
|
158 subplot : public tree_print_code |
578
|
159 { |
|
160 public: |
878
|
161 subplot (void); |
|
162 subplot (tree_expression *data); |
|
163 subplot (subplot_using *u, tree_expression *t, subplot_style *s); |
578
|
164 |
878
|
165 ~subplot (void); |
578
|
166 |
878
|
167 void set_data (tree_expression *data); |
578
|
168 |
872
|
169 tree_constant extract_plot_data (int ndim, tree_constant& data); |
|
170 |
|
171 int handle_plot_data (int ndim, ostrstream& plot_buf); |
|
172 |
878
|
173 int print (int ndim, ostrstream& plot_buf); |
|
174 |
593
|
175 void print_code (ostream& os); |
|
176 |
578
|
177 private: |
|
178 tree_expression *plot_data; |
999
|
179 subplot_using *using_clause; |
|
180 tree_expression *title_clause; |
|
181 subplot_style *style_clause; |
578
|
182 }; |
|
183 |
|
184 class |
593
|
185 subplot_list : public SLList<subplot *>, public tree_print_code |
578
|
186 { |
|
187 public: |
1227
|
188 subplot_list (void) : SLList<subplot *> (), tree_print_code () { } |
878
|
189 |
1227
|
190 subplot_list (subplot *t) : SLList<subplot *> (), tree_print_code () |
578
|
191 { append (t); } |
|
192 |
|
193 ~subplot_list (void) |
|
194 { |
|
195 while (! empty ()) |
|
196 { |
|
197 subplot *t = remove_front (); |
|
198 delete t; |
|
199 } |
|
200 } |
593
|
201 |
|
202 int print (int ndim, ostrstream& plot_buf); |
|
203 |
|
204 void print_code (ostream& os); |
578
|
205 }; |
|
206 |
524
|
207 extern char *save_in_tmp_file (tree_constant& t, int ndim = 2, |
|
208 int parametric = 0); |
|
209 |
|
210 extern void mark_for_deletion (const char *filename); |
|
211 |
|
212 extern void cleanup_tmp_files (void); |
|
213 |
|
214 extern void close_plot_stream (void); |
|
215 |
454
|
216 #endif |
|
217 |
|
218 /* |
|
219 ;;; Local Variables: *** |
|
220 ;;; mode: C++ *** |
|
221 ;;; page-delimiter: "^/\\*" *** |
|
222 ;;; End: *** |
|
223 */ |