Mercurial > hg > octave-nkf
annotate src/graphics.cc @ 11851:651401a1c39b release-3-0-x
change is_square to issquare in is_stabilizable.m
author | Brett Stewart <btstewart@wisc.edu> |
---|---|
date | Mon, 22 Sep 2008 19:41:08 +0200 |
parents | 642af2e62b1f |
children | bfac13fcb6fe |
rev | line source |
---|---|
6406 | 1 /* |
2 | |
11740 | 3 Copyright (C) 2007, 2008 John W. Eaton |
6406 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
6406 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
6406 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 #include <config.h> | |
25 #endif | |
26 | |
27 #include <cctype> | |
7222 | 28 #include <cfloat> |
7286 | 29 #include <cstdlib> |
6406 | 30 |
31 #include <algorithm> | |
32 #include <list> | |
33 #include <map> | |
34 #include <set> | |
35 #include <string> | |
36 | |
6705 | 37 #include "defun.h" |
38 #include "error.h" | |
6595 | 39 #include "graphics.h" |
6705 | 40 #include "ov.h" |
41 #include "oct-obj.h" | |
42 #include "oct-map.h" | |
43 #include "ov-fcn-handle.h" | |
44 #include "parse.h" | |
7222 | 45 #include "unwind-prot.h" |
6595 | 46 |
6406 | 47 static void |
48 gripe_set_invalid (const std::string& pname) | |
49 { | |
50 error ("set: invalid value for %s property", pname.c_str ()); | |
51 } | |
52 | |
53 // --------------------------------------------------------------------- | |
54 | |
6705 | 55 radio_values::radio_values (const std::string& opt_string) |
6406 | 56 { |
6705 | 57 size_t beg = 0; |
58 size_t len = opt_string.length (); | |
59 bool done = len == 0; | |
6681 | 60 |
6705 | 61 while (! done) |
62 { | |
63 size_t end = opt_string.find ('|', beg); | |
6681 | 64 |
6705 | 65 if (end == std::string::npos) |
66 { | |
67 end = len; | |
68 done = true; | |
69 } | |
6681 | 70 |
6705 | 71 std::string t = opt_string.substr (beg, end-beg); |
6681 | 72 |
6705 | 73 // Might want more error checking here... |
74 if (t[0] == '{') | |
75 { | |
76 t = t.substr (1, t.length () - 2); | |
77 default_val = t; | |
78 } | |
79 else if (beg == 0) // ensure default value | |
80 default_val = t; | |
6681 | 81 |
6705 | 82 possible_vals.insert (t); |
6681 | 83 |
6705 | 84 beg = end + 1; |
85 } | |
86 } | |
6681 | 87 |
6705 | 88 bool |
6761 | 89 color_values::str2rgb (std::string str) |
6681 | 90 { |
6705 | 91 double tmp_rgb[3] = {0, 0, 0}; |
92 bool retval = true; | |
6761 | 93 unsigned int len = str.length(); |
6681 | 94 |
6925 | 95 std::transform (str.begin (), str.end (), str.begin (), tolower); |
96 | |
6761 | 97 if (str.compare(0, len, "blue", 0, len) == 0) |
98 tmp_rgb[2] = 1; | |
6925 | 99 else if (str.compare(0, len, "black", 0, len) == 0 || |
100 str.compare(0, len, "k", 0, len) == 0) | |
6761 | 101 tmp_rgb[0] = tmp_rgb[1] = tmp_rgb[2] = 0; |
102 else if (str.compare(0, len, "red", 0, len) == 0) | |
103 tmp_rgb[0] = 1; | |
104 else if (str.compare(0, len, "green", 0, len) == 0) | |
105 tmp_rgb[1] = 1; | |
106 else if (str.compare(0, len, "yellow", 0, len) == 0) | |
107 tmp_rgb[0] = tmp_rgb[1] = 1; | |
108 else if (str.compare(0, len, "magenta", 0, len) == 0) | |
109 tmp_rgb[0] = tmp_rgb[2] = 1; | |
110 else if (str.compare(0, len, "cyan", 0, len) == 0) | |
111 tmp_rgb[1] = tmp_rgb[2] = 1; | |
6925 | 112 else if (str.compare(0, len, "white", 0, len) == 0 || |
113 str.compare(0, len, "w", 0, len) == 0) | |
6761 | 114 tmp_rgb[0] = tmp_rgb[1] = tmp_rgb[2] = 1; |
115 else | |
116 retval = false; | |
6406 | 117 |
6705 | 118 if (retval) |
119 { | |
120 for (int i = 0; i < 3; i++) | |
121 xrgb[i] = tmp_rgb[i]; | |
122 } | |
6563 | 123 |
6705 | 124 return retval; |
125 } | |
6681 | 126 |
6938 | 127 color_property::color_property (const octave_value& val) |
128 : radio_val (), current_val () | |
6705 | 129 { |
130 // FIXME -- need some error checking here. | |
6681 | 131 |
6705 | 132 if (val.is_string ()) |
133 { | |
134 std::string s = val.string_value (); | |
6681 | 135 |
6705 | 136 if (! s.empty ()) |
137 { | |
6938 | 138 color_values col (s); |
139 if (! error_state) | |
6705 | 140 { |
6938 | 141 color_val = col; |
142 current_type = color_t; | |
6705 | 143 } |
144 } | |
145 else | |
146 error ("invalid color specification"); | |
147 } | |
148 else if (val.is_real_matrix ()) | |
149 { | |
150 Matrix m = val.matrix_value (); | |
6563 | 151 |
6705 | 152 if (m.numel () == 3) |
153 { | |
154 color_values col (m (0), m (1), m(2)); | |
155 if (! error_state) | |
156 { | |
157 color_val = col; | |
158 current_type = color_t; | |
159 } | |
160 } | |
161 else | |
162 error ("invalid color specification"); | |
163 } | |
164 else | |
165 error ("invalid color specification"); | |
166 } | |
6406 | 167 |
6790 | 168 // We also provide this assignment operator so that assignment from an |
169 // octave_value object can happen without wiping out list of possible | |
170 // radio_values set in color_property constructor. | |
171 | |
172 color_property& | |
173 color_property::operator = (const octave_value& val) | |
174 { | |
175 if (val.is_string ()) | |
176 { | |
177 std::string s = val.string_value (); | |
178 | |
179 if (! s.empty ()) | |
180 { | |
6898 | 181 if (radio_val.contains (s)) |
6790 | 182 { |
183 current_val = s; | |
184 current_type = radio_t; | |
185 } | |
186 else | |
187 { | |
188 color_values col (s); | |
189 if (! error_state) | |
190 { | |
191 color_val = col; | |
192 current_type = color_t; | |
193 } | |
194 else | |
195 error ("invalid color specification"); | |
196 } | |
197 } | |
198 else | |
199 error ("invalid color specification"); | |
200 } | |
201 else if (val.is_real_matrix ()) | |
202 { | |
203 Matrix m = val.matrix_value (); | |
204 | |
205 if (m.numel () == 3) | |
206 { | |
207 color_values col (m (0), m (1), m(2)); | |
208 if (! error_state) | |
209 { | |
210 color_val = col; | |
211 current_type = color_t; | |
212 } | |
213 } | |
214 else | |
215 error ("invalid color specification"); | |
216 } | |
217 else | |
218 error ("invalid color specification"); | |
219 | |
220 return *this; | |
221 } | |
222 | |
6681 | 223 |
6705 | 224 void |
7189 | 225 property_list::set (const caseless_str& name, const octave_value& val) |
6681 | 226 { |
6705 | 227 size_t offset = 0; |
6681 | 228 |
6705 | 229 size_t len = name.length (); |
6681 | 230 |
6705 | 231 if (len > 4) |
232 { | |
7189 | 233 caseless_str pfx = name.substr (0, 4); |
6681 | 234 |
6705 | 235 if (pfx.compare ("axes") || pfx.compare ("line") |
236 || pfx.compare ("text")) | |
237 offset = 4; | |
238 else if (len > 5) | |
239 { | |
240 pfx = name.substr (0, 5); | |
6681 | 241 |
6807 | 242 if (pfx.compare ("image") || pfx.compare ("patch")) |
6705 | 243 offset = 5; |
244 else if (len > 6) | |
245 { | |
246 pfx = name.substr (0, 6); | |
6681 | 247 |
6705 | 248 if (pfx.compare ("figure")) |
249 offset = 6; | |
250 else if (len > 7) | |
251 { | |
252 pfx = name.substr (0, 7); | |
6681 | 253 |
6705 | 254 if (pfx.compare ("surface")) |
255 offset = 7; | |
256 } | |
257 } | |
258 } | |
6681 | 259 |
6705 | 260 if (offset > 0) |
261 { | |
262 // FIXME -- should we validate property names and values here? | |
6406 | 263 |
6705 | 264 std::string pname = name.substr (offset); |
6406 | 265 |
6705 | 266 std::transform (pfx.begin (), pfx.end (), pfx.begin (), tolower); |
267 std::transform (pname.begin (), pname.end (), pname.begin (), tolower); | |
6406 | 268 |
6705 | 269 bool remove = false; |
270 if (val.is_string ()) | |
271 { | |
7189 | 272 caseless_str tval = val.string_value (); |
6406 | 273 |
6705 | 274 remove = tval.compare ("remove"); |
275 } | |
6406 | 276 |
6705 | 277 pval_map_type& pval_map = plist_map[pfx]; |
6406 | 278 |
6705 | 279 if (remove) |
280 { | |
281 pval_map_iterator p = pval_map.find (pname); | |
6406 | 282 |
6705 | 283 if (p != pval_map.end ()) |
284 pval_map.erase (p); | |
285 } | |
286 else | |
287 pval_map[pname] = val; | |
288 } | |
289 } | |
6406 | 290 |
6705 | 291 if (offset == 0) |
292 error ("invalid default property specification"); | |
293 } | |
6406 | 294 |
6705 | 295 octave_value |
7189 | 296 property_list::lookup (const caseless_str& name) const |
6705 | 297 { |
298 octave_value retval; | |
6406 | 299 |
6705 | 300 size_t offset = 0; |
6406 | 301 |
6705 | 302 size_t len = name.length (); |
6406 | 303 |
6705 | 304 if (len > 4) |
305 { | |
7189 | 306 caseless_str pfx = name.substr (0, 4); |
6406 | 307 |
6705 | 308 if (pfx.compare ("axes") || pfx.compare ("line") |
309 || pfx.compare ("text")) | |
310 offset = 4; | |
311 else if (len > 5) | |
312 { | |
313 pfx = name.substr (0, 5); | |
6406 | 314 |
6807 | 315 if (pfx.compare ("image") || pfx.compare ("patch")) |
6705 | 316 offset = 5; |
317 else if (len > 6) | |
318 { | |
319 pfx = name.substr (0, 6); | |
6406 | 320 |
6705 | 321 if (pfx.compare ("figure")) |
322 offset = 6; | |
323 else if (len > 7) | |
324 { | |
325 pfx = name.substr (0, 7); | |
6406 | 326 |
6705 | 327 if (pfx.compare ("surface")) |
328 offset = 7; | |
329 } | |
330 } | |
331 } | |
6406 | 332 |
6705 | 333 if (offset > 0) |
334 { | |
335 std::string pname = name.substr (offset); | |
6406 | 336 |
6705 | 337 std::transform (pfx.begin (), pfx.end (), pfx.begin (), tolower); |
338 std::transform (pname.begin (), pname.end (), pname.begin (), tolower); | |
6406 | 339 |
6705 | 340 plist_map_const_iterator p = find (pfx); |
6432 | 341 |
6705 | 342 if (p != end ()) |
343 { | |
344 const pval_map_type& pval_map = p->second; | |
6406 | 345 |
6705 | 346 pval_map_const_iterator q = pval_map.find (pname); |
6406 | 347 |
6705 | 348 if (q != pval_map.end ()) |
349 retval = q->second; | |
350 } | |
351 } | |
352 } | |
6406 | 353 |
6705 | 354 return retval; |
355 } | |
6406 | 356 |
6705 | 357 Octave_map |
358 property_list::as_struct (const std::string& prefix_arg) const | |
359 { | |
360 Octave_map m; | |
6406 | 361 |
6705 | 362 for (plist_map_const_iterator p = begin (); p != end (); p++) |
363 { | |
364 std::string prefix = prefix_arg + p->first; | |
6406 | 365 |
6705 | 366 const pval_map_type pval_map = p->second; |
6406 | 367 |
6705 | 368 for (pval_map_const_iterator q = pval_map.begin (); |
369 q != pval_map.end (); | |
370 q++) | |
371 m.assign (prefix + q->first, q->second); | |
372 } | |
6406 | 373 |
6705 | 374 return m; |
375 } | |
6432 | 376 |
6874 | 377 graphics_handle::graphics_handle (const octave_value& a) |
378 : val (octave_NaN) | |
379 { | |
380 if (a.is_empty ()) | |
381 /* do nothing */; | |
382 else | |
383 { | |
384 double tval = a.double_value (); | |
385 | |
386 if (! error_state) | |
387 val = tval; | |
388 else | |
389 error ("invalid graphics handle"); | |
390 } | |
391 } | |
392 | |
6705 | 393 void |
394 graphics_object::set (const octave_value_list& args) | |
395 { | |
396 int nargin = args.length (); | |
6406 | 397 |
6705 | 398 if (nargin == 0) |
399 rep->defaults (); | |
400 else if (nargin % 2 == 0) | |
401 { | |
402 for (int i = 0; i < nargin; i += 2) | |
403 { | |
7189 | 404 caseless_str name = args(i).string_value (); |
6406 | 405 |
6705 | 406 if (! error_state) |
407 { | |
408 octave_value val = args(i+1); | |
6406 | 409 |
6705 | 410 if (val.is_string ()) |
411 { | |
7189 | 412 caseless_str tval = val.string_value (); |
6406 | 413 |
6705 | 414 if (tval.compare ("default")) |
415 val = get_default (name); | |
416 else if (tval.compare ("factory")) | |
417 val = get_factory_default (name); | |
418 } | |
6406 | 419 |
6705 | 420 if (error_state) |
421 break; | |
6406 | 422 |
6705 | 423 rep->set (name, val); |
424 } | |
425 else | |
426 error ("set: expecting argument %d to be a property name", i); | |
427 } | |
428 } | |
429 else | |
430 error ("set: invalid number of arguments"); | |
431 } | |
6406 | 432 |
433 | |
6705 | 434 graphics_handle |
435 gh_manager::get_handle (const std::string& go_name) | |
436 { | |
437 graphics_handle retval; | |
6406 | 438 |
6705 | 439 if (go_name == "figure") |
440 { | |
441 // We always want the lowest unused figure number. | |
6406 | 442 |
6705 | 443 retval = 1; |
6425 | 444 |
6705 | 445 while (handle_map.find (retval) != handle_map.end ()) |
446 retval++; | |
447 } | |
448 else | |
449 { | |
450 free_list_iterator p = handle_free_list.begin (); | |
6406 | 451 |
6705 | 452 if (p != handle_free_list.end ()) |
453 { | |
454 retval = *p; | |
455 handle_free_list.erase (p); | |
456 } | |
457 else | |
7286 | 458 { |
459 static double maxrand = RAND_MAX + 2.0; | |
460 | |
461 retval = graphics_handle (next_handle); | |
462 | |
7304 | 463 next_handle = ceil (next_handle) - 1.0 - (rand () + 1.0) / maxrand; |
7286 | 464 } |
6705 | 465 } |
6406 | 466 |
6705 | 467 return retval; |
468 } | |
6406 | 469 |
6705 | 470 void |
471 gh_manager::do_free (const graphics_handle& h) | |
472 { | |
7056 | 473 if (h.ok ()) |
6705 | 474 { |
6874 | 475 if (h.value () != 0) |
6705 | 476 { |
6874 | 477 iterator p = handle_map.find (h); |
478 | |
479 if (p != handle_map.end ()) | |
480 { | |
481 handle_map.erase (p); | |
482 | |
483 if (h.value () < 0) | |
484 handle_free_list.insert (h); | |
485 } | |
486 else | |
487 error ("graphics_handle::free: invalid object %g", h.value ()); | |
6705 | 488 } |
489 else | |
6874 | 490 error ("graphics_handle::free: can't delete root figure"); |
6705 | 491 } |
492 } | |
6406 | 493 |
494 gh_manager *gh_manager::instance = 0; | |
495 | |
496 static void | |
7189 | 497 xset (const graphics_handle& h, const caseless_str& name, |
6406 | 498 const octave_value& val) |
499 { | |
500 graphics_object obj = gh_manager::get_object (h); | |
501 obj.set (name, val); | |
502 } | |
503 | |
504 static void | |
505 xset (const graphics_handle& h, const octave_value_list& args) | |
506 { | |
507 if (args.length () > 0) | |
508 { | |
509 graphics_object obj = gh_manager::get_object (h); | |
510 obj.set (args); | |
511 } | |
512 } | |
513 | |
514 | |
515 static octave_value | |
7189 | 516 xget (const graphics_handle& h, const caseless_str& name) |
6406 | 517 { |
518 graphics_object obj = gh_manager::get_object (h); | |
519 return obj.get (name); | |
520 } | |
521 | |
522 static graphics_handle | |
523 reparent (const octave_value& ov, const std::string& who, | |
524 const std::string& property, const graphics_handle& new_parent, | |
525 bool adopt = true) | |
526 { | |
527 graphics_handle h = octave_NaN; | |
528 | |
529 double val = ov.double_value (); | |
530 | |
531 if (! error_state) | |
532 { | |
533 h = gh_manager::lookup (val); | |
534 | |
7056 | 535 if (h.ok ()) |
6406 | 536 { |
537 graphics_object obj = gh_manager::get_object (h); | |
538 | |
539 graphics_handle parent_h = obj.get_parent (); | |
540 | |
541 graphics_object parent_obj = gh_manager::get_object (parent_h); | |
542 | |
543 parent_obj.remove_child (h); | |
544 | |
545 if (adopt) | |
6874 | 546 obj.set ("parent", new_parent.value ()); |
6406 | 547 else |
548 obj.reparent (new_parent); | |
549 } | |
550 else | |
551 error ("%s: invalid graphics handle (= %g) for %s", | |
552 who.c_str (), val, property.c_str ()); | |
553 } | |
554 else | |
555 error ("%s: expecting %s to be a graphics handle", | |
556 who.c_str (), property.c_str ()); | |
557 | |
558 return h; | |
559 } | |
560 | |
561 // This function is NOT equivalent to the scripting language function gcf. | |
562 graphics_handle | |
563 gcf (void) | |
564 { | |
565 octave_value val = xget (0, "currentfigure"); | |
566 | |
567 return val.is_empty () ? octave_NaN : val.double_value (); | |
568 } | |
569 | |
570 // This function is NOT equivalent to the scripting language function gca. | |
571 graphics_handle | |
572 gca (void) | |
573 { | |
574 octave_value val = xget (gcf (), "currentaxes"); | |
575 | |
576 return val.is_empty () ? octave_NaN : val.double_value (); | |
577 } | |
578 | |
579 static void | |
580 adopt (const graphics_handle& p, const graphics_handle& h) | |
581 { | |
582 graphics_object parent_obj = gh_manager::get_object (p); | |
583 | |
584 parent_obj.adopt (h); | |
585 } | |
586 | |
587 static bool | |
7056 | 588 is_handle (const graphics_handle& h) |
589 { | |
590 return h.ok (); | |
591 } | |
592 | |
593 static bool | |
6406 | 594 is_handle (double val) |
595 { | |
6874 | 596 graphics_handle h = gh_manager::lookup (val); |
597 | |
598 return h.ok (); | |
6406 | 599 } |
600 | |
601 static bool | |
602 is_handle (const octave_value& val) | |
603 { | |
7142 | 604 return val.is_real_scalar () && is_handle (val.double_value ()); |
6406 | 605 } |
606 | |
607 static bool | |
608 is_figure (double val) | |
609 { | |
610 graphics_object obj = gh_manager::get_object (val); | |
611 | |
612 return obj && obj.isa ("figure"); | |
613 } | |
614 | |
615 // --------------------------------------------------------------------- | |
616 | |
617 static int | |
618 compare (const void *a_arg, const void *b_arg) | |
619 { | |
620 double a = *(static_cast<const double *> (a_arg)); | |
621 double b = *(static_cast<const double *> (b_arg)); | |
622 | |
623 return a > b ? 1 : (a < b) ? -1 : 0; | |
624 } | |
625 | |
626 static Matrix | |
627 maybe_set_children (const Matrix& kids, const octave_value& val) | |
628 { | |
629 const Matrix new_kids = val.matrix_value (); | |
630 | |
631 bool ok = true; | |
632 | |
633 if (! error_state) | |
634 { | |
635 if (kids.numel () == new_kids.numel ()) | |
636 { | |
637 Matrix t1 = kids; | |
638 Matrix t2 = new_kids; | |
639 | |
640 t1.qsort (compare); | |
641 t2.qsort (compare); | |
642 | |
643 if (t1 != t2) | |
644 ok = false; | |
645 } else | |
646 ok = false; | |
647 | |
648 if (! ok) | |
649 error ("set: new children must be a permutation of existing children"); | |
650 } | |
651 else | |
652 { | |
653 ok = false; | |
654 error ("set: expecting children to be array of graphics handles"); | |
655 } | |
656 | |
657 return ok ? new_kids : kids; | |
658 } | |
659 | |
6705 | 660 void |
661 base_properties::set_from_list (base_graphics_object& obj, | |
662 property_list& defaults) | |
6406 | 663 { |
6705 | 664 std::string go_name = graphics_object_name (); |
6406 | 665 |
6705 | 666 property_list::plist_map_const_iterator p = defaults.find (go_name); |
6406 | 667 |
6705 | 668 if (p != defaults.end ()) |
669 { | |
670 const property_list::pval_map_type pval_map = p->second; | |
6406 | 671 |
6705 | 672 for (property_list::pval_map_const_iterator q = pval_map.begin (); |
673 q != pval_map.end (); | |
674 q++) | |
675 { | |
676 std::string pname = q->first; | |
6406 | 677 |
6705 | 678 obj.set (pname, q->second); |
6406 | 679 |
6705 | 680 if (error_state) |
681 { | |
682 error ("error setting default property %s", pname.c_str ()); | |
683 break; | |
684 } | |
685 } | |
686 } | |
687 } | |
6406 | 688 |
6705 | 689 void |
690 base_properties::remove_child (const graphics_handle& h) | |
6406 | 691 { |
6705 | 692 octave_idx_type k = -1; |
693 octave_idx_type n = children.numel (); | |
694 for (octave_idx_type i = 0; i < n; i++) | |
6406 | 695 { |
6874 | 696 if (h.value () == children(i)) |
6406 | 697 { |
6705 | 698 k = i; |
699 break; | |
6406 | 700 } |
701 } | |
702 | |
6705 | 703 if (k >= 0) |
6406 | 704 { |
6705 | 705 Matrix new_kids (1, n-1); |
706 octave_idx_type j = 0; | |
707 for (octave_idx_type i = 0; i < n; i++) | |
708 { | |
709 if (i != k) | |
710 new_kids(j++) = children(i); | |
711 } | |
712 children = new_kids; | |
6406 | 713 } |
6705 | 714 } |
6406 | 715 |
6836 | 716 void |
7176 | 717 base_properties::set_tag (const octave_value& val) |
718 { | |
719 std::string tmp = val.string_value (); | |
720 | |
721 if (! error_state) | |
722 tag = tmp; | |
723 else | |
724 error ("set: expecting tag to be a character string"); | |
725 } | |
726 | |
727 void | |
6836 | 728 base_properties::set_parent (const octave_value& val) |
6705 | 729 { |
730 double tmp = val.double_value (); | |
6406 | 731 |
6705 | 732 graphics_handle new_parent = octave_NaN; |
6406 | 733 |
6705 | 734 if (! error_state) |
735 { | |
736 new_parent = gh_manager::lookup (tmp); | |
6406 | 737 |
7056 | 738 if (new_parent.ok ()) |
6705 | 739 { |
740 graphics_object parent_obj = gh_manager::get_object (parent); | |
6406 | 741 |
6705 | 742 parent_obj.remove_child (__myhandle__); |
6406 | 743 |
6705 | 744 parent = new_parent; |
6406 | 745 |
6705 | 746 ::adopt (parent, __myhandle__); |
747 } | |
748 else | |
749 error ("set: invalid graphics handle (= %g) for parent", tmp); | |
750 } | |
751 else | |
752 error ("set: expecting parent to be a graphics handle"); | |
753 } | |
6432 | 754 |
6705 | 755 void |
6836 | 756 base_properties::mark_modified (void) |
757 { | |
758 __modified__ = true; | |
759 graphics_object parent_obj = gh_manager::get_object (parent); | |
760 parent_obj.mark_modified (); | |
761 } | |
762 | |
763 void | |
764 base_properties::override_defaults (base_graphics_object& obj) | |
765 { | |
766 graphics_object parent_obj = gh_manager::get_object (parent); | |
767 parent_obj.override_defaults (obj); | |
768 } | |
769 | |
770 void | |
7214 | 771 base_properties::update_axis_limits (const std::string& axis_type) const |
772 { | |
773 graphics_handle h = (type == "axes") ? __myhandle__ : parent; | |
774 | |
775 graphics_object obj = gh_manager::get_object (h); | |
776 | |
777 if (obj.isa ("axes")) | |
778 obj.update_axis_limits (axis_type); | |
779 } | |
780 | |
781 void | |
6836 | 782 base_properties::delete_children (void) |
783 { | |
784 octave_idx_type n = children.numel (); | |
785 | |
786 for (octave_idx_type i = 0; i < n; i++) | |
787 gh_manager::free (children(i)); | |
788 } | |
789 | |
790 void | |
6874 | 791 root_figure::properties::set_currentfigure (const graphics_handle& val) |
792 { | |
793 if (error_state) | |
794 return; | |
795 | |
7059 | 796 if (xisnan (val.value ()) || is_handle (val)) |
6874 | 797 { |
798 currentfigure = val; | |
799 | |
800 gh_manager::push_figure (currentfigure); | |
801 } | |
802 else | |
803 gripe_set_invalid ("currentfigure"); | |
804 } | |
805 | |
806 void | |
7189 | 807 root_figure::properties::set (const caseless_str& name, |
6844 | 808 const octave_value& val) |
6705 | 809 { |
7176 | 810 if (name.compare ("tag")) |
811 set_tag (val); | |
812 else if (name.compare ("currentfigure")) | |
6874 | 813 set_currentfigure (val); |
6705 | 814 else if (name.compare ("children")) |
815 children = maybe_set_children (children, val); | |
816 else if (name.compare ("visible")) | |
6874 | 817 set_visible (val); |
6705 | 818 else |
819 warning ("set: invalid property `%s'", name.c_str ()); | |
820 } | |
6406 | 821 |
6844 | 822 octave_value root_figure::properties::get (void) const |
6705 | 823 { |
824 Octave_map m; | |
6406 | 825 |
7176 | 826 m.assign ("tag", tag); |
6705 | 827 m.assign ("type", type); |
6874 | 828 m.assign ("currentfigure", currentfigure.as_octave_value ()); |
6705 | 829 m.assign ("children", children); |
830 m.assign ("visible", visible); | |
6406 | 831 |
6705 | 832 return m; |
833 } | |
6406 | 834 |
6705 | 835 octave_value |
7189 | 836 root_figure::properties::get (const caseless_str& name) const |
6705 | 837 { |
838 octave_value retval; | |
6406 | 839 |
7176 | 840 if (name.compare ("tag")) |
841 retval = type; | |
842 else if (name.compare ("tag")) | |
6705 | 843 retval = type; |
844 else if (name.compare ("currentfigure")) | |
6874 | 845 retval = currentfigure.as_octave_value (); |
6705 | 846 else if (name.compare ("children")) |
847 retval = children; | |
848 else if (name.compare ("visible")) | |
849 retval = visible; | |
850 else | |
851 warning ("get: invalid property `%s'", name.c_str ()); | |
6406 | 852 |
6705 | 853 return retval; |
854 } | |
6406 | 855 |
856 property_list | |
857 root_figure::factory_properties = root_figure::init_factory_properties (); | |
858 | |
6844 | 859 std::string root_figure::properties::go_name ("root figure"); |
6406 | 860 |
861 // --------------------------------------------------------------------- | |
862 | |
6844 | 863 figure::properties::properties (const graphics_handle& mh, |
864 const graphics_handle& p) | |
6705 | 865 : base_properties (go_name, mh, p), |
866 __plot_stream__ (Matrix ()), | |
7189 | 867 __enhanced__ (false), |
6705 | 868 nextplot ("replace"), |
869 closerequestfcn (make_fcn_handle ("closereq")), | |
870 currentaxes (octave_NaN), | |
871 colormap (), | |
872 visible ("on"), | |
7283 | 873 paperorientation ("portrait"), |
874 color ( color_values (1, 1, 1)) | |
6705 | 875 { } |
876 | |
877 void | |
6874 | 878 figure::properties::set_currentaxes (const graphics_handle& val) |
879 { | |
880 if (error_state) | |
881 return; | |
882 | |
7070 | 883 if (xisnan (val.value ()) || is_handle (val)) |
6874 | 884 currentaxes = val; |
885 else | |
886 gripe_set_invalid ("currentaxes"); | |
887 } | |
888 | |
889 void | |
890 figure::properties::set_visible (const octave_value& val) | |
891 { | |
892 std::string s = val.string_value (); | |
893 | |
894 if (! error_state) | |
895 { | |
896 if (s == "on") | |
897 xset (0, "currentfigure", __myhandle__.value ()); | |
898 | |
899 visible = val; | |
900 } | |
901 } | |
902 | |
903 void | |
7189 | 904 figure::properties::set (const caseless_str& name, const octave_value& val) |
6406 | 905 { |
6705 | 906 bool modified = true; |
6406 | 907 |
7176 | 908 if (name.compare ("tag")) |
909 set_tag (val); | |
910 else if (name.compare ("children")) | |
6705 | 911 children = maybe_set_children (children, val); |
912 else if (name.compare ("__modified__")) | |
913 { | |
914 __modified__ = val.bool_value (); | |
915 modified = false; | |
916 } | |
917 else if (name.compare ("__plot_stream__")) | |
6874 | 918 set___plot_stream__ (val); |
7189 | 919 else if (name.compare ("__enhanced__")) |
920 set___enhanced__ (val); | |
6705 | 921 else if (name.compare ("nextplot")) |
6874 | 922 set_nextplot (val); |
6705 | 923 else if (name.compare ("closerequestfcn")) |
6874 | 924 set_closerequestfcn (val); |
6705 | 925 else if (name.compare ("currentaxes")) |
6874 | 926 set_currentaxes (val); |
6705 | 927 else if (name.compare ("colormap")) |
6874 | 928 set_colormap (val); |
6705 | 929 else if (name.compare ("visible")) |
6874 | 930 set_visible (val); |
6705 | 931 else if (name.compare ("paperorientation")) |
6874 | 932 set_paperorientation (val); |
7283 | 933 else if (name.compare ("color")) |
934 set_color (val); | |
6705 | 935 else |
6406 | 936 { |
6705 | 937 modified = false; |
938 warning ("set: invalid property `%s'", name.c_str ()); | |
6406 | 939 } |
940 | |
6705 | 941 if (modified) |
942 mark_modified (); | |
943 } | |
944 | |
945 octave_value | |
6844 | 946 figure::properties::get (void) const |
6705 | 947 { |
948 Octave_map m; | |
6406 | 949 |
7176 | 950 m.assign ("tag", tag); |
6705 | 951 m.assign ("type", type); |
6874 | 952 m.assign ("parent", parent.as_octave_value ()); |
6705 | 953 m.assign ("children", children); |
954 m.assign ("__modified__", __modified__); | |
955 m.assign ("__plot_stream__", __plot_stream__); | |
7189 | 956 m.assign ("__enhanced__", __enhanced__); |
6705 | 957 m.assign ("nextplot", nextplot); |
958 m.assign ("closerequestfcn", closerequestfcn); | |
6874 | 959 m.assign ("currentaxes", currentaxes.as_octave_value ()); |
6705 | 960 m.assign ("colormap", colormap); |
961 m.assign ("visible", visible); | |
962 m.assign ("paperorientation", paperorientation); | |
7283 | 963 m.assign ("color", color); |
6705 | 964 |
965 return m; | |
966 } | |
967 | |
968 octave_value | |
7189 | 969 figure::properties::get (const caseless_str& name) const |
6705 | 970 { |
971 octave_value retval; | |
6406 | 972 |
7176 | 973 if (name.compare ("tag")) |
974 retval = tag; | |
975 else if (name.compare ("type")) | |
6705 | 976 retval = type; |
977 else if (name.compare ("parent")) | |
6874 | 978 retval = parent.as_octave_value (); |
6705 | 979 else if (name.compare ("children")) |
980 retval = children; | |
981 else if (name.compare ("__modified__")) | |
982 retval = __modified__; | |
983 else if (name.compare ("__plot_stream__")) | |
984 retval = __plot_stream__; | |
7189 | 985 else if (name.compare ("__enhanced__")) |
986 retval = __enhanced__; | |
6705 | 987 else if (name.compare ("nextplot")) |
988 retval = nextplot; | |
989 else if (name.compare ("closerequestfcn")) | |
990 retval = closerequestfcn; | |
991 else if (name.compare ("currentaxes")) | |
6874 | 992 retval = currentaxes.as_octave_value (); |
6705 | 993 else if (name.compare ("colormap")) |
994 retval = colormap; | |
995 else if (name.compare ("visible")) | |
996 retval = visible; | |
997 else if (name.compare ("paperorientation")) | |
998 retval = paperorientation; | |
7283 | 999 else if (name.compare ("color")) |
1000 retval = color; | |
6705 | 1001 else |
1002 warning ("get: invalid property `%s'", name.c_str ()); | |
6406 | 1003 |
6705 | 1004 return retval; |
1005 } | |
6406 | 1006 |
6836 | 1007 void |
6844 | 1008 figure::properties::close (void) |
6705 | 1009 { |
1010 if (! __plot_stream__.is_empty ()) | |
6406 | 1011 { |
6705 | 1012 octave_value_list args; |
1013 args(1) = "\nquit;\n"; | |
1014 args(0) = __plot_stream__; | |
1015 feval ("fputs", args); | |
1016 args.resize (1); | |
1017 feval ("fflush", args); | |
1018 feval ("pclose", args); | |
6406 | 1019 } |
1020 | |
6705 | 1021 gh_manager::pop_figure (__myhandle__); |
6406 | 1022 |
6874 | 1023 graphics_handle cf = gh_manager::current_figure (); |
1024 | |
1025 xset (0, "currentfigure", cf.value ()); | |
6705 | 1026 } |
6432 | 1027 |
6836 | 1028 property_list::pval_map_type |
6844 | 1029 figure::properties::factory_defaults (void) |
6705 | 1030 { |
1031 property_list::pval_map_type m; | |
6406 | 1032 |
6705 | 1033 m["nextplot"] = "replace"; |
1034 // m["closerequestfcn"] = make_fcn_handle ("closereq"); | |
1035 m["colormap"] = colormap_property (); | |
1036 m["visible"] = "on"; | |
1037 m["paperorientation"] = "portrait"; | |
7283 | 1038 m["color"] = color_property (color_values (1, 1, 1)); |
6705 | 1039 return m; |
1040 } | |
6406 | 1041 |
6836 | 1042 octave_value |
7189 | 1043 figure::get_default (const caseless_str& name) const |
6836 | 1044 { |
1045 octave_value retval = default_properties.lookup (name); | |
1046 | |
1047 if (retval.is_undefined ()) | |
1048 { | |
1049 graphics_handle parent = get_parent (); | |
1050 graphics_object parent_obj = gh_manager::get_object (parent); | |
1051 | |
1052 retval = parent_obj.get_default (name); | |
1053 } | |
1054 | |
1055 return retval; | |
1056 } | |
1057 | |
6844 | 1058 std::string figure::properties::go_name ("figure"); |
6406 | 1059 |
1060 // --------------------------------------------------------------------- | |
1061 | |
6962 | 1062 static Matrix |
1063 default_colororder (void) | |
1064 { | |
1065 Matrix retval (7, 3, 0.0); | |
1066 | |
1067 retval(0,2) = 1.0; | |
1068 | |
1069 retval(1,1) = 0.5; | |
1070 | |
1071 retval(2,0) = 1.0; | |
1072 | |
1073 retval(3,1) = 0.75; | |
1074 retval(3,2) = 0.75; | |
1075 | |
1076 retval(4,0) = 0.75; | |
1077 retval(4,2) = 0.75; | |
1078 | |
1079 retval(5,0) = 0.75; | |
1080 retval(5,1) = 0.75; | |
1081 | |
1082 retval(6,0) = 0.25; | |
1083 retval(6,1) = 0.25; | |
1084 retval(6,2) = 0.25; | |
1085 | |
1086 return retval; | |
1087 } | |
1088 | |
6844 | 1089 axes::properties::properties (const graphics_handle& mh, |
7286 | 1090 const graphics_handle& p) |
6705 | 1091 : base_properties (go_name, mh, p), |
1092 position (Matrix ()), | |
1093 title (octave_NaN), | |
1094 box ("on"), | |
1095 key ("off"), | |
1096 keybox ("off"), | |
1097 keypos (1), | |
6962 | 1098 colororder (default_colororder ()), |
6705 | 1099 dataaspectratio (Matrix (1, 3, 1.0)), |
1100 dataaspectratiomode ("auto"), | |
7307 | 1101 layer (radio_values ("{bottom}|top")), |
6705 | 1102 xlim (), |
1103 ylim (), | |
1104 zlim (), | |
6807 | 1105 clim (), |
7222 | 1106 xlimmode (radio_values ("{auto}|manual")), |
1107 ylimmode (radio_values ("{auto}|manual")), | |
1108 zlimmode (radio_values ("{auto}|manual")), | |
1109 climmode (radio_values ("{auto}|manual")), | |
6705 | 1110 xlabel (octave_NaN), |
1111 ylabel (octave_NaN), | |
1112 zlabel (octave_NaN), | |
1113 xgrid ("off"), | |
1114 ygrid ("off"), | |
1115 zgrid ("off"), | |
1116 xminorgrid ("off"), | |
1117 yminorgrid ("off"), | |
1118 zminorgrid ("off"), | |
1119 xtick (Matrix ()), | |
1120 ytick (Matrix ()), | |
1121 ztick (Matrix ()), | |
1122 xtickmode ("auto"), | |
1123 ytickmode ("auto"), | |
1124 ztickmode ("auto"), | |
1125 xticklabel (""), | |
1126 yticklabel (""), | |
1127 zticklabel (""), | |
1128 xticklabelmode ("auto"), | |
1129 yticklabelmode ("auto"), | |
1130 zticklabelmode ("auto"), | |
11726
5ccda2448992
new tickdir and tickdirmode axes properties
John W. Eaton <jwe@octave.org>
parents:
11689
diff
changeset
|
1131 tickdir (radio_values ("{in}|out")), |
5ccda2448992
new tickdir and tickdirmode axes properties
John W. Eaton <jwe@octave.org>
parents:
11689
diff
changeset
|
1132 tickdirmode (radio_values ("{auto}|manual")), |
7286 | 1133 color (color_values (0, 0, 0), radio_values ("flat|none|interp")), |
1134 xcolor (color_values (0, 0, 0)), | |
1135 ycolor (color_values (0, 0, 0)), | |
1136 zcolor (color_values (0, 0, 0)), | |
7222 | 1137 xscale (radio_values ("{linear}|log")), |
1138 yscale (radio_values ("{linear}|log")), | |
1139 zscale (radio_values ("{linear}|log")), | |
6705 | 1140 xdir ("normal"), |
1141 ydir ("normal"), | |
1142 zdir ("normal"), | |
11795
642af2e62b1f
fix incorrect axis location properties
Francesco Potorti <Potorti@isti.cnr.it>
parents:
11740
diff
changeset
|
1143 xaxislocation ("left"), |
642af2e62b1f
fix incorrect axis location properties
Francesco Potorti <Potorti@isti.cnr.it>
parents:
11740
diff
changeset
|
1144 yaxislocation ("bottom"), |
11689
842cc9439011
graphcs.cc, graphics.h.in: new property, linewidth
John W. Eaton <jwe@octave.org>
parents:
11674
diff
changeset
|
1145 linewidth (0.5), |
6705 | 1146 view (), |
6765 | 1147 visible ("on"), |
6705 | 1148 nextplot ("replace"), |
7189 | 1149 outerposition (), |
7240 | 1150 activepositionproperty (radio_values ("{outerposition}|position")), |
7189 | 1151 __colorbar__ (radio_values ("{none}|north|south|east|west|northoutside|southoutside|eastoutside|westoutside")) |
6705 | 1152 { |
1153 Matrix tlim (1, 2, 0.0); | |
1154 tlim(1) = 1; | |
1155 xlim = tlim; | |
1156 ylim = tlim; | |
1157 zlim = tlim; | |
6807 | 1158 Matrix cl (1, 2, 0); |
1159 cl(1) = 1; | |
1160 clim = cl; | |
6705 | 1161 |
1162 Matrix tview (1, 2, 0.0); | |
1163 tview(1) = 90; | |
1164 view = tview; | |
1165 | |
1166 Matrix touterposition (1, 4, 0.0); | |
1167 touterposition(2) = 1; | |
1168 touterposition(3) = 1; | |
1169 outerposition = touterposition; | |
1170 } | |
1171 | |
1172 void | |
6874 | 1173 axes::properties::set_title (const graphics_handle& val) |
1174 { | |
1175 if (! error_state) | |
1176 { | |
1177 gh_manager::free (title); | |
1178 title = val; | |
1179 } | |
1180 } | |
1181 | |
1182 void | |
1183 axes::properties::set_title (const octave_value& val) | |
1184 { | |
1185 set_title (::reparent (val, "set", "title", __myhandle__, false)); | |
1186 } | |
1187 | |
1188 void | |
1189 axes::properties::set_xlabel (const graphics_handle& val) | |
1190 { | |
1191 if (! error_state) | |
1192 { | |
1193 gh_manager::free (xlabel); | |
1194 xlabel = val; | |
1195 } | |
1196 } | |
1197 | |
1198 void | |
1199 axes::properties::set_xlabel (const octave_value& val) | |
1200 { | |
1201 set_xlabel (::reparent (val, "set", "xlabel", __myhandle__, false)); | |
1202 } | |
1203 | |
1204 void | |
1205 axes::properties::set_ylabel (const graphics_handle& val) | |
1206 { | |
1207 if (! error_state) | |
1208 { | |
1209 gh_manager::free (ylabel); | |
1210 ylabel = val; | |
1211 } | |
1212 } | |
1213 | |
1214 void | |
1215 axes::properties::set_ylabel (const octave_value& val) | |
1216 { | |
1217 set_ylabel (::reparent (val, "set", "ylabel", __myhandle__, false)); | |
1218 } | |
1219 | |
1220 void | |
1221 axes::properties::set_zlabel (const graphics_handle& val) | |
1222 { | |
1223 if (! error_state) | |
1224 { | |
1225 gh_manager::free (zlabel); | |
1226 zlabel = val; | |
1227 } | |
1228 } | |
1229 | |
1230 void | |
1231 axes::properties::set_zlabel (const octave_value& val) | |
1232 { | |
1233 set_zlabel (::reparent (val, "set", "zlabel", __myhandle__, false)); | |
1234 } | |
1235 | |
1236 void | |
7189 | 1237 axes::properties::set (const caseless_str& name, const octave_value& val) |
6406 | 1238 { |
6705 | 1239 bool modified = true; |
1240 | |
7176 | 1241 if (name.compare ("tag")) |
1242 set_tag (val); | |
1243 else if (name.compare ("parent")) | |
6705 | 1244 set_parent (val); |
1245 else if (name.compare ("children")) | |
1246 children = maybe_set_children (children, val); | |
1247 else if (name.compare ("__modified__")) | |
1248 { | |
1249 __modified__ = val.bool_value (); | |
1250 modified = false; | |
1251 } | |
1252 else if (name.compare ("position")) | |
6874 | 1253 set_position (val); |
6705 | 1254 else if (name.compare ("title")) |
6874 | 1255 set_title (val); |
6705 | 1256 else if (name.compare ("box")) |
6874 | 1257 set_box (val); |
6705 | 1258 else if (name.compare ("key")) |
6874 | 1259 set_key (val); |
6705 | 1260 else if (name.compare ("keybox")) |
6874 | 1261 set_keybox (val); |
6705 | 1262 else if (name.compare ("keypos")) |
6874 | 1263 set_keypos (val); |
6962 | 1264 else if (name.compare ("colororder")) |
1265 set_colororder (val); | |
6705 | 1266 else if (name.compare ("dataaspectratio")) |
6874 | 1267 set_dataaspectratio (val); |
6705 | 1268 else if (name.compare ("dataaspectratiomode")) |
6874 | 1269 set_dataaspectratiomode (val); |
7307 | 1270 else if (name.compare ("layer")) |
1271 set_layer (val); | |
6705 | 1272 else if (name.compare ("xlim")) |
6874 | 1273 set_xlim (val); |
6705 | 1274 else if (name.compare ("ylim")) |
6874 | 1275 set_ylim (val); |
6705 | 1276 else if (name.compare ("zlim")) |
6874 | 1277 set_zlim (val); |
6807 | 1278 else if (name.compare ("clim")) |
6874 | 1279 set_clim (val); |
6705 | 1280 else if (name.compare ("xlimmode")) |
6874 | 1281 set_xlimmode (val); |
6705 | 1282 else if (name.compare ("ylimmode")) |
6874 | 1283 set_ylimmode (val); |
6705 | 1284 else if (name.compare ("zlimmode")) |
6874 | 1285 set_zlimmode (val); |
6807 | 1286 else if (name.compare ("climmode")) |
6874 | 1287 set_climmode (val); |
6705 | 1288 else if (name.compare ("xlabel")) |
6874 | 1289 set_xlabel (val); |
6705 | 1290 else if (name.compare ("ylabel")) |
6874 | 1291 set_ylabel (val); |
6705 | 1292 else if (name.compare ("zlabel")) |
6874 | 1293 set_zlabel (val); |
6705 | 1294 else if (name.compare ("xgrid")) |
6874 | 1295 set_xgrid (val); |
6705 | 1296 else if (name.compare ("ygrid")) |
6874 | 1297 set_ygrid (val); |
6705 | 1298 else if (name.compare ("zgrid")) |
6874 | 1299 set_zgrid (val); |
6705 | 1300 else if (name.compare ("xminorgrid")) |
6874 | 1301 set_xminorgrid (val); |
6705 | 1302 else if (name.compare ("yminorgrid")) |
6874 | 1303 set_yminorgrid (val); |
6705 | 1304 else if (name.compare ("zminorgrid")) |
6874 | 1305 set_zminorgrid (val); |
6705 | 1306 else if (name.compare ("xtick")) |
6874 | 1307 set_xtick (val); |
6705 | 1308 else if (name.compare ("ytick")) |
7030 | 1309 set_ytick (val); |
6705 | 1310 else if (name.compare ("ztick")) |
6874 | 1311 set_ztick (val); |
6705 | 1312 else if (name.compare ("xtickmode")) |
6874 | 1313 set_xtickmode (val); |
6705 | 1314 else if (name.compare ("ytickmode")) |
6874 | 1315 set_ytickmode (val); |
6705 | 1316 else if (name.compare ("ztickmode")) |
6874 | 1317 set_ztickmode (val); |
6705 | 1318 else if (name.compare ("xticklabel")) |
6874 | 1319 set_xticklabel (val); |
6705 | 1320 else if (name.compare ("yticklabel")) |
6874 | 1321 set_yticklabel (val); |
6705 | 1322 else if (name.compare ("zticklabel")) |
6874 | 1323 set_zticklabel (val); |
6705 | 1324 else if (name.compare ("xticklabelmode")) |
6874 | 1325 set_xticklabelmode (val); |
6705 | 1326 else if (name.compare ("yticklabelmode")) |
6874 | 1327 set_yticklabelmode (val); |
6705 | 1328 else if (name.compare ("zticklabelmode")) |
6874 | 1329 set_zticklabelmode (val); |
11726
5ccda2448992
new tickdir and tickdirmode axes properties
John W. Eaton <jwe@octave.org>
parents:
11689
diff
changeset
|
1330 else if (name.compare ("tickdir")) |
5ccda2448992
new tickdir and tickdirmode axes properties
John W. Eaton <jwe@octave.org>
parents:
11689
diff
changeset
|
1331 set_tickdir (val); |
5ccda2448992
new tickdir and tickdirmode axes properties
John W. Eaton <jwe@octave.org>
parents:
11689
diff
changeset
|
1332 else if (name.compare ("tickdirmode")) |
5ccda2448992
new tickdir and tickdirmode axes properties
John W. Eaton <jwe@octave.org>
parents:
11689
diff
changeset
|
1333 set_tickdirmode (val); |
7240 | 1334 else if (name.compare ("color")) |
1335 set_color (val); | |
7194 | 1336 else if (name.compare ("xcolor")) |
1337 set_xcolor (val); | |
1338 else if (name.compare ("ycolor")) | |
1339 set_ycolor (val); | |
1340 else if (name.compare ("zcolor")) | |
1341 set_zcolor (val); | |
6705 | 1342 else if (name.compare ("xscale")) |
6874 | 1343 set_xscale (val); |
6705 | 1344 else if (name.compare ("yscale")) |
6874 | 1345 set_yscale (val); |
6705 | 1346 else if (name.compare ("zscale")) |
6874 | 1347 set_zscale (val); |
6705 | 1348 else if (name.compare ("xdir")) |
6874 | 1349 set_xdir (val); |
6705 | 1350 else if (name.compare ("ydir")) |
6874 | 1351 set_ydir (val); |
6705 | 1352 else if (name.compare ("zdir")) |
6874 | 1353 set_zdir (val); |
6809 | 1354 else if (name.compare ("xaxislocation")) |
6874 | 1355 set_xaxislocation (val); |
6809 | 1356 else if (name.compare ("yaxislocation")) |
6874 | 1357 set_yaxislocation (val); |
11689
842cc9439011
graphcs.cc, graphics.h.in: new property, linewidth
John W. Eaton <jwe@octave.org>
parents:
11674
diff
changeset
|
1358 else if (name.compare ("linwdiwth")) |
842cc9439011
graphcs.cc, graphics.h.in: new property, linewidth
John W. Eaton <jwe@octave.org>
parents:
11674
diff
changeset
|
1359 set_linewidth (val); |
6705 | 1360 else if (name.compare ("view")) |
6874 | 1361 set_view (val); |
6765 | 1362 else if (name.compare ("visible")) |
6874 | 1363 set_visible (val); |
6705 | 1364 else if (name.compare ("nextplot")) |
6874 | 1365 set_nextplot (val); |
6705 | 1366 else if (name.compare ("outerposition")) |
6874 | 1367 set_outerposition (val); |
7240 | 1368 else if (name.compare ("activepositionproperty")) |
1369 set_activepositionproperty (val); | |
7189 | 1370 else if (name.compare ("__colorbar__")) |
1371 set___colorbar__ (val); | |
6705 | 1372 else |
1373 { | |
1374 modified = false; | |
1375 warning ("set: invalid property `%s'", name.c_str ()); | |
1376 } | |
6406 | 1377 |
6705 | 1378 if (modified) |
1379 mark_modified (); | |
1380 } | |
1381 | |
1382 void | |
6844 | 1383 axes::properties::set_defaults (base_graphics_object& obj, |
6890 | 1384 const std::string& mode) |
6705 | 1385 { |
1386 position = Matrix (); | |
1387 title = octave_NaN; | |
1388 box = "on"; | |
1389 key = "off"; | |
1390 keybox = "off"; | |
1391 keypos = 1; | |
6962 | 1392 colororder = default_colororder (); |
6705 | 1393 dataaspectratio = Matrix (1, 3, 1.0); |
1394 dataaspectratiomode = "auto"; | |
7307 | 1395 layer = radio_property (radio_values ("{bottom}|top")); |
6705 | 1396 |
1397 Matrix tlim (1, 2, 0.0); | |
1398 tlim(1) = 1; | |
1399 xlim = tlim; | |
1400 ylim = tlim; | |
1401 zlim = tlim; | |
6807 | 1402 |
1403 Matrix cl (1, 2, 0); | |
1404 cl(1) = 1; | |
1405 clim = cl; | |
1406 | |
7222 | 1407 xlimmode = radio_property (radio_values ("{auto}|manual")); |
1408 ylimmode = radio_property (radio_values ("{auto}|manual")); | |
1409 zlimmode = radio_property (radio_values ("{auto}|manual")); | |
1410 climmode = radio_property (radio_values ("{auto}|manual")); | |
6705 | 1411 xlabel = octave_NaN; |
1412 ylabel = octave_NaN; | |
1413 zlabel = octave_NaN; | |
1414 xgrid = "off"; | |
1415 ygrid = "off"; | |
1416 zgrid = "off"; | |
1417 xminorgrid = "off"; | |
1418 yminorgrid = "off"; | |
1419 zminorgrid = "off"; | |
1420 xtick = Matrix (); | |
1421 ytick = Matrix (); | |
1422 ztick = Matrix (); | |
1423 xtickmode = "auto"; | |
1424 ytickmode = "auto"; | |
1425 ztickmode = "auto"; | |
1426 xticklabel = ""; | |
1427 yticklabel = ""; | |
1428 zticklabel = ""; | |
1429 xticklabelmode = "auto"; | |
1430 yticklabelmode = "auto"; | |
1431 zticklabelmode = "auto"; | |
11726
5ccda2448992
new tickdir and tickdirmode axes properties
John W. Eaton <jwe@octave.org>
parents:
11689
diff
changeset
|
1432 tickdir = radio_property (radio_values ("{in}|out")); |
5ccda2448992
new tickdir and tickdirmode axes properties
John W. Eaton <jwe@octave.org>
parents:
11689
diff
changeset
|
1433 tickdirmode = radio_property (radio_values ("{auto}|manual")); |
7240 | 1434 color = color_property (color_values (0, 0, 0), radio_values("flat|none|interp")); |
7194 | 1435 xcolor = color_property ("black"); |
1436 ycolor = color_property ("black"); | |
1437 zcolor = color_property ("black"); | |
7222 | 1438 xscale = radio_property (radio_values ("{linear}|log")); |
1439 yscale = radio_property (radio_values ("{linear}|log")); | |
1440 zscale = radio_property (radio_values ("{linear}|log")); | |
6705 | 1441 xdir = "normal"; |
1442 ydir = "normal"; | |
1443 zdir = "normal"; | |
11795
642af2e62b1f
fix incorrect axis location properties
Francesco Potorti <Potorti@isti.cnr.it>
parents:
11740
diff
changeset
|
1444 xaxislocation = "bottom"; |
642af2e62b1f
fix incorrect axis location properties
Francesco Potorti <Potorti@isti.cnr.it>
parents:
11740
diff
changeset
|
1445 yaxislocation = "left"; |
11689
842cc9439011
graphcs.cc, graphics.h.in: new property, linewidth
John W. Eaton <jwe@octave.org>
parents:
11674
diff
changeset
|
1446 linewidth = 0.5; |
6705 | 1447 |
1448 Matrix tview (1, 2, 0.0); | |
1449 tview(1) = 90; | |
1450 view = tview; | |
1451 | |
6765 | 1452 visible = "on"; |
6705 | 1453 nextplot = "replace"; |
1454 | |
1455 // FIXME -- this is not quite right; we should preserve | |
1456 // "position" and "units". | |
1457 | |
1458 if (mode != "replace") | |
1459 { | |
6406 | 1460 Matrix touterposition (1, 4, 0.0); |
1461 touterposition(2) = 1; | |
1462 touterposition(3) = 1; | |
1463 outerposition = touterposition; | |
1464 } | |
1465 | |
7240 | 1466 activepositionproperty = radio_property (radio_values ("{outerposition}|position")); |
7189 | 1467 __colorbar__ = radio_property (radio_values ("{none}|north|south|east|west|northoutside|southoutside|eastoutside|westoutside")); |
1468 | |
6705 | 1469 delete_children (); |
6406 | 1470 |
6705 | 1471 children = Matrix (); |
6432 | 1472 |
6705 | 1473 override_defaults (obj); |
1474 } | |
1475 | |
6874 | 1476 graphics_handle |
1477 axes::properties::get_title (void) const | |
1478 { | |
7056 | 1479 if (! title.ok ()) |
6874 | 1480 title = gh_manager::make_graphics_handle ("text", __myhandle__); |
1481 | |
1482 return title; | |
1483 } | |
1484 | |
1485 graphics_handle | |
1486 axes::properties::get_xlabel (void) const | |
1487 { | |
7056 | 1488 if (! xlabel.ok ()) |
6874 | 1489 xlabel = gh_manager::make_graphics_handle ("text", __myhandle__); |
1490 | |
1491 return xlabel; | |
1492 } | |
1493 | |
1494 graphics_handle | |
1495 axes::properties::get_ylabel (void) const | |
1496 { | |
7056 | 1497 if (! ylabel.ok ()) |
6874 | 1498 ylabel = gh_manager::make_graphics_handle ("text", __myhandle__); |
1499 | |
1500 return ylabel; | |
1501 } | |
1502 | |
1503 graphics_handle | |
1504 axes::properties::get_zlabel (void) const | |
1505 { | |
7056 | 1506 if (! zlabel.ok ()) |
6874 | 1507 zlabel = gh_manager::make_graphics_handle ("text", __myhandle__); |
1508 | |
1509 return zlabel; | |
1510 } | |
1511 | |
6705 | 1512 octave_value |
6844 | 1513 axes::properties::get (void) const |
6705 | 1514 { |
1515 Octave_map m; | |
6406 | 1516 |
7176 | 1517 m.assign ("tag", tag); |
6705 | 1518 m.assign ("type", type); |
6874 | 1519 m.assign ("parent", parent.as_octave_value ()); |
6705 | 1520 m.assign ("children", children); |
1521 m.assign ("__modified__", __modified__); | |
1522 m.assign ("position", position); | |
6874 | 1523 m.assign ("title", get_title().as_octave_value ()); |
6705 | 1524 m.assign ("box", box); |
1525 m.assign ("key", key); | |
1526 m.assign ("keybox", keybox); | |
1527 m.assign ("keypos", keypos); | |
6962 | 1528 m.assign ("colororder", colororder); |
6705 | 1529 m.assign ("dataaspectratio", dataaspectratio); |
1530 m.assign ("dataaspectratiomode", dataaspectratiomode); | |
7307 | 1531 m.assign ("layer", layer); |
6705 | 1532 m.assign ("xlim", xlim); |
1533 m.assign ("ylim", ylim); | |
1534 m.assign ("zlim", zlim); | |
6807 | 1535 m.assign ("clim", clim); |
6705 | 1536 m.assign ("xlimmode", xlimmode); |
1537 m.assign ("ylimmode", ylimmode); | |
1538 m.assign ("zlimmode", zlimmode); | |
6807 | 1539 m.assign ("climmode", climmode); |
6874 | 1540 m.assign ("xlabel", get_xlabel().as_octave_value ()); |
1541 m.assign ("ylabel", get_ylabel().as_octave_value ()); | |
1542 m.assign ("zlabel", get_zlabel().as_octave_value ()); | |
6705 | 1543 m.assign ("xgrid", xgrid); |
1544 m.assign ("ygrid", ygrid); | |
1545 m.assign ("zgrid", zgrid); | |
1546 m.assign ("xminorgrid", xminorgrid); | |
1547 m.assign ("yminorgrid", yminorgrid); | |
1548 m.assign ("zminorgrid", zminorgrid); | |
1549 m.assign ("xtick", xtick); | |
1550 m.assign ("ytick", ytick); | |
1551 m.assign ("ztick", ztick); | |
1552 m.assign ("xtickmode", xtickmode); | |
1553 m.assign ("ytickmode", ytickmode); | |
1554 m.assign ("ztickmode", ztickmode); | |
1555 m.assign ("xticklabel", xticklabel); | |
1556 m.assign ("yticklabel", yticklabel); | |
1557 m.assign ("zticklabel", zticklabel); | |
1558 m.assign ("xticklabelmode", xticklabelmode); | |
1559 m.assign ("yticklabelmode", yticklabelmode); | |
1560 m.assign ("zticklabelmode", zticklabelmode); | |
11726
5ccda2448992
new tickdir and tickdirmode axes properties
John W. Eaton <jwe@octave.org>
parents:
11689
diff
changeset
|
1561 m.assign ("tickdir", tickdir); |
5ccda2448992
new tickdir and tickdirmode axes properties
John W. Eaton <jwe@octave.org>
parents:
11689
diff
changeset
|
1562 m.assign ("tickdirmode", tickdirmode); |
7240 | 1563 m.assign ("color", color); |
7194 | 1564 m.assign ("xcolor", xcolor); |
1565 m.assign ("ycolor", ycolor); | |
1566 m.assign ("zcolor", zcolor); | |
6705 | 1567 m.assign ("xscale", xscale); |
1568 m.assign ("yscale", yscale); | |
1569 m.assign ("zscale", zscale); | |
1570 m.assign ("xdir", xdir); | |
1571 m.assign ("ydir", ydir); | |
1572 m.assign ("zdir", zdir); | |
6809 | 1573 m.assign ("xaxislocation", xaxislocation); |
1574 m.assign ("yaxislocation", yaxislocation); | |
11689
842cc9439011
graphcs.cc, graphics.h.in: new property, linewidth
John W. Eaton <jwe@octave.org>
parents:
11674
diff
changeset
|
1575 m.assign ("linewidth", linewidth); |
6705 | 1576 m.assign ("view", view); |
6765 | 1577 m.assign ("visible", visible); |
6705 | 1578 m.assign ("nextplot", nextplot); |
1579 m.assign ("outerposition", outerposition); | |
7240 | 1580 m.assign ("activepositionproperty", activepositionproperty); |
7189 | 1581 m.assign ("__colorbar__", __colorbar__); |
6432 | 1582 |
6705 | 1583 return m; |
1584 } | |
6406 | 1585 |
6705 | 1586 octave_value |
7189 | 1587 axes::properties::get (const caseless_str& name) const |
6705 | 1588 { |
1589 octave_value retval; | |
6406 | 1590 |
7176 | 1591 if (name.compare ("tag")) |
1592 retval = tag; | |
1593 else if (name.compare ("type")) | |
6705 | 1594 retval = type; |
1595 else if (name.compare ("parent")) | |
6874 | 1596 retval = parent.value (); |
6705 | 1597 else if (name.compare ("children")) |
1598 retval = children; | |
1599 else if (name.compare ("__modified__")) | |
1600 retval = __modified__; | |
1601 else if (name.compare ("position")) | |
1602 retval = position; | |
1603 else if (name.compare ("title")) | |
6874 | 1604 retval = get_title().as_octave_value (); |
6705 | 1605 else if (name.compare ("box")) |
1606 retval = box; | |
1607 else if (name.compare ("key")) | |
1608 retval = key; | |
1609 else if (name.compare ("keybox")) | |
1610 retval = keybox; | |
1611 else if (name.compare ("keypos")) | |
1612 retval = keypos; | |
6962 | 1613 else if (name.compare ("colororder")) |
1614 retval = colororder; | |
6705 | 1615 else if (name.compare ("dataaspectratio")) |
1616 retval = dataaspectratio; | |
1617 else if (name.compare ("dataaspectratiomode")) | |
1618 retval = dataaspectratiomode; | |
7307 | 1619 else if (name.compare ("layer")) |
1620 retval = layer; | |
6705 | 1621 else if (name.compare ("xlim")) |
1622 retval = xlim; | |
1623 else if (name.compare ("ylim")) | |
1624 retval = ylim; | |
1625 else if (name.compare ("zlim")) | |
1626 retval = zlim; | |
6807 | 1627 else if (name.compare ("clim")) |
1628 retval = clim; | |
6705 | 1629 else if (name.compare ("xlimmode")) |
1630 retval = xlimmode; | |
1631 else if (name.compare ("ylimmode")) | |
1632 retval = ylimmode; | |
1633 else if (name.compare ("zlimmode")) | |
1634 retval = zlimmode; | |
6807 | 1635 else if (name.compare ("climmode")) |
1636 retval = climmode; | |
6705 | 1637 else if (name.compare ("xlabel")) |
6874 | 1638 retval = get_xlabel().as_octave_value (); |
6705 | 1639 else if (name.compare ("ylabel")) |
6874 | 1640 retval = get_ylabel().as_octave_value (); |
6705 | 1641 else if (name.compare ("zlabel")) |
6874 | 1642 retval = get_zlabel().as_octave_value (); |
6705 | 1643 else if (name.compare ("xgrid")) |
1644 retval = xgrid; | |
1645 else if (name.compare ("ygrid")) | |
1646 retval = ygrid; | |
1647 else if (name.compare ("zgrid")) | |
1648 retval = zgrid; | |
1649 else if (name.compare ("xminorgrid")) | |
1650 retval = xminorgrid; | |
1651 else if (name.compare ("yminorgrid")) | |
1652 retval = yminorgrid; | |
1653 else if (name.compare ("zminorgrid")) | |
1654 retval = zminorgrid; | |
1655 else if (name.compare ("xtick")) | |
1656 retval = xtick; | |
1657 else if (name.compare ("ytick")) | |
1658 retval = ytick; | |
1659 else if (name.compare ("ztick")) | |
1660 retval = ztick; | |
1661 else if (name.compare ("xtickmode")) | |
1662 retval = xtickmode; | |
1663 else if (name.compare ("ytickmode")) | |
1664 retval = ytickmode; | |
1665 else if (name.compare ("ztickmode")) | |
1666 retval = ztickmode; | |
1667 else if (name.compare ("xticklabel")) | |
1668 retval = xticklabel; | |
1669 else if (name.compare ("yticklabel")) | |
1670 retval = yticklabel; | |
1671 else if (name.compare ("zticklabel")) | |
1672 retval = zticklabel; | |
1673 else if (name.compare ("xticklabelmode")) | |
1674 retval = xticklabelmode; | |
1675 else if (name.compare ("yticklabelmode")) | |
1676 retval = yticklabelmode; | |
1677 else if (name.compare ("zticklabelmode")) | |
1678 retval = zticklabelmode; | |
11726
5ccda2448992
new tickdir and tickdirmode axes properties
John W. Eaton <jwe@octave.org>
parents:
11689
diff
changeset
|
1679 else if (name.compare ("tickdir")) |
5ccda2448992
new tickdir and tickdirmode axes properties
John W. Eaton <jwe@octave.org>
parents:
11689
diff
changeset
|
1680 retval = tickdir; |
5ccda2448992
new tickdir and tickdirmode axes properties
John W. Eaton <jwe@octave.org>
parents:
11689
diff
changeset
|
1681 else if (name.compare ("tickdirmode")) |
5ccda2448992
new tickdir and tickdirmode axes properties
John W. Eaton <jwe@octave.org>
parents:
11689
diff
changeset
|
1682 retval = tickdirmode; |
7240 | 1683 else if (name.compare ("color")) |
1684 retval = color; | |
7194 | 1685 else if (name.compare ("xcolor")) |
1686 retval = xcolor; | |
1687 else if (name.compare ("ycolor")) | |
1688 retval = ycolor; | |
1689 else if (name.compare ("zcolor")) | |
1690 retval = zcolor; | |
6705 | 1691 else if (name.compare ("xscale")) |
1692 retval = xscale; | |
1693 else if (name.compare ("yscale")) | |
1694 retval = yscale; | |
1695 else if (name.compare ("zscale")) | |
1696 retval = zscale; | |
1697 else if (name.compare ("xdir")) | |
1698 retval = xdir; | |
1699 else if (name.compare ("ydir")) | |
1700 retval = ydir; | |
1701 else if (name.compare ("zdir")) | |
1702 retval = zdir; | |
6809 | 1703 else if (name.compare ("xaxislocation")) |
1704 retval = xaxislocation; | |
1705 else if (name.compare ("yaxislocation")) | |
1706 retval = yaxislocation; | |
11689
842cc9439011
graphcs.cc, graphics.h.in: new property, linewidth
John W. Eaton <jwe@octave.org>
parents:
11674
diff
changeset
|
1707 else if (name.compare ("linewidth")) |
842cc9439011
graphcs.cc, graphics.h.in: new property, linewidth
John W. Eaton <jwe@octave.org>
parents:
11674
diff
changeset
|
1708 retval = linewidth; |
6705 | 1709 else if (name.compare ("view")) |
1710 retval = view; | |
6765 | 1711 else if (name.compare ("visible")) |
1712 retval = visible; | |
6705 | 1713 else if (name.compare ("nextplot")) |
1714 retval = nextplot; | |
1715 else if (name.compare ("outerposition")) | |
1716 retval = outerposition; | |
7240 | 1717 else if (name.compare ("activepositionproperty")) |
1718 retval = activepositionproperty; | |
7189 | 1719 else if (name.compare ("__colorbar__")) |
1720 retval = __colorbar__; | |
6705 | 1721 else |
1722 warning ("get: invalid property `%s'", name.c_str ()); | |
6406 | 1723 |
6705 | 1724 return retval; |
1725 } | |
6406 | 1726 |
6705 | 1727 void |
6844 | 1728 axes::properties::remove_child (const graphics_handle& h) |
6705 | 1729 { |
7056 | 1730 if (title.ok () && h == title) |
6705 | 1731 title = gh_manager::make_graphics_handle ("text", __myhandle__); |
7056 | 1732 else if (xlabel.ok () && h == xlabel) |
6705 | 1733 xlabel = gh_manager::make_graphics_handle ("text", __myhandle__); |
7056 | 1734 else if (ylabel.ok () && h == ylabel) |
6705 | 1735 ylabel = gh_manager::make_graphics_handle ("text", __myhandle__); |
7056 | 1736 else if (zlabel.ok () && h == zlabel) |
6705 | 1737 zlabel = gh_manager::make_graphics_handle ("text", __myhandle__); |
1738 else | |
1739 base_properties::remove_child (h); | |
1740 } | |
6406 | 1741 |
6705 | 1742 void |
6844 | 1743 axes::properties::delete_children (void) |
6705 | 1744 { |
1745 base_properties::delete_children (); | |
1746 | |
6874 | 1747 gh_manager::free (title); |
1748 gh_manager::free (xlabel); | |
1749 gh_manager::free (ylabel); | |
1750 gh_manager::free (zlabel); | |
6705 | 1751 } |
6406 | 1752 |
6836 | 1753 property_list::pval_map_type |
6844 | 1754 axes::properties::factory_defaults (void) |
6705 | 1755 { |
1756 property_list::pval_map_type m; | |
6406 | 1757 |
6705 | 1758 m["position"] = Matrix (); |
1759 m["title"] = octave_NaN; | |
1760 m["box"] = "on"; | |
1761 m["key"] = "off"; | |
1762 m["keybox"] = "off"; | |
1763 m["keypos"] = 1; | |
6962 | 1764 m["colororder"] = default_colororder (); |
6705 | 1765 m["dataaspectratio"] = Matrix (1, 3, 1.0); |
1766 m["dataaspectratiomode"] = "auto"; | |
7307 | 1767 m["layer"] = radio_property (radio_values ("{bottom}|top")); |
6406 | 1768 |
6705 | 1769 Matrix tlim (1, 2, 0.0); |
1770 tlim(1) = 1; | |
6406 | 1771 |
6705 | 1772 m["xlim"] = tlim; |
1773 m["ylim"] = tlim; | |
1774 m["zlim"] = tlim; | |
6807 | 1775 |
1776 Matrix cl(1, 2, 0); | |
1777 cl(1) = 1; | |
1778 | |
1779 m["clim"] = cl; | |
6406 | 1780 |
7222 | 1781 m["xlimmode"] = radio_property (radio_values ("{auto}|manual")); |
1782 m["ylimmode"] = radio_property (radio_values ("{auto}|manual")); | |
1783 m["zlimmode"] = radio_property (radio_values ("{auto}|manual")); | |
1784 m["climmode"] = radio_property (radio_values ("{auto}|manual")); | |
6705 | 1785 m["xlabel"] = octave_NaN; |
1786 m["ylabel"] = octave_NaN; | |
1787 m["zlabel"] = octave_NaN; | |
1788 m["xgrid"] = "off"; | |
1789 m["ygrid"] = "off"; | |
1790 m["zgrid"] = "off"; | |
1791 m["xminorgrid"] = "off"; | |
1792 m["yminorgrid"] = "off"; | |
1793 m["zminorgrid"] = "off"; | |
1794 m["xtick"] = Matrix (); | |
1795 m["ytick"] = Matrix (); | |
1796 m["ztick"] = Matrix (); | |
1797 m["xtickmode"] = "auto"; | |
1798 m["ytickmode"] = "auto"; | |
1799 m["ztickmode"] = "auto"; | |
1800 m["xticklabel"] = ""; | |
1801 m["yticklabel"] = ""; | |
1802 m["zticklabel"] = ""; | |
1803 m["xticklabelmode"] = "auto"; | |
1804 m["yticklabelmode"] = "auto"; | |
1805 m["zticklabelmode"] = "auto"; | |
11726
5ccda2448992
new tickdir and tickdirmode axes properties
John W. Eaton <jwe@octave.org>
parents:
11689
diff
changeset
|
1806 m["tickdir"] = radio_property (radio_values ("{in}|out")); |
5ccda2448992
new tickdir and tickdirmode axes properties
John W. Eaton <jwe@octave.org>
parents:
11689
diff
changeset
|
1807 m["tickdirmode"] = radio_property (radio_values ("{auto}|manual")); |
7240 | 1808 m["color"] = color_property (color_values (0, 0, 0), radio_values("flat|none|interp")); |
7194 | 1809 m["xcolor"] = color_property ("black"); |
1810 m["ycolor"] = color_property ("black"); | |
1811 m["zcolor"] = color_property ("black"); | |
7222 | 1812 m["xscale"] = radio_property (radio_values ("{linear}|log")); |
1813 m["yscale"] = radio_property (radio_values ("{linear}|log")); | |
1814 m["zscale"] = radio_property (radio_values ("{linear}|log")); | |
6705 | 1815 m["xdir"] = "normal"; |
1816 m["ydir"] = "normal"; | |
1817 m["zdir"] = "normal"; | |
11795
642af2e62b1f
fix incorrect axis location properties
Francesco Potorti <Potorti@isti.cnr.it>
parents:
11740
diff
changeset
|
1818 m["xaxislocation"] = "left"; |
642af2e62b1f
fix incorrect axis location properties
Francesco Potorti <Potorti@isti.cnr.it>
parents:
11740
diff
changeset
|
1819 m["yaxislocation"] = "bottom"; |
11689
842cc9439011
graphcs.cc, graphics.h.in: new property, linewidth
John W. Eaton <jwe@octave.org>
parents:
11674
diff
changeset
|
1820 m["linewidth"] = 0.5; |
6406 | 1821 |
6705 | 1822 Matrix tview (1, 2, 0.0); |
1823 tview(1) = 90; | |
6406 | 1824 |
6705 | 1825 m["view"] = tview; |
6406 | 1826 |
6765 | 1827 m["visible"] = "on"; |
6705 | 1828 m["nextplot"] = "replace"; |
6406 | 1829 |
6705 | 1830 Matrix touterposition (1, 4, 0.0); |
1831 touterposition(2) = 1; | |
1832 touterposition(3) = 1; | |
6406 | 1833 |
6705 | 1834 m["outerposition"] = touterposition; |
7240 | 1835 m["activepositionproperty"] = radio_property (radio_values ("{outerposition}|position")); |
7189 | 1836 m["__colorbar__"] = radio_property (radio_values ("{none}|north|south|east|west|northoutside|southoutside|eastoutside|westoutside")); |
6406 | 1837 |
6705 | 1838 return m; |
1839 } | |
6406 | 1840 |
6836 | 1841 octave_value |
7189 | 1842 axes::get_default (const caseless_str& name) const |
6836 | 1843 { |
1844 octave_value retval = default_properties.lookup (name); | |
1845 | |
1846 if (retval.is_undefined ()) | |
1847 { | |
1848 graphics_handle parent = get_parent (); | |
1849 graphics_object parent_obj = gh_manager::get_object (parent); | |
1850 | |
1851 retval = parent_obj.get_default (name); | |
1852 } | |
1853 | |
1854 return retval; | |
1855 } | |
1856 | |
7222 | 1857 static void |
1858 check_limit_vals (double& min_val, double& max_val, double& min_pos, | |
1859 const data_property& data) | |
1860 { | |
7267 | 1861 double val = data.min_val (); |
1862 if (! (xisinf (val) || xisnan (val)) && val < min_val) | |
1863 min_val = val; | |
1864 val = data.max_val (); | |
1865 if (! (xisinf (val) || xisnan (val)) && val > max_val) | |
1866 max_val = val; | |
1867 val = data.min_pos (); | |
1868 if (! (xisinf (val) || xisnan (val)) && val > 0 && val < min_pos) | |
1869 min_pos = val; | |
7222 | 1870 } |
1871 | |
1872 // Attempt to make "nice" limits from the actual max and min of the | |
1873 // data. For log plots, we will also use the smallest strictly positive | |
1874 // value. | |
1875 | |
1876 static Matrix | |
1877 get_axis_limits (double xmin, double xmax, double min_pos, bool logscale) | |
1878 { | |
1879 Matrix retval; | |
1880 | |
1881 double min_val = xmin; | |
1882 double max_val = xmax; | |
1883 | |
1884 if (! (xisinf (min_val) || xisinf (max_val))) | |
1885 { | |
1886 if (logscale) | |
1887 { | |
1888 if (xisinf (min_pos)) | |
1889 { | |
1890 // warning ("axis: logscale with no positive values to plot"); | |
1891 return retval; | |
1892 } | |
1893 | |
1894 if (min_val <= 0) | |
1895 { | |
1896 warning ("axis: omitting nonpositive data in log plot"); | |
1897 min_val = min_pos; | |
1898 } | |
1899 // FIXME -- maybe this test should also be relative? | |
1900 if (std::abs (min_val - max_val) < sqrt (DBL_EPSILON)) | |
1901 { | |
1902 min_val *= 0.9; | |
1903 max_val *= 1.1; | |
1904 } | |
1905 min_val = pow (10, floor (log10 (min_val))); | |
1906 max_val = pow (10, ceil (log10 (max_val))); | |
1907 } | |
1908 else | |
1909 { | |
1910 if (min_val == 0 && max_val == 0) | |
1911 { | |
1912 min_val = -1; | |
1913 max_val = 1; | |
1914 } | |
1915 // FIXME -- maybe this test should also be relative? | |
1916 else if (std::abs (min_val - max_val) < sqrt (DBL_EPSILON)) | |
1917 { | |
1918 min_val -= 0.1 * std::abs (min_val); | |
1919 max_val += 0.1 * std::abs (max_val); | |
1920 } | |
1921 // FIXME -- to do a better job, we should consider the tic spacing. | |
1922 double scale = pow (10, floor (log10 (max_val - min_val) - 1)); | |
1923 min_val = scale * floor (min_val / scale); | |
1924 max_val = scale * ceil (max_val / scale); | |
1925 } | |
1926 } | |
1927 | |
1928 retval.resize (1, 2); | |
1929 | |
1930 retval(0) = min_val; | |
1931 retval(1) = max_val; | |
1932 | |
1933 return retval; | |
1934 } | |
1935 | |
1936 static bool updating_axis_limits = false; | |
1937 | |
7214 | 1938 void |
7222 | 1939 axes::update_axis_limits (const std::string& axis_type) |
7214 | 1940 { |
7222 | 1941 if (updating_axis_limits) |
1942 return; | |
1943 | |
1944 Matrix kids = xproperties.get_children (); | |
1945 | |
1946 octave_idx_type n = kids.numel (); | |
1947 | |
1948 double min_val = octave_Inf; | |
1949 double max_val = -octave_Inf; | |
1950 double min_pos = octave_Inf; | |
1951 | |
1952 radio_property tmp; | |
1953 | |
1954 char update_type = 0; | |
1955 | |
1956 Matrix limits; | |
1957 | |
1958 if (axis_type == "xdata" || axis_type == "xscale" | |
1959 || axis_type == "xldata" || axis_type == "xudata" | |
1960 || axis_type == "xlimmode") | |
1961 { | |
1962 tmp = xproperties.get_xlimmode (); | |
1963 | |
1964 if (tmp.current_value () == "auto") | |
1965 { | |
1966 for (octave_idx_type i = 0; i < n; i++) | |
1967 { | |
1968 graphics_object obj = gh_manager::get_object (kids(i)); | |
1969 | |
1970 if (obj.isa ("line") || obj.isa ("image") | |
1971 || obj.isa ("patch") || obj.isa ("surface")) | |
1972 { | |
1973 data_property xdata = obj.get_xdata (); | |
1974 | |
1975 check_limit_vals (min_val, max_val, min_pos, xdata); | |
1976 | |
1977 if (obj.isa ("line")) | |
1978 { | |
1979 data_property xldata = obj.get_xldata (); | |
1980 data_property xudata = obj.get_xudata (); | |
1981 | |
1982 check_limit_vals (min_val, max_val, min_pos, xldata); | |
1983 check_limit_vals (min_val, max_val, min_pos, xudata); | |
1984 } | |
1985 } | |
1986 } | |
1987 | |
1988 tmp = xproperties.get_xscale (); | |
1989 | |
1990 limits = get_axis_limits (min_val, max_val, min_pos, | |
1991 tmp.current_value () == "log"); | |
1992 | |
1993 update_type = 'x'; | |
1994 } | |
1995 } | |
1996 else if (axis_type == "ydata" || axis_type == "yscale" | |
1997 || axis_type == "ldata" || axis_type == "udata" | |
1998 || axis_type == "ylimmode") | |
1999 { | |
2000 tmp = xproperties.get_ylimmode (); | |
2001 | |
2002 if (tmp.current_value () == "auto") | |
2003 { | |
2004 for (octave_idx_type i = 0; i < n; i++) | |
2005 { | |
2006 graphics_object obj = gh_manager::get_object (kids(i)); | |
2007 | |
2008 if (obj.isa ("line") || obj.isa ("image") | |
2009 || obj.isa ("patch") || obj.isa ("surface")) | |
2010 { | |
2011 data_property ydata = obj.get_ydata (); | |
2012 | |
2013 check_limit_vals (min_val, max_val, min_pos, ydata); | |
2014 | |
2015 if (obj.isa ("line")) | |
2016 { | |
2017 data_property ldata = obj.get_ldata (); | |
2018 data_property udata = obj.get_udata (); | |
2019 | |
2020 check_limit_vals (min_val, max_val, min_pos, ldata); | |
2021 check_limit_vals (min_val, max_val, min_pos, udata); | |
2022 } | |
2023 } | |
2024 } | |
2025 | |
2026 tmp = xproperties.get_yscale (); | |
2027 | |
2028 limits = get_axis_limits (min_val, max_val, min_pos, | |
2029 tmp.current_value () == "log"); | |
2030 | |
2031 update_type = 'y'; | |
2032 } | |
2033 } | |
2034 else if (axis_type == "zdata" || axis_type == "zscale" | |
2035 || axis_type == "zlimmode") | |
2036 { | |
2037 tmp = xproperties.get_zlimmode (); | |
2038 | |
2039 if (tmp.current_value () == "auto") | |
2040 { | |
2041 for (octave_idx_type i = 0; i < n; i++) | |
2042 { | |
2043 graphics_object obj = gh_manager::get_object (kids(i)); | |
2044 | |
2045 if (obj.isa ("line") || obj.isa ("patch") || obj.isa ("surface")) | |
2046 { | |
2047 data_property zdata = obj.get_zdata (); | |
2048 | |
2049 check_limit_vals (min_val, max_val, min_pos, zdata); | |
2050 } | |
2051 } | |
2052 | |
2053 tmp = xproperties.get_zscale (); | |
2054 | |
2055 limits = get_axis_limits (min_val, max_val, min_pos, | |
2056 tmp.current_value () == "log"); | |
2057 | |
2058 update_type = 'z'; | |
2059 } | |
2060 } | |
2061 else if (axis_type == "cdata" || axis_type == "climmode") | |
2062 { | |
2063 tmp = xproperties.get_climmode (); | |
2064 | |
2065 if (tmp.current_value () == "auto") | |
2066 { | |
2067 for (octave_idx_type i = 0; i < n; i++) | |
2068 { | |
2069 graphics_object obj = gh_manager::get_object (kids(i)); | |
2070 | |
2071 if (obj.isa ("image") || obj.isa ("patch") || obj.isa ("surface")) | |
2072 { | |
2073 data_property cdata = obj.get_cdata (); | |
2074 | |
2075 check_limit_vals (min_val, max_val, min_pos, cdata); | |
2076 } | |
2077 } | |
2078 | |
2079 if (min_val == max_val) | |
2080 max_val = min_val + 1; | |
2081 | |
2082 limits.resize (1, 2); | |
2083 | |
2084 limits(0) = min_val; | |
2085 limits(1) = max_val; | |
2086 | |
2087 update_type = 'c'; | |
2088 } | |
2089 | |
2090 } | |
2091 | |
2092 unwind_protect_bool (updating_axis_limits); | |
2093 updating_axis_limits = true; | |
2094 | |
2095 switch (update_type) | |
2096 { | |
2097 case 'x': | |
2098 xproperties.set_xlim (limits); | |
2099 xproperties.set_xlimmode ("auto"); | |
2100 break; | |
2101 | |
2102 case 'y': | |
2103 xproperties.set_ylim (limits); | |
2104 xproperties.set_ylimmode ("auto"); | |
2105 break; | |
2106 | |
2107 case 'z': | |
2108 xproperties.set_zlim (limits); | |
2109 xproperties.set_zlimmode ("auto"); | |
2110 break; | |
2111 | |
2112 case 'c': | |
2113 xproperties.set_clim (limits); | |
2114 xproperties.set_climmode ("auto"); | |
2115 break; | |
2116 | |
2117 default: | |
2118 break; | |
2119 } | |
2120 | |
2121 unwind_protect::run (); | |
7214 | 2122 } |
2123 | |
6844 | 2124 std::string axes::properties::go_name ("axes"); |
6406 | 2125 |
2126 // --------------------------------------------------------------------- | |
2127 | |
2128 static Matrix | |
2129 default_data (void) | |
2130 { | |
2131 Matrix retval (1, 2); | |
2132 | |
2133 retval(0) = 0; | |
2134 retval(1) = 1; | |
2135 | |
2136 return retval; | |
2137 } | |
2138 | |
6844 | 2139 line::properties::properties (const graphics_handle& mh, |
2140 const graphics_handle& p) | |
6705 | 2141 : base_properties (go_name, mh, p), |
2142 xdata (default_data ()), | |
2143 ydata (default_data ()), | |
2144 zdata (Matrix ()), | |
2145 ldata (Matrix ()), | |
2146 udata (Matrix ()), | |
2147 xldata (Matrix ()), | |
2148 xudata (Matrix ()), | |
2149 color (), | |
2150 linestyle ("-"), | |
2151 linewidth (0.5), | |
2152 marker ("none"), | |
2153 markeredgecolor ("auto"), | |
2154 markerfacecolor ("none"), | |
11674
270677feba91
markersize compatibility changes
John W. Eaton <jwe@octave.org>
parents:
11635
diff
changeset
|
2155 markersize (6), |
7189 | 2156 keylabel (""), |
2157 interpreter (radio_values ("{tex}|none|latex")) | |
6705 | 2158 { } |
2159 | |
2160 void | |
7189 | 2161 line::properties::set (const caseless_str& name, const octave_value& val) |
6406 | 2162 { |
6705 | 2163 bool modified = true; |
6432 | 2164 |
7176 | 2165 if (name.compare ("tag")) |
2166 set_tag (val); | |
2167 else if (name.compare ("parent")) | |
6705 | 2168 set_parent (val); |
2169 else if (name.compare ("children")) | |
2170 children = maybe_set_children (children, val); | |
2171 else if (name.compare ("__modified__")) | |
2172 { | |
2173 __modified__ = val.bool_value (); | |
2174 modified = false; | |
6406 | 2175 } |
6705 | 2176 else if (name.compare ("xdata")) |
6874 | 2177 set_xdata (val); |
6705 | 2178 else if (name.compare ("ydata")) |
6874 | 2179 set_ydata (val); |
6705 | 2180 else if (name.compare ("zdata")) |
6874 | 2181 set_zdata (val); |
6705 | 2182 else if (name.compare ("ldata")) |
6874 | 2183 set_ldata (val); |
6705 | 2184 else if (name.compare ("udata")) |
6874 | 2185 set_udata (val); |
6705 | 2186 else if (name.compare ("xldata")) |
6874 | 2187 set_xldata (val); |
6705 | 2188 else if (name.compare ("xudata")) |
6874 | 2189 set_xudata (val); |
6705 | 2190 else if (name.compare ("color")) |
6874 | 2191 set_color (val); |
6705 | 2192 else if (name.compare ("linestyle")) |
6874 | 2193 set_linestyle (val); |
6705 | 2194 else if (name.compare ("linewidth")) |
6874 | 2195 set_linewidth (val); |
6705 | 2196 else if (name.compare ("marker")) |
6874 | 2197 set_marker (val); |
6705 | 2198 else if (name.compare ("markeredgecolor")) |
6874 | 2199 set_markeredgecolor (val); |
6705 | 2200 else if (name.compare ("markerfacecolor")) |
6874 | 2201 set_markerfacecolor (val); |
6705 | 2202 else if (name.compare ("markersize")) |
6874 | 2203 set_markersize (val); |
6705 | 2204 else if (name.compare ("keylabel")) |
6874 | 2205 set_keylabel (val); |
7189 | 2206 else if (name.compare ("interpreter")) |
2207 set_interpreter (val); | |
6705 | 2208 else |
6406 | 2209 { |
6705 | 2210 modified = false; |
2211 warning ("set: invalid property `%s'", name.c_str ()); | |
6406 | 2212 } |
2213 | |
6705 | 2214 if (modified) |
2215 mark_modified (); | |
2216 } | |
2217 | |
2218 octave_value | |
6844 | 2219 line::properties::get (void) const |
6705 | 2220 { |
2221 Octave_map m; | |
6406 | 2222 |
7176 | 2223 m.assign ("tag", tag); |
6705 | 2224 m.assign ("type", type); |
6874 | 2225 m.assign ("parent", parent.as_octave_value ()); |
6705 | 2226 m.assign ("children", children); |
2227 m.assign ("__modified__", __modified__); | |
2228 m.assign ("xdata", xdata); | |
2229 m.assign ("ydata", ydata); | |
2230 m.assign ("zdata", zdata); | |
2231 m.assign ("ldata", ldata); | |
2232 m.assign ("udata", udata); | |
2233 m.assign ("xldata", xldata); | |
2234 m.assign ("xudata", xudata); | |
2235 m.assign ("color", color); | |
2236 m.assign ("linestyle", linestyle); | |
2237 m.assign ("linewidth", linewidth); | |
2238 m.assign ("marker", marker); | |
2239 m.assign ("markeredgecolor", markeredgecolor); | |
7086 | 2240 m.assign ("markerfacecolor", markerfacecolor); |
6705 | 2241 m.assign ("markersize", markersize); |
2242 m.assign ("keylabel", keylabel); | |
7189 | 2243 m.assign ("interpreter", interpreter); |
6406 | 2244 |
6705 | 2245 return m; |
2246 } | |
6406 | 2247 |
6705 | 2248 octave_value |
7189 | 2249 line::properties::get (const caseless_str& name) const |
6705 | 2250 { |
2251 octave_value retval; | |
6406 | 2252 |
7176 | 2253 if (name.compare ("tag")) |
2254 retval = tag; | |
2255 else if (name.compare ("type")) | |
6705 | 2256 retval = type; |
2257 else if (name.compare ("parent")) | |
6874 | 2258 retval = parent.as_octave_value (); |
6705 | 2259 else if (name.compare ("children")) |
2260 retval = children; | |
2261 else if (name.compare ("__modified__")) | |
2262 retval = __modified__; | |
2263 else if (name.compare ("xdata")) | |
2264 retval = xdata; | |
2265 else if (name.compare ("ydata")) | |
2266 retval = ydata; | |
2267 else if (name.compare ("zdata")) | |
2268 retval = zdata; | |
2269 else if (name.compare ("ldata")) | |
2270 retval = ldata; | |
2271 else if (name.compare ("udata")) | |
2272 retval = udata; | |
2273 else if (name.compare ("xldata")) | |
2274 retval = xldata; | |
2275 else if (name.compare ("xudata")) | |
2276 retval = xudata; | |
2277 else if (name.compare ("color")) | |
2278 retval = color; | |
2279 else if (name.compare ("linestyle")) | |
2280 retval = linestyle; | |
2281 else if (name.compare ("linewidth")) | |
2282 retval = linewidth; | |
2283 else if (name.compare ("marker")) | |
2284 retval = marker; | |
2285 else if (name.compare ("markeredgecolor")) | |
2286 retval = markeredgecolor; | |
2287 else if (name.compare ("markerfacecolor")) | |
2288 retval = markerfacecolor; | |
2289 else if (name.compare ("markersize")) | |
2290 retval = markersize; | |
2291 else if (name.compare ("keylabel")) | |
2292 retval = keylabel; | |
7189 | 2293 else if (name.compare ("interpreter")) |
2294 retval = interpreter; | |
6705 | 2295 else |
2296 warning ("get: invalid property `%s'", name.c_str ()); | |
6432 | 2297 |
6705 | 2298 return retval; |
2299 } | |
6406 | 2300 |
6836 | 2301 property_list::pval_map_type |
6844 | 2302 line::properties::factory_defaults (void) |
6705 | 2303 { |
2304 property_list::pval_map_type m; | |
6406 | 2305 |
6705 | 2306 m["xdata"] = default_data (); |
2307 m["ydata"] = default_data (); | |
2308 m["zdata"] = Matrix (); | |
2309 m["ldata"] = Matrix (); | |
2310 m["udata"] = Matrix (); | |
2311 m["xldata"] = Matrix (); | |
2312 m["xudata"] = Matrix (); | |
2313 m["color"] = color_property (); | |
2314 m["linestyle"] = "-"; | |
2315 m["linewidth"] = 0.5; | |
2316 m["marker"] = "none"; | |
2317 m["markeredgecolor"] = "auto"; | |
2318 m["markerfacecolor"] = "none"; | |
11674
270677feba91
markersize compatibility changes
John W. Eaton <jwe@octave.org>
parents:
11635
diff
changeset
|
2319 m["markersize"] = 6; |
6705 | 2320 m["keylabel"] = ""; |
7213 | 2321 m["interpreter"] = radio_property (radio_values ("{tex}|none|latex")); |
6406 | 2322 |
6705 | 2323 return m; |
2324 } | |
6406 | 2325 |
6844 | 2326 std::string line::properties::go_name ("line"); |
6406 | 2327 |
2328 // --------------------------------------------------------------------- | |
2329 | |
6844 | 2330 text::properties::properties (const graphics_handle& mh, |
2331 const graphics_handle& p) | |
6705 | 2332 : base_properties (go_name, mh, p), |
2333 string (""), | |
2334 units ("data"), | |
2335 position (Matrix (1, 3, 0.0)), | |
6724 | 2336 rotation (0), |
6829 | 2337 horizontalalignment ("left"), |
7162 | 2338 color (Matrix (1, 3, 0.0)), |
2339 fontname ("Helvetica"), | |
7168 | 2340 fontsize (10), |
2341 fontangle (radio_values ("{normal}|italic|oblique")), | |
7189 | 2342 fontweight (radio_values ("{normal}|bold|demi|light")), |
2343 interpreter (radio_values ("{tex}|none|latex")) | |
6705 | 2344 { } |
2345 | |
2346 void | |
7189 | 2347 text::properties::set (const caseless_str& name, const octave_value& val) |
6406 | 2348 { |
6705 | 2349 bool modified = true; |
6432 | 2350 |
7176 | 2351 if (name.compare ("tag")) |
2352 set_tag (val); | |
2353 else if (name.compare ("parent")) | |
6705 | 2354 set_parent (val); |
2355 else if (name.compare ("children")) | |
2356 children = maybe_set_children (children, val); | |
2357 else if (name.compare ("__modified__")) | |
2358 { | |
2359 __modified__ = val.bool_value (); | |
2360 modified = false; | |
6406 | 2361 } |
6705 | 2362 else if (name.compare ("string")) |
6874 | 2363 set_string (val); |
6705 | 2364 else if (name.compare ("units")) |
6874 | 2365 set_units (val); |
6705 | 2366 else if (name.compare ("position")) |
6874 | 2367 set_position (val); |
6724 | 2368 else if (name.compare ("rotation")) |
6874 | 2369 set_rotation (val); |
6705 | 2370 else if (name.compare ("horizontalalignment")) |
6874 | 2371 set_horizontalalignment (val); |
6829 | 2372 else if (name.compare ("color")) |
6874 | 2373 set_color (val); |
7162 | 2374 else if (name.compare ("fontname")) |
2375 set_fontname (val); | |
2376 else if (name.compare ("fontsize")) | |
2377 set_fontsize (val); | |
7168 | 2378 else if (name.compare ("fontangle")) |
2379 set_fontangle (val); | |
2380 else if (name.compare ("fontweight")) | |
2381 set_fontweight (val); | |
7189 | 2382 else if (name.compare ("interpreter")) |
2383 set_interpreter (val); | |
6705 | 2384 else |
6406 | 2385 { |
6705 | 2386 modified = false; |
2387 warning ("set: invalid property `%s'", name.c_str ()); | |
6406 | 2388 } |
2389 | |
6705 | 2390 if (modified) |
2391 mark_modified (); | |
2392 } | |
6406 | 2393 |
6705 | 2394 octave_value |
6844 | 2395 text::properties::get (void) const |
6705 | 2396 { |
2397 Octave_map m; | |
6406 | 2398 |
7176 | 2399 m.assign ("tag", tag); |
6705 | 2400 m.assign ("type", type); |
6874 | 2401 m.assign ("parent", parent.as_octave_value ()); |
6705 | 2402 m.assign ("children", children); |
2403 m.assign ("__modified__", __modified__); | |
2404 m.assign ("string", string); | |
2405 m.assign ("units", units); | |
2406 m.assign ("position", position); | |
6724 | 2407 m.assign ("rotation", rotation); |
6705 | 2408 m.assign ("horizontalalignment", horizontalalignment); |
6829 | 2409 m.assign ("color", color); |
7162 | 2410 m.assign ("fontname", fontname); |
2411 m.assign ("fontsize", fontsize); | |
7168 | 2412 m.assign ("fontangle", fontangle); |
2413 m.assign ("fontweight", fontweight); | |
7189 | 2414 m.assign ("interpreter", interpreter); |
6406 | 2415 |
6705 | 2416 return m; |
2417 } | |
6406 | 2418 |
6705 | 2419 octave_value |
7189 | 2420 text::properties::get (const caseless_str& name) const |
6705 | 2421 { |
2422 octave_value retval; | |
6406 | 2423 |
7176 | 2424 if (name.compare ("tag")) |
2425 retval = tag; | |
2426 else if (name.compare ("type")) | |
6705 | 2427 retval = type; |
2428 else if (name.compare ("parent")) | |
6874 | 2429 retval = parent.as_octave_value (); |
6705 | 2430 else if (name.compare ("children")) |
2431 retval = children; | |
2432 else if (name.compare ("__modified__")) | |
2433 retval = __modified__; | |
2434 else if (name.compare ("string")) | |
2435 retval = string; | |
2436 else if (name.compare ("units")) | |
2437 retval = units; | |
2438 else if (name.compare ("position")) | |
2439 retval = position; | |
6724 | 2440 else if (name.compare ("rotation")) |
2441 retval = rotation; | |
6705 | 2442 else if (name.compare ("horizontalalignment")) |
2443 retval = horizontalalignment; | |
6829 | 2444 else if (name.compare ("color")) |
2445 retval = color; | |
7162 | 2446 else if (name.compare ("fontname")) |
2447 retval = fontname; | |
2448 else if (name.compare ("fontsize")) | |
2449 retval = fontsize; | |
7168 | 2450 else if (name.compare ("fontangle")) |
2451 retval = fontangle; | |
2452 else if (name.compare ("fontweight")) | |
2453 retval = fontweight; | |
7189 | 2454 else if (name.compare ("interpreter")) |
2455 retval = interpreter; | |
6705 | 2456 else |
2457 warning ("get: invalid property `%s'", name.c_str ()); | |
6406 | 2458 |
6705 | 2459 return retval; |
2460 } | |
6406 | 2461 |
6705 | 2462 property_list::pval_map_type |
6844 | 2463 text::properties::factory_defaults (void) |
6705 | 2464 { |
2465 property_list::pval_map_type m; | |
6406 | 2466 |
6705 | 2467 m["string"] = ""; |
2468 m["units"] = "data"; | |
2469 m["position"] = Matrix (1, 3, 0.0); | |
6724 | 2470 m["rotation"] = 0; |
6705 | 2471 m["horizontalalignment"] = "left"; |
6829 | 2472 m["color"] = Matrix (1, 3, 1.0); |
7162 | 2473 m["fontname"] = "Helvetica"; |
2474 m["fontsize"] = 10; | |
7213 | 2475 m["fontangle"] = radio_property (radio_values ("{normal}|italic|oblique")); |
2476 m["fontweight"] = radio_property (radio_values ("{normal}|bold|demi|light")); | |
2477 m["interpreter"] = radio_property (radio_values ("{tex}|none|latex")); | |
6406 | 2478 |
6705 | 2479 return m; |
2480 } | |
6406 | 2481 |
6844 | 2482 std::string text::properties::go_name ("text"); |
6406 | 2483 |
2484 // --------------------------------------------------------------------- | |
2485 | |
6844 | 2486 image::properties::properties (const graphics_handle& mh, |
2487 const graphics_handle& p) | |
6705 | 2488 : base_properties (go_name, mh, p), |
2489 xdata (Matrix ()), | |
7213 | 2490 ydata (Matrix ()), |
11635
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2491 cdata (Matrix ()), |
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2492 cdatamapping (radio_values ("{scaled}|direct")) |
6705 | 2493 { } |
2494 | |
2495 void | |
7189 | 2496 image::properties::set (const caseless_str& name, |
6844 | 2497 const octave_value& val) |
6406 | 2498 { |
6705 | 2499 bool modified = true; |
6432 | 2500 |
7176 | 2501 if (name.compare ("tag")) |
2502 set_tag (val); | |
2503 else if (name.compare ("parent")) | |
6705 | 2504 set_parent (val); |
2505 else if (name.compare ("children")) | |
2506 children = maybe_set_children (children, val); | |
2507 else if (name.compare ("__modified__")) | |
2508 { | |
2509 __modified__ = val.bool_value (); | |
2510 modified = false; | |
6406 | 2511 } |
6705 | 2512 else if (name.compare ("xdata")) |
6874 | 2513 set_xdata (val); |
6705 | 2514 else if (name.compare ("ydata")) |
6874 | 2515 set_ydata (val); |
7213 | 2516 else if (name.compare ("cdata")) |
2517 set_cdata (val); | |
11635
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2518 else if (name.compare ("cdatamapping")) |
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2519 set_cdatamapping (val); |
6705 | 2520 else |
6406 | 2521 { |
6705 | 2522 modified = false; |
2523 warning ("set: invalid property `%s'", name.c_str ()); | |
6406 | 2524 } |
2525 | |
6705 | 2526 if (modified) |
2527 mark_modified (); | |
2528 } | |
6406 | 2529 |
6705 | 2530 octave_value |
6844 | 2531 image::properties::get (void) const |
6705 | 2532 { |
2533 Octave_map m; | |
6406 | 2534 |
7176 | 2535 m.assign ("tag", tag); |
6705 | 2536 m.assign ("type", type); |
6874 | 2537 m.assign ("parent", parent.as_octave_value ()); |
6705 | 2538 m.assign ("children", children); |
2539 m.assign ("__modified__", __modified__); | |
2540 m.assign ("xdata", xdata); | |
2541 m.assign ("ydata", ydata); | |
7213 | 2542 m.assign ("cdata", cdata); |
11635
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2543 m.assign ("cdatamapping", cdatamapping); |
6406 | 2544 |
6705 | 2545 return m; |
2546 } | |
6406 | 2547 |
6705 | 2548 octave_value |
7189 | 2549 image::properties::get (const caseless_str& name) const |
6705 | 2550 { |
2551 octave_value retval; | |
6406 | 2552 |
7176 | 2553 if (name.compare ("tag")) |
2554 retval = tag; | |
2555 else if (name.compare ("type")) | |
6705 | 2556 retval = type; |
2557 else if (name.compare ("parent")) | |
6874 | 2558 retval = parent.as_octave_value (); |
6705 | 2559 else if (name.compare ("children")) |
2560 retval = children; | |
2561 else if (name.compare ("__modified__")) | |
2562 retval = __modified__; | |
2563 else if (name.compare ("xdata")) | |
2564 retval = xdata; | |
2565 else if (name.compare ("ydata")) | |
2566 retval = ydata; | |
7213 | 2567 else if (name.compare ("cdata")) |
2568 retval = cdata; | |
11635
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2569 else if (name.compare ("cdatamapping")) |
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2570 retval = cdatamapping; |
6705 | 2571 else |
2572 warning ("get: invalid property `%s'", name.c_str ()); | |
6406 | 2573 |
6705 | 2574 return retval; |
2575 } | |
6406 | 2576 |
6836 | 2577 property_list::pval_map_type |
6844 | 2578 image::properties::factory_defaults (void) |
6705 | 2579 { |
2580 property_list::pval_map_type m; | |
6406 | 2581 |
6705 | 2582 m["xdata"] = Matrix (); |
2583 m["ydata"] = Matrix (); | |
7213 | 2584 m["cdata"] = Matrix (); |
11635
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2585 m["cdatamapping"] = radio_property (radio_values ("{scaled}|direct")); |
6406 | 2586 |
6705 | 2587 return m; |
2588 } | |
6406 | 2589 |
6844 | 2590 std::string image::properties::go_name ("image"); |
6406 | 2591 |
2592 // --------------------------------------------------------------------- | |
2593 | |
6844 | 2594 patch::properties::properties (const graphics_handle& mh, |
2595 const graphics_handle& p) | |
6807 | 2596 : base_properties (go_name, mh, p), |
2597 xdata (Matrix ()), | |
2598 ydata (Matrix ()), | |
2599 zdata (Matrix ()), | |
7213 | 2600 cdata (Matrix ()), |
11635
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2601 cdatamapping (radio_values ("{scaled}|direct")), |
7020 | 2602 faces (Matrix ()), |
2603 vertices (Matrix ()), | |
6898 | 2604 facecolor (radio_values ("{flat}|none|interp")), |
6807 | 2605 facealpha (1.0), |
7286 | 2606 edgecolor (color_values (0, 0, 0), radio_values ("flat|none|interp")), |
6807 | 2607 linestyle ("-"), |
2608 linewidth (0.5), | |
2609 marker ("none"), | |
2610 markeredgecolor ("auto"), | |
2611 markerfacecolor ("none"), | |
11674
270677feba91
markersize compatibility changes
John W. Eaton <jwe@octave.org>
parents:
11635
diff
changeset
|
2612 markersize (6), |
7189 | 2613 keylabel (""), |
2614 interpreter (radio_values ("{tex}|none|latex")) | |
6807 | 2615 { } |
2616 | |
2617 void | |
7189 | 2618 patch::properties::set (const caseless_str& name, |
6844 | 2619 const octave_value& val) |
6807 | 2620 { |
2621 bool modified = true; | |
2622 | |
7176 | 2623 if (name.compare ("tag")) |
2624 set_tag (val); | |
2625 else if (name.compare ("parent")) | |
6807 | 2626 set_parent (val); |
2627 else if (name.compare ("children")) | |
2628 children = maybe_set_children (children, val); | |
2629 else if (name.compare ("__modified__")) | |
2630 { | |
2631 __modified__ = val.bool_value (); | |
2632 modified = false; | |
2633 } | |
2634 else if (name.compare ("xdata")) | |
6874 | 2635 set_xdata (val); |
6807 | 2636 else if (name.compare ("ydata")) |
6874 | 2637 set_ydata (val); |
6807 | 2638 else if (name.compare ("zdata")) |
6874 | 2639 set_zdata (val); |
7213 | 2640 else if (name.compare ("cdata")) |
2641 set_cdata (val); | |
11635
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2642 else if (name.compare ("cdatamapping")) |
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2643 set_cdatamapping (val); |
7020 | 2644 else if (name.compare ("faces")) |
2645 set_faces (val); | |
2646 else if (name.compare ("vertices")) | |
2647 set_vertices (val); | |
6807 | 2648 else if (name.compare ("facecolor")) |
6938 | 2649 set_facecolor (val); |
6807 | 2650 else if (name.compare ("facealpha")) |
6874 | 2651 set_facealpha (val); |
6807 | 2652 else if (name.compare ("edgecolor")) |
6874 | 2653 set_edgecolor (val); |
6807 | 2654 else if (name.compare ("linestyle")) |
6874 | 2655 set_linestyle (val); |
6807 | 2656 else if (name.compare ("linewidth")) |
6874 | 2657 set_linewidth (val); |
6807 | 2658 else if (name.compare ("marker")) |
6874 | 2659 set_marker (val); |
6807 | 2660 else if (name.compare ("markeredgecolor")) |
6874 | 2661 set_markeredgecolor (val); |
6807 | 2662 else if (name.compare ("markerfacecolor")) |
6874 | 2663 set_markerfacecolor (val); |
6807 | 2664 else if (name.compare ("markersize")) |
6874 | 2665 set_markersize (val); |
7148 | 2666 else if (name.compare ("keylabel")) |
2667 set_keylabel (val); | |
7189 | 2668 else if (name.compare ("interpreter")) |
2669 set_interpreter (val); | |
6807 | 2670 else |
2671 { | |
2672 modified = false; | |
2673 warning ("set: invalid property `%s'", name.c_str ()); | |
2674 } | |
2675 | |
2676 if (modified) | |
2677 mark_modified (); | |
2678 } | |
2679 | |
2680 octave_value | |
6844 | 2681 patch::properties::get (void) const |
6807 | 2682 { |
2683 Octave_map m; | |
2684 | |
7176 | 2685 m.assign ("tag", tag); |
6807 | 2686 m.assign ("type", type); |
6874 | 2687 m.assign ("parent", parent.as_octave_value ()); |
6807 | 2688 m.assign ("children", children); |
2689 m.assign ("__modified__", __modified__); | |
2690 m.assign ("xdata", xdata); | |
2691 m.assign ("ydata", ydata); | |
2692 m.assign ("zdata", zdata); | |
7213 | 2693 m.assign ("cdata", cdata); |
11635
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2694 m.assign ("cdatamapping", cdatamapping); |
7020 | 2695 m.assign ("faces", faces); |
2696 m.assign ("vertices", vertices); | |
6807 | 2697 m.assign ("facecolor", facecolor); |
2698 m.assign ("facealpha", facealpha); | |
2699 m.assign ("edgecolor", edgecolor); | |
2700 m.assign ("linestyle", linestyle); | |
2701 m.assign ("linewidth", linewidth); | |
2702 m.assign ("marker", marker); | |
2703 m.assign ("markeredgecolor", markeredgecolor); | |
2704 m.assign ("markerface", markerfacecolor); | |
2705 m.assign ("markersize", markersize); | |
7148 | 2706 m.assign ("keylabel", keylabel); |
7189 | 2707 m.assign ("interpreter", interpreter); |
6807 | 2708 |
2709 return m; | |
2710 } | |
2711 | |
2712 octave_value | |
7189 | 2713 patch::properties::get (const caseless_str& name) const |
6807 | 2714 { |
2715 octave_value retval; | |
2716 | |
7176 | 2717 if (name.compare ("tag")) |
2718 retval = tag; | |
2719 else if (name.compare ("type")) | |
6807 | 2720 retval = type; |
2721 else if (name.compare ("parent")) | |
6874 | 2722 retval = parent.as_octave_value (); |
6807 | 2723 else if (name.compare ("children")) |
2724 retval = children; | |
2725 else if (name.compare ("__modified__")) | |
2726 retval = __modified__; | |
2727 else if (name.compare ("xdata")) | |
2728 retval = xdata; | |
2729 else if (name.compare ("ydata")) | |
2730 retval = ydata; | |
2731 else if (name.compare ("zdata")) | |
2732 retval = zdata; | |
7213 | 2733 else if (name.compare ("cdata")) |
2734 retval = cdata; | |
11635
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2735 else if (name.compare ("cdatamapping")) |
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2736 retval = cdatamapping; |
7020 | 2737 else if (name.compare ("faces")) |
2738 retval = faces; | |
2739 else if (name.compare ("vertices")) | |
2740 retval = vertices; | |
6807 | 2741 else if (name.compare ("facecolor")) |
2742 retval = facecolor; | |
2743 else if (name.compare ("facealpha")) | |
7108 | 2744 retval = facealpha; |
7317 | 2745 else if (name.compare ("edgecolor")) |
6807 | 2746 retval = edgecolor; |
2747 else if (name.compare ("linestyle")) | |
2748 retval = linestyle; | |
2749 else if (name.compare ("linewidth")) | |
2750 retval = linewidth; | |
2751 else if (name.compare ("marker")) | |
2752 retval = marker; | |
2753 else if (name.compare ("markeredgecolor")) | |
2754 retval = markeredgecolor; | |
2755 else if (name.compare ("markerfacecolor")) | |
2756 retval = markerfacecolor; | |
2757 else if (name.compare ("markersize")) | |
2758 retval = markersize; | |
7148 | 2759 else if (name.compare ("keylabel")) |
2760 retval = keylabel; | |
7189 | 2761 else if (name.compare ("interpreter")) |
2762 retval = interpreter; | |
6807 | 2763 else |
2764 warning ("get: invalid property `%s'", name.c_str ()); | |
2765 | |
2766 return retval; | |
2767 } | |
2768 | |
6836 | 2769 property_list::pval_map_type |
6844 | 2770 patch::properties::factory_defaults (void) |
6807 | 2771 { |
2772 property_list::pval_map_type m; | |
2773 | |
2774 m["xdata"] = Matrix (); | |
2775 m["ydata"] = Matrix (); | |
2776 m["zdata"] = Matrix (); | |
7213 | 2777 m["cdata"] = Matrix (); |
11635
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2778 m["cdatamapping"] = radio_property (radio_values ("{scaled}|direct")); |
7020 | 2779 m["faces"] = Matrix (); |
2780 m["vertices"] = Matrix (); | |
7108 | 2781 m["facecolor"] = color_property (); |
6807 | 2782 m["facealpha"] = 1.0; |
7108 | 2783 m["edgecolor"] = color_property ("black"); |
6807 | 2784 m["linestyle"] = "-"; |
2785 m["linewidth"] = 0.5; | |
2786 m["marker"] = "none"; | |
2787 m["markeredgecolor"] = "auto"; | |
2788 m["markerfacecolor"] = "none"; | |
11674
270677feba91
markersize compatibility changes
John W. Eaton <jwe@octave.org>
parents:
11635
diff
changeset
|
2789 m["markersize"] = 6; |
7148 | 2790 m["keylabel"] = ""; |
7213 | 2791 m["interpreter"] = radio_property (radio_values ("{tex}|none|latex")); |
6807 | 2792 |
2793 return m; | |
2794 } | |
2795 | |
6844 | 2796 std::string patch::properties::go_name ("patch"); |
6807 | 2797 |
2798 // --------------------------------------------------------------------- | |
2799 | |
6844 | 2800 surface::properties::properties (const graphics_handle& mh, |
2801 const graphics_handle& p) | |
6705 | 2802 : base_properties (go_name, mh, p), |
2803 xdata (Matrix ()), | |
2804 ydata (Matrix ()), | |
2805 zdata (Matrix ()), | |
7108 | 2806 cdata (Matrix ()), |
11635
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2807 cdatamapping (radio_values ("{scaled}|direct")), |
7108 | 2808 facecolor (radio_values ("{flat}|none|interp")), |
2809 facealpha (1.0), | |
7286 | 2810 edgecolor (color_values (0, 0, 0), radio_values ("flat|none|interp")), |
7108 | 2811 linestyle ("-"), |
2812 linewidth (0.5), | |
2813 marker ("none"), | |
2814 markeredgecolor ("auto"), | |
2815 markerfacecolor ("none"), | |
11674
270677feba91
markersize compatibility changes
John W. Eaton <jwe@octave.org>
parents:
11635
diff
changeset
|
2816 markersize (6), |
7189 | 2817 keylabel (""), |
2818 interpreter (radio_values ("{tex}|none|latex")) | |
6705 | 2819 { } |
2820 | |
2821 void | |
7189 | 2822 surface::properties::set (const caseless_str& name, |
6844 | 2823 const octave_value& val) |
6406 | 2824 { |
6705 | 2825 bool modified = true; |
6432 | 2826 |
7176 | 2827 if (name.compare ("tag")) |
2828 set_tag (val); | |
2829 else if (name.compare ("parent")) | |
6705 | 2830 set_parent (val); |
2831 else if (name.compare ("children")) | |
2832 children = maybe_set_children (children, val); | |
2833 else if (name.compare ("__modified__")) | |
2834 { | |
2835 __modified__ = val.bool_value (); | |
2836 modified = false; | |
6406 | 2837 } |
6705 | 2838 else if (name.compare ("xdata")) |
6874 | 2839 set_xdata (val); |
6705 | 2840 else if (name.compare ("ydata")) |
6874 | 2841 set_ydata (val); |
6705 | 2842 else if (name.compare ("zdata")) |
6874 | 2843 set_zdata (val); |
7108 | 2844 else if (name.compare ("cdata")) |
2845 set_cdata (val); | |
11635
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2846 else if (name.compare ("cdatamapping")) |
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2847 set_cdatamapping (val); |
7108 | 2848 else if (name.compare ("facecolor")) |
2849 set_facecolor (val); | |
2850 else if (name.compare ("facealpha")) | |
2851 set_facealpha (val); | |
2852 else if (name.compare ("edgecolor")) | |
2853 set_edgecolor (val); | |
2854 else if (name.compare ("linestyle")) | |
2855 set_linestyle (val); | |
2856 else if (name.compare ("linewidth")) | |
2857 set_linewidth (val); | |
2858 else if (name.compare ("marker")) | |
2859 set_marker (val); | |
2860 else if (name.compare ("markeredgecolor")) | |
2861 set_markeredgecolor (val); | |
2862 else if (name.compare ("markerfacecolor")) | |
2863 set_markerfacecolor (val); | |
2864 else if (name.compare ("markersize")) | |
2865 set_markersize (val); | |
6705 | 2866 else if (name.compare ("keylabel")) |
6874 | 2867 set_keylabel (val); |
7189 | 2868 else if (name.compare ("interpreter")) |
2869 set_interpreter (val); | |
6705 | 2870 else |
6406 | 2871 { |
6705 | 2872 modified = false; |
2873 warning ("set: invalid property `%s'", name.c_str ()); | |
6406 | 2874 } |
2875 | |
6705 | 2876 if (modified) |
2877 mark_modified (); | |
2878 } | |
6406 | 2879 |
6705 | 2880 octave_value |
6844 | 2881 surface::properties::get (void) const |
6705 | 2882 { |
2883 Octave_map m; | |
6406 | 2884 |
7176 | 2885 m.assign ("tag", tag); |
6705 | 2886 m.assign ("type", type); |
6874 | 2887 m.assign ("parent", parent.as_octave_value ()); |
6705 | 2888 m.assign ("children", children); |
2889 m.assign ("__modified__", __modified__); | |
2890 m.assign ("xdata", xdata); | |
2891 m.assign ("ydata", ydata); | |
2892 m.assign ("zdata", zdata); | |
7108 | 2893 m.assign ("cdata", cdata); |
11635
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2894 m.assign ("cdatamapping", cdatamapping); |
7108 | 2895 m.assign ("facecolor", facecolor); |
2896 m.assign ("facealpha", facealpha); | |
2897 m.assign ("edgecolor", edgecolor); | |
2898 m.assign ("linestyle", linestyle); | |
2899 m.assign ("linewidth", linewidth); | |
2900 m.assign ("marker", marker); | |
2901 m.assign ("markeredgecolor", markeredgecolor); | |
2902 m.assign ("markerface", markerfacecolor); | |
2903 m.assign ("markersize", markersize); | |
6705 | 2904 m.assign ("keylabel", keylabel); |
7189 | 2905 m.assign ("interpreter", interpreter); |
6406 | 2906 |
6705 | 2907 return m; |
2908 } | |
6406 | 2909 |
6705 | 2910 octave_value |
7189 | 2911 surface::properties::get (const caseless_str& name) const |
6705 | 2912 { |
2913 octave_value retval; | |
6406 | 2914 |
7176 | 2915 if (name.compare ("tag")) |
2916 retval = tag; | |
2917 else if (name.compare ("type")) | |
6705 | 2918 retval = type; |
2919 else if (name.compare ("parent")) | |
6874 | 2920 retval = parent.as_octave_value (); |
6705 | 2921 else if (name.compare ("children")) |
2922 retval = children; | |
2923 else if (name.compare ("__modified__")) | |
2924 retval = __modified__; | |
2925 else if (name.compare ("xdata")) | |
2926 retval = xdata; | |
2927 else if (name.compare ("ydata")) | |
2928 retval = ydata; | |
2929 else if (name.compare ("zdata")) | |
2930 retval = zdata; | |
7108 | 2931 else if (name.compare ("cdata")) |
2932 retval = cdata; | |
11635
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2933 else if (name.compare ("cdatamapping")) |
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2934 retval = cdatamapping; |
7108 | 2935 else if (name.compare ("facecolor")) |
2936 retval = facecolor; | |
2937 else if (name.compare ("facealpha")) | |
2938 retval = facealpha; | |
2939 else if (name.compare ("edgecolor")) | |
2940 retval = edgecolor; | |
2941 else if (name.compare ("linestyle")) | |
2942 retval = linestyle; | |
2943 else if (name.compare ("linewidth")) | |
2944 retval = linewidth; | |
2945 else if (name.compare ("marker")) | |
2946 retval = marker; | |
2947 else if (name.compare ("markeredgecolor")) | |
2948 retval = markeredgecolor; | |
2949 else if (name.compare ("markerfacecolor")) | |
2950 retval = markerfacecolor; | |
2951 else if (name.compare ("markersize")) | |
2952 retval = markersize; | |
6705 | 2953 else if (name.compare ("keylabel")) |
2954 retval = keylabel; | |
7189 | 2955 else if (name.compare ("interpreter")) |
2956 retval = interpreter; | |
6705 | 2957 else |
2958 warning ("get: invalid property `%s'", name.c_str ()); | |
6406 | 2959 |
6705 | 2960 return retval; |
2961 } | |
6406 | 2962 |
6705 | 2963 property_list::pval_map_type |
6844 | 2964 surface::properties::factory_defaults (void) |
6705 | 2965 { |
2966 property_list::pval_map_type m; | |
6406 | 2967 |
6705 | 2968 m["xdata"] = Matrix (); |
2969 m["ydata"] = Matrix (); | |
2970 m["zdata"] = Matrix (); | |
7108 | 2971 m["cdata"] = Matrix (); |
11635
e08d2fff0d58
Implement cdatamapping and respect to to allow correct image/imagesc rendering
David Bateman <dbateman@free.fr>
parents:
7317
diff
changeset
|
2972 m["cdatamapping"] = radio_property (radio_values ("{scaled}|direct")); |
7108 | 2973 m["facecolor"] = color_property (); |
2974 m["facealpha"] = 1.0; | |
2975 m["edgecolor"] = color_property ("black"); | |
2976 m["linestyle"] = "-"; | |
2977 m["linewidth"] = 0.5; | |
2978 m["marker"] = "none"; | |
2979 m["markeredgecolor"] = "auto"; | |
2980 m["markerfacecolor"] = "none"; | |
11674
270677feba91
markersize compatibility changes
John W. Eaton <jwe@octave.org>
parents:
11635
diff
changeset
|
2981 m["markersize"] = 6; |
6705 | 2982 m["keylabel"] = ""; |
7213 | 2983 m["interpreter"] = radio_property (radio_values ("{tex}|none|latex")); |
6406 | 2984 |
6705 | 2985 return m; |
2986 } | |
6406 | 2987 |
6844 | 2988 std::string surface::properties::go_name ("surface"); |
6406 | 2989 |
2990 // --------------------------------------------------------------------- | |
2991 | |
2992 octave_value | |
7189 | 2993 base_graphics_object::get_default (const caseless_str& name) const |
6406 | 2994 { |
2995 graphics_handle parent = get_parent (); | |
2996 graphics_object parent_obj = gh_manager::get_object (parent); | |
2997 | |
2998 return parent_obj.get_default (type () + name); | |
2999 } | |
3000 | |
3001 octave_value | |
7189 | 3002 base_graphics_object::get_factory_default (const caseless_str& name) const |
6406 | 3003 { |
3004 graphics_object parent_obj = gh_manager::get_object (0); | |
3005 | |
3006 return parent_obj.get_factory_default (type () + name); | |
3007 } | |
3008 | |
7286 | 3009 // We use a random value for the handle to avoid issues with plots and |
3010 // scalar values for the first argument. | |
6406 | 3011 gh_manager::gh_manager (void) |
7286 | 3012 : handle_map (), handle_free_list (), |
3013 next_handle (-1.0 - (rand () + 1.0) / (RAND_MAX + 2.0)) | |
6406 | 3014 { |
3015 handle_map[0] = graphics_object (new root_figure ()); | |
3016 } | |
3017 | |
3018 graphics_handle | |
3019 gh_manager::do_make_graphics_handle (const std::string& go_name, | |
3020 const graphics_handle& p) | |
3021 { | |
3022 graphics_handle h = get_handle (go_name); | |
3023 | |
3024 base_graphics_object *go = 0; | |
3025 | |
3026 if (go_name == "figure") | |
3027 go = new figure (h, p); | |
3028 else if (go_name == "axes") | |
3029 go = new axes (h, p); | |
3030 else if (go_name == "line") | |
3031 go = new line (h, p); | |
3032 else if (go_name == "text") | |
3033 go = new text (h, p); | |
3034 else if (go_name == "image") | |
3035 go = new image (h, p); | |
6807 | 3036 else if (go_name == "patch") |
3037 go = new patch (h, p); | |
6406 | 3038 else if (go_name == "surface") |
3039 go = new surface (h, p); | |
3040 if (go) | |
3041 handle_map[h] = graphics_object (go); | |
3042 else | |
3043 error ("gh_manager::do_make_graphics_handle: invalid object type `%s'", | |
3044 go_name.c_str ()); | |
3045 | |
3046 return h; | |
3047 } | |
3048 | |
3049 graphics_handle | |
3050 gh_manager::do_make_figure_handle (double val) | |
3051 { | |
3052 graphics_handle h = val; | |
3053 | |
3054 handle_map[h] = graphics_object (new figure (h, 0)); | |
3055 | |
3056 return h; | |
3057 } | |
3058 | |
3059 void | |
3060 gh_manager::do_push_figure (const graphics_handle& h) | |
3061 { | |
3062 do_pop_figure (h); | |
3063 | |
3064 figure_list.push_front (h); | |
3065 } | |
3066 | |
3067 void | |
3068 gh_manager::do_pop_figure (const graphics_handle& h) | |
3069 { | |
3070 for (figure_list_iterator p = figure_list.begin (); | |
3071 p != figure_list.end (); | |
3072 p++) | |
3073 { | |
3074 if (*p == h) | |
3075 { | |
3076 figure_list.erase (p); | |
3077 break; | |
3078 } | |
3079 } | |
3080 } | |
3081 | |
3082 property_list::plist_map_type | |
3083 root_figure::init_factory_properties (void) | |
3084 { | |
3085 property_list::plist_map_type plist_map; | |
3086 | |
6844 | 3087 plist_map["figure"] = figure::properties::factory_defaults (); |
3088 plist_map["axes"] = axes::properties::factory_defaults (); | |
3089 plist_map["line"] = line::properties::factory_defaults (); | |
3090 plist_map["text"] = text::properties::factory_defaults (); | |
3091 plist_map["image"] = image::properties::factory_defaults (); | |
3092 plist_map["patch"] = patch::properties::factory_defaults (); | |
3093 plist_map["surface"] = surface::properties::factory_defaults (); | |
6406 | 3094 |
3095 return plist_map; | |
3096 } | |
3097 | |
3098 // --------------------------------------------------------------------- | |
3099 | |
3100 DEFUN (ishandle, args, , | |
3101 "-*- texinfo -*-\n\ | |
6678 | 3102 @deftypefn {Built-in Function} {} ishandle (@var{h})\n\ |
6406 | 3103 Return true if @var{h} is a graphics handle and false otherwise.\n\ |
3104 @end deftypefn") | |
3105 { | |
3106 octave_value retval; | |
3107 | |
3108 if (args.length () == 1) | |
3109 retval = is_handle (args(0)); | |
3110 else | |
3111 print_usage (); | |
3112 | |
3113 return retval; | |
3114 } | |
3115 | |
3116 DEFUN (set, args, , | |
3117 "-*- texinfo -*-\n\ | |
6678 | 3118 @deftypefn {Built-in Function} {} set (@var{h}, @var{p}, @var{v}, @dots{})\n\ |
6732 | 3119 Set the named property value or vector @var{p} to the value @var{v}\n\ |
6894 | 3120 for the graphics handle @var{h}.\n\ |
6406 | 3121 @end deftypefn") |
3122 { | |
3123 octave_value retval; | |
3124 | |
3125 int nargin = args.length (); | |
3126 | |
3127 if (nargin > 0) | |
3128 { | |
6732 | 3129 ColumnVector hcv (args(0).vector_value ()); |
6406 | 3130 |
3131 if (! error_state) | |
6732 | 3132 { |
6733 | 3133 bool request_drawnow = false; |
3134 | |
6732 | 3135 for (octave_idx_type n = 0; n < hcv.length (); n++) |
3136 { | |
3137 graphics_object obj = gh_manager::get_object (hcv(n)); | |
6406 | 3138 |
6732 | 3139 if (obj) |
3140 { | |
3141 obj.set (args.splice (0, 1)); | |
6406 | 3142 |
6733 | 3143 request_drawnow = true; |
6732 | 3144 } |
3145 else | |
6733 | 3146 { |
3147 error ("set: invalid handle (= %g)", hcv(n)); | |
3148 break; | |
3149 } | |
6732 | 3150 } |
6733 | 3151 |
3152 if (! error_state && request_drawnow) | |
3153 feval ("__request_drawnow__"); | |
6732 | 3154 } |
6406 | 3155 else |
6732 | 3156 error ("set: expecting graphics handle as first argument"); |
6406 | 3157 } |
3158 else | |
3159 print_usage (); | |
3160 | |
3161 return retval; | |
3162 } | |
3163 | |
3164 DEFUN (get, args, , | |
3165 "-*- texinfo -*-\n\ | |
6678 | 3166 @deftypefn {Built-in Function} {} get (@var{h}, @var{p})\n\ |
6406 | 3167 Return the named property @var{p} from the graphics handle @var{h}.\n\ |
3168 If @var{p} is omitted, return the complete property list for @var{h}.\n\ | |
6732 | 3169 If @var{h} is a vector, return a cell array including the property\n\ |
3170 values or lists respectively.\n\ | |
6406 | 3171 @end deftypefn") |
3172 { | |
3173 octave_value retval; | |
6732 | 3174 octave_value_list vlist; |
6406 | 3175 |
3176 int nargin = args.length (); | |
3177 | |
3178 if (nargin == 1 || nargin == 2) | |
3179 { | |
6732 | 3180 ColumnVector hcv (args(0).vector_value ()); |
6406 | 3181 |
3182 if (! error_state) | |
6732 | 3183 { |
6733 | 3184 octave_idx_type len = hcv.length (); |
3185 | |
3186 vlist.resize (len); | |
3187 | |
3188 for (octave_idx_type n = 0; n < len; n++) | |
6732 | 3189 { |
3190 graphics_object obj = gh_manager::get_object (hcv(n)); | |
6406 | 3191 |
6732 | 3192 if (obj) |
3193 { | |
3194 if (nargin == 1) | |
3195 vlist(n) = obj.get (); | |
3196 else | |
3197 { | |
7189 | 3198 caseless_str property = args(1).string_value (); |
6406 | 3199 |
6732 | 3200 if (! error_state) |
3201 vlist(n) = obj.get (property); | |
3202 else | |
6733 | 3203 { |
3204 error ("get: expecting property name as second argument"); | |
3205 break; | |
3206 } | |
6732 | 3207 } |
3208 } | |
3209 else | |
6733 | 3210 { |
3211 error ("get: invalid handle (= %g)", hcv(n)); | |
3212 break; | |
3213 } | |
6732 | 3214 } |
3215 } | |
6406 | 3216 else |
6732 | 3217 error ("get: expecting graphics handle as first argument"); |
6406 | 3218 } |
3219 else | |
3220 print_usage (); | |
3221 | |
6733 | 3222 if (! error_state) |
6732 | 3223 { |
6733 | 3224 octave_idx_type len = vlist.length (); |
3225 | |
3226 if (len > 1) | |
3227 retval = Cell (vlist); | |
3228 else if (len == 1) | |
3229 retval = vlist(0); | |
6732 | 3230 } |
3231 | |
6406 | 3232 return retval; |
3233 } | |
3234 | |
3235 static octave_value | |
3236 make_graphics_object (const std::string& go_name, | |
6874 | 3237 const octave_value_list& args) |
6406 | 3238 { |
3239 octave_value retval; | |
3240 | |
3241 double val = args(0).double_value (); | |
3242 | |
3243 if (! error_state) | |
3244 { | |
3245 graphics_handle parent = gh_manager::lookup (val); | |
3246 | |
7056 | 3247 if (parent.ok ()) |
6406 | 3248 { |
3249 graphics_handle h | |
3250 = gh_manager::make_graphics_handle (go_name, parent); | |
3251 | |
3252 if (! error_state) | |
3253 { | |
3254 adopt (parent, h); | |
3255 | |
3256 xset (h, args.splice (0, 1)); | |
3257 | |
6874 | 3258 retval = h.value (); |
7296 | 3259 |
3260 if (! error_state) | |
3261 feval ("__request_drawnow__"); | |
6406 | 3262 } |
3263 else | |
3264 error ("__go%s__: unable to create graphics handle", | |
3265 go_name.c_str ()); | |
3266 } | |
3267 else | |
3268 error ("__go_%s__: invalid parent", go_name.c_str ()); | |
3269 } | |
3270 else | |
3271 error ("__go_%s__: invalid parent", go_name.c_str ()); | |
3272 | |
3273 return retval; | |
3274 } | |
3275 | |
3276 DEFUN (__go_figure__, args, , | |
3277 "-*- texinfo -*-\n\ | |
3278 @deftypefn {Built-in Function} {} __go_figure__ (@var{fignum})\n\ | |
6945 | 3279 Undocumented internal function.\n\ |
6406 | 3280 @end deftypefn") |
3281 { | |
3282 octave_value retval; | |
3283 | |
3284 if (args.length () > 0) | |
3285 { | |
3286 double val = args(0).double_value (); | |
3287 | |
3288 if (! error_state) | |
3289 { | |
3290 if (is_figure (val)) | |
3291 { | |
3292 graphics_handle h = gh_manager::lookup (val); | |
3293 | |
3294 xset (h, args.splice (0, 1)); | |
3295 | |
6874 | 3296 retval = h.value (); |
6406 | 3297 } |
3298 else | |
3299 { | |
3300 graphics_handle h = octave_NaN; | |
3301 | |
3302 if (xisnan (val)) | |
3303 h = gh_manager::make_graphics_handle ("figure", 0); | |
3304 else if (val > 0 && D_NINT (val) == val) | |
3305 h = gh_manager::make_figure_handle (val); | |
3306 else | |
3307 error ("__go_figure__: invalid figure number"); | |
3308 | |
7056 | 3309 if (! error_state && h.ok ()) |
6406 | 3310 { |
3311 adopt (0, h); | |
3312 | |
3313 xset (h, args.splice (0, 1)); | |
3314 | |
6874 | 3315 retval = h.value (); |
6406 | 3316 } |
3317 else | |
3318 error ("__go_figure__: failed to create figure handle"); | |
3319 } | |
3320 } | |
3321 else | |
3322 error ("__go_figure__: expecting figure number to be double value"); | |
3323 } | |
3324 else | |
3325 print_usage (); | |
3326 | |
3327 return retval; | |
3328 } | |
3329 | |
3330 #define GO_BODY(TYPE) \ | |
3331 octave_value retval; \ | |
3332 \ | |
3333 if (args.length () > 0) \ | |
3334 retval = make_graphics_object (#TYPE, args); \ | |
3335 else \ | |
3336 print_usage (); \ | |
3337 \ | |
3338 return retval | |
3339 | |
3340 DEFUN (__go_axes__, args, , | |
3341 "-*- texinfo -*-\n\ | |
3342 @deftypefn {Built-in Function} {} __go_axes__ (@var{parent})\n\ | |
6945 | 3343 Undocumented internal function.\n\ |
6406 | 3344 @end deftypefn") |
3345 { | |
3346 GO_BODY (axes); | |
3347 } | |
3348 | |
3349 DEFUN (__go_line__, args, , | |
3350 "-*- texinfo -*-\n\ | |
3351 @deftypefn {Built-in Function} {} __go_line__ (@var{parent})\n\ | |
6945 | 3352 Undocumented internal function.\n\ |
6406 | 3353 @end deftypefn") |
3354 { | |
3355 GO_BODY (line); | |
3356 } | |
3357 | |
3358 DEFUN (__go_text__, args, , | |
3359 "-*- texinfo -*-\n\ | |
3360 @deftypefn {Built-in Function} {} __go_text__ (@var{parent})\n\ | |
6945 | 3361 Undocumented internal function.\n\ |
6406 | 3362 @end deftypefn") |
3363 { | |
3364 GO_BODY (text); | |
3365 } | |
3366 | |
3367 DEFUN (__go_image__, args, , | |
3368 "-*- texinfo -*-\n\ | |
3369 @deftypefn {Built-in Function} {} __go_image__ (@var{parent})\n\ | |
6945 | 3370 Undocumented internal function.\n\ |
6406 | 3371 @end deftypefn") |
3372 { | |
3373 GO_BODY (image); | |
3374 } | |
3375 | |
3376 DEFUN (__go_surface__, args, , | |
3377 "-*- texinfo -*-\n\ | |
3378 @deftypefn {Built-in Function} {} __go_surface__ (@var{parent})\n\ | |
6945 | 3379 Undocumented internal function.\n\ |
6406 | 3380 @end deftypefn") |
3381 { | |
3382 GO_BODY (surface); | |
3383 } | |
3384 | |
6807 | 3385 DEFUN (__go_patch__, args, , |
3386 "-*- texinfo -*-\n\ | |
3387 @deftypefn {Built-in Function} {} __go_patch__ (@var{parent})\n\ | |
6945 | 3388 Undocumented internal function.\n\ |
6807 | 3389 @end deftypefn") |
3390 { | |
3391 GO_BODY (patch); | |
3392 } | |
3393 | |
6406 | 3394 DEFUN (__go_delete__, args, , |
3395 "-*- texinfo -*-\n\ | |
3396 @deftypefn {Built-in Function} {} __go_delete__ (@var{h})\n\ | |
6945 | 3397 Undocumented internal function.\n\ |
6406 | 3398 @end deftypefn") |
3399 { | |
3400 octave_value_list retval; | |
3401 | |
3402 if (args.length () == 1) | |
3403 { | |
3404 graphics_handle h = octave_NaN; | |
3405 | |
3406 double val = args(0).double_value (); | |
3407 | |
3408 if (! error_state) | |
3409 { | |
3410 h = gh_manager::lookup (val); | |
3411 | |
7056 | 3412 if (h.ok ()) |
6406 | 3413 { |
3414 graphics_object obj = gh_manager::get_object (h); | |
3415 | |
3416 graphics_handle parent_h = obj.get_parent (); | |
3417 | |
3418 graphics_object parent_obj = gh_manager::get_object (parent_h); | |
3419 | |
3420 parent_obj.remove_child (h); | |
3421 | |
3422 gh_manager::free (h); | |
3423 } | |
3424 else | |
3425 error ("delete: invalid graphics object (= %g)", val); | |
3426 } | |
3427 else | |
3428 error ("delete: invalid graphics object"); | |
3429 } | |
3430 else | |
3431 print_usage (); | |
3432 | |
3433 return retval; | |
3434 } | |
3435 | |
3436 DEFUN (__go_axes_init__, args, , | |
3437 "-*- texinfo -*-\n\ | |
3438 @deftypefn {Built-in Function} {} __go_axes_init__ (@var{h}, @var{mode})\n\ | |
6945 | 3439 Undocumented internal function.\n\ |
6406 | 3440 @end deftypefn") |
3441 { | |
3442 octave_value retval; | |
3443 | |
3444 int nargin = args.length (); | |
3445 | |
3446 std::string mode = ""; | |
3447 | |
3448 if (nargin == 2) | |
3449 { | |
3450 mode = args(1).string_value (); | |
3451 | |
3452 if (error_state) | |
3453 return retval; | |
3454 } | |
3455 | |
3456 if (nargin == 1 || nargin == 2) | |
3457 { | |
3458 graphics_handle h = octave_NaN; | |
3459 | |
3460 double val = args(0).double_value (); | |
3461 | |
3462 if (! error_state) | |
3463 { | |
3464 h = gh_manager::lookup (val); | |
3465 | |
7056 | 3466 if (h.ok ()) |
6406 | 3467 { |
3468 graphics_object obj = gh_manager::get_object (h); | |
3469 | |
3470 obj.set_defaults (mode); | |
3471 } | |
3472 else | |
3473 error ("__go_axes_init__: invalid graphics object (= %g)", val); | |
3474 } | |
3475 else | |
3476 error ("__go_axes_init__: invalid graphics object"); | |
3477 } | |
3478 else | |
3479 print_usage (); | |
3480 | |
3481 return retval; | |
3482 } | |
3483 | |
3484 DEFUN (__go_handles__, , , | |
3485 "-*- texinfo -*-\n\ | |
3486 @deftypefn {Built-in Function} {} __go_handles__ ()\n\ | |
6945 | 3487 Undocumented internal function.\n\ |
6406 | 3488 @end deftypefn") |
3489 { | |
6425 | 3490 return octave_value (gh_manager::handle_list ()); |
3491 } | |
3492 | |
3493 DEFUN (__go_figure_handles__, , , | |
3494 "-*- texinfo -*-\n\ | |
3495 @deftypefn {Built-in Function} {} __go_figure_handles__ ()\n\ | |
6945 | 3496 Undocumented internal function.\n\ |
6425 | 3497 @end deftypefn") |
3498 { | |
3499 return octave_value (gh_manager::figure_handle_list ()); | |
6406 | 3500 } |
3501 | |
6595 | 3502 octave_value |
3503 get_property_from_handle (double handle, const std::string &property, | |
3504 const std::string &func) | |
3505 { | |
3506 graphics_object obj = gh_manager::get_object (handle); | |
3507 octave_value retval; | |
3508 | |
3509 if (obj) | |
3510 { | |
7189 | 3511 caseless_str p = std::string (property); |
6595 | 3512 retval = obj.get (p); |
3513 } | |
3514 else | |
3515 error ("%s: invalid handle (= %g)", func.c_str(), handle); | |
3516 | |
3517 return retval; | |
3518 } | |
3519 | |
3520 bool | |
3521 set_property_in_handle (double handle, const std::string &property, | |
3522 const octave_value &arg, const std::string &func) | |
3523 { | |
3524 graphics_object obj = gh_manager::get_object (handle); | |
3525 int ret = false; | |
3526 | |
3527 if (obj) | |
3528 { | |
7189 | 3529 caseless_str p = std::string (property); |
6595 | 3530 obj.set (p, arg); |
3531 if (!error_state) | |
3532 ret = true; | |
3533 } | |
3534 else | |
3535 error ("%s: invalid handle (= %g)", func.c_str(), handle); | |
3536 | |
3537 return ret; | |
3538 } | |
3539 | |
6406 | 3540 /* |
3541 ;;; Local Variables: *** | |
3542 ;;; mode: C++ *** | |
3543 ;;; End: *** | |
3544 */ |