26 #if defined (HAVE_CONFIG_H)
74 OCTAVE_NORETURN
static
76 err_set_invalid (
const std::string& pname)
78 error (
"set: invalid value for %s property", pname.c_str ());
86 validate_property_name (
const std::string& who,
const std::string& what,
87 const std::set<std::string>& pnames,
90 std::size_t
len = pname.length ();
91 std::set<std::string> matches;
94 for (
const auto& propnm : pnames)
98 if (
len == propnm.length ())
101 matches.insert (propnm);
105 std::size_t num_matches = matches.size ();
107 if (num_matches == 0)
108 error (
"%s: unknown %s property %s",
109 who.c_str (), what.c_str (), pname.c_str ());
110 else if (num_matches > 1)
114 std::ostringstream os;
116 sv.list_in_columns (os);
118 std::string match_list = os.str ();
120 error (
"%s: ambiguous %s property name %s; possible matches:\n\n%s",
121 who.c_str (), what.c_str (), pname.c_str (), match_list.c_str ());
126 std::string possible_match = *(matches.begin ());
129 "%s: allowing %s to match %s property %s",
130 who.c_str (), pname.c_str (), what.c_str (),
131 possible_match.c_str ());
133 return possible_match;
148 const double cmapv[] =
150 2.67004010000000e-01, 2.72651720952381e-01, 2.77106307619048e-01,
151 2.80356151428571e-01, 2.82390045238095e-01, 2.83204606666667e-01,
152 2.82809341428571e-01, 2.81230763333333e-01, 2.78516153333333e-01,
153 2.74735528571429e-01, 2.69981791904762e-01, 2.64368580952381e-01,
154 2.58026184285714e-01, 2.51098684761905e-01, 2.43732853333333e-01,
155 2.36073294285714e-01, 2.28263191428571e-01, 2.20424955714286e-01,
156 2.12666598571429e-01, 2.05079113809524e-01, 1.97721880952381e-01,
157 1.90631350000000e-01, 1.83819438571429e-01, 1.77272360952381e-01,
158 1.70957518571429e-01, 1.64832915714286e-01, 1.58845368095238e-01,
159 1.52951235714286e-01, 1.47131626666667e-01, 1.41402210952381e-01,
160 1.35832975714286e-01, 1.30582113809524e-01, 1.25898377619048e-01,
161 1.22163105714286e-01, 1.19872409523810e-01, 1.19626570000000e-01,
162 1.22045948571429e-01, 1.27667691904762e-01, 1.36834947142857e-01,
163 1.49643331428571e-01, 1.65967274285714e-01, 1.85538397142857e-01,
164 2.08030450000000e-01, 2.33127309523809e-01, 2.60531475238095e-01,
165 2.90000730000000e-01, 3.21329971428571e-01, 3.54355250000000e-01,
166 3.88930322857143e-01, 4.24933143333333e-01, 4.62246770476190e-01,
167 5.00753620000000e-01, 5.40336957142857e-01, 5.80861172380952e-01,
168 6.22170772857143e-01, 6.64087320476191e-01, 7.06403823333333e-01,
169 7.48885251428571e-01, 7.91273132857143e-01, 8.33302102380952e-01,
170 8.74717527142857e-01, 9.15296319047619e-01, 9.54839555238095e-01,
171 9.93247890000000e-01, 4.87433000000000e-03, 2.58456800000000e-02,
172 5.09139004761905e-02, 7.42014957142857e-02, 9.59536042857143e-02,
173 1.16893314761905e-01, 1.37350195714286e-01, 1.57479940000000e-01,
174 1.77347967619048e-01, 1.96969168571429e-01, 2.16330337619048e-01,
175 2.35404660952381e-01, 2.54161735714286e-01, 2.72573219047619e-01,
176 2.90619516666667e-01, 3.08291041428571e-01, 3.25586450952381e-01,
177 3.42517215238095e-01, 3.59102207142857e-01, 3.75366067142857e-01,
178 3.91340913333333e-01, 4.07061480000000e-01, 4.22563764285714e-01,
179 4.37885543809524e-01, 4.53062984285714e-01, 4.68129543809524e-01,
180 4.83117059523810e-01, 4.98052961428571e-01, 5.12959473333333e-01,
181 5.27854311428571e-01, 5.42750087142857e-01, 5.57652481904762e-01,
182 5.72563073333333e-01, 5.87476284285714e-01, 6.02382410952381e-01,
183 6.17265840000000e-01, 6.32106955714286e-01, 6.46881817142857e-01,
184 6.61562926190476e-01, 6.76119717142857e-01, 6.90518987142857e-01,
185 7.04725181904762e-01, 7.18700950000000e-01, 7.32406441904762e-01,
186 7.45802021904762e-01, 7.58846480000000e-01, 7.71497934761905e-01,
187 7.83714033809524e-01, 7.95453081428571e-01, 8.06673890000000e-01,
188 8.17337565714286e-01, 8.27409135714286e-01, 8.36858167619048e-01,
189 8.45663399523809e-01, 8.53815582857143e-01, 8.61321019047619e-01,
190 8.68206316666667e-01, 8.74522215714286e-01, 8.80346158571429e-01,
191 8.85780083333333e-01, 8.90945338571429e-01, 8.95973498571429e-01,
192 9.01005800000000e-01, 9.06156570000000e-01, 3.29415190000000e-01,
193 3.53367293333333e-01, 3.76236064761905e-01, 3.97901482857143e-01,
194 4.18250757142857e-01, 4.37178920000000e-01, 4.54595888571429e-01,
195 4.70433883333333e-01, 4.84653865714286e-01, 4.97250492857143e-01,
196 5.08254501428571e-01, 5.17731949047619e-01, 5.25780221428571e-01,
197 5.32522206190476e-01, 5.38097133333333e-01, 5.42651800000000e-01,
198 5.46335411904762e-01, 5.49287148571429e-01, 5.51635008571429e-01,
199 5.53493173333333e-01, 5.54953478571429e-01, 5.56089070000000e-01,
200 5.56952166666667e-01, 5.57576145714286e-01, 5.57974025714286e-01,
201 5.58142745238095e-01, 5.58058673809524e-01, 5.57684744285714e-01,
202 5.56973310000000e-01, 5.55864478571429e-01, 5.54288677142857e-01,
203 5.52175699047619e-01, 5.49445382857143e-01, 5.46023368571429e-01,
204 5.41830633809524e-01, 5.36795616666667e-01, 5.30847985714286e-01,
205 5.23924198571429e-01, 5.15966779523810e-01, 5.06924262857143e-01,
206 4.96751861428571e-01, 4.85412122857143e-01, 4.72873300000000e-01,
207 4.59105875238095e-01, 4.44095883333333e-01, 4.27825852857143e-01,
208 4.10292713809524e-01, 3.91487632857143e-01, 3.71420688571429e-01,
209 3.50098750000000e-01, 3.27544678571429e-01, 3.03798967142857e-01,
210 2.78916748571429e-01, 2.53000856190476e-01, 2.26223670000000e-01,
211 1.98879439523810e-01, 1.71494930000000e-01, 1.45037631428572e-01,
212 1.21291048571429e-01, 1.03326155238095e-01, 9.53507900000000e-02,
213 1.00469958095238e-01, 1.17876387142857e-01, 1.43936200000000e-01
219 std::copy (cmapv, cmapv + (64*3), cmap.fortran_vec ());
224 default_screendepth ()
228 return dpy_info.depth ();
232 default_screensize ()
240 retval(2) = dpy_info.width ();
241 retval(3) = dpy_info.height ();
247 default_screenpixelsperinch ()
251 return (dpy_info.x_dpi () + dpy_info.y_dpi ()) / 2;
255 default_colororder ()
257 Matrix retval (7, 3, 0.0);
259 retval(0, 1) = 0.447;
260 retval(0, 2) = 0.741;
262 retval(1, 0) = 0.850;
263 retval(1, 1) = 0.325;
264 retval(1, 2) = 0.098;
266 retval(2, 0) = 0.929;
267 retval(2, 1) = 0.694;
268 retval(2, 2) = 0.125;
270 retval(3, 0) = 0.494;
271 retval(3, 1) = 0.184;
272 retval(3, 2) = 0.556;
274 retval(4, 0) = 0.466;
275 retval(4, 1) = 0.674;
276 retval(4, 2) = 0.188;
278 retval(5, 0) = 0.301;
279 retval(5, 1) = 0.745;
280 retval(5, 2) = 0.933;
282 retval(6, 0) = 0.635;
283 retval(6, 1) = 0.078;
284 retval(6, 2) = 0.184;
290 default_lim (
bool logscale =
false)
333 default_image_cdata ()
338 for (
int col = 0; col < 64; col++)
339 for (
int row = 0; row < 64; row++)
341 m(col, row) =
static_cast<double> (default_im_data[i]);
349 default_surface_xdata ()
353 for (
int col = 0; col < 3; col++)
354 for (
int row = 0; row < 3; row++)
361 default_surface_ydata ()
365 for (
int row = 0; row < 3; row++)
366 for (
int col = 0; col < 3; col++)
373 default_surface_zdata ()
377 for (
int row = 0; row < 3; row++)
384 default_surface_cdata ()
386 return default_surface_zdata ();
390 default_patch_faces ()
402 default_patch_vertices ()
414 default_patch_xdata ()
424 default_patch_ydata ()
434 default_axes_position ()
447 default_axes_outerposition ()
486 default_axes_ticklength ()
497 default_figure_position ()
510 default_figure_papersize ()
521 default_figure_paperposition ()
526 m(0) = 1.3421852580027660;
527 m(1) = 3.3191389435020748;
528 m(2) = 5.8156294839944680;
529 m(3) = 4.3617221129958503;
535 default_graphics_toolkit ()
539 return gtk_mgr.default_toolkit ();
543 default_control_position ()
556 default_control_sliderstep ()
567 default_panel_position ()
580 default_light_position ()
592 default_table_position ()
605 default_table_backgroundcolor ()
618 make_graphics_handle (
const std::string& go_name,
620 bool integer_figure_handle =
false,
621 bool call_createfcn =
true,
622 bool notify_toolkit =
true)
627 call_createfcn, notify_toolkit);
631 convert_font_size (
double font_size,
const caseless_str& from_units,
636 if (from_units.
compare (to_units))
642 double points_size = 0;
645 if (from_units.
compare (
"points"))
646 points_size = font_size;
651 if (from_units.
compare (
"pixels"))
652 points_size = font_size * 72.0 / res;
653 else if (from_units.
compare (
"inches"))
654 points_size = font_size * 72.0;
655 else if (from_units.
compare (
"centimeters"))
656 points_size = font_size * 72.0 / 2.54;
657 else if (from_units.
compare (
"normalized"))
658 points_size = font_size * parent_height * 72.0 / res;
661 double new_font_size = 0;
663 if (to_units.
compare (
"points"))
664 new_font_size = points_size;
670 if (to_units.
compare (
"pixels"))
671 new_font_size = points_size * res / 72.0;
672 else if (to_units.
compare (
"inches"))
673 new_font_size = points_size / 72.0;
674 else if (to_units.
compare (
"centimeters"))
675 new_font_size = points_size * 2.54 / 72.0;
676 else if (to_units.
compare (
"normalized"))
680 if (parent_height > 0)
681 new_font_size = points_size * res / (parent_height * 72.0);
685 return new_font_size;
694 bool is_rectangle = (pos.
numel () == 4);
695 bool is_2D = (pos.
numel () == 2);
697 if (from_units.
compare (
"pixels"))
699 else if (from_units.
compare (
"normalized"))
701 retval(0) = pos(0) * parent_dim(0) + 1;
702 retval(1) = pos(1) * parent_dim(1) + 1;
705 retval(2) = pos(2) * parent_dim(0);
706 retval(3) = pos(3) * parent_dim(1);
711 else if (from_units.
compare (
"characters"))
720 f = 12.0 * res / 74.951;
724 retval(0) = 0.5 * pos(0) *
f;
725 retval(1) = pos(1) *
f;
728 retval(2) = 0.5 * pos(2) *
f;
729 retval(3) = pos(3) *
f;
742 if (from_units.
compare (
"points"))
744 else if (from_units.
compare (
"inches"))
746 else if (from_units.
compare (
"centimeters"))
751 retval(0) = pos(0) *
f + 1;
752 retval(1) = pos(1) *
f + 1;
755 retval(2) = pos(2) *
f;
756 retval(3) = pos(3) *
f;
763 if (! to_units.
compare (
"pixels"))
765 if (to_units.
compare (
"normalized"))
767 retval(0) = (retval(0) - 1) / parent_dim(0);
768 retval(1) = (retval(1) - 1) / parent_dim(1);
771 retval(2) /= parent_dim(0);
772 retval(3) /= parent_dim(1);
777 else if (to_units.
compare (
"characters"))
784 f = 12.0 * res / 74.951;
788 retval(0) = 2 * retval(0) /
f;
789 retval(1) = retval(1) /
f;
792 retval(2) = 2 * retval(2) /
f;
793 retval(3) = retval(3) /
f;
806 if (to_units.
compare (
"points"))
808 else if (to_units.
compare (
"inches"))
810 else if (to_units.
compare (
"centimeters"))
815 retval(0) = (retval(0) - 1) /
f;
816 retval(1) = (retval(1) - 1) /
f;
849 bool is_rectangle = (pos.
numel () == 4);
851 ax_size = ax_bbox.
extract_n (0, 2, 1, 2);
853 if (from_units.
compare (
"data"))
863 retval(0) = v1(0) - ax_bbox(0) + 1;
864 retval(1) = ax_bbox(1) + ax_bbox(3) - v1(1) + 1;
865 retval(2) =
v2(0) - v1(0);
866 retval(3) = v1(1) -
v2(1);
874 retval(0) = v(0) - ax_bbox(0) + 1;
875 retval(1) = ax_bbox(1) + ax_bbox(3) - v(1) + 1;
880 retval = convert_position (pos, from_units,
"pixels", ax_size);
882 if (! to_units.
compare (
"pixels"))
889 v1 = ax_xform.
untransform (retval(0) + ax_bbox(0) - 1,
890 ax_bbox(1) + ax_bbox(3) - retval(1) + 1);
891 v2 = ax_xform.
untransform (retval(0) + retval(2) + ax_bbox(0) - 1,
892 ax_bbox(1) + ax_bbox(3) - (retval(1) + retval(3)) + 1);
898 retval(2) =
v2(0) - v1(0);
899 retval(3) =
v2(1) - v1(1);
904 v = ax_xform.
untransform (retval(0) + ax_bbox(0) - 1,
905 ax_bbox(1) + ax_bbox(3) - retval(1) + 1);
915 retval = convert_position (retval,
"pixels", to_units, ax_size);
924 screen_size_pixels ()
932 return convert_position (sz, obj.
get (
"units").
string_value (),
"pixels",
952 convert_cdata_2 (
bool is_scaled,
bool is_real,
double clim_0,
double clim_1,
977 av[i+lda] = cmapv[idx+nc];
978 av[i+2*lda] = cmapv[idx+2*nc];
982 template <
typename T>
989 convert_cdata_2 (is_scaled, is_real,
990 clim_0, clim_1, cmapv, cv[i], lda, nc, i, av);
995 bool is_scaled,
int cdim)
1000 if (dv.ndims () == cdim && dv(cdim-1) == 3)
1033 double *av = a.fortran_vec ();
1034 const double *cmapv = cmap.data ();
1036 double clim_0 = clim(0);
1037 double clim_1 = clim(1);
1047 #define CONVERT_CDATA_1(ARRAY_T, VAL_FN, IS_REAL) \
1050 ARRAY_T tmp = cdata. VAL_FN ## array_value (); \
1052 convert_cdata_1 (is_scaled, IS_REAL, clim_0, clim_1, cmapv, \
1053 tmp.data (), lda, nc, av); \
1082 warning (
"unsupported type for cdata (= %s). "
1083 "Valid types are int8, int16, int32, int64, uint8, uint16, "
1084 "uint32, uint64, double, single, and bool.",
1089 #undef CONVERT_CDATA_1
1094 template <
typename T>
1096 get_array_limits (
const Array<T>&
m,
double& emin,
double& emax,
1097 double& eminp,
double& emaxp)
1099 const T *data =
m.data ();
1104 double e = double (data[i]);
1115 if (e > 0 && e < eminp)
1118 if (e < 0 && e > emaxp)
1128 int len = name.length ();
1130 bool result =
false;
1141 pfx = name.substr (0, 5);
1147 pfx = name.substr (0, 6);
1153 pfx = name.substr (0, 7);
1161 pfx = name.substr (0, 9);
1168 pfx = name.substr (0, 10);
1170 if (pfx.
compare (
"uipushtool"))
1174 pfx = name.substr (0, 12);
1176 if (pfx.
compare (
"uitoggletool"))
1180 pfx = name.substr (0, 13);
1182 if (pfx.
compare (
"uicontextmenu")
1183 || pfx.
compare (
"uibuttongroup"))
1196 rest = name.substr (offset);
1213 else if (type.
compare (
"axes"))
1214 go =
new axes (h, p);
1215 else if (type.
compare (
"line"))
1216 go =
new line (h, p);
1217 else if (type.
compare (
"text"))
1218 go =
new text (h, p);
1219 else if (type.
compare (
"image"))
1220 go =
new image (h, p);
1221 else if (type.
compare (
"light"))
1222 go =
new light (h, p);
1223 else if (type.
compare (
"patch"))
1224 go =
new patch (h, p);
1225 else if (type.
compare (
"scatter"))
1227 else if (type.
compare (
"surface"))
1229 else if (type.
compare (
"hggroup"))
1231 else if (type.
compare (
"uimenu"))
1233 else if (type.
compare (
"uicontrol"))
1235 else if (type.
compare (
"uipanel"))
1237 else if (type.
compare (
"uibuttongroup"))
1239 else if (type.
compare (
"uicontextmenu"))
1241 else if (type.
compare (
"uitable"))
1243 else if (type.
compare (
"uitoolbar"))
1245 else if (type.
compare (
"uipushtool"))
1247 else if (type.
compare (
"uitoggletool"))
1260 if (m_id >= 0 && do_notify_toolkit)
1286 for (
int i = 0; i < l.
length (); i++)
1291 : m_default_val (), m_possible_vals ()
1293 std::size_t beg = 0;
1294 std::size_t
len = opt_string.length ();
1295 bool done =
len == 0;
1299 std::size_t end = opt_string.find (
'|', beg);
1301 if (end == std::string::npos)
1307 std::string t = opt_string.substr (beg, end-beg);
1310 if (t.empty () && opt_string[beg] ==
'|')
1319 t = t.substr (1, t.length () - 2);
1325 m_possible_vals.insert (t);
1336 for (
const auto& val : m_possible_vals)
1338 if (retval.empty ())
1341 retval =
'{' + val +
'}';
1348 retval +=
" | {" + val +
'}';
1350 retval +=
" | " + val;
1354 if (! retval.empty ())
1355 retval =
"[ " + retval +
" ]";
1366 for (
const auto& val : m_possible_vals)
1367 retval(i++) = std::string (val);
1373 color_values::str2rgb (
const std::string& str_arg)
1377 double tmp_rgb[3] = {0, 0, 0};
1379 std::string str = str_arg;
1380 unsigned int len = str.length ();
1382 std::transform (str.begin (), str.end (), str.begin (), tolower);
1385 if (str.compare (0,
len,
"blue", 0,
len) == 0)
1387 else if (str.compare (0,
len,
"black", 0,
len) == 0
1388 || str.compare (0,
len,
"k", 0,
len) == 0)
1389 tmp_rgb[0] = tmp_rgb[1] = tmp_rgb[2] = 0;
1390 else if (str.compare (0,
len,
"red", 0,
len) == 0)
1392 else if (str.compare (0,
len,
"green", 0,
len) == 0)
1394 else if (str.compare (0,
len,
"yellow", 0,
len) == 0)
1395 tmp_rgb[0] = tmp_rgb[1] = 1;
1396 else if (str.compare (0,
len,
"magenta", 0,
len) == 0)
1397 tmp_rgb[0] = tmp_rgb[2] = 1;
1398 else if (str.compare (0,
len,
"cyan", 0,
len) == 0)
1399 tmp_rgb[1] = tmp_rgb[2] = 1;
1400 else if (str.compare (0,
len,
"white", 0,
len) == 0
1401 || str.compare (0,
len,
"w", 0,
len) == 0)
1402 tmp_rgb[0] = tmp_rgb[1] = tmp_rgb[2] = 1;
1403 else if (str[0] ==
'#' &&
len == 7)
1407 tmp_rgb[0] =
static_cast<double> (stoi (str.substr (1, 2),
nullptr, 16))
1409 tmp_rgb[1] =
static_cast<double> (stoi (str.substr (3, 2),
nullptr, 16))
1411 tmp_rgb[2] =
static_cast<double> (stoi (str.substr (5, 2),
nullptr, 16))
1414 catch (
const octave::execution_exception&)
1418 catch (
const std::invalid_argument&)
1424 else if (str[0] ==
'#' &&
len == 4)
1428 tmp_rgb[0] =
static_cast<double> (stoi (str.substr (1, 1),
nullptr, 16))
1430 tmp_rgb[1] =
static_cast<double> (stoi (str.substr (2, 1),
nullptr, 16))
1432 tmp_rgb[2] =
static_cast<double> (stoi (str.substr (3, 1),
nullptr, 16))
1435 catch (
const octave::execution_exception&)
1439 catch (
const std::invalid_argument&)
1449 for (
int i = 0; i < 3; i++)
1450 m_rgb(i) = tmp_rgb[i];
1464 error (R
"(invalid value for color property "%s")",
1469 if (m_radio_val.
contains (s, match))
1471 if (m_current_type != radio_t || match != m_current_val)
1473 if (s.length () != match.length ())
1475 "%s: allowing %s to match %s value %s",
1476 "set", s.c_str (),
get_name ().c_str (),
1478 m_current_val = match;
1479 m_current_type = radio_t;
1489 if (m_current_type != color_t || col != m_color_val)
1492 m_current_type = color_t;
1496 catch (octave::execution_exception& ee)
1498 error (ee, R
"(invalid value for color property "%s" (value = %s))",
1507 if (
m.numel () != 3)
1508 error (R
"(invalid value for color property "%s")",
1513 if (m_current_type != color_t || col != m_color_val)
1516 m_current_type = color_t;
1521 error (R
"(invalid value for color property "%s")",
1535 if (s.empty () || ! m_radio_val.
contains (s, match))
1536 error (R
"(invalid value for double_radio property "%s")",
1539 if (m_current_type != radio_t || match != m_current_val)
1541 if (s.length () != match.length ())
1543 "%s: allowing %s to match %s value %s",
1544 "set", s.c_str (),
get_name ().c_str (),
1546 m_current_val = match;
1547 m_current_type = radio_t;
1555 if (m_current_type != double_t || new_dval != m_dval)
1558 m_current_type = double_t;
1563 error (R
"(invalid value for double_radio property "%s")",
1592 int vlen = vdims.
ndims ();
1603 if (itdims.
ndims () == vlen)
1607 for (
int i = 0; xok && i < vlen; i++)
1611 if (itdims(i) != vdims(i))
1614 else if (itdims(i) == 0)
1633 error (R
"(set: "%s" must be greater than or equal to %g)",
1636 error (R
"(set: "%s" must be greater than %g)",
1644 error (R
"(set: "%s" must be less than or equal to %g)",
1647 error (R
"(set: "%s" must be less than %g)",
1656 error (R
"(set: "%s" must be finite)", get_name ().c_str ());
1662 error (R
"(set: "%s" must not be nan)", get_name ().c_str ());
1668 error (R
"(set: "%s" must not be infinite)", get_name ().c_str ());
1684 #define CHECK_ARRAY_EQUAL(T, F, A) \
1686 if (m_data.numel () == 1) \
1687 return m_data.F ## scalar_value () == \
1688 v.F ## scalar_value (); \
1694 const A m1 = m_data.F ## array_value (); \
1695 const T *d1 = m1.data (); \
1696 const A m2 = v.F ## array_value (); \
1697 const T *d2 = m2.data (); \
1701 for (int i = 0; flag && i < m_data.numel (); i++) \
1702 if (d1[i] != d2[i]) \
1736 array_property::get_data_limits ()
1782 if (!
get ().isempty ())
1791 double dv = v.
xdouble_value (R
"(set: invalid graphics handle for property "%s")",
1799 bool type_ok =
true;
1816 error (R
"(set: invalid graphics handle (= %g) for property "%s")",
1819 error (R
"(set: invalid graphics object type for property "%s")",
1823 if (m_current_val != gh)
1851 children_property::do_get_children (
bool return_hidden)
const
1853 Matrix retval (m_children_list.size (), 1);
1865 for (
const auto& hchild : m_children_list)
1871 if (! return_hidden)
1872 retval(k++) = hchild;
1874 else if (return_hidden)
1875 retval(k++) = hchild;
1878 retval.resize (k, 1);
1882 for (
const auto& hchild : m_children_list)
1883 retval(k++) = hchild;
1890 children_property::do_delete_children (
bool clear,
bool from_root)
1901 gh_mgr.
free (hchild, from_root);
1903 m_children_list.clear ();
1906 while (! m_children_list.empty ())
1913 gh_mgr.
free (hchild, from_root);
1918 m_children_list.clear ();
1922 callback_property::validate (
const octave_value& v)
const
1944 class callback_props
1948 callback_props () : m_set () { }
1950 OCTAVE_DISABLE_COPY_MOVE (callback_props)
1952 ~callback_props () =
default;
1954 bool empty ()
const {
return m_set.empty (); }
1958 m_set.insert (
reinterpret_cast<intptr_t
> (ptr));
1963 m_set.erase (
reinterpret_cast<intptr_t
> (ptr));
1968 return m_set.find (
reinterpret_cast<intptr_t
> (ptr)) != m_set.end ();
1973 std::set<intptr_t> m_set;
1980 static callback_props executing_callbacks;
1988 octave::unwind_action executing_callbacks_cleanup
1989 ([=] () { executing_callbacks.erase (
this); });
1991 if (! executing_callbacks.contains (
this))
1993 executing_callbacks.insert (
this);
2006 static std::map<caseless_str, graphics_object> dprop_obj_map;
2016 std::string sv = (args.
length () > 0 ? args(0).string_value () :
"");
2020 else if (type.
compare (
"any"))
2027 else if (type.
compare (
"radio"))
2030 error (
"addproperty: missing possible values for radio property");
2032 std::string sv = args(0).xstring_value (
"addproperty: argument for radio property must be a string");
2037 retval.set (args(1));
2039 else if (type.
compare (
"double"))
2041 double dv = (args.
length () > 0 ? args(0).double_value () : 0.0);
2045 else if (type.
compare (
"handle"))
2047 double hv = (args.
length () > 0 ? args(0).double_value ()
2054 else if (type.
compare (
"boolean"))
2059 retval.set (args(0));
2061 else if (type.
compare (
"data"))
2067 retval.set (args(0));
2072 else if (type.
compare (
"color"))
2082 if (args.
length () > 0 && ! args(0).isempty ())
2083 retval.set (args(0));
2091 if (! lookup_object_name (type, go_name, go_rest))
2092 error (
"addproperty: unsupported type for dynamic property (= %s)",
2097 std::map<caseless_str, graphics_object>::const_iterator it
2098 = dprop_obj_map.find (go_name);
2100 if (it == dprop_obj_map.end ())
2108 dprop_obj_map[go_name] = go;
2115 error (
"addproperty: invalid object type (= %s)",
2120 retval = prop.
clone ();
2123 retval.set_name (name);
2126 retval.set (args(0));
2143 for (
int k = 0; k < children.
numel (); k++)
2144 finalize_r (children(k));
2163 for (
int k = 0; k < children.
numel (); k++)
2164 initialize_r (children(k));
2175 m___graphics_toolkit__ = b.
get_name ();
2176 m___plot_stream__ =
Matrix ();
2187 std::string direction =
"in";
2195 if (modestr ==
"zoom in")
2197 val = modestr =
"zoom";
2200 else if (modestr ==
"zoom out")
2202 val = modestr =
"zoom";
2206 if (m___mouse_mode__.set (val,
true))
2208 std::string mode = m___mouse_mode__.current_value ();
2211 pm.
setfield (
"Enable", mode ==
"pan" ?
"on" :
"off");
2212 set___pan_mode__ (pm);
2215 rm.
setfield (
"Enable", mode ==
"rotate" ?
"on" :
"off");
2216 set___rotate_mode__ (rm);
2219 zm.
setfield (
"Enable", mode ==
"zoom" ?
"on" :
"off");
2220 zm.
setfield (
"Direction", direction);
2221 set___zoom_mode__ (zm);
2225 else if (modestr ==
"zoom")
2228 std::string curr_direction
2231 if (direction != curr_direction)
2233 zm.
setfield (
"Direction", direction);
2234 set___zoom_mode__ (zm);
2243 figure::properties::update_handlevisibility ()
2245 if (! is_handle_visible ())
2277 if (go.
isa (
"text"))
2284 else if (go.
isa (
"figure") || go.
isa (
"uipanel") || go.
isa (
"axes")
2285 || go.
isa (
"hggroup"))
2291 if (go.
isa (
"axes"))
2304 update_text_pos (get___myhandle__ ());
2312 std::size_t offset = 0;
2314 std::size_t
len = name.length ();
2325 pfx = name.substr (0, 5);
2331 pfx = name.substr (0, 6);
2337 pfx = name.substr (0, 7);
2345 pfx = name.substr (0, 9);
2352 pfx = name.substr (0, 10);
2354 if (pfx.
compare (
"uipushtool"))
2358 pfx = name.substr (0, 12);
2360 if (pfx.
compare (
"uitoogletool"))
2364 pfx = name.substr (0, 13);
2366 if (pfx.
compare (
"uicontextmenu")
2367 || pfx.
compare (
"uibuttongroup"))
2381 std::string pname = name.substr (offset);
2383 std::transform (pfx.begin (), pfx.end (), pfx.begin (), tolower);
2387 bool has_property =
false;
2390 else if (pfx ==
"figure")
2392 else if (pfx ==
"line")
2394 else if (pfx ==
"text")
2396 else if (pfx ==
"image")
2398 else if (pfx ==
"patch")
2400 else if (pfx ==
"scatter")
2402 else if (pfx ==
"surface")
2404 else if (pfx ==
"hggroup")
2406 else if (pfx ==
"uimenu")
2408 else if (pfx ==
"uicontrol")
2410 else if (pfx ==
"uibuttongroup")
2412 else if (pfx ==
"uipanel")
2414 else if (pfx ==
"uicontextmenu")
2416 else if (pfx ==
"uitable")
2418 else if (pfx ==
"uitoolbar")
2420 else if (pfx ==
"uipushtool")
2424 error (
"invalid %s property '%s'", pfx.c_str (), pname.c_str ());
2426 bool remove =
false;
2431 remove = (sval ==
"remove");
2438 auto p = pval_map.
find (pname);
2440 if (p != pval_map.end ())
2444 pval_map[pname] = val;
2449 error (
"invalid default property specification");
2457 std::size_t offset = 0;
2459 std::size_t
len = name.length ();
2470 pfx = name.substr (0, 5);
2476 pfx = name.substr (0, 6);
2482 pfx = name.substr (0, 7);
2490 pfx = name.substr (0, 9);
2497 pfx = name.substr (0, 10);
2499 if (pfx.
compare (
"uipushtool"))
2503 pfx = name.substr (0, 12);
2505 if (pfx.
compare (
"uitoggletool"))
2509 pfx = name.substr (0, 13);
2511 if (pfx.
compare (
"uicontextmenu")
2512 || pfx.
compare (
"uibuttongroup"))
2524 std::string pname = name.substr (offset);
2526 std::transform (pfx.begin (), pfx.end (), pfx.begin (), tolower);
2538 if (q != pval_map.end ())
2552 for (
const auto& p : *
this)
2554 std::string prefix = prefix_arg + p.first;
2556 for (
const auto& prop_val : p.second)
2557 m.assign (prefix + prop_val.first, prop_val.second);
2568 int nargin = args.
length ();
2571 error (
"graphics_object::set: Nothing to set");
2573 for (
int i = 0; i < nargin; )
2575 if (args(i).isstruct ())
2577 set (args(i).map_value ());
2580 else if (i < nargin - 1)
2582 caseless_str pname = args(i).xstring_value (
"set: argument %d must be a property name", i);
2584 set_value_or_default (pname, val);
2588 error (
"set: invalid number of arguments");
2611 error (
"set: number of names must match number of value columns "
2612 "(%" OCTAVE_IDX_TYPE_FORMAT
" != %" OCTAVE_IDX_TYPE_FORMAT
")",
2622 set_value_or_default (pname, val);
2684 set_value_or_default (pname, val);
2746 if (sval ==
"default")
2750 m_rep->set (pname, default_val);
2752 else if (sval ==
"factory")
2756 m_rep->set (pname, default_val);
2761 if (sval == R
"(\default)")
2762 m_rep->set (pname, "default");
2763 else if (sval == R
"(\factory)")
2764 m_rep->set (pname, "factory");
2766 m_rep->set (pname, val);
2770 m_rep->set (pname, val);
2818 parent_go.
adopt (h);
2828 ishghandle (
double val)
2851 result.xelem (i) = ishghandle (handles(i));
2883 toggle_warn (std::string
id,
bool on,
int state = -1)
2894 else if (state == 2)
2913 for (
const auto& p : pval)
2914 factory_pval[p.first] = p.second;
2917 int state = toggle_warn (
"Octave:deprecated-property",
false);
2920 for (
const auto& p : factory_pval)
2922 std::string pname = p.first;
2926 && pname.find (
"__") != 0 && pname.find (
"current") != 0
2927 && pname !=
"uicontextmenu" && pname !=
"parent")
2930 if (pname.find (
"mode") == (pname.length () - 4))
2931 pval[pname] = p.second;
2933 go.
set (pname, p.second);
2938 for (
const auto& p : pval)
2939 go.
set (p.first, p.second);
2941 toggle_warn (
"Octave:deprecated-property",
true, state);
2950 std::string go_name = graphics_object_name ();
2958 for (
const auto& prop_val : pval_map)
2960 std::string pname = prop_val.first;
2964 bgo.
set (pname, prop_val.second);
2966 catch (octave::execution_exception& ee)
2968 error (ee,
"error setting default property %s", pname.c_str ());
2993 std::map<caseless_str, property, cmp_caseless_str>::const_iterator it
2994 = m_all_props.find (pname);
2996 if (it == m_all_props.end ())
2997 error (R
"(get: unknown property "%s")", pname.c_str ());
2999 return it->second.get ();
3007 for (
const auto& it : m_all_props)
3008 if (all || ! it.second.is_hidden ())
3009 m.assign (it.second.get_name (), it.second.get ());
3014 std::set<std::string>
3017 return m_dynamic_properties;
3023 const std::set<std::string>& dynprops = dynamic_property_names ();
3025 if (dynprops.find (pname) != dynprops.end ())
3028 return m_all_props.find (pname) != m_all_props.end ();
3035 auto it = m_all_props.find (pname);
3037 if (it == m_all_props.end ())
3038 error (R
"(set: unknown property "%s")", pname.c_str ());
3040 it->second.set (val);
3042 m_dynamic_properties.insert (pname);
3050 std::map<caseless_str, property, cmp_caseless_str>::const_iterator it
3051 = m_all_props.find (pname);
3053 if (it == m_all_props.end ())
3054 error (R
"(get_property: unknown property "%s")", pname.c_str ());
3062 double hp = val.
xdouble_value (
"set: parent must be a graphics handle");
3063 if (hp == m___myhandle__)
3064 error (
"set: can not set object parent to be object itself");
3069 if (! new_parent.
ok ())
3070 error (
"set: invalid graphics handle (= %g) for parent", hp);
3083 new_parent_go = gh_mgr.
get_object (new_parent);
3084 if (new_parent_go.
get_parent () == m___myhandle__)
3092 octave::adopt (m_parent.handle_value (), m___myhandle__);
3111 m___modified__ =
"on";
3160 if (m_contextmenu.get ().isempty ())
3167 if (go && go.
isa (
"uicontextmenu"))
3178 return (m_handlevisibility.is (
"on")
3179 || (! executing_callbacks.empty () && ! m_handlevisibility.is (
"off")));
3182 octave::graphics_toolkit
3192 return octave::graphics_toolkit ();
3198 Matrix kids = get_children ();
3202 for (
int i = 0; i < kids.
numel (); i++)
3225 if (is_handle_visible ())
3292 property p = get_property (pname);
3295 p.add_listener (val, mode);
3303 property p = get_property (pname);
3306 p.delete_listener (val, mode);
3313 std::list<graphics_object>& children_list)
const
3317 Matrix ch = get_children ();
3328 if (go.
isa (chtype))
3329 children_list.push_back (go);
3330 else if (traverse && go.
isa (
"hggroup"))
3346 error (
"base_graphics_object::update_axis_limits: invalid graphics object");
3361 error (
"base_graphics_object::update_axis_limits: invalid graphics object");
3374 int state = toggle_warn (
"Octave:deprecated-property",
false);
3376 toggle_warn (
"Octave:deprecated-property",
true, state);
3378 for (
const auto& pm :
m)
3384 octave::unwind_protect frame;
3395 catch (
const octave::execution_exception&)
3399 interp.recover_from_exception ();
3406 const std::string go_name)
const
3409 const auto it = local_defaults.
find (go_name);
3411 if (it != local_defaults.
end ())
3414 for (
const auto& prop_val : pval_lst)
3416 std::string pname = prop_val.first;
3417 if (def.
find (pname) == def.end ())
3418 def[pname] = prop_val.second;
3441 xreset_default_properties (
get_handle (), factory_pval);
3449 error (
"base_graphics_object::values_as_string: invalid graphics object");
3458 for (
const auto& pm :
m)
3460 const auto& pname = pm.first;
3465 if (p.ok () && ! p.is_hidden ())
3467 retval +=
"\n\t" + std::string (pname) +
": ";
3474 if (! retval.empty ())
3486 error (
"base_graphics_object::value_as_string: invalid graphics object");
3496 if (p.ok () && ! p.is_hidden ())
3503 if (! retval.empty ())
3515 error (
"base_graphics_object::values_as_struct: invalid graphics object");
3523 for (
const auto& pm :
m)
3525 const auto& pname = pm.first;
3530 if (p.ok () && ! p.is_hidden ())
3533 retval.
assign (p.get_name (), p.values_as_cell ());
3594 else if (ishghandle (val))
3595 m_callbackobject = val;
3597 err_set_invalid (
"callbackobject");
3607 m_currentfigure = val;
3617 err_set_invalid (
"currentfigure");
3623 if (m_integerhandle.set (val,
true))
3625 bool int_fig_handle = m_integerhandle.is_on ();
3633 m___myhandle__ = gh_mgr.
get_handle (int_fig_handle);
3643 Matrix kids = get_children ();
3654 if (m___myhandle__ == cf)
3655 xset (0,
"currentfigure", m___myhandle__.value ());
3657 this_go.
update (m_integerhandle.get_id ());
3668 std::string xunits = get_units ();
3670 Matrix scrn_sz = default_screensize ();
3672 double dpi = get_screenpixelsperinch ();
3674 if (xunits ==
"pixels")
3679 else if (xunits ==
"normalized")
3681 scrn_sz =
Matrix (1, 4, 1.0);
3685 else if (xunits ==
"inches")
3692 else if (xunits ==
"centimeters")
3696 scrn_sz(2) *= 2.54 / dpi;
3697 scrn_sz(3) *= 2.54 / dpi;
3699 else if (xunits ==
"points")
3703 scrn_sz(2) *= 72 / dpi;
3704 scrn_sz(3) *= 72 / dpi;
3706 else if (xunits ==
"characters")
3712 scrn_sz(2) *= 74.951 / 12.0 / dpi;
3713 scrn_sz(3) *= 74.951 / 12.0 / dpi;
3716 set_screensize (scrn_sz);
3722 Matrix screen_size = screen_size_pixels ();
3725 pos(2) = screen_size(0);
3726 pos(3) = screen_size(1);
3789 m_currentaxes = hax;
3791 err_set_invalid (
"currentaxes");
3799 if (h == m_currentaxes.handle_value ())
3803 Matrix kids = get_children ();
3813 if (go.
isa (
"axes"))
3815 new_currentaxes = kid;
3820 m_currentaxes = new_currentaxes;
3827 if (m_integerhandle.is_on ())
3828 return m___myhandle__.value ();
3833 octave::graphics_toolkit
3843 error (
"set___graphics_toolkit__: toolkit must be a string");
3849 octave::graphics_toolkit b = gtk_mgr.find_toolkit (nm);
3851 if (b.get_name () != nm)
3852 error (
"set___graphics_toolkit__: invalid graphics toolkit");
3854 if (nm != get___graphics_toolkit__ ())
3866 if (! get_currentaxes ().ok ())
3872 if (go.
type () ==
"axes")
3901 xset (0,
"currentfigure", m___myhandle__.value ());
3909 Matrix screen_size = screen_size_pixels ();
3911 get_position ().matrix_value () :
3912 get_outerposition ().matrix_value ());
3914 pos = convert_position (pos, get_units (),
"pixels", screen_size);
3918 pos(1) = screen_size(1) - pos(1) - pos(3);
3926 Matrix screen_size = screen_size_pixels ();
3929 pos(1) = screen_size(1) - pos(1) - pos(3);
3932 pos = convert_position (pos,
"pixels", get_units (), screen_size);
3938 bool do_notify_toolkit)
3940 Matrix screen_size = screen_size_pixels ();
3941 Matrix pos = bbox2position (bb);
3944 set_position (pos, do_notify_toolkit);
3946 set_outerposition (pos, do_notify_toolkit);
3952 Matrix bb = get_boundingbox (
true);
3958 pos(1) = bb(3) - pos(1);
3960 pos = convert_position (pos,
"pixels", get_units (),
3969 Matrix bb = get_boundingbox (
true);
3975 pos = convert_position (pos, get_units (),
"pixels",
3978 pos(1) = bb(3) - pos(1);
3985 bool do_notify_toolkit)
3988 bool modified =
false;
3990 old_bb = get_boundingbox (
true);
3991 modified = m_position.set (v,
false, do_notify_toolkit);
3992 new_bb = get_boundingbox (
true);
3994 if (old_bb != new_bb)
3996 if (old_bb(2) != new_bb(2) || old_bb(3) != new_bb(3))
4000 if (! get_resizefcn ().isempty ())
4003 if (! get_sizechangedfcn ().isempty ())
4006 update_boundingbox ();
4016 if (m_paperpositionmode.is (
"auto"))
4017 m_paperposition.set (get_auto_paperposition ());
4022 bool do_notify_toolkit)
4024 if (m_outerposition.set (v,
true, do_notify_toolkit))
4035 error (
"set: can't set paperunits to normalized when papertype is custom");
4038 if (m_paperunits.set (val,
true))
4040 update_paperunits (old_paperunits);
4052 error (
"set: can't set paperunits to normalized when papertype is custom");
4054 if (m_papertype.set (val,
true))
4056 update_papertype ();
4064 Matrix retval (1, 2, 1.0);
4066 if (! punits.
compare (
"normalized"))
4071 if (punits.
compare (
"inches"))
4074 mm2units = 1 / 25.4;
4076 else if (punits.
compare (
"centimeters"))
4079 mm2units = 1 / 10.0;
4084 mm2units = 72.0 / 25.4;
4087 if (ptype.
compare (
"usletter"))
4089 retval(0) = 8.5 * in2units;
4090 retval(1) = 11.0 * in2units;
4092 else if (ptype.
compare (
"uslegal"))
4094 retval(0) = 8.5 * in2units;
4095 retval(1) = 14.0 * in2units;
4097 else if (ptype.
compare (
"tabloid"))
4099 retval(0) = 11.0 * in2units;
4100 retval(1) = 17.0 * in2units;
4102 else if (ptype.
compare (
"a0"))
4104 retval(0) = 841.0 * mm2units;
4105 retval(1) = 1189.0 * mm2units;
4107 else if (ptype.
compare (
"a1"))
4109 retval(0) = 594.0 * mm2units;
4110 retval(1) = 841.0 * mm2units;
4112 else if (ptype.
compare (
"a2"))
4114 retval(0) = 420.0 * mm2units;
4115 retval(1) = 594.0 * mm2units;
4117 else if (ptype.
compare (
"a3"))
4119 retval(0) = 297.0 * mm2units;
4120 retval(1) = 420.0 * mm2units;
4122 else if (ptype.
compare (
"a4"))
4124 retval(0) = 210.0 * mm2units;
4125 retval(1) = 297.0 * mm2units;
4127 else if (ptype.
compare (
"a5"))
4129 retval(0) = 148.0 * mm2units;
4130 retval(1) = 210.0 * mm2units;
4132 else if (ptype.
compare (
"b0"))
4134 retval(0) = 1029.0 * mm2units;
4135 retval(1) = 1456.0 * mm2units;
4137 else if (ptype.
compare (
"b1"))
4139 retval(0) = 728.0 * mm2units;
4140 retval(1) = 1028.0 * mm2units;
4142 else if (ptype.
compare (
"b2"))
4144 retval(0) = 514.0 * mm2units;
4145 retval(1) = 728.0 * mm2units;
4147 else if (ptype.
compare (
"b3"))
4149 retval(0) = 364.0 * mm2units;
4150 retval(1) = 514.0 * mm2units;
4152 else if (ptype.
compare (
"b4"))
4154 retval(0) = 257.0 * mm2units;
4155 retval(1) = 364.0 * mm2units;
4157 else if (ptype.
compare (
"b5"))
4159 retval(0) = 182.0 * mm2units;
4160 retval(1) = 257.0 * mm2units;
4162 else if (ptype.
compare (
"arch-a"))
4164 retval(0) = 9.0 * in2units;
4165 retval(1) = 12.0 * in2units;
4167 else if (ptype.
compare (
"arch-b"))
4169 retval(0) = 12.0 * in2units;
4170 retval(1) = 18.0 * in2units;
4172 else if (ptype.
compare (
"arch-c"))
4174 retval(0) = 18.0 * in2units;
4175 retval(1) = 24.0 * in2units;
4177 else if (ptype.
compare (
"arch-d"))
4179 retval(0) = 24.0 * in2units;
4180 retval(1) = 36.0 * in2units;
4182 else if (ptype.
compare (
"arch-e"))
4184 retval(0) = 36.0 * in2units;
4185 retval(1) = 48.0 * in2units;
4189 retval(0) = 8.5 * in2units;
4190 retval(1) = 11.0 * in2units;
4194 retval(0) = 11.0 * in2units;
4195 retval(1) = 17.0 * in2units;
4199 retval(0) = 17.0 * in2units;
4200 retval(1) = 22.0 * in2units;
4204 retval(0) = 22.0 * in2units;
4205 retval(1) = 34.0 * in2units;
4209 retval(0) = 34.0 * in2units;
4210 retval(1) = 43.0 * in2units;
4218 figure::properties::get_auto_paperposition ()
4220 Matrix pos = get_position ().matrix_value ();
4227 if (funits ==
"normalized" || punits ==
"normalized")
4229 sz = screen_size_pixels ();
4230 pos = convert_position (pos, funits,
"inches", sz);
4232 if (punits ==
"normalized")
4233 sz = papersize_from_type (
"points", get_papertype ());
4235 pos = convert_position (pos,
"inches", punits, sz);
4238 pos = convert_position (pos, funits, punits, sz);
4241 sz = get_papersize ().matrix_value ();
4243 pos(0) = sz(0)/2 - pos(2)/2;
4244 pos(1) = sz(1)/2 - pos(3)/2;
4335 Matrix pos = get_paperposition ().matrix_value ();
4336 Matrix sz = get_papersize ().matrix_value ();
4343 std::string porient = get_paperorientation ();
4347 if (ptype.
compare (
"<custom>"))
4349 if (old_paperunits.
compare (
"centimeters"))
4354 else if (old_paperunits.
compare (
"points"))
4360 if (punits.
compare (
"centimeters"))
4365 else if (punits.
compare (
"points"))
4373 sz = papersize_from_type (punits, ptype);
4374 if (porient ==
"landscape")
4375 std::swap (sz(0), sz(1));
4390 std::string typ = get_papertype ();
4391 if (typ !=
"<custom>")
4393 Matrix sz = papersize_from_type (get_paperunits (), typ);
4394 if (get_paperorientation () ==
"landscape")
4395 std::swap (sz(0), sz(1));
4401 if (m_paperpositionmode.is (
"auto"))
4402 m_paperposition.set (get_auto_paperposition ());
4408 Matrix sz = get_papersize ().matrix_value ();
4411 std::swap (sz(0), sz(1));
4417 m_paperorientation.set (
"portrait");
4420 std::string punits = get_paperunits ();
4421 if (punits ==
"centimeters")
4426 else if (punits ==
"points")
4431 if (punits ==
"normalized")
4433 if (get_papertype () ==
"<custom>")
4434 error (
"set: can't set the papertype to <custom> when the paperunits is normalized");
4441 std::string ptype =
"<custom>";
4442 const double mm2in = 1.0 / 25.4;
4443 const double tol = 0.01;
4445 if (std::abs (sz(0) - 8.5) + std::abs (sz(1) - 11.0) < tol)
4447 else if (std::abs (sz(0) - 8.5) + std::abs (sz(1) - 14.0) < tol)
4449 else if (std::abs (sz(0) - 11.0) + std::abs (sz(1) - 17.0) < tol)
4451 else if (std::abs (sz(0) - 841.0 * mm2in)
4452 + std::abs (sz(1) - 1198.0 * mm2in) < tol)
4454 else if (std::abs (sz(0) - 594.0 * mm2in)
4455 + std::abs (sz(1) - 841.0 * mm2in) < tol)
4457 else if (std::abs (sz(0) - 420.0 * mm2in)
4458 + std::abs (sz(1) - 594.0 * mm2in) < tol)
4460 else if (std::abs (sz(0) - 297.0 * mm2in)
4461 + std::abs (sz(1) - 420.0 * mm2in) < tol)
4463 else if (std::abs (sz(0) - 210.0 * mm2in)
4464 + std::abs (sz(1) - 297.0 * mm2in) < tol)
4466 else if (std::abs (sz(0) - 148.0 * mm2in)
4467 + std::abs (sz(1) - 210.0 * mm2in) < tol)
4469 else if (std::abs (sz(0) - 1029.0 * mm2in)
4470 + std::abs (sz(1) - 1456.0 * mm2in) < tol)
4472 else if (std::abs (sz(0) - 728.0 * mm2in)
4473 + std::abs (sz(1) - 1028.0 * mm2in) < tol)
4475 else if (std::abs (sz(0) - 514.0 * mm2in)
4476 + std::abs (sz(1) - 728.0 * mm2in) < tol)
4478 else if (std::abs (sz(0) - 364.0 * mm2in)
4479 + std::abs (sz(1) - 514.0 * mm2in) < tol)
4481 else if (std::abs (sz(0) - 257.0 * mm2in)
4482 + std::abs (sz(1) - 364.0 * mm2in) < tol)
4484 else if (std::abs (sz(0) - 182.0 * mm2in)
4485 + std::abs (sz(1) - 257.0 * mm2in) < tol)
4487 else if (std::abs (sz(0) - 9.0)
4488 + std::abs (sz(1) - 12.0) < tol)
4490 else if (std::abs (sz(0) - 12.0)
4491 + std::abs (sz(1) - 18.0) < tol)
4493 else if (std::abs (sz(0) - 18.0)
4494 + std::abs (sz(1) - 24.0) < tol)
4496 else if (std::abs (sz(0) - 24.0)
4497 + std::abs (sz(1) - 36.0) < tol)
4499 else if (std::abs (sz(0) - 36.0)
4500 + std::abs (sz(1) - 48.0) < tol)
4502 else if (std::abs (sz(0) - 8.5)
4503 + std::abs (sz(1) - 11.0) < tol)
4505 else if (std::abs (sz(0) - 11.0)
4506 + std::abs (sz(1) - 17.0) < tol)
4508 else if (std::abs (sz(0) - 17.0)
4509 + std::abs (sz(1) - 22.0) < tol)
4511 else if (std::abs (sz(0) - 22.0)
4512 + std::abs (sz(1) - 34.0) < tol)
4514 else if (std::abs (sz(0) - 34.0)
4515 + std::abs (sz(1) - 43.0) < tol)
4519 m_papertype.set (ptype);
4521 if (punits ==
"centimeters")
4526 else if (punits ==
"points")
4531 if (get_paperorientation () ==
"landscape")
4533 std::swap (sz(0), sz(1));
4537 if (m_paperpositionmode.is (
"auto"))
4538 m_paperposition.set (get_auto_paperposition ());
4576 std::string porient = get_paperorientation ();
4577 Matrix sz = get_papersize ().matrix_value ();
4578 if ((sz(0) > sz(1) && porient ==
"portrait")
4579 || (sz(0) < sz(1) && porient ==
"landscape"))
4581 std::swap (sz(0), sz(1));
4587 if (m_paperpositionmode.is (
"auto"))
4588 m_paperposition.set (get_auto_paperposition ());
4623 if (m_units.set (val,
true))
4625 update_units (old_units);
4633 m_position.set (convert_position (get_position ().matrix_value (),
4634 old_units, get_units (),
4635 screen_size_pixels ()),
false);
4660 if (! get_number ().isempty () && is_numbertitle ())
4662 std::ostringstream os;
4663 std::string nm = get_name ();
4665 os <<
"Figure " << m___myhandle__.value ();
4667 os <<
": " << get_name ();
4672 title = get_name ();
4708 plist.
erase (
"units");
4709 plist.
erase (
"position");
4710 plist.
erase (
"outerposition");
4711 plist.
erase (
"paperunits");
4712 plist.
erase (
"paperposition");
4713 plist.
erase (
"windowstyle");
4716 xreset_default_properties (
get_handle (), plist);
4724 m_position.add_constraint (
dim_vector (1, 4));
4725 m_outerposition.add_constraint (
dim_vector (1, 4));
4726 m_tightinset.add_constraint (
dim_vector (1, 4));
4727 m_looseinset.add_constraint (
dim_vector (1, 4));
4728 m_colororder.add_constraint (
dim_vector (-1, 3));
4729 m_dataaspectratio.add_constraint (3);
4730 m_dataaspectratio.add_constraint (
"min", 0,
false);
4731 m_dataaspectratio.add_constraint (
FINITE);
4732 m_plotboxaspectratio.add_constraint (3);
4733 m_plotboxaspectratio.add_constraint (
"min", 0,
false);
4734 m_plotboxaspectratio.add_constraint (
FINITE);
4737 m_alim.add_constraint (2);
4738 m_alim.add_constraint (
NOT_NAN);
4739 m_clim.add_constraint (2);
4740 m_clim.add_constraint (
NOT_NAN);
4741 m_xlim.add_constraint (2);
4742 m_xlim.add_constraint (
NOT_NAN);
4743 m_ylim.add_constraint (2);
4744 m_ylim.add_constraint (
NOT_NAN);
4745 m_zlim.add_constraint (2);
4746 m_zlim.add_constraint (
NOT_NAN);
4748 m_xtick.add_constraint (
FINITE);
4750 m_ytick.add_constraint (
FINITE);
4752 m_ztick.add_constraint (
FINITE);
4753 m_ticklength.add_constraint (
dim_vector (1, 2));
4758 m_cameraposition.add_constraint (3);
4759 m_cameraposition.add_constraint (
FINITE);
4760 m_cameratarget.add_constraint (3);
4761 m_cameratarget.add_constraint (
FINITE);
4764 m_cameraupvector = upv;
4765 m_cameraupvector.add_constraint (3);
4766 m_cameraupvector.add_constraint (
FINITE);
4767 m_cameraviewangle.add_constraint (
FINITE);
4768 m_currentpoint.add_constraint (
dim_vector (2, 3));
4771 m_fontsize.add_constraint (
"min", 0.0,
false);
4772 m_gridalpha.add_constraint (
"min", 0.0,
true);
4773 m_gridalpha.add_constraint (
"max", 1.0,
true);
4774 m_labelfontsizemultiplier.add_constraint (
"min", 0.0,
false);
4775 m_linewidth.add_constraint (
"min", 0.0,
false);
4776 m_minorgridalpha.add_constraint (
"min", 0.0,
true);
4777 m_minorgridalpha.add_constraint (
"max", 1.0,
true);
4778 m_titlefontsizemultiplier.add_constraint (
"min", 0.0,
false);
4783 m_x_zlim.resize (1, 2);
4789 calc_ticklabels (m_xtick, m_xticklabel, m_xscale.is (
"log"),
4790 xaxislocation_is (
"origin"),
4791 m_yscale.is (
"log") ? 2 : (yaxislocation_is (
"origin") ? 0 :
4792 (yaxislocation_is (
"left") ? -1 : 1)), m_xlim);
4793 calc_ticklabels (m_ytick, m_yticklabel, m_yscale.is (
"log"),
4794 yaxislocation_is (
"origin"),
4795 m_xscale.is (
"log") ? 2 : (xaxislocation_is (
"origin") ? 0 :
4796 (xaxislocation_is (
"bottom") ? -1 : 1)), m_ylim);
4797 calc_ticklabels (m_ztick, m_zticklabel, m_zscale.is (
"log"),
4800 xset (m_xlabel.handle_value (),
"handlevisibility",
"off");
4801 xset (m_ylabel.handle_value (),
"handlevisibility",
"off");
4802 xset (m_zlabel.handle_value (),
"handlevisibility",
"off");
4803 xset (m_title.handle_value (),
"handlevisibility",
"off");
4805 xset (m_xlabel.handle_value (),
"horizontalalignment",
"center");
4806 xset (m_xlabel.handle_value (),
"horizontalalignmentmode",
"auto");
4807 xset (m_ylabel.handle_value (),
"horizontalalignment",
"center");
4808 xset (m_ylabel.handle_value (),
"horizontalalignmentmode",
"auto");
4809 xset (m_zlabel.handle_value (),
"horizontalalignment",
"right");
4810 xset (m_zlabel.handle_value (),
"horizontalalignmentmode",
"auto");
4811 xset (m_title.handle_value (),
"horizontalalignment",
"center");
4812 xset (m_title.handle_value (),
"horizontalalignmentmode",
"auto");
4814 xset (m_xlabel.handle_value (),
"verticalalignment",
"top");
4815 xset (m_xlabel.handle_value (),
"verticalalignmentmode",
"auto");
4816 xset (m_ylabel.handle_value (),
"verticalalignment",
"bottom");
4817 xset (m_ylabel.handle_value (),
"verticalalignmentmode",
"auto");
4818 xset (m_title.handle_value (),
"verticalalignment",
"bottom");
4819 xset (m_title.handle_value (),
"verticalalignmentmode",
"auto");
4821 xset (m_ylabel.handle_value (),
"rotation", 90.0);
4822 xset (m_ylabel.handle_value (),
"rotationmode",
"auto");
4824 xset (m_zlabel.handle_value (),
"visible",
"off");
4826 xset (m_xlabel.handle_value (),
"clipping",
"off");
4827 xset (m_ylabel.handle_value (),
"clipping",
"off");
4828 xset (m_zlabel.handle_value (),
"clipping",
"off");
4829 xset (m_title.handle_value (),
"clipping",
"off");
4831 xset (m_xlabel.handle_value (),
"__autopos_tag__",
"xlabel");
4832 xset (m_ylabel.handle_value (),
"__autopos_tag__",
"ylabel");
4833 xset (m_zlabel.handle_value (),
"__autopos_tag__",
"zlabel");
4834 xset (m_title.handle_value (),
"__autopos_tag__",
"title");
4836 double fs = m_labelfontsizemultiplier.double_value () *
4837 m_fontsize.double_value ();
4841 fs = m_titlefontsizemultiplier.double_value () * m_fontsize.double_value ();
4843 xset (m_title.handle_value (),
"fontweight", m_titlefontweight.get ());
4845 adopt (m_xlabel.handle_value ());
4846 adopt (m_ylabel.handle_value ());
4847 adopt (m_zlabel.handle_value ());
4848 adopt (m_title.handle_value ());
4850 Matrix tlooseinset = default_axes_position ();
4851 tlooseinset(2) = 1-tlooseinset(0)-tlooseinset(2);
4852 tlooseinset(3) = 1-tlooseinset(1)-tlooseinset(3);
4853 m_looseinset = tlooseinset;
4880 axes::properties::calc_tightbox (
const Matrix& init_pos)
4892 update_ticklength ();
4894 Matrix ext = get_extent (
true,
true);
4895 ext(1) = parent_bb(3) - ext(1) - ext(3);
4898 ext = convert_position (ext,
"pixels", get_units (),
4900 if (ext(0) < pos(0))
4902 pos(2) += pos(0)-ext(0);
4905 if (ext(0)+ext(2) > pos(0)+pos(2))
4906 pos(2) = ext(0)+ext(2)-pos(0);
4908 if (ext(1) < pos(1))
4910 pos(3) += pos(1)-ext(1);
4913 if (ext(1)+ext(3) > pos(1)+pos(3))
4914 pos(3) = ext(1)+ext(3)-pos(1);
4923 if (m_positionconstraint.is (
"innerposition"))
4926 update_outerposition ();
4928 set_units (
"normalized");
4929 Matrix pos = m_position.get ().matrix_value ();
4930 Matrix outpos = m_outerposition.get ().matrix_value ();
4931 Matrix tightpos = calc_tightbox (pos);
4932 Matrix tinset (1, 4, 1.0);
4933 tinset(0) = pos(0)-tightpos(0);
4934 tinset(1) = pos(1)-tightpos(1);
4935 tinset(2) = tightpos(0)+tightpos(2)-pos(0)-pos(2);
4936 tinset(3) = tightpos(1)+tightpos(3)-pos(1)-pos(3);
4937 m_tightinset = tinset;
4938 set_units (old_units);
4939 update_transform ();
4940 if (m_positionconstraint.is (
"innerposition"))
4943 update_outerposition ();
5011 const std::string& who,
5026 if (go.
isa (
"text"))
5032 error (
"set: expecting text graphics object or character string for %s property, found %s",
5033 who.c_str (), cname.c_str ());
5036 xset (val,
"handlevisibility",
"off");
5048 set_text_child (m_xlabel,
"xlabel", v);
5049 xset (m_xlabel.handle_value (),
"positionmode",
"auto");
5050 xset (m_xlabel.handle_value (),
"rotationmode",
"auto");
5051 xset (m_xlabel.handle_value (),
"horizontalalignmentmode",
"auto");
5052 xset (m_xlabel.handle_value (),
"verticalalignmentmode",
"auto");
5053 xset (m_xlabel.handle_value (),
"clipping",
"off");
5054 xset (m_xlabel.handle_value (),
"color", get_xcolor ());
5055 xset (m_xlabel.handle_value (),
"__autopos_tag__",
"xlabel");
5056 update_xlabel_position ();
5062 set_text_child (m_ylabel,
"ylabel", v);
5063 xset (m_ylabel.handle_value (),
"positionmode",
"auto");
5064 xset (m_ylabel.handle_value (),
"rotationmode",
"auto");
5065 xset (m_ylabel.handle_value (),
"horizontalalignmentmode",
"auto");
5066 xset (m_ylabel.handle_value (),
"verticalalignmentmode",
"auto");
5067 xset (m_ylabel.handle_value (),
"clipping",
"off");
5068 xset (m_ylabel.handle_value (),
"color", get_ycolor ());
5069 xset (m_ylabel.handle_value (),
"__autopos_tag__",
"ylabel");
5070 update_ylabel_position ();
5076 set_text_child (m_zlabel,
"zlabel", v);
5077 xset (m_zlabel.handle_value (),
"positionmode",
"auto");
5078 xset (m_zlabel.handle_value (),
"rotationmode",
"auto");
5079 xset (m_zlabel.handle_value (),
"horizontalalignmentmode",
"auto");
5080 xset (m_zlabel.handle_value (),
"verticalalignmentmode",
"auto");
5081 xset (m_zlabel.handle_value (),
"clipping",
"off");
5082 xset (m_zlabel.handle_value (),
"color", get_zcolor ());
5083 xset (m_zlabel.handle_value (),
"__autopos_tag__",
"zlabel");
5084 update_zlabel_position ();
5090 set_text_child (m_title,
"title", v);
5091 xset (m_title.handle_value (),
"positionmode",
"auto");
5092 xset (m_title.handle_value (),
"horizontalalignment",
"center");
5093 xset (m_title.handle_value (),
"horizontalalignmentmode",
"auto");
5094 xset (m_title.handle_value (),
"verticalalignment",
"bottom");
5095 xset (m_title.handle_value (),
"verticalalignmentmode",
"auto");
5096 xset (m_title.handle_value (),
"clipping",
"off");
5097 xset (m_title.handle_value (),
"__autopos_tag__",
"title");
5098 update_title_position ();
5103 const std::string& mode)
5122 m_alimmode =
"auto";
5123 m_climmode =
"auto";
5124 m_xlimmode =
"auto";
5125 m_ylimmode =
"auto";
5126 m_zlimmode =
"auto";
5129 m_alphascale =
"linear";
5131 m_ambientlightcolor =
Matrix (1, 3, 1.0);
5134 m_boxstyle =
"back";
5137 m_camerapositionmode =
"auto";
5138 m_cameratargetmode =
"auto";
5139 m_cameraupvectormode =
"auto";
5140 m_cameraviewanglemode =
"auto";
5142 m_clippingstyle =
"3dbox";
5146 m_colororder = default_colororder ();
5147 m_colororderindex = 1.0;
5148 m_colorscale =
"linear";
5151 m_dataaspectratiomode =
"auto";
5153 m_fontangle =
"normal";
5156 m_fontsizemode =
"auto";
5157 m_fontsmoothing =
"on";
5158 m_fontunits =
"points";
5159 m_fontweight =
"normal";
5162 m_gridalphamode =
"auto";
5164 m_gridcolormode =
"auto";
5165 m_gridlinestyle =
"-";
5167 m_labelfontsizemultiplier = 1.1;
5171 m_linestyleorder =
"-";
5172 m_linestyleorderindex = 1.0;
5176 m_minorgridalpha = 0.25;
5177 m_minorgridalphamode =
"auto";
5179 m_minorgridcolormode =
"auto";
5180 m_minorgridlinestyle =
":";
5182 m_nextplot =
"replace";
5185 m_plotboxaspectratiomode =
"auto";
5186 m_projection =
"orthographic";
5188 m_sortmethod =
"depth";
5191 m_tickdirmode =
"auto";
5192 m_ticklabelinterpreter =
"tex";
5193 m_ticklength = default_axes_ticklength ();
5195 m_tightinset =
Matrix (1, 4, 0.0);
5197 m_titlefontsizemultiplier = 1.1;
5198 m_titlefontweight =
"bold";
5200 Matrix tview (1, 2, 0.0);
5204 m_xaxislocation =
"bottom";
5207 m_xcolormode =
"auto";
5210 m_xlimitmethod =
"tickaligned";
5211 m_xminorgrid =
"off";
5212 m_xminortick =
"off";
5213 m_xscale =
"linear";
5216 m_xticklabelmode =
"auto";
5217 m_xticklabelrotation = 0.0;
5218 m_xtickmode =
"auto";
5220 m_yaxislocation =
"left";
5223 m_ycolormode =
"auto";
5226 m_ylimitmethod =
"tickaligned";
5227 m_yminorgrid =
"off";
5228 m_yminortick =
"off";
5229 m_yscale =
"linear";
5232 m_yticklabelmode =
"auto";
5233 m_yticklabelrotation = 0.0;
5234 m_ytickmode =
"auto";
5237 m_zcolormode =
"auto";
5240 m_zlimitmethod =
"tickaligned";
5241 m_zminorgrid =
"off";
5242 m_zminortick =
"off";
5243 m_zscale =
"linear";
5246 m_zticklabelmode =
"auto";
5247 m_zticklabelrotation = 0.0;
5248 m_ztickmode =
"auto";
5260 go = gh_mgr.
get_object (m_ylabel.handle_value ());
5262 go = gh_mgr.
get_object (m_zlabel.handle_value ());
5264 go = gh_mgr.
get_object (m_title.handle_value ());
5267 xset (m_xlabel.handle_value (),
"handlevisibility",
"off");
5268 xset (m_ylabel.handle_value (),
"handlevisibility",
"off");
5269 xset (m_zlabel.handle_value (),
"handlevisibility",
"off");
5270 xset (m_title.handle_value (),
"handlevisibility",
"off");
5272 xset (m_xlabel.handle_value (),
"horizontalalignment",
"center");
5273 xset (m_xlabel.handle_value (),
"horizontalalignmentmode",
"auto");
5274 xset (m_ylabel.handle_value (),
"horizontalalignment",
"center");
5275 xset (m_ylabel.handle_value (),
"horizontalalignmentmode",
"auto");
5276 xset (m_zlabel.handle_value (),
"horizontalalignment",
"right");
5277 xset (m_zlabel.handle_value (),
"horizontalalignmentmode",
"auto");
5278 xset (m_title.handle_value (),
"horizontalalignment",
"center");
5279 xset (m_title.handle_value (),
"horizontalalignmentmode",
"auto");
5281 xset (m_xlabel.handle_value (),
"verticalalignment",
"top");
5282 xset (m_xlabel.handle_value (),
"verticalalignmentmode",
"auto");
5283 xset (m_ylabel.handle_value (),
"verticalalignment",
"bottom");
5284 xset (m_ylabel.handle_value (),
"verticalalignmentmode",
"auto");
5285 xset (m_title.handle_value (),
"verticalalignment",
"bottom");
5286 xset (m_title.handle_value (),
"verticalalignmentmode",
"auto");
5288 xset (m_ylabel.handle_value (),
"rotation", 90.0);
5289 xset (m_ylabel.handle_value (),
"rotationmode",
"auto");
5291 xset (m_zlabel.handle_value (),
"visible",
"off");
5293 xset (m_xlabel.handle_value (),
"clipping",
"off");
5294 xset (m_ylabel.handle_value (),
"clipping",
"off");
5295 xset (m_zlabel.handle_value (),
"clipping",
"off");
5296 xset (m_title.handle_value (),
"clipping",
"off");
5298 xset (m_xlabel.handle_value (),
"__autopos_tag__",
"xlabel");
5299 xset (m_ylabel.handle_value (),
"__autopos_tag__",
"ylabel");
5300 xset (m_zlabel.handle_value (),
"__autopos_tag__",
"zlabel");
5301 xset (m_title.handle_value (),
"__autopos_tag__",
"title");
5304 fs = m_labelfontsizemultiplier.double_value () * m_fontsize.double_value ();
5308 fs = m_titlefontsizemultiplier.double_value () * m_fontsize.double_value ();
5310 xset (m_title.handle_value (),
"fontweight", m_titlefontweight.get ());
5312 update_transform ();
5318 axes::properties::get_colormap ()
const
5320 if (m___colormap__.get ().isempty ())
5331 return get___colormap__ ();
5335 axes::properties::delete_text_child (
handle_property& hp,
bool from_root)
5346 gh_mgr.
free (h, from_root);
5354 if (! is_beingdeleted ())
5371 if (m_xlabel.handle_value ().ok () && h == m_xlabel.handle_value ())
5373 delete_text_child (m_xlabel, from_root);
5374 update_xlabel_position ();
5376 else if (m_ylabel.handle_value ().ok () && h == m_ylabel.handle_value ())
5378 delete_text_child (m_ylabel, from_root);
5379 update_ylabel_position ();
5381 else if (m_zlabel.handle_value ().ok () && h == m_zlabel.handle_value ())
5383 delete_text_child (m_zlabel, from_root);
5384 update_zlabel_position ();
5386 else if (m_title.handle_value ().ok () && h == m_title.handle_value ())
5388 delete_text_child (m_title, from_root);
5389 update_title_position ();
5391 else if (get_num_lights () > 0 && go.
isa (
"light")
5393 decrease_num_lights ();
5408 increase_num_lights ();
5418 if (xlimmode_is (
"auto"))
5421 if (ylimmode_is (
"auto"))
5424 if (zlimmode_is (
"auto"))
5427 if (climmode_is (
"auto"))
5430 if (climmode_is (
"auto"))
5439 for (
int i = 0; i < 4; i++)
5536 double fact = 1.0 / sqrt (v(0)*v(0)+v(1)*v(1)+v(2)*v(2));
5537 scale (v, fact, fact, fact);
5543 return (v1(0)*
v2(0)+v1(1)*
v2(1)+v1(2)*
v2(2));
5549 return sqrt (
dot (v, v));
5557 r(0) = v1(1)*
v2(2) - v1(2)*
v2(1);
5558 r(1) = v1(2)*
v2(0) - v1(0)*
v2(2);
5559 r(2) = v1(0)*
v2(1) - v1(1)*
v2(0);
5567 static double data[32] =
5580 memcpy (
m.fortran_vec (), data, sizeof (
double)*32);
5590 memcpy (retval.
fortran_vec (),
m.data (), sizeof (
double)*3);
5604 double xd = (xdir_is (
"normal") ? 1 : -1);
5605 double yd = (ydir_is (
"normal") ? 1 : -1);
5606 double zd = (zdir_is (
"normal") ? 1 : -1);
5608 Matrix xlimits = m_sx.scale (get_xlim ().matrix_value ());
5609 Matrix ylimits = m_sy.scale (get_ylim ().matrix_value ());
5610 Matrix zlimits = m_sz.scale (get_zlim ().matrix_value ());
5612 double xo = xlimits(xd > 0 ? 0 : 1);
5613 double yo = ylimits(yd > 0 ? 0 : 1);
5614 double zo = zlimits(zd > 0 ? 0 : 1);
5616 Matrix pb = get_plotboxaspectratio ().matrix_value ();
5618 bool autocam = (camerapositionmode_is (
"auto")
5619 && cameratargetmode_is (
"auto")
5620 && cameraupvectormode_is (
"auto")
5621 && cameraviewanglemode_is (
"auto"));
5622 bool dowarp = (autocam && dataaspectratiomode_is (
"auto")
5623 && plotboxaspectratiomode_is (
"auto"));
5629 if (cameratargetmode_is (
"auto"))
5631 c_center(0) = (xlimits(0) + xlimits(1)) / 2;
5632 c_center(1) = (ylimits(0) + ylimits(1)) / 2;
5633 c_center(2) = (zlimits(0) + zlimits(1)) / 2;
5638 c_center =
cam2xform (get_cameratarget ().matrix_value ());
5640 if (camerapositionmode_is (
"auto"))
5642 Matrix tview = get_view ().matrix_value ();
5643 double az = tview(0);
5644 double el = tview(1);
5645 double d = 5 * sqrt (pb(0)*pb(0) + pb(1)*pb(1) + pb(2)*pb(2));
5647 if (el == 90 || el == -90)
5653 c_eye(0) =
d * cos (el) * sin (az);
5654 c_eye(1) = -
d* cos (el) * cos (az);
5655 c_eye(2) =
d * sin (el);
5657 c_eye(0) = c_eye(0)*(xlimits(1)-xlimits(0))/(xd*pb(0))+c_center(0);
5658 c_eye(1) = c_eye(1)*(ylimits(1)-ylimits(0))/(yd*pb(1))+c_center(1);
5659 c_eye(2) = c_eye(2)*(zlimits(1)-zlimits(0))/(zd*pb(2))+c_center(2);
5664 c_eye =
cam2xform (get_cameraposition ().matrix_value ());
5666 if (cameraupvectormode_is (
"auto"))
5668 Matrix tview = get_view ().matrix_value ();
5669 double az = tview(0);
5670 double el = tview(1);
5672 if (el == 90 || el == -90)
5675 * sin (az*M_PI/180.0)*(xlimits(1)-xlimits(0))/pb(0);
5677 * cos (az*M_PI/180.0)*(ylimits(1)-ylimits(0))/pb(1);
5685 c_upv =
cam2xform (get_cameraupvector ().matrix_value ());
5696 scale (x_pre, pb(0), pb(1), pb(2));
5698 scale (x_pre, xd/(xlimits(1)-xlimits(0)), yd/(ylimits(1)-ylimits(0)),
5699 zd/(zlimits(1)-zlimits(0)));
5702 xform (c_eye, x_pre);
5703 xform (c_center, x_pre);
5704 scale (c_upv, pb(0)/(xlimits(1)-xlimits(0)), pb(1)/(ylimits(1)-ylimits(0)),
5705 pb(2)/(zlimits(1)-zlimits(0)));
5706 translate (c_center, -c_eye(0), -c_eye(1), -c_eye(2));
5712 if (std::abs (
dot (
f, UP)) > 1e-15)
5714 double fa = 1 / sqrt (1 -
f(2)*
f(2));
5715 scale (UP, fa, fa, fa);
5721 scale (x_view, 1, 1, -1);
5723 l(0, 0) = s(0); l(0, 1) = s(1); l(0, 2) = s(2);
5724 l(1, 0) = u(0); l(1, 1) = u(1); l(1, 2) = u(2);
5725 l(2, 0) = -
f(0); l(2, 1) = -
f(1); l(2, 2) = -
f(2);
5726 x_view = x_view * l;
5727 translate (x_view, -c_eye(0), -c_eye(1), -c_eye(2));
5728 scale (x_view, pb(0), pb(1), pb(2));
5734 double xM = cmax(0) - cmin(0);
5735 double yM = cmax(1) - cmin(1);
5737 Matrix bb = get_boundingbox (
true);
5741 if (cameraviewanglemode_is (
"auto"))
5748 if (
false && dowarp)
5749 af = (1.0 / (xM > yM ? xM : yM));
5752 if ((bb(2)/bb(3)) > (xM/yM))
5757 v_angle = 2 * (180.0 / M_PI) *
atan (1 / (2 * af *
norm (F)));
5759 m_cameraviewangle = v_angle;
5762 v_angle = get_cameraviewangle ();
5764 double pf = 1 / (2 * tan ((v_angle / 2) * M_PI / 180.0) *
norm (F));
5765 scale (x_projection, pf, pf, 1);
5771 translate (x_viewport, bb(0)+bb(2)/2, bb(1)+bb(3)/2, 0);
5772 scale (x_viewport, bb(2)/xM, -bb(3)/yM, 1);
5779 if ((bb(2)/bb(3)) > (xM/yM))
5785 pix = (bb(2) < bb(3) ? bb(2) : bb(3));
5786 translate (x_viewport, bb(0)+bb(2)/2, bb(1)+bb(3)/2, 0);
5787 scale (x_viewport, pix, -pix, 1);
5790 x_normrender = x_viewport * x_projection * x_view;
5796 m_x_zlim(0) = cmin(2);
5797 m_x_zlim(1) = cmax(2);
5799 m_x_render = x_normrender;
5800 scale (m_x_render, xd/(xlimits(1)-xlimits(0)), yd/(ylimits(1)-ylimits(0)),
5801 zd/(zlimits(1)-zlimits(0)));
5804 m_x_render_inv = m_x_render.inverse ();
5808 m_x_gl_mat1 = x_view;
5809 scale (m_x_gl_mat1, xd/(xlimits(1)-xlimits(0)), yd/(ylimits(1)-ylimits(0)),
5810 zd/(zlimits(1)-zlimits(0)));
5812 m_x_gl_mat2 = x_viewport * x_projection;
5815 static bool updating_axes_layout =
false;
5820 if (updating_axes_layout)
5825 double xd = (xdir_is (
"normal") ? 1 : -1);
5826 double yd = (ydir_is (
"normal") ? 1 : -1);
5827 double zd = (zdir_is (
"normal") ? 1 : -1);
5829 const Matrix xlims =
xform.xscale (get_xlim ().matrix_value ());
5830 const Matrix ylims =
xform.yscale (get_ylim ().matrix_value ());
5831 const Matrix zlims =
xform.zscale (get_zlim ().matrix_value ());
5833 double x_min, x_max, y_min, y_max, z_min, z_max;
5834 x_min = xlims(0), x_max = xlims(1);
5835 y_min = ylims(0), y_max = ylims(1);
5836 z_min = zlims(0), z_max = zlims(1);
5842 p1 =
xform.transform (x_min, (y_min+y_max)/2, (z_min+z_max)/2,
false);
5843 p2 =
xform.transform (x_max, (y_min+y_max)/2, (z_min+z_max)/2,
false);
5846 dir(2) = (p2(2) - p1(2));
5847 if (dir(0) == 0 && dir(1) == 0)
5849 else if (dir(2) == 0)
5853 else if (dir(1) == 0)
5860 m_xPlane = (dir(0) > 0 ? x_max : x_min);
5862 m_xPlane = (dir(1) < 0 ? x_max : x_min);
5865 m_xPlane = (dir(2) < 0 ? x_min : x_max);
5867 m_xPlaneN = (m_xPlane == x_min ? x_max : x_min);
5868 m_fx = (x_max - x_min) / sqrt (dir(0)*dir(0) + dir(1)*dir(1));
5870 p1 =
xform.transform ((x_min + x_max)/2, y_min, (z_min + z_max)/2,
false);
5871 p2 =
xform.transform ((x_min + x_max)/2, y_max, (z_min + z_max)/2,
false);
5874 dir(2) = (p2(2) - p1(2));
5875 if (dir(0) == 0 && dir(1) == 0)
5877 else if (dir(2) == 0)
5881 else if (dir(1) == 0)
5888 m_yPlane = (dir(0) > 0 ? y_max : y_min);
5890 m_yPlane = (dir(1) < 0 ? y_max : y_min);
5893 m_yPlane = (dir(2) < 0 ? y_min : y_max);
5895 m_yPlaneN = (m_yPlane == y_min ? y_max : y_min);
5896 m_fy = (y_max - y_min) / sqrt (dir(0)*dir(0) + dir(1)*dir(1));
5898 p1 =
xform.transform ((x_min + x_max)/2, (y_min + y_max)/2, z_min,
false);
5899 p2 =
xform.transform ((x_min + x_max)/2, (y_min + y_max)/2, z_max,
false);
5902 dir(2) = (p2(2) - p1(2));
5903 if (dir(0) == 0 && dir(1) == 0)
5905 else if (dir(2) == 0)
5909 else if (dir(1) == 0)
5916 m_zPlane = (dir(0) > 0 ? z_min : z_max);
5918 m_zPlane = (dir(1) < 0 ? z_min : z_max);
5921 m_zPlane = (dir(2) < 0 ? z_min : z_max);
5923 m_zPlaneN = (m_zPlane == z_min ? z_max : z_min);
5924 m_fz = (z_max - z_min) / sqrt (dir(0)*dir(0) + dir(1)*dir(1));
5926 octave::unwind_protect_var<bool> restore_var (updating_axes_layout,
true);
5928 m_xySym = (xd*yd*(m_xPlane-m_xPlaneN)*(m_yPlane-m_yPlaneN) > 0);
5929 m_zSign = (zd*(m_zPlane-m_zPlaneN) <= 0);
5930 m_xyzSym = (m_zSign ? m_xySym : ! m_xySym);
5931 m_xpTick = (m_zSign ? m_xPlaneN : m_xPlane);
5932 m_ypTick = (m_zSign ? m_yPlaneN : m_yPlane);
5933 m_zpTick = (m_zSign ? m_zPlane : m_zPlaneN);
5934 m_xpTickN = (m_zSign ? m_xPlane : m_xPlaneN);
5935 m_ypTickN = (m_zSign ? m_yPlane : m_yPlaneN);
5936 m_zpTickN = (m_zSign ? m_zPlaneN : m_zPlane);
5941 m_layer2Dtop =
false;
5944 Matrix ylimits = get_ylim ().matrix_value ();
5945 if (xaxislocation_is (
"top")
5946 || (yscale_is (
"log") && xaxislocation_is (
"origin")
5947 && (ylimits(1) < 0.)))
5949 std::swap (m_yPlane, m_yPlaneN);
5952 m_ypTick = m_yPlaneN;
5953 m_ypTickN = m_yPlane;
5954 Matrix xlimits = get_xlim ().matrix_value ();
5955 if (yaxislocation_is (
"right")
5956 || (xscale_is (
"log") && yaxislocation_is (
"origin")
5957 && (xlimits(1) < 0.)))
5959 std::swap (m_xPlane, m_xPlaneN);
5962 m_xpTick = m_xPlaneN;
5963 m_xpTickN = m_xPlane;
5964 if (layer_is (
"top"))
5966 m_zpTick = m_zPlaneN;
5967 m_layer2Dtop =
true;
5970 m_zpTick = m_zPlane;
5973 Matrix viewmat = get_view ().matrix_value ();
5974 m_nearhoriz = std::abs (viewmat(1)) <= 5;
5975 m_is2D = viewmat(1) == 90;
5977 update_ticklength ();
5981 axes::properties::update_ticklength ()
5987 if (tickdirmode_is (
"auto"))
5988 m_tickdir.set (mode2D ?
"in" :
"out",
true);
5991 std::string tickdir = get_tickdir ();
5992 if (tickdir ==
"in")
5994 else if (tickdir ==
"out")
5996 else if (tickdir ==
"both")
6001 Matrix bbox = get_boundingbox (
true);
6002 Matrix ticklen = get_ticklength ().matrix_value ();
6003 ticklen(0) *=
std::max (bbox(2), bbox(3));
6006 ticklen(1) *= (0.76 *
std::max (bbox(2), bbox(3)));
6008 m_xticklen = ticksign * (mode2D ? ticklen(0) : ticklen(1));
6009 m_yticklen = ticksign * (mode2D ? ticklen(0) : ticklen(1));
6010 m_zticklen = ticksign * (mode2D ? ticklen(0) : ticklen(1));
6012 double offset = get___fontsize_points__ () / 2;
6014 m_xtickoffset = (mode2D ?
std::max (0., m_xticklen) : std::
abs (m_xticklen)) +
6016 m_ytickoffset = (mode2D ?
std::max (0., m_yticklen) : std::
abs (m_yticklen)) +
6018 m_ztickoffset = (mode2D ?
std::max (0., m_zticklen) : std::
abs (m_zticklen)) +
6021 update_xlabel_position ();
6022 update_ylabel_position ();
6023 update_zlabel_position ();
6024 update_title_position ();
6053 std::string to_units = props.
get_units ();
6055 if (to_units !=
"data")
6061 retval(0) = v(0) - bbox(0) + 1;
6062 retval(1) = bbox(1) + bbox(3) - v(1) + 1;
6065 retval = convert_position (retval,
"pixels", to_units,
6074 static bool updating_xlabel_position =
false;
6079 if (updating_xlabel_position)
6094 octave::unwind_protect_var<bool>
6095 restore_var (updating_xlabel_position,
true);
6103 : (m_xyzSym ?
"left" :
"right"));
6111 (m_xstate ==
AXE_VERT_DIR || m_x2Dtop ?
"bottom" :
"top");
6123 ext = get_ticklabel_extents (get_xtick ().matrix_value (),
6124 get_xticklabel ().string_vector_value (),
6125 get_xlim ().matrix_value ());
6128 double wmax = ext(0) + margin;
6129 double hmax = ext(1) + margin;
6140 p =
xform.transform (p(0), p(1), p(2),
false);
6145 p(0) += (m_xyzSym ? wmax : -wmax);
6155 p(1) += (m_x2Dtop ? -hmax : hmax);
6161 p =
xform.untransform (p(0), p(1), p(2),
true);
6163 p = convert_label_position (p, xlabel_props,
xform,
6164 get_extent (
false));
6178 static bool updating_ylabel_position =
false;
6183 if (updating_ylabel_position)
6198 octave::unwind_protect_var<bool>
6199 restore_var (updating_ylabel_position,
true);
6207 : (! m_xyzSym ?
"left" :
"right"));
6215 (m_ystate ==
AXE_VERT_DIR && ! m_y2Dright ?
"bottom" :
"top");
6228 ext = get_ticklabel_extents (get_ytick ().matrix_value (),
6229 get_yticklabel ().string_vector_value (),
6230 get_ylim ().matrix_value ());
6232 double wmax = ext(0) + margin;
6233 double hmax = ext(1) + margin;
6244 p =
xform.transform (p(0), p(1), p(2),
false);
6249 p(0) += (! m_xyzSym ? wmax : -wmax);
6254 p(0) += (m_y2Dright ? wmax : -wmax);
6265 p =
xform.untransform (p(0), p(1), p(2),
true);
6267 p = convert_label_position (p, ylabel_props,
xform,
6268 get_extent (
false));
6282 static bool updating_zlabel_position =
false;
6287 if (updating_zlabel_position)
6300 bool camAuto = cameraupvectormode_is (
"auto");
6303 octave::unwind_protect_var<bool>
6304 restore_updating_zlabel_position (updating_zlabel_position,
true);
6311 ((m_zstate >
AXE_DEPTH_DIR || camAuto) ?
"center" :
"right");
6320 ?
"bottom" : ((m_zSign || camAuto) ?
"bottom" :
"top"));
6332 ext = get_ticklabel_extents (get_ztick ().matrix_value (),
6333 get_zticklabel ().string_vector_value (),
6334 get_zlim ().matrix_value ());
6337 double wmax = ext(0) + margin;
6338 double hmax = ext(1) + margin;
6345 (m_zpTickN + m_zpTick)/2);
6354 (m_zpTickN + m_zpTick)/2);
6361 p =
xform.transform (p(0), p(1), p(2),
false);
6391 p =
xform.untransform (p(0), p(1), p(2),
true);
6393 p = convert_label_position (p, zlabel_props,
xform,
6394 get_extent (
false));
6408 static bool updating_title_position =
false;
6413 if (updating_title_position)
6426 octave::unwind_protect_var<bool> restore_var (updating_title_position,
true);
6433 Matrix bbox = get_extent (
false);
6437 (m_x_zlim(0) + m_x_zlim(1))/2);
6442 ext = get_ticklabel_extents (get_xtick ().matrix_value (),
6443 get_xticklabel ().string_vector_value (),
6444 get_xlim ().matrix_value ());
6448 p =
xform.untransform (p(0), p(1), p(2),
true);
6450 p = convert_label_position (p, title_props,
xform, bbox);
6460 if (elem_type ==
"xlabel")
6461 update_xlabel_position ();
6462 else if (elem_type ==
"ylabel")
6463 update_ylabel_position ();
6464 else if (elem_type ==
"zlabel")
6465 update_zlabel_position ();
6466 else if (elem_type ==
"title")
6467 update_title_position ();
6468 else if (elem_type ==
"sync")
6473 normalized_aspectratios (
Matrix& aspectratios,
const Matrix& scalefactors,
6474 double xlength,
double ylength,
double zlength)
6476 double xval = xlength / scalefactors(0);
6477 double yval = ylength / scalefactors(1);
6478 double zval = zlength / scalefactors(2);
6482 aspectratios(0) = xval / minval;
6483 aspectratios(1) = yval / minval;
6484 aspectratios(2) = zval / minval;
6488 max_axes_scale (
double& s,
Matrix& limits,
const Matrix& kids,
6489 double pbfactor,
double dafactor,
char limit_type,
bool tight)
6509 static std::set<double> updating_aspectratios;
6514 if (updating_aspectratios.find (get___myhandle__ ().value ())
6515 != updating_aspectratios.end ())
6518 Matrix xlimits = get_xlim ().matrix_value ();
6519 Matrix ylimits = get_ylim ().matrix_value ();
6520 Matrix zlimits = get_zlim ().matrix_value ();
6522 double dx = (xlimits(1) - xlimits(0));
6523 double dy = (ylimits(1) - ylimits(0));
6524 double dz = (zlimits(1) - zlimits(0));
6526 Matrix da = get_dataaspectratio ().matrix_value ();
6527 Matrix pba = get_plotboxaspectratio ().matrix_value ();
6529 if (dataaspectratiomode_is (
"auto"))
6531 if (plotboxaspectratiomode_is (
"auto"))
6533 pba =
Matrix (1, 3, 1.0);
6534 m_plotboxaspectratio.set (pba,
false);
6537 normalized_aspectratios (da, pba, dx, dy, dz);
6538 m_dataaspectratio.set (da,
false);
6540 else if (plotboxaspectratiomode_is (
"auto"))
6542 normalized_aspectratios (pba, da, dx, dy, dz);
6543 m_plotboxaspectratio.set (pba,
false);
6548 bool modified_limits =
false;
6551 if (xlimmode_is (
"auto") && ylimmode_is (
"auto") && zlimmode_is (
"auto"))
6553 modified_limits =
true;
6554 kids = get_children ();
6555 max_axes_scale (s, xlimits, kids, pba(0), da(0),
'x',
true);
6556 max_axes_scale (s, ylimits, kids, pba(1), da(1),
'y',
true);
6557 max_axes_scale (s, zlimits, kids, pba(2), da(2),
'z',
true);
6559 else if (xlimmode_is (
"auto") && ylimmode_is (
"auto"))
6561 modified_limits =
true;
6562 max_axes_scale (s, zlimits, kids, pba(2), da(2),
'z',
false);
6564 else if (ylimmode_is (
"auto") && zlimmode_is (
"auto"))
6566 modified_limits =
true;
6567 max_axes_scale (s, xlimits, kids, pba(0), da(0),
'x',
false);
6569 else if (zlimmode_is (
"auto") && xlimmode_is (
"auto"))
6571 modified_limits =
true;
6572 max_axes_scale (s, ylimits, kids, pba(1), da(1),
'y',
false);
6575 if (modified_limits)
6577 octave::unwind_protect_var<std::set<double>>
6578 restore_var (updating_aspectratios);
6580 updating_aspectratios.insert (get___myhandle__ ().value ());
6582 dx = pba(0) * da(0);
6583 dy = pba(1) * da(1);
6584 dz = pba(2) * da(2);
6588 if (xlimmode_is (
"auto"))
6591 xlimits(0) = 0.5 * (xlimits(0) + xlimits(1) - dx);
6592 xlimits(1) = xlimits(0) + dx;
6594 set_xlimmode (
"auto");
6597 if (ylimmode_is (
"auto"))
6600 ylimits(0) = 0.5 * (ylimits(0) + ylimits(1) - dy);
6601 ylimits(1) = ylimits(0) + dy;
6603 set_ylimmode (
"auto");
6606 if (zlimmode_is (
"auto"))
6609 zlimits(0) = 0.5 * (zlimits(0) + zlimits(1) - dz);
6610 zlimits(1) = zlimits(0) + dz;
6612 set_zlimmode (
"auto");
6617 normalized_aspectratios (pba, da, dx, dy, dz);
6618 m_plotboxaspectratio.set (pba,
false);
6637 if (! prop.empty ())
6641 if (prop ==
"fontsize")
6644 get_titlefontsizemultiplier ());
6646 get_labelfontsizemultiplier ());
6648 else if (prop ==
"fontweight")
6649 tval =
get (
"titlefontweight");
6657 double dpr = device_pixel_ratio (get___myhandle__ ());
6661 m_txt_renderer.set_font (
get (
"fontname").string_value (),
6662 get (
"fontweight").string_value (),
6663 get (
"fontangle").string_value (),
6664 get (
"__fontsize_points__").double_value () * dpr);
6671 const Matrix& parent_pix_size)
const
6673 Matrix pos = (
internal ? get_position ().matrix_value ()
6674 : get_outerposition ().matrix_value ());
6675 Matrix parent_size (parent_pix_size);
6687 parent_size = default_figure_position ();
6690 pos = convert_position (pos, get_units (),
"pixels", parent_size);
6694 pos(1) = parent_size(1) - pos(1) - pos(3);
6707 for (
int i = 0; i <= 1; i++)
6708 for (
int j = 0; j <= 1; j++)
6709 for (
int k = 0; k <= 1; k++)
6712 j ? m_yPlaneN : m_yPlane,
6713 k ? m_zPlaneN : m_zPlane,
false);
6722 for (
int i = 0; i < 4; i++)
6726 htext = get_title ();
6728 htext = get_xlabel ();
6730 htext = get_ylabel ();
6732 htext = get_zlabel ();
6741 text_pos =
xform.transform (text_pos(0), text_pos(1), text_pos(2));
6744 ext(0) =
std::min (ext(0), text_pos(0));
6745 ext(1) =
std::min (ext(1), text_pos(1));
6746 ext(2) =
std::max (ext(2), text_pos(0));
6747 ext(3) =
std::max (ext(3), text_pos(1));
6755 double dpr = device_pixel_ratio (get___myhandle__ ());
6757 for (
int j = 0; j < 4; j++)
6760 bool ignore_horizontal =
false;
6761 bool ignore_vertical =
false;
6762 if (only_text_height)
6765 if (text_rotation == 0. || text_rotation == 180.)
6766 ignore_horizontal =
true;
6767 else if (text_rotation == 90. || text_rotation == 270.)
6768 ignore_vertical =
true;
6771 if (! ignore_horizontal)
6773 ext(0) =
std::min (ext(0), text_pos(0)+text_ext(0));
6775 text_pos(0)+text_ext(0)+text_ext(2));
6778 if (! ignore_vertical)
6781 text_pos(1)-text_ext(1)-text_ext(3));
6782 ext(3) =
std::max (ext(3), text_pos(1)-text_ext(1));
6788 ext(2) = ext(2) - ext(0);
6789 ext(3) = ext(3) - ext(1);
6811 std::ostringstream oss;
6819 if (std::abs (data(i)) < 1.0)
6830 std::istringstream iss (valstr);
6834 while (std::getline (iss, tmpstr,
'|'))
6838 if (*valstr.rbegin () ==
'|')
6839 sv.
append (std::string (
""));
6855 if (m_xticklabel.set (convert_ticklabel_string (val),
false))
6857 set_xticklabelmode (
"manual");
6862 set_xticklabelmode (
"manual");
6870 if (m_yticklabel.set (convert_ticklabel_string (val),
false))
6872 set_yticklabelmode (
"manual");
6877 set_yticklabelmode (
"manual");
6885 if (m_zticklabel.set (convert_ticklabel_string (val),
false))
6887 set_zticklabelmode (
"manual");
6892 set_zticklabelmode (
"manual");
6900 convert_linestyleorder_string (
const octave_value& val)
6916 std::istringstream iss (valstr);
6920 while (std::getline (iss, tmpstr,
'|'))
6924 if (*valstr.rbegin () ==
'|')
6925 sv.
append (std::string (
""));
6941 m_linestyleorder.set (convert_linestyleorder_string (val),
false);
6949 if (m_units.set (val,
true))
6951 update_units (old_units);
6968 (convert_position (get_position ().matrix_value (),
6969 old_units, new_units, parent_bb)),
6972 (convert_position (get_outerposition ().matrix_value (),
6973 old_units, new_units, parent_bb)),
6976 (convert_position (get_tightinset ().matrix_value (),
6977 old_units, new_units, parent_bb)),
6980 (convert_position (get_looseinset ().matrix_value (),
6981 old_units, new_units, parent_bb)),
6990 if (m_fontunits.set (val,
true))
6992 update_fontunits (old_fontunits);
7001 double parent_height = get_boundingbox (
true).elem (3);
7002 double fontsz = get_fontsize ();
7004 fontsz = convert_font_size (fontsz, old_units, new_units, parent_height);
7012 double fontsz = get_fontsize ();
7013 double parent_height = box_pix_height;
7015 if (fontunits_is (
"normalized") && parent_height <= 0)
7016 parent_height = get_boundingbox (
true).elem (3);
7018 return convert_font_size (fontsz, get_fontunits (),
"points", parent_height);
7048 bool use_scale)
const
7054 v(0) = m_sx.unscale (v(0));
7055 v(1) = m_sy.unscale (v(1));
7056 v(2) = m_sz.unscale (v(2));
7105 check_limit_vals (
double& min_val,
double& max_val,
7106 double& min_pos,
double& max_neg,
7114 if (
m.numel () != 4)
7144 magform (
double x,
double& a,
int& b)
7153 b =
static_cast<int> (
std::floor (std::log10 (std::abs (
x))));
7159 axes::properties::update_outerposition ()
7161 set_positionconstraint (
"outerposition");
7163 set_units (
"normalized");
7165 Matrix outerbox = m_outerposition.get ().matrix_value ();
7167 double outer_left = outerbox(0);
7168 double outer_bottom = outerbox(1);
7169 double outer_width = outerbox(2);
7170 double outer_height = outerbox(3);
7172 double outer_right = outer_width + outer_left;
7173 double outer_top = outer_height + outer_bottom;
7175 Matrix linset = m_looseinset.get ().matrix_value ();
7176 Matrix tinset = m_tightinset.get ().matrix_value ();
7178 double left_margin =
std::max (linset(0), tinset(0));
7179 double bottom_margin =
std::max (linset(1), tinset(1));
7180 double right_margin =
std::max (linset(2), tinset(2));
7181 double top_margin =
std::max (linset(3), tinset(3));
7183 double inner_left = outer_left;
7184 double inner_right = outer_right;
7186 if ((left_margin + right_margin) < outer_width)
7188 inner_left += left_margin;
7189 inner_right -= right_margin;
7192 double inner_bottom = outer_bottom;
7193 double inner_top = outer_top;
7195 if ((bottom_margin + top_margin) < outer_height)
7197 inner_bottom += bottom_margin;
7198 inner_top -= top_margin;
7201 double inner_width = inner_right - inner_left;
7202 double inner_height = inner_top - inner_bottom;
7206 innerbox(0) = inner_left;
7207 innerbox(1) = inner_bottom;
7208 innerbox(2) = inner_width;
7209 innerbox(3) = inner_height;
7211 m_position = innerbox;
7213 set_units (old_units);
7214 update_transform ();
7218 axes::properties::update_position ()
7220 set_positionconstraint (
"innerposition");
7222 set_units (
"normalized");
7224 Matrix innerbox = m_position.get ().matrix_value ();
7226 double inner_left = innerbox(0);
7227 double inner_bottom = innerbox(1);
7228 double inner_width = innerbox(2);
7229 double inner_height = innerbox(3);
7231 double inner_right = inner_width + inner_left;
7232 double inner_top = inner_height + inner_bottom;
7234 Matrix linset = m_looseinset.get ().matrix_value ();
7235 Matrix tinset = m_tightinset.get ().matrix_value ();
7237 double left_margin =
std::max (linset(0), tinset(0));
7238 double bottom_margin =
std::max (linset(1), tinset(1));
7239 double right_margin =
std::max (linset(2), tinset(2));
7240 double top_margin =
std::max (linset(3), tinset(3));
7244 double outer_left = inner_left - left_margin;
7245 double outer_bottom = inner_bottom - bottom_margin;
7246 double outer_right = inner_right + right_margin;
7247 double outer_top = inner_top + top_margin;
7249 double outer_width = outer_right - outer_left;
7250 double outer_height = outer_top - outer_bottom;
7254 outerbox(0) = outer_left;
7255 outerbox(1) = outer_bottom;
7256 outerbox(2) = outer_width;
7257 outerbox(3) = outer_height;
7259 m_outerposition = outerbox;
7261 set_units (old_units);
7262 update_transform ();
7266 axes::properties::update_looseinset ()
7269 set_units (
"normalized");
7271 Matrix linset = m_looseinset.get ().matrix_value ();
7272 Matrix tinset = m_tightinset.get ().matrix_value ();
7274 double left_margin =
std::max (linset(0), tinset(0));
7275 double bottom_margin =
std::max (linset(1), tinset(1));
7276 double right_margin =
std::max (linset(2), tinset(2));
7277 double top_margin =
std::max (linset(3), tinset(3));
7279 if (m_positionconstraint.is (
"innerposition"))
7281 Matrix innerbox = m_position.get ().matrix_value ();
7283 double inner_left = innerbox(0);
7284 double inner_bottom = innerbox(1);
7285 double inner_width = innerbox(2);
7286 double inner_height = innerbox(3);
7288 double inner_right = inner_width + inner_left;
7289 double inner_top = inner_height + inner_bottom;
7293 double outer_left = inner_left - left_margin;
7294 double outer_bottom = inner_bottom - bottom_margin;
7295 double outer_right = inner_right + right_margin;
7296 double outer_top = inner_top + top_margin;
7298 double outer_width = outer_right - outer_left;
7299 double outer_height = outer_top - outer_bottom;
7303 outerbox(0) = outer_left;
7304 outerbox(1) = outer_bottom;
7305 outerbox(2) = outer_width;
7306 outerbox(3) = outer_height;
7308 m_outerposition = outerbox;
7312 Matrix outerbox = m_outerposition.get ().matrix_value ();
7314 double outer_left = outerbox(0);
7315 double outer_bottom = outerbox(1);
7316 double outer_width = outerbox(2);
7317 double outer_height = outerbox(3);
7319 double outer_right = outer_width + outer_left;
7320 double outer_top = outer_height + outer_bottom;
7322 double inner_left = outer_left;
7323 double inner_right = outer_right;
7325 if ((left_margin + right_margin) < outer_width)
7327 inner_left += left_margin;
7328 inner_right -= right_margin;
7331 double inner_bottom = outer_bottom;
7332 double inner_top = outer_top;
7334 if ((bottom_margin + top_margin) < outer_height)
7336 inner_bottom += bottom_margin;
7337 inner_top -= top_margin;
7340 double inner_width = inner_right - inner_left;
7341 double inner_height = inner_top - inner_bottom;
7345 innerbox(0) = inner_left;
7346 innerbox(1) = inner_bottom;
7347 innerbox(2) = inner_width;
7348 innerbox(3) = inner_height;
7350 m_position = innerbox;
7353 set_units (old_units);
7354 update_transform ();
7362 axes::properties::calc_tick_sep (
double lo,
double hi)
7374 magform ((hi - lo) / ticint, a, b);
7376 static const double sqrt_2 = sqrt (2.0);
7377 static const double sqrt_10 = sqrt (10.0);
7378 static const double sqrt_50 = sqrt (50.0);
7382 else if (a < sqrt_10)
7384 else if (a < sqrt_50)
7397 double min_pos,
double max_neg,
7398 const bool logscale,
7399 const std::string& method)
7403 double min_val =
xmin;
7404 double max_val =
xmax;
7409 retval = default_lim (logscale);
7421 retval = default_lim (logscale);
7429 "axis: omitting non-positive data in log plot");
7432 else if (max_val == 0)
7436 if (std::abs (min_val - max_val)
7437 < sqrt (std::numeric_limits<double>::epsilon ()))
7452 if (method ==
"tickaligned")
7467 else if (method ==
"padded")
7472 double pad = (log10 (max_val) - log10 (min_val)) * 0.07;
7473 min_val =
std::pow (10, log10 (min_val) - pad);
7474 max_val =
std::pow (10, log10 (max_val) + pad);
7479 double pad = (log10 (-min_val) - log10 (-max_val)) * 0.07;
7480 min_val = -
std::pow (10, log10 (-min_val) + pad);
7481 max_val = -
std::pow (10, log10 (-max_val) - pad);
7487 if (min_val == 0 && max_val == 0)
7493 else if (std::abs (min_val - max_val)
7494 < sqrt (std::numeric_limits<double>::epsilon ()))
7496 min_val -= 0.1 * std::abs (min_val);
7497 max_val += 0.1 * std::abs (max_val);
7500 if (method ==
"tickaligned")
7502 double tick_sep = calc_tick_sep (min_val, max_val);
7503 double min_tick =
std::floor (min_val / tick_sep);
7504 double max_tick =
std::ceil (max_val / tick_sep);
7506 min_val =
std::min (min_val, tick_sep * min_tick);
7507 max_val =
std::max (max_val, tick_sep * max_tick);
7509 else if (method ==
"padded")
7511 double pad = 0.07 * (max_val - min_val);
7520 retval(0) = min_val;
7521 retval(1) = max_val;
7528 const bool logscale,
char& update_type)
7534 double eps = std::numeric_limits<double>::epsilon ();
7535 bool do_update =
false;
7536 bool have_children_limits =
false;
7544 have_children_limits =
true;
7548 limits(0) = min_val;
7553 limits(1) = max_val;
7556 if (limits(0) == 0 && limits(1) == 0)
7558 limits = default_lim (logscale);
7562 else if (! logscale && (std::abs (limits(0) - limits(1)) < sqrt (
eps)))
7564 limits(0) -= 0.1 * std::abs (limits(0));
7565 limits(1) += 0.1 * std::abs (limits(1));
7569 && (std::abs (std::log10 (limits(0) / limits(1))) < sqrt (
eps)))
7571 limits(0) = (limits(0) < 0 ? 10.0 * limits(0) : 0.1 * limits(0));
7572 limits(1) = (limits(1) < 0 ? 0.1 * limits(1) : 10.0 * limits(1));
7576 if (logscale && limits(0)*limits(1) <= 0)
7578 if (! have_children_limits)
7585 "Non-positive limit for logarithmic axis ignored\n");
7587 limits(0) = min_pos;
7589 limits(0) = 0.1 * limits(1);
7594 "Non-negative limit for logarithmic axis ignored\n");
7596 limits(1) = max_neg;
7598 limits(1) = 0.1 * limits(0);
7601 if (std::abs (limits(0) - limits(1)) < sqrt (
eps))
7756 bool limmode_is_auto,
7757 bool tickmode_is_auto,
7759 bool method_is_padded,
7760 bool method_is_tight)
7770 bool is_negative = lo < 0 && hi < 0;
7781 hi = std::log10 (-lo);
7782 lo = std::log10 (-tmp);
7786 hi = std::log10 (hi);
7787 lo = std::log10 (lo);
7792 if (tickmode_is_auto)
7804 tick_sep = calc_tick_sep (lo, hi);
7809 if (limmode_is_auto)
7813 if (! method_is_padded && ! method_is_tight)
7816 tmp_lims(0) =
std::min (tick_sep * i1, lo);
7817 tmp_lims(1) =
std::max (tick_sep * i2, hi);
7825 if (i1*tick_sep < lo)
7827 if (i2*tick_sep > hi && i2 > i1)
7833 tmp_lims(0) =
std::pow (10., tmp_lims(0));
7834 tmp_lims(1) =
std::pow (10., tmp_lims(1));
7836 if (tmp_lims(0) <= 0)
7841 double tmp = tmp_lims(0);
7842 tmp_lims(0) = -tmp_lims(1);
7852 if (i1*tick_sep < lo)
7854 if (i2*tick_sep > hi && i2 > i1)
7858 tmp_ticks =
Matrix (1, i2-i1+1);
7859 for (
int i = 0; i <= static_cast<int> (i2-i1); i++)
7861 tmp_ticks(i) = tick_sep * (i+i1);
7863 tmp_ticks(i) =
std::pow (10., tmp_ticks(i));
7865 if (is_logscale && is_negative)
7867 Matrix rev_ticks (1, i2-i1+1);
7868 rev_ticks = -tmp_ticks;
7869 for (
int i = 0; i <= static_cast<int> (i2-i1); i++)
7870 tmp_ticks(i) = rev_ticks(i2-i1-i);
7883 const int MAX_MINOR_TICKS = 1000;
7884 int n = (is_logscale ? 8 : 4);
7885 double mult_below = (is_logscale ? tmp_ticks(1) / tmp_ticks(0) : 1);
7886 double mult_above = (is_logscale ? tmp_ticks(n_ticks-1) / tmp_ticks(n_ticks-2)
7889 double d_below = (tmp_ticks(1) - tmp_ticks(0)) / mult_below / (
n+1);
7890 int n_below =
static_cast<int> (
std::floor ((tmp_ticks(0)-lo_lim) / d_below));
7893 else if (n_below > MAX_MINOR_TICKS)
7894 n_below = MAX_MINOR_TICKS;
7896 int n_between =
n * (n_ticks - 1);
7897 double d_above = (tmp_ticks(n_ticks-1) - tmp_ticks(n_ticks-2)) * mult_above
7899 int n_above =
static_cast<int> (
std::floor ((hi_lim-tmp_ticks(n_ticks-1))
7903 else if (n_above > MAX_MINOR_TICKS)
7904 n_above = MAX_MINOR_TICKS;
7906 Matrix tmp_mticks (1, n_below + n_between + n_above);
7907 for (
int i = 0; i < n_below; i++)
7908 tmp_mticks(i) = tmp_ticks(0) - (n_below-i) * d_below;
7909 for (
int i = 0; i < n_ticks-1; i++)
7911 double d = (tmp_ticks(i+1) - tmp_ticks(i)) / (
n + 1);
7912 for (
int j = 0; j <
n; j++)
7913 tmp_mticks(n_below+
n*i+j) = tmp_ticks(i) +
d * (j+1);
7915 for (
int i = 0; i < n_above; i++)
7916 tmp_mticks(n_below+n_between+i) = tmp_ticks(n_ticks-1) + (i + 1) * d_above;
7918 mticks = tmp_mticks;
7937 const bool is_origin,
7938 const int other_axislocation,
7944 std::ostringstream os;
7948 if (get_is2D () && is_origin)
7950 if (other_axislocation == 0)
7955 else if (other_axislocation == 1)
7956 omit_ticks(0) = lims(1);
7957 else if (other_axislocation == -1)
7958 omit_ticks(0) = lims(0);
7961 omit_ticks(1) = lims(0);
7962 omit_ticks(2) = lims(1);
7970 bool is_2digit_exp =
false;
7972 for (
int i = 0; i < values.
numel (); i++)
7974 double exp = std::abs (std::log10 (values(i)));
7977 is_2digit_exp =
true;
7982 for (
int i = 0; i < values.
numel (); i++)
7984 bool omit_tick =
false;
7985 for (
int i_omit = 0; i_omit < omit_ticks.numel (); i_omit++)
7986 if (values(i) == omit_ticks(i_omit))
7994 if (values(i) < 0.0)
7995 exponent =
std::floor (std::log10 (-values(i)));
7997 exponent =
std::floor (std::log10 (values(i)));
7998 significand = values(i) *
std::pow (10.0, -exponent);
8002 if ((std::abs (significand) - 1) >
8003 10*std::numeric_limits<double>::epsilon())
8004 os << significand <<
'x';
8005 else if (significand < 0)
8013 exponent = -exponent;
8015 if (exponent < 10.0 && is_2digit_exp)
8017 os << exponent <<
'}';
8019 if (m_ticklabelinterpreter.is (
"latex"))
8020 c(i) =
"$" + os.str () +
"$";
8027 for (
int i = 0; i < values.
numel (); i++)
8029 bool omit_tick =
false;
8030 for (
int i_omit = 0; i_omit < omit_ticks.numel (); i_omit++)
8031 if (values(i) == omit_ticks(i_omit))
8043 if (std::abs (values(i)) < 1.0)
8057 axes::properties::get_ticklabel_extents (
const Matrix& ticks,
8063 double dpr = device_pixel_ratio (get___myhandle__ ());
8066 for (
int i = 0; i <
n; i++)
8068 double val = ticks(i);
8069 if (limits(0) <= val && val <= limits(1))
8071 std::string label (ticklabels(i));
8072 label.erase (0, label.find_first_not_of (
' '));
8073 label = label.substr (0, label.find_last_not_of (
' ')+1);
8075 if (m_txt_renderer.ok ())
8081 ext = m_txt_renderer.get_extent (label, 0.0,
8082 get_ticklabelinterpreter ());
8084 wmax =
std::max (wmax, ext(0) / dpr);
8085 hmax =
std::max (hmax, ext(1) / dpr);
8091 int len = label.length ();
8106 double& min_pos,
double& max_neg,
8107 const Matrix& kids,
char limit_type)
8124 check_limit_vals (min_val, max_val, min_pos, max_neg, lim);
8138 check_limit_vals (min_val, max_val, min_pos, max_neg, lim);
8152 check_limit_vals (min_val, max_val, min_pos, max_neg, lim);
8166 check_limit_vals (min_val, max_val, min_pos, max_neg, lim);
8180 check_limit_vals (min_val, max_val, min_pos, max_neg, lim);
8190 static std::set<double> updating_axis_limits;
8196 if (updating_axis_limits.find (
get_handle ().value ())
8197 != updating_axis_limits.end ())
8207 char update_type = 0;
8212 #define FIX_LIMITS \
8214 if (octave::math::isfinite (val)) \
8217 if (octave::math::isfinite (val)) \
8220 if (axis_type ==
"xdata" || axis_type ==
"xscale"
8221 || axis_type ==
"xlimmode" || axis_type ==
"xliminclude"
8222 || axis_type ==
"xlim")
8228 if (m_properties.xlimmode_is (
"auto"))
8232 std::string method = m_properties.get_xlimitmethod ();
8233 limits = m_properties.get_axis_limits (min_val, max_val,
8235 m_properties.xscale_is (
"log"),
8239 m_properties.check_axis_limits (limits, kids,
8240 m_properties.xscale_is (
"log"),
8243 else if (axis_type ==
"ydata" || axis_type ==
"yscale"
8244 || axis_type ==
"ylimmode" || axis_type ==
"yliminclude"
8245 || axis_type ==
"ylim")
8251 if (m_properties.ylimmode_is (
"auto"))
8255 std::string method = m_properties.get_ylimitmethod ();
8256 limits = m_properties.get_axis_limits (min_val, max_val,
8258 m_properties.yscale_is (
"log"),
8262 m_properties.check_axis_limits (limits, kids,
8263 m_properties.yscale_is (
"log"),
8266 else if (axis_type ==
"zdata" || axis_type ==
"zscale"
8267 || axis_type ==
"zlimmode" || axis_type ==
"zliminclude"
8268 || axis_type ==
"zlim")
8274 if (m_properties.zlimmode_is (
"auto"))
8278 m_properties.set_has3Dkids ((max_val - min_val) >
8279 std::numeric_limits<double>::epsilon ());
8281 std::string method = m_properties.get_zlimitmethod ();
8282 limits = m_properties.get_axis_limits (min_val, max_val,
8284 m_properties.zscale_is (
"log"),
8293 m_properties.set_has3Dkids ((max_val - min_val) >
8294 std::numeric_limits<double>::epsilon ());
8296 m_properties.check_axis_limits (limits, kids,
8297 m_properties.zscale_is (
"log"),
8301 else if (axis_type ==
"cdata" || axis_type ==
"climmode"
8302 || axis_type ==
"cdatamapping" || axis_type ==
"climinclude"
8303 || axis_type ==
"clim")
8305 if (m_properties.climmode_is (
"auto"))
8312 if (min_val > max_val)
8314 min_val = min_pos = 0;
8317 else if (min_val == max_val)
8319 max_val = min_val + 1;
8323 limits(0) = min_val;
8324 limits(1) = max_val;
8329 else if (axis_type ==
"alphadata" || axis_type ==
"alimmode"
8330 || axis_type ==
"alphadatamapping" || axis_type ==
"aliminclude"
8331 || axis_type ==
"alim")
8333 if (m_properties.alimmode_is (
"auto"))
8340 if (min_val > max_val)
8342 min_val = min_pos = 0;
8345 else if (min_val == max_val)
8346 max_val = min_val + 1;
8348 limits(0) = min_val;
8349 limits(1) = max_val;
8357 octave::unwind_protect_var<std::set<double>>
8358 restore_var (updating_axis_limits);
8360 updating_axis_limits.insert (
get_handle ().value ());
8363 switch (update_type)
8366 is_auto = m_properties.xlimmode_is (
"auto");
8367 m_properties.set_xlim (limits);
8369 m_properties.set_xlimmode (
"auto");
8370 m_properties.update_xlim ();
8374 is_auto = m_properties.ylimmode_is (
"auto");
8375 m_properties.set_ylim (limits);
8377 m_properties.set_ylimmode (
"auto");
8378 m_properties.update_ylim ();
8382 is_auto = m_properties.zlimmode_is (
"auto");
8383 m_properties.set_zlim (limits);
8385 m_properties.set_zlimmode (
"auto");
8386 m_properties.update_zlim ();
8390 m_properties.set_clim (limits);
8391 m_properties.set_climmode (
"auto");
8395 m_properties.set_alim (limits);
8396 m_properties.set_alimmode (
"auto");
8403 m_properties.update_transform ();
8412 if ((updating_axis_limits.find (
get_handle ().value ())
8413 != updating_axis_limits.end ())
8414 || (updating_aspectratios.find (
get_handle ().value ())
8415 != updating_aspectratios.end ()))
8425 char update_type = 0;
8429 if (axis_type ==
"xdata" || axis_type ==
"xscale"
8430 || axis_type ==
"xlimmode" || axis_type ==
"xliminclude"
8431 || axis_type ==
"xlim")
8434 if (m_properties.xlimmode_is (
"auto"))
8438 std::string method = m_properties.get_xlimitmethod ();
8439 limits = m_properties.get_axis_limits (min_val, max_val,
8441 m_properties.xscale_is (
"log"),
8447 m_properties.check_axis_limits (limits, kids,
8448 m_properties.xscale_is (
"log"),
8450 if (axis_type ==
"xscale")
8454 else if (axis_type ==
"ydata" || axis_type ==
"yscale"
8455 || axis_type ==
"ylimmode" || axis_type ==
"yliminclude"
8456 || axis_type ==
"ylim")
8459 if (m_properties.ylimmode_is (
"auto"))
8463 std::string method = m_properties.get_ylimitmethod ();
8464 limits = m_properties.get_axis_limits (min_val, max_val,
8466 m_properties.yscale_is (
"log"),
8472 m_properties.check_axis_limits (limits, kids,
8473 m_properties.yscale_is (
"log"),
8475 if (axis_type ==
"yscale")
8479 else if (axis_type ==
"zdata" || axis_type ==
"zscale"
8480 || axis_type ==
"zlimmode" || axis_type ==
"zliminclude"
8481 || axis_type ==
"zlim")
8484 if (m_properties.zlimmode_is (
"auto"))
8488 m_properties.set_has3Dkids ((max_val - min_val) >
8489 std::numeric_limits<double>::epsilon ());
8494 && ! m_properties.zscale_is (
"log"))
8495 min_val = max_val = 0.;
8497 std::string method = m_properties.get_zlimitmethod ();
8498 limits = m_properties.get_axis_limits (min_val, max_val,
8500 m_properties.zscale_is (
"log"),
8509 m_properties.set_has3Dkids ((max_val - min_val) >
8510 std::numeric_limits<double>::epsilon ());
8513 m_properties.check_axis_limits (limits, kids,
8514 m_properties.zscale_is (
"log"),
8516 if (axis_type ==
"zscale")
8520 else if (axis_type ==
"cdata" || axis_type ==
"climmode"
8521 || axis_type ==
"cdatamapping" || axis_type ==
"climinclude"
8522 || axis_type ==
"clim")
8524 if (m_properties.climmode_is (
"auto"))
8528 if (min_val > max_val)
8530 min_val = min_pos = 0;
8533 else if (min_val == max_val)
8535 max_val = min_val + 1;
8541 limits(0) = min_val;
8542 limits(1) = max_val;
8548 else if (axis_type ==
"alphadata" || axis_type ==
"alimmode"
8549 || axis_type ==
"alphadatamapping" || axis_type ==
"aliminclude"
8550 || axis_type ==
"alim")
8552 if (m_properties.alimmode_is (
"auto"))
8556 if (min_val > max_val)
8558 min_val = min_pos = 0;
8561 else if (min_val == max_val)
8562 max_val = min_val + 1;
8566 limits(0) = min_val;
8567 limits(1) = max_val;
8574 octave::unwind_protect_var<std::set<double>>
8575 restore_var (updating_axis_limits);
8577 updating_axis_limits.insert (
get_handle ().value ());
8580 switch (update_type)
8583 is_auto = m_properties.xlimmode_is (
"auto");
8584 m_properties.set_xlim (limits);
8586 m_properties.set_xlimmode (
"auto");
8587 m_properties.update_xlim ();
8591 is_auto = m_properties.ylimmode_is (
"auto");
8592 m_properties.set_ylim (limits);
8594 m_properties.set_ylimmode (
"auto");
8595 m_properties.update_ylim ();
8599 is_auto = m_properties.zlimmode_is (
"auto");
8600 m_properties.set_zlim (limits);
8602 m_properties.set_zlimmode (
"auto");
8603 m_properties.update_zlim ();
8607 m_properties.set_clim (limits);
8608 m_properties.set_climmode (
"auto");
8612 m_properties.set_alim (limits);
8613 m_properties.set_alimmode (
"auto");
8620 m_properties.update_transform ();
8635 do_zoom (
double val,
double factor,
const Matrix& lims,
bool is_logscale)
8639 double lo = lims(0);
8640 double hi = lims(1);
8642 bool is_negative = lo < 0 && hi < 0;
8649 hi = std::log10 (-lo);
8650 lo = std::log10 (-tmp);
8651 val = std::log10 (-val);
8655 hi = std::log10 (hi);
8656 lo = std::log10 (lo);
8657 val = std::log10 (val);
8662 lo = val + (lo - val) / factor;
8663 hi = val + (hi - val) / factor;
8688 double x,
double y,
double factor,
8689 bool push_to_zoom_stack)
8692 Matrix xlims = get_xlim ().matrix_value ();
8693 Matrix ylims = get_ylim ().matrix_value ();
8696 Matrix kids = get_children ();
8709 xlims = do_zoom (
x, factor, xlims, xscale_is (
"log"));
8710 ylims = do_zoom (y, factor, ylims, yscale_is (
"log"));
8712 zoom (mode, xlims, ylims, push_to_zoom_stack);
8717 bool push_to_zoom_stack)
8720 Matrix xlims = get_xlim ().matrix_value ();
8721 Matrix ylims = get_ylim ().matrix_value ();
8723 double x = (xlims(0) + xlims(1)) / 2;
8724 double y = (ylims(0) + ylims(1)) / 2;
8726 zoom_about_point (mode,
x, y, factor, push_to_zoom_stack);
8732 if (m_zoom_stack.empty ())
8734 m_zoom_stack.push_front (m_xlimmode.get ());
8735 m_zoom_stack.push_front (m_xlim.get ());
8736 m_zoom_stack.push_front (m_ylimmode.get ());
8737 m_zoom_stack.push_front (m_ylim.get ());
8738 m_zoom_stack.push_front (m_zlimmode.get ());
8739 m_zoom_stack.push_front (m_zlim.get ());
8740 m_zoom_stack.push_front (m_view.get ());
8747 bool push_to_zoom_stack)
8749 if (xl(0) == xl(1) || yl(0) == yl(1))
8751 warning (
"invalid zoom region");
8755 if (push_to_zoom_stack)
8758 if (mode ==
"horizontal" || mode ==
"both")
8761 m_xlimmode =
"manual";
8764 if (mode ==
"vertical" || mode ==
"both")
8767 m_ylimmode =
"manual";
8770 update_transform ();
8772 if (mode ==
"horizontal" || mode ==
"both")
8775 if (mode ==
"vertical" || mode ==
"both")
8780 do_translate (
double x0,
double x1,
const Matrix& lims,
bool is_logscale)
8784 double lo = lims(0);
8785 double hi = lims(1);
8787 bool is_negative = lo < 0 && hi < 0;
8796 hi = std::log10 (-lo);
8797 lo = std::log10 (-tmp);
8803 hi = std::log10 (hi);
8804 lo = std::log10 (lo);
8807 delta = std::log10 (x0) - std::log10 (x1);
8841 double x0,
double x1,
double y0,
double y1,
8842 bool push_to_zoom_stack)
8845 Matrix xlims = get_xlim ().matrix_value ();
8846 Matrix ylims = get_ylim ().matrix_value ();
8849 Matrix kids = get_children ();
8862 xlims = do_translate (x0, x1, xlims, xscale_is (
"log"));
8863 ylims = do_translate (y0, y1, ylims, yscale_is (
"log"));
8865 zoom (mode, xlims, ylims, push_to_zoom_stack);
8870 bool push_to_zoom_stack)
8873 Matrix xlims = get_xlim ().matrix_value ();
8874 Matrix ylims = get_ylim ().matrix_value ();
8876 double x0 = (xlims(0) + xlims(1)) / 2;
8877 double y0 = (ylims(0) + ylims(1)) / 2;
8879 double x1 = x0 + (xlims(1) - xlims(0)) * factor;
8880 double y1 = y0 + (ylims(1) - ylims(0)) * factor;
8882 translate_view (mode, x0, x1, y0, y1, push_to_zoom_stack);
8887 bool push_to_zoom_stack)
8889 if (push_to_zoom_stack)
8892 Matrix bb = get_boundingbox (
true);
8893 Matrix new_view = get_view ().matrix_value ();
8896 new_view(0) += ((x0 - x1) * (180.0 / bb(2)));
8897 new_view(1) += ((y1 - y0) * (180.0 / bb(3)));
8900 new_view(1) =
std::min (new_view(1), 90.0);
8901 new_view(1) =
std::max (new_view(1), -90.0);
8902 if (new_view(0) > 180.0)
8903 new_view(0) -= 360.0;
8904 else if (new_view(0) < -180.0)
8905 new_view(0) += 360.0;
8908 double snapmargin = 1.0;
8909 for (
int a = -90; a <= 90; a += 90)
8911 if ((a - snapmargin) < new_view(1) && new_view(1) < (a + snapmargin))
8918 for (
int a = -180; a <= 180; a += 180)
8919 if ((a - snapmargin) < new_view(0) && new_view(0) < (a + snapmargin))
8929 set_view (new_view);
8934 bool push_to_zoom_stack)
8936 if (push_to_zoom_stack)
8939 Matrix v = get_view ().matrix_value ();
8948 v(0) = fmod (v(0) - delta_az + 720, 360);
8952 update_transform ();
8958 if (m_zoom_stack.size () >= 7)
8960 m_view = m_zoom_stack.front ();
8961 m_zoom_stack.pop_front ();
8963 m_zlim = m_zoom_stack.front ();
8964 m_zoom_stack.pop_front ();
8966 m_zlimmode = m_zoom_stack.front ();
8967 m_zoom_stack.pop_front ();
8969 m_ylim = m_zoom_stack.front ();
8970 m_zoom_stack.pop_front ();
8972 m_ylimmode = m_zoom_stack.front ();
8973 m_zoom_stack.pop_front ();
8975 m_xlim = m_zoom_stack.front ();
8976 m_zoom_stack.pop_front ();
8978 m_xlimmode = m_zoom_stack.front ();
8979 m_zoom_stack.pop_front ();
8981 update_transform ();
8994 if (! is_handle_visible ())
9012 fig.
set (
"currentaxes", kidsarray(0));
9021 figure::properties::init_toolkit ()
9025 m_toolkit = gtk_mgr.get_toolkit ();
9031 std::size_t items_to_leave_on_stack = (do_unzoom ? 7 : 0);
9033 while (m_zoom_stack.size () > items_to_leave_on_stack)
9034 m_zoom_stack.pop_front ();
9044 std::list<graphics_object> children_list;
9045 std::list<graphics_object>::iterator children_list_iter;
9046 get_children_of_type (
"patch",
false,
true, children_list);
9047 get_children_of_type (
"surface",
false,
true, children_list);
9050 for (children_list_iter = children_list.begin ();
9051 children_list_iter != children_list.end (); children_list_iter++)
9054 if (kid.
isa (
"patch"))
9076 int state = toggle_warn (
"Octave:deprecated-property",
false);
9082 toggle_warn (
"Octave:deprecated-property",
true, state);
9090 xinitialize (m_properties.
get_title ());
9091 xinitialize (m_properties.get_xlabel ());
9092 xinitialize (m_properties.get_ylabel ());
9093 xinitialize (m_properties.get_zlabel ());
9095 m_properties.sync_positions ();
9101 line::properties::compute_xlim ()
const
9105 m(0) = m_xdata.min_val ();
9106 m(1) = m_xdata.max_val ();
9107 m(2) = m_xdata.min_pos ();
9108 m(3) = m_xdata.max_neg ();
9114 line::properties::compute_ylim ()
const
9118 m(0) = m_ydata.min_val ();
9119 m(1) = m_ydata.max_val ();
9120 m(2) = m_ydata.min_pos ();
9121 m(3) = m_ydata.max_neg ();
9131 Matrix pos = get_position ().matrix_value ();
9133 if (! units_is (
"data"))
9134 pos = convert_text_position (pos, *
this, get_units (),
"data");
9143 Matrix ext = m_extent.get ().matrix_value ();
9145 if (rotated && get_rotation () != 0)
9147 double rot = get_rotation () * 4.0 *
atan (1.0) / 180;
9148 double x0 = ext(0) * cos (rot) - ext(1) * sin (rot);
9150 double y0 = ext(0) * sin (rot) + ext(1) * cos (rot);
9153 double tmp = (ext(0)+ext(2)) * cos (rot) - ext(1) * sin (rot);
9156 tmp = (ext(0)+ext(2)) * sin (rot) + ext(1) * cos (rot);
9160 tmp = (ext(0)+ext(2)) * cos (rot) - (ext(1)+ext(3)) * sin (rot);
9163 tmp = (ext(0)+ext(2)) * sin (rot) + (ext(1)+ext(3)) * cos (rot);
9167 tmp = ext(0) * cos (rot) - (ext(1)+ext(3)) * sin (rot);
9170 tmp = ext(0) * sin (rot) + (ext(1)+ext(3)) * cos (rot);
9188 Matrix m = get_extent_matrix (
true);
9189 Matrix pos = get_position ().matrix_value ();
9190 Matrix p = convert_text_position (pos, *
this, get_units (),
"pixels");
9195 Matrix bbox = convert_text_position (
m, *
this,
"pixels", get_units ());
9197 double dpr = device_pixel_ratio (get___myhandle__ ());
9200 bbox(ii) = bbox(ii) / dpr;
9210 if (m_fontunits.set (val,
true))
9212 update_fontunits (old_fontunits);
9221 double parent_height = 0;
9222 double fontsz = get_fontsize ();
9224 if (new_units ==
"normalized" || old_units ==
"normalized")
9235 fontsz = convert_font_size (fontsz, old_units, new_units, parent_height);
9243 double dpr = device_pixel_ratio (get___myhandle__ ());
9249 m_txt_renderer.set_font (
get (
"fontname").string_value (),
9250 get (
"fontweight").string_value (),
9251 get (
"fontangle").string_value (),
9252 get (
"__fontsize_points__").double_value () * dpr);
9254 m_txt_renderer.set_anti_aliasing (is_fontsmoothing ());
9256 Matrix c = get_color_rgb ();
9258 m_txt_renderer.set_color (c);
9268 if (horizontalalignment_is (
"center"))
9270 else if (horizontalalignment_is (
"right"))
9273 if (verticalalignment_is (
"middle"))
9275 else if (verticalalignment_is (
"top"))
9277 else if (verticalalignment_is (
"baseline"))
9279 else if (verticalalignment_is (
"cap"))
9294 m_txt_renderer.text_to_pixels (sv.
join (
"\n"), m_pixels, bbox,
9295 halign, valign, 0.0, get_interpreter ());
9302 if (__autopos_tag___is (
"xlabel") || __autopos_tag___is (
"ylabel")
9303 || __autopos_tag___is (
"zlabel") || __autopos_tag___is (
"title"))
9304 update_autopos (
"sync");
9308 text::properties::request_autopos ()
9310 if (__autopos_tag___is (
"xlabel") || __autopos_tag___is (
"ylabel")
9311 || __autopos_tag___is (
"zlabel") || __autopos_tag___is (
"title"))
9312 update_autopos (get___autopos_tag__ ());
9316 text::properties::update_units ()
9318 if (! units_is (
"data"))
9320 set_xliminclude (
"off");
9321 set_yliminclude (
"off");
9322 set_zliminclude (
"off");
9325 Matrix pos = get_position ().matrix_value ();
9327 pos = convert_text_position (pos, *
this, m_cached_units, get_units ());
9332 bool autopos = positionmode_is (
"auto");
9337 set_positionmode (
"auto");
9339 if (units_is (
"data"))
9341 set_xliminclude (
"on");
9342 set_yliminclude (
"on");
9344 set_zliminclude (
"off");
9347 m_cached_units = get_units ();
9353 double fontsz = get_fontsize ();
9354 double parent_height = box_pix_height;
9360 if (fontunits_is (
"normalized") && parent_height <= 0)
9367 return convert_font_size (fontsz, get_fontunits (),
"points", parent_height);
9375 return convert_cdata (*
this, get_cdata (), cdatamapping_is (
"scaled"), 3);
9392 light::properties::update_visible ()
9428 return convert_cdata (*
this, fvc, cdatamapping_is (
"scaled"), 2);
9431 static bool updating_patch_data =
false;
9434 patch::properties::update_fvc ()
9436 if (updating_patch_data)
9439 Matrix xd = get_xdata ().matrix_value ();
9440 Matrix yd = get_ydata ().matrix_value ();
9441 Matrix zd = get_zdata ().matrix_value ();
9442 NDArray cd = get_cdata ().array_value ();
9444 m_bad_data_msg =
"";
9448 m_bad_data_msg =
"x/y/zdata must have the same dimensions";
9456 if ((ncf > 1 || ncv > 1) && ((ncf != nf) || (ncv != 1 && ncv != nv)))
9458 m_bad_data_msg =
"cdata does not match number of faces "
9459 "or number of vertices per face";
9466 if (nv == 1 && nf > 1)
9494 vert(kk, 0) = xd(ii, jj);
9495 vert(kk, 1) = yd(ii, jj);
9497 vert(kk, 2) = zd(ii, jj);
9499 idx(jj, ii) =
static_cast<double> (kk+1);
9507 if (cd.
ndims () == 3)
9510 dv(1) = cd.
dims ()(2);
9518 octave::unwind_protect_var<bool> restore_var (updating_patch_data,
true);
9521 m_vertices.set (vert);
9522 m_facevertexcdata.set (fvc);
9532 double tol = 100 * std::numeric_limits<double>::epsilon ();
9533 EIG eig (cov,
false,
false,
true);
9535 return ev.
min () <= tol * ev.
max ();
9538 std::vector<octave_idx_type>
9542 std::vector<octave_idx_type> coplanar_ends;
9546 plane_pivot(0, i) = vert(idx(0, jj)-1, i);
9564 fc(j-1, i) = vert(idx(j, jj)-1, i) - plane_pivot(i);
9569 coplanar_ends.push_back (nc - 1);
9570 return coplanar_ends;
9580 while (i_start < nc - 1)
9582 i_end = i_start + 2;
9585 coplanar_ends.push_back (nc - 1);
9597 fc(j, i) = vert(idx(j+i_start, jj)-1, i) - plane_pivot(i);
9614 fa(0, i) = vert(idx(i_end, jj)-1, i) - plane_pivot(i);
9618 i_start = i_end - 1;
9619 coplanar_ends.push_back (i_start);
9621 return coplanar_ends;
9625 patch::properties::update_data ()
9627 if (updating_patch_data)
9631 Matrix vert = get_vertices ().matrix_value ();
9632 NDArray fvc = get_facevertexcdata ().array_value ();
9638 m_bad_data_msg =
"";
9639 if (
static_cast<double> (nvert) < idx.
row_max ().
max ())
9641 m_bad_data_msg = R
"(some vertices in "faces" property are undefined)";
9647 if (nfvc > 1 && nfvc != nfaces && nfvc != nvert)
9649 m_bad_data_msg =
"number of facevertexcdata values matches "
9650 "neither number of faces nor number of vertices";
9659 double valid_vert = idx(0, jj);
9660 bool turn_valid =
false;
9665 idx(ii, jj) = valid_vert;
9669 valid_vert = idx(ii, jj);
9675 int fcmax = idx.
rows ();
9676 if (fcmax > 3 && vert.
columns () > 2
9677 && ! (facecolor_is (
"none") && edgecolor_is (
"none")))
9679 m_coplanar_last_idx.resize (idx.
columns ());
9692 bool is_unclosed =
false;
9711 m_coplanar_last_idx.resize (0);
9716 bool pervertex =
false;
9718 if (fvc.
rows () == nfaces || fvc.
rows () == 1)
9722 dv(1) = fvc.
rows ();
9729 dv(0) = idx.
rows ();
9740 bool has_zd =
false;
9752 xd(ii, jj) = vert(row, 0);
9753 yd(ii, jj) = vert(row, 1);
9756 zd(ii, jj) = vert(row, 2);
9759 for (
int kk = 0; kk < fvc.
columns (); kk++)
9760 cd(ii, jj, kk) = fvc(row, kk);
9765 update_normals (
true);
9767 octave::unwind_protect_var<bool> restore_var (updating_patch_data,
true);
9777 double x2,
double y2,
double z2,
9778 double&
x,
double& y,
double& z)
9780 x += (y1 * z2 - z1 * y2);
9781 y += (z1 * x2 - x1 * z2);
9782 z += (x1 * y2 - y1 * x2);
9786 patch::properties::calc_face_normals (
Matrix& fn)
9788 Matrix v = get_vertices ().matrix_value ();
9789 Matrix f = get_faces ().matrix_value ();
9791 bool is_3D = (v.
columns () == 3);
9808 if (m_coplanar_last_idx.size () > 0 && m_coplanar_last_idx[i].size () > 1)
9820 double& nx = fnc(0);
9821 double& ny = fnc(1);
9822 double& nz = fnc(2);
9827 i1 =
f(i, 0) - 1; i2 =
f(i, 1) - 1; i3 =
f(i, nc-1) - 1;
9831 (v(i3, 0) - v(i1, 0), v(i3, 1) - v(i1, 1), v(i3, 2) - v(i1, 2),
9832 v(i2, 0) - v(i1, 0), v(i2, 1) - v(i1, 1), v(i2, 2) - v(i1, 2),
9836 nz = (v(i2, 0) - v(i1, 0)) * (v(i3, 1) - v(i1, 1)) -
9837 (v(i2, 1) - v(i1, 1)) * (v(i3, 0) - v(i1, 0));
9839 nz = (nz < 0) ? -nz : nz;
9849 j1 = nc - 1; j2 = 0;
9850 i1 =
f(i, j1) - 1; i2 =
f(i, j2) - 1;
9852 nx = (v(i2, 1) - v(i1, 1)) * (v(i1, 2) + v(i2, 2));
9853 ny = (v(i2, 2) - v(i1, 2)) * (v(i1, 0) + v(i2, 0));
9854 nz = (v(i2, 0) - v(i1, 0)) * (v(i1, 1) + v(i2, 1));
9859 i1 =
f(i, j1) - 1; i2 =
f(i, j2) - 1;
9861 nx += (v(i2, 1) - v(i1, 1)) * (v(i1, 2) + v(i2, 2));
9862 ny += (v(i2, 2) - v(i1, 2)) * (v(i1, 0) + v(i2, 0));
9863 nz += (v(i2, 0) - v(i1, 0)) * (v(i1, 1) + v(i2, 1));
9868 double n_len = sqrt (nx*nx+ny*ny+nz*nz);
9871 if ( n_len < std::numeric_limits<double>::epsilon () )
9876 fn(i, j) = fnc(j) / n_len;
9881 patch::properties::update_face_normals (
bool reset,
bool force)
9883 if (updating_patch_data || ! facenormalsmode_is (
"auto"))
9886 if (force || ((facelighting_is (
"flat") || edgelighting_is (
"flat"))
9887 && get_do_lighting ()))
9889 Matrix f = get_faces ().matrix_value ();
9892 Matrix fn (num_f, 3, 0.0);
9894 calc_face_normals (fn);
9898 m_facenormals =
Matrix ();
9902 patch::properties::update_vertex_normals (
bool reset,
bool force)
9904 if (updating_patch_data || ! vertexnormalsmode_is (
"auto"))
9907 if (force || ((facelighting_is (
"gouraud") || facelighting_is (
"phong")
9908 || edgelighting_is (
"gouraud") || edgelighting_is (
"phong"))
9909 && get_do_lighting ()))
9911 Matrix v = get_vertices ().matrix_value ();
9912 Matrix f = get_faces ().matrix_value ();
9923 Matrix fn = get_facenormals ().matrix_value ();
9927 fn =
Matrix (num_f, 3, 0.0);
9928 calc_face_normals (fn);
9940 std::vector<std::vector<RowVector>> vec_vn (num_v);
9957 Matrix vn (num_v, 3, 0.0);
9960 std::vector<RowVector>::iterator it = vec_vn[i].begin ();
9965 if (it != vec_vn[i].end ())
9976 for (++it; it != vec_vn[i].end (); ++it)
9981 double dir = (vn0(0)*vn1(0) + vn0(1)*vn1(1) + vn0(2)*vn1(2) < 0) ? -1 : 1;
9983 vn0(j) += dir * vn1(j);
9987 double n_len = sqrt (vn0(0)*vn0(0)+vn0(1)*vn0(1)+vn0(2)*vn0(2));
9991 vn(i, j) = vn0(j)/n_len;
9995 m_vertexnormals = vn;
9998 m_vertexnormals =
Matrix ();
10009 m_properties.update_normals (
true);
10023 m_properties.update_normals (
true);
10035 return convert_cdata (*
this, c, c.
columns () == 1, 2);
10039 scatter::properties::update_data ()
10041 Matrix xd = get_xdata ().matrix_value ();
10042 Matrix yd = get_ydata ().matrix_value ();
10043 Matrix zd = get_zdata ().matrix_value ();
10044 Matrix cd = get_cdata ().matrix_value ();
10045 Matrix sd = get_sizedata ().matrix_value ();
10047 m_bad_data_msg =
"";
10051 m_bad_data_msg =
"x/y/zdata must have the same dimensions";
10059 if (! cd.
isempty () && (c_rows != 1 || c_cols != 3)
10060 && (c_rows != x_rows || (c_cols != 1 && c_cols != 3)))
10062 m_bad_data_msg =
"cdata must be an rgb triplet or have the same number "
10063 "of rows as X and one or three columns";
10068 if (s_rows != 1 && s_rows != x_rows)
10070 m_bad_data_msg =
"sizedata must be a scalar or a vector with the same "
10076 static bool updating_scatter_cdata =
false;
10081 if (updating_scatter_cdata)
10084 Matrix series_idx = get_seriesindex ().matrix_value ();
10098 % color_order.
rows ();
10101 color(0) = color_order(s, 0);
10102 color(1) = color_order(s, 1);
10103 color(2) = color_order(s, 2);
10105 octave::unwind_protect_var<bool> restore_var (updating_scatter_cdata,
true);
10108 set_cdatamode (
"auto");
10116 Matrix series_idx = m_properties.get_seriesindex ().matrix_value ();
10127 series_idx.
resize (1, 1);
10129 m_properties.set_seriesindex (series_idx);
10135 if (m_properties.cdatamode_is (
"auto"))
10136 m_properties.update_color ();
10144 return convert_cdata (*
this, get_cdata (), cdatamapping_is (
"scaled"), 3);
10161 surface::properties::update_face_normals (
bool reset,
bool force)
10163 if (! facenormalsmode_is (
"auto"))
10166 if (force || ((facelighting_is (
"flat") || edgelighting_is (
"flat"))
10167 && get_do_lighting ()))
10169 Matrix x = get_xdata ().matrix_value ();
10170 Matrix y = get_ydata ().matrix_value ();
10171 Matrix z = get_zdata ().matrix_value ();
10182 if (
x.columns () != p || y.
rows () != q)
10185 bool x_mat = (
x.rows () == q);
10186 bool y_mat = (y.
columns () == p);
10190 int i1, i2, j1, j2;
10193 double x0, x1, x2, x3, y0, y1, y2, y3, z0, z1, z2, z3;
10194 double x1m0, x2m1, x3m2, x0m3, y1m0, y2m1, y3m2, y0m3;
10195 double x1p0, x2p1, x3p2, x0p3, y1p0, y2p1, y3p2, y0p3;
10197 x2m1 = x0m3 = y1m0 = y3m2 = 0;
10200 x1p0 = x3p2 = y2p1 = y0p3 = 1;
10203 for (
int i = 0; i < p-1; i++)
10208 for (
int j = 0; j < q-1; j++)
10213 if (x_mat || y_mat)
10215 x0 =
x(x_mat?j1:0, y_mat?i1:0);
10216 x1 =
x(x_mat?j1:0, y_mat?i2:0);
10217 x2 =
x(x_mat?j2:0, y_mat?i2:0);
10218 x3 =
x(x_mat?j2:0, y_mat?i1:0);
10227 y0 = y(x_mat?j1:0, y_mat?i1:0);
10228 y1 = y(x_mat?j1:0, y_mat?i2:0);
10229 y2 = y(x_mat?j2:0, y_mat?i2:0);
10230 y3 = y(x_mat?j2:0, y_mat?i1:0);
10241 double& nx =
n(j, i, 0);
10242 double& ny =
n(j, i, 1);
10243 double& nz =
n(j, i, 2);
10253 nx = y1m0 * (z1 + z0) + y2m1 * (z2 + z1)
10254 + y3m2 * (z3 + z2) + y0m3 * (z0 + z3);
10255 ny = (z1 - z0) * x1p0 + (z2 - z1) * x2p1
10256 + (z3 - z2) * x3p2 + (z0 - z3) * x0p3;
10257 nz = x1m0 * y1p0 + x2m1 * y2p1 + x3m2 * y3p2 + x0m3 * y0p3;
10269 m_facenormals =
Matrix ();
10273 surface::properties::update_vertex_normals (
bool reset,
bool force)
10275 if (! vertexnormalsmode_is (
"auto"))
10278 if (force || ((facelighting_is (
"gouraud") || facelighting_is (
"phong")
10279 || edgelighting_is (
"gouraud") || edgelighting_is (
"phong"))
10280 && get_do_lighting ()))
10282 Matrix x = get_xdata ().matrix_value ();
10283 Matrix y = get_ydata ().matrix_value ();
10284 Matrix z = get_zdata ().matrix_value ();
10295 if (
x.columns () != p || y.
rows () != q)
10300 bool x_mat = (
x.rows () == q);
10301 bool y_mat = (y.
columns () == p);
10303 int i1, i2, i3, j1, j2, j3;
10307 for (
int i = 0; i < p; i++)
10316 for (
int j = 0; j < q; j++)
10325 double& nx =
n(j, i, 0);
10326 double& ny =
n(j, i, 1);
10327 double& nz =
n(j, i, 2);
10329 if ((j > 0) && (i > 0))
10332 (
x(j1, i-1)-
x(j2, i), y(j-1, i1)-y(j, i2), z(j-1, i-1)-z(j, i),
10333 x(j2, i-1)-
x(j1, i), y(j, i1)-y(j-1, i2), z(j, i-1)-z(j-1, i),
10336 if ((j > 0) && (i < (p -1)))
10339 (
x(j1, i+1)-
x(j2, i), y(j-1, i3)-y(j, i2), z(j-1, i+1)-z(j, i),
10340 x(j1, i)-
x(j2, i+1), y(j-1, i2)-y(j, i3), z(j-1, i)-z(j, i+1),
10343 if ((j < (q - 1)) && (i > 0))
10346 (
x(j2, i-1)-
x(j3, i), y(j, i1)-y(j+1, i2), z(j, i-1)-z(j+1, i),
10347 x(j3, i-1)-
x(j2, i), y(j+1, i1)-y(j, i2), z(j+1, i-1)-z(j, i),
10350 if ((j < (q - 1)) && (i < (p -1)))
10353 (
x(j3, i)-
x(j2, i+1), y(j+1, i2)-y(j, i3), z(j+1, i)-z(j, i+1),
10354 x(j3, i+1)-
x(j2, i), y(j+1, i3)-y(j, i2), z(j+1, i+1)-z(j, i),
10364 m_vertexnormals =
n;
10367 m_vertexnormals =
Matrix ();
10370 DEFMETHOD (__update_normals__, interp, args, ,
10378 gh_manager& gh_mgr = interp.get_gh_manager ();
10382 if (args.length () != 1)
10389 if (go.
isa (
"surface"))
10395 else if (go.
isa (
"patch"))
10402 error (
"__update_normals__: "
10403 "H must be a handle to a valid surface or patch object.");
10474 hggroup::properties::update_limits ()
const
10507 static bool updating_hggroup_limits =
false;
10513 if (updating_hggroup_limits)
10526 char update_type = 0;
10528 if (axis_type ==
"xlim" || axis_type ==
"xliminclude")
10533 else if (axis_type ==
"ylim" || axis_type ==
"yliminclude")
10538 else if (axis_type ==
"zlim" || axis_type ==
"zliminclude")
10543 else if (axis_type ==
"clim" || axis_type ==
"climinclude")
10548 else if (axis_type ==
"alim" || axis_type ==
"aliminclude")
10554 if (limits.
numel () == 4)
10572 limits(0) = min_val;
10573 limits(1) = max_val;
10574 limits(2) = min_pos;
10575 limits(3) = max_neg;
10580 octave::unwind_protect_var<bool> restore_var (updating_hggroup_limits,
true);
10582 if (limits(0) != min_val || limits(1) != max_val
10583 || limits(2) != min_pos || limits(3) != max_neg)
10585 limits(0) = min_val;
10586 limits(1) = max_val;
10587 limits(2) = min_pos;
10588 limits(3) = max_neg;
10590 switch (update_type)
10593 m_properties.set_xlim (limits);
10597 m_properties.set_ylim (limits);
10601 m_properties.set_zlim (limits);
10605 m_properties.set_clim (limits);
10609 m_properties.set_alim (limits);
10624 if (updating_hggroup_limits)
10634 char update_type = 0;
10636 if (axis_type ==
"xlim" || axis_type ==
"xliminclude")
10642 else if (axis_type ==
"ylim" || axis_type ==
"yliminclude")
10648 else if (axis_type ==
"zlim" || axis_type ==
"zliminclude")
10654 else if (axis_type ==
"clim" || axis_type ==
"climinclude")
10660 else if (axis_type ==
"alim" || axis_type ==
"aliminclude")
10667 octave::unwind_protect_var<bool> restore_var (updating_hggroup_limits,
true);
10671 limits(0) = min_val;
10672 limits(1) = max_val;
10673 limits(2) = min_pos;
10674 limits(3) = max_neg;
10676 switch (update_type)
10679 m_properties.set_xlim (limits);
10683 m_properties.set_ylim (limits);
10687 m_properties.set_zlim (limits);
10691 m_properties.set_clim (limits);
10695 m_properties.set_alim (limits);
10708 uicontextmenu::properties::update_beingdeleted ()
10711 if (m_beingdeleted.is (
"on"))
10715 std::list<graphics_handle> lst = get_dependent_obj_list ();
10717 for (
auto& hobj : lst)
10722 && go.
get (
"contextmenu") == get___myhandle__ ())
10760 Matrix m = m_extent.get ().matrix_value ();
10769 return convert_position (
m,
"pixels", get_units (), parent_size);
10781 set_extent (go.
get_toolkit ().get_text_extent (go));
10787 Matrix pos = get_position ().matrix_value ();
10796 pos = convert_position (pos, m_cached_units, get_units (), parent_size);
10797 set_position (pos);
10799 m_cached_units = get_units ();
10810 bool was_button = style_is (
"radiobutton") || style_is (
"togglebutton");
10812 bool now_button = style_is (
"radiobutton") || style_is (
"togglebutton");
10821 else if (was_button && ! now_button
10823 == get___myhandle__ ().value ()))
10828 bool modified = m_style.set (st,
true,
false);
10833 if (style_is (
"listbox") || style_is (
"popupmenu"))
10835 Matrix v = m_value.get ().matrix_value ();
10836 if (v.
numel () == 1 && v(0) == 0)
10845 go.
update (m_style.get_id ());
10851 const Matrix& parent_pix_size)
const
10853 Matrix pos = get_position ().matrix_value ();
10854 Matrix parent_size (parent_pix_size);
10865 parent_size = default_figure_position ();
10868 pos = convert_position (pos, get_units (),
"pixels", parent_size);
10872 pos(1) = parent_size(1) - pos(1) - pos(3);
10882 if (m_fontunits.set (val,
true))
10884 update_fontunits (old_fontunits);
10893 double parent_height = get_boundingbox (
false).elem (3);
10894 double fontsz = get_fontsize ();
10896 fontsz = convert_font_size (fontsz, old_units, new_units, parent_height);
10904 double fontsz = get_fontsize ();
10905 double parent_height = box_pix_height;
10907 if (fontunits_is (
"normalized") && parent_height <= 0)
10908 parent_height = get_boundingbox (
false).elem (3);
10910 return convert_font_size (fontsz, get_fontunits (),
"points", parent_height);
10917 const Matrix& parent_pix_size)
const
10919 Matrix pos = get_position ().matrix_value ();
10920 Matrix parent_size (parent_pix_size);
10931 pos = convert_position (pos, get_units (),
"pixels", parent_size);
10935 pos(1) = parent_size(1) - pos(1) - pos(3);
10939 double outer_height = pos(3);
10941 pos(0) = pos(1) = 0;
10943 if (! bordertype_is (
"none"))
10945 double bw = get_borderwidth ();
10948 if (bordertype_is (
"etchedin") || bordertype_is (
"etchedout"))
10951 pos(0) += mul * bw;
10952 pos(1) += mul * bw;
10953 pos(2) -= 2 * mul * bw;
10954 pos(3) -= 2 * mul * bw;
10957 if (! get_title ().empty ())
10959 double fontsz = get_fontsize ();
10961 if (! fontunits_is (
"pixels"))
10965 if (fontunits_is (
"points"))
10966 fontsz *= (res / 72.0);
10967 else if (fontunits_is (
"inches"))
10969 else if (fontunits_is (
"centimeters"))
10970 fontsz *= (res / 2.54);
10971 else if (fontunits_is (
"normalized"))
10972 fontsz *= outer_height;
10975 if (titleposition_is (
"lefttop") || titleposition_is (
"centertop")
10976 || titleposition_is (
"righttop"))
10977 pos(1) += (fontsz / 2);
10978 pos(3) -= (fontsz / 2);
10989 bool modified =
false;
10991 old_bb = get_boundingbox (
true);
10992 modified = m_position.set (v,
false);
10993 new_bb = get_boundingbox (
true);
10995 if (old_bb != new_bb)
10997 if (old_bb(2) != new_bb(2) || old_bb(3) != new_bb(3))
11001 if (! get_resizefcn ().isempty ())
11004 if (! get_sizechangedfcn ().isempty ())
11007 update_boundingbox ();
11023 if (m_units.set (val,
true))
11025 update_units (old_units);
11033 Matrix pos = get_position ().matrix_value ();
11042 pos = convert_position (pos, old_units, get_units (), parent_size);
11043 set_position (pos);
11051 if (m_fontunits.set (val,
true))
11053 update_fontunits (old_fontunits);
11062 double parent_height = get_boundingbox (
false).elem (3);
11063 double fontsz = get_fontsize ();
11065 fontsz = convert_font_size (fontsz, old_units, new_units, parent_height);
11073 double fontsz = get_fontsize ();
11074 double parent_height = box_pix_height;
11076 if (fontunits_is (
"normalized") && parent_height <= 0)
11077 parent_height = get_boundingbox (
false).elem (3);
11079 return convert_font_size (fontsz, get_fontunits (),
"points", parent_height);
11086 m_selectedobject = current_selectedobject;
11089 if (current_selectedobject.
ok ())
11108 && go.
isa (
"uicontrol"))
11113 if (style.
compare (
"radiobutton") || style.
compare (
"togglebutton"))
11115 m_selectedobject = val;
11121 err_set_invalid (
"selectedobject");
11129 if (h.
value () == current_selected.
value ())
11130 set_selectedobject (
Matrix ());
11141 bool has_selected = current_selected.
ok ();
11152 set_selectedobject (h.
value ());
11160 const Matrix& parent_pix_size)
const
11162 Matrix pos = get_position ().matrix_value ();
11163 Matrix parent_size (parent_pix_size);
11174 pos = convert_position (pos, get_units (),
"pixels", parent_size);
11178 pos(1) = parent_size(1) - pos(1) - pos(3);
11182 double outer_height = pos(3);
11184 pos(0) = pos(1) = 0;
11186 if (! bordertype_is (
"none"))
11188 double bw = get_borderwidth ();
11191 if (bordertype_is (
"etchedin") || bordertype_is (
"etchedout"))
11194 pos(0) += mul * bw;
11195 pos(1) += mul * bw;
11196 pos(2) -= 2 * mul * bw;
11197 pos(3) -= 2 * mul * bw;
11200 if (! get_title ().empty ())
11202 double fontsz = get_fontsize ();
11204 if (! fontunits_is (
"pixels"))
11208 if (fontunits_is (
"points"))
11209 fontsz *= (res / 72.0);
11210 else if (fontunits_is (
"inches"))
11212 else if (fontunits_is (
"centimeters"))
11213 fontsz *= (res / 2.54);
11214 else if (fontunits_is (
"normalized"))
11215 fontsz *= outer_height;
11218 if (titleposition_is (
"lefttop") || titleposition_is (
"centertop")
11219 || titleposition_is (
"righttop"))
11220 pos(1) += (fontsz / 2);
11221 pos(3) -= (fontsz / 2);
11232 bool modified =
false;
11234 old_bb = get_boundingbox (
true);
11235 modified = m_position.set (v,
false);
11236 new_bb = get_boundingbox (
true);
11238 if (old_bb != new_bb)
11240 if (old_bb(2) != new_bb(2) || old_bb(3) != new_bb(3))
11244 if (! get_resizefcn ().isempty ())
11247 if (! get_sizechangedfcn ().isempty ())
11250 update_boundingbox ();
11267 if (m_units.set (val,
true))
11269 update_units (old_units);
11277 Matrix pos = get_position ().matrix_value ();
11286 pos = convert_position (pos, old_units, get_units (), parent_size);
11287 set_position (pos);
11295 if (m_fontunits.set (val,
true))
11297 update_fontunits (old_fontunits);
11306 double parent_height = get_boundingbox (
false).elem (3);
11307 double fontsz = get_fontsize ();
11309 fontsz = convert_font_size (fontsz, old_units, new_units, parent_height);
11317 double fontsz = get_fontsize ();
11318 double parent_height = box_pix_height;
11320 if (fontunits_is (
"normalized") && parent_height <= 0)
11321 parent_height = get_boundingbox (
false).elem (3);
11323 return convert_font_size (fontsz, get_fontunits (),
"points", parent_height);
11330 const Matrix& parent_pix_size)
const
11332 Matrix pos = get_position ().matrix_value ();
11333 Matrix parent_size (parent_pix_size);
11344 pos = convert_position (pos, get_units (),
"pixels", parent_size);
11348 pos(1) = parent_size(1) - pos(1) - pos(3);
11361 if (m_columnformat.set (val,
true))
11368 for (
int i = 0; i < cell_value.
numel (); i++)
11376 for (
int j = 0; j < popup.
numel (); j++)
11380 error (
"set: pop-up menu definitions must be non-empty strings");
11385 error (
"set: columnformat definintions must be a cellstr of "
11386 "either 'char', 'short [e|g|eng]?', 'long [e|g|eng]?', "
11387 "'numeric', 'bank', '+', 'rat', 'logical', "
11388 "or a cellstr of non-empty pop-up menu definitions.");
11392 if (m_columnformat.set (val,
true))
11397 if (m_columnformat.set (
Cell (),
true))
11402 error (
"set: expecting cell of strings");
11409 bool error_exists =
false;
11412 error_exists =
false;
11416 for (
int i = 0; i < cell_value.
numel (); i++)
11422 error_exists =
true;
11426 error_exists =
true;
11430 error_exists =
true;
11435 error_exists =
true;
11438 error (
"set: expecting either 'auto' or a cell of pixel values or auto");
11441 if (m_columnwidth.set (val,
true))
11451 if (m_units.set (val,
true))
11453 update_units (old_units);
11461 Matrix pos = get_position ().matrix_value ();
11470 pos = convert_position (pos, old_units, get_units (), parent_size);
11471 set_position (pos);
11479 if (m_fontunits.set (val,
true))
11481 update_fontunits (old_fontunits);
11490 double parent_height = get_boundingbox (
false).elem (3);
11491 double fontsz = get_fontsize ();
11493 fontsz = convert_font_size (fontsz, old_units, new_units, parent_height);
11501 double fontsz = get_fontsize ();
11502 double parent_height = box_pix_height;
11504 if (fontunits_is (
"normalized") && parent_height <= 0)
11505 parent_height = get_boundingbox (
false).elem (3);
11507 return convert_font_size (fontsz, get_fontunits (),
"points", parent_height);
11513 double fontsz = get_fontsize ();
11514 double parent_height = box_pix_height;
11516 if (fontunits_is (
"normalized") && parent_height <= 0)
11517 parent_height = get_boundingbox (
false).elem (3);
11519 return convert_font_size (fontsz, get_fontunits (),
"pixels", parent_height);
11525 Matrix bg = m_backgroundcolor.get ().matrix_value ();
11533 Matrix bg = m_backgroundcolor.get ().matrix_value ();
11534 if (bg.
rows () > 1)
11543 return m_extent.get ().matrix_value ();
11550 Matrix m = m_extent.get ().matrix_value ();
11561 return convert_position (
m,
"pixels", get_units (), parent_size);
11630 m_callback (), m_callback_data (data) { }
11636 m_callback (cb), m_callback_data (data) { }
11638 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (callback_event)
11640 ~callback_event () =
default;
11646 if (m_callback.is_defined ())
11654 std::string m_callback_name;
11668 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (mcode_event)
11670 ~mcode_event () =
default;
11674 if (! m_mcode.empty ())
11690 std::string m_mcode;
11702 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (function_event)
11704 ~function_event () =
default;
11708 m_function (m_function_data);
11715 void *m_function_data;
11723 const octave_value& value,
bool do_notify_toolkit =
true,
11724 bool redraw_figure =
false)
11726 m_property_value (value), m_notify_toolkit (do_notify_toolkit),
11727 m_redraw_figure (redraw_figure)
11730 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (set_event)
11732 ~set_event () =
default;
11754 if (go.
isa (
"figure") && m_property_name ==
"position")
11758 fprops.
set_position (m_property_value, m_notify_toolkit);
11760 else if (go.
isa (
"figure") && m_property_name ==
"outerposition")
11767 p.set (m_property_value,
true, m_notify_toolkit);
11769 if (m_redraw_figure)
11771 if (! go.
isa (
"figure"))
11787 std::string m_property_name;
11789 bool m_notify_toolkit;
11790 bool m_redraw_figure;
11795 const std::string& name,
11799 return graphics_event (
new callback_event (h, name, data, busyaction));
11808 return graphics_event (
new callback_event (h, cb, data, busyaction));
11813 const std::string& cmd,
11828 const std::string& name,
11830 bool notify_toolkit,
bool redraw_figure)
11832 return graphics_event (
new set_event (h, name, data, notify_toolkit,
11837 root_figure::init_factory_properties ()
11876 gh_manager& gh_mgr = interp.get_gh_manager ();
11880 if (args.length () != 1)
11883 return ovl (ishghandle (args(0)));
11914 is_handle_visible (
double val)
11918 return is_handle_visible (gh_mgr.
lookup (val));
11935 result.xelem (i) = is_handle_visible (handles(i));
11943 DEFUN (__is_handle_visible__, args, ,
11949 if (args.length () != 1)
11952 return ovl (is_handle_visible (args(0)));
11970 if (args.length () != 1)
11974 ColumnVector hcv = args(0).xvector_value (
"reset: H must be a graphics handle");
11976 gh_manager& gh_mgr = interp.get_gh_manager ();
12202 int nargin = args.length ();
12208 ColumnVector hcv = args(0).xvector_value (
"set: H must be a graphics handle");
12210 gh_manager& gh_mgr = interp.get_gh_manager ();
12219 if (hcv.
numel () > 1)
12220 error (
"set: H must be a single graphics handle when querying properties");
12224 error (
"set: invalid handle (= %g)", hcv(0));
12237 else if (nargin == 2 && args(1).is_string ())
12239 if (hcv.
numel () > 1)
12240 error (
"set: H must be a single graphics handle when querying properties");
12242 std::string
property = args(1).string_value ();
12249 error (
"set: invalid handle (= %g)", hcv(0));
12273 error (R
"(set: unknown property "%s")", property.c_str ());
12278 bool request_drawnow =
false;
12286 error (
"set: invalid handle (= %g)", hcv(
n));
12291 if (args(i).is_string ())
12293 if (i == nargin - 1)
12294 error (
"set: PROPERTY name must be followed by a VALUE");
12300 else if (args(i).iscellstr ())
12302 if ((i == nargin - 1) || ! args(i+1).iscell ())
12303 error (
"set: cell array of PROPERTIES must be followed by cell array of VALUES");
12304 if (args(i+1).cell_value ().rows () == 1)
12305 go.
set (args(i).cellstr_value (), args(i+1).cell_value (), 0);
12306 else if (hcv.
numel () == args(i+1).cell_value ().rows ())
12307 go.
set (args(i).cellstr_value (), args(i+1).cell_value (),
n);
12309 error (
"set: number of graphics handles must match number of "
12310 "value rows (%" OCTAVE_IDX_TYPE_FORMAT
" != "
12311 "%" OCTAVE_IDX_TYPE_FORMAT
")",
12312 hcv.
numel (), args(i+1).cell_value ().rows ());
12315 else if (args(i).isstruct ())
12317 go.
set (args(i).map_value ());
12321 error (
"set: invalid syntax");
12324 request_drawnow =
true;
12327 if (request_drawnow)
12369 get_graphics_object_type (
double val)
12371 std::string retval;
12378 error (
"get: invalid handle (= %g)", val);
12397 gh_manager& gh_mgr = interp.get_gh_manager ();
12401 int nargin = args.length ();
12403 if (nargin < 1 || nargin > 2)
12406 if (args(0).isempty ())
12409 ColumnVector hcv = args(0).xvector_value (
"get: H must be a graphics handle");
12413 if (nargin == 1 && hcv_len > 1)
12415 std::string typ0 = get_graphics_object_type (hcv(0));
12419 std::string typ = get_graphics_object_type (hcv(
n));
12422 error (
"get: vector of handles must all have the same type");
12428 bool use_cell_format =
false;
12430 if (nargin > 1 && args(1).iscellstr ())
12436 use_cell_format =
true;
12445 error (
"get: invalid handle (= %g)", hcv(
n));
12460 property = args(1).xstring_value (
"get: second argument must be property name or cell array of property names");
12469 error (
"get: invalid handle (= %g)", hcv(
n));
12472 vals(
n) = go.
get ();
12478 if (use_cell_format)
12486 else if (vals_len == 1)
12488 else if (vals_len > 1 && nargin == 1)
12493 tmp[
n] = vals(
n).scalar_map_value ();
12518 gh_manager& gh_mgr = interp.get_gh_manager ();
12522 if (args.length () != 1)
12525 ColumnVector hcv = args(0).xvector_value (
"get: H must be a graphics handle");
12538 error (
"get: invalid handle (= %g)", hcv(
n));
12541 int state = toggle_warn (
"Octave:deprecated-property",
false);
12543 vals(
n) = go.
get (
true);
12545 toggle_warn (
"Octave:deprecated-property",
true, state);
12552 else if (vals_len == 1)
12553 return ovl (vals(0));
12559 make_graphics_object (
const std::string& go_name,
12560 bool integer_figure_handle,
12573 for (
int i = 0; i < xargs.
length (); i += 2)
12575 if (xargs(i).is_string () && p.compare (xargs(i).string_value ()))
12577 if (i >= (xargs.
length () - 1))
12578 error (
"__go_%s__: missing value for parent property",
12581 val = xargs(i+1).double_value ();
12583 xargs = xargs.
splice (i, 2);
12589 val = args(0).xdouble_value (
"__go_%s__: invalid parent", go_name.c_str ());
12595 if (! parent.
ok ())
12596 error (
"__go_%s__: invalid parent", go_name.c_str ());
12603 integer_figure_handle,
false,
false);
12605 catch (octave::execution_exception& ee)
12607 error (ee,
"__go_%s__: %s, unable to create graphics handle",
12608 go_name.c_str (), ee.message ().c_str ());
12615 catch (octave::execution_exception& ee)
12618 error (ee,
"__go_%s__: %s, unable to create graphics handle",
12619 go_name.c_str (), ee.message ().c_str ());
12627 retval = h.
value ();
12634 DEFMETHOD (__go_figure__, interp, args, ,
12640 gh_manager& gh_mgr = interp.get_gh_manager ();
12644 if (args.
length () == 0)
12647 double val = args(0).xdouble_value (
"__go_figure__: figure number must be a double value");
12657 retval = h.
value ();
12661 bool int_fig_handle =
true;
12671 for (
int i = 0; i < xargs.
length (); i++)
12673 if (xargs(i).is_string ()
12674 && pname.
compare (xargs(i).string_value ()))
12676 if (i < (xargs.
length () - 1))
12678 std::string pval = xargs(i+1).string_value ();
12681 int_fig_handle = on.
compare (pval);
12682 xargs = xargs.
splice (i, 2);
12692 if (! int_fig_handle)
12705 error (
"__go_figure__: failed to create figure handle");
12711 catch (octave::execution_exception& ee)
12714 error (ee,
"__go_figure__: unable to create figure handle");
12724 retval = h.
value ();
12730 #define GO_BODY(TYPE) \
12731 gh_manager& gh_mgr = interp.get_gh_manager (); \
12733 octave::autolock guard (gh_mgr.graphics_lock ()); \
12735 if (args.length () == 0) \
12738 return octave_value (make_graphics_object (#TYPE, false, args)); \
12745 if (go.
isa (
"surface"))
12747 else if ((go.
isa (
"line") || go.
isa (
"patch") || go.
isa (
"scatter"))
12776 DEFMETHOD (__calc_dimensions__, interp, args, ,
12784 gh_manager& gh_mgr = interp.get_gh_manager ();
12788 if (args.
length () != 1)
12791 double h = args(0).xdouble_value (
"__calc_dimensions__: first argument must be a graphics handle");
12796 DEFMETHOD (__go_axes__, interp, args, ,
12805 DEFMETHOD (__go_line__, interp, args, ,
12814 DEFMETHOD (__go_text__, interp, args, ,
12823 DEFMETHOD (__go_image__, interp, args, ,
12832 DEFMETHOD (__go_surface__, interp, args, ,
12841 DEFMETHOD (__go_patch__, interp, args, ,
12850 DEFMETHOD (__go_scatter__, interp, args, ,
12859 DEFMETHOD (__go_light__, interp, args, ,
12868 DEFMETHOD (__go_hggroup__, interp, args, ,
12877 DEFMETHOD (__go_uimenu__, interp, args, ,
12886 DEFMETHOD (__go_uicontrol__, interp, args, ,
12895 DEFMETHOD (__go_uibuttongroup__, interp, args, ,
12904 DEFMETHOD (__go_uipanel__, interp, args, ,
12913 DEFMETHOD (__go_uicontextmenu__, interp, args, ,
12922 DEFMETHOD (__go_uitable__, interp, args, ,
12931 DEFMETHOD (__go_uitoolbar__, interp, args, ,
12940 DEFMETHOD (__go_uipushtool__, interp, args, ,
12949 DEFMETHOD (__go_uitoggletool__, interp, args, ,
12958 DEFMETHOD (__go_delete__, interp, args, ,
12964 gh_manager& gh_mgr = interp.get_gh_manager ();
12968 if (args.
length () != 1)
12973 const NDArray vals = args(0).xarray_value (
"delete: invalid graphics object");
12979 h = gh_mgr.
lookup (vals(i));
12982 error (
"delete: invalid graphics object (= %g)", vals(i));
12990 DEFMETHOD (__go_handles__, interp, args, ,
12996 gh_manager& gh_mgr = interp.get_gh_manager ();
13000 bool show_hidden =
false;
13003 show_hidden = args(0).bool_value ();
13008 DEFMETHOD (__go_figure_handles__, interp, args, ,
13014 gh_manager& gh_mgr = interp.get_gh_manager ();
13018 bool show_hidden =
false;
13021 show_hidden = args(0).bool_value ();
13026 DEFMETHOD (__go_execute_callback__, interp, args, ,
13033 int nargin = args.
length ();
13035 if (nargin < 2 || nargin > 3)
13038 const NDArray vals = args(0).xarray_value (
"__go_execute_callback__: invalid graphics object");
13040 std::string name = args(1).xstring_value (
"__go_execute_callback__: invalid callback name");
13042 gh_manager& gh_mgr = interp.get_gh_manager ();
13046 double val = vals(i);
13051 error (
"__go_execute_callback__: invalid graphics object (= %g)", val);
13062 DEFMETHOD (__go_post_callback__, interp, args, ,
13069 int nargin = args.
length ();
13071 if (nargin < 2 || nargin > 3)
13074 const NDArray vals = args(0).xarray_value (
"__go_post_callback__: invalid graphics object");
13076 std::string name = args(1).xstring_value (
"__go_post_callback__: invalid callback name");
13078 gh_manager& gh_mgr = interp.get_gh_manager ();
13082 double val = vals(i);
13087 error (
"__go_execute_callback__: invalid graphics object (= %g)", val);
13098 DEFMETHOD (__image_pixel_size__, interp, args, ,
13104 if (args.
length () != 1)
13107 gh_manager& gh_mgr = interp.get_gh_manager ();
13109 double h = args(0).xdouble_value (
"__image_pixel_size__: argument is not a handle");
13113 if (! go || ! go.
isa (
"image"))
13114 error (
"__image_pixel_size__: object is not an image");
13125 DEFMETHOD (available_graphics_toolkits, interp, , ,
13132 gh_manager& gh_mgr = interp.get_gh_manager ();
13136 octave::gtk_manager& gtk_mgr = interp.get_gtk_manager ();
13138 return ovl (gtk_mgr.available_toolkits_list ());
13141 DEFMETHOD (register_graphics_toolkit, interp, args, ,
13151 gh_manager& gh_mgr = interp.get_gh_manager ();
13155 if (args.
length () != 1)
13158 std::string name = args(0).xstring_value (
"register_graphics_toolkit: TOOLKIT must be a string");
13160 octave::gtk_manager& gtk_mgr = interp.get_gtk_manager ();
13162 gtk_mgr.register_toolkit (name);
13167 DEFMETHOD (loaded_graphics_toolkits, interp, , ,
13174 gh_manager& gh_mgr = interp.get_gh_manager ();
13178 octave::gtk_manager& gtk_mgr = interp.get_gtk_manager ();
13180 return ovl (gtk_mgr.loaded_toolkits_list ());
13183 DEFMETHOD (__show_figure__, interp, args, ,
13189 if (args.
length () != 1)
13192 gh_manager& gh_mgr = interp.get_gh_manager ();
13194 double h = args(0).xdouble_value (
"__show_figure__: invalid handle H");
13199 error (
"__show_figure__: invalid graphics object (= %g)", h);
13237 gh_manager& gh_mgr = interp.get_gh_manager ();
13241 if (args.
length () <= 1)
13245 bool do_events =
true;
13247 if (args.
length () == 1)
13249 caseless_str val (args(0).xstring_value (
"drawnow: first argument must be a string"));
13254 error (
"drawnow: invalid argument, 'expose' is only valid option");
13269 for (
int i = 0; i < hlist.
numel (); i++)
13273 if (h.
ok () && h != 0)
13298 std::string term, file, debug_file;
13300 term = args(0).xstring_value (
"drawnow: TERM must be a string");
13302 file = args(1).xstring_value (
"drawnow: FILE must be a string");
13305 error (
"drawnow: empty output ''");
13306 else if (file.length () == 1 && file[0] ==
'|')
13307 error (
"drawnow: empty pipe '|'");
13308 else if (file[0] !=
'|')
13312 if (pos != std::string::npos)
13314 std::string
dirname = file.substr (0, pos+1);
13317 error (
"drawnow: nonexistent directory '%s'",
13323 debug_file = (args.
length () > 2 ? args(2).xstring_value (
"drawnow: DEBUG_FILE must be a string") :
13329 error (
"drawnow: nothing to draw");
13335 go.
get_toolkit ().print_figure (go, term, file, debug_file);
13344 DEFMETHOD (addlistener, interp, args, ,
13379 gh_manager& gh_mgr = interp.get_gh_manager ();
13383 int nargin = args.
length ();
13385 if (nargin < 3 || nargin > 4)
13388 double h = args(0).xdouble_value (
"addlistener: invalid handle H");
13390 std::string pname = args(1).xstring_value (
"addlistener: PROP must be a string");
13395 error (
"addlistener: invalid graphics object (= %g)", h);
13401 if (args.
length () == 4)
13404 if (persistent.
compare (
"persistent"))
13411 DEFMETHOD (dellistener, interp, args, ,
13440 gh_manager& gh_mgr = interp.get_gh_manager ();
13447 double h = args(0).xdouble_value (
"dellistener: invalid handle");
13449 std::string pname = args(1).xstring_value (
"dellistener: PROP must be a string");
13454 error (
"dellistener: invalid graphics object (= %g)", h);
13458 if (args.
length () == 2)
13462 if (args(2).is_string ()
13463 && args(2).string_value () ==
"persistent")
13477 DEFMETHOD (addproperty, interp, args, ,
13549 gh_manager& gh_mgr = interp.get_gh_manager ();
13556 std::string name = args(0).xstring_value (
"addproperty: NAME must be a string");
13558 double h = args(1).xdouble_value (
"addproperty: invalid handle H");
13563 error (
"addproperty: invalid graphics object (= %g)", h);
13567 std::string
type = args(2).xstring_value (
"addproperty: TYPE must be a string");
13570 error (
"addproperty: a '%s' property already exists in the graphics object",
13582 const std::string& fcn)
13591 error (
"%s: invalid handle (= %g)", fcn.c_str (), handle);
13607 error (
"%s: invalid handle (= %g)", fcn.c_str (), handle);
13615 compare_property_values (octave::interpreter& interp,
13625 if (result.
length () > 0)
13626 return result(0).bool_value ();
13631 static std::map<uint32_t, bool> waitfor_results;
13634 cleanup_waitfor_id (uint32_t
id)
13636 waitfor_results.erase (
id);
13640 do_cleanup_waitfor_listener (
const octave_value& listener,
13645 if (c.
numel () >= 4)
13647 double h = c(2).double_value ();
13674 cleanup_waitfor_postset_listener (
const octave_value& listener)
13675 { do_cleanup_waitfor_listener (listener,
GCB_POSTSET); }
13678 cleanup_waitfor_predelete_listener (
const octave_value& listener)
13685 uint32_t
id = args(2).uint32_scalar_value ().value ();
13689 double h = args(0).double_value ();
13704 if (compare_property_values (interp, pvalue, args(5)))
13705 waitfor_results[id] =
true;
13709 waitfor_results[id] =
true;
13719 uint32_t
id = args(2).uint32_scalar_value ().value ();
13721 waitfor_results[id] =
true;
13770 if (args.
length () == 0)
13774 if (args(0).isempty ())
13777 double h = args(0).xdouble_value (
"waitfor: invalid handle value");
13779 if (! ishghandle (h) || (h == 0 && args.
length () == 1))
13784 octave::unwind_action cleanup_waitfor_id_action;
13785 octave::unwind_action cleanup_waitfor_postset_listener_action;
13786 octave::unwind_action cleanup_waitfor_predelete_listener_action;
13788 static uint32_t id_counter = 0;
13791 int max_arg_index = 0;
13792 int timeout_index = -1;
13794 double timeout = 0;
13796 gh_manager& gh_mgr = interp.get_gh_manager ();
13800 pname = args(1).xstring_value (
"waitfor: PROP must be a string");
13802 if (pname.empty ())
13803 error (
"waitfor: PROP must be a non-empty string");
13805 if (pname !=
"timeout")
13807 if (pname.
compare (R
"(\timeout)"))
13815 "waitfor_listener"));
13820 if (args(2).is_string ())
13833 Cell listener (1, max_arg_index >= 2 ? 5 : 4);
13836 cleanup_waitfor_id_action.set (cleanup_waitfor_id,
id);
13837 waitfor_results[id] =
false;
13839 listener(0) = wf_listener;
13842 listener(3) = pname;
13844 if (max_arg_index >= 2)
13845 listener(4) = args(2);
13857 if (max_arg_index >= 2
13858 && compare_property_values (interp, go.
get (pname), args(2)))
13859 waitfor_results[id] =
true;
13862 cleanup_waitfor_postset_listener_action.set
13863 (cleanup_waitfor_postset_listener, ov_listener);
13875 (waitfor_del_listener,
13876 "waitfor_del_listener"));
13878 Cell del_listener (1, 4);
13880 del_listener(0) = wf_del_listener;
13882 del_listener(2) = h;
13883 del_listener(3) = pname;
13887 cleanup_waitfor_predelete_listener_action.set
13888 (cleanup_waitfor_predelete_listener, ov_del_listener);
13898 if (timeout_index < 0 && args.
length () > (max_arg_index + 1))
13901 1).xstring_value (
"waitfor: invalid parameter, expected 'timeout'");
13904 error (
"waitfor: invalid parameter '%s'", s.c_str ());
13906 timeout_index = max_arg_index + 1;
13909 if (timeout_index >= 0)
13911 if (args.
length () <= (timeout_index + 1))
13912 error (
"waitfor: missing TIMEOUT value");
13914 timeout = args(timeout_index + 1).xscalar_value (
"waitfor: TIMEOUT must be a scalar >= 1");
13918 warning (
"waitfor: TIMEOUT value must be >= 1, using 1 instead");
13938 octave::sys::time start;
13953 if (! pname.empty () && waitfor_results[
id])
13964 octave::command_editor::run_event_hooks ();
13968 octave::sys::time now;
13970 if (start + timeout < now)
13986 int nargin = args.
length ();
13988 if (nargin != 2 && nargin != 3)
13991 double h = args(0).double_value ();
13993 gh_manager& gh_mgr = interp.get_gh_manager ();
13999 if (! handle.
ok ())
14000 error (
"__zoom__: invalid handle");
14009 std::string opt = args(1).string_value ();
14011 if (opt ==
"out" || opt ==
"reset")
14024 std::string mode = args(1).string_value ();
14025 double factor = args(2).scalar_value ();
14027 ax_props.
zoom (mode, factor);
14034 DEFMETHOD (__get_frame__, interp, args, ,
14043 if (args.
length () != 1)
14046 double h = args(0).xdouble_value (
"__get_frame__: HFIG is not a handle");
14048 gh_manager& gh_mgr = interp.get_gh_manager ();
14052 if (! go || ! go.
isa (
"figure"))
14053 error (
"__get_frame__: HFIG is not a figure");
14061 DEFMETHOD (__get_position__, interp, args, ,
14070 if (args.
length () != 2)
14074 = args(0).xdouble_value (
"__get_position__: H must be a graphics handle");
14077 = args(1).xstring_value (
"__get_position__: UNITS must be a string");
14079 gh_manager& gh_mgr = interp.get_gh_manager ();
14083 if (h == 0 || ! go)
14084 error (
"__get_position__: H must be a handle to a valid graphics object");
14097 DEFUN (__get_system_fonts__, args, ,
14103 if (args.
length () != 0)
14106 octave::text_renderer txt_renderer;
14108 return ovl (txt_renderer.get_system_fonts ());
14111 OCTAVE_END_NAMESPACE(
octave)
charNDArray max(char d, const charNDArray &m)
charNDArray min(char d, const charNDArray &m)
T & elem(octave_idx_type n)
Size of the specified dimension.
T * fortran_vec()
Size of the specified dimension.
Array< T, Alloc > as_column() const
Return the array as a column vector.
int ndims() const
Size of the specified dimension.
octave_idx_type rows() const
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
octave_idx_type columns() const
bool isempty() const
Size of the specified dimension.
const dim_vector & dims() const
Return a const-reference so that dims ()(i) works efficiently.
octave_idx_type numel() const
Number of elements in the array.
void resize(octave_idx_type n, const double &rfv=0)
RowVector transpose() const
ColumnVector extract_n(octave_idx_type r1, octave_idx_type n) const
ComplexColumnVector eigenvalues() const
MArray< T > reshape(const dim_vector &new_dims) 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() const
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
ColumnVector row_max() const
bool any_element_is_inf_or_nan() const
finite_type m_finite_constraint
std::pair< double, bool > m_minval
std::set< std::string > m_type_constraints
std::pair< double, bool > m_maxval
std::list< dim_vector > m_size_constraints
void update_axes_layout()
double get_nextseriesindex() const
void update_xlabel_position()
void trigger_normals_calc()
void rotate_view(double delta_az, double delta_el, bool push_to_zoom_stack=true)
void set_units(const octave_value &val)
unsigned int get_num_lights() const
void increase_num_lights()
void set_ylabel(const octave_value &val)
void set_zticklabel(const octave_value &val)
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_ylabel_position()
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)
void set_zlabel(const octave_value &val)
void update_handlevisibility()
static bool has_core_property(const caseless_str &pname)
void set_yticklabel(const octave_value &val)
void update_font(std::string prop="")
void set_fontunits(const octave_value &val)
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
Matrix get_extent(bool with_text=false, bool only_text_height=false) const
void set_defaults(base_graphics_object &obj, const std::string &mode)
void set_xticklabel(const octave_value &val)
void set_linestyleorder(const octave_value &val)
void set_nextseriesindex(const octave_value &val)
void set_xlabel(const octave_value &val)
void set_title(const octave_value &val)
void update_autopos(const std::string &elem_type)
double get___fontsize_points__(double box_pix_height=0) const
graphics_xform get_transform() const
void update_aspectratios()
void adopt(const graphics_handle &h)
octave_value get_colororder() const
void update_zlabel_position()
void check_axis_limits(Matrix &limits, const Matrix kids, const bool logscale, char &update_type)
Matrix get_axis_limits(double xmin, double xmax, double min_pos, double max_neg, const bool logscale, const std::string &method)
void update_title_position()
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)
bool nextplot_is(const std::string &v) const
void decrease_num_lights()
static property_list::pval_map_type factory_defaults()
void translate_view(const std::string &mode, double x0, double x1, double y0, double y1, bool push_to_zoom_stack=true)
octave_value get_default(const caseless_str &name) const
void update_axis_limits(const std::string &axis_type)
void reset_default_properties()
void initialize(const graphics_object &go)
virtual std::string value_as_string(const std::string &prop)
graphics_handle get_handle() const
virtual void adopt(const graphics_handle &h)
virtual octave_value get_default(const caseless_str &) const
virtual void mark_modified()
virtual octave_value get_factory_default(const caseless_str &) const
virtual octave_scalar_map values_as_struct()
virtual std::string type() const
virtual void initialize(const graphics_object &go)
friend class graphics_object
virtual void reset_default_properties()
virtual void set(const caseless_str &pname, const octave_value &pval)
virtual void remove_all_listeners()
virtual graphics_handle get_parent() const
bool isa(const std::string &go_name) 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 defaults() const
virtual std::string values_as_string()
virtual void set_defaults(const std::string &)
bool is_beingdeleted() const
virtual octave_value get_clim() const
void set_from_list(base_graphics_object &obj, property_list &defaults)
void override_defaults(base_graphics_object &obj)
virtual octave_value get_xlim() const
virtual void update_contextmenu() const
graphics_handle get_parent() const
virtual octave::graphics_toolkit get_toolkit() const
virtual void update_autopos(const std::string &elem_type)
virtual property get_property(const caseless_str &pname)
virtual void update_boundingbox()
graphics_handle get___myhandle__() const
bool has_dynamic_property(const std::string &pname) const
virtual void update_handlevisibility()
void get_children_of_type(const caseless_str &type, bool get_invisible, bool traverse, std::list< graphics_object > &children_list) const
virtual octave_value get_ylim() const
virtual void update_axis_limits(const std::string &axis_type) const
octave_value get_dynamic(const caseless_str &pname) const
virtual void add_listener(const caseless_str &, const octave_value &, listener_mode=GCB_POSTSET)
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() const
void set_parent(const octave_value &val)
virtual void adopt(const graphics_handle &h)
bool is_handle_visible() const
std::set< std::string > dynamic_property_names() const
Matrix get_all_children() const
virtual octave_value get_zlim() const
Matrix get_children() const
virtual void init_integerhandle(const octave_value &)
void set_dynamic(const caseless_str &pname, const octave_value &val)
void execute_createfcn(const octave_value &new_data=octave_value()) const
virtual void remove_child(const graphics_handle &h, bool=false)
virtual void delete_listener(const caseless_str &, const octave_value &, listener_mode=GCB_POSTSET)
void renumber_child(graphics_handle old_gh, graphics_handle new_gh)
virtual std::string graphics_object_name() const
virtual Matrix get_boundingbox(bool=false, const Matrix &=Matrix()) const
void renumber_parent(graphics_handle new_gh)
graphics_handle get_parent() const
virtual bool do_set(const octave_value &)
void run_listeners(listener_mode mode=GCB_POSTSET)
std::string get_name() const
bool set(const octave_value &v, bool do_run=true, bool do_notify_toolkit=true)
void execute(const octave_value &data=octave_value()) const
bool compare(const std::string &s, std::size_t limit=std::string::npos) const
bool do_set(const octave_value &newval)
Vector representing the dimensions (size) of an Array.
static dim_vector alloc(int n)
octave_idx_type ndims() const
Number of dimensions.
bool do_set(const octave_value &v)
graphics_handle current_figure() const
Matrix handle_list(bool show_hidden=false)
octave::mutex graphics_lock()
graphics_object get_object(double val) const
void renumber_figure(const graphics_handle &old_gh, const graphics_handle &new_gh)
void execute_listener(const graphics_handle &h, const octave_value &l)
void push_figure(const graphics_handle &h)
bool is_handle_visible(const graphics_handle &h) const
Matrix figure_handle_list(bool show_hidden=false)
graphics_handle lookup(double val) const
void free(const graphics_handle &h, bool from_root=false)
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 make_figure_handle(double val, bool notify_toolkit=true)
graphics_handle get_handle(bool integer_figure_handle)
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)
bool is_xliminclude() const
std::string value_as_string(const std::string &prop)
octave_value get_alim() const
void override_defaults(base_graphics_object &obj)
octave_value get_ylim() const
bool has_readonly_property(const caseless_str &pname) const
bool is_climinclude() const
octave_value get(bool all=false) const
void reset_default_properties()
void set(const caseless_str &name, const octave_value &val)
graphics_object get_ancestor(const std::string &type) const
void update_axis_limits(const std::string &axis_type)
std::string values_as_string()
void delete_property_listener(const std::string &nm, const octave_value &v, listener_mode mode=GCB_POSTSET)
base_properties & get_properties()
bool isa(const std::string &go_name) const
octave_value get_zlim() const
void set_value_or_default(const caseless_str &name, const octave_value &val)
octave_value get_factory_default(const caseless_str &name) const
octave_value get_xlim() const
graphics_handle get_parent() const
graphics_handle get_handle() const
octave_value get_default(const caseless_str &name) const
octave_value get_clim() const
void build_user_defaults_map(property_list::pval_map_type &def, const std::string go_name) const
bool valid_object() const
void remove_child(const graphics_handle &h)
property_list get_factory_defaults_list() const
void add_property_listener(const std::string &nm, const octave_value &v, listener_mode mode=GCB_POSTSET)
bool is_zliminclude() const
void adopt(const graphics_handle &h)
bool is_aliminclude() const
octave::graphics_toolkit get_toolkit() const
bool is_yliminclude() const
octave_map values_as_struct()
std::set< std::string > m_type_constraints
graphics_handle handle_value() const
bool do_set(const octave_value &v)
void adopt(const graphics_handle &h)
static property_list::pval_map_type factory_defaults()
void remove_child(const graphics_handle &h, bool from_root=false)
static bool has_core_property(const caseless_str &pname)
void update_axis_limits(const std::string &axis_type)
static property_list::pval_map_type factory_defaults()
static bool has_core_property(const caseless_str &pname)
octave_value get_color_data() const
static property_list::pval_map_type factory_defaults()
void initialize(const graphics_object &go)
static property_list::pval_map_type factory_defaults()
static bool has_core_property(const caseless_str &pname)
octave_value as_octave_value() 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)
void assign(const std::string &k, const octave_value &val)
octave_value getfield(const std::string &key) const
octave_value_list splice(octave_idx_type offset, octave_idx_type len, const octave_value_list &lst=octave_value_list()) const
octave_idx_type length() const
bool is_function_handle() const
bool is_undefined() const
bool is_uint32_type() const
std::string class_name() const
bool is_real_scalar() const
int32NDArray int32_array_value() const
uint16NDArray uint16_array_value() const
int16NDArray int16_array_value() const
int8NDArray int8_array_value() const
octave_idx_type rows() const
bool is_scalar_type() const
octave_scalar_map scalar_map_value() const
bool is_int8_type() const
bool is_single_type() const
double xdouble_value(const char *fmt,...) const
bool is_uint8_type() const
bool is_uint64_type() const
bool is_uint16_type() const
uint64NDArray uint64_array_value() const
bool is_int16_type() const
octave_value reshape(const dim_vector &dv) const
octave_idx_type numel() const
octave_map map_value() const
std::string string_value(bool force=false) const
bool is_int64_type() const
bool is_matrix_type() const
string_vector string_vector_value(bool pad=false) const
int64NDArray int64_array_value() const
NDArray array_value(bool frc_str_conv=false) const
bool is_double_type() const
bool is_int32_type() const
bool is_bool_scalar() const
uint8NDArray uint8_array_value() const
std::string type_name() const
uint32NDArray uint32_array_value() const
octave_idx_type columns() const
Matrix matrix_value(bool frc_str_conv=false) const
double double_value(bool frc_str_conv=false) const
octave_value get_color_data() const
static property_list::pval_map_type factory_defaults()
bool get_do_lighting() const
void update_normals(bool reset, bool force=false)
static bool has_core_property(const caseless_str &pname)
void reset_default_properties()
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)
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 property create(const std::string &name, const graphics_handle &parent, const caseless_str &type, const octave_value_list &args)
void set_parent(const graphics_handle &h)
std::string values_as_string() const
void erase(const std::string pname)
const_iterator find(const std::string pname) const
std::string values_as_string() const
bool contains(const std::string &val, std::string &match)
radio_values(const std::string &opt_string="")
Cell values_as_cell() const
std::string default_value() const
octave_idx_type nelem() const
static bool has_core_property(const caseless_str &pname)
static property_list::pval_map_type factory_defaults()
octave_value get_color_data() const
void initialize(const graphics_object &go)
string_vector & append(const std::string &s)
octave_idx_type numel() const
std::string join(const std::string &sep="") const
bool get_do_lighting() const
octave_value get_color_data() const
static bool has_core_property(const caseless_str &pname)
static property_list::pval_map_type factory_defaults()
void update_normals(bool reset, bool force=false)
bool verticalalignmentmode_is(const std::string &v) const
Matrix get_data_position() const
octave_value get_string() const
void update_text_extent()
Matrix get_extent_matrix(bool rotated=false) const
bool horizontalalignmentmode_is(const std::string &v) const
std::string get_units() const
bool rotationmode_is(const std::string &v) const
void set_rotation(const octave_value &val)
double get___fontsize_points__(double box_pix_height=0) const
bool positionmode_is(const std::string &v) const
static bool has_core_property(const caseless_str &pname)
void set_horizontalalignmentmode(const octave_value &val)
void set_positionmode(const octave_value &val)
octave_value get_extent() const
void set_verticalalignment(const octave_value &val)
double get_rotation() const
void set_rotationmode(const octave_value &val)
void set_verticalalignmentmode(const octave_value &val)
void set_position(const octave_value &val)
static property_list::pval_map_type factory_defaults()
void set_fontunits(const octave_value &val)
void set_horizontalalignment(const octave_value &val)
void update_fontunits(const caseless_str &old_units)
void set_style(const octave_value &val)
static property_list::pval_map_type factory_defaults()
static bool has_core_property(const caseless_str &pname)
void update_text_extent()
bool style_is(const std::string &v) const
octave_value get_extent() const
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
std::string get_style() const
void set_fontunits(const octave_value &val)
double get___fontsize_points__(double box_pix_height=0) const
static property_list::pval_map_type factory_defaults()
void set_fontunits(const octave_value &val)
void set_units(const octave_value &val)
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
void update_units(const caseless_str &old_units)
double get___fontsize_points__(double box_pix_height=0) const
void set_position(const octave_value &val)
void update_fontunits(const caseless_str &old_units)
static bool has_core_property(const caseless_str &pname)
void update_units(const caseless_str &old_units)
void set_columnformat(const octave_value &val)
double get_fontsize_pixels(double box_pix_height=0) const
octave_value get_extent() const
void set_columnwidth(const octave_value &val)
Matrix get_alternatebackgroundcolor_rgb()
void set_fontunits(const octave_value &val)
Matrix get_backgroundcolor_rgb()
void set_units(const octave_value &val)
void update_fontunits(const caseless_str &old_units)
Matrix get_extent_matrix() const
static bool has_core_property(const caseless_str &pname)
double get___fontsize_points__(double box_pix_height=0) const
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
ColumnVector real(const ComplexColumnVector &a)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define DECLARE_STATIC_FUNX(name, args_name, nargout_name)
#define DECLARE_STATIC_METHODX(name, interp_name, args_name, nargout_name)
#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 warning_with_id(const char *id, const char *fmt,...)
void() error(const char *fmt,...)
void interpreter_try(octave::unwind_protect &)
#define error_unless(cond)
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)
std::string dirname(const std::string &path)
octave_handle graphics_handle
void xset(const graphics_handle &h, const caseless_str &pname, const octave_value &val)
bool isfigure(double val)
graphics_handle reparent(const octave_value &ov, const std::string &who, const std::string &pname, const graphics_handle &new_parent, bool adopt)
void delete_graphics_object(const graphics_handle &h, bool from_root)
octave_value xget(const graphics_handle &h, const caseless_str &pname)
void delete_graphics_objects(const NDArray vals, bool from_root)
ColumnVector xform_vector()
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)
void translate(Matrix &m, double x, double y, double z)
bool set_property_in_handle(double handle, const std::string &property, const octave_value &arg, const std::string &fcn)
#define CONVERT_CDATA_1(ARRAY_T, VAL_FN, IS_REAL)
ColumnVector cross(const ColumnVector &v1, const ColumnVector &v2)
void get_children_limits(double &min_val, double &max_val, double &min_pos, double &max_neg, const Matrix &kids, char limit_type)
double norm(const ColumnVector &v)
void xform(ColumnVector &v, const Matrix &m)
void normalize(ColumnVector &v)
Matrix xform_scale(double x, double y, double z)
std::vector< octave_idx_type > coplanar_partition(const Matrix &vert, const Matrix &idx, octave_idx_type nc, octave_idx_type jj)
ColumnVector cam2xform(const Array< double > &m)
int calc_dimensions(const graphics_object &go)
RowVector xform2cam(const ColumnVector &v)
base_graphics_object * make_graphics_object_from_type(const caseless_str &type, const graphics_handle &h, const graphics_handle &p)
void scale(Matrix &m, double x, double y, double z)
Matrix xform_translate(double x, double y, double z)
ColumnVector transform(const Matrix &m, double x, double y, double z)
#define CHECK_ARRAY_EQUAL(T, F, A)
bool is_coplanar(const Matrix &cov)
double force_in_range(double x, double lower, double upper)
octave_value get_property_from_handle(double handle, const std::string &property, const std::string &fcn)
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)
#define OCTAVE_DEFAULT_FONTNAME
display_info & __get_display_info__()
gh_manager & __get_gh_manager__()
gtk_manager & __get_gtk_manager__()
interpreter & __get_interpreter__()
Complex atan(const Complex &x)
std::complex< T > floor(const std::complex< T > &x)
std::complex< T > ceil(const std::complex< T > &x)
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
bool dir_exists(const std::string &dirname)
std::string dir_sep_chars()
void sleep(double seconds, bool do_graphics_events)
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)
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
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
template int8_t abs(int8_t)