69 error (
"set: invalid value for %s property", pname.c_str ());
78 const std::set<std::string>& pnames,
81 size_t len = pname.length ();
82 std::set<std::string> matches;
84 for (std::set<std::string>::const_iterator p = pnames.begin ();
85 p != pnames.end (); p++)
89 if (len == p->length ())
99 size_t num_matches = matches.size ();
101 if (num_matches == 0)
103 error (
"%s: unknown %s property %s",
104 who.c_str (), what.c_str (), pname.c_str ());
106 else if (num_matches > 1)
110 std::ostringstream os;
114 std::string match_list = os.str ();
116 error (
"%s: ambiguous %s property name %s; possible matches:\n\n%s",
117 who.c_str (), what.c_str (), pname.c_str (), match_list.c_str ());
119 else if (num_matches == 1)
123 std::string possible_match = *(matches.begin ());
126 "%s: allowing %s to match %s property %s",
127 who.c_str (), pname.c_str (), what.c_str (),
128 possible_match.c_str ());
130 return possible_match;
143 double delta = 1.0 / 63.0;
156 if (x >= 3.0/8.0 && x < 5.0/8.0)
157 cmap(i,0) = 4.0 * x - 3.0/2.0;
158 else if (x >= 5.0/8.0 && x < 7.0/8.0)
160 else if (x >= 7.0/8.0)
161 cmap(i,0) = -4.0 * x + 9.0/2.0;
163 if (x >= 1.0/8.0 && x < 3.0/8.0)
164 cmap(i,1) = 4.0 * x - 1.0/2.0;
165 else if (x >= 3.0/8.0 && x < 5.0/8.0)
167 else if (x >= 5.0/8.0 && x < 7.0/8.0)
168 cmap(i,1) = -4.0 * x + 7.0/2.0;
171 cmap(i,2) = 4.0 * x + 1.0/2.0;
172 else if (x >= 1.0/8.0 && x < 3.0/8.0)
174 else if (x >= 3.0/8.0 && x < 5.0/8.0)
175 cmap(i,2) = -4.0 * x + 5.0/2.0;
190 Matrix retval (1, 4, 1.0);
207 Matrix retval (7, 3, 0.0);
263 for (
int col = 0; col < 64; col++)
264 for (
int row = 0; row < 64; row++)
277 for (
int col = 0; col < 3; col++)
278 for (
int row = 0; row < 3; row++)
288 for (
int row = 0; row < 3; row++)
289 for (
int col = 0; col < 3; col++)
299 for (
int row = 0; row < 3; row++)
428 Matrix retval (1, 4, 0.0);
441 Matrix retval (1, 2, 0.0);
452 Matrix retval (1, 4, 0.0);
468 if (from_units.
compare (to_units))
474 double points_size = 0;
477 if (from_units.
compare (
"points"))
478 points_size = font_size;
483 if (from_units.
compare (
"pixels"))
484 points_size = font_size * 72.0 / res;
485 else if (from_units.
compare (
"inches"))
486 points_size = font_size * 72.0;
487 else if (from_units.
compare (
"centimeters"))
488 points_size = font_size * 72.0 / 2.54;
489 else if (from_units.
compare (
"normalized"))
490 points_size = font_size * parent_height * 72.0 / res;
493 double new_font_size = 0;
495 if (to_units.
compare (
"points"))
496 new_font_size = points_size;
502 if (to_units.
compare (
"pixels"))
503 new_font_size = points_size * res / 72.0;
504 else if (to_units.
compare (
"inches"))
505 new_font_size = points_size / 72.0;
506 else if (to_units.
compare (
"centimeters"))
507 new_font_size = points_size * 2.54 / 72.0;
508 else if (to_units.
compare (
"normalized"))
512 if (parent_height > 0)
513 new_font_size = points_size * res / (parent_height * 72.0);
517 return new_font_size;
526 bool is_rectangle = (pos.
numel () == 4);
527 bool is_2d = (pos.
numel () == 2);
529 if (from_units.
compare (
"pixels"))
531 else if (from_units.
compare (
"normalized"))
533 retval(0) = pos(0) * parent_dim(0) + 1;
534 retval(1) = pos(1) * parent_dim(1) + 1;
537 retval(2) = pos(2) * parent_dim(0);
538 retval(3) = pos(3) * parent_dim(1);
543 else if (from_units.
compare (
"characters"))
552 f = 12.0 * res / 74.951;
556 retval(0) = 0.5 * pos(0) *
f;
557 retval(1) = pos(1) *
f;
560 retval(2) = 0.5 * pos(2) *
f;
561 retval(3) = pos(3) *
f;
574 if (from_units.
compare (
"points"))
576 else if (from_units.
compare (
"inches"))
578 else if (from_units.
compare (
"centimeters"))
583 retval(0) = pos(0) * f + 1;
584 retval(1) = pos(1) * f + 1;
587 retval(2) = pos(2) *
f;
588 retval(3) = pos(3) *
f;
595 if (! to_units.
compare (
"pixels"))
597 if (to_units.
compare (
"normalized"))
599 retval(0) = (retval(0) - 1) / parent_dim(0);
600 retval(1) = (retval(1) - 1) / parent_dim(1);
603 retval(2) /= parent_dim(0);
604 retval(3) /= parent_dim(1);
609 else if (to_units.
compare (
"characters"))
616 f = 12.0 * res / 74.951;
620 retval(0) = 2 * retval(0) /
f;
621 retval(1) = retval(1) /
f;
624 retval(2) = 2 * retval(2) /
f;
625 retval(3) = retval(3) /
f;
638 if (to_units.
compare (
"points"))
640 else if (to_units.
compare (
"inches"))
642 else if (to_units.
compare (
"centimeters"))
647 retval(0) = (retval(0) - 1) / f;
648 retval(1) = (retval(1) - 1) / f;
659 else if (! is_rectangle && ! is_2d)
675 if (ax.valid_object ())
680 bool is_rectangle = (pos.
numel () == 4);
682 ax_size = ax_bbox.
extract_n (0, 2, 1, 2);
684 if (from_units.
compare (
"data"))
694 retval(0) =
v1(0) - ax_bbox(0) + 1;
695 retval(1) = ax_bbox(1) + ax_bbox(3) -
v1(1) + 1;
696 retval(2) =
v2(0) -
v1(0);
697 retval(3) =
v1(1) -
v2(1);
705 retval(0) = v(0) - ax_bbox(0) + 1;
706 retval(1) = ax_bbox(1) + ax_bbox(3) - v(1) + 1;
713 if (! to_units.
compare (
"pixels"))
721 retval(0) + ax_bbox(0) - 1,
722 ax_bbox(1) + ax_bbox(3) - retval(1) + 1);
724 retval(0) + retval(2) + ax_bbox(0) - 1,
725 ax_bbox(1) + ax_bbox(3) - (retval(1) + retval(3)) + 1);
731 retval(2) =
v2(0) -
v1(0);
732 retval(3) =
v2(1) -
v1(1);
738 retval(0) + ax_bbox(0) - 1,
739 ax_bbox(1) + ax_bbox(3) - retval(1) + 1);
763 sz.
extract_n (0, 2, 1, 2)).extract_n (0, 2, 1, 2);
772 x =
xround ((nc - 1) * (x - clim_0) / (clim_1 - clim_0));
792 av[i+lda] = cmapv[idx+nc];
793 av[i+2*lda] = cmapv[idx+2*nc];
805 clim_0, clim_1, cmapv, cv[i], lda, nc, i, av);
810 bool is_scaled,
int cdim)
815 if (dv.length () == cdim && dv(cdim-1) == 3)
824 if (fig.valid_object ())
854 const double *cmapv = cmap.
data ();
856 double clim_0 = clim(0);
857 double clim_1 = clim(1);
867 #define CONVERT_CDATA_1(ARRAY_T, VAL_FN, IS_REAL) \
870 ARRAY_T tmp = cdata. VAL_FN ## array_value (); \
872 convert_cdata_1 (is_scaled, IS_REAL, clim_0, clim_1, cmapv, \
873 tmp.data (), lda, nc, av); \
888 error (
"unsupported type for cdata (= %s)", cdata.
type_name ().c_str ());
890 #undef CONVERT_CDATA_1
898 double& eminp,
double& emaxp)
900 const T *data = m.
data ();
905 double e =
double (data[i]);
916 if (e > 0 && e < eminp)
919 if (e < 0 && e > emaxp)
929 int len = name.length ();
942 pfx = name.substr (0, 5);
948 pfx = name.substr (0, 6);
954 pfx = name.substr (0, 7);
961 pfx = name.substr (0, 9);
968 pfx = name.substr (0, 10);
970 if (pfx.
compare (
"uipushtool"))
974 pfx = name.substr (0, 12);
976 if (pfx.
compare (
"uitoggletool"))
980 pfx = name.substr (0, 13);
982 if (pfx.
compare (
"uicontextmenu"))
995 rest = name.substr (offset);
1012 else if (type.
compare (
"axes"))
1013 go =
new axes (h, p);
1014 else if (type.
compare (
"line"))
1015 go =
new line (h, p);
1016 else if (type.
compare (
"text"))
1017 go =
new text (h, p);
1018 else if (type.
compare (
"image"))
1019 go =
new image (h, p);
1020 else if (type.
compare (
"patch"))
1021 go =
new patch (h, p);
1022 else if (type.
compare (
"surface"))
1024 else if (type.
compare (
"hggroup"))
1026 else if (type.
compare (
"uimenu"))
1028 else if (type.
compare (
"uicontrol"))
1030 else if (type.
compare (
"uipanel"))
1032 else if (type.
compare (
"uicontextmenu"))
1034 else if (type.
compare (
"uitoolbar"))
1036 else if (type.
compare (
"uipushtool"))
1038 else if (type.
compare (
"uitoggletool"))
1052 if (
id >= 0 && do_notify_toolkit)
1075 for (
int i = 0; i < l.
length (); i++)
1085 : default_val (), possible_vals ()
1088 size_t len = opt_string.length ();
1089 bool done = len == 0;
1093 size_t end = opt_string.find (
'|', beg);
1095 if (end == std::string::npos)
1101 std::string t = opt_string.substr (beg, end-beg);
1106 t = t.substr (1, t.length () - 2);
1122 for (std::set<caseless_str>::const_iterator it =
possible_vals.begin ();
1125 if (retval.empty ())
1128 retval =
"{" + *it +
"}";
1135 retval +=
" | {" + *it +
"}";
1137 retval +=
" | " + *it;
1141 if (! retval.empty ())
1142 retval =
"[ " + retval +
" ]";
1152 for (std::set<caseless_str>::const_iterator it =
possible_vals.begin ();
1154 retval(i++) = std::string (*it);
1163 double tmp_rgb[3] = {0, 0, 0};
1165 std::string str = str_arg;
1166 unsigned int len = str.length ();
1168 std::transform (str.begin (), str.end (), str.begin (), tolower);
1170 if (str.compare (0, len,
"blue", 0, len) == 0)
1172 else if (str.compare (0, len,
"black", 0, len) == 0
1173 || str.compare (0, len,
"k", 0, len) == 0)
1174 tmp_rgb[0] = tmp_rgb[1] = tmp_rgb[2] = 0;
1175 else if (str.compare (0, len,
"red", 0, len) == 0)
1177 else if (str.compare (0, len,
"green", 0, len) == 0)
1179 else if (str.compare (0, len,
"yellow", 0, len) == 0)
1180 tmp_rgb[0] = tmp_rgb[1] = 1;
1181 else if (str.compare (0, len,
"magenta", 0, len) == 0)
1182 tmp_rgb[0] = tmp_rgb[2] = 1;
1183 else if (str.compare (0, len,
"cyan", 0, len) == 0)
1184 tmp_rgb[1] = tmp_rgb[2] = 1;
1185 else if (str.compare (0, len,
"white", 0, len) == 0
1186 || str.compare (0, len,
"w", 0, len) == 0)
1187 tmp_rgb[0] = tmp_rgb[1] = tmp_rgb[2] = 1;
1193 for (
int i = 0; i < 3; i++)
1194 xrgb(i) = tmp_rgb[i];
1215 if (s.length () != match.length ())
1217 "%s: allowing %s to match %s value %s",
1218 "set", s.c_str (),
get_name ().c_str (),
1238 error (
"invalid value for color property \"%s\" (value = %s)",
1243 error (
"invalid value for color property \"%s\"",
1250 if (m.
numel () == 3)
1264 error (
"invalid value for color property \"%s\"",
1268 error (
"invalid value for color property \"%s\"",
1286 if (s.length () != match.length ())
1288 "%s: allowing %s to match %s value %s",
1289 "set", s.c_str (),
get_name ().c_str (),
1297 error (
"invalid value for double_radio property \"%s\"",
1312 error (
"invalid value for double_radio property \"%s\"",
1344 int vlen = vdims.
length ();
1354 if (itdims.
length () == vlen)
1358 for (
int i = 0; xok && i < vlen; i++)
1362 if (itdims(i) != vdims(i))
1383 #define CHECK_ARRAY_EQUAL(T,F,A) \
1385 if (data.numel () == 1) \
1386 return data.F ## scalar_value () == \
1387 v.F ## scalar_value (); \
1392 const A m1 = data.F ## array_value (); \
1393 const T* d1 = m1.data (); \
1394 const A m2 = v.F ## array_value (); \
1395 const T* d2 = m2.data ();\
1399 for (int i = 0; flag && i < data.numel (); i++) \
1400 if (d1[i] != d2[i]) \
1479 if (!
get ().is_empty ())
1503 error (
"set: invalid graphics handle (= %g) for property \"%s\"",
1507 error (
"set: invalid graphics handle for property \"%s\"",
1533 if (! return_hidden)
1536 else if (return_hidden)
1540 retval.resize (k, 1);
1615 executing_callback =
true;
1634 std::string val = (args.
length () > 0 ? args(0).string_value () :
"");
1639 else if (type.
compare (
"any"))
1646 else if (type.
compare (
"radio"))
1650 std::string vals = args(0).string_value ();
1657 retval.set (args(1));
1660 error (
"addproperty: invalid argument for radio property, expected a string value");
1663 error (
"addproperty: missing possible values for radio property");
1665 else if (type.
compare (
"double"))
1667 double d = (args.
length () > 0 ? args(0).double_value () : 0);
1672 else if (type.
compare (
"handle"))
1683 else if (type.
compare (
"boolean"))
1688 retval.set (args(0));
1690 else if (type.
compare (
"data"))
1696 retval.set (args(0));
1702 else if (type.
compare (
"color"))
1716 if (args.
length () > 0 && ! args(0).is_empty ())
1717 retval.set (args(0));
1731 std::map<caseless_str, graphics_object>::const_iterator it =
1732 dprop_obj_map.find (go_name);
1734 if (it == dprop_obj_map.end ())
1743 dprop_obj_map[go_name] = go;
1755 retval = prop.
clone ();
1758 retval.set_name (name);
1761 retval.set (args(0));
1765 error (
"addproperty: invalid object type (= %s)",
1769 error (
"addproperty: unsupported type for dynamic property (= %s)",
1785 for (
int k = 0; k < children.
numel (); k++)
1803 for (
int k = 0; k < children.
numel (); k++)
1829 std::string direction =
"in";
1837 if (modestr ==
"zoom in")
1839 val = modestr =
"zoom";
1842 else if (modestr ==
"zoom out")
1844 val = modestr =
"zoom";
1848 if (__mouse_mode__.set (val,
true))
1850 std::string mode = __mouse_mode__.current_value ();
1853 pm.
setfield (
"Enable", mode ==
"pan" ?
"on" :
"off");
1854 set___pan_mode__ (pm);
1857 rm.
setfield (
"Enable", mode ==
"rotate" ?
"on" :
"off");
1858 set___rotate_mode__ (rm);
1861 zm.
setfield (
"Enable", mode ==
"zoom" ?
"on" :
"off");
1862 zm.
setfield (
"Direction", direction);
1863 set___zoom_mode__ (zm);
1867 else if (modestr ==
"zoom")
1870 std::string curr_direction
1873 if (direction != curr_direction)
1875 zm.
setfield (
"Direction", direction);
1876 set___zoom_mode__ (zm);
1892 size_t len = name.length ();
1903 pfx = name.substr (0, 5);
1909 pfx = name.substr (0, 6);
1915 pfx = name.substr (0, 7);
1922 pfx = name.substr (0, 9);
1929 pfx = name.substr (0, 10);
1931 if (pfx.
compare (
"uipushtool"))
1935 pfx = name.substr (0, 12);
1937 if (pfx.
compare (
"uitoogletool"))
1941 pfx = name.substr (0, 13);
1943 if (pfx.
compare (
"uicontextmenu"))
1957 std::string pname = name.substr (offset);
1959 std::transform (pfx.begin (), pfx.end (), pfx.begin (), tolower);
1963 bool has_property =
false;
1966 else if (pfx ==
"line")
1968 else if (pfx ==
"text")
1970 else if (pfx ==
"image")
1972 else if (pfx ==
"patch")
1974 else if (pfx ==
"figure")
1976 else if (pfx ==
"surface")
1978 else if (pfx ==
"hggroup")
1980 else if (pfx ==
"uimenu")
1982 else if (pfx ==
"uicontrol")
1984 else if (pfx ==
"uipanel")
1986 else if (pfx ==
"uicontextmenu")
1988 else if (pfx ==
"uitoolbar")
1990 else if (pfx ==
"uipushtool")
1995 bool remove =
false;
2000 remove = (tval.compare (
"remove") == 0);
2009 if (p != pval_map.end ())
2013 pval_map[pname] = val;
2016 error (
"invalid %s property '%s'", pfx.c_str (), pname.c_str ());
2021 error (
"invalid default property specification");
2031 size_t len = name.length ();
2042 pfx = name.substr (0, 5);
2048 pfx = name.substr (0, 6);
2054 pfx = name.substr (0, 7);
2061 pfx = name.substr (0, 9);
2068 pfx = name.substr (0, 10);
2070 if (pfx.
compare (
"uipushtool"))
2074 pfx = name.substr (0, 12);
2076 if (pfx.
compare (
"uitoggletool"))
2080 pfx = name.substr (0, 13);
2082 if (pfx.
compare (
"uicontextmenu"))
2094 std::string pname = name.substr (offset);
2096 std::transform (pfx.begin (), pfx.end (), pfx.begin (), tolower);
2108 if (q != pval_map.end ())
2124 std::string prefix = prefix_arg + p->first;
2129 q != pval_map.end ();
2131 m.
assign (prefix + q->first, q->second);
2142 int nargin = args.
length ();
2145 error (
"graphics_object::set: Nothing to set");
2146 else if (nargin % 2 == 0)
2148 for (
int i = 0; i < nargin; i += 2)
2156 set_value_or_default (name, val);
2162 error (
"set: expecting argument %d to be a property name", i);
2166 error (
"set: invalid number of arguments");
2189 error (
"set: number of names must match number of value columns (%d != %d)",
2200 set_value_or_default (name, val);
2263 set_value_or_default (name, val);
2363 if (tval.compare (
"default") == 0)
2370 rep->set (name, default_val);
2372 else if (tval.compare (
"factory") == 0)
2379 rep->set (name, default_val);
2384 if (tval.compare (
"\\default") == 0)
2385 rep->set (name,
"default");
2386 else if (tval.compare (
"\\factory") == 0)
2387 rep->set (name,
"factory");
2389 rep->set (name, val);
2393 rep->set (name, val);
2417 static double maxrand = RAND_MAX + 2.0;
2419 return (rand () + 1.0) / maxrand;
2427 if (integer_figure_handle)
2436 while (handle_map.find (retval) != handle_map.end ())
2448 if (p != handle_free_list.end ())
2451 handle_free_list.erase (p);
2469 if (h.
value () != 0)
2473 if (p != handle_map.end ())
2486 p->second.finalize ();
2497 handle_map.erase (p);
2500 handle_free_list.insert
2504 error (
"graphics_handle::free: invalid object %g", h.
value ());
2507 error (
"graphics_handle::free: can't delete root figure");
2515 iterator p = handle_map.find (old_gh);
2517 if (p != handle_map.end ())
2521 handle_map.erase (p);
2523 handle_map[new_gh] = go;
2525 if (old_gh.
value () < 0)
2530 error (
"graphics_handle::free: invalid object %g", old_gh.
value ());
2533 q != figure_list.end (); q++)
2550 obj.
set (name, val);
2567 return obj.
get (name);
2594 obj.
set (
"parent", new_parent.
value ());
2599 error (
"%s: invalid graphics handle (= %g) for %s",
2600 who.c_str (), val,
property.c_str ());
2603 error (
"%s: expecting %s to be a graphics handle",
2604 who.c_str (),
property.c_str ());
2702 Matrix hlist = do_figure_handle_list (
true);
2714 hlist = do_figure_handle_list (
true);
2726 hlist = do_figure_handle_list (
true);
2728 assert (hlist.
numel () == 0);
2732 callback_objects.clear ();
2739 parent_obj.
adopt (h);
2786 return obj && obj.
isa (
"figure");
2843 p != pval.end (); p++)
2845 factory_pval[p->first] = p->second;
2851 it != factory_pval.end (); it++)
2853 std::string pname = it->first;
2857 && pname.find (
"__") != 0 && pname.find (
"current") != 0
2858 && pname !=
"uicontextmenu" && pname !=
"parent")
2861 if (pname.find (
"mode") == (pname.length () - 4))
2862 pval[pname] = it->second;
2864 obj.
set (pname, it->second);
2870 it != pval.end (); it++)
2871 obj.
set (it->first, it->second);
2880 std::string go_name = graphics_object_name ();
2884 if (p != defaults.
end ())
2889 q != pval_map.end ();
2892 std::string pname = q->first;
2894 obj.
set (pname, q->second);
2898 error (
"error setting default property %s", pname.c_str ());
2926 std::map<caseless_str, property, cmp_caseless_str>::const_iterator it =
2927 all_props.find (name);
2929 if (it != all_props.end ())
2930 retval = it->second.get ();
2932 error (
"get: unknown property \"%s\"", name.c_str ());
2942 for (std::map<caseless_str, property, cmp_caseless_str>::const_iterator
2943 it = all_props.begin (); it != all_props.end (); ++it)
2944 if (all || ! it->second.is_hidden ())
2945 m.
assign (it->second.get_name (), it->second.get ());
2950 std::set<std::string>
2953 return dynamic_properties;
2959 const std::set<std::string>& dynprops = dynamic_property_names ();
2961 if (dynprops.find (pname) != dynprops.end ())
2964 return all_props.find (pname) != all_props.end ();
2971 std::map<caseless_str, property, cmp_caseless_str>::iterator it =
2972 all_props.find (pname);
2974 if (it != all_props.end ())
2975 it->second.set (val);
2977 error (
"set: unknown property \"%s\"", pname.c_str ());
2981 dynamic_properties.insert (pname);
2990 std::map<caseless_str, property, cmp_caseless_str>::const_iterator it =
2991 all_props.find (name);
2993 if (it == all_props.end ())
2995 error (
"get_property: unknown property \"%s\"", name.c_str ());
3011 if (hnp == __myhandle__)
3012 error (
"set: can not set object parent to be object itself");
3017 if (new_parent.
ok ())
3033 if (new_parent_obj.
get_parent () == __myhandle__)
3041 ::adopt (parent.handle_value (), __myhandle__);
3044 error (
"set: invalid graphics handle (= %g) for parent", hnp);
3048 error (
"set: expecting parent to be a graphics handle");
3066 __modified__ =
"on";
3107 if (obj && obj.
isa (
"uicontextmenu"))
3118 return (handlevisibility.is (
"on")
3119 || (executing_callback && ! handlevisibility.is (
"off")));
3136 Matrix kids = get_children ();
3138 for (
int i = 0; i < kids.
numel (); i++)
3160 property p = get_property (nm);
3163 p.add_listener (v, mode);
3170 property p = get_property (nm);
3173 p.delete_listener (v, mode);
3189 error (
"base_graphics_object::update_axis_limits: invalid graphics object");
3204 error (
"base_graphics_object::update_axis_limits: invalid graphics object");
3241 local_defaults.
find (go_name);
3243 if (p != local_defaults.
end ())
3247 q != pval.end (); q++)
3249 std::string pname = q->first;
3250 if (def.
find (pname) == def.end ())
3251 def[pname] = q->second;
3269 .
find (type ())->second;
3287 if (pa->first !=
"children"
3292 if (p.ok () && ! p.is_hidden ())
3294 retval +=
"\n\t" + std::string (pa->first) +
": ";
3301 if (! retval.empty ())
3305 error (
"base_graphics_object::values_as_string: invalid graphics object");
3323 if (p.ok () && ! p.is_hidden ())
3330 if (! retval.empty ())
3334 error (
"base_graphics_object::value_as_string: invalid graphics object");
3350 pa != m.
end (); pa++)
3352 if (pa->first !=
"children"
3357 if (p.ok () && ! p.is_hidden ())
3360 retval.
assign (p.get_name (), p.values_as_cell ());
3368 error (
"base_graphics_object::values_as_struct: invalid graphics object");
3423 if (! cbo_stack.empty ())
3425 val = cbo_stack.front ();
3427 cbo_stack.pop_front ();
3430 callbackobject = val;
3434 if (get_callbackobject ().ok ())
3435 cbo_stack.push_front (get_callbackobject ());
3437 callbackobject = val;
3453 currentfigure = val;
3467 return std::string (
"on");
3469 return std::string (
"off");
3478 diary.set (val,
false);
3484 diary.run_listeners ();
3501 diaryfile.set (val,
false);
3505 Fdiary (
ovl (diaryfile.string_value ()));
3507 diaryfile.run_listeners ();
3517 return std::string (
"on");
3519 return std::string (
"off");
3528 echo.set (val,
false);
3532 Fecho (
ovl (echo.current_value ()));
3534 echo.run_listeners ();
3542 return Flasterr ()(0).string_value ();
3557 format.set (val,
false);
3563 format.run_listeners ();
3573 return std::string (
"compact");
3575 return std::string (
"loose");
3584 formatspacing.set (val,
false);
3588 std::string strval = formatspacing.current_value ();
3590 if (strval ==
"compact")
3595 formatspacing.run_listeners ();
3613 recursionlimit.set (val,
false);
3617 double dval = recursionlimit.double_value ();
3621 recursionlimit.run_listeners ();
3631 if (integerhandle.set (val,
true))
3633 bool int_fig_handle = integerhandle.is_on ();
3649 Matrix kids = get_children ();
3660 if (__myhandle__ == cf)
3661 xset (0,
"currentfigure", __myhandle__.value ());
3663 this_go.
update (integerhandle.get_id ());
3680 double dpi = get_screenpixelsperinch ();
3682 if (xunits.
compare (
"inches"))
3689 else if (xunits.
compare (
"centimeters"))
3693 ss(2) *= 2.54 / dpi;
3694 ss(3) *= 2.54 / dpi;
3696 else if (xunits.
compare (
"normalized"))
3702 else if (xunits.
compare (
"points"))
3710 set_screensize (ss);
3718 pos(2) = screen_size(0);
3719 pos(3) = screen_size(1);
3791 if (gh == currentaxes.handle_value ())
3795 Matrix kids = get_children ();
3803 if (go.
isa (
"axes"))
3805 new_currentaxes = kid;
3810 currentaxes = new_currentaxes;
3819 if (! get_currentaxes ().ok ())
3823 if (go.
type () ==
"axes")
3854 xset (0,
"currentfigure", __myhandle__.value ());
3865 get_position ().matrix_value () :
3866 get_outerposition ().matrix_value ());
3872 pos(1) = screen_size(1) - pos(1) - pos(3);
3879 bool do_notify_toolkit)
3884 pos(1) = screen_size(1) - pos(1) - pos(3);
3890 set_position (pos, do_notify_toolkit);
3892 set_outerposition (pos, do_notify_toolkit);
3898 Matrix bb = get_boundingbox (
true);
3904 pos(1) = bb(3) - pos(1);
3915 Matrix bb = get_boundingbox (
true);
3924 pos(1) = bb(3) - pos(1);
3931 bool do_notify_toolkit)
3936 bool modified =
false;
3938 old_bb = get_boundingbox (
true);
3939 modified = position.set (v,
false, do_notify_toolkit);
3940 new_bb = get_boundingbox (
true);
3942 if (old_bb != new_bb)
3944 if (old_bb(2) != new_bb(2) || old_bb(3) != new_bb(3))
3946 execute_resizefcn ();
3947 update_boundingbox ();
3953 position.run_listeners (
POSTSET);
3957 if (paperpositionmode.is (
"auto"))
3958 paperposition.set (get_auto_paperposition ());
3964 bool do_notify_toolkit)
3968 if (outerposition.set (v,
true, do_notify_toolkit))
3985 error (
"set: can't set the paperunits to normalized when the papertype is custom");
3989 if (paperunits.set (v,
true))
3991 update_paperunits (old_paperunits);
4009 error (
"set: can't set the paperunits to normalized when the papertype is custom");
4012 if (papertype.set (v,
true))
4014 update_papertype ();
4027 if (! punits.
compare (
"normalized"))
4032 if (punits.
compare (
"inches"))
4035 mm2units = 1 / 25.4 ;
4037 else if (punits.
compare (
"centimeters"))
4040 mm2units = 1 / 10.0;
4045 mm2units = 72.0 / 25.4;
4050 ret (0) = 8.5 * in2units;
4051 ret (1) = 11.0 * in2units;
4053 else if (typ.
compare (
"uslegal"))
4055 ret (0) = 8.5 * in2units;
4056 ret (1) = 14.0 * in2units;
4058 else if (typ.
compare (
"tabloid"))
4060 ret (0) = 11.0 * in2units;
4061 ret (1) = 17.0 * in2units;
4065 ret (0) = 841.0 * mm2units;
4066 ret (1) = 1189.0 * mm2units;
4070 ret (0) = 594.0 * mm2units;
4071 ret (1) = 841.0 * mm2units;
4075 ret (0) = 420.0 * mm2units;
4076 ret (1) = 594.0 * mm2units;
4080 ret (0) = 297.0 * mm2units;
4081 ret (1) = 420.0 * mm2units;
4085 ret (0) = 210.0 * mm2units;
4086 ret (1) = 297.0 * mm2units;
4090 ret (0) = 148.0 * mm2units;
4091 ret (1) = 210.0 * mm2units;
4095 ret (0) = 1029.0 * mm2units;
4096 ret (1) = 1456.0 * mm2units;
4100 ret (0) = 728.0 * mm2units;
4101 ret (1) = 1028.0 * mm2units;
4105 ret (0) = 514.0 * mm2units;
4106 ret (1) = 728.0 * mm2units;
4110 ret (0) = 364.0 * mm2units;
4111 ret (1) = 514.0 * mm2units;
4115 ret (0) = 257.0 * mm2units;
4116 ret (1) = 364.0 * mm2units;
4120 ret (0) = 182.0 * mm2units;
4121 ret (1) = 257.0 * mm2units;
4123 else if (typ.
compare (
"arch-a"))
4125 ret (0) = 9.0 * in2units;
4126 ret (1) = 12.0 * in2units;
4128 else if (typ.
compare (
"arch-b"))
4130 ret (0) = 12.0 * in2units;
4131 ret (1) = 18.0 * in2units;
4133 else if (typ.
compare (
"arch-c"))
4135 ret (0) = 18.0 * in2units;
4136 ret (1) = 24.0 * in2units;
4138 else if (typ.
compare (
"arch-d"))
4140 ret (0) = 24.0 * in2units;
4141 ret (1) = 36.0 * in2units;
4143 else if (typ.
compare (
"arch-e"))
4145 ret (0) = 36.0 * in2units;
4146 ret (1) = 48.0 * in2units;
4150 ret (0) = 8.5 * in2units;
4151 ret (1) = 11.0 * in2units;
4155 ret (0) = 11.0 * in2units;
4156 ret (1) = 17.0 * in2units;
4160 ret (0) = 17.0 * in2units;
4161 ret (1) = 22.0 * in2units;
4165 ret (0) = 22.0 * in2units;
4166 ret (1) = 34.0 * in2units;
4170 ret (0) = 34.0 * in2units;
4171 ret (1) = 43.0 * in2units;
4182 Matrix pos = get_position ().matrix_value ();
4189 if (funits ==
"normalized" || punits ==
"normalized")
4194 if (punits ==
"normalized")
4203 sz = get_papersize ().matrix_value ();
4205 pos(0) = sz(0)/2 - pos(2)/2;
4206 pos(1) = sz(1)/2 - pos(3)/2;
4297 Matrix pos = get_paperposition ().matrix_value ();
4298 Matrix sz = get_papersize ().matrix_value ();
4305 std::string porient = get_paperorientation ();
4311 if (old_paperunits.
compare (
"centimeters"))
4316 else if (old_paperunits.
compare (
"points"))
4322 if (punits.
compare (
"centimeters"))
4327 else if (punits.
compare (
"points"))
4336 if (porient ==
"landscape")
4337 std::swap (sz(0), sz(1));
4353 if (! typ.
compare (
"<custom>"))
4356 if (get_paperorientation () ==
"landscape")
4357 std::swap (sz(0), sz(1));
4363 if (paperpositionmode.is (
"auto"))
4364 paperposition.set (get_auto_paperposition ());
4370 Matrix sz = get_papersize ().matrix_value ();
4373 std::swap (sz(0), sz(1));
4379 paperorientation.set (
"portrait");
4381 std::string punits = get_paperunits ();
4382 if (punits ==
"centimeters")
4387 else if (punits ==
"points")
4392 if (punits ==
"normalized")
4395 if (get_papertype () ==
"<custom>")
4396 error (
"set: can't set the papertype to <custom> when the paperunits is normalized");
4402 std::string typ =
"<custom>";
4403 const double mm2in = 1.0 / 25.4;
4404 const double tol = 0.01;
4412 else if (
std::abs (sz(0) - 841.0 * mm2in)
4413 +
std::abs (sz(1) - 1198.0 * mm2in) < tol)
4415 else if (
std::abs (sz(0) - 594.0 * mm2in)
4416 +
std::abs (sz(1) - 841.0 * mm2in) < tol)
4418 else if (
std::abs (sz(0) - 420.0 * mm2in)
4419 +
std::abs (sz(1) - 594.0 * mm2in) < tol)
4421 else if (
std::abs (sz(0) - 297.0 * mm2in)
4422 +
std::abs (sz(1) - 420.0 * mm2in) < tol)
4424 else if (
std::abs (sz(0) - 210.0 * mm2in)
4425 +
std::abs (sz(1) - 297.0 * mm2in) < tol)
4427 else if (
std::abs (sz(0) - 148.0 * mm2in)
4428 +
std::abs (sz(1) - 210.0 * mm2in) < tol)
4430 else if (
std::abs (sz(0) - 1029.0 * mm2in)
4431 +
std::abs (sz(1) - 1456.0 * mm2in) < tol)
4433 else if (
std::abs (sz(0) - 728.0 * mm2in)
4434 +
std::abs (sz(1) - 1028.0 * mm2in) < tol)
4436 else if (
std::abs (sz(0) - 514.0 * mm2in)
4437 +
std::abs (sz(1) - 728.0 * mm2in) < tol)
4439 else if (
std::abs (sz(0) - 364.0 * mm2in)
4440 +
std::abs (sz(1) - 514.0 * mm2in) < tol)
4442 else if (
std::abs (sz(0) - 257.0 * mm2in)
4443 +
std::abs (sz(1) - 364.0 * mm2in) < tol)
4445 else if (
std::abs (sz(0) - 182.0 * mm2in)
4446 +
std::abs (sz(1) - 257.0 * mm2in) < tol)
4480 papertype.set (typ);
4482 if (punits ==
"centimeters")
4487 else if (punits ==
"points")
4492 if (get_paperorientation () ==
"landscape")
4494 std::swap (sz(0), sz(1));
4498 if (paperpositionmode.is (
"auto"))
4499 paperposition.set (get_auto_paperposition ());
4537 std::string porient = get_paperorientation ();
4538 Matrix sz = get_papersize ().matrix_value ();
4539 Matrix pos = get_paperposition ().matrix_value ();
4540 if ((sz(0) > sz(1) && porient ==
"portrait")
4541 || (sz(0) < sz(1) && porient ==
"landscape"))
4543 std::swap (sz(0), sz(1));
4544 std::swap (pos(0), pos(1));
4545 std::swap (pos(2), pos(3));
4552 if (paperpositionmode.is (
"auto"))
4553 paperposition.set (get_auto_paperposition ());
4589 if (units.set (v,
true))
4591 update_units (old_units);
4600 position.set (
convert_position (get_position ().matrix_value (), old_units,
4625 if (is_numbertitle ())
4627 std::ostringstream os;
4628 std::string nm = get_name ();
4630 os <<
"Figure " << __myhandle__.value ();
4632 os <<
": " << get_name ();
4663 plist.
erase (
"units");
4664 plist.
erase (
"position");
4665 plist.
erase (
"outerposition");
4666 plist.
erase (
"paperunits");
4667 plist.
erase (
"paperposition");
4668 plist.
erase (
"windowstyle");
4679 outerposition.add_constraint (
dim_vector (1, 4));
4680 tightinset.add_constraint (
dim_vector (1, 4));
4681 looseinset.add_constraint (
dim_vector (1, 4));
4682 colororder.add_constraint (
dim_vector (-1, 3));
4683 dataaspectratio.add_constraint (
dim_vector (1, 3));
4684 plotboxaspectratio.add_constraint (
dim_vector (1, 3));
4685 alim.add_constraint (2);
4686 clim.add_constraint (2);
4687 xlim.add_constraint (2);
4688 ylim.add_constraint (2);
4689 zlim.add_constraint (2);
4693 ticklength.add_constraint (
dim_vector (1, 2));
4698 cameraposition.add_constraint (
dim_vector (1, 3));
4699 cameratarget.add_constraint (
dim_vector (1, 3));
4702 cameraupvector = upv;
4703 cameraupvector.add_constraint (
dim_vector (1, 3));
4704 currentpoint.add_constraint (
dim_vector (2, 3));
4708 x_zlim.resize (1, 2);
4714 calc_ticklabels (xtick, xticklabel, xscale.is (
"log"));
4715 calc_ticklabels (ytick, yticklabel, yscale.is (
"log"));
4716 calc_ticklabels (ztick, zticklabel, zscale.is (
"log"));
4718 xset (xlabel.handle_value (),
"handlevisibility",
"off");
4719 xset (ylabel.handle_value (),
"handlevisibility",
"off");
4720 xset (zlabel.handle_value (),
"handlevisibility",
"off");
4721 xset (title.handle_value (),
"handlevisibility",
"off");
4723 xset (xlabel.handle_value (),
"horizontalalignment",
"center");
4724 xset (xlabel.handle_value (),
"horizontalalignmentmode",
"auto");
4725 xset (ylabel.handle_value (),
"horizontalalignment",
"center");
4726 xset (ylabel.handle_value (),
"horizontalalignmentmode",
"auto");
4727 xset (zlabel.handle_value (),
"horizontalalignment",
"right");
4728 xset (zlabel.handle_value (),
"horizontalalignmentmode",
"auto");
4729 xset (title.handle_value (),
"horizontalalignment",
"center");
4730 xset (title.handle_value (),
"horizontalalignmentmode",
"auto");
4732 xset (xlabel.handle_value (),
"verticalalignment",
"top");
4733 xset (xlabel.handle_value (),
"verticalalignmentmode",
"auto");
4734 xset (ylabel.handle_value (),
"verticalalignment",
"bottom");
4735 xset (ylabel.handle_value (),
"verticalalignmentmode",
"auto");
4736 xset (title.handle_value (),
"verticalalignment",
"bottom");
4737 xset (title.handle_value (),
"verticalalignmentmode",
"auto");
4739 xset (ylabel.handle_value (),
"rotation", 90.0);
4740 xset (ylabel.handle_value (),
"rotationmode",
"auto");
4742 xset (zlabel.handle_value (),
"visible",
"off");
4744 xset (xlabel.handle_value (),
"clipping",
"off");
4745 xset (ylabel.handle_value (),
"clipping",
"off");
4746 xset (zlabel.handle_value (),
"clipping",
"off");
4747 xset (title.handle_value (),
"clipping",
"off");
4749 xset (xlabel.handle_value (),
"autopos_tag",
"xlabel");
4750 xset (ylabel.handle_value (),
"autopos_tag",
"ylabel");
4751 xset (zlabel.handle_value (),
"autopos_tag",
"zlabel");
4752 xset (title.handle_value (),
"autopos_tag",
"title");
4754 adopt (xlabel.handle_value ());
4755 adopt (ylabel.handle_value ());
4756 adopt (zlabel.handle_value ());
4757 adopt (title.handle_value ());
4760 tlooseinset(2) = 1-tlooseinset(0)-tlooseinset(2);
4761 tlooseinset(3) = 1-tlooseinset(1)-tlooseinset(3);
4762 looseinset = tlooseinset;
4771 Matrix ext = get_extent (
true,
true);
4772 ext(1) = parent_bb(3) - ext(1) - ext(3);
4777 if (ext(0) < pos(0))
4779 pos(2) += pos(0)-ext(0);
4782 if (ext(0)+ext(2) > pos(0)+pos(2))
4783 pos(2) = ext(0)+ext(2)-pos(0);
4785 if (ext(1) < pos(1))
4787 pos(3) += pos(1)-ext(1);
4790 if (ext(1)+ext(3) > pos(1)+pos(3))
4791 pos(3) = ext(1)+ext(3)-pos(1);
4799 if (activepositionproperty.is (
"position"))
4802 update_outerposition ();
4804 set_units (
"normalized");
4805 Matrix pos = position.get ().matrix_value ();
4806 Matrix outpos = outerposition.get ().matrix_value ();
4807 Matrix tightpos = calc_tightbox (pos);
4808 Matrix tinset (1, 4, 1.0);
4809 tinset(0) = pos(0)-tightpos(0);
4810 tinset(1) = pos(1)-tightpos(1);
4811 tinset(2) = tightpos(0)+tightpos(2)-pos(0)-pos(2);
4812 tinset(3) = tightpos(1)+tightpos(3)-pos(1)-pos(3);
4813 tightinset = tinset;
4814 set_units (old_units);
4815 update_transform ();
4816 if (activepositionproperty.is (
"position"))
4819 update_outerposition ();
4885 const std::string& who,
4897 if (go.
isa (
"text"))
4898 val = ::
reparent (v,
"set", who, __myhandle__,
false);
4903 error (
"set: expecting text graphics object or character string for %s property, found %s",
4904 who.c_str (), cname.c_str ());
4909 xset (val,
"handlevisibility",
"off");
4917 adopt (hp.handle_value ());
4924 set_text_child (xlabel,
"xlabel", v);
4925 xset (xlabel.handle_value (),
"positionmode",
"auto");
4926 xset (xlabel.handle_value (),
"rotationmode",
"auto");
4927 xset (xlabel.handle_value (),
"horizontalalignmentmode",
"auto");
4928 xset (xlabel.handle_value (),
"verticalalignmentmode",
"auto");
4929 xset (xlabel.handle_value (),
"clipping",
"off");
4930 xset (xlabel.handle_value (),
"color", get_xcolor ());
4931 xset (xlabel.handle_value (),
"autopos_tag",
"xlabel");
4932 update_xlabel_position ();
4938 set_text_child (ylabel,
"ylabel", v);
4939 xset (ylabel.handle_value (),
"positionmode",
"auto");
4940 xset (ylabel.handle_value (),
"rotationmode",
"auto");
4941 xset (ylabel.handle_value (),
"horizontalalignmentmode",
"auto");
4942 xset (ylabel.handle_value (),
"verticalalignmentmode",
"auto");
4943 xset (ylabel.handle_value (),
"clipping",
"off");
4944 xset (ylabel.handle_value (),
"color", get_ycolor ());
4945 xset (ylabel.handle_value (),
"autopos_tag",
"ylabel");
4946 update_ylabel_position ();
4952 set_text_child (zlabel,
"zlabel", v);
4953 xset (zlabel.handle_value (),
"positionmode",
"auto");
4954 xset (zlabel.handle_value (),
"rotationmode",
"auto");
4955 xset (zlabel.handle_value (),
"horizontalalignmentmode",
"auto");
4956 xset (zlabel.handle_value (),
"verticalalignmentmode",
"auto");
4957 xset (zlabel.handle_value (),
"clipping",
"off");
4958 xset (zlabel.handle_value (),
"color", get_zcolor ());
4959 xset (zlabel.handle_value (),
"autopos_tag",
"zlabel");
4960 update_zlabel_position ();
4966 set_text_child (title,
"title", v);
4967 xset (title.handle_value (),
"positionmode",
"auto");
4968 xset (title.handle_value (),
"horizontalalignment",
"center");
4969 xset (title.handle_value (),
"horizontalalignmentmode",
"auto");
4970 xset (title.handle_value (),
"verticalalignment",
"bottom");
4971 xset (title.handle_value (),
"verticalalignmentmode",
"auto");
4972 xset (title.handle_value (),
"clipping",
"off");
4973 xset (title.handle_value (),
"autopos_tag",
"title");
4974 update_title_position ();
4979 const std::string& mode)
4984 dataaspectratiomode =
"auto";
5023 xticklabelmode =
"auto";
5024 yticklabelmode =
"auto";
5025 zticklabelmode =
"auto";
5027 interpreter =
"none";
5039 yaxislocation =
"left";
5040 xaxislocation =
"bottom";
5042 Matrix tview (1, 2, 0.0);
5046 __hold_all__ =
"off";
5047 nextplot =
"replace";
5049 ambientlightcolor =
Matrix (1, 3, 1.0);
5052 camerapositionmode =
"auto";
5053 cameratargetmode =
"auto";
5054 cameraupvectormode =
"auto";
5055 cameraviewanglemode =
"auto";
5057 drawmode =
"normal";
5059 fontangle =
"normal";
5062 fontunits =
"points";
5063 fontweight =
"normal";
5065 gridlinestyle =
":";
5066 linestyleorder =
"-";
5068 minorgridlinestyle =
":";
5071 plotboxaspectratiomode =
"auto";
5072 projection =
"orthographic";
5075 tickdirmode =
"auto";
5078 tightinset =
Matrix (1, 4, 0.0);
5087 if (mode !=
"replace" && mode !=
"reset")
5091 activepositionproperty =
"outerposition";
5094 if (mode !=
"reset")
5096 delete_children (
true);
5098 xlabel.invalidate ();
5099 ylabel.invalidate ();
5100 zlabel.invalidate ();
5101 title.invalidate ();
5104 false,
false,
false);
5106 false,
false,
false);
5108 false,
false,
false);
5110 false,
false,
false);
5112 adopt (xlabel.handle_value ());
5113 adopt (ylabel.handle_value ());
5114 adopt (zlabel.handle_value ());
5115 adopt (title.handle_value ());
5117 update_xlabel_position ();
5118 update_ylabel_position ();
5119 update_zlabel_position ();
5120 update_title_position ();
5134 xset (xlabel.handle_value (),
"handlevisibility",
"off");
5135 xset (ylabel.handle_value (),
"handlevisibility",
"off");
5136 xset (zlabel.handle_value (),
"handlevisibility",
"off");
5137 xset (title.handle_value (),
"handlevisibility",
"off");
5139 xset (xlabel.handle_value (),
"horizontalalignment",
"center");
5140 xset (xlabel.handle_value (),
"horizontalalignmentmode",
"auto");
5141 xset (ylabel.handle_value (),
"horizontalalignment",
"center");
5142 xset (ylabel.handle_value (),
"horizontalalignmentmode",
"auto");
5143 xset (zlabel.handle_value (),
"horizontalalignment",
"right");
5144 xset (zlabel.handle_value (),
"horizontalalignmentmode",
"auto");
5145 xset (title.handle_value (),
"horizontalalignment",
"center");
5146 xset (title.handle_value (),
"horizontalalignmentmode",
"auto");
5148 xset (xlabel.handle_value (),
"verticalalignment",
"top");
5149 xset (xlabel.handle_value (),
"verticalalignmentmode",
"auto");
5150 xset (ylabel.handle_value (),
"verticalalignment",
"bottom");
5151 xset (ylabel.handle_value (),
"verticalalignmentmode",
"auto");
5152 xset (title.handle_value (),
"verticalalignment",
"bottom");
5153 xset (title.handle_value (),
"verticalalignmentmode",
"auto");
5155 xset (ylabel.handle_value (),
"rotation", 90.0);
5156 xset (ylabel.handle_value (),
"rotationmode",
"auto");
5158 xset (zlabel.handle_value (),
"visible",
"off");
5160 xset (xlabel.handle_value (),
"clipping",
"off");
5161 xset (ylabel.handle_value (),
"clipping",
"off");
5162 xset (zlabel.handle_value (),
"clipping",
"off");
5163 xset (title.handle_value (),
"clipping",
"off");
5165 xset (xlabel.handle_value (),
"autopos_tag",
"xlabel");
5166 xset (ylabel.handle_value (),
"autopos_tag",
"ylabel");
5167 xset (zlabel.handle_value (),
"autopos_tag",
"zlabel");
5168 xset (title.handle_value (),
"autopos_tag",
"title");
5170 update_transform ();
5195 if (! is_beingdeleted ())
5209 if (xlabel.handle_value ().ok () && h == xlabel.handle_value ())
5211 delete_text_child (xlabel);
5212 update_xlabel_position ();
5214 else if (ylabel.handle_value ().ok () && h == ylabel.handle_value ())
5216 delete_text_child (ylabel);
5217 update_ylabel_position ();
5219 else if (zlabel.handle_value ().ok () && h == zlabel.handle_value ())
5221 delete_text_child (zlabel);
5222 update_zlabel_position ();
5224 else if (title.handle_value ().ok () && h == title.handle_value ())
5226 delete_text_child (title);
5227 update_title_position ();
5237 for (
int i = 0; i < 4; i++)
5254 v(0) =
x; v(1) = y; v(2) = z;
5268 m(0,0) =
x; m(1,1) = y; m(2,2) = z; m(3,3) = 1;
5276 m(0,3) =
x; m(1,3) = y; m(2,3) = z; m(3,3) = 1;
5317 double fact = 1.0 / sqrt (v(0)*v(0)+v(1)*v(1)+v(2)*v(2));
5318 scale (v, fact, fact, fact);
5330 return sqrt (
dot (v, v));
5346 static double data[32] =
5379 double xd = (xdir_is (
"normal") ? 1 : -1);
5380 double yd = (ydir_is (
"normal") ? 1 : -1);
5381 double zd = (zdir_is (
"normal") ? 1 : -1);
5383 Matrix xlimits = sx.scale (get_xlim ().matrix_value ());
5384 Matrix ylimits = sy.scale (get_ylim ().matrix_value ());
5385 Matrix zlimits = sz.scale (get_zlim ().matrix_value ());
5387 double xo = xlimits(xd > 0 ? 0 : 1);
5388 double yo = ylimits(yd > 0 ? 0 : 1);
5389 double zo = zlimits(zd > 0 ? 0 : 1);
5391 Matrix pb = get_plotboxaspectratio ().matrix_value ();
5393 bool autocam = (camerapositionmode_is (
"auto")
5394 && cameratargetmode_is (
"auto")
5395 && cameraupvectormode_is (
"auto")
5396 && cameraviewanglemode_is (
"auto"));
5397 bool dowarp = (autocam && dataaspectratiomode_is (
"auto")
5398 && plotboxaspectratiomode_is (
"auto"));
5404 if (cameratargetmode_is (
"auto"))
5406 c_center(0) = (xlimits(0)+xlimits(1))/2;
5407 c_center(1) = (ylimits(0)+ylimits(1))/2;
5408 c_center(2) = (zlimits(0)+zlimits(1))/2;
5413 c_center =
cam2xform (get_cameratarget ().matrix_value ());
5415 if (camerapositionmode_is (
"auto"))
5417 Matrix tview = get_view ().matrix_value ();
5418 double az = tview(0);
5419 double el = tview(1);
5420 double d = 5 * sqrt (pb(0)*pb(0)+pb(1)*pb(1)+pb(2)*pb(2));
5422 if (el == 90 || el == -90)
5423 c_eye(2) = d*
signum (el);
5428 c_eye(0) = d * cos (el) * sin (az);
5429 c_eye(1) = -d* cos (el) * cos (az);
5430 c_eye(2) = d * sin (el);
5432 c_eye(0) = c_eye(0)*(xlimits(1)-xlimits(0))/(xd*pb(0))+c_center(0);
5433 c_eye(1) = c_eye(1)*(ylimits(1)-ylimits(0))/(yd*pb(1))+c_center(1);
5434 c_eye(2) = c_eye(2)*(zlimits(1)-zlimits(0))/(zd*pb(2))+c_center(2);
5439 c_eye =
cam2xform (get_cameraposition ().matrix_value ());
5441 if (cameraupvectormode_is (
"auto"))
5443 Matrix tview = get_view ().matrix_value ();
5444 double az = tview(0);
5445 double el = tview(1);
5447 if (el == 90 || el == -90)
5450 -
signum (el) *sin (az*M_PI/180.0)*(xlimits(1)-xlimits(0))/pb(0);
5452 signum (el) * cos (az*M_PI/180.0)*(ylimits(1)-ylimits(0))/pb(1);
5460 c_upv =
cam2xform (get_cameraupvector ().matrix_value ());
5471 scale (x_pre, pb(0), pb(1), pb(2));
5473 scale (x_pre, xd/(xlimits(1)-xlimits(0)), yd/(ylimits(1)-ylimits(0)),
5474 zd/(zlimits(1)-zlimits(0)));
5477 xform (c_eye, x_pre);
5478 xform (c_center, x_pre);
5479 scale (c_upv, pb(0)/(xlimits(1)-xlimits(0)), pb(1)/(ylimits(1)-ylimits(0)),
5480 pb(2)/(zlimits(1)-zlimits(0)));
5481 translate (c_center, -c_eye(0), -c_eye(1), -c_eye(2));
5489 double fa = 1 / sqrt(1-
f(2)*
f(2));
5490 scale (UP, fa, fa, fa);
5496 scale (x_view, 1, 1, -1);
5498 l(0,0) = s(0); l(0,1) = s(1); l(0,2) = s(2);
5499 l(1,0) = u(0); l(1,1) = u(1); l(1,2) = u(2);
5500 l(2,0) = -
f(0); l(2,1) = -
f(1); l(2,2) = -
f(2);
5501 x_view = x_view * l;
5502 translate (x_view, -c_eye(0), -c_eye(1), -c_eye(2));
5503 scale (x_view, pb(0), pb(1), pb(2));
5509 double xM = cmax(0)-cmin(0);
5510 double yM = cmax(1)-cmin(1);
5512 Matrix bb = get_boundingbox (
true);
5516 if (cameraviewanglemode_is (
"auto"))
5523 if (
false && dowarp)
5524 af = 1.0 / (xM > yM ? xM : yM);
5527 if ((bb(2)/bb(3)) > (xM/yM))
5532 v_angle = 2 * (180.0 / M_PI) *
atan (1 / (2 * af *
norm (
F)));
5534 cameraviewangle = v_angle;
5537 v_angle = get_cameraviewangle ();
5539 double pf = 1 / (2 * tan ((v_angle / 2) * M_PI / 180.0) *
norm (
F));
5540 scale (x_projection, pf, pf, 1);
5546 translate (x_viewport, bb(0)+bb(2)/2, bb(1)+bb(3)/2, 0);
5547 scale (x_viewport, bb(2)/xM, -bb(3)/yM, 1);
5554 if ((bb(2)/bb(3)) > (xM/yM))
5560 pix = (bb(2) < bb(3) ? bb(2) : bb(3));
5561 translate (x_viewport, bb(0)+bb(2)/2, bb(1)+bb(3)/2, 0);
5562 scale (x_viewport, pix, -pix, 1);
5565 x_normrender = x_viewport * x_projection * x_view;
5571 x_zlim(0) = cmin(2);
5572 x_zlim(1) = cmax(2);
5574 x_render = x_normrender;
5575 scale (x_render, xd/(xlimits(1)-xlimits(0)), yd/(ylimits(1)-ylimits(0)),
5576 zd/(zlimits(1)-zlimits(0)));
5579 x_viewtransform = x_view;
5580 x_projectiontransform = x_projection;
5581 x_viewporttransform = x_viewport;
5582 x_normrendertransform = x_normrender;
5583 x_rendertransform = x_render;
5585 x_render_inv = x_render.
inverse ();
5591 scale (x_gl_mat1, xd/(xlimits(1)-xlimits(0)), yd/(ylimits(1)-ylimits(0)),
5592 zd/(zlimits(1)-zlimits(0)));
5594 x_gl_mat2 = x_viewport * x_projection;
5602 if (updating_axes_layout)
5607 double xd = (xdir_is (
"normal") ? 1 : -1);
5608 double yd = (ydir_is (
"normal") ? 1 : -1);
5609 double zd = (zdir_is (
"normal") ? 1 : -1);
5611 const Matrix xlims = xform.
xscale (get_xlim ().matrix_value ());
5612 const Matrix ylims = xform.
yscale (get_ylim ().matrix_value ());
5613 const Matrix zlims = xform.
zscale (get_zlim ().matrix_value ());
5615 double x_min, x_max, y_min, y_max, z_min, z_max;
5616 x_min = xlims(0), x_max = xlims(1);
5617 y_min = ylims(0), y_max = ylims(1);
5618 z_min = zlims(0), z_max = zlims(1);
5624 p1 = xform.
transform (x_min, (y_min+y_max)/2, (z_min+z_max)/2,
false);
5625 p2 = xform.
transform (x_max, (y_min+y_max)/2, (z_min+z_max)/2,
false);
5626 dir(0) =
xround (p2(0)-p1(0));
5627 dir(1) =
xround (p2(1)-p1(1));
5628 dir(2) = (p2(2)-p1(2));
5629 if (dir(0) == 0 && dir(1) == 0)
5631 else if (dir(2) == 0)
5635 else if (dir(1) == 0)
5642 xPlane = (dir(0) > 0 ? x_max : x_min);
5644 xPlane = (dir(1) < 0 ? x_max : x_min);
5647 xPlane = (dir(2) < 0 ? x_min : x_max);
5649 xPlaneN = (xPlane == x_min ? x_max : x_min);
5650 fx = (x_max-x_min) / sqrt (dir(0)*dir(0)+dir(1)*dir(1));
5652 p1 = xform.
transform ((x_min+x_max)/2, y_min, (z_min+z_max)/2,
false);
5653 p2 = xform.
transform ((x_min+x_max)/2, y_max, (z_min+z_max)/2,
false);
5654 dir(0) =
xround (p2(0)-p1(0));
5655 dir(1) =
xround (p2(1)-p1(1));
5656 dir(2) = (p2(2)-p1(2));
5657 if (dir(0) == 0 && dir(1) == 0)
5659 else if (dir(2) == 0)
5663 else if (dir(1) == 0)
5670 yPlane = (dir(0) > 0 ? y_max : y_min);
5672 yPlane = (dir(1) < 0 ? y_max : y_min);
5675 yPlane = (dir(2) < 0 ? y_min : y_max);
5677 yPlaneN = (yPlane == y_min ? y_max : y_min);
5678 fy = (y_max-y_min) / sqrt (dir(0)*dir(0)+dir(1)*dir(1));
5680 p1 = xform.
transform ((x_min+x_max)/2, (y_min+y_max)/2, z_min,
false);
5681 p2 = xform.
transform ((x_min+x_max)/2, (y_min+y_max)/2, z_max,
false);
5682 dir(0) =
xround (p2(0)-p1(0));
5683 dir(1) =
xround (p2(1)-p1(1));
5684 dir(2) = (p2(2)-p1(2));
5685 if (dir(0) == 0 && dir(1) == 0)
5687 else if (dir(2) == 0)
5691 else if (dir(1) == 0)
5698 zPlane = (dir(0) > 0 ? z_min : z_max);
5700 zPlane = (dir(1) < 0 ? z_min : z_max);
5703 zPlane = (dir(2) < 0 ? z_min : z_max);
5705 zPlaneN = (zPlane == z_min ? z_max : z_min);
5706 fz = (z_max-z_min) / sqrt (dir(0)*dir(0)+dir(1)*dir(1));
5710 updating_axes_layout =
true;
5712 xySym = (xd*yd*(xPlane-xPlaneN)*(yPlane-yPlaneN) > 0);
5713 zSign = (zd*(zPlane-zPlaneN) <= 0);
5714 xyzSym = zSign ? xySym : !xySym;
5715 xpTick = (zSign ? xPlaneN : xPlane);
5716 ypTick = (zSign ? yPlaneN : yPlane);
5717 zpTick = (zSign ? zPlane : zPlaneN);
5718 xpTickN = (zSign ? xPlane : xPlaneN);
5719 ypTickN = (zSign ? yPlane : yPlaneN);
5720 zpTickN = (zSign ? zPlaneN : zPlane);
5728 if (xaxislocation_is (
"top"))
5730 std::swap (yPlane, yPlaneN);
5735 if (yaxislocation_is (
"right"))
5737 std::swap (xPlane, xPlaneN);
5742 if (layer_is (
"top"))
5751 Matrix viewmat = get_view ().matrix_value ();
5752 nearhoriz =
std::abs (viewmat(1)) <= 5;
5753 is2D = viewmat(1) == 90;
5755 update_ticklength ();
5765 if (tickdirmode_is (
"auto"))
5766 tickdir.set (mode2d ?
"in" :
"out",
true);
5768 double ticksign = (tickdir_is (
"in") ? -1 : 1);
5770 Matrix bbox = get_boundingbox (
true);
5771 Matrix ticklen = get_ticklength ().matrix_value ();
5772 ticklen(0) = ticklen(0) *
std::max (bbox(2), bbox(3));
5773 ticklen(1) = ticklen(1) *
std::max (bbox(2), bbox(3));
5775 xticklen = ticksign * (mode2d ? ticklen(0) : ticklen(1));
5776 yticklen = ticksign * (mode2d ? ticklen(0) : ticklen(1));
5777 zticklen = ticksign * (mode2d ? ticklen(0) : ticklen(1));
5779 xtickoffset = (mode2d ?
std::max (0., xticklen) :
std::abs (xticklen)) + 5;
5780 ytickoffset = (mode2d ?
std::max (0., yticklen) :
std::abs (yticklen)) + 5;
5781 ztickoffset = (mode2d ?
std::max (0., zticklen) :
std::abs (zticklen)) + 5;
5783 update_xlabel_position ();
5784 update_ylabel_position ();
5785 update_zlabel_position ();
5786 update_title_position ();
5817 if (! to_units.
compare (
"data"))
5823 retval(0) = v(0) - bbox(0) + 1;
5824 retval(1) = bbox(1) + bbox(3) - v(1) + 1;
5841 if (updating_xlabel_position)
5856 updating_xlabel_position =
true;
5864 ?
"center" : (xyzSym ?
"left" :
"right"));
5884 ext = get_ticklabel_extents (get_xtick ().matrix_value (),
5885 get_xticklabel ().all_strings (),
5886 get_xlim ().matrix_value ());
5888 double wmax = ext(0);
5889 double hmax = ext(1);
5894 bool tick_along_z = nearhoriz ||
xisinf (fy);
5896 p(2) += (
signum (zpTick-zpTickN)*fz*xtickoffset);
5898 p(1) += (
signum (ypTick-ypTickN)*fy*xtickoffset);
5900 p = xform.
transform (p(0), p(1), p(2),
false);
5905 p(0) += (xyzSym ? wmax : -wmax);
5915 p(1) += (x2Dtop ? -hmax : hmax);
5924 get_extent (
false));
5943 if (updating_ylabel_position)
5958 updating_ylabel_position =
true;
5966 ?
"center" : (!xyzSym ?
"left" :
"right"));
5974 (ystate ==
AXE_VERT_DIR && !y2Dright ?
"bottom" :
"top");
5995 ext = get_ticklabel_extents (get_ytick ().matrix_value (),
5996 get_yticklabel ().all_strings (),
5997 get_ylim ().matrix_value ());
5999 double wmax = ext(0)+4;
6000 double hmax = ext(1);
6005 bool tick_along_z = nearhoriz ||
xisinf (fx);
6007 p(2) += (
signum (zpTick-zpTickN)*fz*ytickoffset);
6009 p(0) += (
signum (xpTick-xpTickN)*fx*ytickoffset);
6011 p = xform.
transform (p(0), p(1), p(2),
false);
6016 p(0) += (!xyzSym ? wmax : -wmax);
6021 p(0) += (y2Dright ? wmax : -wmax);
6035 get_extent (
false));
6054 if (updating_zlabel_position)
6065 bool camAuto = cameraupvectormode_is (
"auto");
6070 updating_zlabel_position =
true;
6086 ?
"bottom" : ((zSign || camAuto) ?
"bottom" :
"top"));
6098 ext = get_ticklabel_extents (get_ztick ().matrix_value (),
6099 get_zticklabel ().all_strings (),
6100 get_zlim ().matrix_value ());
6102 double wmax = ext(0);
6103 double hmax = ext(1);
6110 (zpTickN+zpTick)/2);
6112 p(0) += (
signum (xPlaneN-xPlane)*fx*ztickoffset);
6114 p(1) += (
signum (yPlane-yPlaneN)*fy*ztickoffset);
6119 (zpTickN+zpTick)/2);
6121 p(1) += (
signum (yPlaneN-yPlane)*fy*ztickoffset);
6123 p(0) += (
signum (xPlane-xPlaneN)*fx*ztickoffset);
6126 p = xform.
transform (p(0), p(1), p(2),
false);
6159 get_extent (
false));
6178 if (updating_title_position)
6191 updating_title_position =
true;
6198 Matrix bbox = get_extent (
false);
6203 (x_zlim(0)+x_zlim(1))/2);
6208 ext = get_ticklabel_extents (get_xtick ().matrix_value (),
6209 get_xticklabel ().all_strings (),
6210 get_xlim ().matrix_value ());
6226 if (elem_type ==
"xlabel")
6227 update_xlabel_position ();
6228 else if (elem_type ==
"ylabel")
6229 update_ylabel_position ();
6230 else if (elem_type ==
"zlabel")
6231 update_zlabel_position ();
6232 else if (elem_type ==
"title")
6233 update_title_position ();
6234 else if (elem_type ==
"sync")
6240 double xlength,
double ylength,
double zlength)
6242 double xval = xlength/scalefactors(0);
6243 double yval = ylength/scalefactors(1);
6244 double zval = zlength/scalefactors(2);
6246 double minval =
xmin (
xmin (xval, yval), zval);
6248 aspectratios(0) = xval/minval;
6249 aspectratios(1) = yval/minval;
6250 aspectratios(2) = zval/minval;
6255 double pbfactor,
double dafactor,
char limit_type,
bool tight)
6268 s =
xmax(s, (maxval - minval) / (pbfactor * dafactor));
6272 s =
xmax(s, (limits(1) - limits(0)) / (pbfactor * dafactor));
6280 if (updating_aspectratios.find (get___myhandle__ ().value ())
6281 != updating_aspectratios.end ())
6284 Matrix xlimits = get_xlim ().matrix_value ();
6285 Matrix ylimits = get_ylim ().matrix_value ();
6286 Matrix zlimits = get_zlim ().matrix_value ();
6288 double dx = (xlimits(1)-xlimits(0));
6289 double dy = (ylimits(1)-ylimits(0));
6290 double dz = (zlimits(1)-zlimits(0));
6292 Matrix da = get_dataaspectratio ().matrix_value ();
6293 Matrix pba = get_plotboxaspectratio ().matrix_value ();
6295 if (dataaspectratiomode_is (
"auto"))
6297 if (plotboxaspectratiomode_is (
"auto"))
6299 pba =
Matrix (1, 3, 1.0);
6300 plotboxaspectratio.set (pba,
false);
6304 dataaspectratio.set (da,
false);
6306 else if (plotboxaspectratiomode_is (
"auto"))
6309 plotboxaspectratio.set (pba,
false);
6314 bool modified_limits =
false;
6317 if (xlimmode_is (
"auto") && ylimmode_is (
"auto") && zlimmode_is (
"auto"))
6319 modified_limits =
true;
6320 kids = get_children ();
6325 else if (xlimmode_is (
"auto") && ylimmode_is (
"auto"))
6327 modified_limits =
true;
6330 else if (ylimmode_is (
"auto") && zlimmode_is (
"auto"))
6332 modified_limits =
true;
6335 else if (zlimmode_is (
"auto") && xlimmode_is (
"auto"))
6337 modified_limits =
true;
6341 if (modified_limits)
6347 updating_aspectratios.insert (get___myhandle__ ().value ());
6355 if (xlimmode_is (
"auto"))
6358 xlimits(0) = 0.5 * (xlimits(0) + xlimits(1) - dx);
6359 xlimits(1) = xlimits(0) + dx;
6361 set_xlimmode (
"auto");
6364 if (ylimmode_is (
"auto"))
6367 ylimits(0) = 0.5 * (ylimits(0) + ylimits(1) - dy);
6368 ylimits(1) = ylimits(0) + dy;
6370 set_ylimmode (
"auto");
6373 if (zlimmode_is (
"auto"))
6376 zlimits(0) = 0.5 * (zlimits(0) + zlimits(1) - dz);
6377 zlimits(1) = zlimits(0) + dz;
6379 set_zlimmode (
"auto");
6385 plotboxaspectratio.set (pba,
false);
6393 #ifdef HAVE_FREETYPE
6394 #ifdef HAVE_FONTCONFIG
6395 text_renderer.set_font (
get (
"fontname").string_value (),
6396 get (
"fontweight").string_value (),
6397 get (
"fontangle").string_value (),
6398 get (
"fontsize_points").double_value ());
6407 const Matrix& parent_pix_size)
const
6409 Matrix pos =
internal ? get_position ().matrix_value ()
6410 : get_outerposition ().matrix_value ();
6411 Matrix parent_size (parent_pix_size);
6413 if (parent_size.
numel () == 0)
6428 pos(1) = parent_size(1) - pos(1) - pos(3);
6443 for (
int i = 0; i <= 1; i++)
6444 for (
int j = 0; j <= 1; j++)
6445 for (
int k = 0; k <= 1; k++)
6448 j ? yPlaneN : yPlane,
6449 k ? zPlaneN : zPlane,
false);
6458 for (
int i = 0; i < 4; i++)
6462 text_handle = get_title ();
6464 text_handle = get_xlabel ();
6466 text_handle = get_ylabel ();
6468 text_handle = get_zlabel ();
6475 text_pos = xform.
transform (text_pos(0), text_pos(1), text_pos(2));
6478 ext(0) =
std::min (ext(0), text_pos(0));
6479 ext(1) =
std::min (ext(1), text_pos(1));
6480 ext(2) =
std::max (ext(2), text_pos(0));
6481 ext(3) =
std::max (ext(3), text_pos(1));
6487 bool ignore_horizontal =
false;
6488 bool ignore_vertical =
false;
6489 if (only_text_height)
6492 if (text_rotation == 0. || text_rotation == 180.)
6493 ignore_horizontal =
true;
6494 else if (text_rotation == 90. || text_rotation == 270.)
6495 ignore_vertical =
true;
6498 if (! ignore_horizontal)
6500 ext(0) =
std::min (ext(0), text_pos(0)+text_ext(0));
6502 text_pos(0)+text_ext(0)+text_ext(2));
6505 if (! ignore_vertical)
6508 text_pos(1)-text_ext(1)-text_ext(3));
6509 ext(3) =
std::max (ext(3), text_pos(1)-text_ext(1));
6515 ext(2) = ext(2)-ext(0);
6516 ext(3) = ext(3)-ext(1);
6538 std::ostringstream oss;
6550 std::istringstream iss (valstr);
6554 while (std::getline (iss, tmpstr,
'|'))
6558 if (*valstr.rbegin () ==
'|')
6559 sv.
append (std::string (
""));
6579 set_xticklabelmode (
"manual");
6580 xticklabel.run_listeners (
POSTSET);
6584 set_xticklabelmode (
"manual");
6597 set_yticklabelmode (
"manual");
6598 yticklabel.run_listeners (
POSTSET);
6602 set_yticklabelmode (
"manual");
6615 set_zticklabelmode (
"manual");
6616 zticklabel.run_listeners (
POSTSET);
6620 set_zticklabelmode (
"manual");
6645 std::istringstream iss (valstr);
6649 while (std::getline (iss, tmpstr,
'|'))
6653 if (*valstr.rbegin () ==
'|')
6654 sv.
append (std::string (
""));
6682 if (units.set (v,
true))
6684 update_units (old_units);
6698 old_units, new_units,
6702 old_units, new_units,
6706 old_units, new_units,
6710 old_units, new_units,
6721 if (fontunits.set (v,
true))
6723 update_fontunits (old_fontunits);
6733 double parent_height = get_boundingbox (
true).elem (3);
6734 double fsz = get_fontsize ();
6744 double fs = get_fontsize ();
6745 double parent_height = box_pix_height;
6747 if (fontunits_is (
"normalized") && parent_height <= 0)
6748 parent_height = get_boundingbox (
true).elem (3);
6767 bool use_scale)
const
6781 bool use_scale)
const
6787 v(0) = sx.unscale (v(0));
6788 v(1) = sy.unscale (v(1));
6789 v(2) = sz.unscale (v(2));
6836 double& min_pos,
double& max_neg,
6848 if (
xfinite (val) && val < min_val)
6852 if (
xfinite (val) && val > max_val)
6856 if (
xfinite (val) && val > 0 && val < min_pos)
6860 if (
xfinite (val) && val < 0 && val > max_neg)
6901 magform ((hi-lo)/ticint, a, b);
6903 static const double sqrt_2 = sqrt (2.0);
6904 static const double sqrt_10 = sqrt (10.0);
6905 static const double sqrt_50 = sqrt (50.0);
6909 else if (a < sqrt_10)
6911 else if (a < sqrt_50)
6926 double min_pos,
double max_neg,
6931 double min_val =
xmin;
6932 double max_val =
xmax;
6934 if (
xisinf (min_val) && min_val > 0 &&
xisinf (max_val) && max_val < 0)
6949 retval(0) =
pow (10., retval(0));
6950 retval(1) =
pow (10., retval(1));
6953 if ((min_val <= 0 && max_val > 0))
6955 warning (
"axis: omitting non-positive data in log plot");
6960 < sqrt (std::numeric_limits<double>::epsilon ()))
6989 if (min_val == 0 && max_val == 0)
6995 else if (
std::abs (min_val - max_val)
6996 < sqrt (std::numeric_limits<double>::epsilon ()))
6998 min_val -= 0.1 *
std::abs (min_val);
6999 max_val += 0.1 *
std::abs (max_val);
7002 double tick_sep = calc_tick_sep (min_val , max_val);
7004 double max_tick =
std::ceil (max_val / tick_sep);
7006 min_val =
std::min (min_val, tick_sep * min_tick);
7007 max_val =
std::max (max_val, tick_sep * max_tick);
7013 retval(1) = max_val;
7014 retval(0) = min_val;
7023 bool limmode_is_auto,
bool is_logscale)
7032 bool is_negative = lo < 0 && hi < 0;
7043 hi = std::log10 (-lo);
7044 lo = std::log10 (-tmp);
7048 hi = std::log10 (hi);
7049 lo = std::log10 (lo);
7063 tick_sep = calc_tick_sep (lo , hi);
7066 int i2 =
static_cast<int> (
std::ceil (hi / tick_sep));
7068 if (limmode_is_auto)
7072 tmp_lims(0) =
std::min (tick_sep * i1, lo);
7073 tmp_lims(1) =
std::max (tick_sep * i2, hi);
7077 tmp_lims(0) =
std::pow (10.,tmp_lims(0));
7078 tmp_lims(1) =
std::pow (10.,tmp_lims(1));
7079 if (tmp_lims(0) <= 0)
7084 tmp_lims(0) = -tmp_lims(1);
7091 Matrix tmp_ticks (1, i2-i1+1);
7092 for (
int i = 0; i <= i2-i1; i++)
7094 tmp_ticks (i) = tick_sep * (i+i1);
7096 tmp_ticks (i) =
std::pow (10., tmp_ticks (i));
7098 if (is_logscale && is_negative)
7100 Matrix rev_ticks (1, i2-i1+1);
7101 rev_ticks = -tmp_ticks;
7102 for (
int i = 0; i <= i2-i1; i++)
7103 tmp_ticks (i) = rev_ticks (i2-i1-i);
7108 int n = is_logscale ? 8 : 4;
7109 Matrix tmp_mticks (1, n * (tmp_ticks.
numel () - 1));
7111 for (
int i = 0; i < tmp_ticks.
numel ()-1; i++)
7113 double d = (tmp_ticks (i+1) - tmp_ticks (i)) / (n+1);
7114 for (
int j = 0; j < n; j++)
7116 tmp_mticks (n*i+j) = tmp_ticks (i) + d * (j+1);
7119 mticks = tmp_mticks;
7128 std::ostringstream os;
7134 double exp_max = 0.;
7135 double exp_min = 0.;
7137 for (
int i = 0; i < values.
numel (); i++)
7139 exp_max =
std::max (exp_max, std::log10 (values(i)));
7140 exp_min =
std::max (exp_min, std::log10 (values(i)));
7143 for (
int i = 0; i < values.
numel (); i++)
7149 significand = values(i) *
std::pow (10., -exponent);
7150 os.str (std::string ());
7155 exponent = -exponent;
7159 if (exponent < 10. && (exp_max > 9 || exp_min < -9))
7167 for (
int i = 0; i < values.
numel (); i++)
7169 os.str (std::string ());
7183 #ifndef HAVE_FREETYPE
7184 double fontsize =
get (
"fontsize").double_value ();
7191 for (
int i = 0; i < n; i++)
7193 double val = ticks(i);
7194 if (limits(0) <= val && val <= limits(1))
7196 std::string label (ticklabels(i));
7197 label.erase (0, label.find_first_not_of (
" "));
7198 label = label.substr (0, label.find_last_not_of (
" ")+1);
7199 #ifdef HAVE_FREETYPE
7200 ext = text_renderer.get_extent (label, 0.0,
"none");
7205 int len = label.length ();
7206 wmax =
std::max (wmax, 0.5*fontsize*len);
7219 double& min_pos,
double& max_neg,
7220 const Matrix& kids,
char limit_type)
7307 if (updating_axis_limits.find (
get_handle ().value ())
7308 != updating_axis_limits.end ())
7318 char update_type = 0;
7323 #define FIX_LIMITS \
7324 if (limits.numel () == 4) \
7327 if (xfinite (val)) \
7330 if (xfinite (val)) \
7333 if (xfinite (val)) \
7336 if (xfinite (val)) \
7341 limits.resize (4, 1); \
7342 limits(0) = min_val; \
7343 limits(1) = max_val; \
7344 limits(2) = min_pos; \
7345 limits(3) = max_neg; \
7348 if (axis_type ==
"xdata" || axis_type ==
"xscale"
7349 || axis_type ==
"xlimmode" || axis_type ==
"xliminclude"
7350 || axis_type ==
"xlim")
7359 limits =
xproperties.get_axis_limits (min_val, max_val,
7366 else if (axis_type ==
"ydata" || axis_type ==
"yscale"
7367 || axis_type ==
"ylimmode" || axis_type ==
"yliminclude"
7368 || axis_type ==
"ylim")
7377 limits =
xproperties.get_axis_limits (min_val, max_val,
7384 else if (axis_type ==
"zdata" || axis_type ==
"zscale"
7385 || axis_type ==
"zlimmode" || axis_type ==
"zliminclude"
7386 || axis_type ==
"zlim")
7395 limits =
xproperties.get_axis_limits (min_val, max_val,
7402 else if (axis_type ==
"cdata" || axis_type ==
"climmode"
7403 || axis_type ==
"cdatamapping" || axis_type ==
"climinclude"
7404 || axis_type ==
"clim")
7413 if (min_val > max_val)
7415 min_val = min_pos = 0;
7418 else if (min_val == max_val)
7420 max_val = min_val + 1;
7426 limits(0) = min_val;
7427 limits(1) = max_val;
7433 else if (axis_type ==
"alphadata" || axis_type ==
"alimmode"
7434 || axis_type ==
"alphadatamapping" || axis_type ==
"aliminclude"
7435 || axis_type ==
"alim")
7444 if (min_val > max_val)
7446 min_val = min_pos = 0;
7449 else if (min_val == max_val)
7450 max_val = min_val + 1;
7454 limits(0) = min_val;
7455 limits(1) = max_val;
7467 updating_axis_limits.insert (
get_handle ().value ());
7469 switch (update_type)
7510 if ((updating_axis_limits.find (
get_handle ().value ())
7511 != updating_axis_limits.end ())
7512 || (updating_aspectratios.find (
get_handle ().value ())
7513 != updating_aspectratios.end ()))
7523 char update_type = 0;
7527 if (axis_type ==
"xdata" || axis_type ==
"xscale"
7528 || axis_type ==
"xlimmode" || axis_type ==
"xliminclude"
7529 || axis_type ==
"xlim")
7535 limits =
xproperties.get_axis_limits (min_val, max_val,
7542 else if (axis_type ==
"ydata" || axis_type ==
"yscale"
7543 || axis_type ==
"ylimmode" || axis_type ==
"yliminclude"
7544 || axis_type ==
"ylim")
7550 limits =
xproperties.get_axis_limits (min_val, max_val,
7557 else if (axis_type ==
"zdata" || axis_type ==
"zscale"
7558 || axis_type ==
"zlimmode" || axis_type ==
"zliminclude"
7559 || axis_type ==
"zlim")
7565 limits =
xproperties.get_axis_limits (min_val, max_val,
7572 else if (axis_type ==
"cdata" || axis_type ==
"climmode"
7573 || axis_type ==
"cdatamapping" || axis_type ==
"climinclude"
7574 || axis_type ==
"clim")
7580 if (min_val > max_val)
7582 min_val = min_pos = 0;
7585 else if (min_val == max_val)
7587 max_val = min_val + 1;
7593 limits(0) = min_val;
7594 limits(1) = max_val;
7600 else if (axis_type ==
"alphadata" || axis_type ==
"alimmode"
7601 || axis_type ==
"alphadatamapping" || axis_type ==
"aliminclude"
7602 || axis_type ==
"alim")
7608 if (min_val > max_val)
7610 min_val = min_pos = 0;
7613 else if (min_val == max_val)
7614 max_val = min_val + 1;
7618 limits(0) = min_val;
7619 limits(1) = max_val;
7629 updating_axis_limits.insert (
get_handle ().value ());
7631 switch (update_type)
7684 double lo = lims(0);
7685 double hi = lims(1);
7687 bool is_negative = lo < 0 && hi < 0;
7694 hi = std::log10 (-lo);
7695 lo = std::log10 (-tmp);
7696 val = std::log10 (-val);
7700 hi = std::log10 (hi);
7701 lo = std::log10 (lo);
7702 val = std::log10 (val);
7707 lo = val + (lo - val) / factor;
7708 hi = val + (hi - val) / factor;
7733 double x,
double y,
double factor,
7734 bool push_to_zoom_stack)
7737 Matrix xlims = get_xlim ().matrix_value ();
7738 Matrix ylims = get_ylim ().matrix_value ();
7741 Matrix kids = get_children ();
7754 xlims =
do_zoom (x, factor, xlims, xscale_is (
"log"));
7755 ylims =
do_zoom (y, factor, ylims, yscale_is (
"log"));
7757 zoom (mode, xlims, ylims, push_to_zoom_stack);
7762 bool push_to_zoom_stack)
7765 Matrix xlims = get_xlim ().matrix_value ();
7766 Matrix ylims = get_ylim ().matrix_value ();
7768 double x = (xlims(0) + xlims(1)) / 2;
7769 double y = (ylims(0) + ylims(1)) / 2;
7771 zoom_about_point (mode, x, y, factor, push_to_zoom_stack);
7777 if (zoom_stack.empty ())
7779 zoom_stack.push_front (xlimmode.get ());
7780 zoom_stack.push_front (xlim.get ());
7781 zoom_stack.push_front (ylimmode.get ());
7782 zoom_stack.push_front (ylim.get ());
7783 zoom_stack.push_front (zlimmode.get ());
7784 zoom_stack.push_front (zlim.get ());
7785 zoom_stack.push_front (view.get ());
7792 bool push_to_zoom_stack)
7794 if (push_to_zoom_stack)
7797 if (mode ==
"horizontal" || mode ==
"both")
7800 xlimmode =
"manual";
7803 if (mode ==
"vertical" || mode ==
"both")
7806 ylimmode =
"manual";
7809 update_transform ();
7811 if (mode ==
"horizontal" || mode ==
"both")
7814 if (mode ==
"vertical" || mode ==
"both")
7823 double lo = lims(0);
7824 double hi = lims(1);
7826 bool is_negative = lo < 0 && hi < 0;
7835 hi = std::log10 (-lo);
7836 lo = std::log10 (-tmp);
7842 hi = std::log10 (hi);
7843 lo = std::log10 (lo);
7846 delta = std::log10 (x0) - std::log10 (x1);
7880 double x0,
double x1,
double y0,
double y1,
7881 bool push_to_zoom_stack)
7884 Matrix xlims = get_xlim ().matrix_value ();
7885 Matrix ylims = get_ylim ().matrix_value ();
7888 Matrix kids = get_children ();
7901 xlims =
do_translate (x0, x1, xlims, xscale_is (
"log"));
7902 ylims =
do_translate (y0, y1, ylims, yscale_is (
"log"));
7904 zoom (mode, xlims, ylims, push_to_zoom_stack);
7909 bool push_to_zoom_stack)
7912 Matrix xlims = get_xlim ().matrix_value ();
7913 Matrix ylims = get_ylim ().matrix_value ();
7915 double x0 = (xlims(0) + xlims(1)) / 2;
7916 double y0 = (ylims(0) + ylims(1)) / 2;
7918 double x1 = x0 + (xlims(1) - xlims(0)) * factor;
7919 double y1 = y0 + (ylims(1) - ylims(0)) * factor;
7921 translate_view (mode, x0, x1, y0, y1, push_to_zoom_stack);
7926 bool push_to_zoom_stack)
7928 if (push_to_zoom_stack)
7931 Matrix bb = get_boundingbox (
true);
7932 Matrix new_view = get_view ().matrix_value ();
7935 new_view(0) += ((x0 - x1) * (180.0 / bb(2)));
7936 new_view(1) += ((y1 - y0) * (180.0 / bb(3)));
7939 new_view(1) =
std::min (new_view(1), 90.0);
7940 new_view(1) =
std::max (new_view(1), -90.0);
7941 if (new_view(0) > 180.0)
7942 new_view(0) -= 360.0;
7943 else if (new_view(0) < -180.0)
7944 new_view(0) += 360.0;
7947 double snapMargin = 1.0;
7948 for (
int a = -90; a <= 90; a += 90)
7950 if ((a - snapMargin) < new_view(1)
7951 && new_view(1) < (a + snapMargin))
7958 for (
int a = -180; a <= 180; a += 180)
7959 if ((a - snapMargin) < new_view(0)
7960 && new_view(0) < (a + snapMargin))
7970 set_view (new_view);
7975 bool push_to_zoom_stack)
7977 if (push_to_zoom_stack)
7980 Matrix v = get_view ().matrix_value ();
7989 v(0) = fmod (v(0) - delta_az + 720,360);
7993 update_transform ();
7999 if (zoom_stack.size () >= 7)
8001 view = zoom_stack.front ();
8002 zoom_stack.pop_front ();
8004 zlim = zoom_stack.front ();
8005 zoom_stack.pop_front ();
8007 zlimmode = zoom_stack.front ();
8008 zoom_stack.pop_front ();
8010 ylim = zoom_stack.front ();
8011 zoom_stack.pop_front ();
8013 ylimmode = zoom_stack.front ();
8014 zoom_stack.pop_front ();
8016 xlim = zoom_stack.front ();
8017 zoom_stack.pop_front ();
8019 xlimmode = zoom_stack.front ();
8020 zoom_stack.pop_front ();
8022 update_transform ();
8035 size_t items_to_leave_on_stack = do_unzoom ? 7 : 0;
8037 while (zoom_stack.size () > items_to_leave_on_stack)
8038 zoom_stack.pop_front ();
8074 m(0) = xdata.min_val ();
8075 m(1) = xdata.max_val ();
8076 m(2) = xdata.min_pos ();
8077 m(3) = xdata.max_neg ();
8087 m(0) = ydata.min_val ();
8088 m(1) = ydata.max_val ();
8089 m(2) = ydata.min_pos ();
8090 m(3) = ydata.max_neg ();
8100 Matrix pos = get_position ().matrix_value ();
8102 if (! units_is (
"data"))
8112 return extent.get ().matrix_value ();
8120 Matrix m = extent.get ().matrix_value ();
8121 Matrix pos = get_position ().matrix_value ();
8136 if (fontunits.set (v,
true))
8138 update_fontunits (old_fontunits);
8148 double parent_height = 0;
8149 double fsz = get_fontsize ();
8151 if (new_units ==
"normalized")
8156 parent_height = ax.get_properties ().get_boundingbox (
true).elem (3);
8167 #ifdef HAVE_FREETYPE
8168 #ifdef HAVE_FONTCONFIG
8169 renderer.set_font (
get (
"fontname").string_value (),
8170 get (
"fontweight").string_value (),
8171 get (
"fontangle").string_value (),
8172 get (
"fontsize_points").double_value ());
8174 renderer.set_color (get_color_rgb ());
8181 #ifdef HAVE_FREETYPE
8186 if (horizontalalignment_is (
"center"))
8188 else if (horizontalalignment_is (
"right"))
8191 if (verticalalignment_is (
"middle"))
8193 else if (verticalalignment_is (
"top"))
8195 else if (verticalalignment_is (
"baseline"))
8197 else if (verticalalignment_is (
"cap"))
8208 renderer.text_to_pixels (sv.
join (
"\n"), pixels, bbox,
8209 halign, valign, get_rotation (),
8210 get_interpreter ());
8219 if (autopos_tag_is (
"xlabel") || autopos_tag_is (
"ylabel")
8220 || autopos_tag_is (
"zlabel") || autopos_tag_is (
"title"))
8221 update_autopos (
"sync");
8227 if (autopos_tag_is (
"xlabel") || autopos_tag_is (
"ylabel")
8228 || autopos_tag_is (
"zlabel") || autopos_tag_is (
"title"))
8229 update_autopos (get_autopos_tag ());
8235 if (! units_is (
"data"))
8237 set_xliminclude (
"off");
8238 set_yliminclude (
"off");
8239 set_zliminclude (
"off");
8242 Matrix pos = get_position ().matrix_value ();
8250 bool autopos = positionmode_is (
"auto");
8255 set_positionmode (
"auto");
8257 if (units_is (
"data"))
8259 set_xliminclude (
"on");
8260 set_yliminclude (
"on");
8262 set_zliminclude (
"off");
8265 cached_units = get_units ();
8271 double fs = get_fontsize ();
8272 double parent_height = box_pix_height;
8274 if (fontunits_is (
"normalized") && parent_height <= 0)
8279 parent_height = ax.get_properties ().get_boundingbox (
true).elem (3);
8291 cdatamapping_is (
"scaled"), 3);
8303 return convert_cdata (*
this, fvc,cdatamapping_is (
"scaled"), 2);
8311 if (updating_patch_data)
8314 Matrix xd = get_xdata ().matrix_value ();
8315 Matrix yd = get_ydata ().matrix_value ();
8316 Matrix zd = get_zdata ().matrix_value ();
8317 NDArray cd = get_cdata ().array_value ();
8319 bad_data_msg = std::string ();
8323 bad_data_msg =
"x/y/zdata should have the same dimensions";
8332 if (nr == 1 && nc > 1)
8358 vert(kk,0) = xd(ii,jj);
8359 vert(kk,1) = yd(ii,jj);
8361 vert(kk,2) = zd(ii,jj);
8363 idx(jj,ii) =
static_cast<double> (kk+1);
8371 if (cd.
ndims () == 3)
8374 dv(1) = cd.
dims ()(2);
8384 updating_patch_data =
true;
8387 vertices.set (vert);
8388 facevertexcdata.set (fvc);
8395 if (updating_patch_data)
8399 Matrix vert = get_vertices ().matrix_value ();
8400 NDArray fvc = get_facevertexcdata ().array_value ();
8406 bad_data_msg = std::string ();
8407 if (static_cast<double> (nvert) < idx.
row_max ().
max ())
8409 bad_data_msg =
"some vertices in \"faces\" property are undefined";
8418 double valid_vert = idx(0,jj);
8419 bool turn_valid =
false;
8422 if (
xisnan (idx(ii,jj)) || turn_valid)
8424 idx(ii,jj) = valid_vert;
8428 valid_vert = idx(ii,jj);
8436 bool pervertex =
false;
8438 if (fvc.
rows () == nfaces || fvc.
rows () == 1)
8441 dv(1) = fvc.
rows ();
8449 dv(0) = idx.
rows ();
8461 bool has_zd =
false;
8474 xd(ii,jj) = vert(row,0);
8475 yd(ii,jj) = vert(row,1);
8478 zd(ii,jj) = vert(row,2);
8481 for (
int kk = 0; kk < fvc.
columns (); kk++)
8482 cd(ii,jj,kk) = fvc(row,kk);
8489 updating_patch_data =
true;
8502 return convert_cdata (*
this, get_cdata (), cdatamapping_is (
"scaled"), 3);
8507 double x2,
double y2,
double z2,
8508 double&
x,
double& y,
double& z)
8510 x += (y1 * z2 - z1 * y2);
8511 y += (z1 * x2 - x1 * z2);
8512 z += (x1 * y2 - y1 * x2);
8518 if (normalmode_is (
"auto"))
8520 Matrix x = get_xdata ().matrix_value ();
8521 Matrix y = get_ydata ().matrix_value ();
8522 Matrix z = get_zdata ().matrix_value ();
8538 bool x_mat = (x.
rows () == q);
8539 bool y_mat = (y.
columns () == p);
8541 int i1, i2, i3, j1, j2, j3;
8545 for (
int i = 0; i < p; i++)
8554 for (
int j = 0; j < q; j++)
8563 double& nx = n(j, i, 0);
8564 double& ny = n(j, i, 1);
8565 double& nz = n(j, i, 2);
8567 if ((j > 0) && (i > 0))
8570 (
x(j1,i-1)-
x(j2,i), y(j-1,i1)-y(j,i2), z(j-1,i-1)-z(j,i),
8571 x(j2,i-1)-
x(j1,i), y(j,i1)-y(j-1,i2), z(j,i-1)-z(j-1,i),
8574 if ((j > 0) && (i < (p -1)))
8577 (
x(j1,i+1)-
x(j2,i), y(j-1,i3)-y(j,i2), z(j-1,i+1)-z(j,i),
8578 x(j1,i)-
x(j2,i+1), y(j-1,i2)-y(j,i3), z(j-1,i)-z(j,i+1),
8581 if ((j < (q - 1)) && (i > 0))
8584 (
x(j2,i-1)-
x(j3,i), y(j,i1)-y(j+1,i2), z(j,i-1)-z(j+1,i),
8585 x(j3,i-1)-
x(j2,i), y(j+1,i1)-y(j,i2), z(j+1,i-1)-z(j,i),
8588 if ((j < (q - 1)) && (i < (p -1)))
8591 (
x(j3,i)-
x(j2,i+1), y(j+1,i2)-y(j,i3), z(j+1,i)-z(j,i+1),
8592 x(j3,i+1)-
x(j2,i), y(j+1,i3)-y(j,i2), z(j+1,i+1)-z(j,i),
8644 if (updating_hggroup_limits)
8657 char update_type = 0;
8659 if (axis_type ==
"xlim" || axis_type ==
"xliminclude")
8664 else if (axis_type ==
"ylim" || axis_type ==
"yliminclude")
8669 else if (axis_type ==
"zlim" || axis_type ==
"zliminclude")
8674 else if (axis_type ==
"clim" || axis_type ==
"climinclude")
8679 else if (axis_type ==
"alim" || axis_type ==
"aliminclude")
8685 if (limits.
numel () == 4)
8703 limits(0) = min_val;
8704 limits(1) = max_val;
8705 limits(2) = min_pos;
8706 limits(3) = max_neg;
8714 updating_hggroup_limits =
true;
8716 if (limits(0) != min_val || limits(1) != max_val
8717 || limits(2) != min_pos || limits(3) != max_neg)
8719 limits(0) = min_val;
8720 limits(1) = max_val;
8721 limits(2) = min_pos;
8722 limits(3) = max_neg;
8724 switch (update_type)
8757 if (updating_hggroup_limits)
8767 char update_type = 0;
8769 if (axis_type ==
"xlim" || axis_type ==
"xliminclude")
8775 else if (axis_type ==
"ylim" || axis_type ==
"yliminclude")
8781 else if (axis_type ==
"zlim" || axis_type ==
"zliminclude")
8787 else if (axis_type ==
"clim" || axis_type ==
"climinclude")
8793 else if (axis_type ==
"alim" || axis_type ==
"aliminclude")
8803 updating_hggroup_limits =
true;
8805 Matrix limits (1, 4, 0.0);
8807 limits(0) = min_val;
8808 limits(1) = max_val;
8809 limits(2) = min_pos;
8810 limits(3) = max_neg;
8812 switch (update_type)
8845 std::list<graphics_handle> lst =
xproperties.get_dependent_obj_list ();
8846 std::list<graphics_handle>::const_iterator it;
8848 for (it = lst.begin (); it != lst.end (); it++)
8891 Matrix m = extent.get ().matrix_value ();
8896 parent_size = parent_bbox.
extract_n (0, 2, 1, 2);
8904 #ifdef HAVE_FREETYPE
8914 #ifdef HAVE_FONTCONFIG
8915 text_renderer.
set_font (get_fontname (),
8927 ext(0) = ext(1) = 1;
8939 Matrix pos = get_position ().matrix_value ();
8943 parent_size = parent_bbox.
extract_n (0, 2, 1, 2);
8948 cached_units = get_units ();
8954 if (get___object__ ().is_empty ())
8957 error (
"set: cannot change the style of a uicontrol object after creation.");
8962 const Matrix& parent_pix_size)
const
8964 Matrix pos = get_position ().matrix_value ();
8965 Matrix parent_size (parent_pix_size);
8967 if (parent_size.
numel () == 0)
8982 pos(1) = parent_size(1) - pos(1) - pos(3);
8993 if (fontunits.set (v,
true))
8995 update_fontunits (old_fontunits);
9005 double parent_height = get_boundingbox (
false).elem (3);
9006 double fsz = get_fontsize ();
9016 double fs = get_fontsize ();
9017 double parent_height = box_pix_height;
9019 if (fontunits_is (
"normalized") && parent_height <= 0)
9020 parent_height = get_boundingbox (
false).elem (3);
9029 const Matrix& parent_pix_size)
const
9031 Matrix pos = get_position ().matrix_value ();
9032 Matrix parent_size (parent_pix_size);
9034 if (parent_size.
numel () == 0)
9046 pos(1) = parent_size(1) - pos(1) - pos(3);
9050 double outer_height = pos(3);
9052 pos(0) = pos(1) = 0;
9054 if (! bordertype_is (
"none"))
9056 double bw = get_borderwidth ();
9059 if (bordertype_is (
"etchedin") || bordertype_is (
"etchedout"))
9064 pos(2) -= 2 * mul * bw;
9065 pos(3) -= 2 * mul * bw;
9068 if (! get_title ().empty ())
9070 double fs = get_fontsize ();
9072 if (! fontunits_is (
"pixels"))
9076 if (fontunits_is (
"points"))
9078 else if (fontunits_is (
"inches"))
9080 else if (fontunits_is (
"centimeters"))
9082 else if (fontunits_is (
"normalized"))
9086 if (titleposition_is (
"lefttop") || titleposition_is (
"centertop")
9087 || titleposition_is (
"righttop"))
9102 if (units.set (v,
true))
9104 update_units (old_units);
9113 Matrix pos = get_position ().matrix_value ();
9117 parent_size = parent_bbox.
extract_n (0, 2, 1, 2);
9129 if (fontunits.set (v,
true))
9131 update_fontunits (old_fontunits);
9141 double parent_height = get_boundingbox (
false).elem (3);
9142 double fsz = get_fontsize ();
9152 double fs = get_fontsize ();
9153 double parent_height = box_pix_height;
9155 if (fontunits_is (
"normalized") && parent_height <= 0)
9156 parent_height = get_boundingbox (
false).elem (3);
9211 : handle_map (), handle_free_list (),
9212 next_handle (-1.0 - (rand () + 1.0) / (RAND_MAX + 2.0)),
9214 callback_objects (), event_processing (0)
9234 bool integer_figure_handle,
9236 bool do_notify_toolkit)
9254 if (go_name ==
"axes")
9282 if (do_notify_toolkit)
9286 error (
"gh_manager::do_make_graphics_handle: invalid object type '%s'",
9303 if (do_notify_toolkit)
9341 callback (), callback_data (data) { }
9346 callback (cb), callback_data (data) { }
9350 if (callback.is_defined ())
9378 function (function_data);
9402 const octave_value& value,
bool do_notify_toolkit =
true)
9404 property_value (value), notify_toolkit (do_notify_toolkit) { }
9417 p.
set (property_value,
true, notify_toolkit);
9435 const std::string& name,
9470 const std::string& name,
9472 bool notify_toolkit)
9544 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
9562 || cb.
cell_value ()(0).is_function_handle ()))
9566 fcn = c(0).function_value ();
9569 for (
int i = 1; i < c.
length () ; i++)
9576 error (
"trying to execute non-executable object (class = %s)",
9583 END_INTERRUPT_WITH_EXCEPTIONS;
9618 if (busy_action.compare (
"queue"))
9626 || (go.
isa (
"figure")
9627 && (cname.
compare (
"closerequestfcn")
9628 || cname.
compare (
"resizefcn"))))
9660 bool events_executed =
false;
9694 events_executed =
true;
9706 if (events_executed)
9765 DEFUN (ishandle, args, ,
9767 @deftypefn {Built-in Function} {} ishandle (@var{h})\n\
9768 Return true if @var{h} is a graphics handle and false otherwise.\n\
9770 @var{h} may also be a matrix of handles in which case a logical array is\n\
9771 returned that is true where the elements of @var{h} are graphics handles and\n\
9772 false where they are not.\n\
9773 @seealso{isaxes, isfigure}\n\
9780 if (args.length () == 1)
9825 DEFUN (__is_handle_visible__, args, ,
9827 @deftypefn {Built-in Function} {} __is_handle_visible__ (@var{h})\n\
9828 Undocumented internal function.\n\
9833 if (args.length () == 1)
9841 DEFUN (reset, args, ,
9843 @deftypefn {Built-in Function} {} reset (@var{h})\n\
9844 Reset the properties of the graphic object @var{h} to their default values.\n\
9846 For figures, the properties @qcode{\"position\"}, @qcode{\"units\"},\n\
9847 @qcode{\"windowstyle\"}, and @qcode{\"paperunits\"} are not affected.\n\
9848 For axes, the properties @qcode{\"position\"} and @qcode{\"units\"} are\n\
9851 The input @var{h} may also be a vector of graphic handles in which case\n\
9852 each individual object will be reset.\n\
9853 @seealso{cla, clf, newplot}\n\
9856 int nargin = args.length ();
10002 DEFUN (set, args, nargout,
10003 "-*- texinfo -*-\n\
10004 @deftypefn {Built-in Function} {} set (@var{h}, @var{property}, @var{value}, @dots{})\n\
10005 @deftypefnx {Built-in Function} {} set (@var{h}, @var{properties}, @var{values})\n\
10006 @deftypefnx {Built-in Function} {} set (@var{h}, @var{pv})\n\
10007 @deftypefnx {Built-in Function} {@var{value_list} =} set (@var{h}, @var{property})\n\
10008 @deftypefnx {Built-in Function} {@var{all_value_list} =} set (@var{h})\n\
10009 Set named property values for the graphics handle (or vector of graphics\n\
10010 handles) @var{h}.\n\
10012 There are three ways to give the property names and values:\n\
10015 @item as a comma separated list of @var{property}, @var{value} pairs\n\
10017 Here, each @var{property} is a string containing the property name, each\n\
10018 @var{value} is a value of the appropriate type for the property.\n\
10020 @item as a cell array of strings @var{properties} containing property names\n\
10021 and a cell array @var{values} containing property values.\n\
10023 In this case, the number of columns of @var{values} must match the number of\n\
10024 elements in @var{properties}. The first column of @var{values} contains\n\
10025 values for the first entry in @var{properties}, etc. The number of rows of\n\
10026 @var{values} must be 1 or match the number of elements of @var{h}. In the\n\
10027 first case, each handle in @var{h} will be assigned the same values. In the\n\
10028 latter case, the first handle in @var{h} will be assigned the values from\n\
10029 the first row of @var{values} and so on.\n\
10031 @item as a structure array @var{pv}\n\
10033 Here, the field names of @var{pv} represent the property names, and the field\n\
10034 values give the property values. In contrast to the previous case, all\n\
10035 elements of @var{pv} will be set in all handles in @var{h} independent of\n\
10036 the dimensions of @var{pv}.\n\
10039 @code{set} is also used to query the list of values a named property will\n\
10040 take. @code{@var{clist} = set (@var{h}, \"property\")} will return the list\n\
10041 of possible values for @qcode{\"property\"} in the cell list @var{clist}.\n\
10042 If no output variable is used then the list is formatted and printed to the\n\
10045 If no property is specified (@code{@var{slist} = set (@var{h})}) then a\n\
10046 structure @var{slist} is returned where the fieldnames are the properties of\n\
10047 the object @var{h} and the fields are the list of possible values for each\n\
10048 property. If no output variable is used then the list is formatted and\n\
10049 printed to the screen.\n\
10056 set (hf, \"paperorientation\")\n\
10057 @result{} paperorientation: [ landscape | @{portrait@} | rotated ]\n\
10062 shows the paperorientation property can take three values with the default\n\
10063 being @qcode{\"portrait\"}.\n\
10071 int nargin = args.
length ();
10080 bool request_drawnow =
false;
10089 if (nargin == 3 && args(1).is_cellstr ()
10090 && args(2).is_cell ())
10092 if (args(2).cell_value ().rows () == 1)
10094 obj.
set (args(1).cellstr_value (),
10095 args(2).cell_value (), 0);
10097 else if (hcv.
length () == args(2).cell_value ().rows ())
10099 obj.
set (args(1).cellstr_value (),
10100 args(2).cell_value (), n);
10104 error (
"set: number of graphics handles must match number of value rows (%d != %d)",
10105 hcv.
length (), args(2).cell_value ().rows ());
10110 else if (nargin == 2 && args(1).is_map ())
10112 obj.
set (args(1).map_value ());
10114 else if (nargin == 2 && args(1).is_string ())
10116 std::string
property = args(1).string_value ();
10125 <<
" is read-only" << std::endl;
10139 error (
"set: unknown property");
10143 else if (nargin == 1)
10156 obj.
set (args.splice (0, 1));
10157 request_drawnow =
true;
10162 error (
"set: invalid handle (= %g)", hcv(n));
10169 request_drawnow =
true;
10176 error (
"set: expecting graphics handle as first argument");
10187 std::string retval;
10192 retval = obj.
type ();
10194 error (
"get: invalid handle (= %g)", val);
10199 DEFUN (
get, args, ,
10200 "-*- texinfo -*-\n\
10201 @deftypefn {Built-in Function} {@var{val} =} get (@var{h})\n\
10202 @deftypefnx {Built-in Function} {@var{val} =} get (@var{h}, @var{p})\n\
10203 Return the value of the named property @var{p} from the graphics handle\n\
10206 If @var{p} is omitted, return the complete property list for @var{h}.\n\
10208 If @var{h} is a vector, return a cell array including the property values or\n\
10209 lists respectively.\n\
10219 int nargin = args.
length ();
10221 bool use_cell_format =
false;
10223 if (nargin == 1 || nargin == 2)
10225 if (args(0).is_empty ())
10237 if (nargin == 1 && len > 1)
10252 error (
"get: vector of handles must all have same type");
10262 if (nargin > 1 && args(1).is_cellstr ())
10270 use_cell_format =
true;
10291 error (
"get: invalid handle (= %g)", hcv(n));
10297 error (
"get: expecting property name or cell array of property names as second argument");
10305 property = args(1).string_value ();
10308 error (
"get: expecting property name or cell array of property names as second argument");
10322 vals(n) = obj.
get ();
10324 vals(n) = obj.
get (property);
10328 error (
"get: invalid handle (= %g)", hcv(n));
10337 error (
"get: expecting graphics handle as first argument");
10344 if (use_cell_format)
10354 else if (len > 1 && nargin == 1)
10359 tmp[n] = vals(n).scalar_map_value ();
10379 DEFUN (__get__, args, ,
10380 "-*- texinfo -*-\n\
10381 @deftypefn {Built-in Function} {} __get__ (@var{h})\n\
10382 Undocumented internal function.\n\
10391 int nargin = args.
length ();
10408 vals(n) = obj.
get (
true);
10411 error (
"get: invalid handle (= %g)", hcv(n));
10417 error (
"get: expecting graphics handle as first argument");
10437 bool integer_figure_handle,
10448 for (
int i = 0; i < xargs.
length (); i++)
10449 if (xargs(i).is_string ()
10450 && p.
compare (xargs(i).string_value ()))
10452 if (i < (xargs.
length () - 1))
10454 val = xargs(i+1).double_value ();
10458 xargs = xargs.
splice (i, 2);
10463 error (
"__go_%s__: missing value for parent property",
10468 val = args(0).double_value ();
10478 integer_figure_handle,
10489 retval = h.
value ();
10495 error (
"__go%s__: unable to create graphics handle",
10499 error (
"__go_%s__: invalid parent", go_name.c_str ());
10502 error (
"__go_%s__: invalid parent", go_name.c_str ());
10507 DEFUN (__go_figure__, args, ,
10508 "-*- texinfo -*-\n\
10509 @deftypefn {Built-in Function} {} __go_figure__ (@var{fignum})\n\
10510 Undocumented internal function.\n\
10517 if (args.length () > 0)
10527 xset (h, args.splice (0, 1));
10529 retval = h.
value ();
10533 bool int_fig_handle =
true;
10543 for (
int i = 0; i < xargs.
length (); i++)
10545 if (xargs(i).is_string ()
10546 && p.
compare (xargs(i).string_value ()))
10548 if (i < (xargs.
length () - 1))
10550 std::string pval = xargs(i+1).string_value ();
10555 int_fig_handle = on.
compare (pval);
10556 xargs = xargs.
splice (i, 2);
10567 if (! int_fig_handle)
10578 else if (val > 0 &&
D_NINT (val) == val)
10591 retval = h.
value ();
10594 error (
"__go_figure__: failed to create figure handle");
10598 error (
"__go_figure__: expecting figure number to be double value");
10606 #define GO_BODY(TYPE) \
10607 gh_manager::auto_lock guard; \
10609 octave_value retval; \
10611 if (args.length () > 0) \
10612 retval = make_graphics_object (#TYPE, false, args); \
10624 if (go.
isa (
"surface"))
10626 else if ((go.
isa (
"line") || go.
isa (
"patch"))
10653 DEFUN (__calc_dimensions__, args, ,
10654 "-*- texinfo -*-\n\
10655 @deftypefn {Built-in Function} {} __calc_dimensions__ (@var{axes})\n\
10656 Internal function.\n\
10658 Determine the number of dimensions in a graphics object, either 2 or 3.\n\
10665 int nargin = args.
length ();
10669 double h = args(0).double_value ();
10673 error (
"__calc_dimensions__: expecting graphics handle as only argument");
10681 DEFUN (__go_axes__, args, ,
10682 "-*- texinfo -*-\n\
10683 @deftypefn {Built-in Function} {} __go_axes__ (@var{parent})\n\
10684 Undocumented internal function.\n\
10690 DEFUN (__go_line__, args, ,
10691 "-*- texinfo -*-\n\
10692 @deftypefn {Built-in Function} {} __go_line__ (@var{parent})\n\
10693 Undocumented internal function.\n\
10699 DEFUN (__go_text__, args, ,
10700 "-*- texinfo -*-\n\
10701 @deftypefn {Built-in Function} {} __go_text__ (@var{parent})\n\
10702 Undocumented internal function.\n\
10708 DEFUN (__go_image__, args, ,
10709 "-*- texinfo -*-\n\
10710 @deftypefn {Built-in Function} {} __go_image__ (@var{parent})\n\
10711 Undocumented internal function.\n\
10717 DEFUN (__go_surface__, args, ,
10718 "-*- texinfo -*-\n\
10719 @deftypefn {Built-in Function} {} __go_surface__ (@var{parent})\n\
10720 Undocumented internal function.\n\
10726 DEFUN (__go_patch__, args, ,
10727 "-*- texinfo -*-\n\
10728 @deftypefn {Built-in Function} {} __go_patch__ (@var{parent})\n\
10729 Undocumented internal function.\n\
10735 DEFUN (__go_hggroup__, args, ,
10736 "-*- texinfo -*-\n\
10737 @deftypefn {Built-in Function} {} __go_hggroup__ (@var{parent})\n\
10738 Undocumented internal function.\n\
10744 DEFUN (__go_uimenu__, args, ,
10745 "-*- texinfo -*-\n\
10746 @deftypefn {Built-in Function} {} __go_uimenu__ (@var{parent})\n\
10747 Undocumented internal function.\n\
10753 DEFUN (__go_uicontrol__, args, ,
10754 "-*- texinfo -*-\n\
10755 @deftypefn {Built-in Function} {} __go_uicontrol__ (@var{parent})\n\
10756 Undocumented internal function.\n\
10762 DEFUN (__go_uipanel__, args, ,
10763 "-*- texinfo -*-\n\
10764 @deftypefn {Built-in Function} {} __go_uipanel__ (@var{parent})\n\
10765 Undocumented internal function.\n\
10771 DEFUN (__go_uicontextmenu__, args, ,
10772 "-*- texinfo -*-\n\
10773 @deftypefn {Built-in Function} {} __go_uicontextmenu__ (@var{parent})\n\
10774 Undocumented internal function.\n\
10780 DEFUN (__go_uitoolbar__, args, ,
10781 "-*- texinfo -*-\n\
10782 @deftypefn {Built-in Function} {} __go_uitoolbar__ (@var{parent})\n\
10783 Undocumented internal function.\n\
10789 DEFUN (__go_uipushtool__, args, ,
10790 "-*- texinfo -*-\n\
10791 @deftypefn {Built-in Function} {} __go_uipushtool__ (@var{parent})\n\
10792 Undocumented internal function.\n\
10798 DEFUN (__go_uitoggletool__, args, ,
10799 "-*- texinfo -*-\n\
10800 @deftypefn {Built-in Function} {} __go_uitoggletool__ (@var{parent})\n\
10801 Undocumented internal function.\n\
10807 DEFUN (__go_delete__, args, ,
10808 "-*- texinfo -*-\n\
10809 @deftypefn {Built-in Function} {} __go_delete__ (@var{h})\n\
10810 Undocumented internal function.\n\
10817 if (args.length () == 1)
10821 const NDArray vals = args(0).array_value ();
10834 error (
"delete: invalid graphics object (= %g)",
10844 error (
"delete: invalid graphics object");
10852 DEFUN (__go_axes_init__, args, ,
10853 "-*- texinfo -*-\n\
10854 @deftypefn {Built-in Function} {} __go_axes_init__ (@var{h}, @var{mode})\n\
10855 Undocumented internal function.\n\
10862 int nargin = args.
length ();
10864 std::string mode =
"";
10868 mode = args(1).string_value ();
10874 if (nargin == 1 || nargin == 2)
10878 double val = args(0).double_value ();
10892 error (
"__go_axes_init__: axis deleted during initialization (= %g)",
10896 error (
"__go_axes_init__: invalid graphics object (= %g)", val);
10899 error (
"__go_axes_init__: invalid graphics object");
10907 DEFUN (__go_handles__, args, ,
10908 "-*- texinfo -*-\n\
10909 @deftypefn {Built-in Function} {} __go_handles__ (@var{show_hidden})\n\
10910 Undocumented internal function.\n\
10915 bool show_hidden =
false;
10917 if (args.length () > 0)
10918 show_hidden = args(0).bool_value ();
10923 DEFUN (__go_figure_handles__, args, ,
10924 "-*- texinfo -*-\n\
10925 @deftypefn {Built-in Function} {} __go_figure_handles__ (@var{show_hidden})\n\
10926 Undocumented internal function.\n\
10931 bool show_hidden =
false;
10933 if (args.length () > 0)
10934 show_hidden = args(0).bool_value ();
10939 DEFUN (__go_execute_callback__, args, ,
10940 "-*- texinfo -*-\n\
10941 @deftypefn {Built-in Function} {} __go_execute_callback__ (@var{h}, @var{name})\n\
10942 @deftypefnx {Built-in Function} {} __go_execute_callback__ (@var{h}, @var{name}, @var{param})\n\
10943 Undocumented internal function.\n\
10948 int nargin = args.
length ();
10950 if (nargin == 2 || nargin == 3)
10952 double val = args(0).double_value ();
10960 std::string name = args(1).string_value ();
10970 error (
"__go_execute_callback__: invalid callback name");
10973 error (
"__go_execute_callback__: invalid graphics object (= %g)",
10977 error (
"__go_execute_callback__: invalid graphics object");
10985 DEFUN (__image_pixel_size__, args, ,
10986 "-*- texinfo -*-\n\
10987 @deftypefn {Built-in Function} {@var{px}, @var{py}} __image_pixel_size__ (@var{h})\n\
10988 Internal function: returns the pixel size of the image in normalized units.\n\
10993 int nargin = args.
length ();
10997 double h = args(0).double_value ();
11002 if (fobj && fobj.
isa (
"image"))
11013 error (
"__image_pixel_size__: object is not an image");
11016 error (
"__image_pixel_size__: argument is not a handle");
11040 if (!
dtk.empty ())
11052 feval (
"graphics_toolkit", args);
11058 error (
"failed to load %s graphics toolkit",
dtk.c_str ());
11060 retval = pl->second;
11063 error (
"default graphics toolkit '%s' is not available!",
11067 retval = pl->second;
11070 error (
"no graphics toolkits are available!");
11078 if (
dtk.empty () || name ==
"qt"
11103 std::string tk_name = *pa++;
11105 if (tk_name ==
"qt"
11106 || (tk_name ==
"fltk"
11115 DEFUN (available_graphics_toolkits, , ,
11116 "-*- texinfo -*-\n\
11117 @deftypefn {Built-in Function} {} available_graphics_toolkits ()\n\
11118 Return a cell array of registered graphics toolkits.\n\
11119 @seealso{graphics_toolkit, register_graphics_toolkit}\n\
11127 DEFUN (register_graphics_toolkit, args, ,
11128 "-*- texinfo -*-\n\
11129 @deftypefn {Built-in Function} {} register_graphics_toolkit (@var{toolkit})\n\
11130 List @var{toolkit} as an available graphics toolkit.\n\
11131 @seealso{available_graphics_toolkits}\n\
11138 if (args.length () == 1)
11140 if (args(0).is_string ())
11142 std::string name = args(0).string_value ();
11146 error (
"register_graphics_toolkit: TOOLKIT must be a string");
11154 DEFUN (loaded_graphics_toolkits, , ,
11155 "-*- texinfo -*-\n\
11156 @deftypefn {Built-in Function} {} loaded_graphics_toolkits ()\n\
11157 Return a cell array of the currently loaded graphics toolkits.\n\
11158 @seealso{available_graphics_toolkits}\n\
11166 DEFUN (drawnow, args, ,
11167 "-*- texinfo -*-\n\
11168 @deftypefn {Built-in Function} {} drawnow ()\n\
11169 @deftypefnx {Built-in Function} {} drawnow (\"expose\")\n\
11170 @deftypefnx {Built-in Function} {} drawnow (@var{term}, @var{file}, @var{mono}, @var{debug_file})\n\
11171 Update figure windows and their children.\n\
11173 The event queue is flushed and any callbacks generated are executed.\n\
11175 With the optional argument @qcode{\"expose\"}, only graphic objects are\n\
11176 updated and no other events or callbacks are processed.\n\
11178 The third calling form of @code{drawnow} is for debugging and is\n\
11180 @seealso{refresh}\n\
11183 static int drawnow_executing = 0;
11194 if (++drawnow_executing <= 1)
11196 if (args.length () == 0 || args.length () == 1)
11204 if (h.
ok () && h != 0)
11226 bool do_events =
true;
11228 if (args.length () == 1)
11236 error (
"drawnow: invalid argument, expected 'expose' as argument");
11253 else if (args.length () >= 2 && args.length () <= 4)
11255 std::string term, file, debug_file;
11258 term = args(0).string_value ();
11262 file = args(1).string_value ();
11266 size_t pos_p = file.find_first_of (
"|");
11267 size_t pos_c = file.find_first_not_of (
"| ");
11269 if (pos_p == std::string::npos &&
11270 pos_c == std::string::npos)
11272 error (
"drawnow: empty output ''");
11278 else if (pos_c == std::string::npos)
11280 error (
"drawnow: empty pipe '|'");
11286 else if (pos_p != std::string::npos && pos_p < pos_c)
11289 file = file.substr (pos_c);
11295 if (pos != std::string::npos)
11297 std::string dirname = file.substr (pos_c, pos+1);
11301 if (! (fs && fs.
is_dir ()))
11303 error (
"drawnow: nonexistent directory '%s'",
11313 mono = (args.length () >= 3 ? args(2).bool_value () :
false);
11317 debug_file = (args.length () > 3 ? args(3).string_value ()
11336 error (
"drawnow: nothing to draw");
11339 error (
"drawnow: invalid DEBUG_FILE, expected a string value");
11342 error (
"drawnow: invalid colormode MONO, expected a boolean value");
11345 error (
"drawnow: invalid FILE, expected a string value");
11348 error (
"drawnow: invalid terminal TERM, expected a string value");
11359 DEFUN (addlistener, args, ,
11360 "-*- texinfo -*-\n\
11361 @deftypefn {Built-in Function} {} addlistener (@var{h}, @var{prop}, @var{fcn})\n\
11362 Register @var{fcn} as listener for the property @var{prop} of the graphics\n\
11365 Property listeners are executed (in order of registration) when the property\n\
11366 is set. The new value is already available when the listeners are executed.\n\
11368 @var{prop} must be a string naming a valid property in @var{h}.\n\
11370 @var{fcn} can be a function handle, a string or a cell array whose first\n\
11371 element is a function handle. If @var{fcn} is a function handle, the\n\
11372 corresponding function should accept at least 2 arguments, that will be\n\
11373 set to the object handle and the empty matrix respectively. If @var{fcn}\n\
11374 is a string, it must be any valid octave expression. If @var{fcn} is a cell\n\
11375 array, the first element must be a function handle with the same signature\n\
11376 as described above. The next elements of the cell array are passed\n\
11377 as additional arguments to the function.\n\
11383 function my_listener (h, dummy, p1)\n\
11384 fprintf (\"my_listener called with p1=%s\\n\", p1);\n\
11387 addlistener (gcf, \"position\", @{@@my_listener, \"my string\"@})\n\
11391 @seealso{addproperty, hggroup}\n\
11398 if (args.length () >= 3 && args.length () <= 4)
11400 double h = args(0).double_value ();
11404 std::string pname = args(1).string_value ();
11416 if (args.length () == 4)
11419 if (persistent.
compare (
"persistent"))
11424 error (
"addlistener: invalid graphics object (= %g)",
11428 error (
"addlistener: invalid property name, expected a string value");
11431 error (
"addlistener: invalid handle");
11439 DEFUN (dellistener, args, ,
11440 "-*- texinfo -*-\n\
11441 @deftypefn {Built-in Function} {} dellistener (@var{h}, @var{prop}, @var{fcn})\n\
11442 Remove the registration of @var{fcn} as a listener for the property\n\
11443 @var{prop} of the graphics object @var{h}.\n\
11445 The function @var{fcn} must be the same variable (not just the same value),\n\
11446 as was passed to the original call to @code{addlistener}.\n\
11448 If @var{fcn} is not defined then all listener functions of @var{prop}\n\
11455 function my_listener (h, dummy, p1)\n\
11456 fprintf (\"my_listener called with p1=%s\\n\", p1);\n\
11459 c = @{@@my_listener, \"my string\"@};\n\
11460 addlistener (gcf, \"position\", c);\n\
11461 dellistener (gcf, \"position\", c);\n\
11471 if (args.length () == 3 || args.length () == 2)
11473 double h = args(0).double_value ();
11477 std::string pname = args(1).string_value ();
11487 if (args.length () == 2)
11492 if (args(2).is_string ()
11493 && args(2).string_value () ==
"persistent")
11505 error (
"dellistener: invalid graphics object (= %g)",
11509 error (
"dellistener: invalid property name, expected a string value");
11512 error (
"dellistener: invalid handle");
11520 DEFUN (addproperty, args, ,
11521 "-*- texinfo -*-\n\
11522 @deftypefn {Built-in Function} {} addproperty (@var{name}, @var{h}, @var{type})\n\
11523 @deftypefnx {Built-in Function} {} addproperty (@var{name}, @var{h}, @var{type}, @var{arg}, @dots{})\n\
11524 Create a new property named @var{name} in graphics object @var{h}.\n\
11526 @var{type} determines the type of the property to create. @var{args}\n\
11527 usually contains the default value of the property, but additional\n\
11528 arguments might be given, depending on the type of the property.\n\
11530 The supported property types are:\n\
11534 A string property. @var{arg} contains the default string value.\n\
11537 An @nospell{un-typed} property. This kind of property can hold any octave\n\
11538 value. @var{args} contains the default value.\n\
11541 A string property with a limited set of accepted values. The first\n\
11542 argument must be a string with all accepted values separated by\n\
11543 a vertical bar ('|'). The default value can be marked by enclosing\n\
11544 it with a '@{' '@}' pair. The default value may also be given as\n\
11545 an optional second string argument.\n\
11548 A boolean property. This property type is equivalent to a radio\n\
11549 property with \"on|off\" as accepted values. @var{arg} contains\n\
11550 the default property value.\n\
11553 A scalar double property. @var{arg} contains the default value.\n\
11556 A handle property. This kind of property holds the handle of a\n\
11557 graphics object. @var{arg} contains the default handle value.\n\
11558 When no default value is given, the property is initialized to\n\
11559 the empty matrix.\n\
11562 A data (matrix) property. @var{arg} contains the default data\n\
11563 value. When no default value is given, the data is initialized to\n\
11564 the empty matrix.\n\
11567 A color property. @var{arg} contains the default color value.\n\
11568 When no default color is given, the property is set to black.\n\
11569 An optional second string argument may be given to specify an\n\
11570 additional set of accepted string values (like a radio property).\n\
11573 @var{type} may also be the concatenation of a core object type and\n\
11574 a valid property name for that object type. The property created\n\
11575 then has the same characteristics as the referenced property (type,\n\
11576 possible values, hidden state@dots{}). This allows one to clone an\n\
11577 existing property into the graphics object @var{h}.\n\
11583 addproperty (\"my_property\", gcf, \"string\", \"a string value\");\n\
11584 addproperty (\"my_radio\", gcf, \"radio\", \"val_1|val_2|@{val_3@}\");\n\
11585 addproperty (\"my_style\", gcf, \"linelinestyle\", \"--\");\n\
11589 @seealso{addlistener, hggroup}\n\
11596 if (args.length () >= 3)
11602 double h = args(1).double_value ();
11612 std::string type = args(2).string_value ();
11619 args.splice (0, 3));
11625 error (
"addproperty: a '%s' property already exists in the graphics object",
11629 error (
"addproperty: invalid property TYPE, expected a string value");
11632 error (
"addproperty: invalid graphics object (= %g)", h);
11635 error (
"addproperty: invalid handle value");
11638 error (
"addproperty: invalid property NAME, expected a string value");
11648 const std::string& func)
11658 error (
"%s: invalid handle (= %g)", func.c_str (), handle);
11680 error (
"%s: invalid handle (= %g)", func.c_str (), handle);
11696 return result(0).bool_value ();
11706 waitfor_results.erase (
id);
11715 if (c.
numel () >= 4)
11717 double h = c(2).double_value ();
11760 uint32_t
id = args(2).uint32_scalar_value ().value ();
11766 double h = args(0).double_value ();
11784 waitfor_results[id] =
true;
11790 waitfor_results[id] =
true;
11802 uint32_t
id = args(2).uint32_scalar_value ().value ();
11805 waitfor_results[id] =
true;
11811 DEFUN (waitfor, args, ,
11812 "-*- texinfo -*-\n\
11813 @deftypefn {Built-in Function} {} waitfor (@var{h})\n\
11814 @deftypefnx {Built-in Function} {} waitfor (@var{h}, @var{prop})\n\
11815 @deftypefnx {Built-in Function} {} waitfor (@var{h}, @var{prop}, @var{value})\n\
11816 @deftypefnx {Built-in Function} {} waitfor (@dots{}, \"timeout\", @var{timeout})\n\
11817 Suspend the execution of the current program until a condition is\n\
11818 satisfied on the graphics handle @var{h}.\n\
11820 While the program is suspended graphics events are still processed normally,\n\
11821 allowing callbacks to modify the state of graphics objects. This function\n\
11822 is reentrant and can be called from a callback, while another @code{waitfor}\n\
11823 call is pending at the top-level.\n\
11825 In the first form, program execution is suspended until the graphics object\n\
11826 @var{h} is destroyed. If the graphics handle is invalid, the function\n\
11827 returns immediately.\n\
11829 In the second form, execution is suspended until the graphics object is\n\
11830 destroyed or the property named @var{prop} is modified. If the graphics\n\
11831 handle is invalid or the property does not exist, the function returns\n\
11834 In the third form, execution is suspended until the graphics object is\n\
11835 destroyed or the property named @var{prop} is set to @var{value}. The\n\
11836 function @code{isequal} is used to compare property values. If the graphics\n\
11837 handle is invalid, the property does not exist or the property is already\n\
11838 set to @var{value}, the function returns immediately.\n\
11840 An optional timeout can be specified using the property @code{timeout}.\n\
11841 This timeout value is the number of seconds to wait for the condition to be\n\
11842 true. @var{timeout} must be at least 1. If a smaller value is specified, a\n\
11843 warning is issued and a value of 1 is used instead. If the timeout value is\n\
11844 not an integer, it is truncated towards 0.\n\
11846 To define a condition on a property named @code{timeout}, use the string\n\
11847 @code{\\timeout} instead.\n\
11849 In all cases, typing CTRL-C stops program execution immediately.\n\
11850 @seealso{waitforbuttonpress, isequal}\n\
11853 if (args.length () > 0)
11855 double h = args(0).double_value ();
11863 static uint32_t id_counter = 0;
11866 int max_arg_index = 0;
11867 int timeout_index = -1;
11871 if (args.length () > 1)
11873 pname = args(1).string_value ();
11875 && ! pname.empty ()
11876 && ! pname.
compare (
"timeout"))
11878 if (pname.
compare (
"\\timeout"))
11886 "waitfor_listener"));
11889 if (args.length () > 2)
11891 if (args(2).is_string ())
11904 Cell listener (1, max_arg_index >= 2 ? 5 : 4);
11908 waitfor_results[id] =
false;
11910 listener(0) = wf_listener;
11913 listener(3) = pname;
11915 if (max_arg_index >= 2)
11916 listener(4) = args(2);
11928 if (max_arg_index >= 2
11931 waitfor_results[id] =
true;
11951 "waitfor_del_listener"));
11953 Cell del_listener (1, 4);
11955 del_listener(0) = wf_del_listener;
11957 del_listener(2) = h;
11958 del_listener(3) = pname;
11971 error (
"waitfor: invalid property name, expected a non-empty string value");
11975 && timeout_index < 0
11976 && args.length () > (max_arg_index + 1))
11978 caseless_str s = args(max_arg_index + 1).string_value ();
11983 timeout_index = max_arg_index + 1;
11985 error (
"waitfor: invalid parameter '%s'", s.c_str ());
11988 error (
"waitfor: invalid parameter, expected 'timeout'");
11993 if (args.length () > (timeout_index + 1))
11995 timeout =
static_cast<int>
11996 (args(timeout_index + 1).scalar_value ());
12002 warning (
"waitfor: the timeout value must be >= 1, using 1 instead");
12007 error (
"waitfor: invalid timeout value, expected a value >= 1");
12010 error (
"waitfor: missing timeout value");
12043 if (! pname.empty () && waitfor_results[id])
12058 if (start + timeout < time (0))
12064 error (
"waitfor: invalid handle value.");
12072 DEFUN (__zoom__, args, ,
12073 "-*- texinfo -*-\n\
12074 @deftypefn {Built-in Function} {} __zoom__ (@var{axes}, @var{mode}, @var{factor})\n\
12075 @deftypefnx {Built-in Function} {} __zoom__ (@var{axes}, \"out\")\n\
12076 @deftypefnx {Built-in Function} {} __zoom__ (@var{axes}, \"reset\")\n\
12077 Undocumented internal function.\n\
12082 int nargin = args.
length ();
12084 if (nargin != 2 && nargin != 3)
12090 double h = args(0).double_value ();
12099 if (! handle.
ok ())
12101 error (
"__zoom__: invalid handle");
12112 std::string opt = args(1).string_value ();
12117 if (opt ==
"out" || opt ==
"reset")
12131 std::string mode = args(1).string_value ();
12132 double factor = args(2).scalar_value ();
12137 ax_props.
zoom (mode, factor);
static Matrix default_axes_ticklength(void)
uint8NDArray uint8_array_value(void) const
enum double_radio_property::current_enum current_type
void do_register_toolkit(const std::string &name)
std::map< graphics_handle, graphics_object >::iterator iterator
octave_int< uint32_t > octave_uint32
static void pop_figure(const graphics_handle &h)
static graphics_event create_set_event(const graphics_handle &h, const std::string &name, const octave_value &value, bool notify_toolkit=true)
#define OCTAVE_SAFE_CALL(F, ARGS)
void warning_with_id(const char *id, const char *fmt,...)
string_vector keys(void) const
static bool has_core_property(const caseless_str &pname)
static void clear(octave_shlib &oct_file)
octave_value get_default(const caseless_str &name) const
static void convert_cdata_2(bool is_scaled, bool is_real, double clim_0, double clim_1, const double *cmapv, double x, octave_idx_type lda, octave_idx_type nc, octave_idx_type i, double *av)
plist_map_iterator find(const std::string &go_name)
double get_fontsize_points(double box_pix_height=0) const
const Cell & contents(const_iterator p) const
#define OCTAVE_DEFAULT_FONTNAME
bool is_empty(void) const
octave_value get_extent(void) const
graphics_handle get_parent(void) const
static Matrix default_screensize(void)
static std::set< double > updating_aspectratios
octave_value get_color_data(void) const
std::string get_busyaction(void) const
static Matrix default_axes_tick(void)
void rotate3d(double x0, double x1, double y0, double y1, bool push_to_zoom_stack=true)
void delete_listener(const octave_value &v=octave_value(), listener_mode mode=POSTSET)
OCTINTERP_API octave_value_list F__diaryfile__(const octave_value_list &=octave_value_list(), int=0)
virtual void reparent(const graphics_handle &np)
void update_axis_limits(const std::string &axis_type)
OCTINTERP_API octave_value_list Fecho(const octave_value_list &=octave_value_list(), int=0)
static double default_screenpixelsperinch(void)
static caseless_str validate_property_name(const std::string &who, const std::string &what, const std::set< std::string > &pnames, const caseless_str &pname)
static octave_map cat(int dim, octave_idx_type n, const octave_scalar_map *map_list)
static Matrix default_axes_outerposition(void)
std::string values_as_string(void) const
static Matrix default_axes_view(void)
bool is_real_type(void) const
static Matrix papersize_from_type(const caseless_str punits, const caseless_str typ)
void set_fontunits(const octave_value &val)
virtual bool do_set(const octave_value &)
octave_idx_type nelem(void) const
std::map< graphics_handle, graphics_object > handle_map
OCTINTERP_API bool is_equal(const octave_value &v) const
enum color_property::current_enum current_type
graphics_handle do_get_handle(bool integer_figure_handle)
void reset_default_properties(void)
static bool executing_callback
bool is_visible(void) const
void override_defaults(base_graphics_object &obj)
void(* event_fcn)(void *)
void update_text_extent(void)
virtual property get_property(const caseless_str &pname)
void convert_cdata_1(bool is_scaled, bool is_real, double clim_0, double clim_1, const double *cmapv, const T *cv, octave_idx_type lda, octave_idx_type nc, double *av)
static Matrix default_control_sliderstep(void)
octave_value reshape(const dim_vector &dv) const
octave_idx_type rows(void) const
static property_list::pval_map_type factory_defaults(void)
void do_renumber_figure(const graphics_handle &old_gh, const graphics_handle &new_gh)
static void register_toolkit(const std::string &name)
Matrix get_data_position(void) const
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
graphics_handle gca(void)
void erase(const std::string pname)
static octave_value convert_cdata(const base_properties &props, const octave_value &cdata, bool is_scaled, int cdim)
static Matrix default_figure_paperposition(void)
graphics_handle get_xlabel(void) const
void update_xlabel_position(void)
void set_horizontalalignmentmode(const octave_value &val)
static Matrix do_translate(double x0, double x1, const Matrix &lims, bool is_logscale)
int8NDArray int8_array_value(void) const
static Matrix default_patch_xdata(void)
static Cell available_toolkits_list(void)
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
void insert_property(const std::string &name, property p)
static property_list::pval_map_type factory_defaults(void)
void update_limits(void) const
void do_execute_listener(const graphics_handle &h, const octave_value &l)
bool isa(const std::string &go_name) const
void update_axes_layout(void)
static Matrix default_data(void)
virtual void init_integerhandle(const octave_value &)
bool is_uint16_type(void) const
graphics_handle get_zlabel(void) const
void set_rotationmode(const octave_value &val)
OCTINTERP_API void print_usage(void)
std::set< caseless_str > possible_vals
std::set< std::string >::const_iterator const_available_toolkits_iterator
bool is_function(void) const
octave_idx_type numel(void) const
Number of elements in the array.
OCTINTERP_API octave_value box(JNIEnv *jni_env, jobject jobj, jclass jcls=0)
static Matrix default_patch_ydata(void)
void update_fontunits(void)
int16NDArray int16_array_value(void) const
void request_autopos(void)
virtual void defaults(void) const
octave_idx_type length(void) const
OCTINTERP_API bool do_set(const octave_value &v)
static bool is_octave_thread(void)
std::string value_as_string(const std::string &prop)
void set_linestyleorder(const octave_value &val)
void set_verticalalignmentmode(const octave_value &val)
OCTAVE_EXPORT octave_value_list Fdrawnow(const octave_value_list &args, int)
bool is_scalar_type(void) const
OCTINTERP_API octave_value_list Fformat(const octave_value_list &=octave_value_list(), int=0)
std::string default_value(void) const
bool is_numeric_type(void) const
bool is_climinclude(void) const
bool is_defined(void) const
#define CHECK_ARRAY_EQUAL(T, F, A)
static bool updating_zlabel_position
static bool updating_axes_layout
RowVector xform2cam(const ColumnVector &v)
void execute_deletefcn(const octave_value &data=octave_value()) const
static bool has_core_property(const caseless_str &pname)
virtual void remove_all_listeners(void)
static void cleanup_waitfor_postset_listener(const octave_value &listener)
std::ostream & list_in_columns(std::ostream &, int width=0, const std::string &prefix=std::string()) const
Matrix xform_matrix(void)
void do_post_event(const graphics_event &e)
octave_value get_dynamic(const caseless_str &pname) const
void sync_positions(void)
std::set< std::string > type_constraints
void set_parent(const graphics_handle &h)
const_iterator find(const std::string pname) const
bool isa(const std::string &go_name) const
octave_value get_extent(void) const
Matrix extract_n(octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const
virtual void add_listener(const caseless_str &, const octave_value &, listener_mode=POSTSET)
static double y_dpi(void)
uint64NDArray uint64_array_value(void) const
Complex xmax(const Complex &x, const Complex &y)
static void push_figure(const graphics_handle &h)
virtual octave_value get_xlim(void) const
OCTINTERP_API void run_listeners(listener_mode mode=POSTSET)
octave_value get_property_from_handle(double handle, const std::string &property, const std::string &func)
bool positionmode_is(const std::string &v) const
virtual octave_value get_alim(void) const
Matrix get_axis_limits(double xmin, double xmax, double min_pos, double max_neg, bool logscale)
static bool has_core_property(const caseless_str &pname)
void do_post_function(graphics_event::event_fcn fcn, void *fcn_data)
void set_units(const octave_value &val)
graphics_toolkit get_toolkit(void) const
virtual std::string graphics_object_name(void) const
pval_map_type::const_iterator pval_map_const_iterator
static void execute_listener(const graphics_handle &h, const octave_value &l)
Matrix get_extent(bool with_text=false, bool only_text_height=false) const
#define DEFUN(name, args_name, nargout_name, doc)
set_event(const graphics_handle &h, const std::string &name, const octave_value &value, bool do_notify_toolkit=true)
void error(const char *fmt,...)
void set_dynamic(const caseless_str &pname, const octave_value &val)
void do_free(const graphics_handle &h)
static void add_event_hook(event_hook_fcn f)
int32NDArray int32_array_value(void) const
void set_fontunits(const octave_value &val)
void zoom(const std::string &mode, double factor, bool push_to_zoom_stack=true)
callback_event(const graphics_handle &h, const std::string &name, const octave_value &data=Matrix())
base_graphics_event * rep
property get_property_dynamic(const caseless_str &pname)
void set(const caseless_str &name, const octave_value &val)
bool is_int8_type(void) const
octave_value_list feval(const std::string &name, const octave_value_list &args, int nargout)
std::list< dim_vector > size_constraints
static void force_close_figure(const graphics_handle &handle)
static Matrix default_axes_position(void)
virtual void update_axis_limits(const std::string &axis_type)
virtual Matrix get_boundingbox(bool=false, const Matrix &=Matrix()) const
static string_vector names(const map_type &lst)
pval_map_type::iterator pval_map_iterator
virtual void initialize(const graphics_object &go)
static Matrix figure_handle_list(bool show_hidden=false)
void adopt(const graphics_handle &h)
OCTINTERP_API bool str2rgb(const std::string &str)
bool contains(const std::string &val, std::string &match)
void setfield(const std::string &key, const octave_value &val)
static void xset_gcbo(const graphics_handle &h)
std::set< graphics_handle >::iterator free_list_iterator
static void restore_gcbo(void)
void translate_view(const std::string &mode, double x0, double x1, double y0, double y1, bool push_to_zoom_stack=true)
static void run_event_hooks(void)
static double make_handle_fraction(void)
bool verticalalignmentmode_is(const std::string &v) const
static std::set< double > updating_axis_limits
Complex xmin(const Complex &x, const Complex &y)
void do_restore_gcbo(void)
double calc_tick_sep(double minval, double maxval)
void set_position(const octave_value &val)
static graphics_handle make_graphics_handle(const std::string &go_name, const graphics_handle &parent, bool integer_figure_handle=false, bool do_createfcn=true, bool do_notify_toolkit=true)
T & elem(octave_idx_type n)
static property_list::pval_map_type factory_defaults(void)
void update_ticklength(void)
octave_value_list eval_string(const std::string &eval_str, bool silent, int &parse_status, int nargout)
bool rotationmode_is(const std::string &v) const
octave_idx_type numel(void) const
OCTINTERP_API octave_value_list Fmax_recursion_depth(const octave_value_list &=octave_value_list(), int=0)
const octave_base_value const Array< octave_idx_type > &ra_idx octave_int16_scalar & v1
bool is_int32_type(void) const
function_event(graphics_event::event_fcn fcn, void *data=0)
OCTINTERP_API octave_value_list F__formatstring__(const octave_value_list &=octave_value_list(), int=0)
static bool is_handle_visible(const graphics_handle &h)
bool has_dynamic_property(const std::string &pname)
friend class graphics_object
virtual void delete_children(bool clear=false)
static void cleanup_waitfor_predelete_listener(const octave_value &listener)
static std::string get_graphics_object_type(double val)
void set_rotation(const octave_value &val)
void update_axis_limits(const std::string &axis_type)
static void max_axes_scale(double &s, Matrix &limits, const Matrix &kids, double pbfactor, double dafactor, char limit_type, bool tight)
std::string get_units(void) const
static Matrix default_surface_xdata(void)
static octave_value make_graphics_object(const std::string &go_name, bool integer_figure_handle, const octave_value_list &args)
static std::string default_toolkit(void)
Cell getfield(const std::string &key) const
static double default_screendepth(void)
void delete_property_listener(const std::string &nm, const octave_value &v, listener_mode mode=POSTSET)
graphics_handle do_make_figure_handle(double val, bool do_notify_toolkit)
void set_xlabel(const octave_value &val)
void delete_text_child(handle_property &h)
graphics_handle current_val
const_iterator end(void) const
virtual graphics_handle get_parent(void) const
virtual void set(const caseless_str &pname, const octave_value &pval)
void renumber_child(graphics_handle old_gh, graphics_handle new_gh)
static Matrix default_lim(bool logscale=false)
void update_axis_limits(const std::string &axis_type)
bool is_function_handle(void) const
octave_idx_type rows(void) const
property_list get_factory_defaults_list(void) const
octave_value get(bool all=false) const
F77_RET_T const double const double double * d
void build_user_defaults_map(property_list::pval_map_type &def, const std::string go_name) const
void calc_ticklabels(const array_property &ticks, any_property &labels, bool is_logscale)
string_vector all_strings(bool pad=false) const
OCTINTERP_API bool do_set(const octave_value &newval)
Matrix compute_xlim(void) const
graphics_xform get_transform(void) const
RowVector transpose(void) const
bool has_readonly_property(const caseless_str &pname) const
virtual void update_boundingbox(void)
void update_normals(void)
static void delete_graphics_object(const graphics_handle &h)
bool is_handle_visible(void) const
#define CONVERT_CDATA_1(ARRAY_T, VAL_FN, IS_REAL)
void do_post_callback(const graphics_handle &h, const std::string &name, const octave_value &data)
octave_value get(void) const
virtual void adopt(const graphics_handle &h)
Cell cell_value(void) const
int64NDArray int64_array_value(void) const
static void check_limit_vals(double &min_val, double &max_val, double &min_pos, double &max_neg, const octave_value &data)
void update_fontunits(const caseless_str &old_units)
Array< T > as_column(void) const
Return the array as a column vector.
virtual octave_value get(bool all=false) const
graphics_handle gcf(void)
virtual void finalize(const graphics_object &go)
void update_units(const caseless_str &old_units)
OCTINTERP_API octave_value_list F__compactformat__(const octave_value_list &=octave_value_list(), int=0)
void pan(const std::string &mode, double factor, bool push_to_zoom_stack=true)
bool is_aliminclude(void) const
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
void set_defaults(const std::string &mode)
void update_aspectratios(void)
static void cleanup_waitfor_id(uint32_t id)
static void initialize_r(const graphics_handle &h)
void execute_createfcn(const octave_value &data=octave_value()) const
static void free(const graphics_handle &h)
callback_event(const graphics_handle &h, const octave_value &cb, const octave_value &data=Matrix())
virtual octave_value get_default(const caseless_str &) const
ColumnVector row_max(void) const
static bool updating_xlabel_position
Matrix xform_translate(double x, double y, double z)
void set_zlabel(const octave_value &val)
void initialize(const graphics_object &go)
octave_idx_type columns(void) const
OCTINTERP_API octave_value_list Flasterr(const octave_value_list &=octave_value_list(), int=0)
static bool has_core_property(const caseless_str &pname)
static bool has_core_property(const caseless_str &pname)
static bool has_core_property(const caseless_str &pname)
void do_pop_figure(const graphics_handle &h)
virtual octave_value get_clim(void) const
static bool updating_ylabel_position
static bool updating_patch_data
octave_fields::const_iterator const_iterator
void update_text_extent(void)
F77_RET_T const double const double * f
void do_enable_event_processing(bool enable=true)
void add_fcn(void(*fcn)(void))
static Matrix default_patch_vertices(void)
bool set_property_in_handle(double handle, const std::string &property, const octave_value &arg, const std::string &func)
std::list< double >::iterator children_list_iterator
std::list< graphics_handle >::iterator figure_list_iterator
const_iterator begin(void) const
virtual void update(const graphics_object &go, int id)
void set_style(const octave_value &val)
graphics_handle get_parent(void) const
virtual octave_value get_zlim(void) const
std::set< std::string > dynamic_property_names(void) const
Matrix get_children(void) const
bool isfield(const std::string &name) const
void update_title_position(void)
static bool is_figure(double val)
octave_idx_type nfields(void) const
graphics_toolkit do_get_toolkit(void) const
octave_idx_type numel(const octave_value_list &idx)
bool is_bool_type(void) const
bool is_real_scalar(void) const
ColumnVector cam2xform(const Array< double > &m)
bool is_beingdeleted(void) const
std::string string_value(bool force=false) const
plist_map_iterator end(void)
double force_in_range(double x, double lower, double upper)
static char default_im_data[]
static void gripe_set_invalid(const std::string &pname)
virtual void delete_listener(const caseless_str &, const octave_value &, listener_mode=POSTSET)
ColumnVector xform_vector(void)
octave_value get_factory_default(const caseless_str &name) const
virtual void adopt(const graphics_handle &h)
bool set(const octave_value &val, bool do_run=true, bool do_notify_toolkit=true)
static Matrix default_control_position(void)
bool is_matrix_type(void) const
Matrix get_extent_matrix(void) const
void do_delete_children(bool clear)
std::complex< T > ceil(const std::complex< T > &x)
octave_value callback_data
bool is_string(void) const
virtual void update_autopos(const std::string &elem_type)
static bool is_handle(const graphics_handle &h)
bool is_double_type(void) const
static octave_value_list waitfor_listener(const octave_value_list &args, int)
octave_value get_default(const caseless_str &name) const
Matrix xform_scale(double x, double y, double z)
void rotate_view(double delta_az, double delta_el, bool push_to_zoom_stack=true)
ColumnVector extract_n(octave_idx_type r1, octave_idx_type n) const
const T * data(void) const
static Matrix default_figure_position(void)
Matrix compute_ylim(void) const
double norm(const ColumnVector &v)
void set_yticklabel(const octave_value &val)
string_vector & append(const std::string &s)
void set_zticklabel(const octave_value &val)
static bool updating_hggroup_limits
bool is_complex_type(void) const
virtual octave_value get_factory_default(const caseless_str &) const
void resize(const dim_vector &dv, const T &rfv)
Matrix do_get_children(bool return_hidden) const
static base_graphics_object * make_graphics_object_from_type(const caseless_str &type, const graphics_handle &h=graphics_handle(), const graphics_handle &p=graphics_handle())
octave_value get_clim(void) const
Cell values_as_cell(void) const
octave_int< T > pow(const octave_int< T > &a, const octave_int< T > &b)
std::list< double > children_list
double get_fontsize_points(double box_pix_height=0) const
bool is_yliminclude(void) const
octave_value get_alim(void) const
const_iterator end(void) const
bool is_int64_type(void) const
bool is_cellstr(void) const
octave_value_list splice(octave_idx_type offset, octave_idx_type len, const octave_value_list &lst=octave_value_list()) const
static Matrix default_panel_position(void)
void set_font(const std::string &name, const std::string &weight, const std::string &angle, double size)
void set_defaults(base_graphics_object &obj, const std::string &mode)
Matrix transpose(void) const
virtual base_properties & get_properties(void)
std::map< std::string, graphics_toolkit >::const_iterator const_loaded_toolkits_iterator
static bool has_core_property(const caseless_str &pname)
static octave_value convert_linestyleorder_string(const octave_value &val)
static Matrix default_figure_papersize(void)
base_properties & get_properties(void)
virtual void remove_child(const graphics_handle &h)
static void get_array_limits(const Array< T > &m, double &emin, double &emax, double &eminp, double &emaxp)
static bool lookup_object_name(const caseless_str &name, caseless_str &go_name, caseless_str &rest)
static void xset(const graphics_handle &h, const caseless_str &name, const octave_value &val)
void reset_default_properties(void)
virtual text_element * parse(const std::string &s)=0
octave_idx_type length(void) const
static Matrix handle_list(bool show_hidden=false)
void zoom_about_point(const std::string &mode, double x, double y, double factor, bool push_to_zoom_stack=true)
void renumber_parent(graphics_handle new_gh)
void do_unregister_toolkit(const std::string &name)
OCTAVE_API double D_NINT(double x)
octave_value lookup(const caseless_str &name) const
static Matrix default_surface_ydata(void)
static graphics_event create_function_event(event_fcn fcn, void *data=0)
static Matrix convert_text_position(const Matrix &pos, const text::properties &props, const caseless_str &from_units, const caseless_str &to_units)
OCTINTERP_API octave_value_list F__diarystate__(const octave_value_list &=octave_value_list(), int=0)
ColumnVector cross(const ColumnVector &v1, const ColumnVector &v2)
graphics_object get_ancestor(const std::string &type) const
const_iterator begin(void) const
octave_value get_zlim(void) const
static dim_vector alloc(int n)
static Matrix default_colororder(void)
void update_fontunits(const caseless_str &old_units)
void override_defaults(base_graphics_object &obj)
dim_vector dims(void) const
double get_fontsize_points(double box_pix_height=0) const
octave_value property_value
Matrix matrix_value(bool frc_str_conv=false) const
int calc_dimensions(const graphics_object &go)
void set(const caseless_str &name, const octave_value &val)
void update_zlabel_position(void)
static graphics_event create_callback_event(const graphics_handle &h, const std::string &name, const octave_value &data=Matrix())
OCTINTERP_API void execute(const octave_value &data=octave_value()) const
virtual void reset_default_properties(void)
static void execute_callback(const graphics_handle &h, const std::string &name, const octave_value &data=Matrix())
std::list< double >::const_iterator const_children_list_iterator
static void cleanup_instance(void)
static void remove_event_hook(event_hook_fcn f)
void remove_child(const graphics_handle &h)
static gh_manager * instance
graphics_handle do_make_graphics_handle(const std::string &go_name, const graphics_handle &p, bool integer_figure_handle, bool do_createfcn, bool do_notify_toolkit)
static Matrix convert_position(const Matrix &pos, const caseless_str &from_units, const caseless_str &to_units, const Matrix &parent_dim)
std::set< std::string > available_toolkits
octave_value get_string(void) const
static octave_idx_type find(octave_idx_type i, octave_idx_type *pp)
octave_function * function_value(bool silent=false) const
T & xelem(octave_idx_type n)
virtual void set_defaults(const std::string &)
double get_fontsize_points(double box_pix_height=0) const
bool is_int16_type(void) const
static Matrix default_surface_cdata(void)
octave_value get_deletefcn(void) const
graphics_handle get_title(void) const
static void magform(double x, double &a, int &b)
void warning(const char *fmt,...)
void do_post_set(const graphics_handle &h, const std::string &name, const octave_value &value, bool notify_toolkit=true)
static std::map< caseless_str, graphics_object > dprop_obj_map
void update_ylabel_position(void)
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
void set_xticklabel(const octave_value &val)
std::string type(void) const
static std::string dir_sep_chars(void)
bool valid_object(void) const
Handles the reference counting for all the derived classes.
void get_children_limits(double &min_val, double &max_val, double &min_pos, double &max_neg, const Matrix &kids, char limit_type)
std::string type_name(void) const
std::string property_name
double get_rotation(void) const
OCTINTERP_API bool validate(const octave_value &v)
charNDArray max(char d, const charNDArray &m)
octave_idx_type length(void) const
Number of elements in the array.
static graphics_handle make_figure_handle(double val, bool do_notify_toolkit=true)
bool is_empty(void) const
bool is_bool_scalar(void) const
static void close_figure(const graphics_handle &handle)
const octave_char_matrix & v2
NDArray array_value(bool frc_str_conv=false) const
static property_list::pval_map_type factory_defaults(void)
void update_autopos(const std::string &elem_type)
octave_value_list ovl(const octave_value &a0)
static void cleanup_instance(void)
std::string values_as_string(void) const
void do_close_all_figures(void)
void do_push_figure(const graphics_handle &h)
static void do_cleanup_waitfor_listener(const octave_value &listener, listener_mode mode=POSTSET)
double dot(const ColumnVector &v1, const ColumnVector &v2)
virtual std::string value_as_string(const std::string &prop)
void set_title(const octave_value &val)
static octave_value xget(const graphics_handle &h, const caseless_str &name)
std::map< std::string, pval_map_type > plist_map_type
static octave_value convert_ticklabel_string(const octave_value &val)
void calc_ticks_and_lims(array_property &lims, array_property &ticks, array_property &mticks, bool limmode_is_auto, bool is_logscale)
void cross_product(double x1, double y1, double z1, double x2, double y2, double z2, double &x, double &y, double &z)
void set_fontunits(const octave_value &val)
static void xinitialize(const graphics_handle &h)
void remove_child(const graphics_handle &h)
bool is_uint8_type(void) const
void push_zoom_stack(void)
static Matrix default_image_cdata(void)
void assign(const std::string &k, const octave_value &val)
static property_list::pval_map_type factory_defaults(void)
static graphics_handle lookup(double val)
virtual graphics_toolkit get_toolkit(void) const
static OCTINTERP_API property create(const std::string &name, const graphics_handle &parent, const caseless_str &type, const octave_value_list &args)
bool is_interruptible(void) const
void set_fontunits(const octave_value &val)
octave_value get_xlim(void) const
octave_handle graphics_handle
void add_property_listener(const std::string &nm, const octave_value &v, listener_mode mode=POSTSET)
void normalize(ColumnVector &v)
OCTINTERP_API bool set(const octave_value &v, bool do_run=true, bool do_notify_toolkit=true)
octave_map values_as_struct(void)
octave_value get_ylim(void) const
int do_process_events(bool force=false)
static bool compare_property_values(const octave_value &o1, const octave_value &o2)
static void adopt(const graphics_handle &p, const graphics_handle &h)
void set_value_or_default(const caseless_str &name, const octave_value &val)
static OCTINTERP_API void create_instance(void)
OCTINTERP_API octave_value_list F__echostate__(const octave_value_list &=octave_value_list(), int=0)
virtual octave_value get_ylim(void) const
virtual void mark_modified(void)
static graphics_handle get_handle(bool integer_figure_handle)
Matrix get_all_children(void) const
std::string callback_name
void set_units(const octave_value &val)
bool compare(const std::string &s, size_t limit=std::string::npos) const
bool is_modified(void) const
static void normalized_aspectratios(Matrix &aspectratios, const Matrix &scalefactors, double xlength, double ylength, double zlength)
std::string class_name(void) const
Matrix get_extent(text_element *elt, double rotation=0.0)
static void renumber_figure(const graphics_handle &old_gh, const graphics_handle &new_gh)
OCTINTERP_API octave_value_list Fdiary(const octave_value_list &=octave_value_list(), int=0)
static property_list::pval_map_type factory_defaults(void)
void scale(Matrix &m, double x, double y, double z)
void set_horizontalalignment(const octave_value &val)
void clear_zoom_stack(bool do_unzoom=true)
bool any_element_is_inf_or_nan(void) const
void set_verticalalignment(const octave_value &val)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
ColumnVector row_min(void) const
static graphics_object get_object(double val)
bool is_undefined(void) const
bool is_uint64_type(void) const
std::string values_as_string(void)
ColumnVector transform(const Matrix &m, double x, double y, double z)
static void xreset_default_properties(graphics_handle gh, property_list::pval_map_type factory_pval)
void do_execute_callback(const graphics_handle &h, const octave_value &cb, const octave_value &data)
virtual void update_axis_limits(const std::string &axis_type) const
void set_text_child(handle_property &h, const std::string &who, const octave_value &v)
static bool match(const std::string &filename_arg, const std::string &path_elt_arg)
octave_value getfield(const std::string &key) const
void set_beingdeleted(const octave_value &val)
octave_value get_color_data(void) const
static Matrix do_zoom(double val, double factor, const Matrix &lims, bool is_logscale)
void set_ylabel(const octave_value &val)
void reparent(const graphics_handle &h)
std::list< graphics_object > callback_objects
virtual void update_uicontextmenu(void) const
std::complex< T > floor(const std::complex< T > &x)
property clone(void) const
graphics_handle get_handle(void) const
static property_list::pval_map_type factory_defaults(void)
std::map< std::string, graphics_toolkit > loaded_toolkits
static property_list::pval_map_type factory_defaults(void)
static Cell loaded_toolkits_list(void)
static std::map< uint32_t, bool > waitfor_results
octave_value get_color_data(void) const
std::list< graphics_handle > figure_list
graphics_handle get___myhandle__(void) const
void set_modified(const octave_value &val)
OCTINTERP_API radio_values(const std::string &opt_string=std::string())
const T * fortran_vec(void) const
static OCTINTERP_API gtk_manager * instance
octave_fields::const_iterator const_iterator
bool is_single_type(void) const
MArray< T > reshape(const dim_vector &new_dims) const
Matrix calc_tightbox(const Matrix &init_pos)
octave_scalar_map as_struct(const std::string &prefix_arg) const
static double convert_font_size(double font_size, const caseless_str &from_units, const caseless_str &to_units, double parent_height=0)
void set_positionmode(const octave_value &val)
double double_value(bool frc_str_conv=false) const
static Matrix screen_size_pixels(void)
static octave_value_list waitfor_del_listener(const octave_value_list &args, int)
graphics_handle get_handle(void) const
bool is_uint32_type(void) const
virtual octave_scalar_map values_as_struct(void)
void octave_usleep(unsigned int useconds)
std::string get_name(void) const
OCTINTERP_API bool validate(const octave_value &v) const
bool discard_error_messages
virtual bool has_property(const caseless_str &) const
std::string join(const std::string &sep=std::string()) const
static bool has_core_property(const caseless_str &pname)
octave_value as_octave_value(void) const
Matrix get_ticklabel_extents(const Matrix &ticks, const string_vector &ticklabels, const Matrix &limits)
uint32NDArray uint32_array_value(void) const
bool is_zliminclude(void) const
void build_user_defaults_map(property_list::pval_map_type &def, const std::string go_name) const
static bool updating_title_position
virtual std::string values_as_string(void)
static property_list::pval_map_type factory_defaults(void)
static Matrix default_surface_zdata(void)
Complex atan(const Complex &x)
uint16NDArray uint16_array_value(void) const
static void xcreatefcn(const graphics_handle &h)
octave_idx_type columns(void) const
static bool is_handle_visible(const graphics_handle &h)
static bool has_core_property(const caseless_str &pname)
void update_fontunits(void)
bool is_xliminclude(void) const
plist_map_type::const_iterator plist_map_const_iterator
void set_parent(const octave_value &val)
void xform(ColumnVector &v, const Matrix &m)
static graphics_handle current_figure(void)
static void finalize_r(const graphics_handle &h)
void set_from_list(base_graphics_object &obj, property_list &defaults)
void translate(Matrix &m, double x, double y, double z)
graphics_handle get_ylabel(void) const
static double x_dpi(void)
graphics_handle handle_value(void) const
static ColumnVector convert_label_position(const ColumnVector &p, const text::properties &props, const graphics_xform &xform, const Matrix &bbox)
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
Matrix inverse(void) const
static void delete_graphics_objects(const NDArray vals)
bool horizontalalignmentmode_is(const std::string &v) const
F77_RET_T const double * x
charNDArray min(char d, const charNDArray &m)
static Matrix default_patch_faces(void)
static void create_instance(void)
void resize(octave_idx_type n, const double &rfv=0)
OCTINTERP_API bool do_set(const octave_value &v)
OCTINTERP_API void get_data_limits(void)
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
void F(const TSRC *v, TRES *r, octave_idx_type m, octave_idx_type n)
static int process_events(void)
static Matrix jet_colormap(void)
bool is_integer_type(void) const