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 |
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 int have_values; |
|
132 ColumnVector val; |
454
|
133 }; |
|
134 |
|
135 class |
593
|
136 subplot_style : public tree_print_code |
454
|
137 { |
593
|
138 public: |
578
|
139 subplot_style (void); |
|
140 subplot_style (char *s); |
|
141 subplot_style (char *s, tree_expression *lt); |
|
142 subplot_style (char *s, tree_expression *lt, tree_expression *pt); |
454
|
143 |
578
|
144 ~subplot_style (void); |
454
|
145 |
|
146 int print (ostrstream& plot_buf); |
|
147 |
872
|
148 int errorbars (void); |
|
149 |
593
|
150 void print_code (ostream& os); |
|
151 |
|
152 private: |
454
|
153 char *style; |
491
|
154 tree_expression *linetype; |
|
155 tree_expression *pointtype; |
454
|
156 }; |
|
157 |
578
|
158 class |
593
|
159 subplot : public tree_print_code |
578
|
160 { |
|
161 public: |
878
|
162 subplot (void); |
|
163 subplot (tree_expression *data); |
|
164 subplot (subplot_using *u, tree_expression *t, subplot_style *s); |
578
|
165 |
878
|
166 ~subplot (void); |
578
|
167 |
878
|
168 void set_data (tree_expression *data); |
578
|
169 |
872
|
170 tree_constant extract_plot_data (int ndim, tree_constant& data); |
|
171 |
|
172 int handle_plot_data (int ndim, ostrstream& plot_buf); |
|
173 |
878
|
174 int print (int ndim, ostrstream& plot_buf); |
|
175 |
593
|
176 void print_code (ostream& os); |
|
177 |
578
|
178 private: |
|
179 tree_expression *plot_data; |
|
180 subplot_using *using; |
|
181 tree_expression *title; |
|
182 subplot_style *style; |
|
183 }; |
|
184 |
|
185 class |
593
|
186 subplot_list : public SLList<subplot *>, public tree_print_code |
578
|
187 { |
|
188 public: |
|
189 subplot_list (void) : SLList<subplot *> () { } |
878
|
190 |
578
|
191 subplot_list (subplot *t) : SLList<subplot *> () |
|
192 { append (t); } |
|
193 |
|
194 ~subplot_list (void) |
|
195 { |
|
196 while (! empty ()) |
|
197 { |
|
198 subplot *t = remove_front (); |
|
199 delete t; |
|
200 } |
|
201 } |
593
|
202 |
|
203 int print (int ndim, ostrstream& plot_buf); |
|
204 |
|
205 void print_code (ostream& os); |
578
|
206 }; |
|
207 |
524
|
208 extern char *save_in_tmp_file (tree_constant& t, int ndim = 2, |
|
209 int parametric = 0); |
|
210 |
|
211 extern void mark_for_deletion (const char *filename); |
|
212 |
|
213 extern void cleanup_tmp_files (void); |
|
214 |
|
215 extern void close_plot_stream (void); |
|
216 |
454
|
217 #endif |
|
218 |
|
219 /* |
|
220 ;;; Local Variables: *** |
|
221 ;;; mode: C++ *** |
|
222 ;;; page-delimiter: "^/\\*" *** |
|
223 ;;; End: *** |
|
224 */ |