26 #if defined (HAVE_CONFIG_H)
50 #include "builtin-defun-decls.h"
73 OCTAVE_NORETURN
static
77 error (
"set: invalid value for %s property", pname.c_str ());
86 const std::set<std::string>& pnames,
89 size_t len = pname.length ();
90 std::set<std::string> matches;
93 for (
const auto& propnm : pnames)
97 if (
len == propnm.length ())
100 matches.insert (propnm);
104 size_t num_matches = matches.size ();
106 if (num_matches == 0)
107 error (
"%s: unknown %s property %s",
108 who.c_str (), what.c_str (), pname.c_str ());
109 else if (num_matches > 1)
113 std::ostringstream os;
117 std::string match_list = os.str ();
119 error (
"%s: ambiguous %s property name %s; possible matches:\n\n%s",
120 who.c_str (), what.c_str (), pname.c_str (), match_list.c_str ());
125 std::string possible_match = *(matches.begin ());
128 "%s: allowing %s to match %s property %s",
129 who.c_str (), pname.c_str (), what.c_str (),
130 possible_match.c_str ());
132 return possible_match;
147 const double cmapv[] =
149 2.67004010000000e-01, 2.72651720952381e-01, 2.77106307619048e-01,
150 2.80356151428571e-01, 2.82390045238095e-01, 2.83204606666667e-01,
151 2.82809341428571e-01, 2.81230763333333e-01, 2.78516153333333e-01,
152 2.74735528571429e-01, 2.69981791904762e-01, 2.64368580952381e-01,
153 2.58026184285714e-01, 2.51098684761905e-01, 2.43732853333333e-01,
154 2.36073294285714e-01, 2.28263191428571e-01, 2.20424955714286e-01,
155 2.12666598571429e-01, 2.05079113809524e-01, 1.97721880952381e-01,
156 1.90631350000000e-01, 1.83819438571429e-01, 1.77272360952381e-01,
157 1.70957518571429e-01, 1.64832915714286e-01, 1.58845368095238e-01,
158 1.52951235714286e-01, 1.47131626666667e-01, 1.41402210952381e-01,
159 1.35832975714286e-01, 1.30582113809524e-01, 1.25898377619048e-01,
160 1.22163105714286e-01, 1.19872409523810e-01, 1.19626570000000e-01,
161 1.22045948571429e-01, 1.27667691904762e-01, 1.36834947142857e-01,
162 1.49643331428571e-01, 1.65967274285714e-01, 1.85538397142857e-01,
163 2.08030450000000e-01, 2.33127309523809e-01, 2.60531475238095e-01,
164 2.90000730000000e-01, 3.21329971428571e-01, 3.54355250000000e-01,
165 3.88930322857143e-01, 4.24933143333333e-01, 4.62246770476190e-01,
166 5.00753620000000e-01, 5.40336957142857e-01, 5.80861172380952e-01,
167 6.22170772857143e-01, 6.64087320476191e-01, 7.06403823333333e-01,
168 7.48885251428571e-01, 7.91273132857143e-01, 8.33302102380952e-01,
169 8.74717527142857e-01, 9.15296319047619e-01, 9.54839555238095e-01,
170 9.93247890000000e-01, 4.87433000000000e-03, 2.58456800000000e-02,
171 5.09139004761905e-02, 7.42014957142857e-02, 9.59536042857143e-02,
172 1.16893314761905e-01, 1.37350195714286e-01, 1.57479940000000e-01,
173 1.77347967619048e-01, 1.96969168571429e-01, 2.16330337619048e-01,
174 2.35404660952381e-01, 2.54161735714286e-01, 2.72573219047619e-01,
175 2.90619516666667e-01, 3.08291041428571e-01, 3.25586450952381e-01,
176 3.42517215238095e-01, 3.59102207142857e-01, 3.75366067142857e-01,
177 3.91340913333333e-01, 4.07061480000000e-01, 4.22563764285714e-01,
178 4.37885543809524e-01, 4.53062984285714e-01, 4.68129543809524e-01,
179 4.83117059523810e-01, 4.98052961428571e-01, 5.12959473333333e-01,
180 5.27854311428571e-01, 5.42750087142857e-01, 5.57652481904762e-01,
181 5.72563073333333e-01, 5.87476284285714e-01, 6.02382410952381e-01,
182 6.17265840000000e-01, 6.32106955714286e-01, 6.46881817142857e-01,
183 6.61562926190476e-01, 6.76119717142857e-01, 6.90518987142857e-01,
184 7.04725181904762e-01, 7.18700950000000e-01, 7.32406441904762e-01,
185 7.45802021904762e-01, 7.58846480000000e-01, 7.71497934761905e-01,
186 7.83714033809524e-01, 7.95453081428571e-01, 8.06673890000000e-01,
187 8.17337565714286e-01, 8.27409135714286e-01, 8.36858167619048e-01,
188 8.45663399523809e-01, 8.53815582857143e-01, 8.61321019047619e-01,
189 8.68206316666667e-01, 8.74522215714286e-01, 8.80346158571429e-01,
190 8.85780083333333e-01, 8.90945338571429e-01, 8.95973498571429e-01,
191 9.01005800000000e-01, 9.06156570000000e-01, 3.29415190000000e-01,
192 3.53367293333333e-01, 3.76236064761905e-01, 3.97901482857143e-01,
193 4.18250757142857e-01, 4.37178920000000e-01, 4.54595888571429e-01,
194 4.70433883333333e-01, 4.84653865714286e-01, 4.97250492857143e-01,
195 5.08254501428571e-01, 5.17731949047619e-01, 5.25780221428571e-01,
196 5.32522206190476e-01, 5.38097133333333e-01, 5.42651800000000e-01,
197 5.46335411904762e-01, 5.49287148571429e-01, 5.51635008571429e-01,
198 5.53493173333333e-01, 5.54953478571429e-01, 5.56089070000000e-01,
199 5.56952166666667e-01, 5.57576145714286e-01, 5.57974025714286e-01,
200 5.58142745238095e-01, 5.58058673809524e-01, 5.57684744285714e-01,
201 5.56973310000000e-01, 5.55864478571429e-01, 5.54288677142857e-01,
202 5.52175699047619e-01, 5.49445382857143e-01, 5.46023368571429e-01,
203 5.41830633809524e-01, 5.36795616666667e-01, 5.30847985714286e-01,
204 5.23924198571429e-01, 5.15966779523810e-01, 5.06924262857143e-01,
205 4.96751861428571e-01, 4.85412122857143e-01, 4.72873300000000e-01,
206 4.59105875238095e-01, 4.44095883333333e-01, 4.27825852857143e-01,
207 4.10292713809524e-01, 3.91487632857143e-01, 3.71420688571429e-01,
208 3.50098750000000e-01, 3.27544678571429e-01, 3.03798967142857e-01,
209 2.78916748571429e-01, 2.53000856190476e-01, 2.26223670000000e-01,
210 1.98879439523810e-01, 1.71494930000000e-01, 1.45037631428572e-01,
211 1.21291048571429e-01, 1.03326155238095e-01, 9.53507900000000e-02,
212 1.00469958095238e-01, 1.17876387142857e-01, 1.43936200000000e-01
218 std::copy (cmapv, cmapv + (64*3), cmap.
fortran_vec ());
228 return dpy_info.
depth ();
253 return (dpy_info.
x_dpi () + dpy_info.
y_dpi ()) / 2;
340 for (
int col = 0; col < 64; col++)
341 for (
int row = 0; row < 64; row++)
355 for (
int col = 0; col < 3; col++)
356 for (
int row = 0; row < 3; row++)
367 for (
int row = 0; row < 3; row++)
368 for (
int col = 0; col < 3; col++)
379 for (
int row = 0; row < 3; row++)
528 m(0) = 1.3421852580027660;
529 m(1) = 3.3191389435020748;
530 m(2) = 5.8156294839944680;
531 m(3) = 4.3617221129958503;
623 bool integer_figure_handle =
false,
624 bool call_createfcn =
true,
625 bool notify_toolkit =
true)
630 call_createfcn, notify_toolkit);
639 if (from_units.
compare (to_units))
645 double points_size = 0;
648 if (from_units.
compare (
"points"))
649 points_size = font_size;
654 if (from_units.
compare (
"pixels"))
655 points_size = font_size * 72.0 / res;
656 else if (from_units.
compare (
"inches"))
657 points_size = font_size * 72.0;
658 else if (from_units.
compare (
"centimeters"))
659 points_size = font_size * 72.0 / 2.54;
660 else if (from_units.
compare (
"normalized"))
661 points_size = font_size * parent_height * 72.0 / res;
664 double new_font_size = 0;
666 if (to_units.
compare (
"points"))
667 new_font_size = points_size;
673 if (to_units.
compare (
"pixels"))
674 new_font_size = points_size * res / 72.0;
675 else if (to_units.
compare (
"inches"))
676 new_font_size = points_size / 72.0;
677 else if (to_units.
compare (
"centimeters"))
678 new_font_size = points_size * 2.54 / 72.0;
679 else if (to_units.
compare (
"normalized"))
683 if (parent_height > 0)
684 new_font_size = points_size * res / (parent_height * 72.0);
688 return new_font_size;
697 bool is_rectangle = (pos.
numel () == 4);
698 bool is_2D = (pos.
numel () == 2);
700 if (from_units.
compare (
"pixels"))
702 else if (from_units.
compare (
"normalized"))
704 retval(0) = pos(0) * parent_dim(0) + 1;
705 retval(1) = pos(1) * parent_dim(1) + 1;
708 retval(2) = pos(2) * parent_dim(0);
709 retval(3) = pos(3) * parent_dim(1);
714 else if (from_units.
compare (
"characters"))
723 f = 12.0 * res / 74.951;
745 if (from_units.
compare (
"points"))
747 else if (from_units.
compare (
"inches"))
749 else if (from_units.
compare (
"centimeters"))
766 if (! to_units.
compare (
"pixels"))
768 if (to_units.
compare (
"normalized"))
774 retval(2) /= parent_dim(0);
775 retval(3) /= parent_dim(1);
780 else if (to_units.
compare (
"characters"))
787 f = 12.0 * res / 74.951;
809 if (to_units.
compare (
"points"))
811 else if (to_units.
compare (
"inches"))
813 else if (to_units.
compare (
"centimeters"))
830 else if (! is_rectangle && ! is_2D)
854 bool is_rectangle = (pos.
numel () == 4);
856 ax_size = ax_bbox.
extract_n (0, 2, 1, 2);
858 if (from_units.
compare (
"data"))
868 retval(0) = v1(0) - ax_bbox(0) + 1;
869 retval(1) = ax_bbox(1) + ax_bbox(3) - v1(1) + 1;
879 retval(0) = v(0) - ax_bbox(0) + 1;
880 retval(1) = ax_bbox(1) + ax_bbox(3) - v(1) + 1;
887 if (! to_units.
compare (
"pixels"))
895 ax_bbox(1) + ax_bbox(3) -
retval(1) + 1);
910 ax_bbox(1) + ax_bbox(3) -
retval(1) + 1);
982 av[i+lda] = cmapv[idx+nc];
983 av[i+2*lda] = cmapv[idx+2*nc];
987 template <
typename T>
995 clim_0, clim_1, cmapv, cv[i], lda, nc, i, av);
1000 bool is_scaled,
int cdim)
1005 if (dv.
ndims () == cdim && dv(cdim-1) == 3)
1039 const double *cmapv = cmap.
data ();
1041 double clim_0 = clim(0);
1042 double clim_1 = clim(1);
1052 #define CONVERT_CDATA_1(ARRAY_T, VAL_FN, IS_REAL) \
1055 ARRAY_T tmp = cdata. VAL_FN ## array_value (); \
1057 convert_cdata_1 (is_scaled, IS_REAL, clim_0, clim_1, cmapv, \
1058 tmp.data (), lda, nc, av); \
1087 warning (
"unsupported type for cdata (= %s). "
1088 "Valid types are int8, int16, int32, int64, uint8, uint16, "
1089 "uint32, uint64, double, single, and bool.",
1094 #undef CONVERT_CDATA_1
1099 template <
typename T>
1102 double& eminp,
double& emaxp)
1104 const T *data =
m.data ();
1109 double e = double (data[i]);
1120 if (e > 0 && e < eminp)
1123 if (e < 0 && e > emaxp)
1135 bool result =
false;
1146 pfx =
name.substr (0, 5);
1152 pfx =
name.substr (0, 6);
1158 pfx =
name.substr (0, 7);
1165 pfx =
name.substr (0, 9);
1172 pfx =
name.substr (0, 10);
1174 if (pfx.
compare (
"uipushtool"))
1178 pfx =
name.substr (0, 12);
1180 if (pfx.
compare (
"uitoggletool"))
1184 pfx =
name.substr (0, 13);
1186 if (pfx.
compare (
"uicontextmenu")
1187 || pfx.
compare (
"uibuttongroup"))
1200 rest =
name.substr (offset);
1215 if (
type.compare (
"figure"))
1217 else if (
type.compare (
"axes"))
1218 go =
new axes (h, p);
1219 else if (
type.compare (
"line"))
1220 go =
new line (h, p);
1221 else if (
type.compare (
"text"))
1222 go =
new text (h, p);
1223 else if (
type.compare (
"image"))
1224 go =
new image (h, p);
1225 else if (
type.compare (
"light"))
1226 go =
new light (h, p);
1227 else if (
type.compare (
"patch"))
1228 go =
new patch (h, p);
1229 else if (
type.compare (
"surface"))
1231 else if (
type.compare (
"hggroup"))
1233 else if (
type.compare (
"uimenu"))
1235 else if (
type.compare (
"uicontrol"))
1237 else if (
type.compare (
"uipanel"))
1239 else if (
type.compare (
"uibuttongroup"))
1241 else if (
type.compare (
"uicontextmenu"))
1243 else if (
type.compare (
"uitable"))
1245 else if (
type.compare (
"uitoolbar"))
1247 else if (
type.compare (
"uipushtool"))
1249 else if (
type.compare (
"uitoggletool"))
1262 if (
id >= 0 && do_notify_toolkit)
1290 for (
int i = 0; i < l.
length (); i++)
1295 : default_val (), possible_vals ()
1298 size_t len = opt_string.length ();
1299 bool done =
len == 0;
1303 size_t end = opt_string.find (
'|', beg);
1305 if (end == std::string::npos)
1311 std::string t = opt_string.substr (beg, end-beg);
1316 t = t.substr (1, t.length () - 2);
1338 retval =
'{' + val +
'}';
1345 retval +=
" | {" + val +
'}';
1364 retval(i++) = std::string (val);
1374 double tmp_rgb[3] = {0, 0, 0};
1376 std::string str = str_arg;
1377 unsigned int len = str.length ();
1379 std::transform (str.begin (), str.end (), str.begin (), tolower);
1381 if (str.compare (0,
len,
"blue", 0,
len) == 0)
1383 else if (str.compare (0,
len,
"black", 0,
len) == 0
1384 || str.compare (0,
len,
"k", 0,
len) == 0)
1385 tmp_rgb[0] = tmp_rgb[1] = tmp_rgb[2] = 0;
1386 else if (str.compare (0,
len,
"red", 0,
len) == 0)
1388 else if (str.compare (0,
len,
"green", 0,
len) == 0)
1390 else if (str.compare (0,
len,
"yellow", 0,
len) == 0)
1391 tmp_rgb[0] = tmp_rgb[1] = 1;
1392 else if (str.compare (0,
len,
"magenta", 0,
len) == 0)
1393 tmp_rgb[0] = tmp_rgb[2] = 1;
1394 else if (str.compare (0,
len,
"cyan", 0,
len) == 0)
1395 tmp_rgb[1] = tmp_rgb[2] = 1;
1396 else if (str.compare (0,
len,
"white", 0,
len) == 0
1397 || str.compare (0,
len,
"w", 0,
len) == 0)
1398 tmp_rgb[0] = tmp_rgb[1] = tmp_rgb[2] = 1;
1404 for (
int i = 0; i < 3; i++)
1405 xrgb(i) = tmp_rgb[i];
1419 error (R
"(invalid value for color property "%s")",
1428 if (s.length () != match.length ())
1430 "%s: allowing %s to match %s value %s",
1431 "set", s.c_str (),
get_name ().c_str (),
1451 catch (octave::execution_exception& e)
1453 error (e, R
"(invalid value for color property "%s" (value = %s))",
1462 if (
m.numel () != 3)
1463 error (R
"(invalid value for color property "%s")",
1476 error (R
"(invalid value for color property "%s")",
1491 error (R
"(invalid value for double_radio property "%s")",
1496 if (s.length () != match.length ())
1498 "%s: allowing %s to match %s value %s",
1499 "set", s.c_str (),
get_name ().c_str (),
1518 error (R
"(invalid value for double_radio property "%s")",
1547 int vlen = vdims.
ndims ();
1558 if (itdims.
ndims () == vlen)
1562 for (
int i = 0; xok && i < vlen; i++)
1566 if (itdims(i) != vdims(i))
1569 else if (itdims(i) == 0)
1588 error (R
"(set: "%s" must be greater than or equal to %g)",
1591 error (R
"(set: "%s" must be greater than %g)",
1599 error (R
"(set: "%s" must be less than or equal to %g)",
1602 error (R
"(set: "%s" must be less than %g)",
1611 error (R
"(set: "%s" must be finite)", get_name ().c_str ());
1617 error (R
"(set: "%s" must not be nan)", get_name ().c_str ());
1623 error (R
"(set: "%s" must not be infinite)", get_name ().c_str ());
1639 #define CHECK_ARRAY_EQUAL(T, F, A) \
1641 if (data.numel () == 1) \
1642 return data.F ## scalar_value () == \
1643 v.F ## scalar_value (); \
1649 const A m1 = data.F ## array_value (); \
1650 const T *d1 = m1.data (); \
1651 const A m2 = v.F ## array_value (); \
1652 const T *d2 = m2.data (); \
1656 for (int i = 0; flag && i < data.numel (); i++) \
1657 if (d1[i] != d2[i]) \
1736 if (!
get ().isempty ())
1745 double dv = v.
xdouble_value (R
"(set: invalid graphics handle for property "%s")",
1753 bool type_ok =
true;
1770 error (R
"(set: invalid graphics handle (= %g) for property "%s")",
1773 error (R
"(set: invalid graphics object type for property "%s")",
1818 if (! props.is_showhiddenhandles ())
1826 if (! return_hidden)
1829 else if (return_hidden)
1857 gh_mgr.
free (hchild, from_root);
1869 gh_mgr.
free (hchild, from_root);
1916 m_set.insert (
reinterpret_cast<intptr_t
> (ptr));
1921 m_set.erase (
reinterpret_cast<intptr_t
> (ptr));
1926 return m_set.find (
reinterpret_cast<intptr_t
> (ptr)) !=
m_set.end ();
1974 if (
type.compare (
"string"))
1976 std::string sv = (args.
length () > 0 ? args(0).string_value () :
"");
1980 else if (
type.compare (
"any"))
1987 else if (
type.compare (
"radio"))
1990 error (
"addproperty: missing possible values for radio property");
1992 std::string sv = args(0).xstring_value (
"addproperty: argument for radio property must be a string");
1999 else if (
type.compare (
"double"))
2001 double dv = (args.
length () > 0 ? args(0).double_value () : 0.0);
2005 else if (
type.compare (
"handle"))
2007 double hv = (args.
length () > 0 ? args(0).double_value ()
2014 else if (
type.compare (
"boolean"))
2021 else if (
type.compare (
"data"))
2032 else if (
type.compare (
"color"))
2042 if (args.
length () > 0 && ! args(0).isempty ())
2052 error (
"addproperty: unsupported type for dynamic property (= %s)",
2057 std::map<caseless_str, graphics_object>::const_iterator it
2075 error (
"addproperty: invalid object type (= %s)",
2103 for (
int k = 0; k < children.
numel (); k++)
2123 for (
int k = 0; k < children.
numel (); k++)
2135 __graphics_toolkit__ = b.
get_name ();
2136 __plot_stream__ =
Matrix ();
2145 figure::properties::set___mouse_mode__ (
const octave_value& val_arg)
2147 std::string direction =
"in";
2155 if (modestr ==
"zoom in")
2157 val = modestr =
"zoom";
2160 else if (modestr ==
"zoom out")
2162 val = modestr =
"zoom";
2166 if (__mouse_mode__.set (val,
true))
2168 std::string mode = __mouse_mode__.current_value ();
2171 pm.
setfield (
"Enable", mode ==
"pan" ?
"on" :
"off");
2172 set___pan_mode__ (pm);
2175 rm.
setfield (
"Enable", mode ==
"rotate" ?
"on" :
"off");
2176 set___rotate_mode__ (rm);
2179 zm.
setfield (
"Enable", mode ==
"zoom" ?
"on" :
"off");
2180 zm.
setfield (
"Direction", direction);
2181 set___zoom_mode__ (zm);
2185 else if (modestr ==
"zoom")
2188 std::string curr_direction
2191 if (direction != curr_direction)
2193 zm.
setfield (
"Direction", direction);
2194 set___zoom_mode__ (zm);
2203 figure::properties::update_handlevisibility (
void)
2228 base_properties::update_handlevisibility ();
2238 if (go.
isa (
"text"))
2245 else if (go.
isa (
"figure") || go.
isa (
"uipanel") || go.
isa (
"axes")
2246 || go.
isa (
"hggroup"))
2252 if (go.
isa (
"axes"))
2263 figure::properties::update___device_pixel_ratio__ (
void)
2286 pfx =
name.substr (0, 5);
2292 pfx =
name.substr (0, 6);
2298 pfx =
name.substr (0, 7);
2305 pfx =
name.substr (0, 9);
2312 pfx =
name.substr (0, 10);
2314 if (pfx.
compare (
"uipushtool"))
2318 pfx =
name.substr (0, 12);
2320 if (pfx.
compare (
"uitoogletool"))
2324 pfx =
name.substr (0, 13);
2326 if (pfx.
compare (
"uicontextmenu")
2327 || pfx.
compare (
"uibuttongroup"))
2341 std::string pname =
name.substr (offset);
2343 std::transform (pfx.begin (), pfx.end (), pfx.begin (), tolower);
2347 bool has_property =
false;
2349 has_property = axes::properties::has_core_property (pname);
2350 else if (pfx ==
"figure")
2351 has_property = figure::properties::has_core_property (pname);
2352 else if (pfx ==
"line")
2353 has_property = line::properties::has_core_property (pname);
2354 else if (pfx ==
"text")
2355 has_property = text::properties::has_core_property (pname);
2356 else if (pfx ==
"image")
2357 has_property = image::properties::has_core_property (pname);
2358 else if (pfx ==
"patch")
2359 has_property = patch::properties::has_core_property (pname);
2360 else if (pfx ==
"surface")
2361 has_property = surface::properties::has_core_property (pname);
2362 else if (pfx ==
"hggroup")
2363 has_property = hggroup::properties::has_core_property (pname);
2364 else if (pfx ==
"uimenu")
2365 has_property = uimenu::properties::has_core_property (pname);
2366 else if (pfx ==
"uicontrol")
2367 has_property = uicontrol::properties::has_core_property (pname);
2368 else if (pfx ==
"uibuttongroup")
2369 has_property = uibuttongroup::properties::has_core_property (pname);
2370 else if (pfx ==
"uipanel")
2371 has_property = uipanel::properties::has_core_property (pname);
2372 else if (pfx ==
"uicontextmenu")
2373 has_property = uicontextmenu::properties::has_core_property (pname);
2374 else if (pfx ==
"uitable")
2375 has_property = uitable::properties::has_core_property (pname);
2376 else if (pfx ==
"uitoolbar")
2377 has_property = uitoolbar::properties::has_core_property (pname);
2378 else if (pfx ==
"uipushtool")
2379 has_property = uipushtool::properties::has_core_property (pname);
2382 error (
"invalid %s property '%s'", pfx.c_str (), pname.c_str ());
2384 bool remove =
false;
2389 remove = (sval ==
"remove");
2396 auto p = pval_map.
find (pname);
2398 if (p != pval_map.end ())
2402 pval_map[pname] = val;
2407 error (
"invalid default property specification");
2428 pfx =
name.substr (0, 5);
2434 pfx =
name.substr (0, 6);
2440 pfx =
name.substr (0, 7);
2447 pfx =
name.substr (0, 9);
2454 pfx =
name.substr (0, 10);
2456 if (pfx.
compare (
"uipushtool"))
2460 pfx =
name.substr (0, 12);
2462 if (pfx.
compare (
"uitoggletool"))
2466 pfx =
name.substr (0, 13);
2468 if (pfx.
compare (
"uicontextmenu")
2469 || pfx.
compare (
"uibuttongroup"))
2481 std::string pname =
name.substr (offset);
2483 std::transform (pfx.begin (), pfx.end (), pfx.begin (), tolower);
2495 if (q != pval_map.end ())
2509 for (
auto p = begin (); p != end (); p++)
2511 std::string prefix = prefix_arg + p->first;
2513 for (
const auto& prop_val : p->second)
2514 m.assign (prefix + prop_val.first, prop_val.second);
2525 int nargin = args.
length ();
2528 error (
"graphics_object::set: Nothing to set");
2530 for (
int i = 0; i < nargin; )
2532 if (args(i).isstruct () )
2534 set (args(i).map_value ());
2537 else if (i < nargin - 1)
2539 caseless_str pname = args(i).xstring_value (
"set: argument %d must be a property name", i);
2541 set_value_or_default (pname, val);
2545 error (
"set: invalid number of arguments");
2568 error (
"set: number of names must match number of value columns "
2569 "(%" OCTAVE_IDX_TYPE_FORMAT
" != %" OCTAVE_IDX_TYPE_FORMAT
")",
2579 set_value_or_default (pname, val);
2641 set_value_or_default (pname, val);
2738 if (sval ==
"default")
2742 rep->set (pname, default_val);
2744 else if (sval ==
"factory")
2748 rep->set (pname, default_val);
2753 if (sval == R
"(\default)")
2754 rep->set (pname, "default");
2755 else if (sval == R
"(\factory)")
2756 rep->set (pname, "factory");
2758 rep->set (pname, val);
2762 rep->set (pname, val);
2786 static double maxrand = RAND_MAX + 2.0;
2788 return (rand () + 1.0) / maxrand;
2796 if (integer_figure_handle)
2805 while (m_handle_map.find (
retval) != m_handle_map.end ())
2814 auto p = m_handle_free_list.begin ();
2816 if (p != m_handle_free_list.end ())
2819 m_handle_free_list.erase (p);
2839 return go && go.
isa (
"figure");
2847 if (h.
value () == 0)
2848 error (
"graphics_handle::free: can't delete root object");
2850 auto p = m_handle_map.find (h);
2852 if (p == m_handle_map.end ())
2853 error (
"graphics_handle::free: invalid object %g", h.
value ());
2857 if (! p->second.valid_object () || bp.is_beingdeleted ())
2863 parent_go = get_object (parent_h);
2868 p->second.remove_all_listeners ();
2875 bp.execute_deletefcn ();
2878 p->second.finalize ();
2897 m_handle_map.erase (p);
2900 m_handle_free_list.insert
2909 auto p = m_handle_map.find (old_gh);
2911 if (p == m_handle_map.end ())
2912 error (
"graphics_handle::free: invalid object %g", old_gh.
value ());
2916 m_handle_map.erase (p);
2918 m_handle_map[new_gh] = go;
2920 if (old_gh.
value () < 0)
2924 for (
auto& hfig : m_figure_list)
2942 go.
set (pname, val);
2965 return go.
get (pname);
2973 double hv = ov.
xdouble_value (
"%s: %s must be a graphics handle",
2974 who.c_str (), pname.c_str ());
2981 error (
"%s: invalid graphics handle (= %g) for %s",
2982 who.c_str (), hv, pname.c_str ());
2993 go.
set (
"parent", new_parent.
value ());
3036 gh_mgr.
free (h, from_root || go.
isa (
"figure"));
3093 m_event_queue.clear ();
3098 Matrix hlist = figure_handle_list (
true);
3110 hlist = figure_handle_list (
true);
3122 hlist = figure_handle_list (
true);
3124 if (hlist.
numel () != 0)
3125 warning (
"gh_manager::close_all_figures: some graphics elements failed to close.");
3129 m_callback_objects.clear ();
3139 parent_go.
adopt (h);
3215 else if (
state == 2)
3235 for (
const auto& p : pval)
3236 factory_pval[p.first] = p.second;
3242 for (
const auto& p : factory_pval)
3244 std::string pname = p.first;
3248 && pname.find (
"__") != 0 && pname.find (
"current") != 0
3249 && pname !=
"uicontextmenu" && pname !=
"parent")
3252 if (pname.find (
"mode") == (pname.length () - 4))
3253 pval[pname] = p.second;
3255 go.
set (pname, p.second);
3260 for (
const auto& p : pval)
3261 go.
set (p.first, p.second);
3272 std::string go_name = graphics_object_name ();
3280 for (
const auto& prop_val : pval_map)
3282 std::string pname = prop_val.first;
3286 bgo.
set (pname, prop_val.second);
3288 catch (octave::execution_exception& e)
3290 error (e,
"error setting default property %s", pname.c_str ());
3315 std::map<caseless_str, property, cmp_caseless_str>::const_iterator it
3316 = all_props.find (pname);
3318 if (it == all_props.end ())
3319 error (R
"(get: unknown property "%s")", pname.c_str ());
3321 return it->second.get ();
3329 for (std::map<caseless_str, property, cmp_caseless_str>::const_iterator
3330 it = all_props.begin (); it != all_props.end (); ++it)
3331 if (all || ! it->second.is_hidden ())
3332 m.assign (it->second.get_name (), it->second.get ());
3337 std::set<std::string>
3340 return dynamic_properties;
3346 const std::set<std::string>& dynprops = dynamic_property_names ();
3348 if (dynprops.find (pname) != dynprops.end ())
3351 return all_props.find (pname) != all_props.end ();
3358 auto it = all_props.find (pname);
3360 if (it == all_props.end ())
3361 error (R
"(set: unknown property "%s")", pname.c_str ());
3363 it->second.set (val);
3365 dynamic_properties.insert (pname);
3373 std::map<caseless_str, property, cmp_caseless_str>::const_iterator it
3374 = all_props.find (pname);
3376 if (it == all_props.end ())
3377 error (R
"(get_property: unknown property "%s")", pname.c_str ());
3385 double hp = val.
xdouble_value (
"set: parent must be a graphics handle");
3386 if (hp == __myhandle__)
3387 error (
"set: can not set object parent to be object itself");
3393 if (! new_parent.
ok ())
3394 error (
"set: invalid graphics handle (= %g) for parent", hp);
3407 new_parent_go = gh_mgr.
get_object (new_parent);
3408 if (new_parent_go.
get_parent () == __myhandle__)
3416 ::adopt (parent.handle_value (), __myhandle__);
3435 __modified__ =
"on";
3496 if (go && go.
isa (
"uicontextmenu"))
3507 return (handlevisibility.is (
"on")
3528 Matrix kids = get_children ();
3533 for (
int i = 0; i < kids.
numel (); i++)
3555 base_properties::update_handlevisibility (
void)
3569 if (fig.valid_object ())
3577 fig_props.set_currentobject (
Matrix ());
3625 property p = get_property (pname);
3628 p.add_listener (val, mode);
3636 property p = get_property (pname);
3639 p.delete_listener (val, mode);
3646 std::list<graphics_object> &children_list)
const
3651 Matrix ch = get_children ();
3662 if (go.
isa (chtype))
3663 children_list.push_back (go);
3664 else if (traverse && go.
isa (
"hggroup"))
3680 error (
"base_graphics_object::update_axis_limits: invalid graphics object");
3696 error (
"base_graphics_object::update_axis_limits: invalid graphics object");
3714 for (
const auto& pm :
m)
3731 catch (
const octave::execution_exception&)
3745 const auto it = local_defaults.
find (go_name);
3747 if (it != local_defaults.
end ())
3750 for (
const auto& prop_val : pval_lst)
3752 std::string pname = prop_val.first;
3753 if (def.
find (pname) == def.end ())
3754 def[pname] = prop_val.second;
3787 error (
"base_graphics_object::values_as_string: invalid graphics object");
3797 for (
const auto& pm :
m)
3799 const auto& pname = pm.first;
3804 if (p.ok () && ! p.is_hidden ())
3806 retval +=
"\n\t" + std::string (pname) +
": ";
3808 retval += p.values_as_string ();
3825 error (
"base_graphics_object::value_as_string: invalid graphics object");
3836 if (p.ok () && ! p.is_hidden ())
3839 retval += p.values_as_string ();
3855 error (
"base_graphics_object::values_as_struct: invalid graphics object");
3864 for (
const auto& pm :
m)
3866 const auto& pname = pm.first;
3871 if (p.ok () && ! p.is_hidden ())
3925 #include "graphics-props.cc"
3930 root_figure::properties::set_callbackobject (
const octave_value& v)
3937 callbackobject = val;
3943 root_figure::properties::set_currentfigure (
const octave_value& v)
3949 currentfigure = val;
3964 figure::properties::set_integerhandle (
const octave_value& val)
3966 if (integerhandle.set (val,
true))
3968 bool int_fig_handle = integerhandle.is_on ();
3977 __myhandle__ = gh_mgr.
get_handle (int_fig_handle);
3987 Matrix kids = get_children ();
3998 if (__myhandle__ == cf)
3999 xset (0,
"currentfigure", __myhandle__.value ());
4001 this_go.
update (integerhandle.get_id ());
4010 root_figure::properties::update_units (
void)
4012 std::string xunits = get_units ();
4016 double dpi = get_screenpixelsperinch ();
4018 if (xunits ==
"pixels")
4023 else if (xunits ==
"normalized")
4025 scrn_sz =
Matrix (1, 4, 1.0);
4029 else if (xunits ==
"inches")
4036 else if (xunits ==
"centimeters")
4040 scrn_sz(2) *= 2.54 / dpi;
4041 scrn_sz(3) *= 2.54 / dpi;
4043 else if (xunits ==
"points")
4047 scrn_sz(2) *= 72 / dpi;
4048 scrn_sz(3) *= 72 / dpi;
4050 else if (xunits ==
"characters")
4056 scrn_sz(2) *= 74.951 / 12.0 / dpi;
4057 scrn_sz(3) *= 74.951 / 12.0 / dpi;
4060 set_screensize (scrn_sz);
4069 pos(2) = screen_size(0);
4070 pos(3) = screen_size(1);
4128 figure::properties::set_currentaxes (
const octave_value& val)
4143 if (h == currentaxes.handle_value ())
4147 Matrix kids = get_children ();
4158 if (go.
isa (
"axes"))
4160 new_currentaxes = kid;
4165 currentaxes = new_currentaxes;
4170 figure::properties::get_number (
void)
const
4172 if (integerhandle.is_on ())
4173 return __myhandle__.value ();
4188 error (
"set___graphics_toolkit__ must be a string");
4198 error (
"set___graphics_toolkit__: invalid graphics toolkit");
4200 if (nm != get___graphics_toolkit__ ())
4212 if (! get_currentaxes ().ok ())
4219 if (go.
type () ==
"axes")
4248 xset (0,
"currentfigure", __myhandle__.value ());
4258 get_position ().matrix_value () :
4259 get_outerposition ().matrix_value ());
4265 pos(1) = screen_size(1) - pos(1) - pos(3);
4276 pos(1) = screen_size(1) - pos(1) - pos(3);
4285 bool do_notify_toolkit)
4288 Matrix pos = bbox2position (bb);
4291 set_position (pos, do_notify_toolkit);
4293 set_outerposition (pos, do_notify_toolkit);
4299 Matrix bb = get_boundingbox (
true);
4305 pos(1) = bb(3) - pos(1);
4316 Matrix bb = get_boundingbox (
true);
4325 pos(1) = bb(3) - pos(1);
4332 bool do_notify_toolkit)
4335 bool modified =
false;
4337 old_bb = get_boundingbox (
true);
4338 modified = position.set (v,
false, do_notify_toolkit);
4339 new_bb = get_boundingbox (
true);
4341 if (old_bb != new_bb)
4343 if (old_bb(2) != new_bb(2) || old_bb(3) != new_bb(3))
4348 if (! get_resizefcn ().isempty ())
4351 if (! get_sizechangedfcn ().isempty ())
4354 update_boundingbox ();
4364 if (paperpositionmode.is (
"auto"))
4365 paperposition.set (get_auto_paperposition ());
4370 bool do_notify_toolkit)
4372 if (outerposition.set (v,
true, do_notify_toolkit))
4377 figure::properties::set_paperunits (
const octave_value& val)
4383 error (
"set: can't set paperunits to normalized when papertype is custom");
4386 if (paperunits.set (val,
true))
4388 update_paperunits (old_paperunits);
4394 figure::properties::set_papertype (
const octave_value& val)
4400 error (
"set: can't set paperunits to normalized when papertype is custom");
4402 if (papertype.set (val,
true))
4404 update_papertype ();
4414 if (! punits.
compare (
"normalized"))
4419 if (punits.
compare (
"inches"))
4422 mm2units = 1 / 25.4;
4424 else if (punits.
compare (
"centimeters"))
4427 mm2units = 1 / 10.0;
4432 mm2units = 72.0 / 25.4;
4435 if (ptype.
compare (
"usletter"))
4437 retval(0) = 8.5 * in2units;
4438 retval(1) = 11.0 * in2units;
4440 else if (ptype.
compare (
"uslegal"))
4442 retval(0) = 8.5 * in2units;
4443 retval(1) = 14.0 * in2units;
4445 else if (ptype.
compare (
"tabloid"))
4447 retval(0) = 11.0 * in2units;
4448 retval(1) = 17.0 * in2units;
4450 else if (ptype.
compare (
"a0"))
4452 retval(0) = 841.0 * mm2units;
4453 retval(1) = 1189.0 * mm2units;
4455 else if (ptype.
compare (
"a1"))
4457 retval(0) = 594.0 * mm2units;
4458 retval(1) = 841.0 * mm2units;
4460 else if (ptype.
compare (
"a2"))
4462 retval(0) = 420.0 * mm2units;
4463 retval(1) = 594.0 * mm2units;
4465 else if (ptype.
compare (
"a3"))
4467 retval(0) = 297.0 * mm2units;
4468 retval(1) = 420.0 * mm2units;
4470 else if (ptype.
compare (
"a4"))
4472 retval(0) = 210.0 * mm2units;
4473 retval(1) = 297.0 * mm2units;
4475 else if (ptype.
compare (
"a5"))
4477 retval(0) = 148.0 * mm2units;
4478 retval(1) = 210.0 * mm2units;
4480 else if (ptype.
compare (
"b0"))
4482 retval(0) = 1029.0 * mm2units;
4483 retval(1) = 1456.0 * mm2units;
4485 else if (ptype.
compare (
"b1"))
4487 retval(0) = 728.0 * mm2units;
4488 retval(1) = 1028.0 * mm2units;
4490 else if (ptype.
compare (
"b2"))
4492 retval(0) = 514.0 * mm2units;
4493 retval(1) = 728.0 * mm2units;
4495 else if (ptype.
compare (
"b3"))
4497 retval(0) = 364.0 * mm2units;
4498 retval(1) = 514.0 * mm2units;
4500 else if (ptype.
compare (
"b4"))
4502 retval(0) = 257.0 * mm2units;
4503 retval(1) = 364.0 * mm2units;
4505 else if (ptype.
compare (
"b5"))
4507 retval(0) = 182.0 * mm2units;
4508 retval(1) = 257.0 * mm2units;
4510 else if (ptype.
compare (
"arch-a"))
4512 retval(0) = 9.0 * in2units;
4513 retval(1) = 12.0 * in2units;
4515 else if (ptype.
compare (
"arch-b"))
4517 retval(0) = 12.0 * in2units;
4518 retval(1) = 18.0 * in2units;
4520 else if (ptype.
compare (
"arch-c"))
4522 retval(0) = 18.0 * in2units;
4523 retval(1) = 24.0 * in2units;
4525 else if (ptype.
compare (
"arch-d"))
4527 retval(0) = 24.0 * in2units;
4528 retval(1) = 36.0 * in2units;
4530 else if (ptype.
compare (
"arch-e"))
4532 retval(0) = 36.0 * in2units;
4533 retval(1) = 48.0 * in2units;
4537 retval(0) = 8.5 * in2units;
4538 retval(1) = 11.0 * in2units;
4542 retval(0) = 11.0 * in2units;
4543 retval(1) = 17.0 * in2units;
4547 retval(0) = 17.0 * in2units;
4548 retval(1) = 22.0 * in2units;
4552 retval(0) = 22.0 * in2units;
4553 retval(1) = 34.0 * in2units;
4557 retval(0) = 34.0 * in2units;
4558 retval(1) = 43.0 * in2units;
4566 figure::properties::get_auto_paperposition (
void)
4568 Matrix pos = get_position ().matrix_value ();
4575 if (funits ==
"normalized" || punits ==
"normalized")
4580 if (punits ==
"normalized")
4589 sz = get_papersize ().matrix_value ();
4591 pos(0) = sz(0)/2 - pos(2)/2;
4592 pos(1) = sz(1)/2 - pos(3)/2;
4683 Matrix pos = get_paperposition ().matrix_value ();
4684 Matrix sz = get_papersize ().matrix_value ();
4691 std::string porient = get_paperorientation ();
4695 if (ptype.
compare (
"<custom>"))
4697 if (old_paperunits.
compare (
"centimeters"))
4702 else if (old_paperunits.
compare (
"points"))
4708 if (punits.
compare (
"centimeters"))
4713 else if (punits.
compare (
"points"))
4722 if (porient ==
"landscape")
4723 std::swap (sz(0), sz(1));
4736 figure::properties::update_papertype (
void)
4738 std::string typ = get_papertype ();
4739 if (typ !=
"<custom>")
4742 if (get_paperorientation () ==
"landscape")
4743 std::swap (sz(0), sz(1));
4749 if (paperpositionmode.is (
"auto"))
4750 paperposition.set (get_auto_paperposition ());
4754 figure::properties::update_papersize (
void)
4756 Matrix sz = get_papersize ().matrix_value ();
4759 std::swap (sz(0), sz(1));
4765 paperorientation.set (
"portrait");
4768 std::string punits = get_paperunits ();
4769 if (punits ==
"centimeters")
4774 else if (punits ==
"points")
4779 if (punits ==
"normalized")
4781 if (get_papertype () ==
"<custom>")
4782 error (
"set: can't set the papertype to <custom> when the paperunits is normalized");
4789 std::string ptype =
"<custom>";
4790 const double mm2in = 1.0 / 25.4;
4791 const double tol = 0.01;
4799 else if (
std::abs (sz(0) - 841.0 * mm2in)
4800 +
std::abs (sz(1) - 1198.0 * mm2in) < tol)
4802 else if (
std::abs (sz(0) - 594.0 * mm2in)
4803 +
std::abs (sz(1) - 841.0 * mm2in) < tol)
4805 else if (
std::abs (sz(0) - 420.0 * mm2in)
4806 +
std::abs (sz(1) - 594.0 * mm2in) < tol)
4808 else if (
std::abs (sz(0) - 297.0 * mm2in)
4809 +
std::abs (sz(1) - 420.0 * mm2in) < tol)
4811 else if (
std::abs (sz(0) - 210.0 * mm2in)
4812 +
std::abs (sz(1) - 297.0 * mm2in) < tol)
4814 else if (
std::abs (sz(0) - 148.0 * mm2in)
4815 +
std::abs (sz(1) - 210.0 * mm2in) < tol)
4817 else if (
std::abs (sz(0) - 1029.0 * mm2in)
4818 +
std::abs (sz(1) - 1456.0 * mm2in) < tol)
4820 else if (
std::abs (sz(0) - 728.0 * mm2in)
4821 +
std::abs (sz(1) - 1028.0 * mm2in) < tol)
4823 else if (
std::abs (sz(0) - 514.0 * mm2in)
4824 +
std::abs (sz(1) - 728.0 * mm2in) < tol)
4826 else if (
std::abs (sz(0) - 364.0 * mm2in)
4827 +
std::abs (sz(1) - 514.0 * mm2in) < tol)
4829 else if (
std::abs (sz(0) - 257.0 * mm2in)
4830 +
std::abs (sz(1) - 364.0 * mm2in) < tol)
4832 else if (
std::abs (sz(0) - 182.0 * mm2in)
4833 +
std::abs (sz(1) - 257.0 * mm2in) < tol)
4867 papertype.set (ptype);
4869 if (punits ==
"centimeters")
4874 else if (punits ==
"points")
4879 if (get_paperorientation () ==
"landscape")
4881 std::swap (sz(0), sz(1));
4885 if (paperpositionmode.is (
"auto"))
4886 paperposition.set (get_auto_paperposition ());
4922 figure::properties::update_paperorientation (
void)
4924 std::string porient = get_paperorientation ();
4925 Matrix sz = get_papersize ().matrix_value ();
4926 if ((sz(0) > sz(1) && porient ==
"portrait")
4927 || (sz(0) < sz(1) && porient ==
"landscape"))
4929 std::swap (sz(0), sz(1));
4935 if (paperpositionmode.is (
"auto"))
4936 paperposition.set (get_auto_paperposition ());
4967 figure::properties::set_units (
const octave_value& val)
4971 if (units.set (val,
true))
4973 update_units (old_units);
4981 position.set (
convert_position (get_position ().matrix_value (), old_units,
5007 if (! get_number ().isempty () && is_numbertitle ())
5009 std::ostringstream os;
5010 std::string nm = get_name ();
5012 os <<
"Figure " << __myhandle__.value ();
5014 os <<
": " << get_name ();
5019 title = get_name ();
5034 if (
retval.is_undefined ())
5055 plist.
erase (
"units");
5056 plist.
erase (
"position");
5057 plist.
erase (
"outerposition");
5058 plist.
erase (
"paperunits");
5059 plist.
erase (
"paperposition");
5060 plist.
erase (
"windowstyle");
5069 axes::properties::init (
void)
5072 outerposition.add_constraint (
dim_vector (1, 4));
5073 tightinset.add_constraint (
dim_vector (1, 4));
5074 looseinset.add_constraint (
dim_vector (1, 4));
5075 colororder.add_constraint (
dim_vector (-1, 3));
5076 dataaspectratio.add_constraint (3);
5077 dataaspectratio.add_constraint (
"min", 0,
false);
5078 dataaspectratio.add_constraint (
FINITE);
5079 plotboxaspectratio.add_constraint (3);
5080 plotboxaspectratio.add_constraint (
"min", 0,
false);
5081 plotboxaspectratio.add_constraint (
FINITE);
5084 alim.add_constraint (2);
5085 alim.add_constraint (
NOT_NAN);
5086 clim.add_constraint (2);
5087 clim.add_constraint (
NOT_NAN);
5088 xlim.add_constraint (2);
5089 xlim.add_constraint (
NOT_NAN);
5090 ylim.add_constraint (2);
5091 ylim.add_constraint (
NOT_NAN);
5092 zlim.add_constraint (2);
5093 zlim.add_constraint (
NOT_NAN);
5095 xtick.add_constraint (
FINITE);
5097 ytick.add_constraint (
FINITE);
5099 ztick.add_constraint (
FINITE);
5100 ticklength.add_constraint (
dim_vector (1, 2));
5105 cameraposition.add_constraint (3);
5106 cameraposition.add_constraint (
FINITE);
5107 cameratarget.add_constraint (3);
5108 cameratarget.add_constraint (
FINITE);
5111 cameraupvector = upv;
5112 cameraupvector.add_constraint (3);
5113 cameraupvector.add_constraint (
FINITE);
5114 cameraviewangle.add_constraint (
FINITE);
5115 currentpoint.add_constraint (
dim_vector (2, 3));
5118 fontsize.add_constraint (
"min", 0.0,
false);
5119 gridalpha.add_constraint (
"min", 0.0,
true);
5120 gridalpha.add_constraint (
"max", 1.0,
true);
5121 labelfontsizemultiplier.add_constraint (
"min", 0.0,
false);
5122 linewidth.add_constraint (
"min", 0.0,
false);
5123 minorgridalpha.add_constraint (
"min", 0.0,
true);
5124 minorgridalpha.add_constraint (
"max", 1.0,
true);
5125 titlefontsizemultiplier.add_constraint (
"min", 0.0,
false);
5130 x_zlim.resize (1, 2);
5136 calc_ticklabels (xtick, xticklabel, xscale.is (
"log"),
5137 xaxislocation_is (
"origin"),
5138 yscale.is (
"log") ? 2 : (yaxislocation_is (
"origin") ? 0 :
5139 (yaxislocation_is (
"left") ? -1 : 1)), xlim);
5140 calc_ticklabels (ytick, yticklabel, yscale.is (
"log"),
5141 yaxislocation_is (
"origin"),
5142 xscale.is (
"log") ? 2 : (xaxislocation_is (
"origin") ? 0 :
5143 (xaxislocation_is (
"bottom") ? -1 : 1)), ylim);
5144 calc_ticklabels (ztick, zticklabel, zscale.is (
"log"),
false, 2, zlim);
5146 xset (xlabel.handle_value (),
"handlevisibility",
"off");
5147 xset (ylabel.handle_value (),
"handlevisibility",
"off");
5148 xset (zlabel.handle_value (),
"handlevisibility",
"off");
5149 xset (title.handle_value (),
"handlevisibility",
"off");
5151 xset (xlabel.handle_value (),
"horizontalalignment",
"center");
5152 xset (xlabel.handle_value (),
"horizontalalignmentmode",
"auto");
5153 xset (ylabel.handle_value (),
"horizontalalignment",
"center");
5154 xset (ylabel.handle_value (),
"horizontalalignmentmode",
"auto");
5155 xset (zlabel.handle_value (),
"horizontalalignment",
"right");
5156 xset (zlabel.handle_value (),
"horizontalalignmentmode",
"auto");
5157 xset (title.handle_value (),
"horizontalalignment",
"center");
5158 xset (title.handle_value (),
"horizontalalignmentmode",
"auto");
5160 xset (xlabel.handle_value (),
"verticalalignment",
"top");
5161 xset (xlabel.handle_value (),
"verticalalignmentmode",
"auto");
5162 xset (ylabel.handle_value (),
"verticalalignment",
"bottom");
5163 xset (ylabel.handle_value (),
"verticalalignmentmode",
"auto");
5164 xset (title.handle_value (),
"verticalalignment",
"bottom");
5165 xset (title.handle_value (),
"verticalalignmentmode",
"auto");
5167 xset (ylabel.handle_value (),
"rotation", 90.0);
5168 xset (ylabel.handle_value (),
"rotationmode",
"auto");
5170 xset (zlabel.handle_value (),
"visible",
"off");
5172 xset (xlabel.handle_value (),
"clipping",
"off");
5173 xset (ylabel.handle_value (),
"clipping",
"off");
5174 xset (zlabel.handle_value (),
"clipping",
"off");
5175 xset (title.handle_value (),
"clipping",
"off");
5177 xset (xlabel.handle_value (),
"__autopos_tag__",
"xlabel");
5178 xset (ylabel.handle_value (),
"__autopos_tag__",
"ylabel");
5179 xset (zlabel.handle_value (),
"__autopos_tag__",
"zlabel");
5180 xset (title.handle_value (),
"__autopos_tag__",
"title");
5182 double fs = labelfontsizemultiplier.double_value () *
5183 fontsize.double_value ();
5187 fs = titlefontsizemultiplier.double_value () * fontsize.double_value ();
5189 xset (title.handle_value (),
"fontweight", titlefontweight.get ());
5191 adopt (xlabel.handle_value ());
5192 adopt (ylabel.handle_value ());
5193 adopt (zlabel.handle_value ());
5194 adopt (title.handle_value ());
5197 tlooseinset(2) = 1-tlooseinset(0)-tlooseinset(2);
5198 tlooseinset(3) = 1-tlooseinset(1)-tlooseinset(3);
5199 looseinset = tlooseinset;
5226 axes::properties::calc_tightbox (
const Matrix& init_pos)
5239 update_ticklength ();
5241 Matrix ext = get_extent (
true,
true);
5242 ext(1) = parent_bb(3) - ext(1) - ext(3);
5247 if (ext(0) < pos(0))
5249 pos(2) += pos(0)-ext(0);
5252 if (ext(0)+ext(2) > pos(0)+pos(2))
5253 pos(2) = ext(0)+ext(2)-pos(0);
5255 if (ext(1) < pos(1))
5257 pos(3) += pos(1)-ext(1);
5260 if (ext(1)+ext(3) > pos(1)+pos(3))
5261 pos(3) = ext(1)+ext(3)-pos(1);
5270 if (activepositionproperty.is (
"position"))
5273 update_outerposition ();
5275 set_units (
"normalized");
5276 Matrix pos = position.get ().matrix_value ();
5277 Matrix outpos = outerposition.get ().matrix_value ();
5278 Matrix tightpos = calc_tightbox (pos);
5279 Matrix tinset (1, 4, 1.0);
5280 tinset(0) = pos(0)-tightpos(0);
5281 tinset(1) = pos(1)-tightpos(1);
5282 tinset(2) = tightpos(0)+tightpos(2)-pos(0)-pos(2);
5283 tinset(3) = tightpos(1)+tightpos(3)-pos(1)-pos(3);
5284 tightinset = tinset;
5285 set_units (old_units);
5286 update_transform ();
5287 if (activepositionproperty.is (
"position"))
5290 update_outerposition ();
5358 const std::string& who,
5374 if (go.
isa (
"text"))
5375 val =
::reparent (v,
"set", who, __myhandle__,
false);
5380 error (
"set: expecting text graphics object or character string for %s property, found %s",
5381 who.c_str (), cname.c_str ());
5384 xset (val,
"handlevisibility",
"off");
5396 set_text_child (xlabel,
"xlabel", v);
5397 xset (xlabel.handle_value (),
"positionmode",
"auto");
5398 xset (xlabel.handle_value (),
"rotationmode",
"auto");
5399 xset (xlabel.handle_value (),
"horizontalalignmentmode",
"auto");
5400 xset (xlabel.handle_value (),
"verticalalignmentmode",
"auto");
5401 xset (xlabel.handle_value (),
"clipping",
"off");
5402 xset (xlabel.handle_value (),
"color", get_xcolor ());
5403 xset (xlabel.handle_value (),
"__autopos_tag__",
"xlabel");
5404 update_xlabel_position ();
5410 set_text_child (ylabel,
"ylabel", v);
5411 xset (ylabel.handle_value (),
"positionmode",
"auto");
5412 xset (ylabel.handle_value (),
"rotationmode",
"auto");
5413 xset (ylabel.handle_value (),
"horizontalalignmentmode",
"auto");
5414 xset (ylabel.handle_value (),
"verticalalignmentmode",
"auto");
5415 xset (ylabel.handle_value (),
"clipping",
"off");
5416 xset (ylabel.handle_value (),
"color", get_ycolor ());
5417 xset (ylabel.handle_value (),
"__autopos_tag__",
"ylabel");
5418 update_ylabel_position ();
5424 set_text_child (zlabel,
"zlabel", v);
5425 xset (zlabel.handle_value (),
"positionmode",
"auto");
5426 xset (zlabel.handle_value (),
"rotationmode",
"auto");
5427 xset (zlabel.handle_value (),
"horizontalalignmentmode",
"auto");
5428 xset (zlabel.handle_value (),
"verticalalignmentmode",
"auto");
5429 xset (zlabel.handle_value (),
"clipping",
"off");
5430 xset (zlabel.handle_value (),
"color", get_zcolor ());
5431 xset (zlabel.handle_value (),
"__autopos_tag__",
"zlabel");
5432 update_zlabel_position ();
5438 set_text_child (title,
"title", v);
5439 xset (title.handle_value (),
"positionmode",
"auto");
5440 xset (title.handle_value (),
"horizontalalignment",
"center");
5441 xset (title.handle_value (),
"horizontalalignmentmode",
"auto");
5442 xset (title.handle_value (),
"verticalalignment",
"bottom");
5443 xset (title.handle_value (),
"verticalalignmentmode",
"auto");
5444 xset (title.handle_value (),
"clipping",
"off");
5445 xset (title.handle_value (),
"__autopos_tag__",
"title");
5446 update_title_position ();
5451 const std::string& mode)
5460 assert (mode ==
"reset");
5475 ambientlightcolor =
Matrix (1, 3, 1.0);
5481 camerapositionmode =
"auto";
5482 cameratargetmode =
"auto";
5483 cameraupvectormode =
"auto";
5484 cameraviewanglemode =
"auto";
5490 clippingstyle =
"3dbox";
5494 colororderindex = 1.0;
5497 dataaspectratiomode =
"auto";
5499 fontangle =
"normal";
5502 fontunits =
"points";
5503 fontsmoothing =
"on";
5504 fontweight =
"normal";
5507 gridalphamode =
"auto";
5509 gridcolormode =
"auto";
5510 gridlinestyle =
"-";
5512 labelfontsizemultiplier = 1.1;
5516 linestyleorder =
"-";
5517 linestyleorderindex = 1.0;
5521 minorgridalpha = 0.25;
5522 minorgridalphamode =
"auto";
5524 minorgridcolormode =
"auto";
5525 minorgridlinestyle =
":";
5527 nextplot =
"replace";
5530 plotboxaspectratiomode =
"auto";
5531 projection =
"orthographic";
5533 sortmethod =
"depth";
5536 tickdirmode =
"auto";
5537 ticklabelinterpreter =
"tex";
5540 tightinset =
Matrix (1, 4, 0.0);
5542 titlefontsizemultiplier = 1.1;
5543 titlefontweight =
"bold";
5545 Matrix tview (1, 2, 0.0);
5549 xaxislocation =
"bottom";
5552 xcolormode =
"auto";
5560 xticklabelmode =
"auto";
5561 xticklabelrotation = 0.0;
5564 yaxislocation =
"left";
5567 ycolormode =
"auto";
5575 yticklabelmode =
"auto";
5576 yticklabelrotation = 0.0;
5580 zcolormode =
"auto";
5588 zticklabelmode =
"auto";
5589 zticklabelrotation = 0.0;
5603 go = gh_mgr.
get_object (ylabel.handle_value ());
5605 go = gh_mgr.
get_object (zlabel.handle_value ());
5607 go = gh_mgr.
get_object (title.handle_value ());
5610 xset (xlabel.handle_value (),
"handlevisibility",
"off");
5611 xset (ylabel.handle_value (),
"handlevisibility",
"off");
5612 xset (zlabel.handle_value (),
"handlevisibility",
"off");
5613 xset (title.handle_value (),
"handlevisibility",
"off");
5615 xset (xlabel.handle_value (),
"horizontalalignment",
"center");
5616 xset (xlabel.handle_value (),
"horizontalalignmentmode",
"auto");
5617 xset (ylabel.handle_value (),
"horizontalalignment",
"center");
5618 xset (ylabel.handle_value (),
"horizontalalignmentmode",
"auto");
5619 xset (zlabel.handle_value (),
"horizontalalignment",
"right");
5620 xset (zlabel.handle_value (),
"horizontalalignmentmode",
"auto");
5621 xset (title.handle_value (),
"horizontalalignment",
"center");
5622 xset (title.handle_value (),
"horizontalalignmentmode",
"auto");
5624 xset (xlabel.handle_value (),
"verticalalignment",
"top");
5625 xset (xlabel.handle_value (),
"verticalalignmentmode",
"auto");
5626 xset (ylabel.handle_value (),
"verticalalignment",
"bottom");
5627 xset (ylabel.handle_value (),
"verticalalignmentmode",
"auto");
5628 xset (title.handle_value (),
"verticalalignment",
"bottom");
5629 xset (title.handle_value (),
"verticalalignmentmode",
"auto");
5631 xset (ylabel.handle_value (),
"rotation", 90.0);
5632 xset (ylabel.handle_value (),
"rotationmode",
"auto");
5634 xset (zlabel.handle_value (),
"visible",
"off");
5636 xset (xlabel.handle_value (),
"clipping",
"off");
5637 xset (ylabel.handle_value (),
"clipping",
"off");
5638 xset (zlabel.handle_value (),
"clipping",
"off");
5639 xset (title.handle_value (),
"clipping",
"off");
5641 xset (xlabel.handle_value (),
"__autopos_tag__",
"xlabel");
5642 xset (ylabel.handle_value (),
"__autopos_tag__",
"ylabel");
5643 xset (zlabel.handle_value (),
"__autopos_tag__",
"zlabel");
5644 xset (title.handle_value (),
"__autopos_tag__",
"title");
5647 fs = labelfontsizemultiplier.double_value () * fontsize.double_value ();
5651 fs = titlefontsizemultiplier.double_value () * fontsize.double_value ();
5653 xset (title.handle_value (),
"fontweight", titlefontweight.get ());
5655 update_transform ();
5661 axes::properties::get_colormap (
void)
const
5663 if (__colormap__.get ().isempty ())
5672 return figure_props.get_colormap ();
5675 return get___colormap__ ();
5691 gh_mgr.
free (h, from_root);
5699 if (! is_beingdeleted ())
5717 if (xlabel.handle_value ().ok () && h == xlabel.handle_value ())
5719 delete_text_child (xlabel, from_root);
5720 update_xlabel_position ();
5722 else if (ylabel.handle_value ().ok () && h == ylabel.handle_value ())
5724 delete_text_child (ylabel, from_root);
5725 update_ylabel_position ();
5727 else if (zlabel.handle_value ().ok () && h == zlabel.handle_value ())
5729 delete_text_child (zlabel, from_root);
5730 update_zlabel_position ();
5732 else if (title.handle_value ().ok () && h == title.handle_value ())
5734 delete_text_child (title, from_root);
5735 update_title_position ();
5737 else if (get_num_lights () > 0 && go.
isa (
"light")
5739 decrease_num_lights ();
5754 increase_num_lights ();
5764 if (xlimmode_is (
"auto"))
5767 if (ylimmode_is (
"auto"))
5770 if (zlimmode_is (
"auto"))
5773 if (climmode_is (
"auto"))
5776 if (climmode_is (
"auto"))
5785 for (
int i = 0; i < 4; i++)
5882 double fact = 1.0 / sqrt (v(0)*v(0)+v(1)*v(1)+v(2)*v(2));
5883 scale (v, fact, fact, fact);
5889 return (v1(0)*
v2(0)+v1(1)*
v2(1)+v1(2)*
v2(2));
5895 return sqrt (
dot (v, v));
5903 r(0) = v1(1)*
v2(2) - v1(2)*
v2(1);
5904 r(1) = v1(2)*
v2(0) - v1(0)*
v2(2);
5905 r(2) = v1(0)*
v2(1) - v1(1)*
v2(0);
5913 static double data[32] =
5926 memcpy (
m.fortran_vec (), data, sizeof (
double)*32);
5950 double xd = (xdir_is (
"normal") ? 1 : -1);
5951 double yd = (ydir_is (
"normal") ? 1 : -1);
5952 double zd = (zdir_is (
"normal") ? 1 : -1);
5954 Matrix xlimits = sx.scale (get_xlim ().matrix_value ());
5955 Matrix ylimits = sy.scale (get_ylim ().matrix_value ());
5956 Matrix zlimits = sz.scale (get_zlim ().matrix_value ());
5958 double xo = xlimits(xd > 0 ? 0 : 1);
5959 double yo = ylimits(yd > 0 ? 0 : 1);
5960 double zo = zlimits(zd > 0 ? 0 : 1);
5962 Matrix pb = get_plotboxaspectratio ().matrix_value ();
5964 bool autocam = (camerapositionmode_is (
"auto")
5965 && cameratargetmode_is (
"auto")
5966 && cameraupvectormode_is (
"auto")
5967 && cameraviewanglemode_is (
"auto"));
5968 bool dowarp = (autocam && dataaspectratiomode_is (
"auto")
5969 && plotboxaspectratiomode_is (
"auto"));
5975 if (cameratargetmode_is (
"auto"))
5977 c_center(0) = (xlimits(0) + xlimits(1)) / 2;
5978 c_center(1) = (ylimits(0) + ylimits(1)) / 2;
5979 c_center(2) = (zlimits(0) + zlimits(1)) / 2;
5984 c_center =
cam2xform (get_cameratarget ().matrix_value ());
5986 if (camerapositionmode_is (
"auto"))
5988 Matrix tview = get_view ().matrix_value ();
5989 double az = tview(0);
5990 double el = tview(1);
5991 double d = 5 * sqrt (pb(0)*pb(0) + pb(1)*pb(1) + pb(2)*pb(2));
5993 if (el == 90 || el == -90)
5999 c_eye(0) =
d * cos (el) * sin (az);
6000 c_eye(1) = -
d* cos (el) * cos (az);
6001 c_eye(2) =
d * sin (el);
6003 c_eye(0) = c_eye(0)*(xlimits(1)-xlimits(0))/(xd*pb(0))+c_center(0);
6004 c_eye(1) = c_eye(1)*(ylimits(1)-ylimits(0))/(yd*pb(1))+c_center(1);
6005 c_eye(2) = c_eye(2)*(zlimits(1)-zlimits(0))/(zd*pb(2))+c_center(2);
6010 c_eye =
cam2xform (get_cameraposition ().matrix_value ());
6012 if (cameraupvectormode_is (
"auto"))
6014 Matrix tview = get_view ().matrix_value ();
6015 double az = tview(0);
6016 double el = tview(1);
6018 if (el == 90 || el == -90)
6021 * sin (az*M_PI/180.0)*(xlimits(1)-xlimits(0))/pb(0);
6023 * cos (az*M_PI/180.0)*(ylimits(1)-ylimits(0))/pb(1);
6031 c_upv =
cam2xform (get_cameraupvector ().matrix_value ());
6042 scale (x_pre, pb(0), pb(1), pb(2));
6044 scale (x_pre, xd/(xlimits(1)-xlimits(0)), yd/(ylimits(1)-ylimits(0)),
6045 zd/(zlimits(1)-zlimits(0)));
6048 xform (c_eye, x_pre);
6049 xform (c_center, x_pre);
6050 scale (c_upv, pb(0)/(xlimits(1)-xlimits(0)), pb(1)/(ylimits(1)-ylimits(0)),
6051 pb(2)/(zlimits(1)-zlimits(0)));
6052 translate (c_center, -c_eye(0), -c_eye(1), -c_eye(2));
6060 double fa = 1 / sqrt (1 -
f(2)*
f(2));
6061 scale (UP, fa, fa, fa);
6067 scale (x_view, 1, 1, -1);
6069 l(0,0) = s(0); l(0,1) = s(1); l(0,2) = s(2);
6070 l(1,0) = u(0); l(1,1) = u(1); l(1,2) = u(2);
6071 l(2,0) = -
f(0); l(2,1) = -
f(1); l(2,2) = -
f(2);
6072 x_view = x_view * l;
6073 translate (x_view, -c_eye(0), -c_eye(1), -c_eye(2));
6074 scale (x_view, pb(0), pb(1), pb(2));
6080 double xM = cmax(0) - cmin(0);
6081 double yM = cmax(1) - cmin(1);
6083 Matrix bb = get_boundingbox (
true);
6087 if (cameraviewanglemode_is (
"auto"))
6094 if (
false && dowarp)
6095 af = (1.0 / (xM > yM ? xM : yM));
6098 if ((bb(2)/bb(3)) > (xM/yM))
6103 v_angle = 2 * (180.0 / M_PI) *
atan (1 / (2 * af *
norm (F)));
6105 cameraviewangle = v_angle;
6108 v_angle = get_cameraviewangle ();
6110 double pf = 1 / (2 * tan ((v_angle / 2) * M_PI / 180.0) *
norm (F));
6111 scale (x_projection, pf, pf, 1);
6117 translate (x_viewport, bb(0)+bb(2)/2, bb(1)+bb(3)/2, 0);
6118 scale (x_viewport, bb(2)/xM, -bb(3)/yM, 1);
6125 if ((bb(2)/bb(3)) > (xM/yM))
6131 pix = (bb(2) < bb(3) ? bb(2) : bb(3));
6132 translate (x_viewport, bb(0)+bb(2)/2, bb(1)+bb(3)/2, 0);
6133 scale (x_viewport, pix, -pix, 1);
6136 x_normrender = x_viewport * x_projection * x_view;
6142 x_zlim(0) = cmin(2);
6143 x_zlim(1) = cmax(2);
6145 x_render = x_normrender;
6146 scale (x_render, xd/(xlimits(1)-xlimits(0)), yd/(ylimits(1)-ylimits(0)),
6147 zd/(zlimits(1)-zlimits(0)));
6150 x_render_inv = x_render.inverse ();
6155 scale (x_gl_mat1, xd/(xlimits(1)-xlimits(0)), yd/(ylimits(1)-ylimits(0)),
6156 zd/(zlimits(1)-zlimits(0)));
6158 x_gl_mat2 = x_viewport * x_projection;
6171 double xd = (xdir_is (
"normal") ? 1 : -1);
6172 double yd = (ydir_is (
"normal") ? 1 : -1);
6173 double zd = (zdir_is (
"normal") ? 1 : -1);
6175 const Matrix xlims =
xform.xscale (get_xlim ().matrix_value ());
6176 const Matrix ylims =
xform.yscale (get_ylim ().matrix_value ());
6177 const Matrix zlims =
xform.zscale (get_zlim ().matrix_value ());
6179 double x_min, x_max, y_min, y_max, z_min, z_max;
6180 x_min = xlims(0), x_max = xlims(1);
6181 y_min = ylims(0), y_max = ylims(1);
6182 z_min = zlims(0), z_max = zlims(1);
6188 p1 =
xform.transform (x_min, (y_min+y_max)/2, (z_min+z_max)/2,
false);
6189 p2 =
xform.transform (x_max, (y_min+y_max)/2, (z_min+z_max)/2,
false);
6192 dir(2) = (p2(2) - p1(2));
6193 if (dir(0) == 0 && dir(1) == 0)
6195 else if (dir(2) == 0)
6199 else if (dir(1) == 0)
6206 xPlane = (dir(0) > 0 ? x_max : x_min);
6208 xPlane = (dir(1) < 0 ? x_max : x_min);
6211 xPlane = (dir(2) < 0 ? x_min : x_max);
6213 xPlaneN = (xPlane == x_min ? x_max : x_min);
6214 fx = (x_max - x_min) / sqrt (dir(0)*dir(0) + dir(1)*dir(1));
6216 p1 =
xform.transform ((x_min + x_max)/2, y_min, (z_min + z_max)/2,
false);
6217 p2 =
xform.transform ((x_min + x_max)/2, y_max, (z_min + z_max)/2,
false);
6220 dir(2) = (p2(2) - p1(2));
6221 if (dir(0) == 0 && dir(1) == 0)
6223 else if (dir(2) == 0)
6227 else if (dir(1) == 0)
6234 yPlane = (dir(0) > 0 ? y_max : y_min);
6236 yPlane = (dir(1) < 0 ? y_max : y_min);
6239 yPlane = (dir(2) < 0 ? y_min : y_max);
6241 yPlaneN = (yPlane == y_min ? y_max : y_min);
6242 fy = (y_max - y_min) / sqrt (dir(0)*dir(0) + dir(1)*dir(1));
6244 p1 =
xform.transform ((x_min + x_max)/2, (y_min + y_max)/2, z_min,
false);
6245 p2 =
xform.transform ((x_min + x_max)/2, (y_min + y_max)/2, z_max,
false);
6248 dir(2) = (p2(2) - p1(2));
6249 if (dir(0) == 0 && dir(1) == 0)
6251 else if (dir(2) == 0)
6255 else if (dir(1) == 0)
6262 zPlane = (dir(0) > 0 ? z_min : z_max);
6264 zPlane = (dir(1) < 0 ? z_min : z_max);
6267 zPlane = (dir(2) < 0 ? z_min : z_max);
6269 zPlaneN = (zPlane == z_min ? z_max : z_min);
6270 fz = (z_max - z_min) / sqrt (dir(0)*dir(0) + dir(1)*dir(1));
6276 xySym = (xd*yd*(xPlane-xPlaneN)*(yPlane-yPlaneN) > 0);
6277 zSign = (zd*(zPlane-zPlaneN) <= 0);
6278 xyzSym = (zSign ? xySym : ! xySym);
6279 xpTick = (zSign ? xPlaneN : xPlane);
6280 ypTick = (zSign ? yPlaneN : yPlane);
6281 zpTick = (zSign ? zPlane : zPlaneN);
6282 xpTickN = (zSign ? xPlane : xPlaneN);
6283 ypTickN = (zSign ? yPlane : yPlaneN);
6284 zpTickN = (zSign ? zPlaneN : zPlane);
6292 Matrix ylimits = get_ylim ().matrix_value ();
6293 if (xaxislocation_is (
"top")
6294 || (yscale_is (
"log") && xaxislocation_is (
"origin")
6295 && (ylimits(1) < 0.)))
6297 std::swap (yPlane, yPlaneN);
6302 Matrix xlimits = get_xlim ().matrix_value ();
6303 if (yaxislocation_is (
"right")
6304 || (xscale_is (
"log") && yaxislocation_is (
"origin")
6305 && (xlimits(1) < 0.)))
6307 std::swap (xPlane, xPlaneN);
6312 if (layer_is (
"top"))
6321 Matrix viewmat = get_view ().matrix_value ();
6322 nearhoriz =
std::abs (viewmat(1)) <= 5;
6323 is2D = viewmat(1) == 90;
6325 update_ticklength ();
6329 axes::properties::update_ticklength (
void)
6335 if (tickdirmode_is (
"auto"))
6336 tickdir.set (mode2D ?
"in" :
"out",
true);
6338 double ticksign = (tickdir_is (
"in") ? -1 : 1);
6340 Matrix bbox = get_boundingbox (
true);
6341 Matrix ticklen = get_ticklength ().matrix_value ();
6342 ticklen(0) *=
std::max (bbox(2), bbox(3));
6345 ticklen(1) *= (0.76 *
std::max (bbox(2), bbox(3)));
6347 xticklen = ticksign * (mode2D ? ticklen(0) : ticklen(1));
6348 yticklen = ticksign * (mode2D ? ticklen(0) : ticklen(1));
6349 zticklen = ticksign * (mode2D ? ticklen(0) : ticklen(1));
6351 double offset = get___fontsize_points__ () / 2;
6353 xtickoffset = (mode2D ?
std::max (0., xticklen) : std::
abs (xticklen)) +
6355 ytickoffset = (mode2D ?
std::max (0., yticklen) : std::
abs (yticklen)) +
6357 ztickoffset = (mode2D ?
std::max (0., zticklen) : std::
abs (zticklen)) +
6360 update_xlabel_position ();
6361 update_ylabel_position ();
6362 update_zlabel_position ();
6363 update_title_position ();
6392 std::string to_units = props.get_units ();
6394 if (to_units !=
"data")
6400 retval(0) = v(0) - bbox(0) + 1;
6401 retval(1) = bbox(1) + bbox(3) - v(1) + 1;
6432 bool isempty = xlabel_props.get_string ().isempty ();
6440 if (xlabel_props.horizontalalignmentmode_is (
"auto"))
6442 xlabel_props.set_horizontalalignment
6443 (xstate >
AXE_DEPTH_DIR ?
"center" : (xyzSym ?
"left" :
"right"));
6445 xlabel_props.set_horizontalalignmentmode (
"auto");
6448 if (xlabel_props.verticalalignmentmode_is (
"auto"))
6450 xlabel_props.set_verticalalignment
6453 xlabel_props.set_verticalalignmentmode (
"auto");
6457 if (xlabel_props.positionmode_is (
"auto")
6458 || xlabel_props.rotationmode_is (
"auto"))
6463 ext = get_ticklabel_extents (get_xtick ().matrix_value (),
6464 get_xticklabel ().string_vector_value (),
6465 get_xlim ().matrix_value ());
6468 double wmax = ext(0) + margin;
6469 double hmax = ext(1) + margin;
6480 p =
xform.transform (p(0), p(1), p(2),
false);
6485 p(0) += (xyzSym ? wmax : -wmax);
6495 p(1) += (x2Dtop ? -hmax : hmax);
6499 if (xlabel_props.positionmode_is (
"auto"))
6501 p =
xform.untransform (p(0), p(1), p(2),
true);
6504 get_extent (
false));
6507 xlabel_props.set_positionmode (
"auto");
6510 if (! isempty && xlabel_props.rotationmode_is (
"auto"))
6512 xlabel_props.set_rotation (angle);
6513 xlabel_props.set_rotationmode (
"auto");
6537 bool isempty = ylabel_props.get_string ().isempty ();
6545 if (ylabel_props.horizontalalignmentmode_is (
"auto"))
6547 ylabel_props.set_horizontalalignment
6548 (ystate >
AXE_DEPTH_DIR ?
"center" : (! xyzSym ?
"left" :
"right"));
6550 ylabel_props.set_horizontalalignmentmode (
"auto");
6553 if (ylabel_props.verticalalignmentmode_is (
"auto"))
6555 ylabel_props.set_verticalalignment
6556 (ystate ==
AXE_VERT_DIR && ! y2Dright ?
"bottom" :
"top");
6558 ylabel_props.set_verticalalignmentmode (
"auto");
6562 if (ylabel_props.positionmode_is (
"auto")
6563 || ylabel_props.rotationmode_is (
"auto"))
6569 ext = get_ticklabel_extents (get_ytick ().matrix_value (),
6570 get_yticklabel ().string_vector_value (),
6571 get_ylim ().matrix_value ());
6573 double wmax = ext(0) + margin;
6574 double hmax = ext(1) + margin;
6585 p =
xform.transform (p(0), p(1), p(2),
false);
6590 p(0) += (! xyzSym ? wmax : -wmax);
6595 p(0) += (y2Dright ? wmax : -wmax);
6604 if (ylabel_props.positionmode_is (
"auto"))
6606 p =
xform.untransform (p(0), p(1), p(2),
true);
6609 get_extent (
false));
6612 ylabel_props.set_positionmode (
"auto");
6615 if (! isempty && ylabel_props.rotationmode_is (
"auto"))
6617 ylabel_props.set_rotation (angle);
6618 ylabel_props.set_rotationmode (
"auto");
6642 bool camAuto = cameraupvectormode_is (
"auto");
6643 bool isempty = zlabel_props.get_string ().isempty ();
6651 if (zlabel_props.horizontalalignmentmode_is (
"auto"))
6653 zlabel_props.set_horizontalalignment
6656 zlabel_props.set_horizontalalignmentmode (
"auto");
6659 if (zlabel_props.verticalalignmentmode_is (
"auto"))
6661 zlabel_props.set_verticalalignment
6663 ?
"bottom" : ((zSign || camAuto) ?
"bottom" :
"top"));
6665 zlabel_props.set_verticalalignmentmode (
"auto");
6669 if (zlabel_props.positionmode_is (
"auto")
6670 || zlabel_props.rotationmode_is (
"auto"))
6675 ext = get_ticklabel_extents (get_ztick ().matrix_value (),
6676 get_zticklabel ().string_vector_value (),
6677 get_zlim ().matrix_value ());
6680 double wmax = ext(0) + margin;
6681 double hmax = ext(1) + margin;
6688 (zpTickN + zpTick)/2);
6697 (zpTickN + zpTick)/2);
6704 p =
xform.transform (p(0), p(1), p(2),
false);
6732 if (zlabel_props.positionmode_is (
"auto"))
6734 p =
xform.untransform (p(0), p(1), p(2),
true);
6737 get_extent (
false));
6740 zlabel_props.set_positionmode (
"auto");
6743 if (! isempty && zlabel_props.rotationmode_is (
"auto"))
6745 zlabel_props.set_rotation (angle);
6746 zlabel_props.set_rotationmode (
"auto");
6774 if (title_props.positionmode_is (
"auto"))
6779 Matrix bbox = get_extent (
false);
6783 (x_zlim(0) + x_zlim(1))/2);
6788 ext = get_ticklabel_extents (get_xtick ().matrix_value (),
6789 get_xticklabel ().string_vector_value (),
6790 get_xlim ().matrix_value ());
6794 p =
xform.untransform (p(0), p(1), p(2),
true);
6799 title_props.set_positionmode (
"auto");
6806 if (elem_type ==
"xlabel")
6807 update_xlabel_position ();
6808 else if (elem_type ==
"ylabel")
6809 update_ylabel_position ();
6810 else if (elem_type ==
"zlabel")
6811 update_zlabel_position ();
6812 else if (elem_type ==
"title")
6813 update_title_position ();
6814 else if (elem_type ==
"sync")
6820 double xlength,
double ylength,
double zlength)
6822 double xval = xlength / scalefactors(0);
6823 double yval = ylength / scalefactors(1);
6824 double zval = zlength / scalefactors(2);
6828 aspectratios(0) = xval / minval;
6829 aspectratios(1) = yval / minval;
6830 aspectratios(2) = zval / minval;
6835 double pbfactor,
double dafactor,
char limit_type,
bool tight)
6864 Matrix xlimits = get_xlim ().matrix_value ();
6865 Matrix ylimits = get_ylim ().matrix_value ();
6866 Matrix zlimits = get_zlim ().matrix_value ();
6868 double dx = (xlimits(1) - xlimits(0));
6869 double dy = (ylimits(1) - ylimits(0));
6870 double dz = (zlimits(1) - zlimits(0));
6872 Matrix da = get_dataaspectratio ().matrix_value ();
6873 Matrix pba = get_plotboxaspectratio ().matrix_value ();
6875 if (dataaspectratiomode_is (
"auto"))
6877 if (plotboxaspectratiomode_is (
"auto"))
6879 pba =
Matrix (1, 3, 1.0);
6880 plotboxaspectratio.set (pba,
false);
6884 dataaspectratio.set (da,
false);
6886 else if (plotboxaspectratiomode_is (
"auto"))
6889 plotboxaspectratio.set (pba,
false);
6894 bool modified_limits =
false;
6897 if (xlimmode_is (
"auto") && ylimmode_is (
"auto") && zlimmode_is (
"auto"))
6899 modified_limits =
true;
6900 kids = get_children ();
6905 else if (xlimmode_is (
"auto") && ylimmode_is (
"auto"))
6907 modified_limits =
true;
6910 else if (ylimmode_is (
"auto") && zlimmode_is (
"auto"))
6912 modified_limits =
true;
6915 else if (zlimmode_is (
"auto") && xlimmode_is (
"auto"))
6917 modified_limits =
true;
6921 if (modified_limits)
6928 dx = pba(0) * da(0);
6929 dy = pba(1) * da(1);
6930 dz = pba(2) * da(2);
6934 if (xlimmode_is (
"auto"))
6937 xlimits(0) = 0.5 * (xlimits(0) + xlimits(1) - dx);
6938 xlimits(1) = xlimits(0) + dx;
6940 set_xlimmode (
"auto");
6943 if (ylimmode_is (
"auto"))
6946 ylimits(0) = 0.5 * (ylimits(0) + ylimits(1) - dy);
6947 ylimits(1) = ylimits(0) + dy;
6949 set_ylimmode (
"auto");
6952 if (zlimmode_is (
"auto"))
6955 zlimits(0) = 0.5 * (zlimits(0) + zlimits(1) - dz);
6956 zlimits(1) = zlimits(0) + dz;
6958 set_zlimmode (
"auto");
6964 plotboxaspectratio.set (pba,
false);
6985 if (! prop.empty ())
6989 if (prop ==
"fontsize")
6992 get_titlefontsizemultiplier ());
6994 get_labelfontsizemultiplier ());
6996 else if (prop ==
"fontweight")
6997 tval =
get (
"titlefontweight");
7009 txt_renderer.set_font (
get (
"fontname").string_value (),
7010 get (
"fontweight").string_value (),
7011 get (
"fontangle").string_value (),
7012 get (
"__fontsize_points__").double_value () * dpr);
7019 const Matrix& parent_pix_size)
const
7021 Matrix pos = (
internal ? get_position ().matrix_value ()
7022 : get_outerposition ().matrix_value ());
7023 Matrix parent_size (parent_pix_size);
7043 pos(1) = parent_size(1) - pos(1) - pos(3);
7056 for (
int i = 0; i <= 1; i++)
7057 for (
int j = 0; j <= 1; j++)
7058 for (
int k = 0; k <= 1; k++)
7061 j ? yPlaneN : yPlane,
7062 k ? zPlaneN : zPlane,
false);
7071 for (
int i = 0; i < 4; i++)
7075 htext = get_title ();
7077 htext = get_xlabel ();
7079 htext = get_ylabel ();
7081 htext = get_zlabel ();
7090 Matrix text_pos = text_props.get_data_position ();
7091 text_pos =
xform.transform (text_pos(0), text_pos(1), text_pos(2));
7092 if (text_props.get_string ().isempty ())
7094 ext(0) =
std::min (ext(0), text_pos(0));
7095 ext(1) =
std::min (ext(1), text_pos(1));
7096 ext(2) =
std::max (ext(2), text_pos(0));
7097 ext(3) =
std::max (ext(3), text_pos(1));
7101 Matrix text_ext = text_props.get_extent_matrix ();
7107 for (
int j = 0; j < 4; j++)
7110 bool ignore_horizontal =
false;
7111 bool ignore_vertical =
false;
7112 if (only_text_height)
7114 double text_rotation = text_props.get_rotation ();
7115 if (text_rotation == 0. || text_rotation == 180.)
7116 ignore_horizontal =
true;
7117 else if (text_rotation == 90. || text_rotation == 270.)
7118 ignore_vertical =
true;
7121 if (! ignore_horizontal)
7123 ext(0) =
std::min (ext(0), text_pos(0)+text_ext(0));
7125 text_pos(0)+text_ext(0)+text_ext(2));
7128 if (! ignore_vertical)
7131 text_pos(1)-text_ext(1)-text_ext(3));
7132 ext(3) =
std::max (ext(3), text_pos(1)-text_ext(1));
7138 ext(2) = ext(2) - ext(0);
7139 ext(3) = ext(3) - ext(1);
7161 std::ostringstream oss;
7173 std::istringstream iss (valstr);
7177 while (std::getline (iss, tmpstr,
'|'))
7181 if (*valstr.rbegin () ==
'|')
7182 sv.
append (std::string (
""));
7196 axes::properties::set_xticklabel (
const octave_value& val)
7200 set_xticklabelmode (
"manual");
7205 set_xticklabelmode (
"manual");
7211 axes::properties::set_yticklabel (
const octave_value& val)
7215 set_yticklabelmode (
"manual");
7220 set_yticklabelmode (
"manual");
7226 axes::properties::set_zticklabel (
const octave_value& val)
7230 set_zticklabelmode (
"manual");
7235 set_zticklabelmode (
"manual");
7259 std::istringstream iss (valstr);
7263 while (std::getline (iss, tmpstr,
'|'))
7267 if (*valstr.rbegin () ==
'|')
7268 sv.
append (std::string (
""));
7282 axes::properties::set_linestyleorder (
const octave_value& val)
7292 if (units.set (val,
true))
7294 update_units (old_units);
7312 old_units, new_units,
7316 old_units, new_units,
7320 old_units, new_units,
7324 old_units, new_units,
7330 axes::properties::set_fontunits (
const octave_value& val)
7334 if (fontunits.set (val,
true))
7336 update_fontunits (old_fontunits);
7345 double parent_height = get_boundingbox (
true).elem (3);
7346 double fontsz = get_fontsize ();
7356 double fontsz = get_fontsize ();
7357 double parent_height = box_pix_height;
7359 if (fontunits_is (
"normalized") && parent_height <= 0)
7360 parent_height = get_boundingbox (
true).elem (3);
7392 bool use_scale)
const
7398 v(0) = sx.unscale (v(0));
7399 v(1) = sy.unscale (v(1));
7400 v(2) = sz.unscale (v(2));
7411 if (
retval.is_undefined ())
7451 double& min_pos,
double& max_neg,
7459 if (
m.numel () != 4)
7504 axes::properties::update_outerposition (
void)
7506 set_activepositionproperty (
"outerposition");
7508 set_units (
"normalized");
7510 Matrix outerbox = outerposition.get ().matrix_value ();
7512 double outer_left = outerbox(0);
7513 double outer_bottom = outerbox(1);
7514 double outer_width = outerbox(2);
7515 double outer_height = outerbox(3);
7517 double outer_right = outer_width + outer_left;
7518 double outer_top = outer_height + outer_bottom;
7520 Matrix linset = looseinset.get ().matrix_value ();
7521 Matrix tinset = tightinset.get ().matrix_value ();
7523 double left_margin =
std::max (linset(0), tinset(0));
7524 double bottom_margin =
std::max (linset(1), tinset(1));
7525 double right_margin =
std::max (linset(2), tinset(2));
7526 double top_margin =
std::max (linset(3), tinset(3));
7528 double inner_left = outer_left;
7529 double inner_right = outer_right;
7531 if ((left_margin + right_margin) < outer_width)
7533 inner_left += left_margin;
7534 inner_right -= right_margin;
7537 double inner_bottom = outer_bottom;
7538 double inner_top = outer_top;
7540 if ((bottom_margin + top_margin) < outer_height)
7542 inner_bottom += bottom_margin;
7543 inner_top -= top_margin;
7546 double inner_width = inner_right - inner_left;
7547 double inner_height = inner_top - inner_bottom;
7551 innerbox(0) = inner_left;
7552 innerbox(1) = inner_bottom;
7553 innerbox(2) = inner_width;
7554 innerbox(3) = inner_height;
7556 position = innerbox;
7558 set_units (old_units);
7559 update_transform ();
7563 axes::properties::update_position (
void)
7565 set_activepositionproperty (
"position");
7567 set_units (
"normalized");
7569 Matrix innerbox = position.get ().matrix_value ();
7571 double inner_left = innerbox(0);
7572 double inner_bottom = innerbox(1);
7573 double inner_width = innerbox(2);
7574 double inner_height = innerbox(3);
7576 double inner_right = inner_width + inner_left;
7577 double inner_top = inner_height + inner_bottom;
7579 Matrix linset = looseinset.get ().matrix_value ();
7580 Matrix tinset = tightinset.get ().matrix_value ();
7582 double left_margin =
std::max (linset(0), tinset(0));
7583 double bottom_margin =
std::max (linset(1), tinset(1));
7584 double right_margin =
std::max (linset(2), tinset(2));
7585 double top_margin =
std::max (linset(3), tinset(3));
7589 double outer_left = inner_left - left_margin;
7590 double outer_bottom = inner_bottom - bottom_margin;
7591 double outer_right = inner_right + right_margin;
7592 double outer_top = inner_top + top_margin;
7594 double outer_width = outer_right - outer_left;
7595 double outer_height = outer_top - outer_bottom;
7599 outerbox(0) = outer_left;
7600 outerbox(1) = outer_bottom;
7601 outerbox(2) = outer_width;
7602 outerbox(3) = outer_height;
7604 outerposition = outerbox;
7606 set_units (old_units);
7607 update_transform ();
7611 axes::properties::update_looseinset (
void)
7614 set_units (
"normalized");
7616 Matrix linset = looseinset.get ().matrix_value ();
7617 Matrix tinset = tightinset.get ().matrix_value ();
7619 double left_margin =
std::max (linset(0), tinset(0));
7620 double bottom_margin =
std::max (linset(1), tinset(1));
7621 double right_margin =
std::max (linset(2), tinset(2));
7622 double top_margin =
std::max (linset(3), tinset(3));
7624 if (activepositionproperty.is (
"position"))
7626 Matrix innerbox = position.get ().matrix_value ();
7628 double inner_left = innerbox(0);
7629 double inner_bottom = innerbox(1);
7630 double inner_width = innerbox(2);
7631 double inner_height = innerbox(3);
7633 double inner_right = inner_width + inner_left;
7634 double inner_top = inner_height + inner_bottom;
7638 double outer_left = inner_left - left_margin;
7639 double outer_bottom = inner_bottom - bottom_margin;
7640 double outer_right = inner_right + right_margin;
7641 double outer_top = inner_top + top_margin;
7643 double outer_width = outer_right - outer_left;
7644 double outer_height = outer_top - outer_bottom;
7648 outerbox(0) = outer_left;
7649 outerbox(1) = outer_bottom;
7650 outerbox(2) = outer_width;
7651 outerbox(3) = outer_height;
7653 outerposition = outerbox;
7657 Matrix outerbox = outerposition.get ().matrix_value ();
7659 double outer_left = outerbox(0);
7660 double outer_bottom = outerbox(1);
7661 double outer_width = outerbox(2);
7662 double outer_height = outerbox(3);
7664 double outer_right = outer_width + outer_left;
7665 double outer_top = outer_height + outer_bottom;
7667 double inner_left = outer_left;
7668 double inner_right = outer_right;
7670 if ((left_margin + right_margin) < outer_width)
7672 inner_left += left_margin;
7673 inner_right -= right_margin;
7676 double inner_bottom = outer_bottom;
7677 double inner_top = outer_top;
7679 if ((bottom_margin + top_margin) < outer_height)
7681 inner_bottom += bottom_margin;
7682 inner_top -= top_margin;
7685 double inner_width = inner_right - inner_left;
7686 double inner_height = inner_top - inner_bottom;
7690 innerbox(0) = inner_left;
7691 innerbox(1) = inner_bottom;
7692 innerbox(2) = inner_width;
7693 innerbox(3) = inner_height;
7695 position = innerbox;
7698 set_units (old_units);
7699 update_transform ();
7707 axes::properties::calc_tick_sep (
double lo,
double hi)
7719 magform ((hi - lo) / ticint, a, b);
7721 static const double sqrt_2 = sqrt (2.0);
7722 static const double sqrt_10 = sqrt (10.0);
7723 static const double sqrt_50 = sqrt (50.0);
7727 else if (a < sqrt_10)
7729 else if (a < sqrt_50)
7741 axes::properties::get_axis_limits (
double xmin,
double xmax,
7742 double min_pos,
double max_neg,
7743 const bool logscale)
7747 double min_val =
xmin;
7748 double max_val =
xmax;
7773 "axis: omitting non-positive data in log plot");
7776 else if (max_val == 0)
7781 < sqrt (std::numeric_limits<double>::epsilon ()))
7810 if (min_val == 0 && max_val == 0)
7816 else if (
std::abs (min_val - max_val)
7817 < sqrt (std::numeric_limits<double>::epsilon ()))
7819 min_val -= 0.1 *
std::abs (min_val);
7820 max_val += 0.1 *
std::abs (max_val);
7823 double tick_sep = calc_tick_sep (min_val, max_val);
7824 double min_tick =
std::floor (min_val / tick_sep);
7825 double max_tick =
std::ceil (max_val / tick_sep);
7827 min_val =
std::min (min_val, tick_sep * min_tick);
7828 max_val =
std::max (max_val, tick_sep * max_tick);
7841 axes::properties::check_axis_limits (
Matrix &limits,
const Matrix kids,
7842 const bool logscale,
char &update_type)
7848 double eps = std::numeric_limits<double>::epsilon ();
7849 bool do_update =
false;
7850 bool have_children_limits =
false;
7858 have_children_limits =
true;
7862 limits(0) = min_val;
7867 limits(1) = max_val;
7870 if (limits(0) == 0 && limits(1) == 0)
7876 else if (! logscale && (
std::abs (limits(0) - limits(1)) < sqrt (
eps)))
7878 limits(0) -= 0.1 *
std::abs (limits(0));
7879 limits(1) += 0.1 *
std::abs (limits(1));
7883 && (
std::abs (std::log10 (limits(0) / limits(1))) < sqrt (
eps)))
7885 limits(0) = (limits(0) < 0 ? 10.0 * limits(0) : 0.1 * limits(0));
7886 limits(1) = (limits(1) < 0 ? 0.1 * limits(1) : 10.0 * limits(1));
7890 if (logscale && limits(0)*limits(1) <= 0)
7892 if (! have_children_limits)
7899 "Non-positive limit for logarithmic axis ignored\n");
7901 limits(0) = min_pos;
7903 limits(0) = 0.1 * limits(1);
7908 "Non-negative limit for logarithmic axis ignored\n");
7910 limits(1) = max_neg;
7912 limits(1) = 0.1 * limits(0);
7915 if (
std::abs (limits(0) - limits(1)) < sqrt (
eps))
8041 bool limmode_is_auto,
8042 bool tickmode_is_auto,
8052 bool is_negative = lo < 0 && hi < 0;
8063 hi = std::log10 (-lo);
8064 lo = std::log10 (-tmp);
8068 hi = std::log10 (hi);
8069 lo = std::log10 (lo);
8074 if (tickmode_is_auto)
8086 tick_sep = calc_tick_sep (lo, hi);
8091 if (limmode_is_auto)
8095 tmp_lims(0) =
std::min (tick_sep * i1, lo);
8096 tmp_lims(1) =
std::max (tick_sep * i2, hi);
8100 tmp_lims(0) =
std::pow (10., tmp_lims(0));
8101 tmp_lims(1) =
std::pow (10., tmp_lims(1));
8102 if (tmp_lims(0) <= 0)
8106 double tmp = tmp_lims(0);
8107 tmp_lims(0) = -tmp_lims(1);
8116 if (i1*tick_sep < lo)
8118 if (i2*tick_sep > hi && i2 > i1)
8122 tmp_ticks =
Matrix (1, i2-i1+1);
8123 for (
int i = 0; i <= static_cast<int> (i2-i1); i++)
8125 tmp_ticks(i) = tick_sep * (i+i1);
8127 tmp_ticks(i) =
std::pow (10., tmp_ticks(i));
8129 if (is_logscale && is_negative)
8131 Matrix rev_ticks (1, i2-i1+1);
8132 rev_ticks = -tmp_ticks;
8133 for (
int i = 0; i <= static_cast<int> (i2-i1); i++)
8134 tmp_ticks(i) = rev_ticks(i2-i1-i);
8147 int n = (is_logscale ? 8 : 4);
8148 double mult_below = (is_logscale ? tmp_ticks(1) / tmp_ticks(0) : 1);
8149 double mult_above = (is_logscale ? tmp_ticks(n_ticks-1) / tmp_ticks(n_ticks-2)
8152 double d_below = (tmp_ticks(1) - tmp_ticks(0)) / mult_below / (
n+1);
8153 int n_below =
static_cast<int> (
std::floor ((tmp_ticks(0)-lo_lim) / d_below));
8156 int n_between =
n * (n_ticks - 1);
8157 double d_above = (tmp_ticks(n_ticks-1) - tmp_ticks(n_ticks-2)) * mult_above
8159 int n_above =
static_cast<int> (
std::floor ((hi_lim-tmp_ticks(n_ticks-1))
8164 Matrix tmp_mticks (1, n_below + n_between + n_above);
8165 for (
int i = 0; i < n_below; i++)
8166 tmp_mticks(i) = tmp_ticks(0) - (n_below-i) * d_below;
8167 for (
int i = 0; i < n_ticks-1; i++)
8169 double d = (tmp_ticks(i+1) - tmp_ticks(i)) / (
n + 1);
8170 for (
int j = 0; j <
n; j++)
8171 tmp_mticks(n_below+
n*i+j) = tmp_ticks(i) +
d * (j+1);
8173 for (
int i = 0; i < n_above; i++)
8174 tmp_mticks(n_below+n_between+i) = tmp_ticks(n_ticks-1) + (i + 1) * d_above;
8176 mticks = tmp_mticks;
8195 const bool is_origin,
8196 const int other_axislocation,
8202 std::ostringstream os;
8206 if (get_is2D () && is_origin)
8208 if (other_axislocation == 0)
8213 else if (other_axislocation == 1)
8214 omit_ticks(0) = lims(1);
8215 else if (other_axislocation == -1)
8216 omit_ticks(0) = lims(0);
8219 omit_ticks(1) = lims(0);
8220 omit_ticks(2) = lims(1);
8228 double exp_max = 0.0;
8229 double exp_min = 0.0;
8231 for (
int i = 0; i < values.
numel (); i++)
8233 double exp = std::log10 (values(i));
8238 for (
int i = 0; i < values.
numel (); i++)
8240 bool omit_tick =
false;
8241 for (
int i_omit = 0; i_omit < omit_ticks.numel (); i_omit++)
8242 if (values(i) == omit_ticks(i_omit))
8250 if (values(i) < 0.0)
8251 exponent =
std::floor (std::log10 (-values(i)));
8253 exponent =
std::floor (std::log10 (values(i)));
8254 significand = values(i) *
std::pow (10., -exponent);
8258 10*std::numeric_limits<double>::epsilon())
8259 os << significand <<
'x';
8260 else if (significand < 0)
8268 exponent = -exponent;
8270 if (exponent < 10. && (exp_max > 9 || exp_min < -9))
8272 os << exponent <<
'}';
8274 if (ticklabelinterpreter.is (
"latex"))
8275 c(i) =
"$" + os.str () +
"$";
8282 for (
int i = 0; i < values.
numel (); i++)
8284 bool omit_tick =
false;
8285 for (
int i_omit = 0; i_omit < omit_ticks.numel (); i_omit++)
8286 if (values(i) == omit_ticks(i_omit))
8303 axes::properties::get_ticklabel_extents (
const Matrix& ticks,
8312 for (
int i = 0; i <
n; i++)
8314 double val = ticks(i);
8315 if (limits(0) <= val && val <= limits(1))
8317 std::string label (ticklabels(i));
8318 label.erase (0, label.find_first_not_of (
' '));
8319 label = label.substr (0, label.find_last_not_of (
' ')+1);
8321 if (txt_renderer.ok ())
8328 ext = txt_renderer.get_extent (label, 0.0,
8329 get_ticklabelinterpreter ());
8331 wmax =
std::max (wmax, ext(0) / dpr);
8332 hmax =
std::max (hmax, ext(1) / dpr);
8338 int len = label.length ();
8353 double& min_pos,
double& max_neg,
8354 const Matrix& kids,
char limit_type)
8454 char update_type = 0;
8459 #define FIX_LIMITS \
8461 if (octave::math::isfinite (val)) \
8464 if (octave::math::isfinite (val)) \
8467 if (axis_type ==
"xdata" || axis_type ==
"xscale"
8468 || axis_type ==
"xlimmode" || axis_type ==
"xliminclude"
8469 || axis_type ==
"xlim")
8479 limits =
xproperties.get_axis_limits (min_val, max_val,
8488 else if (axis_type ==
"ydata" || axis_type ==
"yscale"
8489 || axis_type ==
"ylimmode" || axis_type ==
"yliminclude"
8490 || axis_type ==
"ylim")
8500 limits =
xproperties.get_axis_limits (min_val, max_val,
8509 else if (axis_type ==
"zdata" || axis_type ==
"zscale"
8510 || axis_type ==
"zlimmode" || axis_type ==
"zliminclude"
8511 || axis_type ==
"zlim")
8522 std::numeric_limits<double>::epsilon ());
8524 limits =
xproperties.get_axis_limits (min_val, max_val,
8535 std::numeric_limits<double>::epsilon ());
8542 else if (axis_type ==
"cdata" || axis_type ==
"climmode"
8543 || axis_type ==
"cdatamapping" || axis_type ==
"climinclude"
8544 || axis_type ==
"clim")
8553 if (min_val > max_val)
8555 min_val = min_pos = 0;
8558 else if (min_val == max_val)
8560 max_val = min_val + 1;
8564 limits(0) = min_val;
8565 limits(1) = max_val;
8570 else if (axis_type ==
"alphadata" || axis_type ==
"alimmode"
8571 || axis_type ==
"alphadatamapping" || axis_type ==
"aliminclude"
8572 || axis_type ==
"alim")
8581 if (min_val > max_val)
8583 min_val = min_pos = 0;
8586 else if (min_val == max_val)
8587 max_val = min_val + 1;
8589 limits(0) = min_val;
8590 limits(1) = max_val;
8604 switch (update_type)
8666 char update_type = 0;
8670 if (axis_type ==
"xdata" || axis_type ==
"xscale"
8671 || axis_type ==
"xlimmode" || axis_type ==
"xliminclude"
8672 || axis_type ==
"xlim")
8679 limits =
xproperties.get_axis_limits (min_val, max_val,
8691 else if (axis_type ==
"ydata" || axis_type ==
"yscale"
8692 || axis_type ==
"ylimmode" || axis_type ==
"yliminclude"
8693 || axis_type ==
"ylim")
8700 limits =
xproperties.get_axis_limits (min_val, max_val,
8712 else if (axis_type ==
"zdata" || axis_type ==
"zscale"
8713 || axis_type ==
"zlimmode" || axis_type ==
"zliminclude"
8714 || axis_type ==
"zlim")
8722 std::numeric_limits<double>::epsilon ());
8725 limits =
xproperties.get_axis_limits (min_val, max_val,
8736 std::numeric_limits<double>::epsilon ());
8744 else if (axis_type ==
"cdata" || axis_type ==
"climmode"
8745 || axis_type ==
"cdatamapping" || axis_type ==
"climinclude"
8746 || axis_type ==
"clim")
8752 if (min_val > max_val)
8754 min_val = min_pos = 0;
8757 else if (min_val == max_val)
8759 max_val = min_val + 1;
8765 limits(0) = min_val;
8766 limits(1) = max_val;
8772 else if (axis_type ==
"alphadata" || axis_type ==
"alimmode"
8773 || axis_type ==
"alphadatamapping" || axis_type ==
"aliminclude"
8774 || axis_type ==
"alim")
8780 if (min_val > max_val)
8782 min_val = min_pos = 0;
8785 else if (min_val == max_val)
8786 max_val = min_val + 1;
8790 limits(0) = min_val;
8791 limits(1) = max_val;
8804 switch (update_type)
8863 double lo = lims(0);
8864 double hi = lims(1);
8866 bool is_negative = lo < 0 && hi < 0;
8873 hi = std::log10 (-lo);
8874 lo = std::log10 (-tmp);
8875 val = std::log10 (-val);
8879 hi = std::log10 (hi);
8880 lo = std::log10 (lo);
8881 val = std::log10 (val);
8886 lo = val + (lo - val) / factor;
8887 hi = val + (hi - val) / factor;
8912 double x,
double y,
double factor,
8913 bool push_to_zoom_stack)
8916 Matrix xlims = get_xlim ().matrix_value ();
8917 Matrix ylims = get_ylim ().matrix_value ();
8920 Matrix kids = get_children ();
8933 xlims =
do_zoom (
x, factor, xlims, xscale_is (
"log"));
8934 ylims =
do_zoom (y, factor, ylims, yscale_is (
"log"));
8936 zoom (mode, xlims, ylims, push_to_zoom_stack);
8941 bool push_to_zoom_stack)
8944 Matrix xlims = get_xlim ().matrix_value ();
8945 Matrix ylims = get_ylim ().matrix_value ();
8947 double x = (xlims(0) + xlims(1)) / 2;
8948 double y = (ylims(0) + ylims(1)) / 2;
8950 zoom_about_point (mode,
x, y, factor, push_to_zoom_stack);
8956 if (zoom_stack.empty ())
8958 zoom_stack.push_front (xlimmode.get ());
8959 zoom_stack.push_front (xlim.get ());
8960 zoom_stack.push_front (ylimmode.get ());
8961 zoom_stack.push_front (ylim.get ());
8962 zoom_stack.push_front (zlimmode.get ());
8963 zoom_stack.push_front (zlim.get ());
8964 zoom_stack.push_front (view.get ());
8971 bool push_to_zoom_stack)
8973 if (xl(0) == xl(1) || yl(0) == yl(1))
8975 warning (
"invalid zoom region");
8979 if (push_to_zoom_stack)
8982 if (mode ==
"horizontal" || mode ==
"both")
8985 xlimmode =
"manual";
8988 if (mode ==
"vertical" || mode ==
"both")
8991 ylimmode =
"manual";
8994 update_transform ();
8996 if (mode ==
"horizontal" || mode ==
"both")
8999 if (mode ==
"vertical" || mode ==
"both")
9008 double lo = lims(0);
9009 double hi = lims(1);
9011 bool is_negative = lo < 0 && hi < 0;
9020 hi = std::log10 (-lo);
9021 lo = std::log10 (-tmp);
9027 hi = std::log10 (hi);
9028 lo = std::log10 (lo);
9031 delta = std::log10 (x0) - std::log10 (x1);
9065 double x0,
double x1,
double y0,
double y1,
9066 bool push_to_zoom_stack)
9069 Matrix xlims = get_xlim ().matrix_value ();
9070 Matrix ylims = get_ylim ().matrix_value ();
9073 Matrix kids = get_children ();
9086 xlims =
do_translate (x0, x1, xlims, xscale_is (
"log"));
9087 ylims =
do_translate (y0, y1, ylims, yscale_is (
"log"));
9089 zoom (mode, xlims, ylims, push_to_zoom_stack);
9094 bool push_to_zoom_stack)
9097 Matrix xlims = get_xlim ().matrix_value ();
9098 Matrix ylims = get_ylim ().matrix_value ();
9100 double x0 = (xlims(0) + xlims(1)) / 2;
9101 double y0 = (ylims(0) + ylims(1)) / 2;
9103 double x1 = x0 + (xlims(1) - xlims(0)) * factor;
9104 double y1 = y0 + (ylims(1) - ylims(0)) * factor;
9106 translate_view (mode, x0, x1, y0, y1, push_to_zoom_stack);
9111 bool push_to_zoom_stack)
9113 if (push_to_zoom_stack)
9116 Matrix bb = get_boundingbox (
true);
9117 Matrix new_view = get_view ().matrix_value ();
9120 new_view(0) += ((x0 - x1) * (180.0 / bb(2)));
9121 new_view(1) += ((y1 - y0) * (180.0 / bb(3)));
9124 new_view(1) =
std::min (new_view(1), 90.0);
9125 new_view(1) =
std::max (new_view(1), -90.0);
9126 if (new_view(0) > 180.0)
9127 new_view(0) -= 360.0;
9128 else if (new_view(0) < -180.0)
9129 new_view(0) += 360.0;
9132 double snapmargin = 1.0;
9133 for (
int a = -90; a <= 90; a += 90)
9135 if ((a - snapmargin) < new_view(1) && new_view(1) < (a + snapmargin))
9142 for (
int a = -180; a <= 180; a += 180)
9143 if ((a - snapmargin) < new_view(0) && new_view(0) < (a + snapmargin))
9153 set_view (new_view);
9158 bool push_to_zoom_stack)
9160 if (push_to_zoom_stack)
9172 v(0) = fmod (v(0) - delta_az + 720,360);
9176 update_transform ();
9182 if (zoom_stack.size () >= 7)
9184 view = zoom_stack.front ();
9185 zoom_stack.pop_front ();
9187 zlim = zoom_stack.front ();
9188 zoom_stack.pop_front ();
9190 zlimmode = zoom_stack.front ();
9191 zoom_stack.pop_front ();
9193 ylim = zoom_stack.front ();
9194 zoom_stack.pop_front ();
9196 ylimmode = zoom_stack.front ();
9197 zoom_stack.pop_front ();
9199 xlim = zoom_stack.front ();
9200 zoom_stack.pop_front ();
9202 xlimmode = zoom_stack.front ();
9203 zoom_stack.pop_front ();
9205 update_transform ();
9237 fig.
set (
"currentaxes", kidsarray(0));
9242 base_properties::update_handlevisibility ();
9246 figure::properties::init_toolkit (
void)
9257 size_t items_to_leave_on_stack = (do_unzoom ? 7 : 0);
9259 while (zoom_stack.size () > items_to_leave_on_stack)
9260 zoom_stack.pop_front ();
9267 axes::properties::trigger_normals_calc (
void)
9270 std::list<graphics_object> children_list;
9271 std::list<graphics_object>::iterator children_list_iter;
9272 get_children_of_type (
"patch",
false,
true, children_list);
9273 get_children_of_type (
"surface",
false,
true, children_list);
9276 for (children_list_iter = children_list.begin ();
9277 children_list_iter != children_list.end (); children_list_iter++)
9280 if (kid.
isa (
"patch"))
9284 patch_props.update_normals (
false);
9290 surface_props.update_normals (
false);
9327 line::properties::compute_xlim (
void)
const
9331 m(0) = xdata.min_val ();
9332 m(1) = xdata.max_val ();
9333 m(2) = xdata.min_pos ();
9334 m(3) = xdata.max_neg ();
9340 line::properties::compute_ylim (
void)
const
9344 m(0) = ydata.min_val ();
9345 m(1) = ydata.max_val ();
9346 m(2) = ydata.min_pos ();
9347 m(3) = ydata.max_neg ();
9355 text::properties::get_data_position (
void)
const
9357 Matrix pos = get_position ().matrix_value ();
9359 if (! units_is (
"data"))
9366 text::properties::get_extent_matrix (
void)
const
9369 return extent.get ().matrix_value ();
9373 text::properties::get_extent (
void)
const
9377 Matrix m = extent.get ().matrix_value ();
9378 Matrix pos = get_position ().matrix_value ();
9389 bbox(ii) = bbox(ii) / dpr;
9395 text::properties::set_fontunits (
const octave_value& val)
9399 if (fontunits.set (val,
true))
9401 update_fontunits (old_fontunits);
9410 double parent_height = 0;
9411 double fontsz = get_fontsize ();
9413 if (new_units ==
"normalized" || old_units ==
"normalized")
9440 txt_renderer.set_font (
get (
"fontname").string_value (),
9441 get (
"fontweight").string_value (),
9442 get (
"fontangle").string_value (),
9443 get (
"__fontsize_points__").double_value () * dpr);
9445 txt_renderer.set_anti_aliasing (is_fontsmoothing ());
9447 Matrix c = get_color_rgb ();
9449 txt_renderer.set_color (c);
9459 if (horizontalalignment_is (
"center"))
9461 else if (horizontalalignment_is (
"right"))
9464 if (verticalalignment_is (
"middle"))
9466 else if (verticalalignment_is (
"top"))
9468 else if (verticalalignment_is (
"baseline"))
9470 else if (verticalalignment_is (
"cap"))
9486 txt_renderer.text_to_pixels (sv.
join (
"\n"), pixels, bbox,
9487 halign, valign, get_rotation (),
9488 get_interpreter ());
9495 if (__autopos_tag___is (
"xlabel") || __autopos_tag___is (
"ylabel")
9496 || __autopos_tag___is (
"zlabel") || __autopos_tag___is (
"title"))
9497 update_autopos (
"sync");
9501 text::properties::request_autopos (
void)
9503 if (__autopos_tag___is (
"xlabel") || __autopos_tag___is (
"ylabel")
9504 || __autopos_tag___is (
"zlabel") || __autopos_tag___is (
"title"))
9505 update_autopos (get___autopos_tag__ ());
9511 if (! units_is (
"data"))
9513 set_xliminclude (
"off");
9514 set_yliminclude (
"off");
9515 set_zliminclude (
"off");
9518 Matrix pos = get_position ().matrix_value ();
9525 bool autopos = positionmode_is (
"auto");
9530 set_positionmode (
"auto");
9532 if (units_is (
"data"))
9534 set_xliminclude (
"on");
9535 set_yliminclude (
"on");
9537 set_zliminclude (
"off");
9540 cached_units = get_units ();
9546 double fontsz = get_fontsize ();
9547 double parent_height = box_pix_height;
9554 if (fontunits_is (
"normalized") && parent_height <= 0)
9569 return convert_cdata (*
this, get_cdata (), cdatamapping_is (
"scaled"), 3);
9582 parent_axes_prop.trigger_normals_calc ();
9586 light::properties::update_visible (
void)
9624 return convert_cdata (*
this, fvc, cdatamapping_is (
"scaled"), 2);
9630 patch::properties::update_fvc (
void)
9635 Matrix xd = get_xdata ().matrix_value ();
9636 Matrix yd = get_ydata ().matrix_value ();
9637 Matrix zd = get_zdata ().matrix_value ();
9638 NDArray cd = get_cdata ().array_value ();
9644 bad_data_msg =
"x/y/zdata must have the same dimensions";
9653 if (nr == 1 && nc > 1)
9679 vert(kk,0) = xd(ii,jj);
9680 vert(kk,1) = yd(ii,jj);
9682 vert(kk,2) = zd(ii,jj);
9684 idx(jj,ii) =
static_cast<double> (kk+1);
9692 if (cd.
ndims () == 3)
9695 dv(1) = cd.
dims ()(2);
9708 vertices.set (vert);
9709 facevertexcdata.set (fvc);
9718 double tol = 100 * std::numeric_limits<double>::epsilon ();
9719 EIG eig (cov,
false,
false,
true);
9721 return ev.
min () <= tol * ev.
max ();
9724 std::vector<octave_idx_type>
9728 std::vector<octave_idx_type> coplanar_ends;
9732 plane_pivot(0,i) = vert(idx(0,jj)-1,i);
9750 fc(j-1,i) = vert(idx(j,jj)-1,i) - plane_pivot(i);
9755 coplanar_ends.push_back (nc - 1);
9756 return coplanar_ends;
9766 while (i_start < nc - 1)
9768 i_end = i_start + 2;
9771 coplanar_ends.push_back (nc - 1);
9783 fc(j,i) = vert(idx(j+i_start,jj)-1,i) - plane_pivot(i);
9800 fa(0,i) = vert(idx(i_end,jj)-1,i) - plane_pivot(i);
9804 i_start = i_end - 1;
9805 coplanar_ends.push_back (i_start);
9807 return coplanar_ends;
9811 patch::properties::update_data (
void)
9817 Matrix vert = get_vertices ().matrix_value ();
9818 NDArray fvc = get_facevertexcdata ().array_value ();
9825 if (
static_cast<double> (nvert) < idx.
row_max ().
max ())
9827 bad_data_msg = R
"(some vertices in "faces" property are undefined)";
9836 double valid_vert = idx(0,jj);
9837 bool turn_valid =
false;
9842 idx(ii,jj) = valid_vert;
9846 valid_vert = idx(ii,jj);
9852 int fcmax = idx.
rows ();
9853 if (fcmax > 3 && vert.
columns () > 2
9854 && ! (facecolor_is (
"none") && edgecolor_is (
"none")))
9856 coplanar_last_idx.resize (idx.
columns ());
9869 bool is_unclosed =
false;
9888 coplanar_last_idx.resize (0);
9893 bool pervertex =
false;
9895 if (fvc.
rows () == nfaces || fvc.
rows () == 1)
9898 dv(1) = fvc.
rows ();
9906 dv(0) = idx.
rows ();
9918 bool has_zd =
false;
9930 xd(ii,jj) = vert(row,0);
9931 yd(ii,jj) = vert(row,1);
9934 zd(ii,jj) = vert(row,2);
9937 for (
int kk = 0; kk < fvc.
columns (); kk++)
9938 cd(ii,jj,kk) = fvc(row,kk);
9943 update_normals (
true);
9957 double x2,
double y2,
double z2,
9958 double&
x,
double& y,
double& z)
9960 x += (y1 * z2 - z1 * y2);
9961 y += (z1 * x2 - x1 * z2);
9962 z += (x1 * y2 - y1 * x2);
9966 patch::properties::calc_face_normals (
Matrix& fn)
9969 Matrix f = get_faces ().matrix_value ();
9971 bool is_3D = (v.
columns () == 3);
9988 if (coplanar_last_idx.size () > 0 && coplanar_last_idx[i].size () > 1)
10000 double& nx = fnc(0);
10001 double& ny = fnc(1);
10002 double& nz = fnc(2);
10007 i1 =
f(i,0) - 1; i2 =
f(i,1) - 1; i3 =
f(i,nc-1) - 1;
10011 (v(i3,0) - v(i1,0), v(i3,1) - v(i1,1), v(i3,2) - v(i1,2),
10012 v(i2,0) - v(i1,0), v(i2,1) - v(i1,1), v(i2,2) - v(i1,2),
10016 nz = (v(i2,0) - v(i1,0)) * (v(i3,1) - v(i1,1)) -
10017 (v(i2,1) - v(i1,1)) * (v(i3,0) - v(i1,0));
10019 nz = (nz < 0) ? -nz : nz;
10029 j1 = nc - 1; j2 = 0;
10030 i1 =
f(i,j1) - 1; i2 =
f(i,j2) - 1;
10032 nx = (v(i2,1) - v(i1,1)) * (v(i1,2) + v(i2,2));
10033 ny = (v(i2,2) - v(i1,2)) * (v(i1,0) + v(i2,0));
10034 nz = (v(i2,0) - v(i1,0)) * (v(i1,1) + v(i2,1));
10039 i1 =
f(i,j1) - 1; i2 =
f(i,j2) - 1;
10041 nx += (v(i2,1) - v(i1,1)) * (v(i1,2) + v(i2,2));
10042 ny += (v(i2,2) - v(i1,2)) * (v(i1,0) + v(i2,0));
10043 nz += (v(i2,0) - v(i1,0)) * (v(i1,1) + v(i2,1));
10048 double n_len = sqrt (nx*nx+ny*ny+nz*nz);
10051 if ( n_len < std::numeric_limits<double>::epsilon () )
10056 fn(i,j) = fnc(j) / n_len;
10061 patch::properties::update_face_normals (
bool reset,
bool force)
10066 if (force || ((facelighting_is (
"flat") || edgelighting_is (
"flat"))
10067 && get_do_lighting ()))
10069 Matrix f = get_faces ().matrix_value ();
10072 Matrix fn (num_f, 3, 0.0);
10074 calc_face_normals (fn);
10078 facenormals =
Matrix ();
10082 patch::properties::update_vertex_normals (
bool reset,
bool force)
10087 if (force || ((facelighting_is (
"gouraud") || facelighting_is (
"phong")
10088 || edgelighting_is (
"gouraud") || edgelighting_is (
"phong"))
10089 && get_do_lighting ()))
10091 Matrix v = get_vertices ().matrix_value ();
10092 Matrix f = get_faces ().matrix_value ();
10103 Matrix fn = get_facenormals ().matrix_value ();
10107 fn =
Matrix (num_f, 3, 0.0);
10108 calc_face_normals (fn);
10120 std::vector<std::vector<RowVector>> vec_vn (num_v);
10137 Matrix vn (num_v, 3, 0.0);
10140 std::vector<RowVector>::iterator it = vec_vn[i].begin ();
10145 if (it != vec_vn[i].end ())
10156 for (++it; it != vec_vn[i].end (); ++it)
10161 double dir = (vn0(0)*vn1(0) + vn0(1)*vn1(1) + vn0(2)*vn1(2) < 0) ? -1 : 1;
10163 vn0(j) += dir * vn1(j);
10167 double n_len = sqrt (vn0(0)*vn0(0)+vn0(1)*vn0(1)+vn0(2)*vn0(2));
10171 vn(i,j) = vn0(j)/n_len;
10175 vertexnormals = vn;
10178 vertexnormals =
Matrix ();
10211 return convert_cdata (*
this, get_cdata (), cdatamapping_is (
"scaled"), 3);
10229 surface::properties::update_face_normals (
bool reset,
bool force)
10231 if (! facenormalsmode_is (
"auto"))
10234 if (force || ((facelighting_is (
"flat") || edgelighting_is (
"flat"))
10235 && get_do_lighting ()))
10237 Matrix x = get_xdata ().matrix_value ();
10238 Matrix y = get_ydata ().matrix_value ();
10239 Matrix z = get_zdata ().matrix_value ();
10250 if (
x.columns () != p || y.
rows () != q)
10253 bool x_mat = (
x.rows () == q);
10254 bool y_mat = (y.
columns () == p);
10258 int i1, i2, j1, j2;
10261 double x0, x1, x2, x3, y0, y1, y2, y3, z0, z1, z2, z3;
10262 double x1m0, x2m1, x3m2, x0m3, y1m0, y2m1, y3m2, y0m3;
10263 double x1p0, x2p1, x3p2, x0p3, y1p0, y2p1, y3p2, y0p3;
10265 x2m1 = x0m3 = y1m0 = y3m2 = 0;
10268 x1p0 = x3p2 = y2p1 = y0p3 = 1;
10271 for (
int i = 0; i < p-1; i++)
10276 for (
int j = 0; j < q-1; j++)
10281 if (x_mat || y_mat)
10283 x0 =
x(x_mat?j1:0,y_mat?i1:0);
10284 x1 =
x(x_mat?j1:0,y_mat?i2:0);
10285 x2 =
x(x_mat?j2:0,y_mat?i2:0);
10286 x3 =
x(x_mat?j2:0,y_mat?i1:0);
10295 y0 = y(x_mat?j1:0,y_mat?i1:0);
10296 y1 = y(x_mat?j1:0,y_mat?i2:0);
10297 y2 = y(x_mat?j2:0,y_mat?i2:0);
10298 y3 = y(x_mat?j2:0,y_mat?i1:0);
10309 double& nx =
n(j,i,0);
10310 double& ny =
n(j,i,1);
10311 double& nz =
n(j,i,2);
10321 nx = y1m0 * (z1 + z0) + y2m1 * (z2 + z1)
10322 + y3m2 * (z3 + z2) + y0m3 * (z0 + z3);
10323 ny = (z1 - z0) * x1p0 + (z2 - z1) * x2p1
10324 + (z3 - z2) * x3p2 + (z0 - z3) * x0p3;
10325 nz = x1m0 * y1p0 + x2m1 * y2p1 + x3m2 * y3p2 + x0m3 * y0p3;
10337 facenormals =
Matrix ();
10341 surface::properties::update_vertex_normals (
bool reset,
bool force)
10343 if (! vertexnormalsmode_is (
"auto"))
10346 if (force || ((facelighting_is (
"gouraud") || facelighting_is (
"phong")
10347 || edgelighting_is (
"gouraud") || edgelighting_is (
"phong"))
10348 && get_do_lighting ()))
10350 Matrix x = get_xdata ().matrix_value ();
10351 Matrix y = get_ydata ().matrix_value ();
10352 Matrix z = get_zdata ().matrix_value ();
10363 if (
x.columns () != p || y.
rows () != q)
10368 bool x_mat = (
x.rows () == q);
10369 bool y_mat = (y.
columns () == p);
10371 int i1, i2, i3, j1, j2, j3;
10375 for (
int i = 0; i < p; i++)
10384 for (
int j = 0; j < q; j++)
10393 double& nx =
n(j, i, 0);
10394 double& ny =
n(j, i, 1);
10395 double& nz =
n(j, i, 2);
10397 if ((j > 0) && (i > 0))
10400 (
x(j1,i-1)-
x(j2,i), y(j-1,i1)-y(j,i2), z(j-1,i-1)-z(j,i),
10401 x(j2,i-1)-
x(j1,i), y(j,i1)-y(j-1,i2), z(j,i-1)-z(j-1,i),
10404 if ((j > 0) && (i < (p -1)))
10407 (
x(j1,i+1)-
x(j2,i), y(j-1,i3)-y(j,i2), z(j-1,i+1)-z(j,i),
10408 x(j1,i)-
x(j2,i+1), y(j-1,i2)-y(j,i3), z(j-1,i)-z(j,i+1),
10411 if ((j < (q - 1)) && (i > 0))
10414 (
x(j2,i-1)-
x(j3,i), y(j,i1)-y(j+1,i2), z(j,i-1)-z(j+1,i),
10415 x(j3,i-1)-
x(j2,i), y(j+1,i1)-y(j,i2), z(j+1,i-1)-z(j,i),
10418 if ((j < (q - 1)) && (i < (p -1)))
10421 (
x(j3,i)-
x(j2,i+1), y(j+1,i2)-y(j,i3), z(j+1,i)-z(j,i+1),
10422 x(j3,i+1)-
x(j2,i), y(j+1,i3)-y(j,i2), z(j+1,i+1)-z(j,i),
10435 vertexnormals =
Matrix ();
10438 DEFMETHOD (__update_normals__, interp, args, ,
10446 gh_manager& gh_mgr = interp.get_gh_manager ();
10450 if (args.length () != 1)
10457 if (go.
isa (
"surface"))
10461 props.update_normals (
false,
true);
10463 else if (go.
isa (
"patch"))
10467 props.update_normals (
false,
true);
10470 error (
"__update_normals__: "
10471 "H must be a handle to a valid surface or patch object.");
10598 char update_type = 0;
10600 if (axis_type ==
"xlim" || axis_type ==
"xliminclude")
10605 else if (axis_type ==
"ylim" || axis_type ==
"yliminclude")
10610 else if (axis_type ==
"zlim" || axis_type ==
"zliminclude")
10615 else if (axis_type ==
"clim" || axis_type ==
"climinclude")
10620 else if (axis_type ==
"alim" || axis_type ==
"aliminclude")
10626 if (limits.
numel () == 4)
10644 limits(0) = min_val;
10645 limits(1) = max_val;
10646 limits(2) = min_pos;
10647 limits(3) = max_neg;
10657 if (limits(0) != min_val || limits(1) != max_val
10658 || limits(2) != min_pos || limits(3) != max_neg)
10660 limits(0) = min_val;
10661 limits(1) = max_val;
10662 limits(2) = min_pos;
10663 limits(3) = max_neg;
10665 switch (update_type)
10709 char update_type = 0;
10711 if (axis_type ==
"xlim" || axis_type ==
"xliminclude")
10717 else if (axis_type ==
"ylim" || axis_type ==
"yliminclude")
10723 else if (axis_type ==
"zlim" || axis_type ==
"zliminclude")
10729 else if (axis_type ==
"clim" || axis_type ==
"climinclude")
10735 else if (axis_type ==
"alim" || axis_type ==
"aliminclude")
10749 limits(0) = min_val;
10750 limits(1) = max_val;
10751 limits(2) = min_pos;
10752 limits(3) = max_neg;
10754 switch (update_type)
10789 if (beingdeleted.is (
"on"))
10794 std::list<graphics_handle> lst = get_dependent_obj_list ();
10796 for (
auto& hobj : lst)
10801 && go.
get (
"uicontextmenu") == get___myhandle__ ())
10837 uicontrol::properties::get_extent (
void)
const
10839 Matrix m = extent.get ().matrix_value ();
10853 uicontrol::properties::update_text_extent (
void)
10868 Matrix pos = get_position ().matrix_value ();
10879 set_position (pos);
10881 cached_units = get_units ();
10885 uicontrol::properties::set_style (
const octave_value& st)
10893 bool was_button = style_is (
"radiobutton") || style_is (
"togglebutton");
10895 bool now_button = style_is (
"radiobutton") || style_is (
"togglebutton");
10899 if (! was_button && now_button && ! props.get_selectedobject ().ok ())
10901 props.set_selectedobject (get___myhandle__ ().value ());
10904 else if (was_button && ! now_button
10905 && (props.get_selectedobject ().value ()
10906 == get___myhandle__ ().value ()))
10907 props.set_selectedobject (
Matrix ());
10911 bool modified = style.
set (st,
true,
false);
10916 if (style_is (
"listbox") || style_is (
"popupmenu"))
10918 Matrix v = value.get ().matrix_value ();
10919 if (v.
numel () == 1 && v(0) == 0)
10928 go.
update (style.get_id ());
10934 const Matrix& parent_pix_size)
const
10936 Matrix pos = get_position ().matrix_value ();
10937 Matrix parent_size (parent_pix_size);
10956 pos(1) = parent_size(1) - pos(1) - pos(3);
10962 uicontrol::properties::set_fontunits (
const octave_value& val)
10966 if (fontunits.set (val,
true))
10968 update_fontunits (old_fontunits);
10977 double parent_height = get_boundingbox (
false).elem (3);
10978 double fontsz = get_fontsize ();
10988 double fontsz = get_fontsize ();
10989 double parent_height = box_pix_height;
10991 if (fontunits_is (
"normalized") && parent_height <= 0)
10992 parent_height = get_boundingbox (
false).elem (3);
11001 const Matrix& parent_pix_size)
const
11003 Matrix pos = get_position ().matrix_value ();
11004 Matrix parent_size (parent_pix_size);
11020 pos(1) = parent_size(1) - pos(1) - pos(3);
11024 double outer_height = pos(3);
11026 pos(0) = pos(1) = 0;
11028 if (! bordertype_is (
"none"))
11030 double bw = get_borderwidth ();
11033 if (bordertype_is (
"etchedin") || bordertype_is (
"etchedout"))
11036 pos(0) += mul * bw;
11037 pos(1) += mul * bw;
11038 pos(2) -= 2 * mul * bw;
11039 pos(3) -= 2 * mul * bw;
11042 if (! get_title ().empty ())
11044 double fontsz = get_fontsize ();
11046 if (! fontunits_is (
"pixels"))
11050 if (fontunits_is (
"points"))
11051 fontsz *= (res / 72.0);
11052 else if (fontunits_is (
"inches"))
11054 else if (fontunits_is (
"centimeters"))
11055 fontsz *= (res / 2.54);
11056 else if (fontunits_is (
"normalized"))
11057 fontsz *= outer_height;
11060 if (titleposition_is (
"lefttop") || titleposition_is (
"centertop")
11061 || titleposition_is (
"righttop"))
11062 pos(1) += (fontsz / 2);
11063 pos(3) -= (fontsz / 2);
11071 uibuttongroup::properties::set_position (
const octave_value& v)
11074 bool modified =
false;
11076 old_bb = get_boundingbox (
true);
11077 modified = position.set (v,
false);
11078 new_bb = get_boundingbox (
true);
11080 if (old_bb != new_bb)
11082 if (old_bb(2) != new_bb(2) || old_bb(3) != new_bb(3))
11087 if (! get_resizefcn ().isempty ())
11090 if (! get_sizechangedfcn ().isempty ())
11093 update_boundingbox ();
11105 uibuttongroup::properties::set_units (
const octave_value& val)
11109 if (units.set (val,
true))
11111 update_units (old_units);
11117 uibuttongroup::properties::update_units (
const caseless_str& old_units)
11119 Matrix pos = get_position ().matrix_value ();
11130 set_position (pos);
11134 uibuttongroup::properties::set_fontunits (
const octave_value& val)
11138 if (fontunits.set (val,
true))
11140 update_fontunits (old_fontunits);
11146 uibuttongroup::properties::update_fontunits (
const caseless_str& old_units)
11149 double parent_height = get_boundingbox (
false).elem (3);
11150 double fontsz = get_fontsize ();
11160 double fontsz = get_fontsize ();
11161 double parent_height = box_pix_height;
11163 if (fontunits_is (
"normalized") && parent_height <= 0)
11164 parent_height = get_boundingbox (
false).elem (3);
11170 uibuttongroup::properties::set_selectedobject (
const octave_value& v)
11173 selectedobject = current_selectedobject;
11176 if (current_selectedobject.
ok ())
11195 && gop.get_parent () == get___myhandle__ ()
11196 && go.
isa (
"uicontrol"))
11201 if (style.
compare (
"radiobutton") || style.
compare (
"togglebutton"))
11203 selectedobject = val;
11217 if (h.
value () == current_selected.
value ())
11218 set_selectedobject (
Matrix ());
11229 bool has_selected = current_selected.
ok ();
11240 if (props.style_is (
"radiobutton") || props.style_is (
"togglebutton"))
11241 set_selectedobject (h.
value ());
11249 const Matrix& parent_pix_size)
const
11251 Matrix pos = get_position ().matrix_value ();
11252 Matrix parent_size (parent_pix_size);
11268 pos(1) = parent_size(1) - pos(1) - pos(3);
11272 double outer_height = pos(3);
11274 pos(0) = pos(1) = 0;
11276 if (! bordertype_is (
"none"))
11278 double bw = get_borderwidth ();
11281 if (bordertype_is (
"etchedin") || bordertype_is (
"etchedout"))
11284 pos(0) += mul * bw;
11285 pos(1) += mul * bw;
11286 pos(2) -= 2 * mul * bw;
11287 pos(3) -= 2 * mul * bw;
11290 if (! get_title ().empty ())
11292 double fontsz = get_fontsize ();
11294 if (! fontunits_is (
"pixels"))
11298 if (fontunits_is (
"points"))
11299 fontsz *= (res / 72.0);
11300 else if (fontunits_is (
"inches"))
11302 else if (fontunits_is (
"centimeters"))
11303 fontsz *= (res / 2.54);
11304 else if (fontunits_is (
"normalized"))
11305 fontsz *= outer_height;
11308 if (titleposition_is (
"lefttop") || titleposition_is (
"centertop")
11309 || titleposition_is (
"righttop"))
11310 pos(1) += (fontsz / 2);
11311 pos(3) -= (fontsz / 2);
11319 uipanel::properties::set_position (
const octave_value& v)
11322 bool modified =
false;
11324 old_bb = get_boundingbox (
true);
11325 modified = position.set (v,
false);
11326 new_bb = get_boundingbox (
true);
11328 if (old_bb != new_bb)
11330 if (old_bb(2) != new_bb(2) || old_bb(3) != new_bb(3))
11335 if (! get_resizefcn ().isempty ())
11338 if (! get_sizechangedfcn ().isempty ())
11341 update_boundingbox ();
11354 uipanel::properties::set_units (
const octave_value& val)
11358 if (units.set (val,
true))
11360 update_units (old_units);
11366 uipanel::properties::update_units (
const caseless_str& old_units)
11368 Matrix pos = get_position ().matrix_value ();
11379 set_position (pos);
11383 uipanel::properties::set_fontunits (
const octave_value& val)
11387 if (fontunits.set (val,
true))
11389 update_fontunits (old_fontunits);
11395 uipanel::properties::update_fontunits (
const caseless_str& old_units)
11398 double parent_height = get_boundingbox (
false).elem (3);
11399 double fontsz = get_fontsize ();
11409 double fontsz = get_fontsize ();
11410 double parent_height = box_pix_height;
11412 if (fontunits_is (
"normalized") && parent_height <= 0)
11413 parent_height = get_boundingbox (
false).elem (3);
11422 const Matrix& parent_pix_size)
const
11424 Matrix pos = get_position ().matrix_value ();
11425 Matrix parent_size (parent_pix_size);
11441 pos(1) = parent_size(1) - pos(1) - pos(3);
11447 uitable::properties::set_columnformat (
const octave_value& val)
11454 if (columnformat.set (val,
true))
11461 for (
int i = 0; i < cell_value.
numel (); i++)
11469 for (
int j = 0; j < popup.
numel (); j++)
11473 error (
"set: pop-up menu definitions must be non-empty strings.");
11478 error (
"set: columnformat definintions must be a cellstr of "
11479 "either 'char', 'short [e|g|eng]?', 'long [e|g|eng]?', "
11480 "'numeric', 'bank', '+', 'rat', 'logical', "
11481 "or a cellstr of non-empty pop-up menu definitions.");
11485 if (columnformat.set (val,
true))
11490 if (columnformat.set (
Cell (),
true))
11495 error (
"set: expecting cell of strings.");
11500 uitable::properties::set_columnwidth (
const octave_value& val)
11502 bool error_exists =
false;
11505 error_exists =
false;
11509 for (
int i = 0; i < cell_value.
numel (); i++)
11515 error_exists =
true;
11519 error_exists =
true;
11523 error_exists =
true;
11528 error_exists =
true;
11531 error (
"set: expecting either 'auto' or a cell of pixel values or auto.");
11534 if (columnwidth.set (val,
true))
11540 uitable::properties::set_units (
const octave_value& val)
11544 if (units.set (val,
true))
11546 update_units (old_units);
11552 uitable::properties::update_units (
const caseless_str& old_units)
11554 Matrix pos = get_position ().matrix_value ();
11565 set_position (pos);
11569 uitable::properties::set_fontunits (
const octave_value& val)
11573 if (fontunits.set (val,
true))
11575 update_fontunits (old_fontunits);
11581 uitable::properties::update_fontunits (
const caseless_str& old_units)
11584 double parent_height = get_boundingbox (
false).elem (3);
11585 double fontsz = get_fontsize ();
11595 double fontsz = get_fontsize ();
11596 double parent_height = box_pix_height;
11598 if (fontunits_is (
"normalized") && parent_height <= 0)
11599 parent_height = get_boundingbox (
false).elem (3);
11607 double fontsz = get_fontsize ();
11608 double parent_height = box_pix_height;
11610 if (fontunits_is (
"normalized") && parent_height <= 0)
11611 parent_height = get_boundingbox (
false).elem (3);
11617 uitable::properties::get_backgroundcolor_rgb (
void)
11619 Matrix bg = backgroundcolor.get ().matrix_value ();
11624 uitable::properties::get_alternatebackgroundcolor_rgb (
void)
11627 Matrix bg = backgroundcolor.get ().matrix_value ();
11628 if (bg.
rows () > 1)
11635 uitable::properties::get_extent_matrix (
void)
const
11637 return extent.get ().matrix_value ();
11641 uitable::properties::get_extent (
void)
const
11644 Matrix m = extent.get ().matrix_value ();
11669 if (
retval.is_undefined ())
11723 : m_interpreter (interp), m_handle_map (), m_handle_free_list (),
11724 m_next_handle (-1.0 - (rand () + 1.0) / (RAND_MAX + 2.0)),
11725 m_figure_list (), m_graphics_lock (), m_event_queue (),
11726 m_callback_objects (), m_event_processing (0)
11739 bool integer_figure_handle,
11740 bool call_createfcn,
bool notify_toolkit)
11747 error (
"gh_manager::make_graphics_handle: invalid object type '%s'",
11758 if (go_name ==
"axes")
11782 if (call_createfcn)
11786 if (notify_toolkit)
11803 if (notify_toolkit)
11840 callback (), callback_data (data) { }
11846 callback (cb), callback_data (data) { }
11853 if (callback.is_defined ())
11882 if (! mcode.empty ())
11928 function (function_data);
11943 const octave_value& value,
bool do_notify_toolkit =
true,
11944 bool redraw_figure =
false)
11946 property_value (value), notify_toolkit (do_notify_toolkit),
11947 m_redraw_figure (redraw_figure)
11970 if (go.
isa (
"figure") && property_name ==
"position")
11976 else if (go.
isa (
"figure") && property_name ==
"outerposition")
11983 p.set (property_value,
true, notify_toolkit);
11985 if (m_redraw_figure)
11987 if (! go.
isa (
"figure"))
12016 const std::string&
name,
12034 const std::string& cmd,
12049 const std::string&
name,
12051 bool notify_toolkit,
bool redraw_figure)
12141 catch (octave::execution_exception& e)
12149 || cb.
cell_value ()(0).is_function_handle ()))
12155 for (
int i = 1; i < c.
numel () ; i++)
12161 error (
"trying to execute non-executable object (class = %s)",
12173 catch (octave::execution_exception& e)
12183 std::string go_name
12186 if (go_name.length () > 1
12187 && go_name[0] ==
'u' && go_name[1] ==
'i')
12226 if (cname ==
"deletefcn" || cname ==
"createfcn"
12227 || cname ==
"closerequestfcn"
12228 || ((go.
isa (
"figure") || go.
isa (
"uipanel")
12229 || go.
isa (
"uibuttongroup"))
12230 && (cname ==
"resizefcn" || cname ==
"sizechangedfcn")))
12237 if (cname ==
"closerequestfcn")
12239 std::string cmd (
"close (gcbf ());");
12259 bool redraw_figure)
12272 bool events_executed =
false;
12301 std::list<graphics_event>::iterator p =
m_event_queue.begin ();
12308 else if (p->get_busyaction ()
12325 events_executed =
true;
12337 if (events_executed)
12464 gh_manager& gh_mgr = interp.get_gh_manager ();
12468 if (args.length () != 1)
12531 DEFUN (__is_handle_visible__, args, ,
12537 if (args.length () != 1)
12558 if (args.length () != 1)
12562 ColumnVector hcv = args(0).xvector_value (
"reset: H must be a graphics handle");
12564 gh_manager& gh_mgr = interp.get_gh_manager ();
12761 gh_manager& gh_mgr = interp.get_gh_manager ();
12765 int nargin = args.length ();
12773 ColumnVector hcv = args(0).xvector_value (
"set: H must be a graphics handle");
12775 bool request_drawnow =
false;
12783 error (
"set: invalid handle (= %g)", hcv(
n));
12785 if (nargin == 3 && args(1).iscellstr () && args(2).iscell ())
12787 if (args(2).cell_value ().rows () == 1)
12788 go.
set (args(1).cellstr_value (), args(2).cell_value (), 0);
12789 else if (hcv.
numel () == args(2).cell_value ().rows ())
12790 go.
set (args(1).cellstr_value (), args(2).cell_value (),
n);
12792 error (
"set: number of graphics handles must match number of "
12793 "value rows (%" OCTAVE_IDX_TYPE_FORMAT
" != "
12794 "%" OCTAVE_IDX_TYPE_FORMAT
")",
12795 hcv.
numel (), args(2).cell_value ().rows ());
12797 else if (nargin == 2 && args(1).isstruct ())
12798 go.
set (args(1).map_value ());
12799 else if (nargin == 2 && args(1).is_string ())
12801 std::string
property = args(1).string_value ();
12812 <<
" is read-only" << std::endl;
12825 error (
"set: unknown property");
12827 else if (nargin == 1)
12840 go.
set (args.splice (0, 1));
12843 request_drawnow =
true;
12846 if (request_drawnow)
12862 error (
"get: invalid handle (= %g)", val);
12881 gh_manager& gh_mgr = interp.get_gh_manager ();
12885 int nargin = args.length ();
12887 if (nargin < 1 || nargin > 2)
12890 if (args(0).isempty ())
12893 ColumnVector hcv = args(0).xvector_value (
"get: H must be a graphics handle");
12897 if (nargin == 1 && hcv_len > 1)
12906 error (
"get: vector of handles must all have the same type");
12912 bool use_cell_format =
false;
12914 if (nargin > 1 && args(1).iscellstr ())
12920 use_cell_format =
true;
12929 error (
"get: invalid handle (= %g)", hcv(
n));
12944 property = args(1).xstring_value (
"get: second argument must be property name or cell array of property names");
12953 error (
"get: invalid handle (= %g)", hcv(
n));
12956 vals(
n) = go.
get ();
12962 if (use_cell_format)
12970 else if (vals_len == 1)
12972 else if (vals_len > 1 && nargin == 1)
12977 tmp[
n] = vals(
n).scalar_map_value ();
13002 gh_manager& gh_mgr = interp.get_gh_manager ();
13006 if (args.length () != 1)
13009 ColumnVector hcv = args(0).xvector_value (
"get: H must be a graphics handle");
13022 error (
"get: invalid handle (= %g)", hcv(
n));
13027 vals(
n) = go.
get (
true);
13036 else if (vals_len == 1)
13037 return ovl (vals(0));
13044 bool integer_figure_handle,
13057 for (
int i = 0; i < xargs.
length (); i += 2)
13059 if (xargs(i).is_string () && p.
compare (xargs(i).string_value ()))
13061 if (i >= (xargs.
length () - 1))
13062 error (
"__go_%s__: missing value for parent property",
13065 val = xargs(i+1).double_value ();
13067 xargs = xargs.
splice (i, 2);
13073 val = args(0).xdouble_value (
"__go_%s__: invalid parent", go_name.c_str ());
13079 if (! parent.
ok ())
13080 error (
"__go_%s__: invalid parent", go_name.c_str ());
13087 integer_figure_handle,
false,
false);
13089 catch (octave::execution_exception& e)
13091 error (e,
"__go_%s__: %s, unable to create graphics handle",
13092 go_name.c_str (), e.message ().c_str ());
13099 catch (octave::execution_exception& e)
13102 error (e,
"__go_%s__: %s, unable to create graphics handle",
13103 go_name.c_str (), e.message ().c_str ());
13118 DEFMETHOD (__go_figure__, interp, args, ,
13124 gh_manager& gh_mgr = interp.get_gh_manager ();
13128 if (args.length () == 0)
13131 double val = args(0).
xdouble_value (
"__go_figure__: figure number must be a double value");
13139 xset (h, args.splice (0, 1));
13145 bool int_fig_handle =
true;
13155 for (
int i = 0; i < xargs.
length (); i++)
13157 if (xargs(i).is_string ()
13158 && pname.
compare (xargs(i).string_value ()))
13160 if (i < (xargs.
length () - 1))
13162 std::string pval = xargs(i+1).string_value ();
13165 int_fig_handle = on.
compare (pval);
13166 xargs = xargs.
splice (i, 2);
13176 if (! int_fig_handle)
13189 error (
"__go_figure__: failed to create figure handle");
13195 catch (octave::execution_exception& e)
13198 error (e,
"__go_figure__: unable to create figure handle");
13214 #define GO_BODY(TYPE) \
13215 gh_manager& gh_mgr = interp.get_gh_manager (); \
13217 octave::autolock guard (gh_mgr.graphics_lock ()); \
13219 if (args.length () == 0) \
13222 return octave_value (make_graphics_object (#TYPE, false, args)); \
13229 if (go.
isa (
"surface"))
13231 else if ((go.
isa (
"line") || go.
isa (
"patch"))
13260 DEFMETHOD (__calc_dimensions__, interp, args, ,
13268 gh_manager& gh_mgr = interp.get_gh_manager ();
13272 if (args.length () != 1)
13275 double h = args(0).xdouble_value (
"__calc_dimensions__: first argument must be a graphics handle");
13280 DEFMETHOD (__go_axes__, interp, args, ,
13289 DEFMETHOD (__go_line__, interp, args, ,
13298 DEFMETHOD (__go_text__, interp, args, ,
13307 DEFMETHOD (__go_image__, interp, args, ,
13316 DEFMETHOD (__go_surface__, interp, args, ,
13325 DEFMETHOD (__go_patch__, interp, args, ,
13334 DEFMETHOD (__go_light__, interp, args, ,
13343 DEFMETHOD (__go_hggroup__, interp, args, ,
13352 DEFMETHOD (__go_uimenu__, interp, args, ,
13361 DEFMETHOD (__go_uicontrol__, interp, args, ,
13370 DEFMETHOD (__go_uibuttongroup__, interp, args, ,
13379 DEFMETHOD (__go_uipanel__, interp, args, ,
13388 DEFMETHOD (__go_uicontextmenu__, interp, args, ,
13397 DEFMETHOD (__go_uitable__, interp, args, ,
13406 DEFMETHOD (__go_uitoolbar__, interp, args, ,
13415 DEFMETHOD (__go_uipushtool__, interp, args, ,
13424 DEFMETHOD (__go_uitoggletool__, interp, args, ,
13433 DEFMETHOD (__go_delete__, interp, args, ,
13439 gh_manager& gh_mgr = interp.get_gh_manager ();
13443 if (args.length () != 1)
13448 const NDArray vals = args(0).xarray_value (
"delete: invalid graphics object");
13454 h = gh_mgr.
lookup (vals(i));
13457 error (
"delete: invalid graphics object (= %g)", vals(i));
13465 DEFMETHOD (__go_handles__, interp, args, ,
13471 gh_manager& gh_mgr = interp.get_gh_manager ();
13475 bool show_hidden =
false;
13477 if (args.length () > 0)
13478 show_hidden = args(0).bool_value ();
13483 DEFMETHOD (__go_figure_handles__, interp, args, ,
13489 gh_manager& gh_mgr = interp.get_gh_manager ();
13493 bool show_hidden =
false;
13495 if (args.length () > 0)
13496 show_hidden = args(0).bool_value ();
13501 DEFMETHOD (__go_execute_callback__, interp, args, ,
13508 int nargin = args.length ();
13510 if (nargin < 2 || nargin > 3)
13513 const NDArray vals = args(0).xarray_value (
"__go_execute_callback__: invalid graphics object");
13515 std::string
name = args(1).xstring_value (
"__go_execute_callback__: invalid callback name");
13517 gh_manager& gh_mgr = interp.get_gh_manager ();
13521 double val = vals(i);
13526 error (
"__go_execute_callback__: invalid graphics object (= %g)", val);
13537 DEFMETHOD (__go_post_callback__, interp, args, ,
13544 int nargin = args.length ();
13546 if (nargin < 2 || nargin > 3)
13549 const NDArray vals = args(0).xarray_value (
"__go_post_callback__: invalid graphics object");
13551 std::string
name = args(1).xstring_value (
"__go_post_callback__: invalid callback name");
13553 gh_manager& gh_mgr = interp.get_gh_manager ();
13557 double val = vals(i);
13562 error (
"__go_execute_callback__: invalid graphics object (= %g)", val);
13573 DEFMETHOD (__image_pixel_size__, interp, args, ,
13579 if (args.length () != 1)
13582 gh_manager& gh_mgr = interp.get_gh_manager ();
13584 double h = args(0).xdouble_value (
"__image_pixel_size__: argument is not a handle");
13588 if (! go || ! go.
isa (
"image"))
13589 error (
"__image_pixel_size__: object is not an image");
13595 dp(0) = ip.pixel_xsize ();
13596 dp(1) = ip.pixel_ysize ();
13600 DEFMETHOD (available_graphics_toolkits, interp, , ,
13607 gh_manager& gh_mgr = interp.get_gh_manager ();
13616 DEFMETHOD (register_graphics_toolkit, interp, args, ,
13623 gh_manager& gh_mgr = interp.get_gh_manager ();
13627 if (args.length () != 1)
13630 std::string
name = args(0).xstring_value (
"register_graphics_toolkit: TOOLKIT must be a string");
13639 DEFMETHOD (loaded_graphics_toolkits, interp, , ,
13646 gh_manager& gh_mgr = interp.get_gh_manager ();
13655 DEFMETHOD (__show_figure__, interp, args, ,
13661 if (args.length () != 1)
13664 gh_manager& gh_mgr = interp.get_gh_manager ();
13666 double h = args(0).xdouble_value (
"__show_figure__: invalid handle H");
13671 error (
"__show_figure__: invalid graphics object (= %g)", h);
13700 if (args.length () > 3)
13711 gh_manager& gh_mgr = interp.get_gh_manager ();
13715 if (args.length () <= 1)
13719 bool do_events =
true;
13721 if (args.length () == 1)
13723 caseless_str val (args(0).xstring_value (
"drawnow: first argument must be a string"));
13728 error (
"drawnow: invalid argument, 'expose' is only valid option");
13743 for (
int i = 0; i < hlist.
numel (); i++)
13747 if (h.
ok () && h != 0)
13755 if (fprops.is_visible ())
13770 else if (args.length () >= 2 && args.length () <= 3)
13772 std::string term, file, debug_file;
13774 term = args(0).xstring_value (
"drawnow: TERM must be a string");
13776 file = args(1).xstring_value (
"drawnow: FILE must be a string");
13779 error (
"drawnow: empty output ''");
13780 else if (file.length () == 1 && file[0] ==
'|')
13781 error (
"drawnow: empty pipe '|'");
13782 else if (file[0] !=
'|')
13786 if (pos != std::string::npos)
13788 std::string
dirname = file.substr (0, pos+1);
13792 if (! fs || ! fs.
is_dir ())
13793 error (
"drawnow: nonexistent directory '%s'",
13799 debug_file = (args.length () > 2 ? args(2).xstring_value (
"drawnow: DEBUG_FILE must be a string") :
"");
13804 error (
"drawnow: nothing to draw");
13819 DEFMETHOD (addlistener, interp, args, ,
13854 gh_manager& gh_mgr = interp.get_gh_manager ();
13858 int nargin = args.length ();
13860 if (nargin < 3 || nargin > 4)
13863 double h = args(0).xdouble_value (
"addlistener: invalid handle H");
13865 std::string pname = args(1).xstring_value (
"addlistener: PROP must be a string");
13870 error (
"addlistener: invalid graphics object (= %g)", h);
13876 if (args.length () == 4)
13879 if (persistent.
compare (
"persistent"))
13886 DEFMETHOD (dellistener, interp, args, ,
13915 gh_manager& gh_mgr = interp.get_gh_manager ();
13919 if (args.length () < 2 || args.length () > 3)
13922 double h = args(0).xdouble_value (
"dellistener: invalid handle");
13924 std::string pname = args(1).xstring_value (
"dellistener: PROP must be a string");
13929 error (
"dellistener: invalid graphics object (= %g)", h);
13933 if (args.length () == 2)
13937 if (args(2).is_string ()
13938 && args(2).string_value () ==
"persistent")
13952 DEFMETHOD (addproperty, interp, args, ,
14024 gh_manager& gh_mgr = interp.get_gh_manager ();
14028 if (args.length () < 3)
14031 std::string
name = args(0).xstring_value (
"addproperty: NAME must be a string");
14033 double h = args(1).xdouble_value (
"addproperty: invalid handle H");
14038 error (
"addproperty: invalid graphics object (= %g)", h);
14042 std::string
type = args(2).xstring_value (
"addproperty: TYPE must be a string");
14045 error (
"addproperty: a '%s' property already exists in the graphics object",
14057 const std::string& func)
14066 error (
"%s: invalid handle (= %g)", func.c_str (), handle);
14082 error (
"%s: invalid handle (= %g)", func.c_str (), handle);
14099 if (result.
length () > 0)
14100 return result(0).bool_value ();
14119 if (c.
numel () >= 4)
14121 double h = c(2).double_value ();
14158 if (args.length () > 3)
14160 uint32_t
id = args(2).uint32_scalar_value ().value ();
14162 if (args.length () > 5)
14164 double h = args(0).double_value ();
14192 if (args.length () > 2)
14194 uint32_t
id = args(2).uint32_scalar_value ().value ();
14245 if (args.length () == 0)
14249 if (args(0).isempty ())
14252 double h = args(0).xdouble_value (
"waitfor: invalid handle value");
14254 if (!
ishghandle (h) || (h == 0 && args.length () == 1))
14261 static uint32_t id_counter = 0;
14264 int max_arg_index = 0;
14265 int timeout_index = -1;
14267 double timeout = 0;
14269 gh_manager& gh_mgr = interp.get_gh_manager ();
14271 if (args.length () > 1)
14273 pname = args(1).xstring_value (
"waitfor: PROP must be a string");
14275 if (pname.empty ())
14276 error (
"waitfor: PROP must be a non-empty string");
14278 if (pname !=
"timeout")
14280 if (pname.
compare (R
"(\timeout)"))
14288 "waitfor_listener"));
14291 if (args.length () > 2)
14293 if (args(2).is_string ())
14306 Cell listener (1, max_arg_index >= 2 ? 5 : 4);
14312 listener(0) = wf_listener;
14315 listener(3) = pname;
14317 if (max_arg_index >= 2)
14318 listener(4) = args(2);
14330 if (max_arg_index >= 2
14348 "waitfor_del_listener"));
14350 Cell del_listener (1, 4);
14352 del_listener(0) = wf_del_listener;
14354 del_listener(2) = h;
14355 del_listener(3) = pname;
14369 if (timeout_index < 0 && args.length () > (max_arg_index + 1))
14371 caseless_str s = args(max_arg_index + 1).xstring_value (
"waitfor: invalid parameter, expected 'timeout'");
14374 error (
"waitfor: invalid parameter '%s'", s.c_str ());
14376 timeout_index = max_arg_index + 1;
14379 if (timeout_index >= 0)
14381 if (args.length () <= (timeout_index + 1))
14382 error (
"waitfor: missing TIMEOUT value");
14384 timeout = args(timeout_index + 1).xscalar_value (
"waitfor: TIMEOUT must be a scalar >= 1");
14388 warning (
"waitfor: TIMEOUT value must be >= 1, using 1 instead");
14440 if (start + timeout < now)
14456 int nargin = args.length ();
14458 if (nargin != 2 && nargin != 3)
14461 double h = args(0).double_value ();
14463 gh_manager& gh_mgr = interp.get_gh_manager ();
14469 if (! handle.
ok ())
14470 error (
"__zoom__: invalid handle");
14479 std::string opt = args(1).string_value ();
14481 if (opt ==
"out" || opt ==
"reset")
14494 std::string mode = args(1).string_value ();
14495 double factor = args(2).scalar_value ();
14497 ax_props.
zoom (mode, factor);
14504 DEFMETHOD (__get_frame__, interp, args, ,
14513 if (args.length () != 1)
14516 double h = args(0).xdouble_value (
"__get_frame__: HFIG is not a handle");
14518 gh_manager& gh_mgr = interp.get_gh_manager ();
14522 if (! go || ! go.
isa (
"figure"))
14523 error (
"__get_frame__: HFIG is not a figure");
14531 DEFUN (__get_system_fonts__, args, ,
14537 if (args.length () != 0)
octave_idx_type lookup(const T *x, octave_idx_type n, T y)
charNDArray max(char d, const charNDArray &m)
charNDArray min(char d, const charNDArray &m)
N Dimensional Array with copy-on-write semantics.
Array< T > as_column(void) const
Return the array as a column vector.
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
void assign(const idx_vector &i, const Array< T > &rhs, const T &rfv)
Indexed assignment (always with resize & fill).
octave_idx_type columns(void) const
T & xelem(octave_idx_type n)
Size of the specified dimension.
octave_idx_type numel(void) const
Number of elements in the array.
T & elem(octave_idx_type n)
Size of the specified dimension.
const T * data(void) const
Size of the specified dimension.
octave_idx_type rows(void) const
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
int ndims(void) const
Size of the specified dimension.
const T * fortran_vec(void) const
Size of the specified dimension.
bool isempty(void) const
Size of the specified dimension.
void resize(octave_idx_type n, const double &rfv=0)
RowVector transpose(void) const
ColumnVector extract_n(octave_idx_type r1, octave_idx_type n) const
ComplexColumnVector eigenvalues(void) const
MArray< T > reshape(const dim_vector &new_dims) const
ColumnVector row_max(void) const
RowVector row(octave_idx_type i) const
Matrix extract_n(octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const
ColumnVector row_min(void) const
Matrix transpose(void) const
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
bool any_element_is_inf_or_nan(void) const
finite_type finite_constraint
std::pair< double, bool > minval
std::pair< double, bool > maxval
OCTINTERP_API void get_data_limits(void)
OCTINTERP_API bool is_equal(const octave_value &v) const
OCTINTERP_API bool validate(const octave_value &v)
octave_value get(void) const
std::list< dim_vector > size_constraints
std::set< std::string > type_constraints
void rotate_view(double delta_az, double delta_el, bool push_to_zoom_stack=true)
void zoom(const std::string &mode, double factor, bool push_to_zoom_stack=true)
void rotate3d(double x0, double x1, double y0, double y1, bool push_to_zoom_stack=true)
void update_aspectratios(void)
void update_title_position(void)
graphics_xform get_transform(void) const
void pan(const std::string &mode, double factor, bool push_to_zoom_stack=true)
void remove_child(const graphics_handle &h, bool from_root=false)
unsigned int get_num_lights(void) const
void update_font(std::string prop="")
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
void update_fontunits(const caseless_str &old_fontunits)
Matrix get_extent(bool with_text=false, bool only_text_height=false) const
void sync_positions(void)
void set_defaults(base_graphics_object &obj, const std::string &mode)
void update_zlabel_position(void)
void push_zoom_stack(void)
void set_text_child(handle_property &h, const std::string &who, const octave_value &v)
void update_autopos(const std::string &elem_type)
double get___fontsize_points__(double box_pix_height=0) const
void update_xlabel_position(void)
void adopt(const graphics_handle &h)
void update_units(const caseless_str &old_units)
void update_axes_layout(void)
void update_handlevisibility(void)
void zoom_about_point(const std::string &mode, double x, double y, double factor, bool push_to_zoom_stack=true)
void clear_zoom_stack(bool do_unzoom=true)
void delete_text_child(handle_property &h, bool from_root=false)
void increase_num_lights(void)
void update_ylabel_position(void)
void translate_view(const std::string &mode, double x0, double x1, double y0, double y1, bool push_to_zoom_stack=true)
void decrease_num_lights(void)
octave_value get_default(const caseless_str &name) const
void update_axis_limits(const std::string &axis_type)
void reset_default_properties(void)
void initialize(const graphics_object &go)
virtual std::string value_as_string(const std::string &prop)
virtual graphics_handle get_parent(void) const
virtual void adopt(const graphics_handle &h)
virtual void defaults(void) const
virtual std::string type(void) const
virtual std::string values_as_string(void)
virtual octave_value get_default(const caseless_str &) const
virtual void reset_default_properties(void)
virtual octave_value get_factory_default(const caseless_str &) const
virtual octave_scalar_map values_as_struct(void)
virtual void remove_all_listeners(void)
graphics_handle get_handle(void) const
virtual void initialize(const graphics_object &go)
virtual void reparent(const graphics_handle &np)
friend class graphics_object
virtual base_properties & get_properties(void)
virtual void set(const caseless_str &pname, const octave_value &pval)
bool isa(const std::string &go_name) const
octave_value get(bool all=false) const
virtual void update_axis_limits(const std::string &axis_type)
void build_user_defaults_map(property_list::pval_map_type &def, const std::string go_name) const
virtual void set_defaults(const std::string &)
virtual void mark_modified(void)
void set_from_list(base_graphics_object &obj, property_list &defaults)
Matrix get_children(void) const
void override_defaults(base_graphics_object &obj)
bool is_modified(void) const
virtual octave_value get_ylim(void) const
virtual void update_uicontextmenu(void) const
virtual void update_autopos(const std::string &elem_type)
virtual octave::graphics_toolkit get_toolkit(void) const
bool is_handle_visible(void) const
bool has_dynamic_property(const std::string &pname) const
std::set< std::string > dynamic_property_names(void) const
virtual octave_value get_xlim(void) const
virtual void update_boundingbox(void)
void get_children_of_type(const caseless_str &type, bool get_invisible, bool traverse, std::list< graphics_object > &children_list) const
virtual void update_axis_limits(const std::string &axis_type) const
octave_value get_dynamic(const caseless_str &pname) const
Matrix get_all_children(void) const
static property_list::pval_map_type factory_defaults(void)
virtual void add_listener(const caseless_str &, const octave_value &, listener_mode=GCB_POSTSET)
virtual void set(const caseless_str &, const octave_value &)
void insert_property(const std::string &name, property p)
property get_property_dynamic(const caseless_str &pname) const
virtual bool has_property(const caseless_str &) const
void set_modified(const octave_value &val)
virtual octave_value get_alim(void) const
void set_parent(const octave_value &val)
virtual void adopt(const graphics_handle &h)
virtual octave_value get_zlim(void) const
virtual octave_value get_clim(void) const
void set_beingdeleted(const octave_value &val)
virtual void init_integerhandle(const octave_value &)
void set_dynamic(const caseless_str &pname, const octave_value &val)
virtual void delete_children(bool clear=false, bool from_root=false)
virtual void remove_child(const graphics_handle &h, bool=false)
virtual void delete_listener(const caseless_str &, const octave_value &, listener_mode=GCB_POSTSET)
virtual property get_property(const caseless_str &pname)
virtual std::string graphics_object_name(void) const
void renumber_child(graphics_handle old_gh, graphics_handle new_gh)
virtual Matrix get_boundingbox(bool=false, const Matrix &=Matrix()) const
void renumber_parent(graphics_handle new_gh)
std::string get_name(void) const
virtual bool do_set(const octave_value &)
OCTINTERP_API void run_listeners(listener_mode mode=GCB_POSTSET)
graphics_handle get_parent(void) const
OCTINTERP_API bool set(const octave_value &v, bool do_run=true, bool do_notify_toolkit=true)
std::string callback_name
callback_event(const graphics_handle &h, const std::string &name, const octave_value &data=Matrix(), int busyaction=base_graphics_event::QUEUE)
octave_value callback_data
callback_event(const graphics_handle &h, const octave_value &cb, const octave_value &data=Matrix(), int busyaction=base_graphics_event::QUEUE)
OCTINTERP_API void execute(const octave_value &data=octave_value()) const
OCTINTERP_API bool validate(const octave_value &v) const
~callback_props(void)=default
callback_props(const callback_props &)=delete
void erase(const callback_property *ptr)
callback_props & operator=(const callback_props &)=delete
std::set< intptr_t > m_set
bool contains(const callback_property *ptr) const
void insert(const callback_property *ptr)
bool compare(const std::string &s, size_t limit=std::string::npos) const
void do_delete_children(bool clear, bool from_root)
Matrix do_get_children(bool return_hidden) const
std::list< double > children_list
OCTINTERP_API bool do_set(const octave_value &newval)
enum color_property::current_enum current_type
octave_value get(void) const
OCTINTERP_API bool str2rgb(const std::string &str)
Vector representing the dimensions (size) of an Array.
void resize(int n, int fill_value=0)
static dim_vector alloc(int n)
octave_idx_type ndims(void) const
Number of dimensions.
enum double_radio_property::current_enum current_type
OCTINTERP_API bool do_set(const octave_value &v)
function_event(graphics_event::event_fcn fcn, void *data=nullptr)
function_event(void)=delete
function_event(const function_event &)=delete
void post_set(const graphics_handle &h, const std::string &name, const octave_value &value, bool notify_toolkit=true, bool redraw_figure=false)
Matrix handle_list(bool show_hidden=false)
graphics_object get_object(double val) const
octave::interpreter & m_interpreter
void renumber_figure(const graphics_handle &old_gh, const graphics_handle &new_gh)
void close_all_figures(void)
void execute_listener(const graphics_handle &h, const octave_value &l)
gh_manager(octave::interpreter &interp)
void push_figure(const graphics_handle &h)
bool is_handle_visible(const graphics_handle &h) const
std::list< graphics_handle > m_figure_list
std::list< graphics_object > m_callback_objects
void post_event(const graphics_event &e)
Matrix figure_handle_list(bool show_hidden=false)
graphics_handle lookup(double val) const
std::map< graphics_handle, graphics_object > m_handle_map
void enable_event_processing(bool enable=true)
std::list< graphics_event > m_event_queue
void post_function(graphics_event::event_fcn fcn, void *fcn_data=nullptr)
void free(const graphics_handle &h, bool from_root=false)
octave::mutex m_graphics_lock
void pop_figure(const graphics_handle &h)
void post_callback(const graphics_handle &h, const std::string &name, const octave_value &data=Matrix())
graphics_handle make_graphics_handle(const std::string &go_name, const graphics_handle &p, bool integer_figure_handle=false, bool call_createfcn=true, bool notify_toolkit=true)
void execute_callback(const graphics_handle &h, const std::string &name, const octave_value &data=Matrix())
int process_events(bool force=false)
graphics_handle current_figure(void) const
octave::mutex graphics_lock(void)
graphics_handle make_figure_handle(double val, bool notify_toolkit=true)
graphics_handle get_handle(bool integer_figure_handle)
graphics_event(void)=default
static graphics_event create_mcode_event(const graphics_handle &h, const std::string &cmd, int busyaction)
void(* event_fcn)(void *)
static graphics_event create_function_event(event_fcn fcn, void *data=nullptr)
static graphics_event create_set_event(const graphics_handle &h, const std::string &name, const octave_value &value, bool notify_toolkit=true, bool redraw_figure=false)
static graphics_event create_callback_event(const graphics_handle &h, const std::string &name, const octave_value &data=Matrix(), int busyaction=base_graphics_event::QUEUE)
octave_value get_zlim(void) const
std::string value_as_string(const std::string &prop)
octave_map values_as_struct(void)
octave_value get_ylim(void) const
void override_defaults(base_graphics_object &obj)
bool has_readonly_property(const caseless_str &pname) const
octave_value get(bool all=false) const
bool is_aliminclude(void) const
void set(const caseless_str &name, const octave_value &val)
graphics_object get_ancestor(const std::string &type) const
octave_value get_alim(void) const
bool is_yliminclude(void) const
void reset_default_properties(void)
void update_axis_limits(const std::string &axis_type)
void delete_property_listener(const std::string &nm, const octave_value &v, listener_mode mode=GCB_POSTSET)
bool isa(const std::string &go_name) const
base_properties & get_properties(void)
std::string type(void) const
void set_value_or_default(const caseless_str &name, const octave_value &val)
octave_value get_factory_default(const caseless_str &name) const
void reparent(const graphics_handle &h)
graphics_handle get_handle(void) const
bool is_xliminclude(void) const
octave_value get_default(const caseless_str &name) const
octave::graphics_toolkit get_toolkit(void) const
void build_user_defaults_map(property_list::pval_map_type &def, const std::string go_name) const
bool is_climinclude(void) const
octave_value get_xlim(void) const
bool is_zliminclude(void) const
graphics_handle get_parent(void) const
property_list get_factory_defaults_list(void) const
void remove_child(const graphics_handle &h)
std::string values_as_string(void)
bool valid_object(void) const
void add_property_listener(const std::string &nm, const octave_value &v, listener_mode mode=GCB_POSTSET)
void adopt(const graphics_handle &h)
octave_value get_clim(void) const
std::set< std::string > type_constraints
graphics_handle current_val
octave_value get(void) const
OCTINTERP_API bool do_set(const octave_value &v)
graphics_handle handle_value(void) const
void adopt(const graphics_handle &h)
void remove_child(const graphics_handle &h, bool from_root=false)
void update_limits(void) const
void update_axis_limits(const std::string &axis_type)
octave_value get_color_data(void) const
void initialize(const graphics_object &go)
mcode_event(const graphics_handle &h, const std::string &cmd, int busyaction=base_graphics_event::QUEUE)
void add_method(T *obj, void(T::*method)(Params...), Args &&... args)
void add_fcn(void(*fcn)(Params...), Args &&... args)
static void remove_event_hook(event_hook_fcn f)
static void run_event_hooks(void)
static void add_event_hook(event_hook_fcn f)
graphics_toolkit find_toolkit(const std::string &name) const
void register_toolkit(const std::string &name)
Cell loaded_toolkits_list(void) const
Cell available_toolkits_list(void) const
graphics_toolkit get_toolkit(void) const
std::string default_toolkit(void) const
octave_value_list eval_string(const std::string &eval_str, bool silent, int &parse_status, int nargout)
void recover_from_exception(void)
void handle_exception(const execution_exception &e)
octave_map get_system_fonts(void)
static bool is_thread(void)
octave_value as_octave_value(void) const
Cell getfield(const std::string &key) const
bool isfield(const std::string &name) const
static octave_map cat(int dim, octave_idx_type n, const octave_scalar_map *map_list)
void setfield(const std::string &key, const octave_value &val)
octave_value getfield(const std::string &key) const
octave_idx_type length(void) const
octave_value_list splice(octave_idx_type offset, octave_idx_type len, const octave_value_list &lst=octave_value_list()) const
bool is_function(void) const
octave_idx_type length(void) const
int32NDArray int32_array_value(void) const
bool iscellstr(void) const
uint16NDArray uint16_array_value(void) const
bool is_uint16_type(void) const
bool is_bool_scalar(void) const
bool is_int8_type(void) const
octave_idx_type rows(void) const
bool isnumeric(void) const
octave_idx_type numel(void) const
bool is_scalar_type(void) const
bool is_string(void) const
double xdouble_value(const char *fmt,...) const
bool is_defined(void) const
bool isinteger(void) const
bool is_double_type(void) const
Cell cell_value(void) const
bool is_function_handle(void) const
std::string class_name(void) const
bool is_uint32_type(void) const
octave_idx_type columns(void) const
int8NDArray int8_array_value(void) const
bool is_int64_type(void) const
int64NDArray int64_array_value(void) const
octave_function * function_value(bool silent=false) const
uint8NDArray uint8_array_value(void) const
octave_value reshape(const dim_vector &dv) const
std::string string_value(bool force=false) const
bool is_matrix_type(void) const
octave_scalar_map scalar_map_value(void) const
bool is_int32_type(void) const
bool is_uint64_type(void) const
bool is_int16_type(void) const
uint64NDArray uint64_array_value(void) const
string_vector string_vector_value(bool pad=false) const
NDArray array_value(bool frc_str_conv=false) const
bool is_single_type(void) const
uint32NDArray uint32_array_value(void) const
octave_map map_value(void) const
bool is_real_scalar(void) const
bool is_undefined(void) const
bool is_uint8_type(void) const
int16NDArray int16_array_value(void) const
Matrix matrix_value(bool frc_str_conv=false) const
bool iscomplex(void) const
double double_value(bool frc_str_conv=false) const
std::string type_name(void) const
bool islogical(void) const
dim_vector dims(void) const
octave_value get_color_data(void) const
bool get_do_lighting(void) const
void reset_default_properties(void)
void initialize(const graphics_object &go)
octave_scalar_map as_struct(const std::string &prefix_arg) const
plist_map_iterator find(const std::string &go_name)
plist_map_iterator end(void)
void set(const caseless_str &name, const octave_value &val)
plist_map_type::const_iterator plist_map_const_iterator
octave_value lookup(const caseless_str &name) const
pval_map_type::const_iterator pval_map_const_iterator
std::map< std::string, pval_map_type > plist_map_type
void delete_listener(const octave_value &v=octave_value(), listener_mode mode=GCB_POSTSET)
static OCTINTERP_API property create(const std::string &name, const graphics_handle &parent, const caseless_str &type, const octave_value_list &args)
void erase(const std::string pname)
const_iterator find(const std::string pname) const
octave_idx_type nelem(void) const
bool contains(const std::string &val, std::string &match)
Cell values_as_cell(void) const
OCTINTERP_API radio_values(const std::string &opt_string="")
std::string values_as_string(void) const
std::set< caseless_str > possible_vals
std::string default_value(void) const
octave_value property_value
set_event(const graphics_handle &h, const std::string &name, const octave_value &value, bool do_notify_toolkit=true, bool redraw_figure=false)
std::string property_name
string_vector & append(const std::string &s)
std::ostream & list_in_columns(std::ostream &, int width=0, const std::string &prefix="") const
std::string join(const std::string &sep="") const
octave_idx_type numel(void) const
octave_value get_color_data(void) const
bool get_do_lighting(void) const
void update_text_extent(void)
double get___fontsize_points__(double box_pix_height=0) const
void set_position(const octave_value &val)
void update_fontunits(const caseless_str &old_fontunits)
void update_fontunits(const caseless_str &old_units)
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
double get___fontsize_points__(double box_pix_height=0) const
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
double get___fontsize_points__(double box_pix_height=0) const
double get_fontsize_pixels(double box_pix_height=0) const
double get___fontsize_points__(double box_pix_height=0) const
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
static octave_idx_type find(octave_idx_type i, octave_idx_type *pp)
ColumnVector real(const ComplexColumnVector &a)
#define DECLARE_STATIC_FUNX(name, args_name, nargout_name)
OCTINTERP_API void print_usage(void)
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void warning(const char *fmt,...)
void interpreter_try(octave::unwind_protect &frame)
void warning_with_id(const char *id, const char *fmt,...)
void error(const char *fmt,...)
octave_value_list set_warning_state(const std::string &id, const std::string &state)
void disable_warning(const std::string &id)
int warning_enabled(const std::string &id)
octave_handle graphics_handle
static double default_screendepth(void)
static Matrix default_patch_vertices(void)
static void xset(const graphics_handle &h, const caseless_str &pname, const octave_value &val)
static Matrix default_surface_ydata(void)
static Matrix default_light_position(void)
static bool compare_property_values(const octave_value &ov1, const octave_value &ov2)
static Matrix default_patch_ydata(void)
static double make_handle_fraction(void)
void cross_product(double x1, double y1, double z1, double x2, double y2, double z2, double &x, double &y, double &z)
double dot(const ColumnVector &v1, const ColumnVector &v2)
static bool updating_zlabel_position
static Matrix default_image_cdata(void)
void translate(Matrix &m, double x, double y, double z)
static std::set< double > updating_aspectratios
OCTAVE_EXPORT octave_value_list Fdrawnow(octave::interpreter &interp, const octave_value_list &args, int)
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 Matrix default_data(void)
#define CONVERT_CDATA_1(ARRAY_T, VAL_FN, IS_REAL)
static bool updating_hggroup_limits
ColumnVector cross(const ColumnVector &v1, const ColumnVector &v2)
static void delete_graphics_objects(const NDArray vals, bool from_root=false)
static void finalize_r(const graphics_handle &h)
static Matrix default_figure_paperposition(void)
static Matrix default_figure_papersize(void)
graphics_handle gca(void)
static Matrix default_table_backgroundcolor(void)
static octave_value convert_ticklabel_string(const octave_value &val)
void get_children_limits(double &min_val, double &max_val, double &min_pos, double &max_neg, const Matrix &kids, char limit_type)
static Matrix screen_size_pixels(void)
double norm(const ColumnVector &v)
static void xreset_default_properties(graphics_handle h, property_list::pval_map_type factory_pval)
static bool updating_patch_data
void xform(ColumnVector &v, const Matrix &m)
static Matrix default_axes_position(void)
static Matrix default_screensize(void)
void normalize(ColumnVector &v)
static Matrix default_axes_view(void)
static Matrix default_surface_xdata(void)
static void close_figure(const graphics_handle &h)
Matrix xform_scale(double x, double y, double z)
static graphics_handle make_graphics_handle(const std::string &go_name, const graphics_handle &parent, bool integer_figure_handle=false, bool call_createfcn=true, bool notify_toolkit=true)
static void normalized_aspectratios(Matrix &aspectratios, const Matrix &scalefactors, double xlength, double ylength, double zlength)
static std::map< caseless_str, graphics_object > dprop_obj_map
static Matrix default_control_position(void)
static Matrix do_translate(double x0, double x1, const Matrix &lims, bool is_logscale)
static Matrix default_axes_tick(void)
std::vector< octave_idx_type > coplanar_partition(const Matrix &vert, const Matrix &idx, octave_idx_type nc, octave_idx_type jj)
static void update_text_pos(graphics_handle h)
static callback_props executing_callbacks
static double device_pixel_ratio(graphics_handle h)
static Matrix default_control_sliderstep(void)
ColumnVector cam2xform(const Array< double > &m)
static void delete_graphics_object(const graphics_handle &h, bool from_root=false)
static OCTAVE_NORETURN void err_set_invalid(const std::string &pname)
int calc_dimensions(const graphics_object &go)
static bool updating_ylabel_position
static bool ishghandle(const graphics_handle &h)
RowVector xform2cam(const ColumnVector &v)
static bool delete_executing
static void magform(double x, double &a, int &b)
static Matrix papersize_from_type(const caseless_str punits, const caseless_str ptype)
static std::map< uint32_t, bool > waitfor_results
static bool updating_axes_layout
static Matrix default_patch_xdata(void)
static void check_limit_vals(double &min_val, double &max_val, double &min_pos, double &max_neg, const octave_value &data)
static bool lookup_object_name(const caseless_str &name, caseless_str &go_name, caseless_str &rest)
static Matrix default_lim(bool logscale=false)
static void force_close_figure(const graphics_handle &h)
static Matrix default_table_position(void)
static int process_graphics_events(void)
static double convert_font_size(double font_size, const caseless_str &from_units, const caseless_str &to_units, double parent_height=0)
static Matrix viridis_colormap(void)
static void get_array_limits(const Array< T > &m, double &emin, double &emax, double &eminp, double &emaxp)
static void cleanup_waitfor_predelete_listener(const octave_value &listener)
static octave_value_list waitfor_listener(const octave_value_list &args, int)
static std::set< double > updating_axis_limits
bool set_property_in_handle(double handle, const std::string &property, const octave_value &arg, const std::string &func)
static void xset_gcbo(const graphics_handle &h)
static ColumnVector convert_label_position(const ColumnVector &p, const text::properties &props, const graphics_xform &xform, const Matrix &bbox)
void scale(Matrix &m, double x, double y, double z)
static octave_value convert_linestyleorder_string(const octave_value &val)
Matrix xform_translate(double x, double y, double z)
static std::string default_graphics_toolkit(void)
static void initialize_r(const graphics_handle &h)
static void cleanup_waitfor_id(uint32_t id)
static std::string get_graphics_object_type(double val)
octave_value get_property_from_handle(double handle, const std::string &property, const std::string &func)
Matrix xform_matrix(void)
static double default_screenpixelsperinch(void)
static bool updating_xlabel_position
ColumnVector xform_vector(void)
static Matrix default_surface_cdata(void)
ColumnVector transform(const Matrix &m, double x, double y, double z)
graphics_handle gcf(void)
static void do_cleanup_waitfor_listener(const octave_value &listener, listener_mode mode=GCB_POSTSET)
static void xinitialize(const graphics_handle &h)
static octave_value xget(const graphics_handle &h, const caseless_str &name)
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)
static Matrix default_data_lim(void)
#define CHECK_ARRAY_EQUAL(T, F, A)
static Matrix default_panel_position(void)
static octave_value_list waitfor_del_listener(const octave_value_list &args, int)
bool is_coplanar(const Matrix &cov)
static Matrix do_zoom(double val, double factor, const Matrix &lims, bool is_logscale)
static bool updating_title_position
static bool is_handle_visible(const graphics_handle &h)
static Matrix default_colororder(void)
static octave_value convert_cdata(const base_properties &props, const octave_value &cdata, bool is_scaled, int cdim)
static void adopt(const graphics_handle &parent_h, const graphics_handle &h)
static Matrix default_axes_ticklength(void)
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())
double force_in_range(double x, double lower, double upper)
static Matrix default_surface_zdata(void)
static void max_axes_scale(double &s, Matrix &limits, const Matrix &kids, double pbfactor, double dafactor, char limit_type, bool tight)
static void xcreatefcn(const graphics_handle &h)
static Matrix default_axes_outerposition(void)
static Matrix convert_position(const Matrix &pos, const caseless_str &from_units, const caseless_str &to_units, const Matrix &parent_dim)
static Matrix default_patch_faces(void)
static octave_value make_graphics_object(const std::string &go_name, bool integer_figure_handle, const octave_value_list &args)
static Matrix convert_text_position(const Matrix &pos, const text::properties &props, const caseless_str &from_units, const caseless_str &to_units)
static int toggle_warn(std::string id, bool on, int state=-1)
static bool isfigure(double val)
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_figure_position(void)
static void cleanup_waitfor_postset_listener(const octave_value &listener)
#define OCTAVE_DEFAULT_FONTNAME
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
F77_RET_T const F77_DBLE * x
F77_RET_T const F77_DBLE const F77_DBLE * f
Complex atan(const Complex &x)
std::complex< T > ceil(const std::complex< T > &x)
std::complex< T > floor(const std::complex< T > &x)
std::string dirname(const std::string &path)
std::string dir_sep_chars(void)
gh_manager & __get_gh_manager__(const std::string &who)
static uint32_t state[624]
interpreter & __get_interpreter__(const std::string &who)
void sleep(double seconds, bool do_graphics_events)
gtk_manager & __get_gtk_manager__(const std::string &who)
octave_value_list feval(const char *name, const octave_value_list &args, int nargout)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
display_info & __get_display_info__(const std::string &who)
octave_int< uint32_t > octave_uint32
octave_int< T > pow(const octave_int< T > &a, const octave_int< T > &b)
octave_int< T > xmin(const octave_int< T > &x, const octave_int< T > &y)
octave_int< T > xmax(const octave_int< T > &x, const octave_int< T > &y)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
static char default_im_data[]
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
const octave_char_matrix & v2
static octave_value box(JNIEnv *jni_env, void *jobj, void *jcls_arg=nullptr)
octave_value::octave_value(const Array< char > &chm, char type) return retval
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.