00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #if !defined (graphics_h)
00026 #define graphics_h 1
00027
00028 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031
00032 #include <cctype>
00033
00034 #include <algorithm>
00035 #include <list>
00036 #include <map>
00037 #include <set>
00038 #include <string>
00039
00040 #include "lo-ieee.h"
00041
00042 #include "gripes.h"
00043 #include "oct-map.h"
00044 #include "oct-mutex.h"
00045 #include "ov.h"
00046
00047
00048
00049
00050 #if !defined (OCTAVE_DEFAULT_FONTNAME)
00051 #define OCTAVE_DEFAULT_FONTNAME "*"
00052 #endif
00053
00054 class caseless_str : public std::string
00055 {
00056 public:
00057 typedef std::string::iterator iterator;
00058 typedef std::string::const_iterator const_iterator;
00059
00060 caseless_str (void) : std::string () { }
00061 caseless_str (const std::string& s) : std::string (s) { }
00062 caseless_str (const char *s) : std::string (s) { }
00063
00064 caseless_str (const caseless_str& name) : std::string (name) { }
00065
00066 caseless_str& operator = (const caseless_str& pname)
00067 {
00068 std::string::operator = (pname);
00069 return *this;
00070 }
00071
00072 operator std::string (void) const { return *this; }
00073
00074
00075 bool compare (const std::string& s, size_t limit = std::string::npos) const
00076 {
00077 const_iterator p1 = begin ();
00078 const_iterator p2 = s.begin ();
00079
00080 size_t k = 0;
00081
00082 while (p1 != end () && p2 != s.end () && k++ < limit)
00083 {
00084 if (std::tolower (*p1) != std::tolower (*p2))
00085 return false;
00086
00087 *p1++;
00088 *p2++;
00089 }
00090
00091 return (limit == std::string::npos) ? size () == s.size () : k == limit;
00092 }
00093 };
00094
00095
00096
00097 class graphics_handle
00098 {
00099 public:
00100 graphics_handle (void) : val (octave_NaN) { }
00101
00102 graphics_handle (const octave_value& a);
00103
00104 graphics_handle (int a) : val (a) { }
00105
00106 graphics_handle (double a) : val (a) { }
00107
00108 graphics_handle (const graphics_handle& a) : val (a.val) { }
00109
00110 graphics_handle& operator = (const graphics_handle& a)
00111 {
00112 if (&a != this)
00113 val = a.val;
00114
00115 return *this;
00116 }
00117
00118 ~graphics_handle (void) { }
00119
00120 double value (void) const { return val; }
00121
00122 octave_value as_octave_value (void) const
00123 {
00124 return ok () ? octave_value (val) : octave_value (Matrix ());
00125 }
00126
00127 graphics_handle operator ++ (void)
00128 {
00129 ++val;
00130 return *this;
00131 }
00132
00133 graphics_handle operator ++ (int)
00134 {
00135 graphics_handle h = *this;
00136 ++val;
00137 return h;
00138 }
00139
00140 graphics_handle operator -- (void)
00141 {
00142 --val;
00143 return *this;
00144 }
00145
00146 graphics_handle operator -- (int)
00147 {
00148 graphics_handle h = *this;
00149 --val;
00150 return h;
00151 }
00152
00153 bool ok (void) const { return ! xisnan (val); }
00154
00155 private:
00156 double val;
00157 };
00158
00159 inline bool
00160 operator == (const graphics_handle& a, const graphics_handle& b)
00161 {
00162 return a.value () == b.value ();
00163 }
00164
00165 inline bool
00166 operator != (const graphics_handle& a, const graphics_handle& b)
00167 {
00168 return a.value () != b.value ();
00169 }
00170
00171 inline bool
00172 operator < (const graphics_handle& a, const graphics_handle& b)
00173 {
00174 return a.value () < b.value ();
00175 }
00176
00177 inline bool
00178 operator <= (const graphics_handle& a, const graphics_handle& b)
00179 {
00180 return a.value () <= b.value ();
00181 }
00182
00183 inline bool
00184 operator >= (const graphics_handle& a, const graphics_handle& b)
00185 {
00186 return a.value () >= b.value ();
00187 }
00188
00189 inline bool
00190 operator > (const graphics_handle& a, const graphics_handle& b)
00191 {
00192 return a.value () > b.value ();
00193 }
00194
00195
00196
00197 class base_scaler
00198 {
00199 public:
00200 base_scaler (void) { }
00201
00202 virtual ~base_scaler (void) { }
00203
00204 virtual Matrix scale (const Matrix& m) const
00205 {
00206 error ("invalid axis scale");
00207 return m;
00208 }
00209
00210 virtual NDArray scale (const NDArray& m) const
00211 {
00212 error ("invalid axis scale");
00213 return m;
00214 }
00215
00216 virtual double scale (double d) const
00217 {
00218 error ("invalid axis scale");
00219 return d;
00220 }
00221
00222 virtual double unscale (double d) const
00223 {
00224 error ("invalid axis scale");
00225 return d;
00226 }
00227
00228 virtual base_scaler* clone () const
00229 { return new base_scaler (); }
00230
00231 virtual bool is_linear (void) const
00232 { return false; }
00233 };
00234
00235 class lin_scaler : public base_scaler
00236 {
00237 public:
00238 lin_scaler (void) { }
00239
00240 Matrix scale (const Matrix& m) const { return m; }
00241
00242 NDArray scale (const NDArray& m) const { return m; }
00243
00244 double scale (double d) const { return d; }
00245
00246 double unscale (double d) const { return d; }
00247
00248 base_scaler* clone (void) const { return new lin_scaler (); }
00249
00250 bool is_linear (void) const { return true; }
00251 };
00252
00253 class log_scaler : public base_scaler
00254 {
00255 public:
00256 log_scaler (void) { }
00257
00258 Matrix scale (const Matrix& m) const
00259 {
00260 Matrix retval (m.rows (), m.cols ());
00261
00262 do_scale (m.data (), retval.fortran_vec (), m.numel ());
00263 return retval;
00264 }
00265
00266 NDArray scale (const NDArray& m) const
00267 {
00268 NDArray retval (m.dims ());
00269
00270 do_scale (m.data (), retval.fortran_vec (), m.numel ());
00271 return retval;
00272 }
00273
00274 double scale (double d) const
00275 { return log10 (d); }
00276
00277 double unscale (double d) const
00278 { return pow (10.0, d); }
00279
00280 base_scaler* clone (void) const
00281 { return new log_scaler (); }
00282
00283 private:
00284 void do_scale (const double *src, double *dest, int n) const
00285 {
00286 for (int i = 0; i < n; i++)
00287 dest[i] = log10(src[i]);
00288 }
00289 };
00290
00291 class scaler
00292 {
00293 public:
00294 scaler (void) : rep (new base_scaler ()) { }
00295
00296 scaler (const scaler& s) : rep (s.rep->clone()) { }
00297
00298 ~scaler (void) { delete rep; }
00299
00300 Matrix scale (const Matrix& m) const
00301 { return rep->scale (m); }
00302
00303 NDArray scale (const NDArray& m) const
00304 { return rep->scale (m); }
00305
00306 double scale (double d) const
00307 { return rep->scale (d); }
00308
00309 double unscale (double d) const
00310 { return rep->unscale (d); }
00311
00312 bool is_linear (void) const
00313 { return rep->is_linear (); }
00314
00315 scaler& operator = (const scaler& s)
00316 {
00317 if (rep)
00318 {
00319 delete rep;
00320 rep = 0;
00321 }
00322
00323 rep = s.rep->clone ();
00324
00325 return *this;
00326 }
00327
00328 scaler& operator = (const std::string& s)
00329 {
00330 if (rep)
00331 {
00332 delete rep;
00333 rep = 0;
00334 }
00335
00336 if (s == "log")
00337 rep = new log_scaler ();
00338 else if (s == "linear")
00339 rep = new lin_scaler ();
00340 else
00341 rep = new base_scaler ();
00342
00343 return *this;
00344 }
00345
00346 private:
00347 base_scaler *rep;
00348 };
00349
00350
00351
00352 class property;
00353
00354 enum listener_mode { POSTSET };
00355
00356 class base_property
00357 {
00358 public:
00359 friend class property;
00360
00361 public:
00362 base_property (void) : id (-1), count (1) { }
00363
00364 base_property (const std::string& s, const graphics_handle& h)
00365 : id (-1), count (1), name (s), parent (h), hidden (false) { }
00366
00367 base_property (const base_property& p)
00368 : id (-1), count (1), name (p.name), parent (p.parent), hidden (p.hidden) { }
00369
00370 virtual ~base_property (void) { }
00371
00372 bool ok (void) const { return parent.ok (); }
00373
00374 std::string get_name (void) const { return name; }
00375
00376 void set_name (const std::string& s) { name = s; }
00377
00378 graphics_handle get_parent (void) const { return parent; }
00379
00380 void set_parent (const graphics_handle &h) { parent = h; }
00381
00382 bool is_hidden (void) const { return hidden; }
00383
00384 void set_hidden (bool flag) { hidden = flag; }
00385
00386 int get_id (void) const { return id; }
00387
00388 void set_id (int d) { id = d; }
00389
00390
00391
00392 bool set (const octave_value& v, bool do_run = true);
00393
00394 virtual octave_value get (void) const
00395 {
00396 error ("get: invalid property \"%s\"", name.c_str ());
00397 return octave_value ();
00398 }
00399
00400 base_property& operator = (const octave_value& val)
00401 {
00402 set (val);
00403 return *this;
00404 }
00405
00406 void add_listener (const octave_value& v, listener_mode mode = POSTSET)
00407 {
00408 octave_value_list& l = listeners[mode];
00409 l.resize (l.length () + 1, v);
00410 }
00411
00412 void delete_listener (const octave_value& v = octave_value (),
00413 listener_mode mode = POSTSET)
00414 {
00415 octave_value_list& l = listeners[mode];
00416
00417 if (v.is_defined ())
00418 {
00419 bool found = false;
00420 int i;
00421
00422 for (i = 0; i < l.length (); i++)
00423 {
00424 if (v.internal_rep () == l(i).internal_rep ())
00425 {
00426 found = true;
00427 break;
00428 }
00429 }
00430 if (found)
00431 {
00432 for (int j = i; j < l.length() - 1; j++)
00433 l(j) = l (j + 1);
00434
00435 l.resize (l.length () - 1);
00436 }
00437 }
00438 else
00439 l.resize (0);
00440
00441 }
00442
00443 OCTINTERP_API void run_listeners (listener_mode mode = POSTSET);
00444
00445 virtual base_property* clone (void) const
00446 { return new base_property (*this); }
00447
00448 protected:
00449 virtual bool do_set (const octave_value&)
00450 {
00451 error ("set: invalid property \"%s\"", name.c_str ());
00452 return false;
00453 }
00454
00455 private:
00456 typedef std::map<listener_mode, octave_value_list> listener_map;
00457 typedef std::map<listener_mode, octave_value_list>::iterator listener_map_iterator;
00458 typedef std::map<listener_mode, octave_value_list>::const_iterator listener_map_const_iterator;
00459
00460 private:
00461 int id;
00462 int count;
00463 std::string name;
00464 graphics_handle parent;
00465 bool hidden;
00466 listener_map listeners;
00467 };
00468
00469
00470
00471 class string_property : public base_property
00472 {
00473 public:
00474 string_property (const std::string& s, const graphics_handle& h,
00475 const std::string& val = "")
00476 : base_property (s, h), str (val) { }
00477
00478 string_property (const string_property& p)
00479 : base_property (p), str (p.str) { }
00480
00481 octave_value get (void) const
00482 { return octave_value (str); }
00483
00484 std::string string_value (void) const { return str; }
00485
00486 string_property& operator = (const octave_value& val)
00487 {
00488 set (val);
00489 return *this;
00490 }
00491
00492 base_property* clone (void) const { return new string_property (*this); }
00493
00494 protected:
00495 bool do_set (const octave_value& val)
00496 {
00497 if (val.is_string ())
00498 {
00499 std::string new_str = val.string_value ();
00500
00501 if (new_str != str)
00502 {
00503 str = new_str;
00504 return true;
00505 }
00506 }
00507 else
00508 error ("set: invalid string property value for \"%s\"",
00509 get_name ().c_str ());
00510 return false;
00511 }
00512
00513 private:
00514 std::string str;
00515 };
00516
00517
00518
00519 class radio_values
00520 {
00521 public:
00522 OCTINTERP_API radio_values (const std::string& opt_string = std::string ());
00523
00524 radio_values (const radio_values& a)
00525 : default_val (a.default_val), possible_vals (a.possible_vals) { }
00526
00527 radio_values& operator = (const radio_values& a)
00528 {
00529 if (&a != this)
00530 {
00531 default_val = a.default_val;
00532 possible_vals = a.possible_vals;
00533 }
00534
00535 return *this;
00536 }
00537
00538 std::string default_value (void) const { return default_val; }
00539
00540 bool validate (const std::string& val)
00541 {
00542 bool retval = true;
00543
00544 if (! contains (val))
00545 {
00546 error ("invalid value = %s", val.c_str ());
00547 retval = false;
00548 }
00549
00550 return retval;
00551 }
00552
00553 bool contains (const std::string& val)
00554 {
00555 return (possible_vals.find (val) != possible_vals.end ());
00556 }
00557
00558 private:
00559
00560 std::string default_val;
00561 std::set<caseless_str> possible_vals;
00562 };
00563
00564 class radio_property : public base_property
00565 {
00566 public:
00567 radio_property (const std::string& nm, const graphics_handle& h,
00568 const radio_values& v = radio_values ())
00569 : base_property (nm, h),
00570 vals (v), current_val (v.default_value ()) { }
00571
00572 radio_property (const std::string& nm, const graphics_handle& h,
00573 const std::string& v)
00574 : base_property (nm, h),
00575 vals (v), current_val (vals.default_value ()) { }
00576
00577 radio_property (const std::string& nm, const graphics_handle& h,
00578 const radio_values& v, const std::string& def)
00579 : base_property (nm, h),
00580 vals (v), current_val (def) { }
00581
00582 radio_property (const radio_property& p)
00583 : base_property (p), vals (p.vals), current_val (p.current_val) { }
00584
00585 octave_value get (void) const { return octave_value (current_val); }
00586
00587 const std::string& current_value (void) const { return current_val; }
00588
00589 bool is (const caseless_str& v) const
00590 { return v.compare (current_val); }
00591
00592 radio_property& operator = (const octave_value& val)
00593 {
00594 set (val);
00595 return *this;
00596 }
00597
00598 base_property* clone (void) const { return new radio_property (*this); }
00599
00600 protected:
00601 bool do_set (const octave_value& newval)
00602 {
00603 if (newval.is_string ())
00604 {
00605 std::string s = newval.string_value ();
00606 if (vals.validate (s))
00607 {
00608 if (s != current_val)
00609 {
00610 current_val = s;
00611 return true;
00612 }
00613 }
00614 else
00615 error ("set: invalid value for radio property \"%s\" (value = %s)",
00616 get_name ().c_str (), s.c_str ());
00617 }
00618 else
00619 error ("set: invalid value for radio property \"%s\"",
00620 get_name ().c_str ());
00621 return false;
00622 }
00623
00624 private:
00625 radio_values vals;
00626 std::string current_val;
00627 };
00628
00629
00630
00631 class color_values
00632 {
00633 public:
00634 color_values (double r = 0, double g = 0, double b = 1)
00635 : xrgb (1, 3)
00636 {
00637 xrgb(0) = r;
00638 xrgb(1) = g;
00639 xrgb(2) = b;
00640
00641 validate ();
00642 }
00643
00644 color_values (std::string str)
00645 : xrgb (1, 3)
00646 {
00647 if (! str2rgb (str))
00648 error ("invalid color specification: %s", str.c_str ());
00649 }
00650
00651 color_values (const color_values& c)
00652 : xrgb (c.xrgb)
00653 { }
00654
00655 color_values& operator = (const color_values& c)
00656 {
00657 if (&c != this)
00658 xrgb = c.xrgb;
00659
00660 return *this;
00661 }
00662
00663 bool operator == (const color_values& c) const
00664 {
00665 return (xrgb(0) == c.xrgb(0)
00666 && xrgb(1) == c.xrgb(1)
00667 && xrgb(2) == c.xrgb(2));
00668 }
00669
00670 bool operator != (const color_values& c) const
00671 { return ! (*this == c); }
00672
00673 Matrix rgb (void) const { return xrgb; }
00674
00675 operator octave_value (void) const { return xrgb; }
00676
00677 void validate (void) const
00678 {
00679 for (int i = 0; i < 3; i++)
00680 {
00681 if (xrgb(i) < 0 || xrgb(i) > 1)
00682 {
00683 error ("invalid RGB color specification");
00684 break;
00685 }
00686 }
00687 }
00688
00689 private:
00690 Matrix xrgb;
00691
00692 OCTINTERP_API bool str2rgb (std::string str);
00693 };
00694
00695 class color_property : public base_property
00696 {
00697 public:
00698 color_property (const color_values& c, const radio_values& v)
00699 : base_property ("", graphics_handle ()),
00700 current_type (color_t), color_val (c), radio_val (v),
00701 current_val (v.default_value ())
00702 { }
00703
00704 color_property (const std::string& nm, const graphics_handle& h,
00705 const color_values& c = color_values (),
00706 const radio_values& v = radio_values ())
00707 : base_property (nm, h),
00708 current_type (color_t), color_val (c), radio_val (v),
00709 current_val (v.default_value ())
00710 { }
00711
00712 color_property (const std::string& nm, const graphics_handle& h,
00713 const radio_values& v)
00714 : base_property (nm, h),
00715 current_type (radio_t), color_val (color_values ()), radio_val (v),
00716 current_val (v.default_value ())
00717 { }
00718
00719 color_property (const std::string& nm, const graphics_handle& h,
00720 const std::string& v)
00721 : base_property (nm, h),
00722 current_type (radio_t), color_val (color_values ()), radio_val (v),
00723 current_val (radio_val.default_value ())
00724 { }
00725
00726 color_property (const std::string& nm, const graphics_handle& h,
00727 const color_property& v)
00728 : base_property (nm, h),
00729 current_type (v.current_type), color_val (v.color_val),
00730 radio_val (v.radio_val), current_val (v.current_val)
00731 { }
00732
00733 color_property (const color_property& p)
00734 : base_property (p), current_type (p.current_type),
00735 color_val (p.color_val), radio_val (p.radio_val),
00736 current_val (p.current_val) { }
00737
00738 octave_value get (void) const
00739 {
00740 if (current_type == color_t)
00741 return color_val.rgb ();
00742
00743 return current_val;
00744 }
00745
00746 bool is_rgb (void) const { return (current_type == color_t); }
00747
00748 bool is_radio (void) const { return (current_type == radio_t); }
00749
00750 bool is (const std::string& v) const
00751 { return (is_radio () && current_val == v); }
00752
00753 Matrix rgb (void) const
00754 {
00755 if (current_type != color_t)
00756 error ("color has no rgb value");
00757
00758 return color_val.rgb ();
00759 }
00760
00761 const std::string& current_value (void) const
00762 {
00763 if (current_type != radio_t)
00764 error ("color has no radio value");
00765
00766 return current_val;
00767 }
00768
00769 color_property& operator = (const octave_value& val)
00770 {
00771 set (val);
00772 return *this;
00773 }
00774
00775 operator octave_value (void) const { return get (); }
00776
00777 base_property* clone (void) const { return new color_property (*this); }
00778
00779 protected:
00780 OCTINTERP_API bool do_set (const octave_value& newval);
00781
00782 private:
00783 enum current_enum { color_t, radio_t } current_type;
00784 color_values color_val;
00785 radio_values radio_val;
00786 std::string current_val;
00787 };
00788
00789
00790
00791 class double_property : public base_property
00792 {
00793 public:
00794 double_property (const std::string& nm, const graphics_handle& h,
00795 double d = 0)
00796 : base_property (nm, h),
00797 current_val (d) { }
00798
00799 double_property (const double_property& p)
00800 : base_property (p), current_val (p.current_val) { }
00801
00802 octave_value get (void) const { return octave_value (current_val); }
00803
00804 double double_value (void) const { return current_val; }
00805
00806 double_property& operator = (const octave_value& val)
00807 {
00808 set (val);
00809 return *this;
00810 }
00811
00812 base_property* clone (void) const { return new double_property (*this); }
00813
00814 protected:
00815 bool do_set (const octave_value& v)
00816 {
00817 if (v.is_scalar_type () && v.is_real_type ())
00818 {
00819 double new_val = v.double_value ();
00820
00821 if (new_val != current_val)
00822 {
00823 current_val = new_val;
00824 return true;
00825 }
00826 }
00827 else
00828 error ("set: invalid value for double property \"%s\"",
00829 get_name ().c_str ());
00830 return false;
00831 }
00832
00833 private:
00834 double current_val;
00835 };
00836
00837
00838
00839 class double_radio_property : public base_property
00840 {
00841 public:
00842 double_radio_property (double d, const radio_values& v)
00843 : base_property ("", graphics_handle ()),
00844 current_type (double_t), dval (d), radio_val (v),
00845 current_val (v.default_value ())
00846 { }
00847
00848 double_radio_property (const std::string& nm, const graphics_handle& h,
00849 const std::string& v)
00850 : base_property (nm, h),
00851 current_type (radio_t), dval (0), radio_val (v),
00852 current_val (radio_val.default_value ())
00853 { }
00854
00855 double_radio_property (const std::string& nm, const graphics_handle& h,
00856 const double_radio_property& v)
00857 : base_property (nm, h),
00858 current_type (v.current_type), dval (v.dval),
00859 radio_val (v.radio_val), current_val (v.current_val)
00860 { }
00861
00862 double_radio_property (const double_radio_property& p)
00863 : base_property (p), current_type (p.current_type),
00864 dval (p.dval), radio_val (p.radio_val),
00865 current_val (p.current_val) { }
00866
00867 octave_value get (void) const
00868 {
00869 if (current_type == double_t)
00870 return dval;
00871
00872 return current_val;
00873 }
00874
00875 bool is_double (void) const { return (current_type == double_t); }
00876
00877 bool is_radio (void) const { return (current_type == radio_t); }
00878
00879 bool is (const std::string& v) const
00880 { return (is_radio () && current_val == v); }
00881
00882 double double_value (void) const
00883 {
00884 if (current_type != double_t)
00885 error ("%s: property has no double", get_name ().c_str ());
00886
00887 return dval;
00888 }
00889
00890 const std::string& current_value (void) const
00891 {
00892 if (current_type != radio_t)
00893 error ("%s: property has no radio value");
00894
00895 return current_val;
00896 }
00897
00898 double_radio_property& operator = (const octave_value& val)
00899 {
00900 set (val);
00901 return *this;
00902 }
00903
00904 operator octave_value (void) const { return get (); }
00905
00906 base_property* clone (void) const
00907 { return new double_radio_property (*this); }
00908
00909 protected:
00910 OCTINTERP_API bool do_set (const octave_value& v);
00911
00912 private:
00913 enum current_enum { double_t, radio_t } current_type;
00914 double dval;
00915 radio_values radio_val;
00916 std::string current_val;
00917 };
00918
00919
00920
00921 class array_property : public base_property
00922 {
00923 public:
00924 array_property (void)
00925 : base_property ("", graphics_handle ()), data (Matrix ())
00926 {
00927 get_data_limits ();
00928 }
00929
00930 array_property (const std::string& nm, const graphics_handle& h,
00931 const octave_value& m)
00932 : base_property (nm, h), data (m)
00933 {
00934 get_data_limits ();
00935 }
00936
00937
00938
00939
00940 array_property (const array_property& p)
00941 : base_property (p), data (p.data),
00942 xmin (p.xmin), xmax (p.xmax), xminp (p.xminp) { }
00943
00944 octave_value get (void) const { return data; }
00945
00946 void add_constraint (const std::string& type)
00947 { type_constraints.push_back (type); }
00948
00949 void add_constraint (const dim_vector& dims)
00950 { size_constraints.push_back (dims); }
00951
00952 double min_val (void) const { return xmin; }
00953 double max_val (void) const { return xmax; }
00954 double min_pos (void) const { return xminp; }
00955
00956 Matrix get_limits (void) const
00957 {
00958 Matrix m (1, 3);
00959
00960 m(0) = min_val ();
00961 m(1) = max_val ();
00962 m(2) = min_pos ();
00963
00964 return m;
00965 }
00966
00967 array_property& operator = (const octave_value& val)
00968 {
00969 set (val);
00970 return *this;
00971 }
00972
00973 base_property* clone (void) const
00974 {
00975 array_property *p = new array_property (*this);
00976
00977 p->type_constraints = type_constraints;
00978 p->size_constraints = size_constraints;
00979
00980 return p;
00981 }
00982
00983 protected:
00984 bool do_set (const octave_value& v)
00985 {
00986 if (validate (v))
00987 {
00988
00989 if (! is_equal (v))
00990 {
00991 data = v;
00992
00993 get_data_limits ();
00994
00995 return true;
00996 }
00997 }
00998 else
00999 error ("invalid value for array property \"%s\"",
01000 get_name ().c_str ());
01001
01002 return false;
01003 }
01004
01005 private:
01006 OCTINTERP_API bool validate (const octave_value& v);
01007
01008 OCTINTERP_API bool is_equal (const octave_value& v) const;
01009
01010 OCTINTERP_API void get_data_limits (void);
01011
01012 protected:
01013 octave_value data;
01014 double xmin;
01015 double xmax;
01016 double xminp;
01017 std::list<std::string> type_constraints;
01018 std::list<dim_vector> size_constraints;
01019 };
01020
01021 class row_vector_property : public array_property
01022 {
01023 public:
01024 row_vector_property (const std::string& nm, const graphics_handle& h,
01025 const octave_value& m)
01026 : array_property (nm, h, m)
01027 {
01028 add_constraint (dim_vector (-1, 1));
01029 add_constraint (dim_vector (1, -1));
01030 }
01031
01032 row_vector_property (const row_vector_property& p)
01033 : array_property (p)
01034 {
01035 add_constraint (dim_vector (-1, 1));
01036 add_constraint (dim_vector (1, -1));
01037 }
01038
01039 void add_constraint (const std::string& type)
01040 {
01041 array_property::add_constraint (type);
01042 }
01043
01044 void add_constraint (const dim_vector& dims)
01045 {
01046 array_property::add_constraint (dims);
01047 }
01048
01049 void add_constraint (octave_idx_type len)
01050 {
01051 size_constraints.remove (dim_vector (1, -1));
01052 size_constraints.remove (dim_vector (-1, 1));
01053
01054 add_constraint (dim_vector (1, len));
01055 add_constraint (dim_vector (len, 1));
01056 }
01057
01058 row_vector_property& operator = (const octave_value& val)
01059 {
01060 set (val);
01061 return *this;
01062 }
01063
01064 base_property* clone (void) const
01065 {
01066 row_vector_property *p = new row_vector_property (*this);
01067
01068 p->type_constraints = type_constraints;
01069 p->size_constraints = size_constraints;
01070
01071 return p;
01072 }
01073
01074 protected:
01075 bool do_set (const octave_value& v)
01076 {
01077 bool retval = array_property::do_set (v);
01078
01079 if (! error_state)
01080 {
01081 dim_vector dv = data.dims ();
01082
01083 if (dv(0) > 1 && dv(1) == 1)
01084 {
01085 int tmp = dv(0);
01086 dv(0) = dv(1);
01087 dv(1) = tmp;
01088
01089 data = data.reshape (dv);
01090 }
01091
01092 return retval;
01093 }
01094
01095 return false;
01096 }
01097
01098 private:
01099 OCTINTERP_API bool validate (const octave_value& v);
01100 };
01101
01102
01103
01104 class bool_property : public radio_property
01105 {
01106 public:
01107 bool_property (const std::string& nm, const graphics_handle& h,
01108 bool val)
01109 : radio_property (nm, h, radio_values (val ? "{on}|off" : "on|{off}"))
01110 { }
01111
01112 bool_property (const std::string& nm, const graphics_handle& h,
01113 const char* val)
01114 : radio_property (nm, h, radio_values ("on|off"), val)
01115 { }
01116
01117 bool_property (const bool_property& p)
01118 : radio_property (p) { }
01119
01120 bool is_on (void) const { return is ("on"); }
01121
01122 bool_property& operator = (const octave_value& val)
01123 {
01124 set (val);
01125 return *this;
01126 }
01127
01128 base_property* clone (void) const { return new bool_property (*this); }
01129
01130 protected:
01131 bool do_set (const octave_value& val)
01132 {
01133 if (val.is_bool_scalar ())
01134 return radio_property::do_set (val.bool_value () ? "on" : "off");
01135 else
01136 return radio_property::do_set (val);
01137 }
01138 };
01139
01140
01141
01142 class handle_property : public base_property
01143 {
01144 public:
01145 handle_property (const std::string& nm, const graphics_handle& h,
01146 const graphics_handle& val = graphics_handle ())
01147 : base_property (nm, h),
01148 current_val (val) { }
01149
01150 handle_property (const handle_property& p)
01151 : base_property (p), current_val (p.current_val) { }
01152
01153 octave_value get (void) const { return current_val.as_octave_value (); }
01154
01155 graphics_handle handle_value (void) const { return current_val; }
01156
01157 handle_property& operator = (const octave_value& val)
01158 {
01159 set (val);
01160 return *this;
01161 }
01162
01163 handle_property& operator = (const graphics_handle& h)
01164 {
01165 set (octave_value (h.value ()));
01166 return *this;
01167 }
01168
01169 base_property* clone (void) const { return new handle_property (*this); }
01170
01171 protected:
01172 OCTINTERP_API bool do_set (const octave_value& v);
01173
01174 private:
01175 graphics_handle current_val;
01176 };
01177
01178
01179
01180 class any_property : public base_property
01181 {
01182 public:
01183 any_property (const std::string& nm, const graphics_handle& h,
01184 const octave_value& m = Matrix ())
01185 : base_property (nm, h), data (m) { }
01186
01187 any_property (const any_property& p)
01188 : base_property (p), data (p.data) { }
01189
01190 octave_value get (void) const { return data; }
01191
01192 any_property& operator = (const octave_value& val)
01193 {
01194 set (val);
01195 return *this;
01196 }
01197
01198 base_property* clone (void) const { return new any_property (*this); }
01199
01200 protected:
01201 bool do_set (const octave_value& v)
01202 {
01203 data = v;
01204 return true;
01205 }
01206
01207 private:
01208 octave_value data;
01209 };
01210
01211
01212
01213 class callback_property : public base_property
01214 {
01215 public:
01216 callback_property (const std::string& nm, const graphics_handle& h,
01217 const octave_value& m)
01218 : base_property (nm, h), callback (m) { }
01219
01220 callback_property (const callback_property& p)
01221 : base_property (p), callback (p.callback) { }
01222
01223 octave_value get (void) const { return callback; }
01224
01225 OCTINTERP_API void execute (const octave_value& data = octave_value ()) const;
01226
01227 callback_property& operator = (const octave_value& val)
01228 {
01229 set (val);
01230 return *this;
01231 }
01232
01233 base_property* clone (void) const { return new callback_property (*this); }
01234
01235 protected:
01236 bool do_set (const octave_value& v)
01237 {
01238 if (validate (v))
01239 {
01240 callback = v;
01241 return true;
01242 }
01243 else
01244 error ("invalid value for callback property \"%s\"",
01245 get_name ().c_str ());
01246 return false;
01247 }
01248
01249 private:
01250 OCTINTERP_API bool validate (const octave_value& v) const;
01251
01252 private:
01253 octave_value callback;
01254 };
01255
01256
01257
01258 class property
01259 {
01260 public:
01261 property (void) : rep (new base_property ("", graphics_handle ()))
01262 { }
01263
01264 property (base_property *bp, bool persist = false) : rep (bp)
01265 { if (persist) rep->count++; }
01266
01267 property (const property& p)
01268 {
01269 rep = p.rep;
01270 rep->count++;
01271 }
01272
01273 ~property (void)
01274 {
01275 if (--rep->count <= 0)
01276 delete rep;
01277 }
01278
01279 bool ok (void) const
01280 { return rep->ok (); }
01281
01282 std::string get_name (void) const
01283 { return rep->get_name (); }
01284
01285 void set_name (const std::string& name)
01286 { rep->set_name (name); }
01287
01288 graphics_handle get_parent (void) const
01289 { return rep->get_parent (); }
01290
01291 void set_parent (const graphics_handle& h)
01292 { rep->set_parent (h); }
01293
01294 bool is_hidden (void) const
01295 { return rep->is_hidden (); }
01296
01297 void set_hidden (bool flag)
01298 { rep->set_hidden (flag); }
01299
01300 int get_id (void) const
01301 { return rep->get_id (); }
01302
01303 void set_id (int d)
01304 { rep->set_id (d); }
01305
01306 octave_value get (void) const
01307 { return rep->get (); }
01308
01309 bool set (const octave_value& val)
01310 { return rep->set (val); }
01311
01312 property& operator = (const octave_value& val)
01313 {
01314 *rep = val;
01315 return *this;
01316 }
01317
01318 property& operator = (const property& p)
01319 {
01320 if (rep && --rep->count <= 0)
01321 delete rep;
01322
01323 rep = p.rep;
01324 rep->count++;
01325
01326 return *this;
01327 }
01328
01329 void add_listener (const octave_value& v, listener_mode mode = POSTSET)
01330 { rep->add_listener (v, mode); }
01331
01332 void delete_listener (const octave_value& v = octave_value (),
01333 listener_mode mode = POSTSET)
01334 { rep->delete_listener (v, mode); }
01335
01336 void run_listeners (listener_mode mode = POSTSET)
01337 { rep->run_listeners (mode); }
01338
01339 OCTINTERP_API static
01340 property create (const std::string& name, const graphics_handle& parent,
01341 const caseless_str& type,
01342 const octave_value_list& args);
01343
01344 property clone (void) const
01345 { return property (rep->clone ()); }
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366
01367 private:
01368 base_property *rep;
01369 };
01370
01371
01372
01373 class property_list
01374 {
01375 public:
01376 typedef std::map<std::string, octave_value> pval_map_type;
01377 typedef std::map<std::string, pval_map_type> plist_map_type;
01378
01379 typedef pval_map_type::iterator pval_map_iterator;
01380 typedef pval_map_type::const_iterator pval_map_const_iterator;
01381
01382 typedef plist_map_type::iterator plist_map_iterator;
01383 typedef plist_map_type::const_iterator plist_map_const_iterator;
01384
01385 property_list (const plist_map_type& m = plist_map_type ())
01386 : plist_map (m) { }
01387
01388 ~property_list (void) { }
01389
01390 void set (const caseless_str& name, const octave_value& val);
01391
01392 octave_value lookup (const caseless_str& name) const;
01393
01394 plist_map_iterator begin (void) { return plist_map.begin (); }
01395 plist_map_const_iterator begin (void) const { return plist_map.begin (); }
01396
01397 plist_map_iterator end (void) { return plist_map.end (); }
01398 plist_map_const_iterator end (void) const { return plist_map.end (); }
01399
01400 plist_map_iterator find (const std::string& go_name)
01401 {
01402 return plist_map.find (go_name);
01403 }
01404
01405 plist_map_const_iterator find (const std::string& go_name) const
01406 {
01407 return plist_map.find (go_name);
01408 }
01409
01410 Octave_map as_struct (const std::string& prefix_arg) const;
01411
01412 private:
01413 plist_map_type plist_map;
01414 };
01415
01416
01417
01418 class graphics_backend;
01419 class graphics_object;
01420
01421 class base_graphics_backend
01422 {
01423 public:
01424 friend class graphics_backend;
01425
01426 public:
01427 base_graphics_backend (const std::string& nm)
01428 : name (nm), count (0) { }
01429
01430 virtual ~base_graphics_backend (void) { }
01431
01432 std::string get_name (void) const { return name; }
01433
01434 virtual bool is_valid (void) const { return false; }
01435
01436 virtual void redraw_figure (const graphics_object&) const
01437 { gripe_invalid ("redraw_figure"); }
01438
01439 virtual void print_figure (const graphics_object&, const std::string&,
01440 const std::string&, bool,
01441 const std::string& = "") const
01442 { gripe_invalid ("print_figure"); }
01443
01444 virtual Matrix get_canvas_size (const graphics_handle&) const
01445 {
01446 gripe_invalid ("get_canvas_size");
01447 return Matrix (1, 2, 0.0);
01448 }
01449
01450 virtual double get_screen_resolution (void) const
01451 {
01452 gripe_invalid ("get_screen_resolution");
01453 return 72.0;
01454 }
01455
01456 virtual Matrix get_screen_size (void) const
01457 {
01458 gripe_invalid ("get_screen_size");
01459 return Matrix (1, 2, 0.0);
01460 }
01461
01462
01463 virtual void property_changed (const graphics_object&, int)
01464 { gripe_invalid ("property_changed"); }
01465
01466 void property_changed (const graphics_handle&, int);
01467
01468
01469 virtual void object_created (const graphics_object&)
01470 { gripe_invalid ("object_created"); }
01471
01472 void object_created (const graphics_handle&);
01473
01474
01475 virtual void object_destroyed (const graphics_object&)
01476 { gripe_invalid ("object_destroyed"); }
01477
01478 void object_destroyed (const graphics_handle&);
01479
01480 private:
01481 std::string name;
01482 int count;
01483
01484 private:
01485 void gripe_invalid (const std::string& fname) const
01486 {
01487 if (! is_valid ())
01488 error ("%s: invalid graphics backend", fname.c_str ());
01489 }
01490 };
01491
01492 class graphics_backend
01493 {
01494 public:
01495 graphics_backend (void)
01496 : rep (new base_graphics_backend ("unknown"))
01497 {
01498 rep->count++;
01499 }
01500
01501 graphics_backend (base_graphics_backend* b)
01502 : rep (b)
01503 {
01504 rep->count++;
01505 }
01506
01507 graphics_backend (const graphics_backend& b)
01508 : rep (b.rep)
01509 {
01510 rep->count++;
01511 }
01512
01513 ~graphics_backend (void)
01514 {
01515 if (--rep->count == 0)
01516 delete rep;
01517 }
01518
01519 graphics_backend& operator = (const graphics_backend& b)
01520 {
01521 if (rep != b.rep)
01522 {
01523 if (--rep->count == 0)
01524 delete rep;
01525
01526 rep = b.rep;
01527 rep->count++;
01528 }
01529
01530 return *this;
01531 }
01532
01533 operator bool (void) const { return rep->is_valid (); }
01534
01535 std::string get_name (void) const { return rep->get_name (); }
01536
01537 void redraw_figure (const graphics_object& go) const
01538 { rep->redraw_figure (go); }
01539
01540 void print_figure (const graphics_object& go, const std::string& term,
01541 const std::string& file, bool mono,
01542 const std::string& debug_file = "") const
01543 { rep->print_figure (go, term, file, mono, debug_file); }
01544
01545 Matrix get_canvas_size (const graphics_handle& fh) const
01546 { return rep->get_canvas_size (fh); }
01547
01548 double get_screen_resolution (void) const
01549 { return rep->get_screen_resolution (); }
01550
01551 Matrix get_screen_size (void) const
01552 { return rep->get_screen_size (); }
01553
01554
01555 void property_changed (const graphics_object& go, int id)
01556 { rep->property_changed (go, id); }
01557
01558 void property_changed (const graphics_handle& h, int id)
01559 { rep->property_changed (h, id); }
01560
01561
01562 void object_created (const graphics_object& go)
01563 { rep->object_created (go); }
01564
01565 void object_created (const graphics_handle& h)
01566 { rep->object_created (h); }
01567
01568
01569
01570
01571 void object_destroyed (const graphics_object& go)
01572 { rep->object_destroyed (go); }
01573
01574 void object_destroyed (const graphics_handle& h)
01575 { rep->object_destroyed (h); }
01576
01577 OCTINTERP_API static graphics_backend default_backend (void);
01578
01579 static void register_backend (const graphics_backend& b)
01580 { available_backends[b.get_name ()] = b; }
01581
01582 static void unregister_backend (const std::string& name)
01583 { available_backends.erase (name); }
01584
01585 static graphics_backend find_backend (const std::string& name)
01586 {
01587 const_available_backends_iterator p = available_backends.find (name);
01588
01589 if (p != available_backends.end ())
01590 return p->second;
01591 else
01592 return default_backend ();
01593 }
01594
01595 static Cell available_backends_list (void)
01596 {
01597 Cell m (1 , available_backends.size ());
01598 const_available_backends_iterator p;
01599 int i;
01600
01601 for (i = 0,p = available_backends.begin (); p != available_backends.end (); p++,i++)
01602 m(i) = p->first;
01603
01604 return m;
01605 }
01606
01607 private:
01608 base_graphics_backend *rep;
01609
01610 static OCTINTERP_API std::map<std::string, graphics_backend> available_backends;
01611
01612 typedef std::map<std::string, graphics_backend>::iterator available_backends_iterator;
01613 typedef std::map<std::string, graphics_backend>::const_iterator const_available_backends_iterator;
01614 };
01615
01616
01617
01618 class base_graphics_object;
01619
01620 class OCTINTERP_API base_properties
01621 {
01622 public:
01623 base_properties (const std::string& ty = "unknown",
01624 const graphics_handle& mh = graphics_handle (),
01625 const graphics_handle& p = graphics_handle ());
01626
01627 virtual ~base_properties (void) { }
01628
01629 virtual std::string graphics_object_name (void) const { return "unknonwn"; }
01630
01631 void mark_modified (void);
01632
01633 void override_defaults (base_graphics_object& obj);
01634
01635
01636
01637
01638 void set_from_list (base_graphics_object& obj, property_list& defaults);
01639
01640 void insert_property (const std::string& name, property p)
01641 {
01642 p.set_name (name);
01643 p.set_parent (__myhandle__);
01644 all_props[name] = p;
01645 }
01646
01647 virtual void set (const caseless_str&, const octave_value&)
01648 {
01649 panic_impossible ();
01650 }
01651
01652 void set (const caseless_str& pname, const std::string& cname,
01653 const octave_value& val);
01654
01655 virtual octave_value get (const caseless_str& pname) const;
01656
01657 virtual octave_value get (const std::string& pname) const
01658 {
01659 return get (caseless_str (pname));
01660 }
01661
01662 virtual octave_value get (const char *pname) const
01663 {
01664 return get (caseless_str (pname));
01665 }
01666
01667 virtual octave_value get (bool all = false) const;
01668
01669 virtual property get_property (const caseless_str& pname);
01670
01671 virtual bool has_property (const caseless_str&) const
01672 {
01673 panic_impossible ();
01674 return false;
01675 }
01676
01677 bool is_modified (void) const { return is___modified__ (); }
01678
01679 virtual void remove_child (const graphics_handle& h);
01680
01681 virtual void adopt (const graphics_handle& h)
01682 {
01683 octave_idx_type n = children.numel ();
01684 children.resize (n+1, 1);
01685 for (octave_idx_type i = n; i > 0; i--)
01686 children(i) = children(i-1);
01687 children(0) = h.value ();
01688 mark_modified ();
01689 }
01690
01691 virtual graphics_backend get_backend (void) const;
01692
01693 virtual Matrix get_boundingbox (bool = false) const
01694 { return Matrix (1, 4, 0.0); }
01695
01696 virtual void update_boundingbox (void);
01697
01698 virtual void add_listener (const caseless_str&, const octave_value&,
01699 listener_mode = POSTSET);
01700
01701 virtual void delete_listener (const caseless_str&, const octave_value&,
01702 listener_mode = POSTSET);
01703
01704 void set_tag (const octave_value& val) { tag = val; }
01705
01706 void set_parent (const octave_value& val);
01707
01708 Matrix get_all_children (void) const { return children; }
01709
01710 void set_children (const octave_value& val);
01711
01712 void set_modified (const octave_value& val) { set___modified__ (val); }
01713
01714 void set___modified__ (const octave_value& val) { __modified__ = val; }
01715
01716 void reparent (const graphics_handle& new_parent) { parent = new_parent; }
01717
01718
01719
01720
01721 virtual void update_axis_limits (const std::string& axis_type) const;
01722
01723 virtual void delete_children (void);
01724
01725 static property_list::pval_map_type factory_defaults (void);
01726
01727
01728
01729
01730
01731
01732 virtual octave_value get_xlim (void) const { return octave_value (); }
01733 virtual octave_value get_ylim (void) const { return octave_value (); }
01734 virtual octave_value get_zlim (void) const { return octave_value (); }
01735 virtual octave_value get_clim (void) const { return octave_value (); }
01736 virtual octave_value get_alim (void) const { return octave_value (); }
01737
01738 virtual bool is_xliminclude (void) const { return false; }
01739 virtual bool is_yliminclude (void) const { return false; }
01740 virtual bool is_zliminclude (void) const { return false; }
01741 virtual bool is_climinclude (void) const { return false; }
01742 virtual bool is_aliminclude (void) const { return false; }
01743
01744 bool is_handle_visible (void) const
01745 {
01746 return ! handlevisibility.is ("off");
01747 }
01748
01749 static std::map<std::string, std::set<std::string> > all_dynamic_properties;
01750
01751 static std::set<std::string> dynamic_property_names (const std::string& cname);
01752
01753 static bool has_dynamic_property (const std::string& pname,
01754 const std::string& cname);
01755
01756 protected:
01757 void set_dynamic (const caseless_str& pname, const std::string& cname,
01758 const octave_value& val);
01759
01760 octave_value get_dynamic (const caseless_str& pname) const;
01761
01762 octave_value get_dynamic (bool all = false) const;
01763
01764 property get_property_dynamic (const caseless_str& pname);
01765
01766 public:
01767
01768
01769 static std::set<std::string> core_property_names (void);
01770
01771 static bool has_core_property (const caseless_str& pname);
01772
01773 std::set<std::string> all_property_names (const std::string& cname) const;
01774
01775 protected:
01776
01777 bool_property beingdeleted;
01778 radio_property busyaction;
01779 callback_property buttondownfcn;
01780 Matrix children;
01781 bool_property clipping;
01782 callback_property createfcn;
01783 callback_property deletefcn;
01784 radio_property handlevisibility;
01785 bool_property hittest;
01786 bool_property interruptible;
01787 handle_property parent;
01788 bool_property selected;
01789 bool_property selectionhighlight;
01790 string_property tag;
01791 string_property type;
01792 any_property userdata;
01793 bool_property visible;
01794 bool_property __modified__;
01795 graphics_handle __myhandle__;
01796 handle_property uicontextmenu;
01797
01798 public:
01799
01800 enum
01801 {
01802 BEINGDELETED = 0,
01803 BUSYACTION = 1,
01804 BUTTONDOWNFCN = 2,
01805 CHILDREN = 3,
01806 CLIPPING = 4,
01807 CREATEFCN = 5,
01808 DELETEFCN = 6,
01809 HANDLEVISIBILITY = 7,
01810 HITTEST = 8,
01811 INTERRUPTIBLE = 9,
01812 PARENT = 10,
01813 SELECTED = 11,
01814 SELECTIONHIGHLIGHT = 12,
01815 TAG = 13,
01816 TYPE = 14,
01817 USERDATA = 15,
01818 VISIBLE = 16,
01819 __MODIFIED__ = 17,
01820 __MYHANDLE__ = 18,
01821 UICONTEXTMENU = 19
01822 };
01823
01824 bool is_beingdeleted (void) const { return beingdeleted.is_on (); }
01825 std::string get_beingdeleted (void) const { return beingdeleted.current_value (); }
01826
01827 bool busyaction_is (const std::string& v) const { return busyaction.is (v); }
01828 std::string get_busyaction (void) const { return busyaction.current_value (); }
01829
01830 void execute_buttondownfcn (const octave_value& data = octave_value ()) const { buttondownfcn.execute (data); }
01831 octave_value get_buttondownfcn (void) const { return buttondownfcn.get (); }
01832
01833 Matrix get_children (void) const;
01834
01835 bool is_clipping (void) const { return clipping.is_on (); }
01836 std::string get_clipping (void) const { return clipping.current_value (); }
01837
01838 void execute_createfcn (const octave_value& data = octave_value ()) const { createfcn.execute (data); }
01839 octave_value get_createfcn (void) const { return createfcn.get (); }
01840
01841 void execute_deletefcn (const octave_value& data = octave_value ()) const { deletefcn.execute (data); }
01842 octave_value get_deletefcn (void) const { return deletefcn.get (); }
01843
01844 bool handlevisibility_is (const std::string& v) const { return handlevisibility.is (v); }
01845 std::string get_handlevisibility (void) const { return handlevisibility.current_value (); }
01846
01847 bool is_hittest (void) const { return hittest.is_on (); }
01848 std::string get_hittest (void) const { return hittest.current_value (); }
01849
01850 bool is_interruptible (void) const { return interruptible.is_on (); }
01851 std::string get_interruptible (void) const { return interruptible.current_value (); }
01852
01853 graphics_handle get_parent (void) const { return parent.handle_value (); }
01854
01855 bool is_selected (void) const { return selected.is_on (); }
01856 std::string get_selected (void) const { return selected.current_value (); }
01857
01858 bool is_selectionhighlight (void) const { return selectionhighlight.is_on (); }
01859 std::string get_selectionhighlight (void) const { return selectionhighlight.current_value (); }
01860
01861 std::string get_tag (void) const { return tag.string_value (); }
01862
01863 std::string get_type (void) const { return type.string_value (); }
01864
01865 octave_value get_userdata (void) const { return userdata.get (); }
01866
01867 bool is_visible (void) const { return visible.is_on (); }
01868 std::string get_visible (void) const { return visible.current_value (); }
01869
01870 bool is___modified__ (void) const { return __modified__.is_on (); }
01871 std::string get___modified__ (void) const { return __modified__.current_value (); }
01872
01873 graphics_handle get___myhandle__ (void) const { return __myhandle__; }
01874
01875 graphics_handle get_uicontextmenu (void) const { return uicontextmenu.handle_value (); }
01876
01877
01878 void set_beingdeleted (const octave_value& val)
01879 {
01880 if (! error_state)
01881 {
01882 if (beingdeleted.set (val, true))
01883 {
01884 mark_modified ();
01885 }
01886 }
01887 }
01888
01889 void set_busyaction (const octave_value& val)
01890 {
01891 if (! error_state)
01892 {
01893 if (busyaction.set (val, true))
01894 {
01895 mark_modified ();
01896 }
01897 }
01898 }
01899
01900 void set_buttondownfcn (const octave_value& val)
01901 {
01902 if (! error_state)
01903 {
01904 if (buttondownfcn.set (val, true))
01905 {
01906 mark_modified ();
01907 }
01908 }
01909 }
01910
01911 void set_clipping (const octave_value& val)
01912 {
01913 if (! error_state)
01914 {
01915 if (clipping.set (val, true))
01916 {
01917 mark_modified ();
01918 }
01919 }
01920 }
01921
01922 void set_createfcn (const octave_value& val)
01923 {
01924 if (! error_state)
01925 {
01926 if (createfcn.set (val, true))
01927 {
01928 mark_modified ();
01929 }
01930 }
01931 }
01932
01933 void set_deletefcn (const octave_value& val)
01934 {
01935 if (! error_state)
01936 {
01937 if (deletefcn.set (val, true))
01938 {
01939 mark_modified ();
01940 }
01941 }
01942 }
01943
01944 void set_handlevisibility (const octave_value& val)
01945 {
01946 if (! error_state)
01947 {
01948 if (handlevisibility.set (val, true))
01949 {
01950 mark_modified ();
01951 }
01952 }
01953 }
01954
01955 void set_hittest (const octave_value& val)
01956 {
01957 if (! error_state)
01958 {
01959 if (hittest.set (val, true))
01960 {
01961 mark_modified ();
01962 }
01963 }
01964 }
01965
01966 void set_interruptible (const octave_value& val)
01967 {
01968 if (! error_state)
01969 {
01970 if (interruptible.set (val, true))
01971 {
01972 mark_modified ();
01973 }
01974 }
01975 }
01976
01977 void set_selected (const octave_value& val)
01978 {
01979 if (! error_state)
01980 {
01981 if (selected.set (val, true))
01982 {
01983 mark_modified ();
01984 }
01985 }
01986 }
01987
01988 void set_selectionhighlight (const octave_value& val)
01989 {
01990 if (! error_state)
01991 {
01992 if (selectionhighlight.set (val, true))
01993 {
01994 mark_modified ();
01995 }
01996 }
01997 }
01998
01999 void set_userdata (const octave_value& val)
02000 {
02001 if (! error_state)
02002 {
02003 if (userdata.set (val, true))
02004 {
02005 mark_modified ();
02006 }
02007 }
02008 }
02009
02010 void set_visible (const octave_value& val)
02011 {
02012 if (! error_state)
02013 {
02014 if (visible.set (val, true))
02015 {
02016 mark_modified ();
02017 }
02018 }
02019 }
02020
02021 void set_uicontextmenu (const octave_value& val)
02022 {
02023 if (! error_state)
02024 {
02025 if (uicontextmenu.set (val, true))
02026 {
02027 mark_modified ();
02028 }
02029 }
02030 }
02031
02032
02033 protected:
02034 struct cmp_caseless_str
02035 {
02036 bool operator () (const caseless_str &a, const caseless_str &b) const
02037 {
02038 std::string a1 = a;
02039 std::transform (a1.begin (), a1.end (), a1.begin (), tolower);
02040 std::string b1 = b;
02041 std::transform (b1.begin (), b1.end (), b1.begin (), tolower);
02042
02043 return a1 < b1;
02044 }
02045 };
02046
02047 std::map<caseless_str, property, cmp_caseless_str> all_props;
02048
02049 protected:
02050 void insert_static_property (const std::string& name, base_property& p)
02051 { insert_property (name, property (&p, true)); }
02052
02053 virtual void init (void) { }
02054 };
02055
02056 class OCTINTERP_API base_graphics_object
02057 {
02058 public:
02059 friend class graphics_object;
02060
02061 base_graphics_object (void) : count (1) { }
02062
02063 base_graphics_object (const base_graphics_object&) { }
02064
02065 virtual ~base_graphics_object (void) { }
02066
02067 virtual void mark_modified (void)
02068 {
02069 if (valid_object ())
02070 get_properties ().mark_modified ();
02071 else
02072 error ("base_graphics_object::mark_modified: invalid graphics object");
02073 }
02074
02075 virtual void override_defaults (base_graphics_object& obj)
02076 {
02077 if (valid_object ())
02078 get_properties ().override_defaults (obj);
02079 else
02080 error ("base_graphics_object::override_defaults: invalid graphics object");
02081 }
02082
02083 virtual void set_from_list (property_list& plist)
02084 {
02085 if (valid_object ())
02086 get_properties ().set_from_list (*this, plist);
02087 else
02088 error ("base_graphics_object::set_from_list: invalid graphics object");
02089 }
02090
02091 virtual void set (const caseless_str& pname, const octave_value& pval)
02092 {
02093 if (valid_object ())
02094 get_properties ().set (pname, pval);
02095 else
02096 error ("base_graphics_object::set: invalid graphics object");
02097 }
02098
02099 virtual void set_defaults (const std::string&)
02100 {
02101 error ("base_graphics_object::set_defaults: invalid graphics object");
02102 }
02103
02104 virtual octave_value get (bool all = false) const
02105 {
02106 if (valid_object ())
02107 return get_properties ().get (all);
02108 else
02109 {
02110 error ("base_graphics_object::get: invalid graphics object");
02111 return octave_value ();
02112 }
02113 }
02114
02115 virtual octave_value get (const caseless_str& pname) const
02116 {
02117 if (valid_object ())
02118 return get_properties ().get (pname);
02119 else
02120 {
02121 error ("base_graphics_object::get: invalid graphics object");
02122 return octave_value ();
02123 }
02124 }
02125
02126 virtual octave_value get_default (const caseless_str&) const;
02127
02128 virtual octave_value get_factory_default (const caseless_str&) const;
02129
02130 virtual octave_value get_defaults (void) const
02131 {
02132 error ("base_graphics_object::get_defaults: invalid graphics object");
02133 return octave_value ();
02134 }
02135
02136 virtual octave_value get_factory_defaults (void) const
02137 {
02138 error ("base_graphics_object::get_factory_defaults: invalid graphics object");
02139 return octave_value ();
02140 }
02141
02142 virtual graphics_handle get_parent (void) const
02143 {
02144 if (valid_object ())
02145 return get_properties ().get_parent ();
02146 else
02147 {
02148 error ("base_graphics_object::get_parent: invalid graphics object");
02149 return graphics_handle ();
02150 }
02151 }
02152
02153 graphics_handle get_handle (void) const
02154 {
02155 if (valid_object ())
02156 return get_properties ().get___myhandle__ ();
02157 else
02158 {
02159 error ("base_graphics_object::get_handle: invalid graphics object");
02160 return graphics_handle ();
02161 }
02162 }
02163
02164 virtual void remove_child (const graphics_handle& h)
02165 {
02166 if (valid_object ())
02167 get_properties ().remove_child (h);
02168 else
02169 error ("base_graphics_object::remove_child: invalid graphics object");
02170 }
02171
02172 virtual void adopt (const graphics_handle& h)
02173 {
02174 if (valid_object ())
02175 get_properties ().adopt (h);
02176 else
02177 error ("base_graphics_object::adopt: invalid graphics object");
02178 }
02179
02180 virtual void reparent (const graphics_handle& np)
02181 {
02182 if (valid_object ())
02183 get_properties ().reparent (np);
02184 else
02185 error ("base_graphics_object::reparent: invalid graphics object");
02186 }
02187
02188 virtual void defaults (void) const
02189 {
02190 if (valid_object ())
02191 {
02192 std::string msg = (type () + "::defaults");
02193 gripe_not_implemented (msg.c_str ());
02194 }
02195 else
02196 error ("base_graphics_object::default: invalid graphics object");
02197 }
02198
02199 virtual base_properties& get_properties (void)
02200 {
02201 static base_properties properties;
02202 error ("base_graphics_object::get_properties: invalid graphics object");
02203 return properties;
02204 }
02205
02206 virtual const base_properties& get_properties (void) const
02207 {
02208 static base_properties properties;
02209 error ("base_graphics_object::get_properties: invalid graphics object");
02210 return properties;
02211 }
02212
02213 virtual void update_axis_limits (const std::string& axis_type);
02214
02215 virtual bool valid_object (void) const { return false; }
02216
02217 virtual std::string type (void) const
02218 {
02219 return (valid_object () ? get_properties ().graphics_object_name ()
02220 : "unknown");
02221 }
02222
02223 bool isa (const std::string& go_name) const
02224 {
02225 return type () == go_name;
02226 }
02227
02228 virtual graphics_backend get_backend (void) const
02229 {
02230 if (valid_object ())
02231 return get_properties ().get_backend ();
02232 else
02233 {
02234 error ("base_graphics_object::get_backend: invalid graphics object");
02235 return graphics_backend ();
02236 }
02237 }
02238
02239 virtual void add_property_listener (const std::string& nm,
02240 const octave_value& v,
02241 listener_mode mode = POSTSET)
02242 {
02243 if (valid_object ())
02244 get_properties ().add_listener (nm, v, mode);
02245 }
02246
02247 virtual void delete_property_listener (const std::string& nm,
02248 const octave_value& v,
02249 listener_mode mode = POSTSET)
02250 {
02251 if (valid_object ())
02252 get_properties ().delete_listener (nm, v, mode);
02253 }
02254
02255 virtual void remove_all_listeners (void);
02256
02257 protected:
02258
02259 int count;
02260 };
02261
02262 class OCTINTERP_API graphics_object
02263 {
02264 public:
02265 graphics_object (void) : rep (new base_graphics_object ()) { }
02266
02267 graphics_object (base_graphics_object *new_rep)
02268 : rep (new_rep) { }
02269
02270 graphics_object (const graphics_object& obj)
02271 {
02272 rep = obj.rep;
02273 rep->count++;
02274 }
02275
02276 graphics_object& operator = (const graphics_object& obj)
02277 {
02278 if (rep != obj.rep)
02279 {
02280 if (--rep->count == 0)
02281 delete rep;
02282
02283 rep = obj.rep;
02284 rep->count++;
02285 }
02286
02287 return *this;
02288 }
02289
02290 ~graphics_object (void)
02291 {
02292 if (--rep->count == 0)
02293 delete rep;
02294 }
02295
02296 void mark_modified (void) { rep->mark_modified (); }
02297
02298 void override_defaults (base_graphics_object& obj)
02299 {
02300 rep->override_defaults (obj);
02301 }
02302
02303 void set_from_list (property_list& plist) { rep->set_from_list (plist); }
02304
02305 void set (const caseless_str& name, const octave_value& val)
02306 {
02307 rep->set (name, val);
02308 }
02309
02310 void set (const octave_value_list& args);
02311
02312 void set_defaults (const std::string& mode) { rep->set_defaults (mode); }
02313
02314 octave_value get (bool all = false) const { return rep->get (all); }
02315
02316 octave_value get (const caseless_str& name) const
02317 {
02318 return name.compare ("default")
02319 ? get_defaults ()
02320 : (name.compare ("factory")
02321 ? get_factory_defaults () : rep->get (name));
02322 }
02323
02324 octave_value get (const std::string& name) const
02325 {
02326 return get (caseless_str (name));
02327 }
02328
02329 octave_value get (const char *name) const
02330 {
02331 return get (caseless_str (name));
02332 }
02333
02334 octave_value get_default (const caseless_str& name) const
02335 {
02336 return rep->get_default (name);
02337 }
02338
02339 octave_value get_factory_default (const caseless_str& name) const
02340 {
02341 return rep->get_factory_default (name);
02342 }
02343
02344 octave_value get_defaults (void) const { return rep->get_defaults (); }
02345
02346 octave_value get_factory_defaults (void) const
02347 {
02348 return rep->get_factory_defaults ();
02349 }
02350
02351 graphics_handle get_parent (void) const { return rep->get_parent (); }
02352
02353 graphics_handle get_handle (void) const { return rep->get_handle (); }
02354
02355 void remove_child (const graphics_handle& h) { rep->remove_child (h); }
02356
02357 void adopt (const graphics_handle& h) { rep->adopt (h); }
02358
02359 void reparent (const graphics_handle& h) { rep->reparent (h); }
02360
02361 void defaults (void) const { rep->defaults (); }
02362
02363 bool isa (const std::string& go_name) const { return rep->isa (go_name); }
02364
02365 base_properties& get_properties (void) { return rep->get_properties (); }
02366
02367 const base_properties& get_properties (void) const
02368 {
02369 return rep->get_properties ();
02370 }
02371
02372 void update_axis_limits (const std::string& axis_type)
02373 {
02374 rep->update_axis_limits (axis_type);
02375 }
02376
02377 bool valid_object (void) const { return rep->valid_object (); }
02378
02379 std::string type (void) const { return rep->type (); }
02380
02381 operator bool (void) const { return rep->valid_object (); }
02382
02383
02384
02385
02386
02387
02388 octave_value get_xlim (void) const
02389 { return get_properties ().get_xlim (); }
02390
02391 octave_value get_ylim (void) const
02392 { return get_properties ().get_ylim (); }
02393
02394 octave_value get_zlim (void) const
02395 { return get_properties ().get_zlim (); }
02396
02397 octave_value get_clim (void) const
02398 { return get_properties ().get_clim (); }
02399
02400 octave_value get_alim (void) const
02401 { return get_properties ().get_alim (); }
02402
02403 bool is_xliminclude (void) const
02404 { return get_properties ().is_xliminclude (); }
02405
02406 bool is_yliminclude (void) const
02407 { return get_properties ().is_yliminclude (); }
02408
02409 bool is_zliminclude (void) const
02410 { return get_properties ().is_zliminclude (); }
02411
02412 bool is_climinclude (void) const
02413 { return get_properties ().is_climinclude (); }
02414
02415 bool is_aliminclude (void) const
02416 { return get_properties ().is_aliminclude (); }
02417
02418 bool is_handle_visible (void) const
02419 { return get_properties ().is_handle_visible (); }
02420
02421 graphics_backend get_backend (void) const { return rep->get_backend (); }
02422
02423 void add_property_listener (const std::string& nm, const octave_value& v,
02424 listener_mode mode = POSTSET)
02425 { rep->add_property_listener (nm, v, mode); }
02426
02427 void delete_property_listener (const std::string& nm, const octave_value& v,
02428 listener_mode mode = POSTSET)
02429 { rep->delete_property_listener (nm, v, mode); }
02430
02431 private:
02432 base_graphics_object *rep;
02433 };
02434
02435
02436
02437 class OCTINTERP_API root_figure : public base_graphics_object
02438 {
02439 public:
02440 class OCTINTERP_API properties : public base_properties
02441 {
02442 public:
02443 void remove_child (const graphics_handle& h);
02444
02445
02446
02447
02448 public:
02449 properties (const graphics_handle& mh, const graphics_handle& p);
02450
02451 ~properties (void) { }
02452
02453 void set (const caseless_str& pname, const octave_value& val);
02454
02455 octave_value get (bool all = false) const;
02456
02457 octave_value get (const caseless_str& pname) const;
02458
02459 octave_value get (const std::string& pname) const
02460 {
02461 return get (caseless_str (pname));
02462 }
02463
02464 octave_value get (const char *pname) const
02465 {
02466 return get (caseless_str (pname));
02467 }
02468
02469 property get_property (const caseless_str& pname);
02470
02471 std::string graphics_object_name (void) const { return go_name; }
02472
02473 static property_list::pval_map_type factory_defaults (void);
02474
02475 private:
02476 static std::string go_name;
02477
02478 public:
02479
02480
02481 static std::set<std::string> core_property_names (void);
02482
02483 static bool has_core_property (const caseless_str& pname);
02484
02485 std::set<std::string> all_property_names (void) const;
02486
02487 bool has_property (const caseless_str& pname) const;
02488
02489 private:
02490
02491 handle_property currentfigure;
02492 handle_property callbackobject;
02493 double_property screendepth;
02494 array_property screensize;
02495 double_property screenpixelsperinch;
02496 radio_property units;
02497 bool_property showhiddenhandles;
02498
02499 public:
02500
02501 enum
02502 {
02503 CURRENTFIGURE = 1000,
02504 CALLBACKOBJECT = 1001,
02505 SCREENDEPTH = 1002,
02506 SCREENSIZE = 1003,
02507 SCREENPIXELSPERINCH = 1004,
02508 UNITS = 1005,
02509 SHOWHIDDENHANDLES = 1006
02510 };
02511
02512 graphics_handle get_currentfigure (void) const { return currentfigure.handle_value (); }
02513
02514 graphics_handle get_callbackobject (void) const { return callbackobject.handle_value (); }
02515
02516 double get_screendepth (void) const { return screendepth.double_value (); }
02517
02518 octave_value get_screensize (void) const { return screensize.get (); }
02519
02520 double get_screenpixelsperinch (void) const { return screenpixelsperinch.double_value (); }
02521
02522 bool units_is (const std::string& v) const { return units.is (v); }
02523 std::string get_units (void) const { return units.current_value (); }
02524
02525 bool is_showhiddenhandles (void) const { return showhiddenhandles.is_on (); }
02526 std::string get_showhiddenhandles (void) const { return showhiddenhandles.current_value (); }
02527
02528
02529 void set_currentfigure (const octave_value& val);
02530
02531 void set_callbackobject (const octave_value& val);
02532
02533 void set_screendepth (const octave_value& val)
02534 {
02535 if (! error_state)
02536 {
02537 if (screendepth.set (val, true))
02538 {
02539 mark_modified ();
02540 }
02541 }
02542 }
02543
02544 void set_screensize (const octave_value& val)
02545 {
02546 if (! error_state)
02547 {
02548 if (screensize.set (val, true))
02549 {
02550 mark_modified ();
02551 }
02552 }
02553 }
02554
02555 void set_screenpixelsperinch (const octave_value& val)
02556 {
02557 if (! error_state)
02558 {
02559 if (screenpixelsperinch.set (val, true))
02560 {
02561 mark_modified ();
02562 }
02563 }
02564 }
02565
02566 void set_units (const octave_value& val)
02567 {
02568 if (! error_state)
02569 {
02570 if (units.set (val, true))
02571 {
02572 update_units ();
02573 mark_modified ();
02574 }
02575 }
02576 }
02577
02578 void update_units (void);
02579
02580 void set_showhiddenhandles (const octave_value& val)
02581 {
02582 if (! error_state)
02583 {
02584 if (showhiddenhandles.set (val, true))
02585 {
02586 mark_modified ();
02587 }
02588 }
02589 }
02590
02591
02592 private:
02593 std::list<graphics_handle> cbo_stack;
02594 };
02595
02596 private:
02597 properties xproperties;
02598
02599 public:
02600
02601 root_figure (void) : xproperties (0, graphics_handle ()), default_properties () { }
02602
02603 ~root_figure (void) { xproperties.delete_children (); }
02604
02605 void mark_modified (void) { }
02606
02607 void override_defaults (base_graphics_object& obj)
02608 {
02609
02610
02611
02612
02613
02614 obj.set_from_list (default_properties);
02615 }
02616
02617 void set (const caseless_str& name, const octave_value& value)
02618 {
02619 if (name.compare ("default", 7))
02620
02621
02622
02623 default_properties.set (name.substr (7), value);
02624 else
02625 xproperties.set (name, value);
02626 }
02627
02628 octave_value get (const caseless_str& name) const
02629 {
02630 octave_value retval;
02631
02632 if (name.compare ("default", 7))
02633 return get_default (name.substr (7));
02634 else if (name.compare ("factory", 7))
02635 return get_factory_default (name.substr (7));
02636 else
02637 retval = xproperties.get (name);
02638
02639 return retval;
02640 }
02641
02642 octave_value get_default (const caseless_str& name) const
02643 {
02644 octave_value retval = default_properties.lookup (name);
02645
02646 if (retval.is_undefined ())
02647 {
02648
02649 retval = factory_properties.lookup (name);
02650
02651 if (retval.is_undefined ())
02652 error ("get: invalid default property `%s'", name.c_str ());
02653 }
02654
02655 return retval;
02656 }
02657
02658 octave_value get_factory_default (const caseless_str& name) const
02659 {
02660 octave_value retval = factory_properties.lookup (name);
02661
02662 if (retval.is_undefined ())
02663 error ("get: invalid factory default property `%s'", name.c_str ());
02664
02665 return retval;
02666 }
02667
02668 octave_value get_defaults (void) const
02669 {
02670 return default_properties.as_struct ("default");
02671 }
02672
02673 octave_value get_factory_defaults (void) const
02674 {
02675 return factory_properties.as_struct ("factory");
02676 }
02677
02678 base_properties& get_properties (void) { return xproperties; }
02679
02680 const base_properties& get_properties (void) const { return xproperties; }
02681
02682 bool valid_object (void) const { return true; }
02683
02684 private:
02685 property_list default_properties;
02686
02687 static property_list factory_properties;
02688
02689 static property_list::plist_map_type init_factory_properties (void);
02690 };
02691
02692
02693
02694 class OCTINTERP_API figure : public base_graphics_object
02695 {
02696 public:
02697 class OCTINTERP_API properties : public base_properties
02698 {
02699 public:
02700 void remove_child (const graphics_handle& h);
02701
02702 void set_visible (const octave_value& val);
02703
02704 graphics_backend get_backend (void) const
02705 {
02706 if (! backend)
02707 backend = graphics_backend::default_backend ();
02708
02709 return backend;
02710 }
02711
02712 void set_backend (const graphics_backend& b)
02713 {
02714 if (backend)
02715 backend.object_destroyed (__myhandle__);
02716 backend = b;
02717 __backend__ = b.get_name ();
02718 __plot_stream__ = Matrix ();
02719 mark_modified ();
02720 }
02721
02722 void set___backend__ (const octave_value& val)
02723 {
02724 if (! error_state)
02725 {
02726 if (val.is_string ())
02727 {
02728 std::string nm = val.string_value ();
02729 graphics_backend b = graphics_backend::find_backend (nm);
02730 if (b.get_name () != nm)
02731 {
02732 error ("set___backend__: invalid backend");
02733 }
02734 else
02735 {
02736 set_backend (b);
02737 mark_modified ();
02738 }
02739 }
02740 else
02741 error ("set___backend__ must be a string");
02742 }
02743 }
02744
02745 Matrix get_boundingbox (bool internal = false) const;
02746
02747 void set_boundingbox (const Matrix& bb);
02748
02749 std::string get_title (void) const;
02750
02751
02752
02753
02754 public:
02755 properties (const graphics_handle& mh, const graphics_handle& p);
02756
02757 ~properties (void) { }
02758
02759 void set (const caseless_str& pname, const octave_value& val);
02760
02761 octave_value get (bool all = false) const;
02762
02763 octave_value get (const caseless_str& pname) const;
02764
02765 octave_value get (const std::string& pname) const
02766 {
02767 return get (caseless_str (pname));
02768 }
02769
02770 octave_value get (const char *pname) const
02771 {
02772 return get (caseless_str (pname));
02773 }
02774
02775 property get_property (const caseless_str& pname);
02776
02777 std::string graphics_object_name (void) const { return go_name; }
02778
02779 static property_list::pval_map_type factory_defaults (void);
02780
02781 private:
02782 static std::string go_name;
02783
02784 public:
02785
02786
02787 static std::set<std::string> core_property_names (void);
02788
02789 static bool has_core_property (const caseless_str& pname);
02790
02791 std::set<std::string> all_property_names (void) const;
02792
02793 bool has_property (const caseless_str& pname) const;
02794
02795 private:
02796
02797 any_property __plot_stream__;
02798 bool_property __enhanced__;
02799 radio_property nextplot;
02800 callback_property closerequestfcn;
02801 handle_property currentaxes;
02802 array_property colormap;
02803 radio_property paperorientation;
02804 color_property color;
02805 array_property alphamap;
02806 string_property currentcharacter;
02807 handle_property currentobject;
02808 array_property current_point;
02809 bool_property dockcontrols;
02810 bool_property doublebuffer;
02811 string_property filename;
02812 bool_property integerhandle;
02813 bool_property inverthardcopy;
02814 callback_property keypressfcn;
02815 callback_property keyreleasefcn;
02816 radio_property menubar;
02817 double_property mincolormap;
02818 string_property name;
02819 bool_property numbertitle;
02820 radio_property paperunits;
02821 array_property paperposition;
02822 radio_property paperpositionmode;
02823 array_property papersize;
02824 radio_property papertype;
02825 radio_property pointer;
02826 array_property pointershapecdata;
02827 array_property pointershapehotspot;
02828 array_property position;
02829 radio_property renderer;
02830 radio_property renderermode;
02831 bool_property resize;
02832 callback_property resizefcn;
02833 radio_property selectiontype;
02834 radio_property toolbar;
02835 radio_property units;
02836 callback_property windowbuttondownfcn;
02837 callback_property windowbuttonmotionfcn;
02838 callback_property windowbuttonupfcn;
02839 callback_property windowbuttonwheelfcn;
02840 radio_property windowstyle;
02841 string_property wvisual;
02842 radio_property wvisualmode;
02843 string_property xdisplay;
02844 string_property xvisual;
02845 radio_property xvisualmode;
02846 callback_property buttondownfcn;
02847 string_property __backend__;
02848
02849 public:
02850
02851 enum
02852 {
02853 __PLOT_STREAM__ = 2000,
02854 __ENHANCED__ = 2001,
02855 NEXTPLOT = 2002,
02856 CLOSEREQUESTFCN = 2003,
02857 CURRENTAXES = 2004,
02858 COLORMAP = 2005,
02859 PAPERORIENTATION = 2006,
02860 COLOR = 2007,
02861 ALPHAMAP = 2008,
02862 CURRENTCHARACTER = 2009,
02863 CURRENTOBJECT = 2010,
02864 CURRENT_POINT = 2011,
02865 DOCKCONTROLS = 2012,
02866 DOUBLEBUFFER = 2013,
02867 FILENAME = 2014,
02868 INTEGERHANDLE = 2015,
02869 INVERTHARDCOPY = 2016,
02870 KEYPRESSFCN = 2017,
02871 KEYRELEASEFCN = 2018,
02872 MENUBAR = 2019,
02873 MINCOLORMAP = 2020,
02874 NAME = 2021,
02875 NUMBERTITLE = 2022,
02876 PAPERUNITS = 2023,
02877 PAPERPOSITION = 2024,
02878 PAPERPOSITIONMODE = 2025,
02879 PAPERSIZE = 2026,
02880 PAPERTYPE = 2027,
02881 POINTER = 2028,
02882 POINTERSHAPECDATA = 2029,
02883 POINTERSHAPEHOTSPOT = 2030,
02884 POSITION = 2031,
02885 RENDERER = 2032,
02886 RENDERERMODE = 2033,
02887 RESIZE = 2034,
02888 RESIZEFCN = 2035,
02889 SELECTIONTYPE = 2036,
02890 TOOLBAR = 2037,
02891 UNITS = 2038,
02892 WINDOWBUTTONDOWNFCN = 2039,
02893 WINDOWBUTTONMOTIONFCN = 2040,
02894 WINDOWBUTTONUPFCN = 2041,
02895 WINDOWBUTTONWHEELFCN = 2042,
02896 WINDOWSTYLE = 2043,
02897 WVISUAL = 2044,
02898 WVISUALMODE = 2045,
02899 XDISPLAY = 2046,
02900 XVISUAL = 2047,
02901 XVISUALMODE = 2048,
02902 BUTTONDOWNFCN = 2049,
02903 __BACKEND__ = 2050
02904 };
02905
02906 octave_value get___plot_stream__ (void) const { return __plot_stream__.get (); }
02907
02908 bool is___enhanced__ (void) const { return __enhanced__.is_on (); }
02909 std::string get___enhanced__ (void) const { return __enhanced__.current_value (); }
02910
02911 bool nextplot_is (const std::string& v) const { return nextplot.is (v); }
02912 std::string get_nextplot (void) const { return nextplot.current_value (); }
02913
02914 void execute_closerequestfcn (const octave_value& data = octave_value ()) const { closerequestfcn.execute (data); }
02915 octave_value get_closerequestfcn (void) const { return closerequestfcn.get (); }
02916
02917 graphics_handle get_currentaxes (void) const { return currentaxes.handle_value (); }
02918
02919 octave_value get_colormap (void) const { return colormap.get (); }
02920
02921 bool paperorientation_is (const std::string& v) const { return paperorientation.is (v); }
02922 std::string get_paperorientation (void) const { return paperorientation.current_value (); }
02923
02924 bool color_is_rgb (void) const { return color.is_rgb (); }
02925 bool color_is (const std::string& v) const { return color.is (v); }
02926 Matrix get_color_rgb (void) const { return (color.is_rgb () ? color.rgb () : Matrix ()); }
02927 octave_value get_color (void) const { return color.get (); }
02928
02929 octave_value get_alphamap (void) const { return alphamap.get (); }
02930
02931 std::string get_currentcharacter (void) const { return currentcharacter.string_value (); }
02932
02933 graphics_handle get_currentobject (void) const { return currentobject.handle_value (); }
02934
02935 octave_value get_current_point (void) const { return current_point.get (); }
02936
02937 bool is_dockcontrols (void) const { return dockcontrols.is_on (); }
02938 std::string get_dockcontrols (void) const { return dockcontrols.current_value (); }
02939
02940 bool is_doublebuffer (void) const { return doublebuffer.is_on (); }
02941 std::string get_doublebuffer (void) const { return doublebuffer.current_value (); }
02942
02943 std::string get_filename (void) const { return filename.string_value (); }
02944
02945 bool is_integerhandle (void) const { return integerhandle.is_on (); }
02946 std::string get_integerhandle (void) const { return integerhandle.current_value (); }
02947
02948 bool is_inverthardcopy (void) const { return inverthardcopy.is_on (); }
02949 std::string get_inverthardcopy (void) const { return inverthardcopy.current_value (); }
02950
02951 void execute_keypressfcn (const octave_value& data = octave_value ()) const { keypressfcn.execute (data); }
02952 octave_value get_keypressfcn (void) const { return keypressfcn.get (); }
02953
02954 void execute_keyreleasefcn (const octave_value& data = octave_value ()) const { keyreleasefcn.execute (data); }
02955 octave_value get_keyreleasefcn (void) const { return keyreleasefcn.get (); }
02956
02957 bool menubar_is (const std::string& v) const { return menubar.is (v); }
02958 std::string get_menubar (void) const { return menubar.current_value (); }
02959
02960 double get_mincolormap (void) const { return mincolormap.double_value (); }
02961
02962 std::string get_name (void) const { return name.string_value (); }
02963
02964 bool is_numbertitle (void) const { return numbertitle.is_on (); }
02965 std::string get_numbertitle (void) const { return numbertitle.current_value (); }
02966
02967 bool paperunits_is (const std::string& v) const { return paperunits.is (v); }
02968 std::string get_paperunits (void) const { return paperunits.current_value (); }
02969
02970 octave_value get_paperposition (void) const { return paperposition.get (); }
02971
02972 bool paperpositionmode_is (const std::string& v) const { return paperpositionmode.is (v); }
02973 std::string get_paperpositionmode (void) const { return paperpositionmode.current_value (); }
02974
02975 octave_value get_papersize (void) const { return papersize.get (); }
02976
02977 bool papertype_is (const std::string& v) const { return papertype.is (v); }
02978 std::string get_papertype (void) const { return papertype.current_value (); }
02979
02980 bool pointer_is (const std::string& v) const { return pointer.is (v); }
02981 std::string get_pointer (void) const { return pointer.current_value (); }
02982
02983 octave_value get_pointershapecdata (void) const { return pointershapecdata.get (); }
02984
02985 octave_value get_pointershapehotspot (void) const { return pointershapehotspot.get (); }
02986
02987 octave_value get_position (void) const { return position.get (); }
02988
02989 bool renderer_is (const std::string& v) const { return renderer.is (v); }
02990 std::string get_renderer (void) const { return renderer.current_value (); }
02991
02992 bool renderermode_is (const std::string& v) const { return renderermode.is (v); }
02993 std::string get_renderermode (void) const { return renderermode.current_value (); }
02994
02995 bool is_resize (void) const { return resize.is_on (); }
02996 std::string get_resize (void) const { return resize.current_value (); }
02997
02998 void execute_resizefcn (const octave_value& data = octave_value ()) const { resizefcn.execute (data); }
02999 octave_value get_resizefcn (void) const { return resizefcn.get (); }
03000
03001 bool selectiontype_is (const std::string& v) const { return selectiontype.is (v); }
03002 std::string get_selectiontype (void) const { return selectiontype.current_value (); }
03003
03004 bool toolbar_is (const std::string& v) const { return toolbar.is (v); }
03005 std::string get_toolbar (void) const { return toolbar.current_value (); }
03006
03007 bool units_is (const std::string& v) const { return units.is (v); }
03008 std::string get_units (void) const { return units.current_value (); }
03009
03010 void execute_windowbuttondownfcn (const octave_value& data = octave_value ()) const { windowbuttondownfcn.execute (data); }
03011 octave_value get_windowbuttondownfcn (void) const { return windowbuttondownfcn.get (); }
03012
03013 void execute_windowbuttonmotionfcn (const octave_value& data = octave_value ()) const { windowbuttonmotionfcn.execute (data); }
03014 octave_value get_windowbuttonmotionfcn (void) const { return windowbuttonmotionfcn.get (); }
03015
03016 void execute_windowbuttonupfcn (const octave_value& data = octave_value ()) const { windowbuttonupfcn.execute (data); }
03017 octave_value get_windowbuttonupfcn (void) const { return windowbuttonupfcn.get (); }
03018
03019 void execute_windowbuttonwheelfcn (const octave_value& data = octave_value ()) const { windowbuttonwheelfcn.execute (data); }
03020 octave_value get_windowbuttonwheelfcn (void) const { return windowbuttonwheelfcn.get (); }
03021
03022 bool windowstyle_is (const std::string& v) const { return windowstyle.is (v); }
03023 std::string get_windowstyle (void) const { return windowstyle.current_value (); }
03024
03025 std::string get_wvisual (void) const { return wvisual.string_value (); }
03026
03027 bool wvisualmode_is (const std::string& v) const { return wvisualmode.is (v); }
03028 std::string get_wvisualmode (void) const { return wvisualmode.current_value (); }
03029
03030 std::string get_xdisplay (void) const { return xdisplay.string_value (); }
03031
03032 std::string get_xvisual (void) const { return xvisual.string_value (); }
03033
03034 bool xvisualmode_is (const std::string& v) const { return xvisualmode.is (v); }
03035 std::string get_xvisualmode (void) const { return xvisualmode.current_value (); }
03036
03037 void execute_buttondownfcn (const octave_value& data = octave_value ()) const { buttondownfcn.execute (data); }
03038 octave_value get_buttondownfcn (void) const { return buttondownfcn.get (); }
03039
03040 std::string get___backend__ (void) const { return __backend__.string_value (); }
03041
03042
03043 void set___plot_stream__ (const octave_value& val)
03044 {
03045 if (! error_state)
03046 {
03047 if (__plot_stream__.set (val, true))
03048 {
03049 mark_modified ();
03050 }
03051 }
03052 }
03053
03054 void set___enhanced__ (const octave_value& val)
03055 {
03056 if (! error_state)
03057 {
03058 if (__enhanced__.set (val, true))
03059 {
03060 mark_modified ();
03061 }
03062 }
03063 }
03064
03065 void set_nextplot (const octave_value& val)
03066 {
03067 if (! error_state)
03068 {
03069 if (nextplot.set (val, true))
03070 {
03071 mark_modified ();
03072 }
03073 }
03074 }
03075
03076 void set_closerequestfcn (const octave_value& val)
03077 {
03078 if (! error_state)
03079 {
03080 if (closerequestfcn.set (val, true))
03081 {
03082 mark_modified ();
03083 }
03084 }
03085 }
03086
03087 void set_currentaxes (const octave_value& val);
03088
03089 void set_colormap (const octave_value& val)
03090 {
03091 if (! error_state)
03092 {
03093 if (colormap.set (val, true))
03094 {
03095 mark_modified ();
03096 }
03097 }
03098 }
03099
03100 void set_paperorientation (const octave_value& val)
03101 {
03102 if (! error_state)
03103 {
03104 if (paperorientation.set (val, true))
03105 {
03106 mark_modified ();
03107 }
03108 }
03109 }
03110
03111 void set_color (const octave_value& val)
03112 {
03113 if (! error_state)
03114 {
03115 if (color.set (val, true))
03116 {
03117 mark_modified ();
03118 }
03119 }
03120 }
03121
03122 void set_alphamap (const octave_value& val)
03123 {
03124 if (! error_state)
03125 {
03126 if (alphamap.set (val, true))
03127 {
03128 mark_modified ();
03129 }
03130 }
03131 }
03132
03133 void set_currentcharacter (const octave_value& val)
03134 {
03135 if (! error_state)
03136 {
03137 if (currentcharacter.set (val, true))
03138 {
03139 mark_modified ();
03140 }
03141 }
03142 }
03143
03144 void set_currentobject (const octave_value& val)
03145 {
03146 if (! error_state)
03147 {
03148 if (currentobject.set (val, true))
03149 {
03150 mark_modified ();
03151 }
03152 }
03153 }
03154
03155 void set_current_point (const octave_value& val)
03156 {
03157 if (! error_state)
03158 {
03159 if (current_point.set (val, true))
03160 {
03161 mark_modified ();
03162 }
03163 }
03164 }
03165
03166 void set_dockcontrols (const octave_value& val)
03167 {
03168 if (! error_state)
03169 {
03170 if (dockcontrols.set (val, true))
03171 {
03172 mark_modified ();
03173 }
03174 }
03175 }
03176
03177 void set_doublebuffer (const octave_value& val)
03178 {
03179 if (! error_state)
03180 {
03181 if (doublebuffer.set (val, true))
03182 {
03183 mark_modified ();
03184 }
03185 }
03186 }
03187
03188 void set_filename (const octave_value& val)
03189 {
03190 if (! error_state)
03191 {
03192 if (filename.set (val, true))
03193 {
03194 mark_modified ();
03195 }
03196 }
03197 }
03198
03199 void set_integerhandle (const octave_value& val)
03200 {
03201 if (! error_state)
03202 {
03203 if (integerhandle.set (val, true))
03204 {
03205 mark_modified ();
03206 }
03207 }
03208 }
03209
03210 void set_inverthardcopy (const octave_value& val)
03211 {
03212 if (! error_state)
03213 {
03214 if (inverthardcopy.set (val, true))
03215 {
03216 mark_modified ();
03217 }
03218 }
03219 }
03220
03221 void set_keypressfcn (const octave_value& val)
03222 {
03223 if (! error_state)
03224 {
03225 if (keypressfcn.set (val, true))
03226 {
03227 mark_modified ();
03228 }
03229 }
03230 }
03231
03232 void set_keyreleasefcn (const octave_value& val)
03233 {
03234 if (! error_state)
03235 {
03236 if (keyreleasefcn.set (val, true))
03237 {
03238 mark_modified ();
03239 }
03240 }
03241 }
03242
03243 void set_menubar (const octave_value& val)
03244 {
03245 if (! error_state)
03246 {
03247 if (menubar.set (val, true))
03248 {
03249 mark_modified ();
03250 }
03251 }
03252 }
03253
03254 void set_mincolormap (const octave_value& val)
03255 {
03256 if (! error_state)
03257 {
03258 if (mincolormap.set (val, true))
03259 {
03260 mark_modified ();
03261 }
03262 }
03263 }
03264
03265 void set_name (const octave_value& val)
03266 {
03267 if (! error_state)
03268 {
03269 if (name.set (val, true))
03270 {
03271 mark_modified ();
03272 }
03273 }
03274 }
03275
03276 void set_numbertitle (const octave_value& val)
03277 {
03278 if (! error_state)
03279 {
03280 if (numbertitle.set (val, true))
03281 {
03282 mark_modified ();
03283 }
03284 }
03285 }
03286
03287 void set_paperunits (const octave_value& val)
03288 {
03289 if (! error_state)
03290 {
03291 if (paperunits.set (val, true))
03292 {
03293 mark_modified ();
03294 }
03295 }
03296 }
03297
03298 void set_paperposition (const octave_value& val)
03299 {
03300 if (! error_state)
03301 {
03302 if (paperposition.set (val, true))
03303 {
03304 mark_modified ();
03305 }
03306 }
03307 }
03308
03309 void set_paperpositionmode (const octave_value& val)
03310 {
03311 if (! error_state)
03312 {
03313 if (paperpositionmode.set (val, true))
03314 {
03315 mark_modified ();
03316 }
03317 }
03318 }
03319
03320 void set_papersize (const octave_value& val)
03321 {
03322 if (! error_state)
03323 {
03324 if (papersize.set (val, true))
03325 {
03326 mark_modified ();
03327 }
03328 }
03329 }
03330
03331 void set_papertype (const octave_value& val)
03332 {
03333 if (! error_state)
03334 {
03335 if (papertype.set (val, true))
03336 {
03337 mark_modified ();
03338 }
03339 }
03340 }
03341
03342 void set_pointer (const octave_value& val)
03343 {
03344 if (! error_state)
03345 {
03346 if (pointer.set (val, true))
03347 {
03348 mark_modified ();
03349 }
03350 }
03351 }
03352
03353 void set_pointershapecdata (const octave_value& val)
03354 {
03355 if (! error_state)
03356 {
03357 if (pointershapecdata.set (val, true))
03358 {
03359 mark_modified ();
03360 }
03361 }
03362 }
03363
03364 void set_pointershapehotspot (const octave_value& val)
03365 {
03366 if (! error_state)
03367 {
03368 if (pointershapehotspot.set (val, true))
03369 {
03370 mark_modified ();
03371 }
03372 }
03373 }
03374
03375 void set_position (const octave_value& val);
03376
03377 void set_renderer (const octave_value& val)
03378 {
03379 if (! error_state)
03380 {
03381 if (renderer.set (val, true))
03382 {
03383 mark_modified ();
03384 }
03385 }
03386 }
03387
03388 void set_renderermode (const octave_value& val)
03389 {
03390 if (! error_state)
03391 {
03392 if (renderermode.set (val, true))
03393 {
03394 mark_modified ();
03395 }
03396 }
03397 }
03398
03399 void set_resize (const octave_value& val)
03400 {
03401 if (! error_state)
03402 {
03403 if (resize.set (val, true))
03404 {
03405 mark_modified ();
03406 }
03407 }
03408 }
03409
03410 void set_resizefcn (const octave_value& val)
03411 {
03412 if (! error_state)
03413 {
03414 if (resizefcn.set (val, true))
03415 {
03416 mark_modified ();
03417 }
03418 }
03419 }
03420
03421 void set_selectiontype (const octave_value& val)
03422 {
03423 if (! error_state)
03424 {
03425 if (selectiontype.set (val, true))
03426 {
03427 mark_modified ();
03428 }
03429 }
03430 }
03431
03432 void set_toolbar (const octave_value& val)
03433 {
03434 if (! error_state)
03435 {
03436 if (toolbar.set (val, true))
03437 {
03438 mark_modified ();
03439 }
03440 }
03441 }
03442
03443 void set_units (const octave_value& val)
03444 {
03445 if (! error_state)
03446 {
03447 if (units.set (val, true))
03448 {
03449 mark_modified ();
03450 }
03451 }
03452 }
03453
03454 void set_windowbuttondownfcn (const octave_value& val)
03455 {
03456 if (! error_state)
03457 {
03458 if (windowbuttondownfcn.set (val, true))
03459 {
03460 mark_modified ();
03461 }
03462 }
03463 }
03464
03465 void set_windowbuttonmotionfcn (const octave_value& val)
03466 {
03467 if (! error_state)
03468 {
03469 if (windowbuttonmotionfcn.set (val, true))
03470 {
03471 mark_modified ();
03472 }
03473 }
03474 }
03475
03476 void set_windowbuttonupfcn (const octave_value& val)
03477 {
03478 if (! error_state)
03479 {
03480 if (windowbuttonupfcn.set (val, true))
03481 {
03482 mark_modified ();
03483 }
03484 }
03485 }
03486
03487 void set_windowbuttonwheelfcn (const octave_value& val)
03488 {
03489 if (! error_state)
03490 {
03491 if (windowbuttonwheelfcn.set (val, true))
03492 {
03493 mark_modified ();
03494 }
03495 }
03496 }
03497
03498 void set_windowstyle (const octave_value& val)
03499 {
03500 if (! error_state)
03501 {
03502 if (windowstyle.set (val, true))
03503 {
03504 mark_modified ();
03505 }
03506 }
03507 }
03508
03509 void set_wvisual (const octave_value& val)
03510 {
03511 if (! error_state)
03512 {
03513 if (wvisual.set (val, true))
03514 {
03515 mark_modified ();
03516 }
03517 }
03518 }
03519
03520 void set_wvisualmode (const octave_value& val)
03521 {
03522 if (! error_state)
03523 {
03524 if (wvisualmode.set (val, true))
03525 {
03526 mark_modified ();
03527 }
03528 }
03529 }
03530
03531 void set_xdisplay (const octave_value& val)
03532 {
03533 if (! error_state)
03534 {
03535 if (xdisplay.set (val, true))
03536 {
03537 mark_modified ();
03538 }
03539 }
03540 }
03541
03542 void set_xvisual (const octave_value& val)
03543 {
03544 if (! error_state)
03545 {
03546 if (xvisual.set (val, true))
03547 {
03548 mark_modified ();
03549 }
03550 }
03551 }
03552
03553 void set_xvisualmode (const octave_value& val)
03554 {
03555 if (! error_state)
03556 {
03557 if (xvisualmode.set (val, true))
03558 {
03559 mark_modified ();
03560 }
03561 }
03562 }
03563
03564 void set_buttondownfcn (const octave_value& val)
03565 {
03566 if (! error_state)
03567 {
03568 if (buttondownfcn.set (val, true))
03569 {
03570 mark_modified ();
03571 }
03572 }
03573 }
03574
03575
03576 protected:
03577 void init (void)
03578 {
03579 colormap.add_constraint (dim_vector (-1, 3));
03580 alphamap.add_constraint (dim_vector (-1, 1));
03581 paperposition.add_constraint (dim_vector (1, 4));
03582 pointershapecdata.add_constraint (dim_vector (16, 16));
03583 pointershapehotspot.add_constraint (dim_vector (1, 2));
03584 position.add_constraint (dim_vector (1, 4));
03585 }
03586
03587 private:
03588 mutable graphics_backend backend;
03589 };
03590
03591 private:
03592 properties xproperties;
03593
03594 public:
03595 figure (const graphics_handle& mh, const graphics_handle& p)
03596 : base_graphics_object (), xproperties (mh, p), default_properties ()
03597 {
03598 xproperties.override_defaults (*this);
03599 }
03600
03601 ~figure (void)
03602 {
03603 xproperties.delete_children ();
03604 }
03605
03606 void override_defaults (base_graphics_object& obj)
03607 {
03608
03609
03610 xproperties.override_defaults (obj);
03611
03612
03613
03614
03615
03616
03617 obj.set_from_list (default_properties);
03618 }
03619
03620 void set (const caseless_str& name, const octave_value& value)
03621 {
03622 if (name.compare ("default", 7))
03623
03624
03625
03626 default_properties.set (name.substr (7), value);
03627 else
03628 xproperties.set (name, value);
03629 }
03630
03631 octave_value get (const caseless_str& name) const
03632 {
03633 octave_value retval;
03634
03635 if (name.compare ("default", 7))
03636 retval = get_default (name.substr (7));
03637 else
03638 retval = xproperties.get (name);
03639
03640 return retval;
03641 }
03642
03643 octave_value get_default (const caseless_str& name) const;
03644
03645 octave_value get_defaults (void) const
03646 {
03647 return default_properties.as_struct ("default");
03648 }
03649
03650 base_properties& get_properties (void) { return xproperties; }
03651
03652 const base_properties& get_properties (void) const { return xproperties; }
03653
03654 bool valid_object (void) const { return true; }
03655
03656 private:
03657 property_list default_properties;
03658 };
03659
03660
03661
03662 class OCTINTERP_API graphics_xform
03663 {
03664 public:
03665 graphics_xform (void)
03666 : xform (xform_eye ()), xform_inv (xform_eye ())
03667 {
03668 sx = sy = sz = "linear";
03669 }
03670
03671 graphics_xform (const Matrix& xm, const Matrix& xim,
03672 const scaler& x, const scaler& y, const scaler& z)
03673 : xform (xm), xform_inv (xim), sx (x), sy (y), sz (z) { }
03674
03675 graphics_xform (const graphics_xform& g)
03676 : xform (g.xform), xform_inv (g.xform_inv), sx (g.sx),
03677 sy (g.sy), sz (g.sz) { }
03678
03679 ~graphics_xform (void) { }
03680
03681 graphics_xform& operator = (const graphics_xform& g)
03682 {
03683 xform = g.xform;
03684 xform_inv = g.xform_inv;
03685 sx = g.sx;
03686 sy = g.sy;
03687 sz = g.sz;
03688
03689 return *this;
03690 }
03691
03692 static ColumnVector xform_vector (double x, double y, double z);
03693
03694 static Matrix xform_eye (void);
03695
03696 ColumnVector transform (double x, double y, double z,
03697 bool scale = true) const;
03698
03699 ColumnVector untransform (double x, double y, double z,
03700 bool scale = true) const;
03701
03702 Matrix xscale (const Matrix& m) const { return sx.scale (m); }
03703 Matrix yscale (const Matrix& m) const { return sy.scale (m); }
03704 Matrix zscale (const Matrix& m) const { return sz.scale (m); }
03705
03706 Matrix scale (const Matrix& m) const
03707 {
03708 bool has_z = (m.columns () > 2);
03709
03710 if (sx.is_linear () && sy.is_linear ()
03711 && (! has_z || sz.is_linear ()))
03712 return m;
03713
03714 Matrix retval (m.dims ());
03715
03716 int r = m.rows ();
03717
03718 for (int i = 0; i < r; i++)
03719 {
03720 retval(i,0) = sx.scale (m(i,0));
03721 retval(i,1) = sy.scale (m(i,1));
03722 if (has_z)
03723 retval(i,2) = sz.scale (m(i,2));
03724 }
03725
03726 return retval;
03727 }
03728
03729 private:
03730 Matrix xform;
03731 Matrix xform_inv;
03732 scaler sx, sy, sz;
03733 };
03734
03735 class OCTINTERP_API axes : public base_graphics_object
03736 {
03737 public:
03738 class OCTINTERP_API properties : public base_properties
03739 {
03740 public:
03741 void set_defaults (base_graphics_object& obj, const std::string& mode);
03742
03743 void remove_child (const graphics_handle& h);
03744
03745 const scaler& get_x_scaler (void) const { return sx; }
03746 const scaler& get_y_scaler (void) const { return sy; }
03747 const scaler& get_z_scaler (void) const { return sz; }
03748
03749 Matrix get_boundingbox (bool internal = false) const;
03750
03751 void update_boundingbox (void)
03752 {
03753 if (units_is ("normalized"))
03754 {
03755 update_transform ();
03756 base_properties::update_boundingbox ();
03757 }
03758 }
03759
03760 void update_camera (void);
03761 void update_aspectratios (void);
03762 void update_transform (void)
03763 {
03764 update_aspectratios ();
03765 update_camera ();
03766 }
03767
03768 graphics_xform get_transform (void) const
03769 { return graphics_xform (x_render, x_render_inv, sx, sy, sz); }
03770
03771 Matrix get_transform_matrix (void) const { return x_render; }
03772 Matrix get_inverse_transform_matrix (void) const { return x_render_inv; }
03773 Matrix get_opengl_matrix_1 (void) const { return x_gl_mat1; }
03774 Matrix get_opengl_matrix_2 (void) const { return x_gl_mat2; }
03775 Matrix get_transform_zlim (void) const { return x_zlim; }
03776
03777 ColumnVector pixel2coord (double px, double py) const
03778 { return get_transform ().untransform (px, py, (x_zlim(0)+x_zlim(1))/2); }
03779
03780 ColumnVector coord2pixel (double x, double y, double z) const
03781 { return get_transform ().transform (x, y, z); }
03782
03783 void zoom_about_point (double x, double y, double factor,
03784 bool push_to_zoom_stack = true);
03785 void zoom (const Matrix& xl, const Matrix& yl, bool push_to_zoom_stack = true);
03786 void translate_view (double delta_x, double delta_y);
03787 void unzoom (void);
03788 void clear_zoom_stack (void);
03789
03790 private:
03791 scaler sx, sy, sz;
03792 Matrix x_render, x_render_inv;
03793 Matrix x_gl_mat1, x_gl_mat2;
03794 Matrix x_zlim;
03795 std::list<octave_value> zoom_stack;
03796
03797 void set_text_child (handle_property& h, const std::string& who,
03798 const octave_value& v);
03799
03800 void delete_text_child (handle_property& h);
03801
03802
03803
03804
03805
03806
03807 public:
03808 properties (const graphics_handle& mh, const graphics_handle& p);
03809
03810 ~properties (void) { }
03811
03812 void set (const caseless_str& pname, const octave_value& val);
03813
03814 octave_value get (bool all = false) const;
03815
03816 octave_value get (const caseless_str& pname) const;
03817
03818 octave_value get (const std::string& pname) const
03819 {
03820 return get (caseless_str (pname));
03821 }
03822
03823 octave_value get (const char *pname) const
03824 {
03825 return get (caseless_str (pname));
03826 }
03827
03828 property get_property (const caseless_str& pname);
03829
03830 std::string graphics_object_name (void) const { return go_name; }
03831
03832 static property_list::pval_map_type factory_defaults (void);
03833
03834 private:
03835 static std::string go_name;
03836
03837 public:
03838
03839
03840 static std::set<std::string> core_property_names (void);
03841
03842 static bool has_core_property (const caseless_str& pname);
03843
03844 std::set<std::string> all_property_names (void) const;
03845
03846 bool has_property (const caseless_str& pname) const;
03847
03848 private:
03849
03850 array_property position;
03851 bool_property box;
03852 bool_property key;
03853 bool_property keybox;
03854 bool_property keyreverse;
03855 any_property keypos;
03856 array_property colororder;
03857 array_property dataaspectratio;
03858 radio_property dataaspectratiomode;
03859 radio_property layer;
03860 row_vector_property xlim;
03861 row_vector_property ylim;
03862 row_vector_property zlim;
03863 row_vector_property clim;
03864 row_vector_property alim;
03865 radio_property xlimmode;
03866 radio_property ylimmode;
03867 radio_property zlimmode;
03868 radio_property climmode;
03869 radio_property alimmode;
03870 handle_property xlabel;
03871 handle_property ylabel;
03872 handle_property zlabel;
03873 handle_property title;
03874 bool_property xgrid;
03875 bool_property ygrid;
03876 bool_property zgrid;
03877 bool_property xminorgrid;
03878 bool_property yminorgrid;
03879 bool_property zminorgrid;
03880 row_vector_property xtick;
03881 row_vector_property ytick;
03882 row_vector_property ztick;
03883 radio_property xtickmode;
03884 radio_property ytickmode;
03885 radio_property ztickmode;
03886 bool_property xminortick;
03887 bool_property yminortick;
03888 bool_property zminortick;
03889 any_property xticklabel;
03890 any_property yticklabel;
03891 any_property zticklabel;
03892 radio_property xticklabelmode;
03893 radio_property yticklabelmode;
03894 radio_property zticklabelmode;
03895 radio_property interpreter;
03896 color_property color;
03897 color_property xcolor;
03898 color_property ycolor;
03899 color_property zcolor;
03900 radio_property xscale;
03901 radio_property yscale;
03902 radio_property zscale;
03903 radio_property xdir;
03904 radio_property ydir;
03905 radio_property zdir;
03906 radio_property yaxislocation;
03907 radio_property xaxislocation;
03908 array_property view;
03909 radio_property nextplot;
03910 array_property outerposition;
03911 radio_property activepositionproperty;
03912 color_property ambientlightcolor;
03913 array_property cameraposition;
03914 array_property cameratarget;
03915 array_property cameraupvector;
03916 double_property cameraviewangle;
03917 radio_property camerapositionmode;
03918 radio_property cameratargetmode;
03919 radio_property cameraupvectormode;
03920 radio_property cameraviewanglemode;
03921 array_property currentpoint;
03922 radio_property drawmode;
03923 radio_property fontangle;
03924 string_property fontname;
03925 double_property fontsize;
03926 radio_property fontunits;
03927 radio_property fontweight;
03928 radio_property gridlinestyle;
03929 string_property linestyleorder;
03930 double_property linewidth;
03931 radio_property minorgridlinestyle;
03932 array_property plotboxaspectratio;
03933 radio_property plotboxaspectratiomode;
03934 radio_property projection;
03935 radio_property tickdir;
03936 radio_property tickdirmode;
03937 array_property ticklength;
03938 array_property tightinset;
03939 radio_property units;
03940 array_property x_viewtransform;
03941 array_property x_projectiontransform;
03942 array_property x_viewporttransform;
03943 array_property x_normrendertransform;
03944 array_property x_rendertransform;
03945
03946 public:
03947
03948 enum
03949 {
03950 POSITION = 3000,
03951 BOX = 3001,
03952 KEY = 3002,
03953 KEYBOX = 3003,
03954 KEYREVERSE = 3004,
03955 KEYPOS = 3005,
03956 COLORORDER = 3006,
03957 DATAASPECTRATIO = 3007,
03958 DATAASPECTRATIOMODE = 3008,
03959 LAYER = 3009,
03960 XLIM = 3010,
03961 YLIM = 3011,
03962 ZLIM = 3012,
03963 CLIM = 3013,
03964 ALIM = 3014,
03965 XLIMMODE = 3015,
03966 YLIMMODE = 3016,
03967 ZLIMMODE = 3017,
03968 CLIMMODE = 3018,
03969 ALIMMODE = 3019,
03970 XLABEL = 3020,
03971 YLABEL = 3021,
03972 ZLABEL = 3022,
03973 TITLE = 3023,
03974 XGRID = 3024,
03975 YGRID = 3025,
03976 ZGRID = 3026,
03977 XMINORGRID = 3027,
03978 YMINORGRID = 3028,
03979 ZMINORGRID = 3029,
03980 XTICK = 3030,
03981 YTICK = 3031,
03982 ZTICK = 3032,
03983 XTICKMODE = 3033,
03984 YTICKMODE = 3034,
03985 ZTICKMODE = 3035,
03986 XMINORTICK = 3036,
03987 YMINORTICK = 3037,
03988 ZMINORTICK = 3038,
03989 XTICKLABEL = 3039,
03990 YTICKLABEL = 3040,
03991 ZTICKLABEL = 3041,
03992 XTICKLABELMODE = 3042,
03993 YTICKLABELMODE = 3043,
03994 ZTICKLABELMODE = 3044,
03995 INTERPRETER = 3045,
03996 COLOR = 3046,
03997 XCOLOR = 3047,
03998 YCOLOR = 3048,
03999 ZCOLOR = 3049,
04000 XSCALE = 3050,
04001 YSCALE = 3051,
04002 ZSCALE = 3052,
04003 XDIR = 3053,
04004 YDIR = 3054,
04005 ZDIR = 3055,
04006 YAXISLOCATION = 3056,
04007 XAXISLOCATION = 3057,
04008 VIEW = 3058,
04009 NEXTPLOT = 3059,
04010 OUTERPOSITION = 3060,
04011 ACTIVEPOSITIONPROPERTY = 3061,
04012 AMBIENTLIGHTCOLOR = 3062,
04013 CAMERAPOSITION = 3063,
04014 CAMERATARGET = 3064,
04015 CAMERAUPVECTOR = 3065,
04016 CAMERAVIEWANGLE = 3066,
04017 CAMERAPOSITIONMODE = 3067,
04018 CAMERATARGETMODE = 3068,
04019 CAMERAUPVECTORMODE = 3069,
04020 CAMERAVIEWANGLEMODE = 3070,
04021 CURRENTPOINT = 3071,
04022 DRAWMODE = 3072,
04023 FONTANGLE = 3073,
04024 FONTNAME = 3074,
04025 FONTSIZE = 3075,
04026 FONTUNITS = 3076,
04027 FONTWEIGHT = 3077,
04028 GRIDLINESTYLE = 3078,
04029 LINESTYLEORDER = 3079,
04030 LINEWIDTH = 3080,
04031 MINORGRIDLINESTYLE = 3081,
04032 PLOTBOXASPECTRATIO = 3082,
04033 PLOTBOXASPECTRATIOMODE = 3083,
04034 PROJECTION = 3084,
04035 TICKDIR = 3085,
04036 TICKDIRMODE = 3086,
04037 TICKLENGTH = 3087,
04038 TIGHTINSET = 3088,
04039 UNITS = 3089,
04040 X_VIEWTRANSFORM = 3090,
04041 X_PROJECTIONTRANSFORM = 3091,
04042 X_VIEWPORTTRANSFORM = 3092,
04043 X_NORMRENDERTRANSFORM = 3093,
04044 X_RENDERTRANSFORM = 3094
04045 };
04046
04047 octave_value get_position (void) const { return position.get (); }
04048
04049 bool is_box (void) const { return box.is_on (); }
04050 std::string get_box (void) const { return box.current_value (); }
04051
04052 bool is_key (void) const { return key.is_on (); }
04053 std::string get_key (void) const { return key.current_value (); }
04054
04055 bool is_keybox (void) const { return keybox.is_on (); }
04056 std::string get_keybox (void) const { return keybox.current_value (); }
04057
04058 bool is_keyreverse (void) const { return keyreverse.is_on (); }
04059 std::string get_keyreverse (void) const { return keyreverse.current_value (); }
04060
04061 octave_value get_keypos (void) const { return keypos.get (); }
04062
04063 octave_value get_colororder (void) const { return colororder.get (); }
04064
04065 octave_value get_dataaspectratio (void) const { return dataaspectratio.get (); }
04066
04067 bool dataaspectratiomode_is (const std::string& v) const { return dataaspectratiomode.is (v); }
04068 std::string get_dataaspectratiomode (void) const { return dataaspectratiomode.current_value (); }
04069
04070 bool layer_is (const std::string& v) const { return layer.is (v); }
04071 std::string get_layer (void) const { return layer.current_value (); }
04072
04073 octave_value get_xlim (void) const { return xlim.get (); }
04074
04075 octave_value get_ylim (void) const { return ylim.get (); }
04076
04077 octave_value get_zlim (void) const { return zlim.get (); }
04078
04079 octave_value get_clim (void) const { return clim.get (); }
04080
04081 octave_value get_alim (void) const { return alim.get (); }
04082
04083 bool xlimmode_is (const std::string& v) const { return xlimmode.is (v); }
04084 std::string get_xlimmode (void) const { return xlimmode.current_value (); }
04085
04086 bool ylimmode_is (const std::string& v) const { return ylimmode.is (v); }
04087 std::string get_ylimmode (void) const { return ylimmode.current_value (); }
04088
04089 bool zlimmode_is (const std::string& v) const { return zlimmode.is (v); }
04090 std::string get_zlimmode (void) const { return zlimmode.current_value (); }
04091
04092 bool climmode_is (const std::string& v) const { return climmode.is (v); }
04093 std::string get_climmode (void) const { return climmode.current_value (); }
04094
04095 bool alimmode_is (const std::string& v) const { return alimmode.is (v); }
04096 std::string get_alimmode (void) const { return alimmode.current_value (); }
04097
04098 graphics_handle get_xlabel (void) const { return xlabel.handle_value (); }
04099
04100 graphics_handle get_ylabel (void) const { return ylabel.handle_value (); }
04101
04102 graphics_handle get_zlabel (void) const { return zlabel.handle_value (); }
04103
04104 graphics_handle get_title (void) const { return title.handle_value (); }
04105
04106 bool is_xgrid (void) const { return xgrid.is_on (); }
04107 std::string get_xgrid (void) const { return xgrid.current_value (); }
04108
04109 bool is_ygrid (void) const { return ygrid.is_on (); }
04110 std::string get_ygrid (void) const { return ygrid.current_value (); }
04111
04112 bool is_zgrid (void) const { return zgrid.is_on (); }
04113 std::string get_zgrid (void) const { return zgrid.current_value (); }
04114
04115 bool is_xminorgrid (void) const { return xminorgrid.is_on (); }
04116 std::string get_xminorgrid (void) const { return xminorgrid.current_value (); }
04117
04118 bool is_yminorgrid (void) const { return yminorgrid.is_on (); }
04119 std::string get_yminorgrid (void) const { return yminorgrid.current_value (); }
04120
04121 bool is_zminorgrid (void) const { return zminorgrid.is_on (); }
04122 std::string get_zminorgrid (void) const { return zminorgrid.current_value (); }
04123
04124 octave_value get_xtick (void) const { return xtick.get (); }
04125
04126 octave_value get_ytick (void) const { return ytick.get (); }
04127
04128 octave_value get_ztick (void) const { return ztick.get (); }
04129
04130 bool xtickmode_is (const std::string& v) const { return xtickmode.is (v); }
04131 std::string get_xtickmode (void) const { return xtickmode.current_value (); }
04132
04133 bool ytickmode_is (const std::string& v) const { return ytickmode.is (v); }
04134 std::string get_ytickmode (void) const { return ytickmode.current_value (); }
04135
04136 bool ztickmode_is (const std::string& v) const { return ztickmode.is (v); }
04137 std::string get_ztickmode (void) const { return ztickmode.current_value (); }
04138
04139 bool is_xminortick (void) const { return xminortick.is_on (); }
04140 std::string get_xminortick (void) const { return xminortick.current_value (); }
04141
04142 bool is_yminortick (void) const { return yminortick.is_on (); }
04143 std::string get_yminortick (void) const { return yminortick.current_value (); }
04144
04145 bool is_zminortick (void) const { return zminortick.is_on (); }
04146 std::string get_zminortick (void) const { return zminortick.current_value (); }
04147
04148 octave_value get_xticklabel (void) const { return xticklabel.get (); }
04149
04150 octave_value get_yticklabel (void) const { return yticklabel.get (); }
04151
04152 octave_value get_zticklabel (void) const { return zticklabel.get (); }
04153
04154 bool xticklabelmode_is (const std::string& v) const { return xticklabelmode.is (v); }
04155 std::string get_xticklabelmode (void) const { return xticklabelmode.current_value (); }
04156
04157 bool yticklabelmode_is (const std::string& v) const { return yticklabelmode.is (v); }
04158 std::string get_yticklabelmode (void) const { return yticklabelmode.current_value (); }
04159
04160 bool zticklabelmode_is (const std::string& v) const { return zticklabelmode.is (v); }
04161 std::string get_zticklabelmode (void) const { return zticklabelmode.current_value (); }
04162
04163 bool interpreter_is (const std::string& v) const { return interpreter.is (v); }
04164 std::string get_interpreter (void) const { return interpreter.current_value (); }
04165
04166 bool color_is_rgb (void) const { return color.is_rgb (); }
04167 bool color_is (const std::string& v) const { return color.is (v); }
04168 Matrix get_color_rgb (void) const { return (color.is_rgb () ? color.rgb () : Matrix ()); }
04169 octave_value get_color (void) const { return color.get (); }
04170
04171 bool xcolor_is_rgb (void) const { return xcolor.is_rgb (); }
04172 bool xcolor_is (const std::string& v) const { return xcolor.is (v); }
04173 Matrix get_xcolor_rgb (void) const { return (xcolor.is_rgb () ? xcolor.rgb () : Matrix ()); }
04174 octave_value get_xcolor (void) const { return xcolor.get (); }
04175
04176 bool ycolor_is_rgb (void) const { return ycolor.is_rgb (); }
04177 bool ycolor_is (const std::string& v) const { return ycolor.is (v); }
04178 Matrix get_ycolor_rgb (void) const { return (ycolor.is_rgb () ? ycolor.rgb () : Matrix ()); }
04179 octave_value get_ycolor (void) const { return ycolor.get (); }
04180
04181 bool zcolor_is_rgb (void) const { return zcolor.is_rgb (); }
04182 bool zcolor_is (const std::string& v) const { return zcolor.is (v); }
04183 Matrix get_zcolor_rgb (void) const { return (zcolor.is_rgb () ? zcolor.rgb () : Matrix ()); }
04184 octave_value get_zcolor (void) const { return zcolor.get (); }
04185
04186 bool xscale_is (const std::string& v) const { return xscale.is (v); }
04187 std::string get_xscale (void) const { return xscale.current_value (); }
04188
04189 bool yscale_is (const std::string& v) const { return yscale.is (v); }
04190 std::string get_yscale (void) const { return yscale.current_value (); }
04191
04192 bool zscale_is (const std::string& v) const { return zscale.is (v); }
04193 std::string get_zscale (void) const { return zscale.current_value (); }
04194
04195 bool xdir_is (const std::string& v) const { return xdir.is (v); }
04196 std::string get_xdir (void) const { return xdir.current_value (); }
04197
04198 bool ydir_is (const std::string& v) const { return ydir.is (v); }
04199 std::string get_ydir (void) const { return ydir.current_value (); }
04200
04201 bool zdir_is (const std::string& v) const { return zdir.is (v); }
04202 std::string get_zdir (void) const { return zdir.current_value (); }
04203
04204 bool yaxislocation_is (const std::string& v) const { return yaxislocation.is (v); }
04205 std::string get_yaxislocation (void) const { return yaxislocation.current_value (); }
04206
04207 bool xaxislocation_is (const std::string& v) const { return xaxislocation.is (v); }
04208 std::string get_xaxislocation (void) const { return xaxislocation.current_value (); }
04209
04210 octave_value get_view (void) const { return view.get (); }
04211
04212 bool nextplot_is (const std::string& v) const { return nextplot.is (v); }
04213 std::string get_nextplot (void) const { return nextplot.current_value (); }
04214
04215 octave_value get_outerposition (void) const { return outerposition.get (); }
04216
04217 bool activepositionproperty_is (const std::string& v) const { return activepositionproperty.is (v); }
04218 std::string get_activepositionproperty (void) const { return activepositionproperty.current_value (); }
04219
04220 bool ambientlightcolor_is_rgb (void) const { return ambientlightcolor.is_rgb (); }
04221 bool ambientlightcolor_is (const std::string& v) const { return ambientlightcolor.is (v); }
04222 Matrix get_ambientlightcolor_rgb (void) const { return (ambientlightcolor.is_rgb () ? ambientlightcolor.rgb () : Matrix ()); }
04223 octave_value get_ambientlightcolor (void) const { return ambientlightcolor.get (); }
04224
04225 octave_value get_cameraposition (void) const { return cameraposition.get (); }
04226
04227 octave_value get_cameratarget (void) const { return cameratarget.get (); }
04228
04229 octave_value get_cameraupvector (void) const { return cameraupvector.get (); }
04230
04231 double get_cameraviewangle (void) const { return cameraviewangle.double_value (); }
04232
04233 bool camerapositionmode_is (const std::string& v) const { return camerapositionmode.is (v); }
04234 std::string get_camerapositionmode (void) const { return camerapositionmode.current_value (); }
04235
04236 bool cameratargetmode_is (const std::string& v) const { return cameratargetmode.is (v); }
04237 std::string get_cameratargetmode (void) const { return cameratargetmode.current_value (); }
04238
04239 bool cameraupvectormode_is (const std::string& v) const { return cameraupvectormode.is (v); }
04240 std::string get_cameraupvectormode (void) const { return cameraupvectormode.current_value (); }
04241
04242 bool cameraviewanglemode_is (const std::string& v) const { return cameraviewanglemode.is (v); }
04243 std::string get_cameraviewanglemode (void) const { return cameraviewanglemode.current_value (); }
04244
04245 octave_value get_currentpoint (void) const { return currentpoint.get (); }
04246
04247 bool drawmode_is (const std::string& v) const { return drawmode.is (v); }
04248 std::string get_drawmode (void) const { return drawmode.current_value (); }
04249
04250 bool fontangle_is (const std::string& v) const { return fontangle.is (v); }
04251 std::string get_fontangle (void) const { return fontangle.current_value (); }
04252
04253 std::string get_fontname (void) const { return fontname.string_value (); }
04254
04255 double get_fontsize (void) const { return fontsize.double_value (); }
04256
04257 bool fontunits_is (const std::string& v) const { return fontunits.is (v); }
04258 std::string get_fontunits (void) const { return fontunits.current_value (); }
04259
04260 bool fontweight_is (const std::string& v) const { return fontweight.is (v); }
04261 std::string get_fontweight (void) const { return fontweight.current_value (); }
04262
04263 bool gridlinestyle_is (const std::string& v) const { return gridlinestyle.is (v); }
04264 std::string get_gridlinestyle (void) const { return gridlinestyle.current_value (); }
04265
04266 std::string get_linestyleorder (void) const { return linestyleorder.string_value (); }
04267
04268 double get_linewidth (void) const { return linewidth.double_value (); }
04269
04270 bool minorgridlinestyle_is (const std::string& v) const { return minorgridlinestyle.is (v); }
04271 std::string get_minorgridlinestyle (void) const { return minorgridlinestyle.current_value (); }
04272
04273 octave_value get_plotboxaspectratio (void) const { return plotboxaspectratio.get (); }
04274
04275 bool plotboxaspectratiomode_is (const std::string& v) const { return plotboxaspectratiomode.is (v); }
04276 std::string get_plotboxaspectratiomode (void) const { return plotboxaspectratiomode.current_value (); }
04277
04278 bool projection_is (const std::string& v) const { return projection.is (v); }
04279 std::string get_projection (void) const { return projection.current_value (); }
04280
04281 bool tickdir_is (const std::string& v) const { return tickdir.is (v); }
04282 std::string get_tickdir (void) const { return tickdir.current_value (); }
04283
04284 bool tickdirmode_is (const std::string& v) const { return tickdirmode.is (v); }
04285 std::string get_tickdirmode (void) const { return tickdirmode.current_value (); }
04286
04287 octave_value get_ticklength (void) const { return ticklength.get (); }
04288
04289 octave_value get_tightinset (void) const { return tightinset.get (); }
04290
04291 bool units_is (const std::string& v) const { return units.is (v); }
04292 std::string get_units (void) const { return units.current_value (); }
04293
04294 octave_value get_x_viewtransform (void) const { return x_viewtransform.get (); }
04295
04296 octave_value get_x_projectiontransform (void) const { return x_projectiontransform.get (); }
04297
04298 octave_value get_x_viewporttransform (void) const { return x_viewporttransform.get (); }
04299
04300 octave_value get_x_normrendertransform (void) const { return x_normrendertransform.get (); }
04301
04302 octave_value get_x_rendertransform (void) const { return x_rendertransform.get (); }
04303
04304
04305 void set_position (const octave_value& val)
04306 {
04307 if (! error_state)
04308 {
04309 if (position.set (val, true))
04310 {
04311 update_position ();
04312 mark_modified ();
04313 }
04314 }
04315 }
04316
04317 void set_box (const octave_value& val)
04318 {
04319 if (! error_state)
04320 {
04321 if (box.set (val, true))
04322 {
04323 mark_modified ();
04324 }
04325 }
04326 }
04327
04328 void set_key (const octave_value& val)
04329 {
04330 if (! error_state)
04331 {
04332 if (key.set (val, true))
04333 {
04334 mark_modified ();
04335 }
04336 }
04337 }
04338
04339 void set_keybox (const octave_value& val)
04340 {
04341 if (! error_state)
04342 {
04343 if (keybox.set (val, true))
04344 {
04345 mark_modified ();
04346 }
04347 }
04348 }
04349
04350 void set_keyreverse (const octave_value& val)
04351 {
04352 if (! error_state)
04353 {
04354 if (keyreverse.set (val, true))
04355 {
04356 mark_modified ();
04357 }
04358 }
04359 }
04360
04361 void set_keypos (const octave_value& val)
04362 {
04363 if (! error_state)
04364 {
04365 if (keypos.set (val, true))
04366 {
04367 mark_modified ();
04368 }
04369 }
04370 }
04371
04372 void set_colororder (const octave_value& val)
04373 {
04374 if (! error_state)
04375 {
04376 if (colororder.set (val, true))
04377 {
04378 mark_modified ();
04379 }
04380 }
04381 }
04382
04383 void set_dataaspectratio (const octave_value& val)
04384 {
04385 if (! error_state)
04386 {
04387 if (dataaspectratio.set (val, false))
04388 {
04389 set_dataaspectratiomode ("manual");
04390 dataaspectratio.run_listeners (POSTSET);
04391 mark_modified ();
04392 }
04393 else
04394 set_dataaspectratiomode ("manual");
04395 }
04396 }
04397
04398 void set_dataaspectratiomode (const octave_value& val)
04399 {
04400 if (! error_state)
04401 {
04402 if (dataaspectratiomode.set (val, true))
04403 {
04404 mark_modified ();
04405 }
04406 }
04407 }
04408
04409 void set_layer (const octave_value& val)
04410 {
04411 if (! error_state)
04412 {
04413 if (layer.set (val, true))
04414 {
04415 mark_modified ();
04416 }
04417 }
04418 }
04419
04420 void set_xlim (const octave_value& val)
04421 {
04422 if (! error_state)
04423 {
04424 if (xlim.set (val, false))
04425 {
04426 set_xlimmode ("manual");
04427 update_xlim ();
04428 xlim.run_listeners (POSTSET);
04429 mark_modified ();
04430 }
04431 else
04432 set_xlimmode ("manual");
04433 }
04434 }
04435
04436 void set_ylim (const octave_value& val)
04437 {
04438 if (! error_state)
04439 {
04440 if (ylim.set (val, false))
04441 {
04442 set_ylimmode ("manual");
04443 update_ylim ();
04444 ylim.run_listeners (POSTSET);
04445 mark_modified ();
04446 }
04447 else
04448 set_ylimmode ("manual");
04449 }
04450 }
04451
04452 void set_zlim (const octave_value& val)
04453 {
04454 if (! error_state)
04455 {
04456 if (zlim.set (val, false))
04457 {
04458 set_zlimmode ("manual");
04459 update_zlim ();
04460 zlim.run_listeners (POSTSET);
04461 mark_modified ();
04462 }
04463 else
04464 set_zlimmode ("manual");
04465 }
04466 }
04467
04468 void set_clim (const octave_value& val)
04469 {
04470 if (! error_state)
04471 {
04472 if (clim.set (val, false))
04473 {
04474 set_climmode ("manual");
04475 clim.run_listeners (POSTSET);
04476 mark_modified ();
04477 }
04478 else
04479 set_climmode ("manual");
04480 }
04481 }
04482
04483 void set_alim (const octave_value& val)
04484 {
04485 if (! error_state)
04486 {
04487 if (alim.set (val, false))
04488 {
04489 set_alimmode ("manual");
04490 alim.run_listeners (POSTSET);
04491 mark_modified ();
04492 }
04493 else
04494 set_alimmode ("manual");
04495 }
04496 }
04497
04498 void set_xlimmode (const octave_value& val)
04499 {
04500 if (! error_state)
04501 {
04502 if (xlimmode.set (val, false))
04503 {
04504 update_axis_limits ("xlimmode");
04505 xlimmode.run_listeners (POSTSET);
04506 mark_modified ();
04507 }
04508 }
04509 }
04510
04511 void set_ylimmode (const octave_value& val)
04512 {
04513 if (! error_state)
04514 {
04515 if (ylimmode.set (val, false))
04516 {
04517 update_axis_limits ("ylimmode");
04518 ylimmode.run_listeners (POSTSET);
04519 mark_modified ();
04520 }
04521 }
04522 }
04523
04524 void set_zlimmode (const octave_value& val)
04525 {
04526 if (! error_state)
04527 {
04528 if (zlimmode.set (val, false))
04529 {
04530 update_axis_limits ("zlimmode");
04531 zlimmode.run_listeners (POSTSET);
04532 mark_modified ();
04533 }
04534 }
04535 }
04536
04537 void set_climmode (const octave_value& val)
04538 {
04539 if (! error_state)
04540 {
04541 if (climmode.set (val, false))
04542 {
04543 update_axis_limits ("climmode");
04544 climmode.run_listeners (POSTSET);
04545 mark_modified ();
04546 }
04547 }
04548 }
04549
04550 void set_alimmode (const octave_value& val)
04551 {
04552 if (! error_state)
04553 {
04554 if (alimmode.set (val, true))
04555 {
04556 mark_modified ();
04557 }
04558 }
04559 }
04560
04561 void set_xlabel (const octave_value& val);
04562
04563 void set_ylabel (const octave_value& val);
04564
04565 void set_zlabel (const octave_value& val);
04566
04567 void set_title (const octave_value& val);
04568
04569 void set_xgrid (const octave_value& val)
04570 {
04571 if (! error_state)
04572 {
04573 if (xgrid.set (val, true))
04574 {
04575 mark_modified ();
04576 }
04577 }
04578 }
04579
04580 void set_ygrid (const octave_value& val)
04581 {
04582 if (! error_state)
04583 {
04584 if (ygrid.set (val, true))
04585 {
04586 mark_modified ();
04587 }
04588 }
04589 }
04590
04591 void set_zgrid (const octave_value& val)
04592 {
04593 if (! error_state)
04594 {
04595 if (zgrid.set (val, true))
04596 {
04597 mark_modified ();
04598 }
04599 }
04600 }
04601
04602 void set_xminorgrid (const octave_value& val)
04603 {
04604 if (! error_state)
04605 {
04606 if (xminorgrid.set (val, true))
04607 {
04608 mark_modified ();
04609 }
04610 }
04611 }
04612
04613 void set_yminorgrid (const octave_value& val)
04614 {
04615 if (! error_state)
04616 {
04617 if (yminorgrid.set (val, true))
04618 {
04619 mark_modified ();
04620 }
04621 }
04622 }
04623
04624 void set_zminorgrid (const octave_value& val)
04625 {
04626 if (! error_state)
04627 {
04628 if (zminorgrid.set (val, true))
04629 {
04630 mark_modified ();
04631 }
04632 }
04633 }
04634
04635 void set_xtick (const octave_value& val)
04636 {
04637 if (! error_state)
04638 {
04639 if (xtick.set (val, false))
04640 {
04641 set_xtickmode ("manual");
04642 update_xtick ();
04643 xtick.run_listeners (POSTSET);
04644 mark_modified ();
04645 }
04646 else
04647 set_xtickmode ("manual");
04648 }
04649 }
04650
04651 void set_ytick (const octave_value& val)
04652 {
04653 if (! error_state)
04654 {
04655 if (ytick.set (val, false))
04656 {
04657 set_ytickmode ("manual");
04658 update_ytick ();
04659 ytick.run_listeners (POSTSET);
04660 mark_modified ();
04661 }
04662 else
04663 set_ytickmode ("manual");
04664 }
04665 }
04666
04667 void set_ztick (const octave_value& val)
04668 {
04669 if (! error_state)
04670 {
04671 if (ztick.set (val, false))
04672 {
04673 set_ztickmode ("manual");
04674 update_ztick ();
04675 ztick.run_listeners (POSTSET);
04676 mark_modified ();
04677 }
04678 else
04679 set_ztickmode ("manual");
04680 }
04681 }
04682
04683 void set_xtickmode (const octave_value& val)
04684 {
04685 if (! error_state)
04686 {
04687 if (xtickmode.set (val, true))
04688 {
04689 mark_modified ();
04690 }
04691 }
04692 }
04693
04694 void set_ytickmode (const octave_value& val)
04695 {
04696 if (! error_state)
04697 {
04698 if (ytickmode.set (val, true))
04699 {
04700 mark_modified ();
04701 }
04702 }
04703 }
04704
04705 void set_ztickmode (const octave_value& val)
04706 {
04707 if (! error_state)
04708 {
04709 if (ztickmode.set (val, true))
04710 {
04711 mark_modified ();
04712 }
04713 }
04714 }
04715
04716 void set_xminortick (const octave_value& val)
04717 {
04718 if (! error_state)
04719 {
04720 if (xminortick.set (val, true))
04721 {
04722 mark_modified ();
04723 }
04724 }
04725 }
04726
04727 void set_yminortick (const octave_value& val)
04728 {
04729 if (! error_state)
04730 {
04731 if (yminortick.set (val, true))
04732 {
04733 mark_modified ();
04734 }
04735 }
04736 }
04737
04738 void set_zminortick (const octave_value& val)
04739 {
04740 if (! error_state)
04741 {
04742 if (zminortick.set (val, true))
04743 {
04744 mark_modified ();
04745 }
04746 }
04747 }
04748
04749 void set_xticklabel (const octave_value& val)
04750 {
04751 if (! error_state)
04752 {
04753 if (xticklabel.set (val, false))
04754 {
04755 set_xticklabelmode ("manual");
04756 xticklabel.run_listeners (POSTSET);
04757 mark_modified ();
04758 }
04759 else
04760 set_xticklabelmode ("manual");
04761 }
04762 }
04763
04764 void set_yticklabel (const octave_value& val)
04765 {
04766 if (! error_state)
04767 {
04768 if (yticklabel.set (val, false))
04769 {
04770 set_yticklabelmode ("manual");
04771 yticklabel.run_listeners (POSTSET);
04772 mark_modified ();
04773 }
04774 else
04775 set_yticklabelmode ("manual");
04776 }
04777 }
04778
04779 void set_zticklabel (const octave_value& val)
04780 {
04781 if (! error_state)
04782 {
04783 if (zticklabel.set (val, false))
04784 {
04785 set_zticklabelmode ("manual");
04786 zticklabel.run_listeners (POSTSET);
04787 mark_modified ();
04788 }
04789 else
04790 set_zticklabelmode ("manual");
04791 }
04792 }
04793
04794 void set_xticklabelmode (const octave_value& val)
04795 {
04796 if (! error_state)
04797 {
04798 if (xticklabelmode.set (val, true))
04799 {
04800 update_xticklabelmode ();
04801 mark_modified ();
04802 }
04803 }
04804 }
04805
04806 void set_yticklabelmode (const octave_value& val)
04807 {
04808 if (! error_state)
04809 {
04810 if (yticklabelmode.set (val, true))
04811 {
04812 update_yticklabelmode ();
04813 mark_modified ();
04814 }
04815 }
04816 }
04817
04818 void set_zticklabelmode (const octave_value& val)
04819 {
04820 if (! error_state)
04821 {
04822 if (zticklabelmode.set (val, true))
04823 {
04824 update_zticklabelmode ();
04825 mark_modified ();
04826 }
04827 }
04828 }
04829
04830 void set_interpreter (const octave_value& val)
04831 {
04832 if (! error_state)
04833 {
04834 if (interpreter.set (val, true))
04835 {
04836 mark_modified ();
04837 }
04838 }
04839 }
04840
04841 void set_color (const octave_value& val)
04842 {
04843 if (! error_state)
04844 {
04845 if (color.set (val, true))
04846 {
04847 mark_modified ();
04848 }
04849 }
04850 }
04851
04852 void set_xcolor (const octave_value& val)
04853 {
04854 if (! error_state)
04855 {
04856 if (xcolor.set (val, true))
04857 {
04858 mark_modified ();
04859 }
04860 }
04861 }
04862
04863 void set_ycolor (const octave_value& val)
04864 {
04865 if (! error_state)
04866 {
04867 if (ycolor.set (val, true))
04868 {
04869 mark_modified ();
04870 }
04871 }
04872 }
04873
04874 void set_zcolor (const octave_value& val)
04875 {
04876 if (! error_state)
04877 {
04878 if (zcolor.set (val, true))
04879 {
04880 mark_modified ();
04881 }
04882 }
04883 }
04884
04885 void set_xscale (const octave_value& val)
04886 {
04887 if (! error_state)
04888 {
04889 if (xscale.set (val, false))
04890 {
04891 update_xscale ();
04892 update_axis_limits ("xscale");
04893 xscale.run_listeners (POSTSET);
04894 mark_modified ();
04895 }
04896 }
04897 }
04898
04899 void set_yscale (const octave_value& val)
04900 {
04901 if (! error_state)
04902 {
04903 if (yscale.set (val, false))
04904 {
04905 update_yscale ();
04906 update_axis_limits ("yscale");
04907 yscale.run_listeners (POSTSET);
04908 mark_modified ();
04909 }
04910 }
04911 }
04912
04913 void set_zscale (const octave_value& val)
04914 {
04915 if (! error_state)
04916 {
04917 if (zscale.set (val, false))
04918 {
04919 update_zscale ();
04920 update_axis_limits ("zscale");
04921 zscale.run_listeners (POSTSET);
04922 mark_modified ();
04923 }
04924 }
04925 }
04926
04927 void set_xdir (const octave_value& val)
04928 {
04929 if (! error_state)
04930 {
04931 if (xdir.set (val, true))
04932 {
04933 update_xdir ();
04934 mark_modified ();
04935 }
04936 }
04937 }
04938
04939 void set_ydir (const octave_value& val)
04940 {
04941 if (! error_state)
04942 {
04943 if (ydir.set (val, true))
04944 {
04945 update_ydir ();
04946 mark_modified ();
04947 }
04948 }
04949 }
04950
04951 void set_zdir (const octave_value& val)
04952 {
04953 if (! error_state)
04954 {
04955 if (zdir.set (val, true))
04956 {
04957 update_zdir ();
04958 mark_modified ();
04959 }
04960 }
04961 }
04962
04963 void set_yaxislocation (const octave_value& val)
04964 {
04965 if (! error_state)
04966 {
04967 if (yaxislocation.set (val, true))
04968 {
04969 mark_modified ();
04970 }
04971 }
04972 }
04973
04974 void set_xaxislocation (const octave_value& val)
04975 {
04976 if (! error_state)
04977 {
04978 if (xaxislocation.set (val, true))
04979 {
04980 mark_modified ();
04981 }
04982 }
04983 }
04984
04985 void set_view (const octave_value& val)
04986 {
04987 if (! error_state)
04988 {
04989 if (view.set (val, true))
04990 {
04991 update_view ();
04992 mark_modified ();
04993 }
04994 }
04995 }
04996
04997 void set_nextplot (const octave_value& val)
04998 {
04999 if (! error_state)
05000 {
05001 if (nextplot.set (val, true))
05002 {
05003 mark_modified ();
05004 }
05005 }
05006 }
05007
05008 void set_outerposition (const octave_value& val)
05009 {
05010 if (! error_state)
05011 {
05012 if (outerposition.set (val, true))
05013 {
05014 update_outerposition ();
05015 mark_modified ();
05016 }
05017 }
05018 }
05019
05020 void set_activepositionproperty (const octave_value& val)
05021 {
05022 if (! error_state)
05023 {
05024 if (activepositionproperty.set (val, true))
05025 {
05026 mark_modified ();
05027 }
05028 }
05029 }
05030
05031 void set_ambientlightcolor (const octave_value& val)
05032 {
05033 if (! error_state)
05034 {
05035 if (ambientlightcolor.set (val, true))
05036 {
05037 mark_modified ();
05038 }
05039 }
05040 }
05041
05042 void set_cameraposition (const octave_value& val)
05043 {
05044 if (! error_state)
05045 {
05046 if (cameraposition.set (val, false))
05047 {
05048 set_camerapositionmode ("manual");
05049 cameraposition.run_listeners (POSTSET);
05050 mark_modified ();
05051 }
05052 else
05053 set_camerapositionmode ("manual");
05054 }
05055 }
05056
05057 void set_cameratarget (const octave_value& val)
05058 {
05059 if (! error_state)
05060 {
05061 if (cameratarget.set (val, false))
05062 {
05063 set_cameratargetmode ("manual");
05064 cameratarget.run_listeners (POSTSET);
05065 mark_modified ();
05066 }
05067 else
05068 set_cameratargetmode ("manual");
05069 }
05070 }
05071
05072 void set_cameraupvector (const octave_value& val)
05073 {
05074 if (! error_state)
05075 {
05076 if (cameraupvector.set (val, false))
05077 {
05078 set_cameraupvectormode ("manual");
05079 cameraupvector.run_listeners (POSTSET);
05080 mark_modified ();
05081 }
05082 else
05083 set_cameraupvectormode ("manual");
05084 }
05085 }
05086
05087 void set_cameraviewangle (const octave_value& val)
05088 {
05089 if (! error_state)
05090 {
05091 if (cameraviewangle.set (val, false))
05092 {
05093 set_cameraviewanglemode ("manual");
05094 cameraviewangle.run_listeners (POSTSET);
05095 mark_modified ();
05096 }
05097 else
05098 set_cameraviewanglemode ("manual");
05099 }
05100 }
05101
05102 void set_camerapositionmode (const octave_value& val)
05103 {
05104 if (! error_state)
05105 {
05106 if (camerapositionmode.set (val, true))
05107 {
05108 mark_modified ();
05109 }
05110 }
05111 }
05112
05113 void set_cameratargetmode (const octave_value& val)
05114 {
05115 if (! error_state)
05116 {
05117 if (cameratargetmode.set (val, true))
05118 {
05119 mark_modified ();
05120 }
05121 }
05122 }
05123
05124 void set_cameraupvectormode (const octave_value& val)
05125 {
05126 if (! error_state)
05127 {
05128 if (cameraupvectormode.set (val, true))
05129 {
05130 mark_modified ();
05131 }
05132 }
05133 }
05134
05135 void set_cameraviewanglemode (const octave_value& val)
05136 {
05137 if (! error_state)
05138 {
05139 if (cameraviewanglemode.set (val, true))
05140 {
05141 mark_modified ();
05142 }
05143 }
05144 }
05145
05146 void set_currentpoint (const octave_value& val)
05147 {
05148 if (! error_state)
05149 {
05150 if (currentpoint.set (val, true))
05151 {
05152 mark_modified ();
05153 }
05154 }
05155 }
05156
05157 void set_drawmode (const octave_value& val)
05158 {
05159 if (! error_state)
05160 {
05161 if (drawmode.set (val, true))
05162 {
05163 mark_modified ();
05164 }
05165 }
05166 }
05167
05168 void set_fontangle (const octave_value& val)
05169 {
05170 if (! error_state)
05171 {
05172 if (fontangle.set (val, true))
05173 {
05174 mark_modified ();
05175 }
05176 }
05177 }
05178
05179 void set_fontname (const octave_value& val)
05180 {
05181 if (! error_state)
05182 {
05183 if (fontname.set (val, true))
05184 {
05185 mark_modified ();
05186 }
05187 }
05188 }
05189
05190 void set_fontsize (const octave_value& val)
05191 {
05192 if (! error_state)
05193 {
05194 if (fontsize.set (val, true))
05195 {
05196 mark_modified ();
05197 }
05198 }
05199 }
05200
05201 void set_fontunits (const octave_value& val)
05202 {
05203 if (! error_state)
05204 {
05205 if (fontunits.set (val, true))
05206 {
05207 mark_modified ();
05208 }
05209 }
05210 }
05211
05212 void set_fontweight (const octave_value& val)
05213 {
05214 if (! error_state)
05215 {
05216 if (fontweight.set (val, true))
05217 {
05218 mark_modified ();
05219 }
05220 }
05221 }
05222
05223 void set_gridlinestyle (const octave_value& val)
05224 {
05225 if (! error_state)
05226 {
05227 if (gridlinestyle.set (val, true))
05228 {
05229 mark_modified ();
05230 }
05231 }
05232 }
05233
05234 void set_linestyleorder (const octave_value& val)
05235 {
05236 if (! error_state)
05237 {
05238 if (linestyleorder.set (val, true))
05239 {
05240 mark_modified ();
05241 }
05242 }
05243 }
05244
05245 void set_linewidth (const octave_value& val)
05246 {
05247 if (! error_state)
05248 {
05249 if (linewidth.set (val, true))
05250 {
05251 mark_modified ();
05252 }
05253 }
05254 }
05255
05256 void set_minorgridlinestyle (const octave_value& val)
05257 {
05258 if (! error_state)
05259 {
05260 if (minorgridlinestyle.set (val, true))
05261 {
05262 mark_modified ();
05263 }
05264 }
05265 }
05266
05267 void set_plotboxaspectratio (const octave_value& val)
05268 {
05269 if (! error_state)
05270 {
05271 if (plotboxaspectratio.set (val, false))
05272 {
05273 set_plotboxaspectratiomode ("manual");
05274 plotboxaspectratio.run_listeners (POSTSET);
05275 mark_modified ();
05276 }
05277 else
05278 set_plotboxaspectratiomode ("manual");
05279 }
05280 }
05281
05282 void set_plotboxaspectratiomode (const octave_value& val)
05283 {
05284 if (! error_state)
05285 {
05286 if (plotboxaspectratiomode.set (val, true))
05287 {
05288 mark_modified ();
05289 }
05290 }
05291 }
05292
05293 void set_projection (const octave_value& val)
05294 {
05295 if (! error_state)
05296 {
05297 if (projection.set (val, true))
05298 {
05299 mark_modified ();
05300 }
05301 }
05302 }
05303
05304 void set_tickdir (const octave_value& val)
05305 {
05306 if (! error_state)
05307 {
05308 if (tickdir.set (val, false))
05309 {
05310 set_tickdirmode ("manual");
05311 tickdir.run_listeners (POSTSET);
05312 mark_modified ();
05313 }
05314 else
05315 set_tickdirmode ("manual");
05316 }
05317 }
05318
05319 void set_tickdirmode (const octave_value& val)
05320 {
05321 if (! error_state)
05322 {
05323 if (tickdirmode.set (val, true))
05324 {
05325 mark_modified ();
05326 }
05327 }
05328 }
05329
05330 void set_ticklength (const octave_value& val)
05331 {
05332 if (! error_state)
05333 {
05334 if (ticklength.set (val, true))
05335 {
05336 mark_modified ();
05337 }
05338 }
05339 }
05340
05341 void set_tightinset (const octave_value& val)
05342 {
05343 if (! error_state)
05344 {
05345 if (tightinset.set (val, true))
05346 {
05347 mark_modified ();
05348 }
05349 }
05350 }
05351
05352 void set_units (const octave_value& val)
05353 {
05354 if (! error_state)
05355 {
05356 if (units.set (val, true))
05357 {
05358 mark_modified ();
05359 }
05360 }
05361 }
05362
05363 void set_x_viewtransform (const octave_value& val)
05364 {
05365 if (! error_state)
05366 {
05367 if (x_viewtransform.set (val, true))
05368 {
05369 mark_modified ();
05370 }
05371 }
05372 }
05373
05374 void set_x_projectiontransform (const octave_value& val)
05375 {
05376 if (! error_state)
05377 {
05378 if (x_projectiontransform.set (val, true))
05379 {
05380 mark_modified ();
05381 }
05382 }
05383 }
05384
05385 void set_x_viewporttransform (const octave_value& val)
05386 {
05387 if (! error_state)
05388 {
05389 if (x_viewporttransform.set (val, true))
05390 {
05391 mark_modified ();
05392 }
05393 }
05394 }
05395
05396 void set_x_normrendertransform (const octave_value& val)
05397 {
05398 if (! error_state)
05399 {
05400 if (x_normrendertransform.set (val, true))
05401 {
05402 mark_modified ();
05403 }
05404 }
05405 }
05406
05407 void set_x_rendertransform (const octave_value& val)
05408 {
05409 if (! error_state)
05410 {
05411 if (x_rendertransform.set (val, true))
05412 {
05413 mark_modified ();
05414 }
05415 }
05416 }
05417
05418
05419 protected:
05420 void init (void);
05421
05422 private:
05423 void update_xscale (void) { sx = get_xscale (); }
05424 void update_yscale (void) { sy = get_yscale (); }
05425 void update_zscale (void) { sz = get_zscale (); }
05426
05427 void update_view (void) { update_camera (); }
05428
05429 void update_xdir (void) { update_camera (); }
05430 void update_ydir (void) { update_camera (); }
05431 void update_zdir (void) { update_camera (); }
05432
05433 void update_xtick (void)
05434 {
05435 if (xticklabelmode.is ("auto"))
05436 calc_ticklabels (xtick, xticklabel, xscale.is ("log"));
05437 }
05438 void update_ytick (void)
05439 {
05440 if (yticklabelmode.is ("auto"))
05441 calc_ticklabels (ytick, yticklabel, yscale.is ("log"));
05442 }
05443 void update_ztick (void)
05444 {
05445 if (zticklabelmode.is ("auto"))
05446 calc_ticklabels (ztick, zticklabel, zscale.is ("log"));
05447 }
05448
05449 void update_xticklabelmode (void)
05450 {
05451 if (xticklabelmode.is ("auto"))
05452 calc_ticklabels (xtick, xticklabel, xscale.is ("log"));
05453 }
05454 void update_yticklabelmode (void)
05455 {
05456 if (yticklabelmode.is ("auto"))
05457 calc_ticklabels (ytick, yticklabel, yscale.is ("log"));
05458 }
05459 void update_zticklabelmode (void)
05460 {
05461 if (zticklabelmode.is ("auto"))
05462 calc_ticklabels (ztick, zticklabel, zscale.is ("log"));
05463 }
05464
05465 void sync_positions (void);
05466 void update_outerposition (void) { sync_positions ();}
05467 void update_position (void) { sync_positions (); }
05468
05469 double calc_tick_sep (double minval, double maxval);
05470 void calc_ticks_and_lims (array_property& lims, array_property& ticks, bool limmode_is_auto, bool is_logscale);
05471 void calc_ticklabels (const array_property& ticks, any_property& labels, bool is_logscale);
05472 void fix_limits (array_property& lims)
05473 {
05474 if (lims.get ().is_empty ())
05475 return;
05476
05477 Matrix l = lims.get ().matrix_value ();
05478 if (l(0) > l(1))
05479 {
05480 l(0) = 0;
05481 l(1) = 1;
05482 lims = l;
05483 }
05484 else if (l(0) == l(1))
05485 {
05486 l(0) -= 0.5;
05487 l(1) += 0.5;
05488 lims = l;
05489 }
05490 }
05491
05492 public:
05493 Matrix get_axis_limits (double xmin, double xmax, double min_pos, bool logscale);
05494
05495 void update_xlim (bool do_clr_zoom = true)
05496 {
05497 if (xtickmode.is ("auto"))
05498 calc_ticks_and_lims (xlim, xtick, xlimmode.is ("auto"), xscale.is ("log"));
05499 if (xticklabelmode.is ("auto"))
05500 calc_ticklabels (xtick, xticklabel, xscale.is ("log"));
05501
05502 fix_limits (xlim);
05503
05504 if (do_clr_zoom)
05505 zoom_stack.clear ();
05506 }
05507
05508 void update_ylim (bool do_clr_zoom = true)
05509 {
05510 if (ytickmode.is ("auto"))
05511 calc_ticks_and_lims (ylim, ytick, ylimmode.is ("auto"), yscale.is ("log"));
05512 if (yticklabelmode.is ("auto"))
05513 calc_ticklabels (ytick, yticklabel, yscale.is ("log"));
05514
05515 fix_limits (ylim);
05516
05517 if (do_clr_zoom)
05518 zoom_stack.clear ();
05519 }
05520
05521 void update_zlim (void)
05522 {
05523 if (ztickmode.is ("auto"))
05524 calc_ticks_and_lims (zlim, ztick, zlimmode.is ("auto"), zscale.is ("log"));
05525 if (zticklabelmode.is ("auto"))
05526 calc_ticklabels (ztick, zticklabel, zscale.is ("log"));
05527
05528 fix_limits (zlim);
05529
05530 zoom_stack.clear ();
05531 }
05532
05533 };
05534
05535 private:
05536 properties xproperties;
05537
05538 public:
05539 axes (const graphics_handle& mh, const graphics_handle& p)
05540 : base_graphics_object (), xproperties (mh, p), default_properties ()
05541 {
05542 xproperties.override_defaults (*this);
05543 xproperties.update_transform ();
05544 }
05545
05546 ~axes (void) { xproperties.delete_children (); }
05547
05548 void override_defaults (base_graphics_object& obj)
05549 {
05550
05551
05552 xproperties.override_defaults (obj);
05553
05554
05555
05556
05557
05558
05559 obj.set_from_list (default_properties);
05560 }
05561
05562 void set (const caseless_str& name, const octave_value& value)
05563 {
05564 if (name.compare ("default", 7))
05565
05566
05567
05568 default_properties.set (name.substr (7), value);
05569 else
05570 xproperties.set (name, value);
05571 }
05572
05573 void set_defaults (const std::string& mode)
05574 {
05575 remove_all_listeners ();
05576 xproperties.set_defaults (*this, mode);
05577 }
05578
05579 octave_value get (const caseless_str& name) const
05580 {
05581 octave_value retval;
05582
05583
05584 if (name.compare ("default", 7))
05585 retval = get_default (name.substr (7));
05586 else
05587 retval = xproperties.get (name);
05588
05589 return retval;
05590 }
05591
05592 octave_value get_default (const caseless_str& name) const;
05593
05594 octave_value get_defaults (void) const
05595 {
05596 return default_properties.as_struct ("default");
05597 }
05598
05599 base_properties& get_properties (void) { return xproperties; }
05600
05601 const base_properties& get_properties (void) const { return xproperties; }
05602
05603 void update_axis_limits (const std::string& axis_type);
05604
05605 bool valid_object (void) const { return true; }
05606
05607 private:
05608 property_list default_properties;
05609 };
05610
05611
05612
05613 class OCTINTERP_API line : public base_graphics_object
05614 {
05615 public:
05616 class OCTINTERP_API properties : public base_properties
05617 {
05618 public:
05619
05620
05621
05622
05623
05624
05625 public:
05626 properties (const graphics_handle& mh, const graphics_handle& p);
05627
05628 ~properties (void) { }
05629
05630 void set (const caseless_str& pname, const octave_value& val);
05631
05632 octave_value get (bool all = false) const;
05633
05634 octave_value get (const caseless_str& pname) const;
05635
05636 octave_value get (const std::string& pname) const
05637 {
05638 return get (caseless_str (pname));
05639 }
05640
05641 octave_value get (const char *pname) const
05642 {
05643 return get (caseless_str (pname));
05644 }
05645
05646 property get_property (const caseless_str& pname);
05647
05648 std::string graphics_object_name (void) const { return go_name; }
05649
05650 static property_list::pval_map_type factory_defaults (void);
05651
05652 private:
05653 static std::string go_name;
05654
05655 public:
05656
05657
05658 static std::set<std::string> core_property_names (void);
05659
05660 static bool has_core_property (const caseless_str& pname);
05661
05662 std::set<std::string> all_property_names (void) const;
05663
05664 bool has_property (const caseless_str& pname) const;
05665
05666 private:
05667
05668 row_vector_property xdata;
05669 row_vector_property ydata;
05670 row_vector_property zdata;
05671 row_vector_property ldata;
05672 row_vector_property udata;
05673 row_vector_property xldata;
05674 row_vector_property xudata;
05675 string_property xdatasource;
05676 string_property ydatasource;
05677 string_property zdatasource;
05678 color_property color;
05679 radio_property linestyle;
05680 double_property linewidth;
05681 radio_property marker;
05682 color_property markeredgecolor;
05683 color_property markerfacecolor;
05684 double_property markersize;
05685 string_property keylabel;
05686 radio_property interpreter;
05687 string_property displayname;
05688 radio_property erasemode;
05689 row_vector_property xlim;
05690 row_vector_property ylim;
05691 row_vector_property zlim;
05692 bool_property xliminclude;
05693 bool_property yliminclude;
05694 bool_property zliminclude;
05695
05696 public:
05697
05698 enum
05699 {
05700 XDATA = 4000,
05701 YDATA = 4001,
05702 ZDATA = 4002,
05703 LDATA = 4003,
05704 UDATA = 4004,
05705 XLDATA = 4005,
05706 XUDATA = 4006,
05707 XDATASOURCE = 4007,
05708 YDATASOURCE = 4008,
05709 ZDATASOURCE = 4009,
05710 COLOR = 4010,
05711 LINESTYLE = 4011,
05712 LINEWIDTH = 4012,
05713 MARKER = 4013,
05714 MARKEREDGECOLOR = 4014,
05715 MARKERFACECOLOR = 4015,
05716 MARKERSIZE = 4016,
05717 KEYLABEL = 4017,
05718 INTERPRETER = 4018,
05719 DISPLAYNAME = 4019,
05720 ERASEMODE = 4020,
05721 XLIM = 4021,
05722 YLIM = 4022,
05723 ZLIM = 4023,
05724 XLIMINCLUDE = 4024,
05725 YLIMINCLUDE = 4025,
05726 ZLIMINCLUDE = 4026
05727 };
05728
05729 octave_value get_xdata (void) const { return xdata.get (); }
05730
05731 octave_value get_ydata (void) const { return ydata.get (); }
05732
05733 octave_value get_zdata (void) const { return zdata.get (); }
05734
05735 octave_value get_ldata (void) const { return ldata.get (); }
05736
05737 octave_value get_udata (void) const { return udata.get (); }
05738
05739 octave_value get_xldata (void) const { return xldata.get (); }
05740
05741 octave_value get_xudata (void) const { return xudata.get (); }
05742
05743 std::string get_xdatasource (void) const { return xdatasource.string_value (); }
05744
05745 std::string get_ydatasource (void) const { return ydatasource.string_value (); }
05746
05747 std::string get_zdatasource (void) const { return zdatasource.string_value (); }
05748
05749 bool color_is_rgb (void) const { return color.is_rgb (); }
05750 bool color_is (const std::string& v) const { return color.is (v); }
05751 Matrix get_color_rgb (void) const { return (color.is_rgb () ? color.rgb () : Matrix ()); }
05752 octave_value get_color (void) const { return color.get (); }
05753
05754 bool linestyle_is (const std::string& v) const { return linestyle.is (v); }
05755 std::string get_linestyle (void) const { return linestyle.current_value (); }
05756
05757 double get_linewidth (void) const { return linewidth.double_value (); }
05758
05759 bool marker_is (const std::string& v) const { return marker.is (v); }
05760 std::string get_marker (void) const { return marker.current_value (); }
05761
05762 bool markeredgecolor_is_rgb (void) const { return markeredgecolor.is_rgb (); }
05763 bool markeredgecolor_is (const std::string& v) const { return markeredgecolor.is (v); }
05764 Matrix get_markeredgecolor_rgb (void) const { return (markeredgecolor.is_rgb () ? markeredgecolor.rgb () : Matrix ()); }
05765 octave_value get_markeredgecolor (void) const { return markeredgecolor.get (); }
05766
05767 bool markerfacecolor_is_rgb (void) const { return markerfacecolor.is_rgb (); }
05768 bool markerfacecolor_is (const std::string& v) const { return markerfacecolor.is (v); }
05769 Matrix get_markerfacecolor_rgb (void) const { return (markerfacecolor.is_rgb () ? markerfacecolor.rgb () : Matrix ()); }
05770 octave_value get_markerfacecolor (void) const { return markerfacecolor.get (); }
05771
05772 double get_markersize (void) const { return markersize.double_value (); }
05773
05774 std::string get_keylabel (void) const { return keylabel.string_value (); }
05775
05776 bool interpreter_is (const std::string& v) const { return interpreter.is (v); }
05777 std::string get_interpreter (void) const { return interpreter.current_value (); }
05778
05779 std::string get_displayname (void) const { return displayname.string_value (); }
05780
05781 bool erasemode_is (const std::string& v) const { return erasemode.is (v); }
05782 std::string get_erasemode (void) const { return erasemode.current_value (); }
05783
05784 octave_value get_xlim (void) const { return xlim.get (); }
05785
05786 octave_value get_ylim (void) const { return ylim.get (); }
05787
05788 octave_value get_zlim (void) const { return zlim.get (); }
05789
05790 bool is_xliminclude (void) const { return xliminclude.is_on (); }
05791 std::string get_xliminclude (void) const { return xliminclude.current_value (); }
05792
05793 bool is_yliminclude (void) const { return yliminclude.is_on (); }
05794 std::string get_yliminclude (void) const { return yliminclude.current_value (); }
05795
05796 bool is_zliminclude (void) const { return zliminclude.is_on (); }
05797 std::string get_zliminclude (void) const { return zliminclude.current_value (); }
05798
05799
05800 void set_xdata (const octave_value& val)
05801 {
05802 if (! error_state)
05803 {
05804 if (xdata.set (val, true))
05805 {
05806 update_xdata ();
05807 mark_modified ();
05808 }
05809 }
05810 }
05811
05812 void set_ydata (const octave_value& val)
05813 {
05814 if (! error_state)
05815 {
05816 if (ydata.set (val, true))
05817 {
05818 update_ydata ();
05819 mark_modified ();
05820 }
05821 }
05822 }
05823
05824 void set_zdata (const octave_value& val)
05825 {
05826 if (! error_state)
05827 {
05828 if (zdata.set (val, true))
05829 {
05830 update_zdata ();
05831 mark_modified ();
05832 }
05833 }
05834 }
05835
05836 void set_ldata (const octave_value& val)
05837 {
05838 if (! error_state)
05839 {
05840 if (ldata.set (val, true))
05841 {
05842 update_ldata ();
05843 mark_modified ();
05844 }
05845 }
05846 }
05847
05848 void set_udata (const octave_value& val)
05849 {
05850 if (! error_state)
05851 {
05852 if (udata.set (val, true))
05853 {
05854 update_udata ();
05855 mark_modified ();
05856 }
05857 }
05858 }
05859
05860 void set_xldata (const octave_value& val)
05861 {
05862 if (! error_state)
05863 {
05864 if (xldata.set (val, true))
05865 {
05866 update_xldata ();
05867 mark_modified ();
05868 }
05869 }
05870 }
05871
05872 void set_xudata (const octave_value& val)
05873 {
05874 if (! error_state)
05875 {
05876 if (xudata.set (val, true))
05877 {
05878 update_xudata ();
05879 mark_modified ();
05880 }
05881 }
05882 }
05883
05884 void set_xdatasource (const octave_value& val)
05885 {
05886 if (! error_state)
05887 {
05888 if (xdatasource.set (val, true))
05889 {
05890 mark_modified ();
05891 }
05892 }
05893 }
05894
05895 void set_ydatasource (const octave_value& val)
05896 {
05897 if (! error_state)
05898 {
05899 if (ydatasource.set (val, true))
05900 {
05901 mark_modified ();
05902 }
05903 }
05904 }
05905
05906 void set_zdatasource (const octave_value& val)
05907 {
05908 if (! error_state)
05909 {
05910 if (zdatasource.set (val, true))
05911 {
05912 mark_modified ();
05913 }
05914 }
05915 }
05916
05917 void set_color (const octave_value& val)
05918 {
05919 if (! error_state)
05920 {
05921 if (color.set (val, true))
05922 {
05923 mark_modified ();
05924 }
05925 }
05926 }
05927
05928 void set_linestyle (const octave_value& val)
05929 {
05930 if (! error_state)
05931 {
05932 if (linestyle.set (val, true))
05933 {
05934 mark_modified ();
05935 }
05936 }
05937 }
05938
05939 void set_linewidth (const octave_value& val)
05940 {
05941 if (! error_state)
05942 {
05943 if (linewidth.set (val, true))
05944 {
05945 mark_modified ();
05946 }
05947 }
05948 }
05949
05950 void set_marker (const octave_value& val)
05951 {
05952 if (! error_state)
05953 {
05954 if (marker.set (val, true))
05955 {
05956 mark_modified ();
05957 }
05958 }
05959 }
05960
05961 void set_markeredgecolor (const octave_value& val)
05962 {
05963 if (! error_state)
05964 {
05965 if (markeredgecolor.set (val, true))
05966 {
05967 mark_modified ();
05968 }
05969 }
05970 }
05971
05972 void set_markerfacecolor (const octave_value& val)
05973 {
05974 if (! error_state)
05975 {
05976 if (markerfacecolor.set (val, true))
05977 {
05978 mark_modified ();
05979 }
05980 }
05981 }
05982
05983 void set_markersize (const octave_value& val)
05984 {
05985 if (! error_state)
05986 {
05987 if (markersize.set (val, true))
05988 {
05989 mark_modified ();
05990 }
05991 }
05992 }
05993
05994 void set_keylabel (const octave_value& val)
05995 {
05996 if (! error_state)
05997 {
05998 if (keylabel.set (val, true))
05999 {
06000 mark_modified ();
06001 }
06002 }
06003 }
06004
06005 void set_interpreter (const octave_value& val)
06006 {
06007 if (! error_state)
06008 {
06009 if (interpreter.set (val, true))
06010 {
06011 mark_modified ();
06012 }
06013 }
06014 }
06015
06016 void set_displayname (const octave_value& val)
06017 {
06018 if (! error_state)
06019 {
06020 if (displayname.set (val, true))
06021 {
06022 mark_modified ();
06023 }
06024 }
06025 }
06026
06027 void set_erasemode (const octave_value& val)
06028 {
06029 if (! error_state)
06030 {
06031 if (erasemode.set (val, true))
06032 {
06033 mark_modified ();
06034 }
06035 }
06036 }
06037
06038 void set_xlim (const octave_value& val)
06039 {
06040 if (! error_state)
06041 {
06042 if (xlim.set (val, false))
06043 {
06044 update_axis_limits ("xlim");
06045 xlim.run_listeners (POSTSET);
06046 mark_modified ();
06047 }
06048 }
06049 }
06050
06051 void set_ylim (const octave_value& val)
06052 {
06053 if (! error_state)
06054 {
06055 if (ylim.set (val, false))
06056 {
06057 update_axis_limits ("ylim");
06058 ylim.run_listeners (POSTSET);
06059 mark_modified ();
06060 }
06061 }
06062 }
06063
06064 void set_zlim (const octave_value& val)
06065 {
06066 if (! error_state)
06067 {
06068 if (zlim.set (val, false))
06069 {
06070 update_axis_limits ("zlim");
06071 zlim.run_listeners (POSTSET);
06072 mark_modified ();
06073 }
06074 }
06075 }
06076
06077 void set_xliminclude (const octave_value& val)
06078 {
06079 if (! error_state)
06080 {
06081 if (xliminclude.set (val, false))
06082 {
06083 update_axis_limits ("xliminclude");
06084 xliminclude.run_listeners (POSTSET);
06085 mark_modified ();
06086 }
06087 }
06088 }
06089
06090 void set_yliminclude (const octave_value& val)
06091 {
06092 if (! error_state)
06093 {
06094 if (yliminclude.set (val, false))
06095 {
06096 update_axis_limits ("yliminclude");
06097 yliminclude.run_listeners (POSTSET);
06098 mark_modified ();
06099 }
06100 }
06101 }
06102
06103 void set_zliminclude (const octave_value& val)
06104 {
06105 if (! error_state)
06106 {
06107 if (zliminclude.set (val, false))
06108 {
06109 update_axis_limits ("zliminclude");
06110 zliminclude.run_listeners (POSTSET);
06111 mark_modified ();
06112 }
06113 }
06114 }
06115
06116
06117 private:
06118 Matrix compute_xlim (void) const;
06119 Matrix compute_ylim (void) const;
06120
06121 void update_xdata (void) { set_xlim (compute_xlim ()); }
06122 void update_xldata (void) { set_xlim (compute_xlim ()); }
06123 void update_xudata (void) { set_xlim (compute_xlim ()); }
06124
06125 void update_ydata (void) { set_ylim (compute_ylim ()); }
06126 void update_ldata (void) { set_ylim (compute_ylim ()); }
06127 void update_udata (void) { set_ylim (compute_ylim ()); }
06128
06129 void update_zdata (void)
06130 {
06131 set_zlim (zdata.get_limits ());
06132 set_zliminclude (get_zdata ().numel () > 0);
06133 }
06134 };
06135
06136 private:
06137 properties xproperties;
06138
06139 public:
06140 line (const graphics_handle& mh, const graphics_handle& p)
06141 : base_graphics_object (), xproperties (mh, p)
06142 {
06143 xproperties.override_defaults (*this);
06144 }
06145
06146 ~line (void) { xproperties.delete_children (); }
06147
06148 base_properties& get_properties (void) { return xproperties; }
06149
06150 const base_properties& get_properties (void) const { return xproperties; }
06151
06152 bool valid_object (void) const { return true; }
06153 };
06154
06155
06156
06157 class OCTINTERP_API text : public base_graphics_object
06158 {
06159 public:
06160 class OCTINTERP_API properties : public base_properties
06161 {
06162 public:
06163
06164
06165
06166 public:
06167 properties (const graphics_handle& mh, const graphics_handle& p);
06168
06169 ~properties (void) { }
06170
06171 void set (const caseless_str& pname, const octave_value& val);
06172
06173 octave_value get (bool all = false) const;
06174
06175 octave_value get (const caseless_str& pname) const;
06176
06177 octave_value get (const std::string& pname) const
06178 {
06179 return get (caseless_str (pname));
06180 }
06181
06182 octave_value get (const char *pname) const
06183 {
06184 return get (caseless_str (pname));
06185 }
06186
06187 property get_property (const caseless_str& pname);
06188
06189 std::string graphics_object_name (void) const { return go_name; }
06190
06191 static property_list::pval_map_type factory_defaults (void);
06192
06193 private:
06194 static std::string go_name;
06195
06196 public:
06197
06198
06199 static std::set<std::string> core_property_names (void);
06200
06201 static bool has_core_property (const caseless_str& pname);
06202
06203 std::set<std::string> all_property_names (void) const;
06204
06205 bool has_property (const caseless_str& pname) const;
06206
06207 private:
06208
06209 string_property string;
06210 radio_property units;
06211 array_property position;
06212 double_property rotation;
06213 radio_property horizontalalignment;
06214 color_property color;
06215 string_property fontname;
06216 double_property fontsize;
06217 radio_property fontangle;
06218 radio_property fontweight;
06219 radio_property interpreter;
06220 color_property backgroundcolor;
06221 string_property displayname;
06222 color_property edgecolor;
06223 radio_property erasemode;
06224 bool_property editing;
06225 radio_property fontunits;
06226 radio_property linestyle;
06227 double_property linewidth;
06228 double_property margin;
06229 radio_property verticalalignment;
06230 row_vector_property xlim;
06231 row_vector_property ylim;
06232 row_vector_property zlim;
06233 bool_property xliminclude;
06234 bool_property yliminclude;
06235 bool_property zliminclude;
06236
06237 public:
06238
06239 enum
06240 {
06241 STRING = 5000,
06242 UNITS = 5001,
06243 POSITION = 5002,
06244 ROTATION = 5003,
06245 HORIZONTALALIGNMENT = 5004,
06246 COLOR = 5005,
06247 FONTNAME = 5006,
06248 FONTSIZE = 5007,
06249 FONTANGLE = 5008,
06250 FONTWEIGHT = 5009,
06251 INTERPRETER = 5010,
06252 BACKGROUNDCOLOR = 5011,
06253 DISPLAYNAME = 5012,
06254 EDGECOLOR = 5013,
06255 ERASEMODE = 5014,
06256 EDITING = 5015,
06257 FONTUNITS = 5016,
06258 LINESTYLE = 5017,
06259 LINEWIDTH = 5018,
06260 MARGIN = 5019,
06261 VERTICALALIGNMENT = 5020,
06262 XLIM = 5021,
06263 YLIM = 5022,
06264 ZLIM = 5023,
06265 XLIMINCLUDE = 5024,
06266 YLIMINCLUDE = 5025,
06267 ZLIMINCLUDE = 5026
06268 };
06269
06270 std::string get_string (void) const { return string.string_value (); }
06271
06272 bool units_is (const std::string& v) const { return units.is (v); }
06273 std::string get_units (void) const { return units.current_value (); }
06274
06275 octave_value get_position (void) const { return position.get (); }
06276
06277 double get_rotation (void) const { return rotation.double_value (); }
06278
06279 bool horizontalalignment_is (const std::string& v) const { return horizontalalignment.is (v); }
06280 std::string get_horizontalalignment (void) const { return horizontalalignment.current_value (); }
06281
06282 bool color_is_rgb (void) const { return color.is_rgb (); }
06283 bool color_is (const std::string& v) const { return color.is (v); }
06284 Matrix get_color_rgb (void) const { return (color.is_rgb () ? color.rgb () : Matrix ()); }
06285 octave_value get_color (void) const { return color.get (); }
06286
06287 std::string get_fontname (void) const { return fontname.string_value (); }
06288
06289 double get_fontsize (void) const { return fontsize.double_value (); }
06290
06291 bool fontangle_is (const std::string& v) const { return fontangle.is (v); }
06292 std::string get_fontangle (void) const { return fontangle.current_value (); }
06293
06294 bool fontweight_is (const std::string& v) const { return fontweight.is (v); }
06295 std::string get_fontweight (void) const { return fontweight.current_value (); }
06296
06297 bool interpreter_is (const std::string& v) const { return interpreter.is (v); }
06298 std::string get_interpreter (void) const { return interpreter.current_value (); }
06299
06300 bool backgroundcolor_is_rgb (void) const { return backgroundcolor.is_rgb (); }
06301 bool backgroundcolor_is (const std::string& v) const { return backgroundcolor.is (v); }
06302 Matrix get_backgroundcolor_rgb (void) const { return (backgroundcolor.is_rgb () ? backgroundcolor.rgb () : Matrix ()); }
06303 octave_value get_backgroundcolor (void) const { return backgroundcolor.get (); }
06304
06305 std::string get_displayname (void) const { return displayname.string_value (); }
06306
06307 bool edgecolor_is_rgb (void) const { return edgecolor.is_rgb (); }
06308 bool edgecolor_is (const std::string& v) const { return edgecolor.is (v); }
06309 Matrix get_edgecolor_rgb (void) const { return (edgecolor.is_rgb () ? edgecolor.rgb () : Matrix ()); }
06310 octave_value get_edgecolor (void) const { return edgecolor.get (); }
06311
06312 bool erasemode_is (const std::string& v) const { return erasemode.is (v); }
06313 std::string get_erasemode (void) const { return erasemode.current_value (); }
06314
06315 bool is_editing (void) const { return editing.is_on (); }
06316 std::string get_editing (void) const { return editing.current_value (); }
06317
06318 bool fontunits_is (const std::string& v) const { return fontunits.is (v); }
06319 std::string get_fontunits (void) const { return fontunits.current_value (); }
06320
06321 bool linestyle_is (const std::string& v) const { return linestyle.is (v); }
06322 std::string get_linestyle (void) const { return linestyle.current_value (); }
06323
06324 double get_linewidth (void) const { return linewidth.double_value (); }
06325
06326 double get_margin (void) const { return margin.double_value (); }
06327
06328 bool verticalalignment_is (const std::string& v) const { return verticalalignment.is (v); }
06329 std::string get_verticalalignment (void) const { return verticalalignment.current_value (); }
06330
06331 octave_value get_xlim (void) const { return xlim.get (); }
06332
06333 octave_value get_ylim (void) const { return ylim.get (); }
06334
06335 octave_value get_zlim (void) const { return zlim.get (); }
06336
06337 bool is_xliminclude (void) const { return xliminclude.is_on (); }
06338 std::string get_xliminclude (void) const { return xliminclude.current_value (); }
06339
06340 bool is_yliminclude (void) const { return yliminclude.is_on (); }
06341 std::string get_yliminclude (void) const { return yliminclude.current_value (); }
06342
06343 bool is_zliminclude (void) const { return zliminclude.is_on (); }
06344 std::string get_zliminclude (void) const { return zliminclude.current_value (); }
06345
06346
06347 void set_string (const octave_value& val)
06348 {
06349 if (! error_state)
06350 {
06351 if (string.set (val, true))
06352 {
06353 mark_modified ();
06354 }
06355 }
06356 }
06357
06358 void set_units (const octave_value& val)
06359 {
06360 if (! error_state)
06361 {
06362 if (units.set (val, true))
06363 {
06364 mark_modified ();
06365 }
06366 }
06367 }
06368
06369 void set_position (const octave_value& val)
06370 {
06371 if (! error_state)
06372 {
06373 if (position.set (val, true))
06374 {
06375 update_position ();
06376 mark_modified ();
06377 }
06378 }
06379 }
06380
06381 void set_rotation (const octave_value& val)
06382 {
06383 if (! error_state)
06384 {
06385 if (rotation.set (val, true))
06386 {
06387 mark_modified ();
06388 }
06389 }
06390 }
06391
06392 void set_horizontalalignment (const octave_value& val)
06393 {
06394 if (! error_state)
06395 {
06396 if (horizontalalignment.set (val, true))
06397 {
06398 mark_modified ();
06399 }
06400 }
06401 }
06402
06403 void set_color (const octave_value& val)
06404 {
06405 if (! error_state)
06406 {
06407 if (color.set (val, true))
06408 {
06409 mark_modified ();
06410 }
06411 }
06412 }
06413
06414 void set_fontname (const octave_value& val)
06415 {
06416 if (! error_state)
06417 {
06418 if (fontname.set (val, true))
06419 {
06420 mark_modified ();
06421 }
06422 }
06423 }
06424
06425 void set_fontsize (const octave_value& val)
06426 {
06427 if (! error_state)
06428 {
06429 if (fontsize.set (val, true))
06430 {
06431 mark_modified ();
06432 }
06433 }
06434 }
06435
06436 void set_fontangle (const octave_value& val)
06437 {
06438 if (! error_state)
06439 {
06440 if (fontangle.set (val, true))
06441 {
06442 mark_modified ();
06443 }
06444 }
06445 }
06446
06447 void set_fontweight (const octave_value& val)
06448 {
06449 if (! error_state)
06450 {
06451 if (fontweight.set (val, true))
06452 {
06453 mark_modified ();
06454 }
06455 }
06456 }
06457
06458 void set_interpreter (const octave_value& val)
06459 {
06460 if (! error_state)
06461 {
06462 if (interpreter.set (val, true))
06463 {
06464 mark_modified ();
06465 }
06466 }
06467 }
06468
06469 void set_backgroundcolor (const octave_value& val)
06470 {
06471 if (! error_state)
06472 {
06473 if (backgroundcolor.set (val, true))
06474 {
06475 mark_modified ();
06476 }
06477 }
06478 }
06479
06480 void set_displayname (const octave_value& val)
06481 {
06482 if (! error_state)
06483 {
06484 if (displayname.set (val, true))
06485 {
06486 mark_modified ();
06487 }
06488 }
06489 }
06490
06491 void set_edgecolor (const octave_value& val)
06492 {
06493 if (! error_state)
06494 {
06495 if (edgecolor.set (val, true))
06496 {
06497 mark_modified ();
06498 }
06499 }
06500 }
06501
06502 void set_erasemode (const octave_value& val)
06503 {
06504 if (! error_state)
06505 {
06506 if (erasemode.set (val, true))
06507 {
06508 mark_modified ();
06509 }
06510 }
06511 }
06512
06513 void set_editing (const octave_value& val)
06514 {
06515 if (! error_state)
06516 {
06517 if (editing.set (val, true))
06518 {
06519 mark_modified ();
06520 }
06521 }
06522 }
06523
06524 void set_fontunits (const octave_value& val)
06525 {
06526 if (! error_state)
06527 {
06528 if (fontunits.set (val, true))
06529 {
06530 mark_modified ();
06531 }
06532 }
06533 }
06534
06535 void set_linestyle (const octave_value& val)
06536 {
06537 if (! error_state)
06538 {
06539 if (linestyle.set (val, true))
06540 {
06541 mark_modified ();
06542 }
06543 }
06544 }
06545
06546 void set_linewidth (const octave_value& val)
06547 {
06548 if (! error_state)
06549 {
06550 if (linewidth.set (val, true))
06551 {
06552 mark_modified ();
06553 }
06554 }
06555 }
06556
06557 void set_margin (const octave_value& val)
06558 {
06559 if (! error_state)
06560 {
06561 if (margin.set (val, true))
06562 {
06563 mark_modified ();
06564 }
06565 }
06566 }
06567
06568 void set_verticalalignment (const octave_value& val)
06569 {
06570 if (! error_state)
06571 {
06572 if (verticalalignment.set (val, true))
06573 {
06574 mark_modified ();
06575 }
06576 }
06577 }
06578
06579 void set_xlim (const octave_value& val)
06580 {
06581 if (! error_state)
06582 {
06583 if (xlim.set (val, false))
06584 {
06585 update_axis_limits ("xlim");
06586 xlim.run_listeners (POSTSET);
06587 mark_modified ();
06588 }
06589 }
06590 }
06591
06592 void set_ylim (const octave_value& val)
06593 {
06594 if (! error_state)
06595 {
06596 if (ylim.set (val, false))
06597 {
06598 update_axis_limits ("ylim");
06599 ylim.run_listeners (POSTSET);
06600 mark_modified ();
06601 }
06602 }
06603 }
06604
06605 void set_zlim (const octave_value& val)
06606 {
06607 if (! error_state)
06608 {
06609 if (zlim.set (val, false))
06610 {
06611 update_axis_limits ("zlim");
06612 zlim.run_listeners (POSTSET);
06613 mark_modified ();
06614 }
06615 }
06616 }
06617
06618 void set_xliminclude (const octave_value& val)
06619 {
06620 if (! error_state)
06621 {
06622 if (xliminclude.set (val, false))
06623 {
06624 update_axis_limits ("xliminclude");
06625 xliminclude.run_listeners (POSTSET);
06626 mark_modified ();
06627 }
06628 }
06629 }
06630
06631 void set_yliminclude (const octave_value& val)
06632 {
06633 if (! error_state)
06634 {
06635 if (yliminclude.set (val, false))
06636 {
06637 update_axis_limits ("yliminclude");
06638 yliminclude.run_listeners (POSTSET);
06639 mark_modified ();
06640 }
06641 }
06642 }
06643
06644 void set_zliminclude (const octave_value& val)
06645 {
06646 if (! error_state)
06647 {
06648 if (zliminclude.set (val, false))
06649 {
06650 update_axis_limits ("zliminclude");
06651 zliminclude.run_listeners (POSTSET);
06652 mark_modified ();
06653 }
06654 }
06655 }
06656
06657
06658 protected:
06659 void init (void)
06660 {
06661 position.add_constraint (dim_vector (1, 3));
06662 }
06663
06664 private:
06665 void update_position (void)
06666 {
06667 Matrix pos = get_position ().matrix_value ();
06668 Matrix lim;
06669
06670 lim = Matrix (1, 3, pos(0));
06671 lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2));
06672 set_xlim (lim);
06673
06674 lim = Matrix (1, 3, pos(1));
06675 lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2));
06676 set_ylim (lim);
06677
06678 if (pos.numel () == 3)
06679 {
06680 lim = Matrix (1, 3, pos(2));
06681 lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2));
06682 set_zliminclude ("on");
06683 set_zlim (lim);
06684 }
06685 else
06686 set_zliminclude ("off");
06687 }
06688 };
06689
06690 private:
06691 properties xproperties;
06692
06693 public:
06694 text (const graphics_handle& mh, const graphics_handle& p)
06695 : base_graphics_object (), xproperties (mh, p)
06696 {
06697 xproperties.override_defaults (*this);
06698 }
06699
06700 ~text (void) { xproperties.delete_children (); }
06701
06702 base_properties& get_properties (void) { return xproperties; }
06703
06704 const base_properties& get_properties (void) const { return xproperties; }
06705
06706 bool valid_object (void) const { return true; }
06707 };
06708
06709
06710
06711 class OCTINTERP_API image : public base_graphics_object
06712 {
06713 public:
06714 class OCTINTERP_API properties : public base_properties
06715 {
06716 public:
06717 bool is_climinclude (void) const
06718 { return (climinclude.is_on () && cdatamapping.is ("scaled")); }
06719 std::string get_climinclude (void) const
06720 { return climinclude.current_value (); }
06721
06722 octave_value get_color_data (void) const;
06723
06724
06725
06726
06727 public:
06728 properties (const graphics_handle& mh, const graphics_handle& p);
06729
06730 ~properties (void) { }
06731
06732 void set (const caseless_str& pname, const octave_value& val);
06733
06734 octave_value get (bool all = false) const;
06735
06736 octave_value get (const caseless_str& pname) const;
06737
06738 octave_value get (const std::string& pname) const
06739 {
06740 return get (caseless_str (pname));
06741 }
06742
06743 octave_value get (const char *pname) const
06744 {
06745 return get (caseless_str (pname));
06746 }
06747
06748 property get_property (const caseless_str& pname);
06749
06750 std::string graphics_object_name (void) const { return go_name; }
06751
06752 static property_list::pval_map_type factory_defaults (void);
06753
06754 private:
06755 static std::string go_name;
06756
06757 public:
06758
06759
06760 static std::set<std::string> core_property_names (void);
06761
06762 static bool has_core_property (const caseless_str& pname);
06763
06764 std::set<std::string> all_property_names (void) const;
06765
06766 bool has_property (const caseless_str& pname) const;
06767
06768 private:
06769
06770 row_vector_property xdata;
06771 row_vector_property ydata;
06772 array_property cdata;
06773 radio_property cdatamapping;
06774 row_vector_property xlim;
06775 row_vector_property ylim;
06776 row_vector_property clim;
06777 bool_property xliminclude;
06778 bool_property yliminclude;
06779 bool_property climinclude;
06780
06781 public:
06782
06783 enum
06784 {
06785 XDATA = 6000,
06786 YDATA = 6001,
06787 CDATA = 6002,
06788 CDATAMAPPING = 6003,
06789 XLIM = 6004,
06790 YLIM = 6005,
06791 CLIM = 6006,
06792 XLIMINCLUDE = 6007,
06793 YLIMINCLUDE = 6008,
06794 CLIMINCLUDE = 6009
06795 };
06796
06797 octave_value get_xdata (void) const { return xdata.get (); }
06798
06799 octave_value get_ydata (void) const { return ydata.get (); }
06800
06801 octave_value get_cdata (void) const { return cdata.get (); }
06802
06803 bool cdatamapping_is (const std::string& v) const { return cdatamapping.is (v); }
06804 std::string get_cdatamapping (void) const { return cdatamapping.current_value (); }
06805
06806 octave_value get_xlim (void) const { return xlim.get (); }
06807
06808 octave_value get_ylim (void) const { return ylim.get (); }
06809
06810 octave_value get_clim (void) const { return clim.get (); }
06811
06812 bool is_xliminclude (void) const { return xliminclude.is_on (); }
06813 std::string get_xliminclude (void) const { return xliminclude.current_value (); }
06814
06815 bool is_yliminclude (void) const { return yliminclude.is_on (); }
06816 std::string get_yliminclude (void) const { return yliminclude.current_value (); }
06817
06818
06819 void set_xdata (const octave_value& val)
06820 {
06821 if (! error_state)
06822 {
06823 if (xdata.set (val, true))
06824 {
06825 update_xdata ();
06826 mark_modified ();
06827 }
06828 }
06829 }
06830
06831 void set_ydata (const octave_value& val)
06832 {
06833 if (! error_state)
06834 {
06835 if (ydata.set (val, true))
06836 {
06837 update_ydata ();
06838 mark_modified ();
06839 }
06840 }
06841 }
06842
06843 void set_cdata (const octave_value& val)
06844 {
06845 if (! error_state)
06846 {
06847 if (cdata.set (val, true))
06848 {
06849 update_cdata ();
06850 mark_modified ();
06851 }
06852 }
06853 }
06854
06855 void set_cdatamapping (const octave_value& val)
06856 {
06857 if (! error_state)
06858 {
06859 if (cdatamapping.set (val, false))
06860 {
06861 update_axis_limits ("cdatamapping");
06862 cdatamapping.run_listeners (POSTSET);
06863 mark_modified ();
06864 }
06865 }
06866 }
06867
06868 void set_xlim (const octave_value& val)
06869 {
06870 if (! error_state)
06871 {
06872 if (xlim.set (val, false))
06873 {
06874 update_axis_limits ("xlim");
06875 xlim.run_listeners (POSTSET);
06876 mark_modified ();
06877 }
06878 }
06879 }
06880
06881 void set_ylim (const octave_value& val)
06882 {
06883 if (! error_state)
06884 {
06885 if (ylim.set (val, false))
06886 {
06887 update_axis_limits ("ylim");
06888 ylim.run_listeners (POSTSET);
06889 mark_modified ();
06890 }
06891 }
06892 }
06893
06894 void set_clim (const octave_value& val)
06895 {
06896 if (! error_state)
06897 {
06898 if (clim.set (val, false))
06899 {
06900 update_axis_limits ("clim");
06901 clim.run_listeners (POSTSET);
06902 mark_modified ();
06903 }
06904 }
06905 }
06906
06907 void set_xliminclude (const octave_value& val)
06908 {
06909 if (! error_state)
06910 {
06911 if (xliminclude.set (val, false))
06912 {
06913 update_axis_limits ("xliminclude");
06914 xliminclude.run_listeners (POSTSET);
06915 mark_modified ();
06916 }
06917 }
06918 }
06919
06920 void set_yliminclude (const octave_value& val)
06921 {
06922 if (! error_state)
06923 {
06924 if (yliminclude.set (val, false))
06925 {
06926 update_axis_limits ("yliminclude");
06927 yliminclude.run_listeners (POSTSET);
06928 mark_modified ();
06929 }
06930 }
06931 }
06932
06933 void set_climinclude (const octave_value& val)
06934 {
06935 if (! error_state)
06936 {
06937 if (climinclude.set (val, false))
06938 {
06939 update_axis_limits ("climinclude");
06940 climinclude.run_listeners (POSTSET);
06941 mark_modified ();
06942 }
06943 }
06944 }
06945
06946
06947 protected:
06948 void init (void)
06949 {
06950 xdata.add_constraint (2);
06951 ydata.add_constraint (2);
06952 cdata.add_constraint ("double");
06953 cdata.add_constraint ("logical");
06954 cdata.add_constraint ("uint8");
06955 cdata.add_constraint (dim_vector (-1, -1));
06956 cdata.add_constraint (dim_vector (-1, -1, 3));
06957 }
06958
06959 private:
06960 void update_xdata (void)
06961 {
06962 octave_idx_type iw = (get_cdata ().dims ())(1) - 1;
06963 Matrix limits = xdata.get_limits ();
06964 float dp = (limits(1) - limits(0))/(2*iw);
06965
06966 limits(0) = limits(0) - dp;
06967 limits(1) = limits(1) + dp;
06968 set_xlim (limits);
06969 }
06970
06971 void update_ydata (void)
06972 {
06973 octave_idx_type ih = (get_cdata().dims ())(0) - 1;
06974 Matrix limits = ydata.get_limits ();
06975 float dp = (limits(1) - limits(0))/(2*ih);
06976
06977 limits(0) = limits(0) - dp;
06978 limits(1) = limits(1) + dp;
06979 set_ylim (limits);
06980 }
06981
06982 void update_cdata (void)
06983 {
06984 if (cdatamapping_is ("scaled"))
06985 set_clim (cdata.get_limits ());
06986 else
06987 clim = cdata.get_limits ();
06988 }
06989 };
06990
06991 private:
06992 properties xproperties;
06993
06994 public:
06995 image (const graphics_handle& mh, const graphics_handle& p)
06996 : base_graphics_object (), xproperties (mh, p)
06997 {
06998 xproperties.override_defaults (*this);
06999 }
07000
07001 ~image (void) { xproperties.delete_children (); }
07002
07003 base_properties& get_properties (void) { return xproperties; }
07004
07005 const base_properties& get_properties (void) const { return xproperties; }
07006
07007 bool valid_object (void) const { return true; }
07008 };
07009
07010
07011
07012 class OCTINTERP_API patch : public base_graphics_object
07013 {
07014 public:
07015 class OCTINTERP_API properties : public base_properties
07016 {
07017 public:
07018 octave_value get_color_data (void) const;
07019
07020 bool is_climinclude (void) const
07021 { return (climinclude.is_on () && cdatamapping.is ("scaled")); }
07022 std::string get_climinclude (void) const
07023 { return climinclude.current_value (); }
07024
07025 bool is_aliminclude (void) const
07026 { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); }
07027 std::string get_aliminclude (void) const
07028 { return aliminclude.current_value (); }
07029
07030
07031
07032
07033 public:
07034 properties (const graphics_handle& mh, const graphics_handle& p);
07035
07036 ~properties (void) { }
07037
07038 void set (const caseless_str& pname, const octave_value& val);
07039
07040 octave_value get (bool all = false) const;
07041
07042 octave_value get (const caseless_str& pname) const;
07043
07044 octave_value get (const std::string& pname) const
07045 {
07046 return get (caseless_str (pname));
07047 }
07048
07049 octave_value get (const char *pname) const
07050 {
07051 return get (caseless_str (pname));
07052 }
07053
07054 property get_property (const caseless_str& pname);
07055
07056 std::string graphics_object_name (void) const { return go_name; }
07057
07058 static property_list::pval_map_type factory_defaults (void);
07059
07060 private:
07061 static std::string go_name;
07062
07063 public:
07064
07065
07066 static std::set<std::string> core_property_names (void);
07067
07068 static bool has_core_property (const caseless_str& pname);
07069
07070 std::set<std::string> all_property_names (void) const;
07071
07072 bool has_property (const caseless_str& pname) const;
07073
07074 private:
07075
07076 array_property xdata;
07077 array_property ydata;
07078 array_property zdata;
07079 array_property cdata;
07080 radio_property cdatamapping;
07081 array_property faces;
07082 array_property facevertexalphadata;
07083 array_property facevertexcdata;
07084 array_property vertices;
07085 array_property vertexnormals;
07086 radio_property normalmode;
07087 color_property facecolor;
07088 double_radio_property facealpha;
07089 radio_property facelighting;
07090 color_property edgecolor;
07091 double_radio_property edgealpha;
07092 radio_property edgelighting;
07093 radio_property backfacelighting;
07094 double_property ambientstrength;
07095 double_property diffusestrength;
07096 double_property specularstrength;
07097 double_property specularexponent;
07098 double_property specularcolorreflectance;
07099 radio_property erasemode;
07100 radio_property linestyle;
07101 double_property linewidth;
07102 radio_property marker;
07103 color_property markeredgecolor;
07104 color_property markerfacecolor;
07105 double_property markersize;
07106 string_property keylabel;
07107 radio_property interpreter;
07108 radio_property alphadatamapping;
07109 row_vector_property xlim;
07110 row_vector_property ylim;
07111 row_vector_property zlim;
07112 row_vector_property clim;
07113 row_vector_property alim;
07114 bool_property xliminclude;
07115 bool_property yliminclude;
07116 bool_property zliminclude;
07117 bool_property climinclude;
07118 bool_property aliminclude;
07119
07120 public:
07121
07122 enum
07123 {
07124 XDATA = 7000,
07125 YDATA = 7001,
07126 ZDATA = 7002,
07127 CDATA = 7003,
07128 CDATAMAPPING = 7004,
07129 FACES = 7005,
07130 FACEVERTEXALPHADATA = 7006,
07131 FACEVERTEXCDATA = 7007,
07132 VERTICES = 7008,
07133 VERTEXNORMALS = 7009,
07134 NORMALMODE = 7010,
07135 FACECOLOR = 7011,
07136 FACEALPHA = 7012,
07137 FACELIGHTING = 7013,
07138 EDGECOLOR = 7014,
07139 EDGEALPHA = 7015,
07140 EDGELIGHTING = 7016,
07141 BACKFACELIGHTING = 7017,
07142 AMBIENTSTRENGTH = 7018,
07143 DIFFUSESTRENGTH = 7019,
07144 SPECULARSTRENGTH = 7020,
07145 SPECULAREXPONENT = 7021,
07146 SPECULARCOLORREFLECTANCE = 7022,
07147 ERASEMODE = 7023,
07148 LINESTYLE = 7024,
07149 LINEWIDTH = 7025,
07150 MARKER = 7026,
07151 MARKEREDGECOLOR = 7027,
07152 MARKERFACECOLOR = 7028,
07153 MARKERSIZE = 7029,
07154 KEYLABEL = 7030,
07155 INTERPRETER = 7031,
07156 ALPHADATAMAPPING = 7032,
07157 XLIM = 7033,
07158 YLIM = 7034,
07159 ZLIM = 7035,
07160 CLIM = 7036,
07161 ALIM = 7037,
07162 XLIMINCLUDE = 7038,
07163 YLIMINCLUDE = 7039,
07164 ZLIMINCLUDE = 7040,
07165 CLIMINCLUDE = 7041,
07166 ALIMINCLUDE = 7042
07167 };
07168
07169 octave_value get_xdata (void) const { return xdata.get (); }
07170
07171 octave_value get_ydata (void) const { return ydata.get (); }
07172
07173 octave_value get_zdata (void) const { return zdata.get (); }
07174
07175 octave_value get_cdata (void) const { return cdata.get (); }
07176
07177 bool cdatamapping_is (const std::string& v) const { return cdatamapping.is (v); }
07178 std::string get_cdatamapping (void) const { return cdatamapping.current_value (); }
07179
07180 octave_value get_faces (void) const { return faces.get (); }
07181
07182 octave_value get_facevertexalphadata (void) const { return facevertexalphadata.get (); }
07183
07184 octave_value get_facevertexcdata (void) const { return facevertexcdata.get (); }
07185
07186 octave_value get_vertices (void) const { return vertices.get (); }
07187
07188 octave_value get_vertexnormals (void) const { return vertexnormals.get (); }
07189
07190 bool normalmode_is (const std::string& v) const { return normalmode.is (v); }
07191 std::string get_normalmode (void) const { return normalmode.current_value (); }
07192
07193 bool facecolor_is_rgb (void) const { return facecolor.is_rgb (); }
07194 bool facecolor_is (const std::string& v) const { return facecolor.is (v); }
07195 Matrix get_facecolor_rgb (void) const { return (facecolor.is_rgb () ? facecolor.rgb () : Matrix ()); }
07196 octave_value get_facecolor (void) const { return facecolor.get (); }
07197
07198 bool facealpha_is_double (void) const { return facealpha.is_double (); }
07199 bool facealpha_is (const std::string& v) const { return facealpha.is (v); }
07200 double get_facealpha_double (void) const { return (facealpha.is_double () ? facealpha.double_value () : 0); }
07201 octave_value get_facealpha (void) const { return facealpha.get (); }
07202
07203 bool facelighting_is (const std::string& v) const { return facelighting.is (v); }
07204 std::string get_facelighting (void) const { return facelighting.current_value (); }
07205
07206 bool edgecolor_is_rgb (void) const { return edgecolor.is_rgb (); }
07207 bool edgecolor_is (const std::string& v) const { return edgecolor.is (v); }
07208 Matrix get_edgecolor_rgb (void) const { return (edgecolor.is_rgb () ? edgecolor.rgb () : Matrix ()); }
07209 octave_value get_edgecolor (void) const { return edgecolor.get (); }
07210
07211 bool edgealpha_is_double (void) const { return edgealpha.is_double (); }
07212 bool edgealpha_is (const std::string& v) const { return edgealpha.is (v); }
07213 double get_edgealpha_double (void) const { return (edgealpha.is_double () ? edgealpha.double_value () : 0); }
07214 octave_value get_edgealpha (void) const { return edgealpha.get (); }
07215
07216 bool edgelighting_is (const std::string& v) const { return edgelighting.is (v); }
07217 std::string get_edgelighting (void) const { return edgelighting.current_value (); }
07218
07219 bool backfacelighting_is (const std::string& v) const { return backfacelighting.is (v); }
07220 std::string get_backfacelighting (void) const { return backfacelighting.current_value (); }
07221
07222 double get_ambientstrength (void) const { return ambientstrength.double_value (); }
07223
07224 double get_diffusestrength (void) const { return diffusestrength.double_value (); }
07225
07226 double get_specularstrength (void) const { return specularstrength.double_value (); }
07227
07228 double get_specularexponent (void) const { return specularexponent.double_value (); }
07229
07230 double get_specularcolorreflectance (void) const { return specularcolorreflectance.double_value (); }
07231
07232 bool erasemode_is (const std::string& v) const { return erasemode.is (v); }
07233 std::string get_erasemode (void) const { return erasemode.current_value (); }
07234
07235 bool linestyle_is (const std::string& v) const { return linestyle.is (v); }
07236 std::string get_linestyle (void) const { return linestyle.current_value (); }
07237
07238 double get_linewidth (void) const { return linewidth.double_value (); }
07239
07240 bool marker_is (const std::string& v) const { return marker.is (v); }
07241 std::string get_marker (void) const { return marker.current_value (); }
07242
07243 bool markeredgecolor_is_rgb (void) const { return markeredgecolor.is_rgb (); }
07244 bool markeredgecolor_is (const std::string& v) const { return markeredgecolor.is (v); }
07245 Matrix get_markeredgecolor_rgb (void) const { return (markeredgecolor.is_rgb () ? markeredgecolor.rgb () : Matrix ()); }
07246 octave_value get_markeredgecolor (void) const { return markeredgecolor.get (); }
07247
07248 bool markerfacecolor_is_rgb (void) const { return markerfacecolor.is_rgb (); }
07249 bool markerfacecolor_is (const std::string& v) const { return markerfacecolor.is (v); }
07250 Matrix get_markerfacecolor_rgb (void) const { return (markerfacecolor.is_rgb () ? markerfacecolor.rgb () : Matrix ()); }
07251 octave_value get_markerfacecolor (void) const { return markerfacecolor.get (); }
07252
07253 double get_markersize (void) const { return markersize.double_value (); }
07254
07255 std::string get_keylabel (void) const { return keylabel.string_value (); }
07256
07257 bool interpreter_is (const std::string& v) const { return interpreter.is (v); }
07258 std::string get_interpreter (void) const { return interpreter.current_value (); }
07259
07260 bool alphadatamapping_is (const std::string& v) const { return alphadatamapping.is (v); }
07261 std::string get_alphadatamapping (void) const { return alphadatamapping.current_value (); }
07262
07263 octave_value get_xlim (void) const { return xlim.get (); }
07264
07265 octave_value get_ylim (void) const { return ylim.get (); }
07266
07267 octave_value get_zlim (void) const { return zlim.get (); }
07268
07269 octave_value get_clim (void) const { return clim.get (); }
07270
07271 octave_value get_alim (void) const { return alim.get (); }
07272
07273 bool is_xliminclude (void) const { return xliminclude.is_on (); }
07274 std::string get_xliminclude (void) const { return xliminclude.current_value (); }
07275
07276 bool is_yliminclude (void) const { return yliminclude.is_on (); }
07277 std::string get_yliminclude (void) const { return yliminclude.current_value (); }
07278
07279 bool is_zliminclude (void) const { return zliminclude.is_on (); }
07280 std::string get_zliminclude (void) const { return zliminclude.current_value (); }
07281
07282
07283 void set_xdata (const octave_value& val)
07284 {
07285 if (! error_state)
07286 {
07287 if (xdata.set (val, true))
07288 {
07289 update_xdata ();
07290 mark_modified ();
07291 }
07292 }
07293 }
07294
07295 void set_ydata (const octave_value& val)
07296 {
07297 if (! error_state)
07298 {
07299 if (ydata.set (val, true))
07300 {
07301 update_ydata ();
07302 mark_modified ();
07303 }
07304 }
07305 }
07306
07307 void set_zdata (const octave_value& val)
07308 {
07309 if (! error_state)
07310 {
07311 if (zdata.set (val, true))
07312 {
07313 update_zdata ();
07314 mark_modified ();
07315 }
07316 }
07317 }
07318
07319 void set_cdata (const octave_value& val)
07320 {
07321 if (! error_state)
07322 {
07323 if (cdata.set (val, true))
07324 {
07325 update_cdata ();
07326 mark_modified ();
07327 }
07328 }
07329 }
07330
07331 void set_cdatamapping (const octave_value& val)
07332 {
07333 if (! error_state)
07334 {
07335 if (cdatamapping.set (val, false))
07336 {
07337 update_axis_limits ("cdatamapping");
07338 cdatamapping.run_listeners (POSTSET);
07339 mark_modified ();
07340 }
07341 }
07342 }
07343
07344 void set_faces (const octave_value& val)
07345 {
07346 if (! error_state)
07347 {
07348 if (faces.set (val, true))
07349 {
07350 mark_modified ();
07351 }
07352 }
07353 }
07354
07355 void set_facevertexalphadata (const octave_value& val)
07356 {
07357 if (! error_state)
07358 {
07359 if (facevertexalphadata.set (val, true))
07360 {
07361 mark_modified ();
07362 }
07363 }
07364 }
07365
07366 void set_facevertexcdata (const octave_value& val)
07367 {
07368 if (! error_state)
07369 {
07370 if (facevertexcdata.set (val, true))
07371 {
07372 mark_modified ();
07373 }
07374 }
07375 }
07376
07377 void set_vertices (const octave_value& val)
07378 {
07379 if (! error_state)
07380 {
07381 if (vertices.set (val, true))
07382 {
07383 mark_modified ();
07384 }
07385 }
07386 }
07387
07388 void set_vertexnormals (const octave_value& val)
07389 {
07390 if (! error_state)
07391 {
07392 if (vertexnormals.set (val, true))
07393 {
07394 mark_modified ();
07395 }
07396 }
07397 }
07398
07399 void set_normalmode (const octave_value& val)
07400 {
07401 if (! error_state)
07402 {
07403 if (normalmode.set (val, true))
07404 {
07405 mark_modified ();
07406 }
07407 }
07408 }
07409
07410 void set_facecolor (const octave_value& val)
07411 {
07412 if (! error_state)
07413 {
07414 if (facecolor.set (val, true))
07415 {
07416 mark_modified ();
07417 }
07418 }
07419 }
07420
07421 void set_facealpha (const octave_value& val)
07422 {
07423 if (! error_state)
07424 {
07425 if (facealpha.set (val, true))
07426 {
07427 mark_modified ();
07428 }
07429 }
07430 }
07431
07432 void set_facelighting (const octave_value& val)
07433 {
07434 if (! error_state)
07435 {
07436 if (facelighting.set (val, true))
07437 {
07438 mark_modified ();
07439 }
07440 }
07441 }
07442
07443 void set_edgecolor (const octave_value& val)
07444 {
07445 if (! error_state)
07446 {
07447 if (edgecolor.set (val, true))
07448 {
07449 mark_modified ();
07450 }
07451 }
07452 }
07453
07454 void set_edgealpha (const octave_value& val)
07455 {
07456 if (! error_state)
07457 {
07458 if (edgealpha.set (val, true))
07459 {
07460 mark_modified ();
07461 }
07462 }
07463 }
07464
07465 void set_edgelighting (const octave_value& val)
07466 {
07467 if (! error_state)
07468 {
07469 if (edgelighting.set (val, true))
07470 {
07471 mark_modified ();
07472 }
07473 }
07474 }
07475
07476 void set_backfacelighting (const octave_value& val)
07477 {
07478 if (! error_state)
07479 {
07480 if (backfacelighting.set (val, true))
07481 {
07482 mark_modified ();
07483 }
07484 }
07485 }
07486
07487 void set_ambientstrength (const octave_value& val)
07488 {
07489 if (! error_state)
07490 {
07491 if (ambientstrength.set (val, true))
07492 {
07493 mark_modified ();
07494 }
07495 }
07496 }
07497
07498 void set_diffusestrength (const octave_value& val)
07499 {
07500 if (! error_state)
07501 {
07502 if (diffusestrength.set (val, true))
07503 {
07504 mark_modified ();
07505 }
07506 }
07507 }
07508
07509 void set_specularstrength (const octave_value& val)
07510 {
07511 if (! error_state)
07512 {
07513 if (specularstrength.set (val, true))
07514 {
07515 mark_modified ();
07516 }
07517 }
07518 }
07519
07520 void set_specularexponent (const octave_value& val)
07521 {
07522 if (! error_state)
07523 {
07524 if (specularexponent.set (val, true))
07525 {
07526 mark_modified ();
07527 }
07528 }
07529 }
07530
07531 void set_specularcolorreflectance (const octave_value& val)
07532 {
07533 if (! error_state)
07534 {
07535 if (specularcolorreflectance.set (val, true))
07536 {
07537 mark_modified ();
07538 }
07539 }
07540 }
07541
07542 void set_erasemode (const octave_value& val)
07543 {
07544 if (! error_state)
07545 {
07546 if (erasemode.set (val, true))
07547 {
07548 mark_modified ();
07549 }
07550 }
07551 }
07552
07553 void set_linestyle (const octave_value& val)
07554 {
07555 if (! error_state)
07556 {
07557 if (linestyle.set (val, true))
07558 {
07559 mark_modified ();
07560 }
07561 }
07562 }
07563
07564 void set_linewidth (const octave_value& val)
07565 {
07566 if (! error_state)
07567 {
07568 if (linewidth.set (val, true))
07569 {
07570 mark_modified ();
07571 }
07572 }
07573 }
07574
07575 void set_marker (const octave_value& val)
07576 {
07577 if (! error_state)
07578 {
07579 if (marker.set (val, true))
07580 {
07581 mark_modified ();
07582 }
07583 }
07584 }
07585
07586 void set_markeredgecolor (const octave_value& val)
07587 {
07588 if (! error_state)
07589 {
07590 if (markeredgecolor.set (val, true))
07591 {
07592 mark_modified ();
07593 }
07594 }
07595 }
07596
07597 void set_markerfacecolor (const octave_value& val)
07598 {
07599 if (! error_state)
07600 {
07601 if (markerfacecolor.set (val, true))
07602 {
07603 mark_modified ();
07604 }
07605 }
07606 }
07607
07608 void set_markersize (const octave_value& val)
07609 {
07610 if (! error_state)
07611 {
07612 if (markersize.set (val, true))
07613 {
07614 mark_modified ();
07615 }
07616 }
07617 }
07618
07619 void set_keylabel (const octave_value& val)
07620 {
07621 if (! error_state)
07622 {
07623 if (keylabel.set (val, true))
07624 {
07625 mark_modified ();
07626 }
07627 }
07628 }
07629
07630 void set_interpreter (const octave_value& val)
07631 {
07632 if (! error_state)
07633 {
07634 if (interpreter.set (val, true))
07635 {
07636 mark_modified ();
07637 }
07638 }
07639 }
07640
07641 void set_alphadatamapping (const octave_value& val)
07642 {
07643 if (! error_state)
07644 {
07645 if (alphadatamapping.set (val, false))
07646 {
07647 update_axis_limits ("alphadatamapping");
07648 alphadatamapping.run_listeners (POSTSET);
07649 mark_modified ();
07650 }
07651 }
07652 }
07653
07654 void set_xlim (const octave_value& val)
07655 {
07656 if (! error_state)
07657 {
07658 if (xlim.set (val, false))
07659 {
07660 update_axis_limits ("xlim");
07661 xlim.run_listeners (POSTSET);
07662 mark_modified ();
07663 }
07664 }
07665 }
07666
07667 void set_ylim (const octave_value& val)
07668 {
07669 if (! error_state)
07670 {
07671 if (ylim.set (val, false))
07672 {
07673 update_axis_limits ("ylim");
07674 ylim.run_listeners (POSTSET);
07675 mark_modified ();
07676 }
07677 }
07678 }
07679
07680 void set_zlim (const octave_value& val)
07681 {
07682 if (! error_state)
07683 {
07684 if (zlim.set (val, false))
07685 {
07686 update_axis_limits ("zlim");
07687 zlim.run_listeners (POSTSET);
07688 mark_modified ();
07689 }
07690 }
07691 }
07692
07693 void set_clim (const octave_value& val)
07694 {
07695 if (! error_state)
07696 {
07697 if (clim.set (val, false))
07698 {
07699 update_axis_limits ("clim");
07700 clim.run_listeners (POSTSET);
07701 mark_modified ();
07702 }
07703 }
07704 }
07705
07706 void set_alim (const octave_value& val)
07707 {
07708 if (! error_state)
07709 {
07710 if (alim.set (val, false))
07711 {
07712 update_axis_limits ("alim");
07713 alim.run_listeners (POSTSET);
07714 mark_modified ();
07715 }
07716 }
07717 }
07718
07719 void set_xliminclude (const octave_value& val)
07720 {
07721 if (! error_state)
07722 {
07723 if (xliminclude.set (val, false))
07724 {
07725 update_axis_limits ("xliminclude");
07726 xliminclude.run_listeners (POSTSET);
07727 mark_modified ();
07728 }
07729 }
07730 }
07731
07732 void set_yliminclude (const octave_value& val)
07733 {
07734 if (! error_state)
07735 {
07736 if (yliminclude.set (val, false))
07737 {
07738 update_axis_limits ("yliminclude");
07739 yliminclude.run_listeners (POSTSET);
07740 mark_modified ();
07741 }
07742 }
07743 }
07744
07745 void set_zliminclude (const octave_value& val)
07746 {
07747 if (! error_state)
07748 {
07749 if (zliminclude.set (val, false))
07750 {
07751 update_axis_limits ("zliminclude");
07752 zliminclude.run_listeners (POSTSET);
07753 mark_modified ();
07754 }
07755 }
07756 }
07757
07758 void set_climinclude (const octave_value& val)
07759 {
07760 if (! error_state)
07761 {
07762 if (climinclude.set (val, false))
07763 {
07764 update_axis_limits ("climinclude");
07765 climinclude.run_listeners (POSTSET);
07766 mark_modified ();
07767 }
07768 }
07769 }
07770
07771 void set_aliminclude (const octave_value& val)
07772 {
07773 if (! error_state)
07774 {
07775 if (aliminclude.set (val, false))
07776 {
07777 update_axis_limits ("aliminclude");
07778 aliminclude.run_listeners (POSTSET);
07779 mark_modified ();
07780 }
07781 }
07782 }
07783
07784
07785 protected:
07786 void init (void)
07787 {
07788 xdata.add_constraint (dim_vector (-1, -1));
07789 ydata.add_constraint (dim_vector (-1, -1));
07790 zdata.add_constraint (dim_vector (-1, -1));
07791 vertices.add_constraint (dim_vector (-1, 2));
07792 vertices.add_constraint (dim_vector (-1, 3));
07793 cdata.add_constraint (dim_vector (-1, -1));
07794 cdata.add_constraint (dim_vector (-1, -1, 3));
07795 facevertexcdata.add_constraint (dim_vector (-1, 1));
07796 facevertexcdata.add_constraint (dim_vector (-1, 3));
07797 facevertexalphadata.add_constraint (dim_vector (-1, 1));
07798 }
07799
07800 private:
07801 void update_xdata (void) { set_xlim (xdata.get_limits ()); }
07802 void update_ydata (void) { set_ylim (ydata.get_limits ()); }
07803 void update_zdata (void) { set_zlim (zdata.get_limits ()); }
07804
07805 void update_cdata (void)
07806 {
07807 if (cdatamapping_is ("scaled"))
07808 set_clim (cdata.get_limits ());
07809 else
07810 clim = cdata.get_limits ();
07811 }
07812 };
07813
07814 private:
07815 properties xproperties;
07816
07817 public:
07818 patch (const graphics_handle& mh, const graphics_handle& p)
07819 : base_graphics_object (), xproperties (mh, p)
07820 {
07821 xproperties.override_defaults (*this);
07822 }
07823
07824 ~patch (void) { xproperties.delete_children (); }
07825
07826 base_properties& get_properties (void) { return xproperties; }
07827
07828 const base_properties& get_properties (void) const { return xproperties; }
07829
07830 bool valid_object (void) const { return true; }
07831 };
07832
07833
07834
07835 class OCTINTERP_API surface : public base_graphics_object
07836 {
07837 public:
07838 class OCTINTERP_API properties : public base_properties
07839 {
07840 public:
07841 octave_value get_color_data (void) const;
07842
07843 bool is_climinclude (void) const
07844 { return (climinclude.is_on () && cdatamapping.is ("scaled")); }
07845 std::string get_climinclude (void) const
07846 { return climinclude.current_value (); }
07847
07848 bool is_aliminclude (void) const
07849 { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); }
07850 std::string get_aliminclude (void) const
07851 { return aliminclude.current_value (); }
07852
07853
07854
07855
07856 public:
07857 properties (const graphics_handle& mh, const graphics_handle& p);
07858
07859 ~properties (void) { }
07860
07861 void set (const caseless_str& pname, const octave_value& val);
07862
07863 octave_value get (bool all = false) const;
07864
07865 octave_value get (const caseless_str& pname) const;
07866
07867 octave_value get (const std::string& pname) const
07868 {
07869 return get (caseless_str (pname));
07870 }
07871
07872 octave_value get (const char *pname) const
07873 {
07874 return get (caseless_str (pname));
07875 }
07876
07877 property get_property (const caseless_str& pname);
07878
07879 std::string graphics_object_name (void) const { return go_name; }
07880
07881 static property_list::pval_map_type factory_defaults (void);
07882
07883 private:
07884 static std::string go_name;
07885
07886 public:
07887
07888
07889 static std::set<std::string> core_property_names (void);
07890
07891 static bool has_core_property (const caseless_str& pname);
07892
07893 std::set<std::string> all_property_names (void) const;
07894
07895 bool has_property (const caseless_str& pname) const;
07896
07897 private:
07898
07899 array_property xdata;
07900 array_property ydata;
07901 array_property zdata;
07902 array_property cdata;
07903 radio_property cdatamapping;
07904 string_property xdatasource;
07905 string_property ydatasource;
07906 string_property zdatasource;
07907 string_property cdatasource;
07908 color_property facecolor;
07909 double_radio_property facealpha;
07910 color_property edgecolor;
07911 radio_property linestyle;
07912 double_property linewidth;
07913 radio_property marker;
07914 color_property markeredgecolor;
07915 color_property markerfacecolor;
07916 double_property markersize;
07917 string_property keylabel;
07918 radio_property interpreter;
07919 array_property alphadata;
07920 radio_property alphadatamapping;
07921 double_property ambientstrength;
07922 radio_property backfacelighting;
07923 double_property diffusestrength;
07924 double_radio_property edgealpha;
07925 radio_property edgelighting;
07926 radio_property erasemode;
07927 radio_property facelighting;
07928 radio_property meshstyle;
07929 radio_property normalmode;
07930 double_property specularcolorreflectance;
07931 double_property specularexponent;
07932 double_property specularstrength;
07933 array_property vertexnormals;
07934 row_vector_property xlim;
07935 row_vector_property ylim;
07936 row_vector_property zlim;
07937 row_vector_property clim;
07938 row_vector_property alim;
07939 bool_property xliminclude;
07940 bool_property yliminclude;
07941 bool_property zliminclude;
07942 bool_property climinclude;
07943 bool_property aliminclude;
07944
07945 public:
07946
07947 enum
07948 {
07949 XDATA = 8000,
07950 YDATA = 8001,
07951 ZDATA = 8002,
07952 CDATA = 8003,
07953 CDATAMAPPING = 8004,
07954 XDATASOURCE = 8005,
07955 YDATASOURCE = 8006,
07956 ZDATASOURCE = 8007,
07957 CDATASOURCE = 8008,
07958 FACECOLOR = 8009,
07959 FACEALPHA = 8010,
07960 EDGECOLOR = 8011,
07961 LINESTYLE = 8012,
07962 LINEWIDTH = 8013,
07963 MARKER = 8014,
07964 MARKEREDGECOLOR = 8015,
07965 MARKERFACECOLOR = 8016,
07966 MARKERSIZE = 8017,
07967 KEYLABEL = 8018,
07968 INTERPRETER = 8019,
07969 ALPHADATA = 8020,
07970 ALPHADATAMAPPING = 8021,
07971 AMBIENTSTRENGTH = 8022,
07972 BACKFACELIGHTING = 8023,
07973 DIFFUSESTRENGTH = 8024,
07974 EDGEALPHA = 8025,
07975 EDGELIGHTING = 8026,
07976 ERASEMODE = 8027,
07977 FACELIGHTING = 8028,
07978 MESHSTYLE = 8029,
07979 NORMALMODE = 8030,
07980 SPECULARCOLORREFLECTANCE = 8031,
07981 SPECULAREXPONENT = 8032,
07982 SPECULARSTRENGTH = 8033,
07983 VERTEXNORMALS = 8034,
07984 XLIM = 8035,
07985 YLIM = 8036,
07986 ZLIM = 8037,
07987 CLIM = 8038,
07988 ALIM = 8039,
07989 XLIMINCLUDE = 8040,
07990 YLIMINCLUDE = 8041,
07991 ZLIMINCLUDE = 8042,
07992 CLIMINCLUDE = 8043,
07993 ALIMINCLUDE = 8044
07994 };
07995
07996 octave_value get_xdata (void) const { return xdata.get (); }
07997
07998 octave_value get_ydata (void) const { return ydata.get (); }
07999
08000 octave_value get_zdata (void) const { return zdata.get (); }
08001
08002 octave_value get_cdata (void) const { return cdata.get (); }
08003
08004 bool cdatamapping_is (const std::string& v) const { return cdatamapping.is (v); }
08005 std::string get_cdatamapping (void) const { return cdatamapping.current_value (); }
08006
08007 std::string get_xdatasource (void) const { return xdatasource.string_value (); }
08008
08009 std::string get_ydatasource (void) const { return ydatasource.string_value (); }
08010
08011 std::string get_zdatasource (void) const { return zdatasource.string_value (); }
08012
08013 std::string get_cdatasource (void) const { return cdatasource.string_value (); }
08014
08015 bool facecolor_is_rgb (void) const { return facecolor.is_rgb (); }
08016 bool facecolor_is (const std::string& v) const { return facecolor.is (v); }
08017 Matrix get_facecolor_rgb (void) const { return (facecolor.is_rgb () ? facecolor.rgb () : Matrix ()); }
08018 octave_value get_facecolor (void) const { return facecolor.get (); }
08019
08020 bool facealpha_is_double (void) const { return facealpha.is_double (); }
08021 bool facealpha_is (const std::string& v) const { return facealpha.is (v); }
08022 double get_facealpha_double (void) const { return (facealpha.is_double () ? facealpha.double_value () : 0); }
08023 octave_value get_facealpha (void) const { return facealpha.get (); }
08024
08025 bool edgecolor_is_rgb (void) const { return edgecolor.is_rgb (); }
08026 bool edgecolor_is (const std::string& v) const { return edgecolor.is (v); }
08027 Matrix get_edgecolor_rgb (void) const { return (edgecolor.is_rgb () ? edgecolor.rgb () : Matrix ()); }
08028 octave_value get_edgecolor (void) const { return edgecolor.get (); }
08029
08030 bool linestyle_is (const std::string& v) const { return linestyle.is (v); }
08031 std::string get_linestyle (void) const { return linestyle.current_value (); }
08032
08033 double get_linewidth (void) const { return linewidth.double_value (); }
08034
08035 bool marker_is (const std::string& v) const { return marker.is (v); }
08036 std::string get_marker (void) const { return marker.current_value (); }
08037
08038 bool markeredgecolor_is_rgb (void) const { return markeredgecolor.is_rgb (); }
08039 bool markeredgecolor_is (const std::string& v) const { return markeredgecolor.is (v); }
08040 Matrix get_markeredgecolor_rgb (void) const { return (markeredgecolor.is_rgb () ? markeredgecolor.rgb () : Matrix ()); }
08041 octave_value get_markeredgecolor (void) const { return markeredgecolor.get (); }
08042
08043 bool markerfacecolor_is_rgb (void) const { return markerfacecolor.is_rgb (); }
08044 bool markerfacecolor_is (const std::string& v) const { return markerfacecolor.is (v); }
08045 Matrix get_markerfacecolor_rgb (void) const { return (markerfacecolor.is_rgb () ? markerfacecolor.rgb () : Matrix ()); }
08046 octave_value get_markerfacecolor (void) const { return markerfacecolor.get (); }
08047
08048 double get_markersize (void) const { return markersize.double_value (); }
08049
08050 std::string get_keylabel (void) const { return keylabel.string_value (); }
08051
08052 bool interpreter_is (const std::string& v) const { return interpreter.is (v); }
08053 std::string get_interpreter (void) const { return interpreter.current_value (); }
08054
08055 octave_value get_alphadata (void) const { return alphadata.get (); }
08056
08057 bool alphadatamapping_is (const std::string& v) const { return alphadatamapping.is (v); }
08058 std::string get_alphadatamapping (void) const { return alphadatamapping.current_value (); }
08059
08060 double get_ambientstrength (void) const { return ambientstrength.double_value (); }
08061
08062 bool backfacelighting_is (const std::string& v) const { return backfacelighting.is (v); }
08063 std::string get_backfacelighting (void) const { return backfacelighting.current_value (); }
08064
08065 double get_diffusestrength (void) const { return diffusestrength.double_value (); }
08066
08067 bool edgealpha_is_double (void) const { return edgealpha.is_double (); }
08068 bool edgealpha_is (const std::string& v) const { return edgealpha.is (v); }
08069 double get_edgealpha_double (void) const { return (edgealpha.is_double () ? edgealpha.double_value () : 0); }
08070 octave_value get_edgealpha (void) const { return edgealpha.get (); }
08071
08072 bool edgelighting_is (const std::string& v) const { return edgelighting.is (v); }
08073 std::string get_edgelighting (void) const { return edgelighting.current_value (); }
08074
08075 bool erasemode_is (const std::string& v) const { return erasemode.is (v); }
08076 std::string get_erasemode (void) const { return erasemode.current_value (); }
08077
08078 bool facelighting_is (const std::string& v) const { return facelighting.is (v); }
08079 std::string get_facelighting (void) const { return facelighting.current_value (); }
08080
08081 bool meshstyle_is (const std::string& v) const { return meshstyle.is (v); }
08082 std::string get_meshstyle (void) const { return meshstyle.current_value (); }
08083
08084 bool normalmode_is (const std::string& v) const { return normalmode.is (v); }
08085 std::string get_normalmode (void) const { return normalmode.current_value (); }
08086
08087 double get_specularcolorreflectance (void) const { return specularcolorreflectance.double_value (); }
08088
08089 double get_specularexponent (void) const { return specularexponent.double_value (); }
08090
08091 double get_specularstrength (void) const { return specularstrength.double_value (); }
08092
08093 octave_value get_vertexnormals (void) const { return vertexnormals.get (); }
08094
08095 octave_value get_xlim (void) const { return xlim.get (); }
08096
08097 octave_value get_ylim (void) const { return ylim.get (); }
08098
08099 octave_value get_zlim (void) const { return zlim.get (); }
08100
08101 octave_value get_clim (void) const { return clim.get (); }
08102
08103 octave_value get_alim (void) const { return alim.get (); }
08104
08105 bool is_xliminclude (void) const { return xliminclude.is_on (); }
08106 std::string get_xliminclude (void) const { return xliminclude.current_value (); }
08107
08108 bool is_yliminclude (void) const { return yliminclude.is_on (); }
08109 std::string get_yliminclude (void) const { return yliminclude.current_value (); }
08110
08111 bool is_zliminclude (void) const { return zliminclude.is_on (); }
08112 std::string get_zliminclude (void) const { return zliminclude.current_value (); }
08113
08114
08115 void set_xdata (const octave_value& val)
08116 {
08117 if (! error_state)
08118 {
08119 if (xdata.set (val, true))
08120 {
08121 update_xdata ();
08122 mark_modified ();
08123 }
08124 }
08125 }
08126
08127 void set_ydata (const octave_value& val)
08128 {
08129 if (! error_state)
08130 {
08131 if (ydata.set (val, true))
08132 {
08133 update_ydata ();
08134 mark_modified ();
08135 }
08136 }
08137 }
08138
08139 void set_zdata (const octave_value& val)
08140 {
08141 if (! error_state)
08142 {
08143 if (zdata.set (val, true))
08144 {
08145 update_zdata ();
08146 mark_modified ();
08147 }
08148 }
08149 }
08150
08151 void set_cdata (const octave_value& val)
08152 {
08153 if (! error_state)
08154 {
08155 if (cdata.set (val, true))
08156 {
08157 update_cdata ();
08158 mark_modified ();
08159 }
08160 }
08161 }
08162
08163 void set_cdatamapping (const octave_value& val)
08164 {
08165 if (! error_state)
08166 {
08167 if (cdatamapping.set (val, false))
08168 {
08169 update_axis_limits ("cdatamapping");
08170 cdatamapping.run_listeners (POSTSET);
08171 mark_modified ();
08172 }
08173 }
08174 }
08175
08176 void set_xdatasource (const octave_value& val)
08177 {
08178 if (! error_state)
08179 {
08180 if (xdatasource.set (val, true))
08181 {
08182 mark_modified ();
08183 }
08184 }
08185 }
08186
08187 void set_ydatasource (const octave_value& val)
08188 {
08189 if (! error_state)
08190 {
08191 if (ydatasource.set (val, true))
08192 {
08193 mark_modified ();
08194 }
08195 }
08196 }
08197
08198 void set_zdatasource (const octave_value& val)
08199 {
08200 if (! error_state)
08201 {
08202 if (zdatasource.set (val, true))
08203 {
08204 mark_modified ();
08205 }
08206 }
08207 }
08208
08209 void set_cdatasource (const octave_value& val)
08210 {
08211 if (! error_state)
08212 {
08213 if (cdatasource.set (val, true))
08214 {
08215 mark_modified ();
08216 }
08217 }
08218 }
08219
08220 void set_facecolor (const octave_value& val)
08221 {
08222 if (! error_state)
08223 {
08224 if (facecolor.set (val, true))
08225 {
08226 mark_modified ();
08227 }
08228 }
08229 }
08230
08231 void set_facealpha (const octave_value& val)
08232 {
08233 if (! error_state)
08234 {
08235 if (facealpha.set (val, true))
08236 {
08237 mark_modified ();
08238 }
08239 }
08240 }
08241
08242 void set_edgecolor (const octave_value& val)
08243 {
08244 if (! error_state)
08245 {
08246 if (edgecolor.set (val, true))
08247 {
08248 mark_modified ();
08249 }
08250 }
08251 }
08252
08253 void set_linestyle (const octave_value& val)
08254 {
08255 if (! error_state)
08256 {
08257 if (linestyle.set (val, true))
08258 {
08259 mark_modified ();
08260 }
08261 }
08262 }
08263
08264 void set_linewidth (const octave_value& val)
08265 {
08266 if (! error_state)
08267 {
08268 if (linewidth.set (val, true))
08269 {
08270 mark_modified ();
08271 }
08272 }
08273 }
08274
08275 void set_marker (const octave_value& val)
08276 {
08277 if (! error_state)
08278 {
08279 if (marker.set (val, true))
08280 {
08281 mark_modified ();
08282 }
08283 }
08284 }
08285
08286 void set_markeredgecolor (const octave_value& val)
08287 {
08288 if (! error_state)
08289 {
08290 if (markeredgecolor.set (val, true))
08291 {
08292 mark_modified ();
08293 }
08294 }
08295 }
08296
08297 void set_markerfacecolor (const octave_value& val)
08298 {
08299 if (! error_state)
08300 {
08301 if (markerfacecolor.set (val, true))
08302 {
08303 mark_modified ();
08304 }
08305 }
08306 }
08307
08308 void set_markersize (const octave_value& val)
08309 {
08310 if (! error_state)
08311 {
08312 if (markersize.set (val, true))
08313 {
08314 mark_modified ();
08315 }
08316 }
08317 }
08318
08319 void set_keylabel (const octave_value& val)
08320 {
08321 if (! error_state)
08322 {
08323 if (keylabel.set (val, true))
08324 {
08325 mark_modified ();
08326 }
08327 }
08328 }
08329
08330 void set_interpreter (const octave_value& val)
08331 {
08332 if (! error_state)
08333 {
08334 if (interpreter.set (val, true))
08335 {
08336 mark_modified ();
08337 }
08338 }
08339 }
08340
08341 void set_alphadata (const octave_value& val)
08342 {
08343 if (! error_state)
08344 {
08345 if (alphadata.set (val, true))
08346 {
08347 update_alphadata ();
08348 mark_modified ();
08349 }
08350 }
08351 }
08352
08353 void set_alphadatamapping (const octave_value& val)
08354 {
08355 if (! error_state)
08356 {
08357 if (alphadatamapping.set (val, false))
08358 {
08359 update_axis_limits ("alphadatamapping");
08360 alphadatamapping.run_listeners (POSTSET);
08361 mark_modified ();
08362 }
08363 }
08364 }
08365
08366 void set_ambientstrength (const octave_value& val)
08367 {
08368 if (! error_state)
08369 {
08370 if (ambientstrength.set (val, true))
08371 {
08372 mark_modified ();
08373 }
08374 }
08375 }
08376
08377 void set_backfacelighting (const octave_value& val)
08378 {
08379 if (! error_state)
08380 {
08381 if (backfacelighting.set (val, true))
08382 {
08383 mark_modified ();
08384 }
08385 }
08386 }
08387
08388 void set_diffusestrength (const octave_value& val)
08389 {
08390 if (! error_state)
08391 {
08392 if (diffusestrength.set (val, true))
08393 {
08394 mark_modified ();
08395 }
08396 }
08397 }
08398
08399 void set_edgealpha (const octave_value& val)
08400 {
08401 if (! error_state)
08402 {
08403 if (edgealpha.set (val, true))
08404 {
08405 mark_modified ();
08406 }
08407 }
08408 }
08409
08410 void set_edgelighting (const octave_value& val)
08411 {
08412 if (! error_state)
08413 {
08414 if (edgelighting.set (val, true))
08415 {
08416 mark_modified ();
08417 }
08418 }
08419 }
08420
08421 void set_erasemode (const octave_value& val)
08422 {
08423 if (! error_state)
08424 {
08425 if (erasemode.set (val, true))
08426 {
08427 mark_modified ();
08428 }
08429 }
08430 }
08431
08432 void set_facelighting (const octave_value& val)
08433 {
08434 if (! error_state)
08435 {
08436 if (facelighting.set (val, true))
08437 {
08438 mark_modified ();
08439 }
08440 }
08441 }
08442
08443 void set_meshstyle (const octave_value& val)
08444 {
08445 if (! error_state)
08446 {
08447 if (meshstyle.set (val, true))
08448 {
08449 mark_modified ();
08450 }
08451 }
08452 }
08453
08454 void set_normalmode (const octave_value& val)
08455 {
08456 if (! error_state)
08457 {
08458 if (normalmode.set (val, true))
08459 {
08460 update_normalmode ();
08461 mark_modified ();
08462 }
08463 }
08464 }
08465
08466 void set_specularcolorreflectance (const octave_value& val)
08467 {
08468 if (! error_state)
08469 {
08470 if (specularcolorreflectance.set (val, true))
08471 {
08472 mark_modified ();
08473 }
08474 }
08475 }
08476
08477 void set_specularexponent (const octave_value& val)
08478 {
08479 if (! error_state)
08480 {
08481 if (specularexponent.set (val, true))
08482 {
08483 mark_modified ();
08484 }
08485 }
08486 }
08487
08488 void set_specularstrength (const octave_value& val)
08489 {
08490 if (! error_state)
08491 {
08492 if (specularstrength.set (val, true))
08493 {
08494 mark_modified ();
08495 }
08496 }
08497 }
08498
08499 void set_vertexnormals (const octave_value& val)
08500 {
08501 if (! error_state)
08502 {
08503 if (vertexnormals.set (val, true))
08504 {
08505 update_vertexnormals ();
08506 mark_modified ();
08507 }
08508 }
08509 }
08510
08511 void set_xlim (const octave_value& val)
08512 {
08513 if (! error_state)
08514 {
08515 if (xlim.set (val, false))
08516 {
08517 update_axis_limits ("xlim");
08518 xlim.run_listeners (POSTSET);
08519 mark_modified ();
08520 }
08521 }
08522 }
08523
08524 void set_ylim (const octave_value& val)
08525 {
08526 if (! error_state)
08527 {
08528 if (ylim.set (val, false))
08529 {
08530 update_axis_limits ("ylim");
08531 ylim.run_listeners (POSTSET);
08532 mark_modified ();
08533 }
08534 }
08535 }
08536
08537 void set_zlim (const octave_value& val)
08538 {
08539 if (! error_state)
08540 {
08541 if (zlim.set (val, false))
08542 {
08543 update_axis_limits ("zlim");
08544 zlim.run_listeners (POSTSET);
08545 mark_modified ();
08546 }
08547 }
08548 }
08549
08550 void set_clim (const octave_value& val)
08551 {
08552 if (! error_state)
08553 {
08554 if (clim.set (val, false))
08555 {
08556 update_axis_limits ("clim");
08557 clim.run_listeners (POSTSET);
08558 mark_modified ();
08559 }
08560 }
08561 }
08562
08563 void set_alim (const octave_value& val)
08564 {
08565 if (! error_state)
08566 {
08567 if (alim.set (val, false))
08568 {
08569 update_axis_limits ("alim");
08570 alim.run_listeners (POSTSET);
08571 mark_modified ();
08572 }
08573 }
08574 }
08575
08576 void set_xliminclude (const octave_value& val)
08577 {
08578 if (! error_state)
08579 {
08580 if (xliminclude.set (val, false))
08581 {
08582 update_axis_limits ("xliminclude");
08583 xliminclude.run_listeners (POSTSET);
08584 mark_modified ();
08585 }
08586 }
08587 }
08588
08589 void set_yliminclude (const octave_value& val)
08590 {
08591 if (! error_state)
08592 {
08593 if (yliminclude.set (val, false))
08594 {
08595 update_axis_limits ("yliminclude");
08596 yliminclude.run_listeners (POSTSET);
08597 mark_modified ();
08598 }
08599 }
08600 }
08601
08602 void set_zliminclude (const octave_value& val)
08603 {
08604 if (! error_state)
08605 {
08606 if (zliminclude.set (val, false))
08607 {
08608 update_axis_limits ("zliminclude");
08609 zliminclude.run_listeners (POSTSET);
08610 mark_modified ();
08611 }
08612 }
08613 }
08614
08615 void set_climinclude (const octave_value& val)
08616 {
08617 if (! error_state)
08618 {
08619 if (climinclude.set (val, false))
08620 {
08621 update_axis_limits ("climinclude");
08622 climinclude.run_listeners (POSTSET);
08623 mark_modified ();
08624 }
08625 }
08626 }
08627
08628 void set_aliminclude (const octave_value& val)
08629 {
08630 if (! error_state)
08631 {
08632 if (aliminclude.set (val, false))
08633 {
08634 update_axis_limits ("aliminclude");
08635 aliminclude.run_listeners (POSTSET);
08636 mark_modified ();
08637 }
08638 }
08639 }
08640
08641
08642 protected:
08643 void init (void)
08644 {
08645 xdata.add_constraint (dim_vector (-1, -1));
08646 ydata.add_constraint (dim_vector (-1, -1));
08647 zdata.add_constraint (dim_vector (-1, -1));
08648 alphadata.add_constraint ("double");
08649 alphadata.add_constraint ("uint8");
08650 alphadata.add_constraint (dim_vector (-1, -1));
08651 vertexnormals.add_constraint (dim_vector (-1, -1, 3));
08652 cdata.add_constraint ("double");
08653 cdata.add_constraint ("uint8");
08654 cdata.add_constraint (dim_vector (-1, -1));
08655 cdata.add_constraint (dim_vector (-1, -1, 3));
08656 }
08657
08658 private:
08659 void update_normals (void);
08660
08661 void update_xdata (void)
08662 {
08663 update_normals ();
08664 set_xlim (xdata.get_limits ());
08665 }
08666
08667 void update_ydata (void)
08668 {
08669 update_normals ();
08670 set_ylim (ydata.get_limits ());
08671 }
08672
08673 void update_zdata (void)
08674 {
08675 update_normals ();
08676 set_zlim (zdata.get_limits ());
08677 }
08678
08679 void update_cdata (void)
08680 {
08681 if (cdatamapping_is ("scaled"))
08682 set_clim (cdata.get_limits ());
08683 else
08684 clim = cdata.get_limits ();
08685 }
08686
08687 void update_alphadata (void)
08688 {
08689 if (alphadatamapping_is ("scaled"))
08690 set_alim (alphadata.get_limits ());
08691 else
08692 alim = alphadata.get_limits ();
08693 }
08694
08695 void update_normalmode (void)
08696 { update_normals (); }
08697
08698 void update_vertexnormals (void)
08699 { set_normalmode ("manual"); }
08700 };
08701
08702 private:
08703 properties xproperties;
08704
08705 public:
08706 surface (const graphics_handle& mh, const graphics_handle& p)
08707 : base_graphics_object (), xproperties (mh, p)
08708 {
08709 xproperties.override_defaults (*this);
08710 }
08711
08712 ~surface (void) { xproperties.delete_children (); }
08713
08714 base_properties& get_properties (void) { return xproperties; }
08715
08716 const base_properties& get_properties (void) const { return xproperties; }
08717
08718 bool valid_object (void) const { return true; }
08719 };
08720
08721
08722
08723 class OCTINTERP_API hggroup : public base_graphics_object
08724 {
08725 public:
08726 class OCTINTERP_API properties : public base_properties
08727 {
08728 public:
08729 void remove_child (const graphics_handle& h)
08730 {
08731 base_properties::remove_child (h);
08732 update_limits ();
08733 }
08734
08735 void adopt (const graphics_handle& h)
08736 {
08737 base_properties::adopt (h);
08738 update_limits ();
08739 }
08740
08741
08742
08743
08744 public:
08745 properties (const graphics_handle& mh, const graphics_handle& p);
08746
08747 ~properties (void) { }
08748
08749 void set (const caseless_str& pname, const octave_value& val);
08750
08751 octave_value get (bool all = false) const;
08752
08753 octave_value get (const caseless_str& pname) const;
08754
08755 octave_value get (const std::string& pname) const
08756 {
08757 return get (caseless_str (pname));
08758 }
08759
08760 octave_value get (const char *pname) const
08761 {
08762 return get (caseless_str (pname));
08763 }
08764
08765 property get_property (const caseless_str& pname);
08766
08767 std::string graphics_object_name (void) const { return go_name; }
08768
08769 static property_list::pval_map_type factory_defaults (void);
08770
08771 private:
08772 static std::string go_name;
08773
08774 public:
08775
08776
08777 static std::set<std::string> core_property_names (void);
08778
08779 static bool has_core_property (const caseless_str& pname);
08780
08781 std::set<std::string> all_property_names (void) const;
08782
08783 bool has_property (const caseless_str& pname) const;
08784
08785 private:
08786
08787 row_vector_property xlim;
08788 row_vector_property ylim;
08789 row_vector_property zlim;
08790 row_vector_property clim;
08791 row_vector_property alim;
08792 bool_property xliminclude;
08793 bool_property yliminclude;
08794 bool_property zliminclude;
08795 bool_property climinclude;
08796 bool_property aliminclude;
08797
08798 public:
08799
08800 enum
08801 {
08802 XLIM = 9000,
08803 YLIM = 9001,
08804 ZLIM = 9002,
08805 CLIM = 9003,
08806 ALIM = 9004,
08807 XLIMINCLUDE = 9005,
08808 YLIMINCLUDE = 9006,
08809 ZLIMINCLUDE = 9007,
08810 CLIMINCLUDE = 9008,
08811 ALIMINCLUDE = 9009
08812 };
08813
08814 octave_value get_xlim (void) const { return xlim.get (); }
08815
08816 octave_value get_ylim (void) const { return ylim.get (); }
08817
08818 octave_value get_zlim (void) const { return zlim.get (); }
08819
08820 octave_value get_clim (void) const { return clim.get (); }
08821
08822 octave_value get_alim (void) const { return alim.get (); }
08823
08824 bool is_xliminclude (void) const { return xliminclude.is_on (); }
08825 std::string get_xliminclude (void) const { return xliminclude.current_value (); }
08826
08827 bool is_yliminclude (void) const { return yliminclude.is_on (); }
08828 std::string get_yliminclude (void) const { return yliminclude.current_value (); }
08829
08830 bool is_zliminclude (void) const { return zliminclude.is_on (); }
08831 std::string get_zliminclude (void) const { return zliminclude.current_value (); }
08832
08833 bool is_climinclude (void) const { return climinclude.is_on (); }
08834 std::string get_climinclude (void) const { return climinclude.current_value (); }
08835
08836 bool is_aliminclude (void) const { return aliminclude.is_on (); }
08837 std::string get_aliminclude (void) const { return aliminclude.current_value (); }
08838
08839
08840 void set_xlim (const octave_value& val)
08841 {
08842 if (! error_state)
08843 {
08844 if (xlim.set (val, true))
08845 {
08846 mark_modified ();
08847 }
08848 }
08849 }
08850
08851 void set_ylim (const octave_value& val)
08852 {
08853 if (! error_state)
08854 {
08855 if (ylim.set (val, true))
08856 {
08857 mark_modified ();
08858 }
08859 }
08860 }
08861
08862 void set_zlim (const octave_value& val)
08863 {
08864 if (! error_state)
08865 {
08866 if (zlim.set (val, true))
08867 {
08868 mark_modified ();
08869 }
08870 }
08871 }
08872
08873 void set_clim (const octave_value& val)
08874 {
08875 if (! error_state)
08876 {
08877 if (clim.set (val, true))
08878 {
08879 mark_modified ();
08880 }
08881 }
08882 }
08883
08884 void set_alim (const octave_value& val)
08885 {
08886 if (! error_state)
08887 {
08888 if (alim.set (val, true))
08889 {
08890 mark_modified ();
08891 }
08892 }
08893 }
08894
08895 void set_xliminclude (const octave_value& val)
08896 {
08897 if (! error_state)
08898 {
08899 if (xliminclude.set (val, true))
08900 {
08901 mark_modified ();
08902 }
08903 }
08904 }
08905
08906 void set_yliminclude (const octave_value& val)
08907 {
08908 if (! error_state)
08909 {
08910 if (yliminclude.set (val, true))
08911 {
08912 mark_modified ();
08913 }
08914 }
08915 }
08916
08917 void set_zliminclude (const octave_value& val)
08918 {
08919 if (! error_state)
08920 {
08921 if (zliminclude.set (val, true))
08922 {
08923 mark_modified ();
08924 }
08925 }
08926 }
08927
08928 void set_climinclude (const octave_value& val)
08929 {
08930 if (! error_state)
08931 {
08932 if (climinclude.set (val, true))
08933 {
08934 mark_modified ();
08935 }
08936 }
08937 }
08938
08939 void set_aliminclude (const octave_value& val)
08940 {
08941 if (! error_state)
08942 {
08943 if (aliminclude.set (val, true))
08944 {
08945 mark_modified ();
08946 }
08947 }
08948 }
08949
08950
08951 private:
08952 void update_limits (void)
08953 {
08954 update_axis_limits ("xlim");
08955 update_axis_limits ("ylim");
08956 update_axis_limits ("zlim");
08957 update_axis_limits ("clim");
08958 update_axis_limits ("alim");
08959 }
08960
08961 protected:
08962 void init (void)
08963 { }
08964 };
08965
08966 private:
08967 properties xproperties;
08968
08969 public:
08970 hggroup (const graphics_handle& mh, const graphics_handle& p)
08971 : base_graphics_object (), xproperties (mh, p)
08972 {
08973 xproperties.override_defaults (*this);
08974 }
08975
08976 ~hggroup (void) { xproperties.delete_children (); }
08977
08978 base_properties& get_properties (void) { return xproperties; }
08979
08980 const base_properties& get_properties (void) const { return xproperties; }
08981
08982 bool valid_object (void) const { return true; }
08983
08984 void update_axis_limits (const std::string& axis_type);
08985 };
08986
08987
08988
08989 octave_value
08990 get_property_from_handle (double handle, const std::string &property,
08991 const std::string &func);
08992 bool
08993 set_property_in_handle (double handle, const std::string &property,
08994 const octave_value &arg, const std::string &func);
08995
08996
08997
08998 class graphics_event;
08999
09000 class
09001 base_graphics_event
09002 {
09003 public:
09004 friend class graphics_event;
09005
09006 base_graphics_event (void) : count (1) { }
09007
09008 virtual ~base_graphics_event (void) { }
09009
09010 virtual void execute (void) = 0;
09011
09012 private:
09013 int count;
09014 };
09015
09016 class
09017 graphics_event
09018 {
09019 public:
09020 typedef void (*event_fcn) (void*);
09021
09022 graphics_event (void) : rep (0) { }
09023
09024 graphics_event (const graphics_event& e)
09025 {
09026 rep = e.rep;
09027 rep->count++;
09028 }
09029
09030 ~graphics_event (void)
09031 {
09032 if (rep && --rep->count == 0)
09033 delete rep;
09034 }
09035
09036 graphics_event& operator = (const graphics_event& e)
09037 {
09038 if (rep != e.rep)
09039 {
09040 if (rep && --rep->count == 0)
09041 delete rep;
09042
09043 rep = e.rep;
09044 if (rep)
09045 rep->count++;
09046 }
09047
09048 return *this;
09049 }
09050
09051 void execute (void)
09052 { if (rep) rep->execute (); }
09053
09054 bool ok (void) const
09055 { return (rep != 0); }
09056
09057 static graphics_event
09058 create_callback_event (const graphics_handle& h,
09059 const std::string& name,
09060 const octave_value& data = Matrix ());
09061
09062 static graphics_event
09063 create_function_event (event_fcn fcn, void *data = 0);
09064
09065 static graphics_event
09066 create_set_event (const graphics_handle& h,
09067 const std::string& name,
09068 const octave_value& value);
09069 private:
09070 base_graphics_event *rep;
09071 };
09072
09073 class OCTINTERP_API gh_manager
09074 {
09075 protected:
09076
09077 gh_manager (void);
09078
09079 public:
09080
09081 static bool instance_ok (void)
09082 {
09083 bool retval = true;
09084
09085 if (! instance)
09086 instance = new gh_manager ();
09087
09088 if (! instance)
09089 {
09090 ::error ("unable to create gh_manager!");
09091
09092 retval = false;
09093 }
09094
09095 return retval;
09096 }
09097
09098 static void free (const graphics_handle& h)
09099 {
09100 if (instance_ok ())
09101 instance->do_free (h);
09102 }
09103
09104 static graphics_handle lookup (double val)
09105 {
09106 return instance_ok () ? instance->do_lookup (val) : graphics_handle ();
09107 }
09108
09109 static graphics_object get_object (const graphics_handle& h)
09110 {
09111 return instance_ok () ? instance->do_get_object (h) : graphics_object ();
09112 }
09113
09114 static graphics_handle
09115 make_graphics_handle (const std::string& go_name,
09116 const graphics_handle& parent, bool do_createfcn = true)
09117 {
09118 return instance_ok ()
09119 ? instance->do_make_graphics_handle (go_name, parent, do_createfcn)
09120 : graphics_handle ();
09121 }
09122
09123 static graphics_handle make_figure_handle (double val)
09124 {
09125 return instance_ok ()
09126 ? instance->do_make_figure_handle (val) : graphics_handle ();
09127 }
09128
09129 static void push_figure (const graphics_handle& h)
09130 {
09131 if (instance_ok ())
09132 instance->do_push_figure (h);
09133 }
09134
09135 static void pop_figure (const graphics_handle& h)
09136 {
09137 if (instance_ok ())
09138 instance->do_pop_figure (h);
09139 }
09140
09141 static graphics_handle current_figure (void)
09142 {
09143 return instance_ok ()
09144 ? instance->do_current_figure () : graphics_handle ();
09145 }
09146
09147 static Matrix handle_list (void)
09148 {
09149 return instance_ok () ? instance->do_handle_list () : Matrix ();
09150 }
09151
09152 static void lock (void)
09153 {
09154 if (instance_ok ())
09155 instance->do_lock ();
09156 }
09157
09158 static void unlock (void)
09159 {
09160 if (instance_ok ())
09161 instance->do_unlock ();
09162 }
09163
09164 static Matrix figure_handle_list (void)
09165 {
09166 return instance_ok () ? instance->do_figure_handle_list () : Matrix ();
09167 }
09168
09169 static void execute_callback (const graphics_handle& h,
09170 const std::string& name,
09171 const octave_value& data = Matrix ())
09172 {
09173 graphics_object go = get_object (h);
09174
09175 if (go.valid_object ())
09176 {
09177 octave_value cb = go.get (name);
09178
09179 if (! error_state)
09180 execute_callback (h, cb, data);
09181 }
09182 }
09183
09184 static void execute_callback (const graphics_handle& h,
09185 const octave_value& cb,
09186 const octave_value& data = Matrix ())
09187 {
09188 if (instance_ok ())
09189 instance->do_execute_callback (h, cb, data);
09190 }
09191
09192 static void post_callback (const graphics_handle& h,
09193 const std::string& name,
09194 const octave_value& data = Matrix ())
09195 {
09196 if (instance_ok ())
09197 instance->do_post_callback (h, name, data);
09198 }
09199
09200 static void post_function (graphics_event::event_fcn fcn, void* data = 0)
09201 {
09202 if (instance_ok ())
09203 instance->do_post_function (fcn, data);
09204 }
09205
09206 static void post_set (const graphics_handle& h,
09207 const std::string& name,
09208 const octave_value& value)
09209 {
09210 if (instance_ok ())
09211 instance->do_post_set (h, name, value);
09212 }
09213
09214 static int process_events (void)
09215 {
09216 return (instance_ok () ? instance->do_process_events () : 0);
09217 }
09218
09219 static int flush_events (void)
09220 {
09221 return (instance_ok () ? instance->do_process_events (true) : 0);
09222 }
09223
09224 static bool is_handle_visible (const graphics_handle& h)
09225 {
09226 bool retval = false;
09227
09228 graphics_object go = get_object (h);
09229
09230 if (go.valid_object ())
09231 retval = go.is_handle_visible ();
09232
09233 return retval;
09234 }
09235
09236 public:
09237 class autolock
09238 {
09239 public:
09240 autolock (void) { lock (); }
09241
09242 ~autolock (void) { unlock (); }
09243
09244 private:
09245
09246
09247 autolock (const autolock&);
09248 autolock& operator = (const autolock&);
09249 };
09250
09251 private:
09252
09253 static gh_manager *instance;
09254
09255 typedef std::map<graphics_handle, graphics_object>::iterator iterator;
09256 typedef std::map<graphics_handle, graphics_object>::const_iterator const_iterator;
09257
09258 typedef std::set<graphics_handle>::iterator free_list_iterator;
09259 typedef std::set<graphics_handle>::const_iterator const_free_list_iterator;
09260
09261 typedef std::list<graphics_handle>::iterator figure_list_iterator;
09262 typedef std::list<graphics_handle>::const_iterator const_figure_list_iterator;
09263
09264
09265 std::map<graphics_handle, graphics_object> handle_map;
09266
09267
09268 std::set<graphics_handle> handle_free_list;
09269
09270
09271 double next_handle;
09272
09273
09274
09275 std::list<graphics_handle> figure_list;
09276
09277
09278 octave_mutex graphics_lock;
09279
09280
09281 std::list<graphics_event> event_queue;
09282
09283
09284 std::list<graphics_object> callback_objects;
09285
09286 graphics_handle get_handle (const std::string& go_name);
09287
09288 void do_free (const graphics_handle& h);
09289
09290 graphics_handle do_lookup (double val)
09291 {
09292 iterator p = (xisnan (val) ? handle_map.end () : handle_map.find (val));
09293
09294 return (p != handle_map.end ()) ? p->first : graphics_handle ();
09295 }
09296
09297 graphics_object do_get_object (const graphics_handle& h)
09298 {
09299 iterator p = (h.ok () ? handle_map.find (h) : handle_map.end ());
09300
09301 return (p != handle_map.end ()) ? p->second : graphics_object ();
09302 }
09303
09304 graphics_handle do_make_graphics_handle (const std::string& go_name,
09305 const graphics_handle& p, bool do_createfcn);
09306
09307 graphics_handle do_make_figure_handle (double val);
09308
09309 Matrix do_handle_list (void)
09310 {
09311 Matrix retval (1, handle_map.size ());
09312 octave_idx_type i = 0;
09313 for (const_iterator p = handle_map.begin (); p != handle_map.end (); p++)
09314 {
09315 graphics_handle h = p->first;
09316 retval(i++) = h.value ();
09317 }
09318 return retval;
09319 }
09320
09321 Matrix do_figure_handle_list (void)
09322 {
09323 Matrix retval (1, figure_list.size ());
09324 octave_idx_type i = 0;
09325 for (const_figure_list_iterator p = figure_list.begin ();
09326 p != figure_list.end ();
09327 p++)
09328 {
09329 graphics_handle h = *p;
09330 retval(i++) = h.value ();
09331 }
09332 return retval;
09333 }
09334
09335 void do_push_figure (const graphics_handle& h);
09336
09337 void do_pop_figure (const graphics_handle& h);
09338
09339 graphics_handle do_current_figure (void) const
09340 {
09341 return figure_list.empty () ? graphics_handle () : figure_list.front ();
09342 }
09343
09344 void do_lock (void) { graphics_lock.lock (); }
09345
09346 void do_unlock (void) { graphics_lock.unlock (); }
09347
09348 void do_execute_callback (const graphics_handle& h, const octave_value& cb,
09349 const octave_value& data);
09350
09351 void do_post_callback (const graphics_handle& h, const std::string name,
09352 const octave_value& data);
09353
09354 void do_post_function (graphics_event::event_fcn fcn, void* fcn_data);
09355
09356 void do_post_set (const graphics_handle& h, const std::string name,
09357 const octave_value& value);
09358
09359 int do_process_events (bool force = false);
09360
09361 static void restore_gcbo (void)
09362 {
09363 if (instance_ok ())
09364 instance->do_restore_gcbo ();
09365 }
09366
09367 void do_restore_gcbo (void);
09368
09369 void do_post_event (const graphics_event& e);
09370 };
09371
09372 void get_children_limits (double& min_val, double& max_val, double& min_pos,
09373 const Matrix& kids, char limit_type);
09374
09375
09376 OCTINTERP_API graphics_handle gcf (void);
09377
09378
09379 OCTINTERP_API graphics_handle gca (void);
09380
09381 #endif
09382
09383
09384
09385
09386
09387