23 #if defined (HAVE_CONFIG_H) 48 #include "builtin-defun-decls.h" 70 OCTAVE_NORETURN
static 74 error (
"set: invalid value for %s property",
pname.c_str ());
83 const std::set<std::string>& pnames,
86 size_t len =
pname.length ();
87 std::set<std::string> matches;
90 for (
const auto& propnm : pnames)
92 if (
pname.compare (propnm, len))
94 if (len == propnm.length ())
97 matches.insert (propnm);
101 size_t num_matches = matches.size ();
103 if (num_matches == 0)
104 error (
"%s: unknown %s property %s",
105 who.c_str (), what.c_str (),
pname.c_str ());
106 else if (num_matches > 1)
110 std::ostringstream
os;
116 error (
"%s: ambiguous %s property name %s; possible matches:\n\n%s",
117 who.c_str (), what.c_str (),
pname.c_str (), match_list.c_str ());
119 else if (num_matches == 1)
125 "%s: allowing %s to match %s property %s",
126 who.c_str (),
pname.c_str (), what.c_str (),
127 possible_match.c_str ());
129 return possible_match;
144 const double cmapv[] =
146 2.67004010000000e-01, 2.72651720952381e-01, 2.77106307619048e-01,
147 2.80356151428571e-01, 2.82390045238095e-01, 2.83204606666667e-01,
148 2.82809341428571e-01, 2.81230763333333e-01, 2.78516153333333e-01,
149 2.74735528571429e-01, 2.69981791904762e-01, 2.64368580952381e-01,
150 2.58026184285714e-01, 2.51098684761905e-01, 2.43732853333333e-01,
151 2.36073294285714e-01, 2.28263191428571e-01, 2.20424955714286e-01,
152 2.12666598571429e-01, 2.05079113809524e-01, 1.97721880952381e-01,
153 1.90631350000000e-01, 1.83819438571429e-01, 1.77272360952381e-01,
154 1.70957518571429e-01, 1.64832915714286e-01, 1.58845368095238e-01,
155 1.52951235714286e-01, 1.47131626666667e-01, 1.41402210952381e-01,
156 1.35832975714286e-01, 1.30582113809524e-01, 1.25898377619048e-01,
157 1.22163105714286e-01, 1.19872409523810e-01, 1.19626570000000e-01,
158 1.22045948571429e-01, 1.27667691904762e-01, 1.36834947142857e-01,
159 1.49643331428571e-01, 1.65967274285714e-01, 1.85538397142857e-01,
160 2.08030450000000e-01, 2.33127309523809e-01, 2.60531475238095e-01,
161 2.90000730000000e-01, 3.21329971428571e-01, 3.54355250000000e-01,
162 3.88930322857143e-01, 4.24933143333333e-01, 4.62246770476190e-01,
163 5.00753620000000e-01, 5.40336957142857e-01, 5.80861172380952e-01,
164 6.22170772857143e-01, 6.64087320476191e-01, 7.06403823333333e-01,
165 7.48885251428571e-01, 7.91273132857143e-01, 8.33302102380952e-01,
166 8.74717527142857e-01, 9.15296319047619e-01, 9.54839555238095e-01,
167 9.93247890000000e-01, 4.87433000000000e-03, 2.58456800000000e-02,
168 5.09139004761905e-02, 7.42014957142857e-02, 9.59536042857143e-02,
169 1.16893314761905e-01, 1.37350195714286e-01, 1.57479940000000e-01,
170 1.77347967619048e-01, 1.96969168571429e-01, 2.16330337619048e-01,
171 2.35404660952381e-01, 2.54161735714286e-01, 2.72573219047619e-01,
172 2.90619516666667e-01, 3.08291041428571e-01, 3.25586450952381e-01,
173 3.42517215238095e-01, 3.59102207142857e-01, 3.75366067142857e-01,
174 3.91340913333333e-01, 4.07061480000000e-01, 4.22563764285714e-01,
175 4.37885543809524e-01, 4.53062984285714e-01, 4.68129543809524e-01,
176 4.83117059523810e-01, 4.98052961428571e-01, 5.12959473333333e-01,
177 5.27854311428571e-01, 5.42750087142857e-01, 5.57652481904762e-01,
178 5.72563073333333e-01, 5.87476284285714e-01, 6.02382410952381e-01,
179 6.17265840000000e-01, 6.32106955714286e-01, 6.46881817142857e-01,
180 6.61562926190476e-01, 6.76119717142857e-01, 6.90518987142857e-01,
181 7.04725181904762e-01, 7.18700950000000e-01, 7.32406441904762e-01,
182 7.45802021904762e-01, 7.58846480000000e-01, 7.71497934761905e-01,
183 7.83714033809524e-01, 7.95453081428571e-01, 8.06673890000000e-01,
184 8.17337565714286e-01, 8.27409135714286e-01, 8.36858167619048e-01,
185 8.45663399523809e-01, 8.53815582857143e-01, 8.61321019047619e-01,
186 8.68206316666667e-01, 8.74522215714286e-01, 8.80346158571429e-01,
187 8.85780083333333e-01, 8.90945338571429e-01, 8.95973498571429e-01,
188 9.01005800000000e-01, 9.06156570000000e-01, 3.29415190000000e-01,
189 3.53367293333333e-01, 3.76236064761905e-01, 3.97901482857143e-01,
190 4.18250757142857e-01, 4.37178920000000e-01, 4.54595888571429e-01,
191 4.70433883333333e-01, 4.84653865714286e-01, 4.97250492857143e-01,
192 5.08254501428571e-01, 5.17731949047619e-01, 5.25780221428571e-01,
193 5.32522206190476e-01, 5.38097133333333e-01, 5.42651800000000e-01,
194 5.46335411904762e-01, 5.49287148571429e-01, 5.51635008571429e-01,
195 5.53493173333333e-01, 5.54953478571429e-01, 5.56089070000000e-01,
196 5.56952166666667e-01, 5.57576145714286e-01, 5.57974025714286e-01,
197 5.58142745238095e-01, 5.58058673809524e-01, 5.57684744285714e-01,
198 5.56973310000000e-01, 5.55864478571429e-01, 5.54288677142857e-01,
199 5.52175699047619e-01, 5.49445382857143e-01, 5.46023368571429e-01,
200 5.41830633809524e-01, 5.36795616666667e-01, 5.30847985714286e-01,
201 5.23924198571429e-01, 5.15966779523810e-01, 5.06924262857143e-01,
202 4.96751861428571e-01, 4.85412122857143e-01, 4.72873300000000e-01,
203 4.59105875238095e-01, 4.44095883333333e-01, 4.27825852857143e-01,
204 4.10292713809524e-01, 3.91487632857143e-01, 3.71420688571429e-01,
205 3.50098750000000e-01, 3.27544678571429e-01, 3.03798967142857e-01,
206 2.78916748571429e-01, 2.53000856190476e-01, 2.26223670000000e-01,
207 1.98879439523810e-01, 1.71494930000000e-01, 1.45037631428572e-01,
208 1.21291048571429e-01, 1.03326155238095e-01, 9.53507900000000e-02,
209 1.00469958095238e-01, 1.17876387142857e-01, 1.43936200000000e-01
215 std::copy (cmapv, cmapv + (64*3), cmap.
fortran_vec ());
315 for (
int col = 0; col < 64; col++)
330 for (
int col = 0; col < 3; col++)
343 for (
int col = 0; col < 3; col++)
574 if (from_units.
compare (to_units))
580 double points_size = 0;
583 if (from_units.
compare (
"points"))
584 points_size = font_size;
589 if (from_units.
compare (
"pixels"))
590 points_size = font_size * 72.0 / res;
591 else if (from_units.
compare (
"inches"))
592 points_size = font_size * 72.0;
593 else if (from_units.
compare (
"centimeters"))
594 points_size = font_size * 72.0 / 2.54;
595 else if (from_units.
compare (
"normalized"))
596 points_size = font_size * parent_height * 72.0 / res;
599 double new_font_size = 0;
601 if (to_units.
compare (
"points"))
602 new_font_size = points_size;
608 if (to_units.
compare (
"pixels"))
609 new_font_size = points_size * res / 72.0;
610 else if (to_units.
compare (
"inches"))
611 new_font_size = points_size / 72.0;
612 else if (to_units.
compare (
"centimeters"))
613 new_font_size = points_size * 2.54 / 72.0;
614 else if (to_units.
compare (
"normalized"))
618 if (parent_height > 0)
619 new_font_size = points_size * res / (parent_height * 72.0);
623 return new_font_size;
632 bool is_rectangle = (pos.
numel () == 4);
633 bool is_2d = (pos.
numel () == 2);
635 if (from_units.
compare (
"pixels"))
637 else if (from_units.
compare (
"normalized"))
639 retval(0) = pos(0) * parent_dim(0) + 1;
640 retval(1) = pos(1) * parent_dim(1) + 1;
643 retval(2) = pos(2) * parent_dim(0);
644 retval(3) = pos(3) * parent_dim(1);
649 else if (from_units.
compare (
"characters"))
658 f = 12.0 * res / 74.951;
680 if (from_units.
compare (
"points"))
682 else if (from_units.
compare (
"inches"))
684 else if (from_units.
compare (
"centimeters"))
701 if (! to_units.
compare (
"pixels"))
703 if (to_units.
compare (
"normalized"))
709 retval(2) /= parent_dim(0);
710 retval(3) /= parent_dim(1);
715 else if (to_units.
compare (
"characters"))
722 f = 12.0 * res / 74.951;
744 if (to_units.
compare (
"points"))
746 else if (to_units.
compare (
"inches"))
748 else if (to_units.
compare (
"centimeters"))
765 else if (! is_rectangle && ! is_2d)
781 if (ax.valid_object ())
786 bool is_rectangle = (pos.
numel () == 4);
788 ax_size = ax_bbox.
extract_n (0, 2, 1, 2);
790 if (from_units.
compare (
"data"))
800 retval(0) = v1(0) - ax_bbox(0) + 1;
801 retval(1) = ax_bbox(1) + ax_bbox(3) - v1(1) + 1;
811 retval(0) = v(0) - ax_bbox(0) + 1;
812 retval(1) = ax_bbox(1) + ax_bbox(3) - v(1) + 1;
819 if (! to_units.
compare (
"pixels"))
827 retval(0) + ax_bbox(0) - 1,
828 ax_bbox(1) + ax_bbox(3) -
retval(1) + 1);
844 retval(0) + ax_bbox(0) - 1,
845 ax_bbox(1) + ax_bbox(3) -
retval(1) + 1);
869 sz.extract_n (0, 2, 1, 2)).extract_n (0, 2, 1, 2);
898 av[
i+lda] = cmapv[idx+nc];
899 av[
i+2*lda] = cmapv[idx+2*nc];
903 template <
typename T>
911 clim_0, clim_1, cmapv, cv[
i], lda, nc,
i, av);
916 bool is_scaled,
int cdim)
921 if (
dv.
ndims () == cdim &&
dv(cdim-1) == 3)
930 if (ax.valid_object ())
952 double *av =
a.fortran_vec ();
953 const double *cmapv = cmap.
data ();
955 double clim_0 = clim(0);
956 double clim_1 = clim(1);
966 #define CONVERT_CDATA_1(ARRAY_T, VAL_FN, IS_REAL) \ 969 ARRAY_T tmp = cdata. VAL_FN ## array_value (); \ 971 convert_cdata_1 (is_scaled, IS_REAL, clim_0, clim_1, cmapv, \ 972 tmp.data (), lda, nc, av); \ 989 warning (
"unsupported type for cdata (= %s). " 990 "Valid types are uint8, uint16, double, single, and bool.",
995 #undef CONVERT_CDATA_1 1000 template <
typename T>
1003 double& eminp,
double& emaxp)
1005 const T *data = m.
data ();
1021 if (
e > 0 &&
e < eminp)
1024 if (e < 0 && e > emaxp)
1034 int len =
name.length ();
1047 pfx =
name.substr (0, 5);
1053 pfx =
name.substr (0, 6);
1059 pfx =
name.substr (0, 7);
1066 pfx =
name.substr (0, 9);
1073 pfx =
name.substr (0, 10);
1075 if (pfx.
compare (
"uipushtool"))
1079 pfx =
name.substr (0, 12);
1081 if (pfx.
compare (
"uitoggletool"))
1085 pfx =
name.substr (0, 13);
1087 if (pfx.
compare (
"uicontextmenu") ||
1088 pfx.
compare (
"uibuttongroup"))
1101 rest =
name.substr (offset);
1116 if (
type.compare (
"figure"))
1118 else if (
type.compare (
"axes"))
1120 else if (
type.compare (
"line"))
1122 else if (
type.compare (
"text"))
1124 else if (
type.compare (
"image"))
1126 else if (
type.compare (
"light"))
1128 else if (
type.compare (
"patch"))
1130 else if (
type.compare (
"surface"))
1132 else if (
type.compare (
"hggroup"))
1134 else if (
type.compare (
"uimenu"))
1136 else if (
type.compare (
"uicontrol"))
1138 else if (
type.compare (
"uipanel"))
1140 else if (
type.compare (
"uibuttongroup"))
1142 else if (
type.compare (
"uicontextmenu"))
1144 else if (
type.compare (
"uitoolbar"))
1146 else if (
type.compare (
"uipushtool"))
1148 else if (
type.compare (
"uitoggletool"))
1161 if (
id >= 0 && do_notify_toolkit)
1188 : default_val (), possible_vals ()
1191 size_t len = opt_string.length ();
1192 bool done = len == 0;
1196 size_t end = opt_string.find (
'|', beg);
1198 if (end == std::string::npos)
1267 double tmp_rgb[3] = {0, 0, 0};
1270 unsigned int len =
str.length ();
1274 if (
str.compare (0, len,
"blue", 0, len) == 0)
1276 else if (
str.compare (0, len,
"black", 0, len) == 0
1277 ||
str.compare (0, len,
"k", 0, len) == 0)
1278 tmp_rgb[0] = tmp_rgb[1] = tmp_rgb[2] = 0;
1279 else if (
str.compare (0, len,
"red", 0, len) == 0)
1281 else if (
str.compare (0, len,
"green", 0, len) == 0)
1283 else if (
str.compare (0, len,
"yellow", 0, len) == 0)
1284 tmp_rgb[0] = tmp_rgb[1] = 1;
1285 else if (
str.compare (0, len,
"magenta", 0, len) == 0)
1286 tmp_rgb[0] = tmp_rgb[2] = 1;
1287 else if (
str.compare (0, len,
"cyan", 0, len) == 0)
1288 tmp_rgb[1] = tmp_rgb[2] = 1;
1289 else if (
str.compare (0, len,
"white", 0, len) == 0
1290 ||
str.compare (0, len,
"w", 0, len) == 0)
1291 tmp_rgb[0] = tmp_rgb[1] = tmp_rgb[2] = 1;
1297 for (
int i = 0;
i < 3;
i++)
1307 if (
val.is_string ())
1312 error (R
"(invalid value for color property "%s")", 1321 if (
s.length () != match.length ())
1323 "%s: allowing %s to match %s value %s",
1324 "set",
s.c_str (),
get_name ().c_str (),
1344 catch (octave::execution_exception&
e)
1346 error (
e, R
"(invalid value for color property "%s" (value = %s))", 1351 else if (
val.isnumeric ())
1355 if (m.
numel () != 3)
1356 error (R
"(invalid value for color property "%s")", 1369 error (R
"(invalid value for color property "%s")", 1378 if (
val.is_string ())
1384 error (R
"(invalid value for double_radio property "%s")", 1389 if (
s.length () != match.length ())
1391 "%s: allowing %s to match %s value %s",
1392 "set",
s.c_str (),
get_name ().c_str (),
1399 else if (
val.is_scalar_type () &&
val.isreal ())
1401 double new_dval =
val.double_value ();
1411 error (R
"(invalid value for double_radio property "%s")", 1440 int vlen = vdims.
ndims ();
1451 if (itdims.
ndims () == vlen)
1455 for (
int i = 0; xok &&
i < vlen;
i++)
1459 if (itdims(
i) != vdims(
i))
1477 error (R
"(set: "%s" must be greater than or equal to %g)", 1480 error (R
"(set: "%s" must be greater than %g)", 1488 error (R
"(set: "%s" must be less than or equal to %g)", 1491 error (R
"(set: "%s" must be less than %g)", 1500 error (R
"(set: "%s" must be finite)", get_name ().c_str ()); 1506 error (R
"(set: "%s" must not be nan)", get_name ().c_str ()); 1512 error (R
"(set: "%s" must not be infinite)", get_name ().c_str ()); 1528 #define CHECK_ARRAY_EQUAL(T, F, A) \ 1530 if (data.numel () == 1) \ 1531 return data.F ## scalar_value () == \ 1532 v.F ## scalar_value (); \ 1538 const A m1 = data.F ## array_value (); \ 1539 const T *d1 = m1.data (); \ 1540 const A m2 = v.F ## array_value (); \ 1541 const T *d2 = m2.data (); \ 1545 for (int i = 0; flag && i < data.numel (); i++) \ 1546 if (d1[i] != d2[i]) \ 1625 if (!
get ().isempty ())
1634 double dv = v.
xdouble_value (R
"(set: invalid graphics handle for property "%s")", 1640 bool type_ok =
true;
1657 error (R
"(set: invalid graphics handle (= %g) for property "%s")", 1660 error (R
"(set: invalid graphics object type for property "%s")", 1702 if (! props.is_showhiddenhandles ())
1710 if (! return_hidden)
1713 else if (return_hidden)
1782 m_set.insert (reinterpret_cast<intptr_t> (ptr));
1787 m_set.erase (reinterpret_cast<intptr_t> (ptr));
1792 return m_set.find (reinterpret_cast<intptr_t> (ptr)) !=
m_set.end ();
1835 if (
type.compare (
"string"))
1841 else if (
type.compare (
"any"))
1848 else if (
type.compare (
"radio"))
1851 error (
"addproperty: missing possible values for radio property");
1853 std::string sv = args(0).xstring_value (
"addproperty: argument for radio property must be a string");
1860 else if (
type.compare (
"double"))
1862 double dv = (args.
length () > 0 ? args(0).double_value () : 0.0);
1866 else if (
type.compare (
"handle"))
1868 double hv = (args.
length () > 0 ? args(0).double_value ()
1875 else if (
type.compare (
"boolean"))
1882 else if (
type.compare (
"data"))
1893 else if (
type.compare (
"color"))
1903 if (args.
length () > 0 && ! args(0).isempty ())
1913 error (
"addproperty: unsupported type for dynamic property (= %s)",
1918 std::map<caseless_str, graphics_object>::const_iterator it =
1937 error (
"addproperty: invalid object type (= %s)",
1963 for (
int k = 0;
k < children.
numel ();
k++)
1981 for (
int k = 0;
k < children.
numel ();
k++)
1993 __graphics_toolkit__ =
b.get_name ();
1994 __plot_stream__ =
Matrix ();
2003 figure::properties::set___mouse_mode__ (
const octave_value& val_arg)
2009 if (
val.is_string ())
2013 if (modestr ==
"zoom in")
2015 val = modestr =
"zoom";
2018 else if (modestr ==
"zoom out")
2020 val = modestr =
"zoom";
2024 if (__mouse_mode__.set (
val,
true))
2030 set___pan_mode__ (pm);
2033 rm.
setfield (
"Enable",
mode ==
"rotate" ?
"on" :
"off");
2034 set___rotate_mode__ (rm);
2038 zm.
setfield (
"Direction", direction);
2039 set___zoom_mode__ (zm);
2043 else if (modestr ==
"zoom")
2049 if (direction != curr_direction)
2051 zm.
setfield (
"Direction", direction);
2052 set___zoom_mode__ (zm);
2061 figure::properties::update_handlevisibility (
void)
2080 base_properties::update_handlevisibility ();
2089 size_t len =
name.length ();
2100 pfx =
name.substr (0, 5);
2106 pfx =
name.substr (0, 6);
2112 pfx =
name.substr (0, 7);
2119 pfx =
name.substr (0, 9);
2126 pfx =
name.substr (0, 10);
2128 if (pfx.
compare (
"uipushtool"))
2132 pfx =
name.substr (0, 12);
2134 if (pfx.
compare (
"uitoogletool"))
2138 pfx =
name.substr (0, 13);
2140 if (pfx.
compare (
"uicontextmenu")
2141 || pfx.
compare (
"uibuttongroup"))
2157 std::transform (pfx.begin (), pfx.end (), pfx.begin (), tolower);
2161 bool has_property =
false;
2163 has_property = axes::properties::has_core_property (
pname);
2164 else if (pfx ==
"figure")
2165 has_property = figure::properties::has_core_property (
pname);
2166 else if (pfx ==
"line")
2167 has_property = line::properties::has_core_property (
pname);
2168 else if (pfx ==
"text")
2169 has_property = text::properties::has_core_property (
pname);
2170 else if (pfx ==
"image")
2171 has_property = image::properties::has_core_property (
pname);
2172 else if (pfx ==
"patch")
2173 has_property = patch::properties::has_core_property (
pname);
2174 else if (pfx ==
"surface")
2175 has_property = surface::properties::has_core_property (
pname);
2176 else if (pfx ==
"hggroup")
2177 has_property = hggroup::properties::has_core_property (
pname);
2178 else if (pfx ==
"uimenu")
2179 has_property = uimenu::properties::has_core_property (
pname);
2180 else if (pfx ==
"uicontrol")
2181 has_property = uicontrol::properties::has_core_property (
pname);
2182 else if (pfx ==
"uibuttongroup")
2183 has_property = uibuttongroup::properties::has_core_property (
pname);
2184 else if (pfx ==
"uipanel")
2185 has_property = uipanel::properties::has_core_property (
pname);
2186 else if (pfx ==
"uicontextmenu")
2187 has_property = uicontextmenu::properties::has_core_property (
pname);
2188 else if (pfx ==
"uitoolbar")
2189 has_property = uitoolbar::properties::has_core_property (
pname);
2190 else if (pfx ==
"uipushtool")
2191 has_property = uipushtool::properties::has_core_property (
pname);
2194 error (
"invalid %s property '%s'", pfx.c_str (),
pname.c_str ());
2196 bool remove =
false;
2197 if (
val.is_string ())
2201 remove = (sval ==
"remove");
2210 if (
p != pval_map.end ())
2219 error (
"invalid default property specification");
2229 size_t len =
name.length ();
2240 pfx =
name.substr (0, 5);
2246 pfx =
name.substr (0, 6);
2252 pfx =
name.substr (0, 7);
2259 pfx =
name.substr (0, 9);
2266 pfx =
name.substr (0, 10);
2268 if (pfx.
compare (
"uipushtool"))
2272 pfx =
name.substr (0, 12);
2274 if (pfx.
compare (
"uitoggletool"))
2278 pfx =
name.substr (0, 13);
2280 if (pfx.
compare (
"uicontextmenu")
2281 || pfx.
compare (
"uibuttongroup"))
2295 std::transform (pfx.begin (), pfx.end (), pfx.begin (), tolower);
2307 if (q != pval_map.end ())
2325 for (
const auto& prop_val :
p->second)
2326 m.
assign (prefix + prop_val.first, prop_val.second);
2340 error (
"graphics_object::set: Nothing to set");
2346 set (args(
i).map_value ());
2351 caseless_str pname = args(
i).xstring_value (
"set: argument %d must be a property name",
i);
2357 error (
"set: invalid number of arguments");
2380 error (
"set: number of names must match number of value columns (%d != %d)",
2543 if (
val.is_string ())
2549 if (sval ==
"default")
2553 rep->set (
pname, default_val);
2555 else if (sval ==
"factory")
2559 rep->set (
pname, default_val);
2564 if (sval == R
"(\default)") 2565 rep->set (pname, "default");
2566 else if (sval == R
"(\factory)") 2567 rep->set (pname, "factory");
2597 static double maxrand = RAND_MAX + 2.0;
2599 return (rand () + 1.0) / maxrand;
2607 if (integer_figure_handle)
2616 while (handle_map.find (
retval) != handle_map.end ())
2627 if (
p != handle_free_list.end ())
2630 handle_free_list.erase (
p);
2648 if (
h.value () == 0)
2649 error (
"graphics_handle::free: can't delete root figure");
2653 if (
p == handle_map.end ())
2654 error (
"graphics_handle::free: invalid object %g",
h.value ());
2658 bp.set_beingdeleted (
true);
2664 bp.execute_deletefcn ();
2667 p->second.finalize ();
2678 handle_map.erase (
p);
2681 handle_free_list.insert
2692 if (
p == handle_map.end ())
2693 error (
"graphics_handle::free: invalid object %g", old_gh.
value ());
2697 handle_map.erase (
p);
2699 handle_map[new_gh] = go;
2701 if (old_gh.
value () < 0)
2705 for (
auto& hfig : figure_list)
2749 double hv = ov.
xdouble_value (
"%s: %s must be a graphics handle",
2750 who.c_str (),
pname.c_str ());
2755 error (
"%s: invalid graphics handle (= %g) for %s",
2756 who.c_str (), hv,
pname.c_str ());
2767 go.
set (
"parent", new_parent.
value ());
2781 :
val.double_value ();
2791 :
val.double_value ();
2869 event_queue.clear ();
2874 Matrix hlist = do_figure_handle_list (
true);
2886 hlist = do_figure_handle_list (
true);
2898 hlist = do_figure_handle_list (
true);
2900 if (hlist.
numel () != 0)
2901 warning (
"gh_manager::do_close_all_figures: some graphics elements failed to close.");
2905 callback_objects.clear ();
2936 else if (
val.isnumeric () &&
val.isreal ())
2956 return go && go.
isa (
"figure");
2997 else if (
state == 2)
3014 for (
const auto&
p : pval)
3015 factory_pval[
p.first] =
p.second;
3021 for (
const auto&
p : factory_pval)
3027 &&
pname.find (
"__") != 0 &&
pname.find (
"current") != 0
3028 &&
pname !=
"uicontextmenu" &&
pname !=
"parent")
3031 if (
pname.find (
"mode") == (
pname.length () - 4))
3039 for (
const auto&
p : pval)
3040 go.
set (
p.first,
p.second);
3059 for (
const auto& prop_val : pval_map)
3067 catch (octave::execution_exception&
e)
3069 error (
e,
"error setting default property %s",
pname.c_str ());
3094 std::map<caseless_str, property, cmp_caseless_str>::const_iterator it =
3095 all_props.find (
pname);
3097 if (it == all_props.end ())
3098 error (R
"(get: unknown property "%s")", pname.c_str ()); 3100 return it->second.get ();
3108 for (std::map<caseless_str, property, cmp_caseless_str>::const_iterator
3109 it = all_props.begin (); it != all_props.end (); ++it)
3110 if (all || ! it->second.is_hidden ())
3111 m.
assign (it->second.get_name (), it->second.get ());
3116 std::set<std::string>
3119 return dynamic_properties;
3125 const std::set<std::string>& dynprops = dynamic_property_names ();
3127 if (dynprops.find (
pname) != dynprops.end ())
3130 return all_props.find (
pname) != all_props.end ();
3137 std::map<caseless_str, property, cmp_caseless_str>::iterator it =
3138 all_props.find (
pname);
3140 if (it == all_props.end ())
3141 error (R
"(set: unknown property "%s")", pname.c_str ()); 3143 it->second.set (val); 3145 dynamic_properties.insert (pname); 3153 std::map<caseless_str, property, cmp_caseless_str>::const_iterator it =
3154 all_props.find (
pname);
3156 if (it == all_props.end ())
3157 error (R
"(get_property: unknown property "%s")", pname.c_str ()); 3165 double hp =
val.xdouble_value (
"set: parent must be a graphics handle");
3169 if (hp == __myhandle__)
3170 error (
"set: can not set object parent to be object itself");
3174 if (! new_parent.
ok ())
3175 error (
"set: invalid graphics handle (= %g) for parent", hp);
3189 if (new_parent_go.
get_parent () == __myhandle__)
3197 ::adopt (parent.handle_value (), __myhandle__);
3216 __modified__ =
"on";
3258 if (go && go.
isa (
"uicontextmenu"))
3269 return (handlevisibility.is (
"on")
3287 Matrix kids = get_children ();
3289 for (
int i = 0;
i < kids.
numel ();
i++)
3308 base_properties::update_handlevisibility (
void)
3321 root_props.set_callbackobject (
Matrix ());
3327 if (fig.valid_object ())
3335 fig_props.set_currentobject (
Matrix ());
3384 property p = get_property (
pname);
3395 property p = get_property (
pname);
3407 error (
"base_graphics_object::update_axis_limits: invalid graphics object");
3420 error (
"base_graphics_object::update_axis_limits: invalid graphics object");
3435 for (
const auto& pm : m)
3456 p.delete_listener ();
3458 catch (
const octave::execution_exception&)
3469 const auto it = local_defaults.
find (go_name);
3471 if (it != local_defaults.
end ())
3474 for (
const auto& prop_val : pval_lst)
3478 def[
pname] = prop_val.second;
3506 error (
"base_graphics_object::values_as_string: invalid graphics object");
3512 for (
const auto& pm : m)
3514 const auto&
pname = pm.first;
3519 if (
p.ok () && !
p.is_hidden ())
3523 retval +=
p.values_as_string ();
3540 error (
"base_graphics_object::value_as_string: invalid graphics object");
3548 if (
p.ok () && !
p.is_hidden ())
3551 retval +=
p.values_as_string ();
3567 error (
"base_graphics_object::values_as_struct: invalid graphics object");
3572 for (
const auto& pm : m)
3574 const auto&
pname = pm.first;
3579 if (
p.ok () && !
p.is_hidden ())
3628 #include "graphics-props.cc" 3633 root_figure::properties::set_callbackobject (
const octave_value& v)
3639 if (! cbo_stack.empty ())
3641 val = cbo_stack.front ();
3643 cbo_stack.pop_front ();
3646 callbackobject =
val;
3650 if (get_callbackobject ().ok ())
3651 cbo_stack.push_front (get_callbackobject ());
3653 callbackobject =
val;
3660 root_figure::properties::set_currentfigure (
const octave_value& v)
3666 currentfigure =
val;
3678 if (integerhandle.set (
val,
true))
3680 bool int_fig_handle = integerhandle.is_on ();
3696 Matrix kids = get_children ();
3707 if (__myhandle__ == cf)
3708 xset (0,
"currentfigure", __myhandle__.value ());
3710 this_go.
update (integerhandle.get_id ());
3719 root_figure::properties::update_units (
void)
3725 double dpi = get_screenpixelsperinch ();
3727 if (xunits ==
"inches")
3734 else if (xunits ==
"centimeters")
3738 scrn_sz(2) *= 2.54 / dpi;
3739 scrn_sz(3) *= 2.54 / dpi;
3741 else if (xunits ==
"normalized")
3743 scrn_sz =
Matrix (1, 4, 1.0);
3747 else if (xunits ==
"points")
3751 scrn_sz(2) *= 72 / dpi;
3752 scrn_sz(3) *= 72 / dpi;
3755 set_screensize (scrn_sz);
3764 pos(2) = screen_size(0);
3765 pos(3) = screen_size(1);
3833 if (
h == currentaxes.handle_value ())
3837 Matrix kids = get_children ();
3845 if (go.
isa (
"axes"))
3847 new_currentaxes = kid;
3852 currentaxes = new_currentaxes;
3873 if (!
val.is_string ())
3874 error (
"set___graphics_toolkit__ must be a string");
3883 if (
b.get_name () !=
nm)
3884 error (
"set___graphics_toolkit__: invalid graphics toolkit");
3886 if (
nm != get___graphics_toolkit__ ())
3898 if (! get_currentaxes ().ok ())
3902 if (go.
type () ==
"axes")
3903 set_currentaxes (
h.as_octave_value ());
3931 xset (0,
"currentfigure", __myhandle__.value ());
3941 get_position ().matrix_value () :
3942 get_outerposition ().matrix_value ());
3948 pos(1) = screen_size(1) - pos(1) - pos(3);
3955 bool do_notify_toolkit)
3960 pos(1) = screen_size(1) - pos(1) - pos(3);
3966 set_position (pos, do_notify_toolkit);
3968 set_outerposition (pos, do_notify_toolkit);
3974 Matrix bb = get_boundingbox (
true);
3980 pos(1) = bb(3) - pos(1);
3991 Matrix bb = get_boundingbox (
true);
4000 pos(1) = bb(3) - pos(1);
4007 bool do_notify_toolkit)
4010 bool modified =
false;
4012 old_bb = get_boundingbox (
true);
4013 modified = position.set (v,
false, do_notify_toolkit);
4014 new_bb = get_boundingbox (
true);
4016 if (old_bb != new_bb)
4018 if (old_bb(2) != new_bb(2) || old_bb(3) != new_bb(3))
4020 execute_resizefcn ();
4021 update_boundingbox ();
4027 position.run_listeners (
POSTSET);
4031 if (paperpositionmode.is (
"auto"))
4032 paperposition.set (get_auto_paperposition ());
4037 bool do_notify_toolkit)
4039 if (outerposition.set (v,
true, do_notify_toolkit))
4050 error (
"set: can't set paperunits to normalized when papertype is custom");
4053 if (paperunits.set (
val,
true))
4055 update_paperunits (old_paperunits);
4067 error (
"set: can't set paperunits to normalized when papertype is custom");
4069 if (papertype.set (
val,
true))
4071 update_papertype ();
4081 if (! punits.
compare (
"normalized"))
4086 if (punits.
compare (
"inches"))
4089 mm2units = 1 / 25.4;
4091 else if (punits.
compare (
"centimeters"))
4094 mm2units = 1 / 10.0;
4099 mm2units = 72.0 / 25.4;
4102 if (ptype.
compare (
"usletter"))
4104 retval(0) = 8.5 * in2units;
4105 retval(1) = 11.0 * in2units;
4107 else if (ptype.
compare (
"uslegal"))
4109 retval(0) = 8.5 * in2units;
4110 retval(1) = 14.0 * in2units;
4112 else if (ptype.
compare (
"tabloid"))
4114 retval(0) = 11.0 * in2units;
4115 retval(1) = 17.0 * in2units;
4117 else if (ptype.
compare (
"a0"))
4119 retval(0) = 841.0 * mm2units;
4120 retval(1) = 1189.0 * mm2units;
4122 else if (ptype.
compare (
"a1"))
4124 retval(0) = 594.0 * mm2units;
4125 retval(1) = 841.0 * mm2units;
4127 else if (ptype.
compare (
"a2"))
4129 retval(0) = 420.0 * mm2units;
4130 retval(1) = 594.0 * mm2units;
4132 else if (ptype.
compare (
"a3"))
4134 retval(0) = 297.0 * mm2units;
4135 retval(1) = 420.0 * mm2units;
4137 else if (ptype.
compare (
"a4"))
4139 retval(0) = 210.0 * mm2units;
4140 retval(1) = 297.0 * mm2units;
4142 else if (ptype.
compare (
"a5"))
4144 retval(0) = 148.0 * mm2units;
4145 retval(1) = 210.0 * mm2units;
4147 else if (ptype.
compare (
"b0"))
4149 retval(0) = 1029.0 * mm2units;
4150 retval(1) = 1456.0 * mm2units;
4152 else if (ptype.
compare (
"b1"))
4154 retval(0) = 728.0 * mm2units;
4155 retval(1) = 1028.0 * mm2units;
4157 else if (ptype.
compare (
"b2"))
4159 retval(0) = 514.0 * mm2units;
4160 retval(1) = 728.0 * mm2units;
4162 else if (ptype.
compare (
"b3"))
4164 retval(0) = 364.0 * mm2units;
4165 retval(1) = 514.0 * mm2units;
4167 else if (ptype.
compare (
"b4"))
4169 retval(0) = 257.0 * mm2units;
4170 retval(1) = 364.0 * mm2units;
4172 else if (ptype.
compare (
"b5"))
4174 retval(0) = 182.0 * mm2units;
4175 retval(1) = 257.0 * mm2units;
4177 else if (ptype.
compare (
"arch-a"))
4179 retval(0) = 9.0 * in2units;
4180 retval(1) = 12.0 * in2units;
4182 else if (ptype.
compare (
"arch-b"))
4184 retval(0) = 12.0 * in2units;
4185 retval(1) = 18.0 * in2units;
4187 else if (ptype.
compare (
"arch-c"))
4189 retval(0) = 18.0 * in2units;
4190 retval(1) = 24.0 * in2units;
4192 else if (ptype.
compare (
"arch-d"))
4194 retval(0) = 24.0 * in2units;
4195 retval(1) = 36.0 * in2units;
4197 else if (ptype.
compare (
"arch-e"))
4199 retval(0) = 36.0 * in2units;
4200 retval(1) = 48.0 * in2units;
4204 retval(0) = 8.5 * in2units;
4205 retval(1) = 11.0 * in2units;
4209 retval(0) = 11.0 * in2units;
4210 retval(1) = 17.0 * in2units;
4214 retval(0) = 17.0 * in2units;
4215 retval(1) = 22.0 * in2units;
4219 retval(0) = 22.0 * in2units;
4220 retval(1) = 34.0 * in2units;
4224 retval(0) = 34.0 * in2units;
4225 retval(1) = 43.0 * in2units;
4233 figure::properties::get_auto_paperposition (
void)
4235 Matrix pos = get_position ().matrix_value ();
4242 if (funits ==
"normalized" || punits ==
"normalized")
4247 if (punits ==
"normalized")
4256 sz = get_papersize ().matrix_value ();
4258 pos(0) =
sz(0)/2 - pos(2)/2;
4259 pos(1) =
sz(1)/2 - pos(3)/2;
4350 Matrix pos = get_paperposition ().matrix_value ();
4351 Matrix sz = get_papersize ().matrix_value ();
4362 if (ptype.
compare (
"<custom>"))
4364 if (old_paperunits.
compare (
"centimeters"))
4369 else if (old_paperunits.
compare (
"points"))
4375 if (punits.
compare (
"centimeters"))
4380 else if (punits.
compare (
"points"))
4389 if (porient ==
"landscape")
4403 figure::properties::update_papertype (
void)
4406 if (typ !=
"<custom>")
4409 if (get_paperorientation () ==
"landscape")
4416 if (paperpositionmode.is (
"auto"))
4417 paperposition.set (get_auto_paperposition ());
4421 figure::properties::update_papersize (
void)
4423 Matrix sz = get_papersize ().matrix_value ();
4432 paperorientation.set (
"portrait");
4436 if (punits ==
"centimeters")
4441 else if (punits ==
"points")
4446 if (punits ==
"normalized")
4448 if (get_papertype () ==
"<custom>")
4449 error (
"set: can't set the papertype to <custom> when the paperunits is normalized");
4457 const double mm2in = 1.0 / 25.4;
4458 const double tol = 0.01;
4534 papertype.set (ptype);
4536 if (punits ==
"centimeters")
4541 else if (punits ==
"points")
4546 if (get_paperorientation () ==
"landscape")
4552 if (paperpositionmode.is (
"auto"))
4553 paperposition.set (get_auto_paperposition ());
4589 figure::properties::update_paperorientation (
void)
4592 Matrix sz = get_papersize ().matrix_value ();
4593 if ((
sz(0) >
sz(1) && porient ==
"portrait")
4594 || (
sz(0) <
sz(1) && porient ==
"landscape"))
4602 if (paperpositionmode.is (
"auto"))
4603 paperposition.set (get_auto_paperposition ());
4638 if (units.set (
val,
true))
4640 update_units (old_units);
4648 position.set (
convert_position (get_position ().matrix_value (), old_units,
4673 if (is_numbertitle ())
4675 std::ostringstream
os;
4678 os <<
"Figure " << __myhandle__.value ();
4680 os <<
": " << get_name ();
4711 plist.
erase (
"units");
4712 plist.
erase (
"position");
4713 plist.
erase (
"outerposition");
4714 plist.
erase (
"paperunits");
4715 plist.
erase (
"paperposition");
4716 plist.
erase (
"windowstyle");
4725 axes::properties::init (
void)
4728 outerposition.add_constraint (
dim_vector (1, 4));
4729 tightinset.add_constraint (
dim_vector (1, 4));
4730 looseinset.add_constraint (
dim_vector (1, 4));
4731 colororder.add_constraint (
dim_vector (-1, 3));
4732 dataaspectratio.add_constraint (3);
4733 dataaspectratio.add_constraint (
"min", 0,
false);
4734 dataaspectratio.add_constraint (
FINITE);
4735 plotboxaspectratio.add_constraint (3);
4736 plotboxaspectratio.add_constraint (
"min", 0,
false);
4737 plotboxaspectratio.add_constraint (
FINITE);
4740 alim.add_constraint (2);
4741 alim.add_constraint (
NOT_NAN);
4742 clim.add_constraint (2);
4743 clim.add_constraint (
NOT_NAN);
4744 xlim.add_constraint (2);
4745 xlim.add_constraint (
NOT_NAN);
4746 ylim.add_constraint (2);
4747 ylim.add_constraint (
NOT_NAN);
4748 zlim.add_constraint (2);
4749 zlim.add_constraint (
NOT_NAN);
4751 xtick.add_constraint (
FINITE);
4753 ytick.add_constraint (
FINITE);
4755 ztick.add_constraint (
FINITE);
4756 ticklength.add_constraint (
dim_vector (1, 2));
4761 cameraposition.add_constraint (3);
4762 cameraposition.add_constraint (
FINITE);
4763 cameratarget.add_constraint (3);
4764 cameratarget.add_constraint (
FINITE);
4767 cameraupvector = upv;
4768 cameraupvector.add_constraint (3);
4769 cameraupvector.add_constraint (
FINITE);
4770 cameraviewangle.add_constraint (
FINITE);
4771 currentpoint.add_constraint (
dim_vector (2, 3));
4774 fontsize.add_constraint (
"min", 0.0,
false);
4775 gridalpha.add_constraint (
"min", 0.0,
true);
4776 gridalpha.add_constraint (
"max", 1.0,
true);
4777 labelfontsizemultiplier.add_constraint (
"min", 0.0,
false);
4778 linewidth.add_constraint (
"min", 0.0,
false);
4779 minorgridalpha.add_constraint (
"min", 0.0,
true);
4780 minorgridalpha.add_constraint (
"max", 1.0,
true);
4781 titlefontsizemultiplier.add_constraint (
"min", 0.0,
false);
4786 x_zlim.resize (1, 2);
4792 calc_ticklabels (xtick, xticklabel, xscale.is (
"log"),
4793 xaxislocation_is (
"origin"),
4794 yscale.is (
"log") ? 2 : (yaxislocation_is (
"origin") ? 0 :
4795 (yaxislocation_is (
"left") ? -1 : 1)), xlim);
4796 calc_ticklabels (ytick, yticklabel, yscale.is (
"log"),
4797 yaxislocation_is (
"origin"),
4798 xscale.is (
"log") ? 2 : (xaxislocation_is (
"origin") ? 0 :
4799 (xaxislocation_is (
"bottom") ? -1 : 1)), ylim);
4800 calc_ticklabels (ztick, zticklabel, zscale.is (
"log"),
false, 2, zlim);
4802 xset (xlabel.handle_value (),
"handlevisibility",
"off");
4803 xset (ylabel.handle_value (),
"handlevisibility",
"off");
4804 xset (zlabel.handle_value (),
"handlevisibility",
"off");
4805 xset (title.handle_value (),
"handlevisibility",
"off");
4807 xset (xlabel.handle_value (),
"horizontalalignment",
"center");
4808 xset (xlabel.handle_value (),
"horizontalalignmentmode",
"auto");
4809 xset (ylabel.handle_value (),
"horizontalalignment",
"center");
4810 xset (ylabel.handle_value (),
"horizontalalignmentmode",
"auto");
4811 xset (zlabel.handle_value (),
"horizontalalignment",
"right");
4812 xset (zlabel.handle_value (),
"horizontalalignmentmode",
"auto");
4813 xset (title.handle_value (),
"horizontalalignment",
"center");
4814 xset (title.handle_value (),
"horizontalalignmentmode",
"auto");
4816 xset (xlabel.handle_value (),
"verticalalignment",
"top");
4817 xset (xlabel.handle_value (),
"verticalalignmentmode",
"auto");
4818 xset (ylabel.handle_value (),
"verticalalignment",
"bottom");
4819 xset (ylabel.handle_value (),
"verticalalignmentmode",
"auto");
4820 xset (title.handle_value (),
"verticalalignment",
"bottom");
4821 xset (title.handle_value (),
"verticalalignmentmode",
"auto");
4823 xset (ylabel.handle_value (),
"rotation", 90.0);
4824 xset (ylabel.handle_value (),
"rotationmode",
"auto");
4826 xset (zlabel.handle_value (),
"visible",
"off");
4828 xset (xlabel.handle_value (),
"clipping",
"off");
4829 xset (ylabel.handle_value (),
"clipping",
"off");
4830 xset (zlabel.handle_value (),
"clipping",
"off");
4831 xset (title.handle_value (),
"clipping",
"off");
4833 xset (xlabel.handle_value (),
"__autopos_tag__",
"xlabel");
4834 xset (ylabel.handle_value (),
"__autopos_tag__",
"ylabel");
4835 xset (zlabel.handle_value (),
"__autopos_tag__",
"zlabel");
4836 xset (title.handle_value (),
"__autopos_tag__",
"title");
4838 double fs = labelfontsizemultiplier.double_value () *
4839 fontsize.double_value ();
4843 fs = titlefontsizemultiplier.double_value () * fontsize.double_value ();
4845 xset (title.handle_value (),
"fontweight", titlefontweight.get ());
4847 adopt (xlabel.handle_value ());
4848 adopt (ylabel.handle_value ());
4849 adopt (zlabel.handle_value ());
4850 adopt (title.handle_value ());
4853 tlooseinset(2) = 1-tlooseinset(0)-tlooseinset(2);
4854 tlooseinset(3) = 1-tlooseinset(1)-tlooseinset(3);
4855 looseinset = tlooseinset;
4887 Matrix ext = get_extent (
true,
true);
4888 ext(1) = parent_bb(3) - ext(1) - ext(3);
4893 if (ext(0) < pos(0))
4895 pos(2) += pos(0)-ext(0);
4898 if (ext(0)+ext(2) > pos(0)+pos(2))
4899 pos(2) = ext(0)+ext(2)-pos(0);
4901 if (ext(1) < pos(1))
4903 pos(3) += pos(1)-ext(1);
4906 if (ext(1)+ext(3) > pos(1)+pos(3))
4907 pos(3) = ext(1)+ext(3)-pos(1);
4916 if (activepositionproperty.is (
"position"))
4919 update_outerposition ();
4921 set_units (
"normalized");
4922 Matrix pos = position.get ().matrix_value ();
4923 Matrix outpos = outerposition.get ().matrix_value ();
4924 Matrix tightpos = calc_tightbox (pos);
4925 Matrix tinset (1, 4, 1.0);
4926 tinset(0) = pos(0)-tightpos(0);
4927 tinset(1) = pos(1)-tightpos(1);
4928 tinset(2) = tightpos(0)+tightpos(2)-pos(0)-pos(2);
4929 tinset(3) = tightpos(1)+tightpos(3)-pos(1)-pos(3);
4930 tightinset = tinset;
4931 set_units (old_units);
4932 update_transform ();
4933 if (activepositionproperty.is (
"position"))
4936 update_outerposition ();
5016 if (go.
isa (
"text"))
5017 val = ::
reparent (v,
"set", who, __myhandle__,
false);
5022 error (
"set: expecting text graphics object or character string for %s property, found %s",
5023 who.c_str (), cname.c_str ());
5026 xset (
val,
"handlevisibility",
"off");
5034 adopt (hp.handle_value ());
5040 set_text_child (xlabel,
"xlabel", v);
5041 xset (xlabel.handle_value (),
"positionmode",
"auto");
5042 xset (xlabel.handle_value (),
"rotationmode",
"auto");
5043 xset (xlabel.handle_value (),
"horizontalalignmentmode",
"auto");
5044 xset (xlabel.handle_value (),
"verticalalignmentmode",
"auto");
5045 xset (xlabel.handle_value (),
"clipping",
"off");
5046 xset (xlabel.handle_value (),
"color", get_xcolor ());
5047 xset (xlabel.handle_value (),
"__autopos_tag__",
"xlabel");
5048 update_xlabel_position ();
5054 set_text_child (ylabel,
"ylabel", v);
5055 xset (ylabel.handle_value (),
"positionmode",
"auto");
5056 xset (ylabel.handle_value (),
"rotationmode",
"auto");
5057 xset (ylabel.handle_value (),
"horizontalalignmentmode",
"auto");
5058 xset (ylabel.handle_value (),
"verticalalignmentmode",
"auto");
5059 xset (ylabel.handle_value (),
"clipping",
"off");
5060 xset (ylabel.handle_value (),
"color", get_ycolor ());
5061 xset (ylabel.handle_value (),
"__autopos_tag__",
"ylabel");
5062 update_ylabel_position ();
5068 set_text_child (zlabel,
"zlabel", v);
5069 xset (zlabel.handle_value (),
"positionmode",
"auto");
5070 xset (zlabel.handle_value (),
"rotationmode",
"auto");
5071 xset (zlabel.handle_value (),
"horizontalalignmentmode",
"auto");
5072 xset (zlabel.handle_value (),
"verticalalignmentmode",
"auto");
5073 xset (zlabel.handle_value (),
"clipping",
"off");
5074 xset (zlabel.handle_value (),
"color", get_zcolor ());
5075 xset (zlabel.handle_value (),
"__autopos_tag__",
"zlabel");
5076 update_zlabel_position ();
5082 set_text_child (title,
"title", v);
5083 xset (title.handle_value (),
"positionmode",
"auto");
5084 xset (title.handle_value (),
"horizontalalignment",
"center");
5085 xset (title.handle_value (),
"horizontalalignmentmode",
"auto");
5086 xset (title.handle_value (),
"verticalalignment",
"bottom");
5087 xset (title.handle_value (),
"verticalalignmentmode",
"auto");
5088 xset (title.handle_value (),
"clipping",
"off");
5089 xset (title.handle_value (),
"__autopos_tag__",
"title");
5090 update_title_position ();
5104 assert (
mode ==
"reset");
5119 ambientlightcolor =
Matrix (1, 3, 1.0);
5125 camerapositionmode =
"auto";
5126 cameratargetmode =
"auto";
5127 cameraupvectormode =
"auto";
5128 cameraviewanglemode =
"auto";
5134 clippingstyle =
"3dbox";
5138 colororderindex = 1.0;
5141 dataaspectratiomode =
"auto";
5143 drawmode =
"normal";
5145 fontangle =
"normal";
5148 fontunits =
"points";
5149 fontsmoothing =
"on";
5150 fontweight =
"normal";
5153 gridalphamode =
"auto";
5155 gridcolormode =
"auto";
5156 gridlinestyle =
"-";
5158 labelfontsizemultiplier = 1.1;
5162 linestyleorder =
"-";
5163 linestyleorderindex = 1.0;
5167 minorgridalpha = 0.25;
5168 minorgridalphamode =
"auto";
5170 minorgridcolormode =
"auto";
5171 minorgridlinestyle =
":";
5173 nextplot =
"replace";
5176 plotboxaspectratiomode =
"auto";
5177 projection =
"orthographic";
5179 sortmethod =
"depth";
5182 tickdirmode =
"auto";
5183 ticklabelinterpreter =
"tex";
5186 tightinset =
Matrix (1, 4, 0.0);
5188 titlefontsizemultiplier = 1.1;
5189 titlefontweight =
"bold";
5191 Matrix tview (1, 2, 0.0);
5195 xaxislocation =
"bottom";
5198 xcolormode =
"auto";
5206 xticklabelmode =
"auto";
5207 xticklabelrotation = 0.0;
5210 yaxislocation =
"left";
5213 ycolormode =
"auto";
5221 yticklabelmode =
"auto";
5222 yticklabelrotation = 0.0;
5226 zcolormode =
"auto";
5234 zticklabelmode =
"auto";
5235 zticklabelrotation = 0.0;
5253 xset (xlabel.handle_value (),
"handlevisibility",
"off");
5254 xset (ylabel.handle_value (),
"handlevisibility",
"off");
5255 xset (zlabel.handle_value (),
"handlevisibility",
"off");
5256 xset (title.handle_value (),
"handlevisibility",
"off");
5258 xset (xlabel.handle_value (),
"horizontalalignment",
"center");
5259 xset (xlabel.handle_value (),
"horizontalalignmentmode",
"auto");
5260 xset (ylabel.handle_value (),
"horizontalalignment",
"center");
5261 xset (ylabel.handle_value (),
"horizontalalignmentmode",
"auto");
5262 xset (zlabel.handle_value (),
"horizontalalignment",
"right");
5263 xset (zlabel.handle_value (),
"horizontalalignmentmode",
"auto");
5264 xset (title.handle_value (),
"horizontalalignment",
"center");
5265 xset (title.handle_value (),
"horizontalalignmentmode",
"auto");
5267 xset (xlabel.handle_value (),
"verticalalignment",
"top");
5268 xset (xlabel.handle_value (),
"verticalalignmentmode",
"auto");
5269 xset (ylabel.handle_value (),
"verticalalignment",
"bottom");
5270 xset (ylabel.handle_value (),
"verticalalignmentmode",
"auto");
5271 xset (title.handle_value (),
"verticalalignment",
"bottom");
5272 xset (title.handle_value (),
"verticalalignmentmode",
"auto");
5274 xset (ylabel.handle_value (),
"rotation", 90.0);
5275 xset (ylabel.handle_value (),
"rotationmode",
"auto");
5277 xset (zlabel.handle_value (),
"visible",
"off");
5279 xset (xlabel.handle_value (),
"clipping",
"off");
5280 xset (ylabel.handle_value (),
"clipping",
"off");
5281 xset (zlabel.handle_value (),
"clipping",
"off");
5282 xset (title.handle_value (),
"clipping",
"off");
5284 xset (xlabel.handle_value (),
"__autopos_tag__",
"xlabel");
5285 xset (ylabel.handle_value (),
"__autopos_tag__",
"ylabel");
5286 xset (zlabel.handle_value (),
"__autopos_tag__",
"zlabel");
5287 xset (title.handle_value (),
"__autopos_tag__",
"title");
5290 fs = labelfontsizemultiplier.double_value () * fontsize.double_value ();
5294 fs = titlefontsizemultiplier.double_value () * fontsize.double_value ();
5296 xset (title.handle_value (),
"fontweight", titlefontweight.get ());
5298 update_transform ();
5306 if (__colormap__.get ().isempty ())
5312 return figure_props.get_colormap ();
5315 return get___colormap__ ();
5338 if (! is_beingdeleted ())
5352 if (xlabel.handle_value ().ok () &&
h == xlabel.handle_value ())
5354 delete_text_child (xlabel);
5355 update_xlabel_position ();
5357 else if (ylabel.handle_value ().ok () &&
h == ylabel.handle_value ())
5359 delete_text_child (ylabel);
5360 update_ylabel_position ();
5362 else if (zlabel.handle_value ().ok () &&
h == zlabel.handle_value ())
5364 delete_text_child (zlabel);
5365 update_zlabel_position ();
5367 else if (title.handle_value ().ok () &&
h == title.handle_value ())
5369 delete_text_child (title);
5370 update_title_position ();
5381 for (
int i = 0;
i < 4;
i++)
5478 double fact = 1.0 / sqrt (v(0)*v(0)+v(1)*v(1)+v(2)*v(2));
5479 scale (v, fact, fact, fact);
5485 return (v1(0)*
v2(0)+v1(1)*
v2(1)+v1(2)*
v2(2));
5491 return sqrt (
dot (v, v));
5499 r(0) = v1(1)*
v2(2) - v1(2)*
v2(1);
5500 r(1) = v1(2)*
v2(0) - v1(0)*
v2(2);
5501 r(2) = v1(0)*
v2(1) - v1(1)*
v2(0);
5509 static double data[32] =
5546 double xd = (xdir_is (
"normal") ? 1 : -1);
5547 double yd = (ydir_is (
"normal") ? 1 : -1);
5548 double zd = (zdir_is (
"normal") ? 1 : -1);
5550 Matrix xlimits = sx.scale (get_xlim ().matrix_value ());
5551 Matrix ylimits = sy.scale (get_ylim ().matrix_value ());
5552 Matrix zlimits =
sz.scale (get_zlim ().matrix_value ());
5554 double xo = xlimits(xd > 0 ? 0 : 1);
5555 double yo = ylimits(yd > 0 ? 0 : 1);
5556 double zo = zlimits(zd > 0 ? 0 : 1);
5558 Matrix pb = get_plotboxaspectratio ().matrix_value ();
5560 bool autocam = (camerapositionmode_is (
"auto")
5561 && cameratargetmode_is (
"auto")
5562 && cameraupvectormode_is (
"auto")
5563 && cameraviewanglemode_is (
"auto"));
5564 bool dowarp = (autocam && dataaspectratiomode_is (
"auto")
5565 && plotboxaspectratiomode_is (
"auto"));
5571 if (cameratargetmode_is (
"auto"))
5573 c_center(0) = (xlimits(0) + xlimits(1)) / 2;
5574 c_center(1) = (ylimits(0) + ylimits(1)) / 2;
5575 c_center(2) = (zlimits(0) + zlimits(1)) / 2;
5580 c_center =
cam2xform (get_cameratarget ().matrix_value ());
5582 if (camerapositionmode_is (
"auto"))
5584 Matrix tview = get_view ().matrix_value ();
5585 double az = tview(0);
5586 double el = tview(1);
5587 double d = 5 * sqrt (pb(0)*pb(0) + pb(1)*pb(1) + pb(2)*pb(2));
5589 if (el == 90 || el == -90)
5595 c_eye(0) =
d * cos (el) * sin (az);
5596 c_eye(1) = -
d* cos (el) * cos (az);
5597 c_eye(2) =
d * sin (el);
5599 c_eye(0) = c_eye(0)*(xlimits(1)-xlimits(0))/(xd*pb(0))+c_center(0);
5600 c_eye(1) = c_eye(1)*(ylimits(1)-ylimits(0))/(yd*pb(1))+c_center(1);
5601 c_eye(2) = c_eye(2)*(zlimits(1)-zlimits(0))/(zd*pb(2))+c_center(2);
5606 c_eye =
cam2xform (get_cameraposition ().matrix_value ());
5608 if (cameraupvectormode_is (
"auto"))
5610 Matrix tview = get_view ().matrix_value ();
5611 double az = tview(0);
5612 double el = tview(1);
5614 if (el == 90 || el == -90)
5617 * sin (az*M_PI/180.0)*(xlimits(1)-xlimits(0))/pb(0);
5619 * cos (az*M_PI/180.0)*(ylimits(1)-ylimits(0))/pb(1);
5627 c_upv =
cam2xform (get_cameraupvector ().matrix_value ());
5638 scale (x_pre, pb(0), pb(1), pb(2));
5640 scale (x_pre, xd/(xlimits(1)-xlimits(0)), yd/(ylimits(1)-ylimits(0)),
5641 zd/(zlimits(1)-zlimits(0)));
5644 xform (c_eye, x_pre);
5645 xform (c_center, x_pre);
5646 scale (c_upv, pb(0)/(xlimits(1)-xlimits(0)), pb(1)/(ylimits(1)-ylimits(0)),
5647 pb(2)/(zlimits(1)-zlimits(0)));
5648 translate (c_center, -c_eye(0), -c_eye(1), -c_eye(2));
5656 double fa = 1 / sqrt (1 -
f(2)*
f(2));
5657 scale (UP, fa, fa, fa);
5663 scale (x_view, 1, 1, -1);
5665 l(0,0) =
s(0); l(0,1) =
s(1); l(0,2) =
s(2);
5666 l(1,0) =
u(0); l(1,1) =
u(1); l(1,2) =
u(2);
5667 l(2,0) = -
f(0); l(2,1) = -
f(1); l(2,2) = -
f(2);
5668 x_view = x_view * l;
5669 translate (x_view, -c_eye(0), -c_eye(1), -c_eye(2));
5670 scale (x_view, pb(0), pb(1), pb(2));
5676 double xM = cmax(0) - cmin(0);
5677 double yM = cmax(1) - cmin(1);
5679 Matrix bb = get_boundingbox (
true);
5683 if (cameraviewanglemode_is (
"auto"))
5690 if (
false && dowarp)
5691 af = (1.0 / (xM > yM ? xM : yM));
5694 if ((bb(2)/bb(3)) > (xM/yM))
5699 v_angle = 2 * (180.0 / M_PI) *
atan (1 / (2 * af *
norm (
F)));
5701 cameraviewangle = v_angle;
5704 v_angle = get_cameraviewangle ();
5706 double pf = 1 / (2 * tan ((v_angle / 2) * M_PI / 180.0) *
norm (
F));
5707 scale (x_projection, pf, pf, 1);
5713 translate (x_viewport, bb(0)+bb(2)/2, bb(1)+bb(3)/2, 0);
5714 scale (x_viewport, bb(2)/xM, -bb(3)/yM, 1);
5721 if ((bb(2)/bb(3)) > (xM/yM))
5727 pix = (bb(2) < bb(3) ? bb(2) : bb(3));
5728 translate (x_viewport, bb(0)+bb(2)/2, bb(1)+bb(3)/2, 0);
5729 scale (x_viewport, pix, -pix, 1);
5732 x_normrender = x_viewport * x_projection * x_view;
5738 x_zlim(0) = cmin(2);
5739 x_zlim(1) = cmax(2);
5741 x_render = x_normrender;
5742 scale (x_render, xd/(xlimits(1)-xlimits(0)), yd/(ylimits(1)-ylimits(0)),
5743 zd/(zlimits(1)-zlimits(0)));
5746 x_render_inv = x_render.inverse ();
5751 scale (x_gl_mat1, xd/(xlimits(1)-xlimits(0)), yd/(ylimits(1)-ylimits(0)),
5752 zd/(zlimits(1)-zlimits(0)));
5754 x_gl_mat2 = x_viewport * x_projection;
5767 double xd = (xdir_is (
"normal") ? 1 : -1);
5768 double yd = (ydir_is (
"normal") ? 1 : -1);
5769 double zd = (zdir_is (
"normal") ? 1 : -1);
5771 const Matrix xlims =
xform.xscale (get_xlim ().matrix_value ());
5772 const Matrix ylims =
xform.yscale (get_ylim ().matrix_value ());
5773 const Matrix zlims =
xform.zscale (get_zlim ().matrix_value ());
5775 double x_min, x_max, y_min, y_max, z_min, z_max;
5776 x_min = xlims(0), x_max = xlims(1);
5777 y_min = ylims(0), y_max = ylims(1);
5778 z_min = zlims(0), z_max = zlims(1);
5784 p1 =
xform.transform (x_min, (y_min+y_max)/2, (z_min+z_max)/2,
false);
5785 p2 =
xform.transform (x_max, (y_min+y_max)/2, (z_min+z_max)/2,
false);
5788 dir(2) = (p2(2) - p1(2));
5789 if (dir(0) == 0 && dir(1) == 0)
5791 else if (dir(2) == 0)
5795 else if (dir(1) == 0)
5802 xPlane = (dir(0) > 0 ? x_max : x_min);
5804 xPlane = (dir(1) < 0 ? x_max : x_min);
5807 xPlane = (dir(2) < 0 ? x_min : x_max);
5809 xPlaneN = (xPlane == x_min ? x_max : x_min);
5810 fx = (x_max - x_min) / sqrt (dir(0)*dir(0) + dir(1)*dir(1));
5812 p1 =
xform.transform ((x_min + x_max)/2, y_min, (z_min + z_max)/2,
false);
5813 p2 =
xform.transform ((x_min + x_max)/2, y_max, (z_min + z_max)/2,
false);
5816 dir(2) = (p2(2) - p1(2));
5817 if (dir(0) == 0 && dir(1) == 0)
5819 else if (dir(2) == 0)
5823 else if (dir(1) == 0)
5830 yPlane = (dir(0) > 0 ? y_max : y_min);
5832 yPlane = (dir(1) < 0 ? y_max : y_min);
5835 yPlane = (dir(2) < 0 ? y_min : y_max);
5837 yPlaneN = (yPlane == y_min ? y_max : y_min);
5838 fy = (y_max - y_min) / sqrt (dir(0)*dir(0) + dir(1)*dir(1));
5840 p1 =
xform.transform ((x_min + x_max)/2, (y_min + y_max)/2, z_min,
false);
5841 p2 =
xform.transform ((x_min + x_max)/2, (y_min + y_max)/2, z_max,
false);
5844 dir(2) = (p2(2) - p1(2));
5845 if (dir(0) == 0 && dir(1) == 0)
5847 else if (dir(2) == 0)
5851 else if (dir(1) == 0)
5858 zPlane = (dir(0) > 0 ? z_min : z_max);
5860 zPlane = (dir(1) < 0 ? z_min : z_max);
5863 zPlane = (dir(2) < 0 ? z_min : z_max);
5865 zPlaneN = (zPlane == z_min ? z_max : z_min);
5866 fz = (z_max - z_min) / sqrt (dir(0)*dir(0) + dir(1)*dir(1));
5872 xySym = (xd*yd*(xPlane-xPlaneN)*(yPlane-yPlaneN) > 0);
5873 zSign = (zd*(zPlane-zPlaneN) <= 0);
5874 xyzSym = (zSign ? xySym : ! xySym);
5875 xpTick = (zSign ? xPlaneN : xPlane);
5876 ypTick = (zSign ? yPlaneN : yPlane);
5877 zpTick = (zSign ? zPlane : zPlaneN);
5878 xpTickN = (zSign ? xPlane : xPlaneN);
5879 ypTickN = (zSign ? yPlane : yPlaneN);
5880 zpTickN = (zSign ? zPlaneN : zPlane);
5888 Matrix ylimits = get_ylim ().matrix_value ();
5889 if (xaxislocation_is (
"top") ||
5890 (yscale_is (
"log") && xaxislocation_is (
"origin")
5891 && (ylimits(1) < 0.)))
5898 Matrix xlimits = get_xlim ().matrix_value ();
5899 if (yaxislocation_is (
"right") ||
5900 (xscale_is (
"log") && yaxislocation_is (
"origin")
5901 && (xlimits(1) < 0.)))
5908 if (layer_is (
"top"))
5917 Matrix viewmat = get_view ().matrix_value ();
5918 nearhoriz =
std::abs (viewmat(1)) <= 5;
5919 is2D = viewmat(1) == 90;
5921 update_ticklength ();
5931 if (tickdirmode_is (
"auto"))
5932 tickdir.set (mode2d ?
"in" :
"out",
true);
5934 double ticksign = (tickdir_is (
"in") ? -1 : 1);
5936 Matrix bbox = get_boundingbox (
true);
5937 Matrix ticklen = get_ticklength ().matrix_value ();
5938 ticklen(0) *=
std::max (bbox(2), bbox(3));
5939 ticklen(1) *=
std::max (bbox(2), bbox(3));
5941 xticklen = ticksign * (mode2d ? ticklen(0) : ticklen(1));
5942 yticklen = ticksign * (mode2d ? ticklen(0) : ticklen(1));
5943 zticklen = ticksign * (mode2d ? ticklen(0) : ticklen(1));
5945 xtickoffset = (mode2d ?
std::max (0., xticklen) :
std::abs (xticklen)) + 5;
5946 ytickoffset = (mode2d ?
std::max (0., yticklen) :
std::abs (yticklen)) + 5;
5947 ztickoffset = (mode2d ?
std::max (0., zticklen) :
std::abs (zticklen)) + 5;
5949 update_xlabel_position ();
5950 update_ylabel_position ();
5951 update_zlabel_position ();
5952 update_title_position ();
5983 if (to_units !=
"data")
5989 retval(0) = v(0) - bbox(0) + 1;
5990 retval(1) = bbox(1) + bbox(3) - v(1) + 1;
6018 bool isempty = xlabel_props.get_string ().isempty ();
6026 if (xlabel_props.horizontalalignmentmode_is (
"auto"))
6028 xlabel_props.set_horizontalalignment
6029 (xstate >
AXE_DEPTH_DIR ?
"center" : (xyzSym ?
"left" :
"right"));
6031 xlabel_props.set_horizontalalignmentmode (
"auto");
6034 if (xlabel_props.verticalalignmentmode_is (
"auto"))
6036 xlabel_props.set_verticalalignment
6039 xlabel_props.set_verticalalignmentmode (
"auto");
6043 if (xlabel_props.positionmode_is (
"auto")
6044 || xlabel_props.rotationmode_is (
"auto"))
6049 ext = get_ticklabel_extents (get_xtick ().matrix_value (),
6050 get_xticklabel ().string_vector_value (),
6051 get_xlim ().matrix_value ());
6053 double wmax = ext(0);
6054 double hmax = ext(1);
6065 p =
xform.transform (
p(0),
p(1),
p(2),
false);
6070 p(0) += (xyzSym ? wmax : -wmax);
6080 p(1) += (x2Dtop ? -hmax : hmax);
6084 if (xlabel_props.positionmode_is (
"auto"))
6086 p =
xform.untransform (
p(0),
p(1),
p(2),
true);
6089 get_extent (
false));
6091 xlabel_props.
set_position (
p.extract_n (0, 3).transpose ());
6092 xlabel_props.set_positionmode (
"auto");
6095 if (! isempty && xlabel_props.rotationmode_is (
"auto"))
6097 xlabel_props.set_rotation (angle);
6098 xlabel_props.set_rotationmode (
"auto");
6119 bool isempty = ylabel_props.get_string ().isempty ();
6127 if (ylabel_props.horizontalalignmentmode_is (
"auto"))
6129 ylabel_props.set_horizontalalignment
6130 (ystate >
AXE_DEPTH_DIR ?
"center" : (! xyzSym ?
"left" :
"right"));
6132 ylabel_props.set_horizontalalignmentmode (
"auto");
6135 if (ylabel_props.verticalalignmentmode_is (
"auto"))
6137 ylabel_props.set_verticalalignment
6138 (ystate ==
AXE_VERT_DIR && ! y2Dright ?
"bottom" :
"top");
6140 ylabel_props.set_verticalalignmentmode (
"auto");
6144 if (ylabel_props.positionmode_is (
"auto")
6145 || ylabel_props.rotationmode_is (
"auto"))
6159 ext = get_ticklabel_extents (get_ytick ().matrix_value (),
6160 get_yticklabel ().string_vector_value (),
6161 get_ylim ().matrix_value ());
6163 double wmax = ext(0)+4;
6164 double hmax = ext(1);
6175 p =
xform.transform (
p(0),
p(1),
p(2),
false);
6180 p(0) += (! xyzSym ? wmax : -wmax);
6185 p(0) += (y2Dright ? wmax : -wmax);
6194 if (ylabel_props.positionmode_is (
"auto"))
6196 p =
xform.untransform (
p(0),
p(1),
p(2),
true);
6199 get_extent (
false));
6201 ylabel_props.
set_position (
p.extract_n (0, 3).transpose ());
6202 ylabel_props.set_positionmode (
"auto");
6205 if (! isempty && ylabel_props.rotationmode_is (
"auto"))
6207 ylabel_props.set_rotation (angle);
6208 ylabel_props.set_rotationmode (
"auto");
6229 bool camAuto = cameraupvectormode_is (
"auto");
6230 bool isempty = zlabel_props.get_string ().isempty ();
6238 if (zlabel_props.horizontalalignmentmode_is (
"auto"))
6240 zlabel_props.set_horizontalalignment
6243 zlabel_props.set_horizontalalignmentmode (
"auto");
6246 if (zlabel_props.verticalalignmentmode_is (
"auto"))
6248 zlabel_props.set_verticalalignment
6250 ?
"bottom" : ((zSign || camAuto) ?
"bottom" :
"top"));
6252 zlabel_props.set_verticalalignmentmode (
"auto");
6256 if (zlabel_props.positionmode_is (
"auto")
6257 || zlabel_props.rotationmode_is (
"auto"))
6262 ext = get_ticklabel_extents (get_ztick ().matrix_value (),
6263 get_zticklabel ().string_vector_value (),
6264 get_zlim ().matrix_value ());
6266 double wmax = ext(0);
6267 double hmax = ext(1);
6274 (zpTickN + zpTick)/2);
6283 (zpTickN + zpTick)/2);
6290 p =
xform.transform (
p(0),
p(1),
p(2),
false);
6318 if (zlabel_props.positionmode_is (
"auto"))
6320 p =
xform.untransform (
p(0),
p(1),
p(2),
true);
6323 get_extent (
false));
6325 zlabel_props.
set_position (
p.extract_n (0, 3).transpose ());
6326 zlabel_props.set_positionmode (
"auto");
6329 if (! isempty && zlabel_props.rotationmode_is (
"auto"))
6331 zlabel_props.set_rotation (angle);
6332 zlabel_props.set_rotationmode (
"auto");
6357 if (title_props.positionmode_is (
"auto"))
6362 Matrix bbox = get_extent (
false);
6367 (x_zlim(0) + x_zlim(1))/2);
6372 ext = get_ticklabel_extents (get_xtick ().matrix_value (),
6373 get_xticklabel ().string_vector_value (),
6374 get_xlim ().matrix_value ());
6378 p =
xform.untransform (
p(0),
p(1),
p(2),
true);
6383 title_props.set_positionmode (
"auto");
6390 if (elem_type ==
"xlabel")
6391 update_xlabel_position ();
6392 else if (elem_type ==
"ylabel")
6393 update_ylabel_position ();
6394 else if (elem_type ==
"zlabel")
6395 update_zlabel_position ();
6396 else if (elem_type ==
"title")
6397 update_title_position ();
6398 else if (elem_type ==
"sync")
6404 double xlength,
double ylength,
double zlength)
6406 double xval = xlength / scalefactors(0);
6407 double yval = ylength / scalefactors(1);
6408 double zval = zlength / scalefactors(2);
6412 aspectratios(0) = xval / minval;
6413 aspectratios(1) = yval / minval;
6414 aspectratios(2) = zval / minval;
6419 double pbfactor,
double dafactor,
char limit_type,
bool tight)
6448 Matrix xlimits = get_xlim ().matrix_value ();
6449 Matrix ylimits = get_ylim ().matrix_value ();
6450 Matrix zlimits = get_zlim ().matrix_value ();
6452 double dx = (xlimits(1) - xlimits(0));
6453 double dy = (ylimits(1) - ylimits(0));
6454 double dz = (zlimits(1) - zlimits(0));
6456 Matrix da = get_dataaspectratio ().matrix_value ();
6457 Matrix pba = get_plotboxaspectratio ().matrix_value ();
6459 if (dataaspectratiomode_is (
"auto"))
6461 if (plotboxaspectratiomode_is (
"auto"))
6463 pba =
Matrix (1, 3, 1.0);
6464 plotboxaspectratio.set (pba,
false);
6468 dataaspectratio.set (da,
false);
6470 else if (plotboxaspectratiomode_is (
"auto"))
6473 plotboxaspectratio.set (pba,
false);
6478 bool modified_limits =
false;
6481 if (xlimmode_is (
"auto") && ylimmode_is (
"auto") && zlimmode_is (
"auto"))
6483 modified_limits =
true;
6484 kids = get_children ();
6489 else if (xlimmode_is (
"auto") && ylimmode_is (
"auto"))
6491 modified_limits =
true;
6494 else if (ylimmode_is (
"auto") && zlimmode_is (
"auto"))
6496 modified_limits =
true;
6499 else if (zlimmode_is (
"auto") && xlimmode_is (
"auto"))
6501 modified_limits =
true;
6505 if (modified_limits)
6512 dx = pba(0) * da(0);
6513 dy = pba(1) * da(1);
6514 dz = pba(2) * da(2);
6518 if (xlimmode_is (
"auto"))
6521 xlimits(0) = 0.5 * (xlimits(0) + xlimits(1) - dx);
6522 xlimits(1) = xlimits(0) + dx;
6524 set_xlimmode (
"auto");
6527 if (ylimmode_is (
"auto"))
6530 ylimits(0) = 0.5 * (ylimits(0) + ylimits(1) - dy);
6531 ylimits(1) = ylimits(0) + dy;
6533 set_ylimmode (
"auto");
6536 if (zlimmode_is (
"auto"))
6539 zlimits(0) = 0.5 * (zlimits(0) + zlimits(1) - dz);
6540 zlimits(1) = zlimits(0) + dz;
6542 set_zlimmode (
"auto");
6548 plotboxaspectratio.set (pba,
false);
6563 if (! prop.empty ())
6567 if (prop ==
"fontsize")
6570 get_titlefontsizemultiplier ());
6572 get_labelfontsizemultiplier ());
6574 else if (prop ==
"fontweight")
6575 tval =
get (
"titlefontweight");
6585 txt_renderer.set_font (
get (
"fontname").string_value (),
6586 get (
"fontweight").string_value (),
6587 get (
"fontangle").string_value (),
6588 get (
"__fontsize_points__").double_value ());
6595 const Matrix& parent_pix_size)
const 6597 Matrix pos = (
internal ? get_position ().matrix_value ()
6598 : get_outerposition ().matrix_value ());
6599 Matrix parent_size (parent_pix_size);
6616 pos(1) = parent_size(1) - pos(1) - pos(3);
6629 for (
int i = 0;
i <= 1;
i++)
6630 for (
int j = 0; j <= 1; j++)
6631 for (
int k = 0;
k <= 1;
k++)
6634 j ? yPlaneN : yPlane,
6635 k ? zPlaneN : zPlane,
false);
6644 for (
int i = 0;
i < 4;
i++)
6648 htext = get_title ();
6650 htext = get_xlabel ();
6652 htext = get_ylabel ();
6654 htext = get_zlabel ();
6660 Matrix text_pos = text_props.get_data_position ();
6661 text_pos =
xform.transform (text_pos(0), text_pos(1), text_pos(2));
6662 if (text_props.get_string ().isempty ())
6664 ext(0) =
std::min (ext(0), text_pos(0));
6665 ext(1) =
std::min (ext(1), text_pos(1));
6666 ext(2) =
std::max (ext(2), text_pos(0));
6667 ext(3) =
std::max (ext(3), text_pos(1));
6671 Matrix text_ext = text_props.get_extent_matrix ();
6673 bool ignore_horizontal =
false;
6674 bool ignore_vertical =
false;
6675 if (only_text_height)
6677 double text_rotation = text_props.get_rotation ();
6678 if (text_rotation == 0. || text_rotation == 180.)
6679 ignore_horizontal =
true;
6680 else if (text_rotation == 90. || text_rotation == 270.)
6681 ignore_vertical =
true;
6684 if (! ignore_horizontal)
6686 ext(0) =
std::min (ext(0), text_pos(0)+text_ext(0));
6688 text_pos(0)+text_ext(0)+text_ext(2));
6691 if (! ignore_vertical)
6694 text_pos(1)-text_ext(1)-text_ext(3));
6695 ext(3) =
std::max (ext(3), text_pos(1)-text_ext(1));
6701 ext(2) = ext(2) - ext(0);
6702 ext(3) = ext(3) - ext(1);
6712 if (
val.iscellstr ())
6715 if (
val.columns () > 1)
6721 if (
val.isnumeric ())
6724 std::ostringstream oss;
6733 else if (
val.is_string () &&
val.rows () == 1)
6736 std::istringstream iss (valstr);
6740 while (std::getline (iss, tmpstr,
'|'))
6744 if (*valstr.rbegin () ==
'|')
6763 set_xticklabelmode (
"manual");
6764 xticklabel.run_listeners (
POSTSET);
6768 set_xticklabelmode (
"manual");
6778 set_yticklabelmode (
"manual");
6779 yticklabel.run_listeners (
POSTSET);
6783 set_yticklabelmode (
"manual");
6793 set_zticklabelmode (
"manual");
6794 zticklabel.run_listeners (
POSTSET);
6798 set_zticklabelmode (
"manual");
6810 if (
val.iscellstr ())
6813 if (
val.columns () > 1)
6819 if (
val.is_string () &&
val.rows () == 1)
6822 std::istringstream iss (valstr);
6826 while (std::getline (iss, tmpstr,
'|'))
6830 if (*valstr.rbegin () ==
'|')
6855 if (units.set (
val,
true))
6857 update_units (old_units);
6870 old_units, new_units,
6874 old_units, new_units,
6878 old_units, new_units,
6882 old_units, new_units,
6892 if (fontunits.set (
val,
true))
6894 update_fontunits (old_fontunits);
6903 double parent_height = get_boundingbox (
true).elem (3);
6904 double fontsz = get_fontsize ();
6914 double fontsz = get_fontsize ();
6915 double parent_height = box_pix_height;
6917 if (fontunits_is (
"normalized") && parent_height <= 0)
6918 parent_height = get_boundingbox (
true).elem (3);
6950 bool use_scale)
const 6956 v(0) = sx.unscale (v(0));
6957 v(1) = sy.unscale (v(1));
6958 v(2) =
sz.unscale (v(2));
7005 double& min_pos,
double& max_neg,
7012 if (m.
numel () == 4)
7072 static const double sqrt_2 = sqrt (2.0);
7073 static const double sqrt_10 = sqrt (10.0);
7074 static const double sqrt_50 = sqrt (50.0);
7078 else if (
a < sqrt_10)
7080 else if (
a < sqrt_50)
7093 double min_pos,
double max_neg,
7094 const bool logscale)
7098 double min_val =
xmin;
7099 double max_val =
xmax;
7124 "axis: omitting non-positive data in log plot");
7127 else if (max_val == 0)
7132 < sqrt (std::numeric_limits<double>::epsilon ()))
7161 if (min_val == 0 && max_val == 0)
7167 else if (
std::abs (min_val - max_val)
7168 < sqrt (std::numeric_limits<double>::epsilon ()))
7170 min_val -= 0.1 *
std::abs (min_val);
7171 max_val += 0.1 *
std::abs (max_val);
7174 double tick_sep = calc_tick_sep (min_val, max_val);
7175 double min_tick =
std::floor (min_val / tick_sep);
7176 double max_tick =
std::ceil (max_val / tick_sep);
7178 min_val =
std::min (min_val, tick_sep * min_tick);
7179 max_val =
std::max (max_val, tick_sep * max_tick);
7193 const bool logscale,
char &update_type)
7199 double eps = std::numeric_limits<double>::epsilon ();
7200 bool do_update =
false;
7201 bool have_children_limits =
false;
7209 have_children_limits =
true;
7213 limits(0) = min_val;
7218 limits(1) = max_val;
7221 if (limits(0) == 0 && limits(1) == 0)
7227 else if (
std::abs (limits(0) - limits(1)) < sqrt (
eps))
7231 limits(0) = (limits(0) < 0 ? 10.0 * limits(0) : 0.1 * limits(0));
7232 limits(1) = (limits(1) < 0 ? 0.1 * limits(1) : 10.0 * limits(1));
7236 limits(0) -= 0.1 *
std::abs (limits(0));
7237 limits(1) += 0.1 *
std::abs (limits(1));
7242 if (logscale && limits(0)*limits(1) <= 0)
7244 if (! have_children_limits)
7251 "Non-positive limit for logarithmic axis ignored\n");
7253 limits(0) = min_pos;
7255 limits(0) = 0.1 * limits(1);
7260 "Non-negative limit for logarithmic axis ignored\n");
7262 limits(1) = max_neg;
7264 limits(1) = 0.1 * limits(0);
7267 if (
std::abs (limits(0) - limits(1)) < sqrt (
eps))
7393 bool limmode_is_auto,
7394 bool tickmode_is_auto,
7404 bool is_negative = lo < 0 && hi < 0;
7415 hi = std::log10 (-lo);
7416 lo = std::log10 (-
tmp);
7420 hi = std::log10 (hi);
7421 lo = std::log10 (lo);
7426 if (tickmode_is_auto)
7438 tick_sep = calc_tick_sep (lo, hi);
7443 if (limmode_is_auto)
7447 tmp_lims(0) =
std::min (tick_sep * i1, lo);
7448 tmp_lims(1) =
std::max (tick_sep * i2, hi);
7452 tmp_lims(0) =
std::pow (10., tmp_lims(0));
7453 tmp_lims(1) =
std::pow (10., tmp_lims(1));
7454 if (tmp_lims(0) <= 0)
7458 double tmp = tmp_lims(0);
7459 tmp_lims(0) = -tmp_lims(1);
7468 if (i1*tick_sep < lo)
7470 if (i2*tick_sep > hi && i2 > i1)
7474 tmp_ticks =
Matrix (1, i2-i1+1);
7475 for (
int i = 0; i <= static_cast<int> (i2-i1);
i++)
7477 tmp_ticks(
i) = tick_sep * (
i+i1);
7481 if (is_logscale && is_negative)
7483 Matrix rev_ticks (1, i2-i1+1);
7484 rev_ticks = -tmp_ticks;
7485 for (
int i = 0; i <= static_cast<int> (i2-i1);
i++)
7486 tmp_ticks(
i) = rev_ticks(i2-i1-
i);
7499 int n = (is_logscale ? 8 : 4);
7500 double mult_below = (is_logscale ? tmp_ticks(1) / tmp_ticks(0) : 1);
7501 double mult_above = (is_logscale ? tmp_ticks(n_ticks-1) / tmp_ticks(n_ticks-2)
7504 double d_below = (tmp_ticks(1) - tmp_ticks(0)) / mult_below / (n+1);
7505 int n_below =
static_cast<int> (
std::floor ((tmp_ticks(0)-lo_lim) / d_below));
7508 int n_between = n * (n_ticks - 1);
7509 double d_above = (tmp_ticks(n_ticks-1) - tmp_ticks(n_ticks-2)) * mult_above
7511 int n_above =
static_cast<int> (
std::floor ((hi_lim-tmp_ticks(n_ticks-1))
7516 Matrix tmp_mticks (1, n_below + n_between + n_above);
7517 for (
int i = 0;
i < n_below;
i++)
7518 tmp_mticks(
i) = tmp_ticks(0) - (n_below-
i) * d_below;
7519 for (
int i = 0;
i < n_ticks-1;
i++)
7521 double d = (tmp_ticks(
i+1) - tmp_ticks(
i)) / (n + 1);
7522 for (
int j = 0; j < n; j++)
7523 tmp_mticks(n_below+n*
i+j) = tmp_ticks(
i) +
d * (j+1);
7525 for (
int i = 0;
i < n_above;
i++)
7526 tmp_mticks(n_below+n_between+
i) = tmp_ticks(n_ticks-1) + (
i + 1) * d_above;
7528 mticks = tmp_mticks;
7547 const bool is_origin,
7548 const int other_axislocation,
7554 std::ostringstream
os;
7558 if (get_is2D () && is_origin)
7560 if (other_axislocation == 0)
7565 else if (other_axislocation == 1)
7566 omit_ticks(0) = lims(1);
7567 else if (other_axislocation == -1)
7568 omit_ticks(0) = lims(0);
7571 omit_ticks(1) = lims(0);
7572 omit_ticks(2) = lims(1);
7580 double exp_max = 0.0;
7581 double exp_min = 0.0;
7583 for (
int i = 0;
i <
values.numel ();
i++)
7585 double exp = std::log10 (
values(
i));
7590 for (
int i = 0;
i <
values.numel ();
i++)
7592 bool omit_tick =
false;
7593 for (
int i_omit = 0; i_omit < omit_ticks.
numel (); i_omit++)
7594 if (
values(
i) == omit_ticks(i_omit))
7610 10*std::numeric_limits<double>::epsilon())
7611 os << significand <<
'x';
7612 else if (significand < 0)
7620 exponent = -exponent;
7622 if (exponent < 10. && (exp_max > 9 || exp_min < -9))
7624 os << exponent <<
'}';
7630 for (
int i = 0;
i <
values.numel ();
i++)
7632 bool omit_tick =
false;
7633 for (
int i_omit = 0; i_omit < omit_ticks.
numel (); i_omit++)
7634 if (
values(
i) == omit_ticks(i_omit))
7659 for (
int i = 0;
i < n;
i++)
7661 double val = ticks(
i);
7662 if (limits(0) <=
val &&
val <= limits(1))
7665 label.erase (0, label.find_first_not_of (
' '));
7666 label = label.substr (0, label.find_last_not_of (
' ')+1);
7668 if (txt_renderer.ok ())
7671 ext = txt_renderer.get_extent (label, 0.0,
7672 get_ticklabelinterpreter ());
7680 double fsize =
get (
"fontsize").double_value ();
7681 int len = label.length ();
7683 wmax =
std::max (wmax, 0.5*fsize*len);
7696 double& min_pos,
double& max_neg,
7697 const Matrix& kids,
char limit_type)
7795 char update_type = 0;
7800 #define FIX_LIMITS \ 7801 if (limits.numel () == 4) \ 7804 if (octave::math::isfinite (val)) \ 7807 if (octave::math::isfinite (val)) \ 7810 if (octave::math::isfinite (val)) \ 7813 if (octave::math::isfinite (val)) \ 7818 limits.resize (4, 1); \ 7819 limits(0) = min_val; \ 7820 limits(1) = max_val; \ 7821 limits(2) = min_pos; \ 7822 limits(3) = max_neg; \ 7825 if (axis_type ==
"xdata" || axis_type ==
"xscale" 7826 || axis_type ==
"xlimmode" || axis_type ==
"xliminclude" 7827 || axis_type ==
"xlim")
7837 limits =
xproperties.get_axis_limits (min_val, max_val,
7846 else if (axis_type ==
"ydata" || axis_type ==
"yscale" 7847 || axis_type ==
"ylimmode" || axis_type ==
"yliminclude" 7848 || axis_type ==
"ylim")
7858 limits =
xproperties.get_axis_limits (min_val, max_val,
7867 else if (axis_type ==
"zdata" || axis_type ==
"zscale" 7868 || axis_type ==
"zlimmode" || axis_type ==
"zliminclude" 7869 || axis_type ==
"zlim")
7880 std::numeric_limits<double>::epsilon ());
7882 limits =
xproperties.get_axis_limits (min_val, max_val,
7893 std::numeric_limits<double>::epsilon ());
7900 else if (axis_type ==
"cdata" || axis_type ==
"climmode" 7901 || axis_type ==
"cdatamapping" || axis_type ==
"climinclude" 7902 || axis_type ==
"clim")
7911 if (min_val > max_val)
7913 min_val = min_pos = 0;
7916 else if (min_val == max_val)
7918 max_val = min_val + 1;
7924 limits(0) = min_val;
7925 limits(1) = max_val;
7931 else if (axis_type ==
"alphadata" || axis_type ==
"alimmode" 7932 || axis_type ==
"alphadatamapping" || axis_type ==
"aliminclude" 7933 || axis_type ==
"alim")
7942 if (min_val > max_val)
7944 min_val = min_pos = 0;
7947 else if (min_val == max_val)
7948 max_val = min_val + 1;
7952 limits(0) = min_val;
7953 limits(1) = max_val;
7968 switch (update_type)
8027 char update_type = 0;
8031 if (axis_type ==
"xdata" || axis_type ==
"xscale" 8032 || axis_type ==
"xlimmode" || axis_type ==
"xliminclude" 8033 || axis_type ==
"xlim")
8040 limits =
xproperties.get_axis_limits (min_val, max_val,
8052 else if (axis_type ==
"ydata" || axis_type ==
"yscale" 8053 || axis_type ==
"ylimmode" || axis_type ==
"yliminclude" 8054 || axis_type ==
"ylim")
8061 limits =
xproperties.get_axis_limits (min_val, max_val,
8073 else if (axis_type ==
"zdata" || axis_type ==
"zscale" 8074 || axis_type ==
"zlimmode" || axis_type ==
"zliminclude" 8075 || axis_type ==
"zlim")
8083 std::numeric_limits<double>::epsilon ());
8086 limits =
xproperties.get_axis_limits (min_val, max_val,
8097 std::numeric_limits<double>::epsilon ());
8105 else if (axis_type ==
"cdata" || axis_type ==
"climmode" 8106 || axis_type ==
"cdatamapping" || axis_type ==
"climinclude" 8107 || axis_type ==
"clim")
8113 if (min_val > max_val)
8115 min_val = min_pos = 0;
8118 else if (min_val == max_val)
8120 max_val = min_val + 1;
8126 limits(0) = min_val;
8127 limits(1) = max_val;
8133 else if (axis_type ==
"alphadata" || axis_type ==
"alimmode" 8134 || axis_type ==
"alphadatamapping" || axis_type ==
"aliminclude" 8135 || axis_type ==
"alim")
8141 if (min_val > max_val)
8143 min_val = min_pos = 0;
8146 else if (min_val == max_val)
8147 max_val = min_val + 1;
8151 limits(0) = min_val;
8152 limits(1) = max_val;
8165 switch (update_type)
8224 double lo = lims(0);
8225 double hi = lims(1);
8227 bool is_negative = lo < 0 && hi < 0;
8234 hi = std::log10 (-lo);
8235 lo = std::log10 (-
tmp);
8240 hi = std::log10 (hi);
8241 lo = std::log10 (lo);
8247 lo =
val + (lo -
val) / factor;
8248 hi =
val + (hi -
val) / factor;
8273 double x,
double y,
double factor,
8274 bool push_to_zoom_stack)
8277 Matrix xlims = get_xlim ().matrix_value ();
8278 Matrix ylims = get_ylim ().matrix_value ();
8281 Matrix kids = get_children ();
8294 xlims =
do_zoom (
x, factor, xlims, xscale_is (
"log"));
8295 ylims =
do_zoom (
y, factor, ylims, yscale_is (
"log"));
8297 zoom (
mode, xlims, ylims, push_to_zoom_stack);
8302 bool push_to_zoom_stack)
8305 Matrix xlims = get_xlim ().matrix_value ();
8306 Matrix ylims = get_ylim ().matrix_value ();
8308 double x = (xlims(0) + xlims(1)) / 2;
8309 double y = (ylims(0) + ylims(1)) / 2;
8311 zoom_about_point (
mode,
x,
y, factor, push_to_zoom_stack);
8317 if (zoom_stack.empty ())
8319 zoom_stack.push_front (xlimmode.get ());
8320 zoom_stack.push_front (xlim.get ());
8321 zoom_stack.push_front (ylimmode.get ());
8322 zoom_stack.push_front (ylim.get ());
8323 zoom_stack.push_front (zlimmode.get ());
8324 zoom_stack.push_front (zlim.get ());
8325 zoom_stack.push_front (view.get ());
8332 bool push_to_zoom_stack)
8334 if (xl(0) == xl(1) || yl(0) == yl(1))
8336 warning (
"invalid zoom region");
8340 if (push_to_zoom_stack)
8343 if (
mode ==
"horizontal" ||
mode ==
"both")
8346 xlimmode =
"manual";
8349 if (
mode ==
"vertical" ||
mode ==
"both")
8352 ylimmode =
"manual";
8355 update_transform ();
8357 if (
mode ==
"horizontal" ||
mode ==
"both")
8360 if (
mode ==
"vertical" ||
mode ==
"both")
8369 double lo = lims(0);
8370 double hi = lims(1);
8372 bool is_negative = lo < 0 && hi < 0;
8381 hi = std::log10 (-lo);
8382 lo = std::log10 (-
tmp);
8388 hi = std::log10 (hi);
8389 lo = std::log10 (lo);
8392 delta = std::log10 (x0) - std::log10 (x1);
8426 double x0,
double x1,
double y0,
double y1,
8427 bool push_to_zoom_stack)
8430 Matrix xlims = get_xlim ().matrix_value ();
8431 Matrix ylims = get_ylim ().matrix_value ();
8434 Matrix kids = get_children ();
8447 xlims =
do_translate (x0, x1, xlims, xscale_is (
"log"));
8448 ylims =
do_translate (y0, y1, ylims, yscale_is (
"log"));
8450 zoom (
mode, xlims, ylims, push_to_zoom_stack);
8455 bool push_to_zoom_stack)
8458 Matrix xlims = get_xlim ().matrix_value ();
8459 Matrix ylims = get_ylim ().matrix_value ();
8461 double x0 = (xlims(0) + xlims(1)) / 2;
8462 double y0 = (ylims(0) + ylims(1)) / 2;
8464 double x1 = x0 + (xlims(1) - xlims(0)) * factor;
8465 double y1 = y0 + (ylims(1) - ylims(0)) * factor;
8467 translate_view (
mode, x0, x1, y0, y1, push_to_zoom_stack);
8472 bool push_to_zoom_stack)
8474 if (push_to_zoom_stack)
8477 Matrix bb = get_boundingbox (
true);
8478 Matrix new_view = get_view ().matrix_value ();
8481 new_view(0) += ((x0 - x1) * (180.0 / bb(2)));
8482 new_view(1) += ((y1 - y0) * (180.0 / bb(3)));
8485 new_view(1) =
std::min (new_view(1), 90.0);
8486 new_view(1) =
std::max (new_view(1), -90.0);
8487 if (new_view(0) > 180.0)
8488 new_view(0) -= 360.0;
8489 else if (new_view(0) < -180.0)
8490 new_view(0) += 360.0;
8493 double snapmargin = 1.0;
8494 for (
int a = -90;
a <= 90;
a += 90)
8496 if ((
a - snapmargin) < new_view(1) && new_view(1) < (
a + snapmargin))
8503 for (
int a = -180;
a <= 180;
a += 180)
8504 if ((
a - snapmargin) < new_view(0) && new_view(0) < (
a + snapmargin))
8514 set_view (new_view);
8519 bool push_to_zoom_stack)
8521 if (push_to_zoom_stack)
8533 v(0) = fmod (v(0) - delta_az + 720,360);
8537 update_transform ();
8543 if (zoom_stack.size () >= 7)
8545 view = zoom_stack.front ();
8546 zoom_stack.pop_front ();
8548 zlim = zoom_stack.front ();
8549 zoom_stack.pop_front ();
8551 zlimmode = zoom_stack.front ();
8552 zoom_stack.pop_front ();
8554 ylim = zoom_stack.front ();
8555 zoom_stack.pop_front ();
8557 ylimmode = zoom_stack.front ();
8558 zoom_stack.pop_front ();
8560 xlim = zoom_stack.front ();
8561 zoom_stack.pop_front ();
8563 xlimmode = zoom_stack.front ();
8564 zoom_stack.pop_front ();
8566 update_transform ();
8584 if (! ca.isempty () && ca.double_value () == __myhandle__)
8589 fig.set (
"currentaxes",
Matrix ());
8593 fig.set (
"currentaxes", kidsarray(0));
8598 base_properties::update_handlevisibility ();
8604 size_t items_to_leave_on_stack = (do_unzoom ? 7 : 0);
8606 while (zoom_stack.size () > items_to_leave_on_stack)
8607 zoom_stack.pop_front ();
8645 line::properties::compute_xlim (
void)
const 8649 m(0) = xdata.min_val ();
8650 m(1) = xdata.max_val ();
8651 m(2) = xdata.min_pos ();
8652 m(3) = xdata.max_neg ();
8658 line::properties::compute_ylim (
void)
const 8662 m(0) = ydata.min_val ();
8663 m(1) = ydata.max_val ();
8664 m(2) = ydata.min_pos ();
8665 m(3) = ydata.max_neg ();
8673 text::properties::get_data_position (
void)
const 8675 Matrix pos = get_position ().matrix_value ();
8677 if (! units_is (
"data"))
8684 text::properties::get_extent_matrix (
void)
const 8687 return extent.get ().matrix_value ();
8691 text::properties::get_extent (
void)
const 8695 Matrix m = extent.get ().matrix_value ();
8696 Matrix pos = get_position ().matrix_value ();
8710 if (fontunits.set (
val,
true))
8712 update_fontunits (old_fontunits);
8721 double parent_height = 0;
8722 double fontsz = get_fontsize ();
8724 if (new_units ==
"normalized")
8729 parent_height = ax.get_properties ().get_boundingbox (
true).elem (3);
8738 text::properties::update_font (
void)
8741 txt_renderer.set_font (
get (
"fontname").string_value (),
8742 get (
"fontweight").string_value (),
8743 get (
"fontangle").string_value (),
8744 get (
"__fontsize_points__").double_value ());
8746 txt_renderer.set_color (get_color_rgb ());
8750 text::properties::update_text_extent (
void)
8755 if (horizontalalignment_is (
"center"))
8757 else if (horizontalalignment_is (
"right"))
8760 if (verticalalignment_is (
"middle"))
8762 else if (verticalalignment_is (
"top"))
8764 else if (verticalalignment_is (
"baseline"))
8766 else if (verticalalignment_is (
"cap"))
8778 txt_renderer.text_to_pixels (sv.
join (
"\n"), pixels, bbox,
8779 halign, valign, get_rotation (),
8780 get_interpreter ());
8787 if (__autopos_tag___is (
"xlabel") || __autopos_tag___is (
"ylabel")
8788 || __autopos_tag___is (
"zlabel") || __autopos_tag___is (
"title"))
8789 update_autopos (
"sync");
8793 text::properties::request_autopos (
void)
8795 if (__autopos_tag___is (
"xlabel") || __autopos_tag___is (
"ylabel")
8796 || __autopos_tag___is (
"zlabel") || __autopos_tag___is (
"title"))
8797 update_autopos (get___autopos_tag__ ());
8803 if (! units_is (
"data"))
8805 set_xliminclude (
"off");
8806 set_yliminclude (
"off");
8807 set_zliminclude (
"off");
8810 Matrix pos = get_position ().matrix_value ();
8817 bool autopos = positionmode_is (
"auto");
8822 set_positionmode (
"auto");
8824 if (units_is (
"data"))
8826 set_xliminclude (
"on");
8827 set_yliminclude (
"on");
8829 set_zliminclude (
"off");
8832 cached_units = get_units ();
8838 double fontsz = get_fontsize ();
8839 double parent_height = box_pix_height;
8841 if (fontunits_is (
"normalized") && parent_height <= 0)
8846 parent_height = ax.get_properties ().get_boundingbox (
true).elem (3);
8857 return convert_cdata (*
this, get_cdata (), cdatamapping_is (
"scaled"), 3);
8869 return convert_cdata (*
this, fvc, cdatamapping_is (
"scaled"), 2);
8875 patch::properties::update_fvc (
void)
8880 Matrix xd = get_xdata ().matrix_value ();
8881 Matrix yd = get_ydata ().matrix_value ();
8882 Matrix zd = get_zdata ().matrix_value ();
8883 NDArray cd = get_cdata ().array_value ();
8889 bad_data_msg =
"x/y/zdata must have the same dimensions";
8898 if (nr == 1 && nc > 1)
8924 vert(kk,0) = xd(ii,jj);
8925 vert(kk,1) = yd(ii,jj);
8927 vert(kk,2) = zd(ii,jj);
8929 idx(jj,ii) =
static_cast<double> (kk+1);
8937 if (cd.
ndims () == 3)
8953 vertices.set (vert);
8954 facevertexcdata.set (fvc);
8958 patch::properties::update_data (
void)
8964 Matrix vert = get_vertices ().matrix_value ();
8965 NDArray fvc = get_facevertexcdata ().array_value ();
8972 if (static_cast<double> (nvert) < idx.
row_max ().
max ())
8974 bad_data_msg = R
"(some vertices in "faces" property are undefined)"; 8983 double valid_vert = idx(0,jj);
8984 bool turn_valid =
false;
8989 idx(ii,jj) = valid_vert;
8993 valid_vert = idx(ii,jj);
9001 bool pervertex =
false;
9003 if (fvc.
rows () == nfaces || fvc.
rows () == 1)
9026 bool has_zd =
false;
9038 xd(ii,jj) = vert(
row,0);
9039 yd(ii,jj) = vert(
row,1);
9042 zd(ii,jj) = vert(
row,2);
9045 for (
int kk = 0; kk < fvc.
columns (); kk++)
9046 cd(ii,jj,kk) = fvc(
row,kk);
9065 return convert_cdata (*
this, get_cdata (), cdatamapping_is (
"scaled"), 3);
9070 double x2,
double y2,
double z2,
9071 double&
x,
double&
y,
double& z)
9073 x += (y1 * z2 - z1 * y2);
9074 y += (z1 * x2 - x1 * z2);
9075 z += (x1 * y2 - y1 * x2);
9079 surface::properties::update_vertex_normals (
void)
9081 if (vertexnormalsmode_is (
"auto"))
9083 Matrix x = get_xdata ().matrix_value ();
9084 Matrix y = get_ydata ().matrix_value ();
9085 Matrix z = get_zdata ().matrix_value ();
9096 if (
x.columns () !=
p ||
y.rows () != q)
9101 bool x_mat = (
x.rows () == q);
9102 bool y_mat = (
y.columns () ==
p);
9104 int i1, i2, i3, j1, j2, j3;
9108 for (
int i = 0;
i <
p;
i++)
9117 for (
int j = 0; j < q; j++)
9126 double& nx = n(j,
i, 0);
9127 double& ny = n(j,
i, 1);
9128 double& nz = n(j,
i, 2);
9130 if ((j > 0) && (
i > 0))
9133 (
x(j1,
i-1)-
x(j2,
i),
y(j-1,i1)-
y(j,i2), z(j-1,
i-1)-z(j,
i),
9134 x(j2,
i-1)-
x(j1,
i),
y(j,i1)-
y(j-1,i2), z(j,
i-1)-z(j-1,
i),
9137 if ((j > 0) && (
i < (
p -1)))
9140 (
x(j1,
i+1)-
x(j2,
i),
y(j-1,i3)-
y(j,i2), z(j-1,
i+1)-z(j,
i),
9141 x(j1,
i)-
x(j2,
i+1),
y(j-1,i2)-
y(j,i3), z(j-1,
i)-z(j,
i+1),
9144 if ((j < (q - 1)) && (
i > 0))
9147 (
x(j2,
i-1)-
x(j3,
i),
y(j,i1)-
y(j+1,i2), z(j,
i-1)-z(j+1,
i),
9148 x(j3,
i-1)-
x(j2,
i),
y(j+1,i1)-
y(j,i2), z(j+1,
i-1)-z(j,
i),
9151 if ((j < (q - 1)) && (
i < (
p -1)))
9154 (
x(j3,
i)-
x(j2,
i+1),
y(j+1,i2)-
y(j,i3), z(j+1,
i)-z(j,
i+1),
9155 x(j3,
i+1)-
x(j2,
i),
y(j+1,i3)-
y(j,i2), z(j+1,
i+1)-z(j,
i),
9172 hggroup::properties::update_limits (
void)
const 9220 char update_type = 0;
9222 if (axis_type ==
"xlim" || axis_type ==
"xliminclude")
9227 else if (axis_type ==
"ylim" || axis_type ==
"yliminclude")
9232 else if (axis_type ==
"zlim" || axis_type ==
"zliminclude")
9237 else if (axis_type ==
"clim" || axis_type ==
"climinclude")
9242 else if (axis_type ==
"alim" || axis_type ==
"aliminclude")
9248 if (limits.
numel () == 4)
9266 limits(0) = min_val;
9267 limits(1) = max_val;
9268 limits(2) = min_pos;
9269 limits(3) = max_neg;
9279 if (limits(0) != min_val || limits(1) != max_val
9280 || limits(2) != min_pos || limits(3) != max_neg)
9282 limits(0) = min_val;
9283 limits(1) = max_val;
9284 limits(2) = min_pos;
9285 limits(3) = max_neg;
9287 switch (update_type)
9330 char update_type = 0;
9332 if (axis_type ==
"xlim" || axis_type ==
"xliminclude")
9338 else if (axis_type ==
"ylim" || axis_type ==
"yliminclude")
9344 else if (axis_type ==
"zlim" || axis_type ==
"zliminclude")
9350 else if (axis_type ==
"clim" || axis_type ==
"climinclude")
9356 else if (axis_type ==
"alim" || axis_type ==
"aliminclude")
9368 Matrix limits (1, 4, 0.0);
9370 limits(0) = min_val;
9371 limits(1) = max_val;
9372 limits(2) = min_pos;
9373 limits(3) = max_neg;
9375 switch (update_type)
9408 std::list<graphics_handle> lst =
xproperties.get_dependent_obj_list ();
9409 std::list<graphics_handle>::const_iterator it;
9411 for (it = lst.begin (); it != lst.end (); it++)
9452 uicontrol::properties::get_extent (
void)
const 9454 Matrix m = extent.get ().matrix_value ();
9464 uicontrol::properties::update_text_extent (
void)
9476 txt_renderer.
set_font (get_fontname (), get_fontweight (),
9477 get_fontangle (), get_fontsize ());
9487 ext(0) = ext(1) = 1;
9497 Matrix pos = get_position ().matrix_value ();
9506 cached_units = get_units ();
9510 uicontrol::properties::set_style (
const octave_value& st)
9512 if (! get___object__ ().isempty ())
9513 error (
"set: cannot change the style of a uicontrol object after creation.");
9518 if (style_is (
"listbox") || style_is (
"popupmenu"))
9521 if (v.
numel () == 1 && v (0) == 0)
9528 const Matrix& parent_pix_size)
const 9530 Matrix pos = get_position ().matrix_value ();
9531 Matrix parent_size (parent_pix_size);
9548 pos(1) = parent_size(1) - pos(1) - pos(3);
9558 if (fontunits.set (
val,
true))
9560 update_fontunits (old_fontunits);
9569 double parent_height = get_boundingbox (
false).elem (3);
9570 double fontsz = get_fontsize ();
9580 double fontsz = get_fontsize ();
9581 double parent_height = box_pix_height;
9583 if (fontunits_is (
"normalized") && parent_height <= 0)
9584 parent_height = get_boundingbox (
false).elem (3);
9593 const Matrix& parent_pix_size)
const 9595 Matrix pos = get_position ().matrix_value ();
9596 Matrix parent_size (parent_pix_size);
9610 pos(1) = parent_size(1) - pos(1) - pos(3);
9614 double outer_height = pos(3);
9616 pos(0) = pos(1) = 0;
9618 if (! bordertype_is (
"none"))
9620 double bw = get_borderwidth ();
9623 if (bordertype_is (
"etchedin") || bordertype_is (
"etchedout"))
9628 pos(2) -= 2 * mul * bw;
9629 pos(3) -= 2 * mul * bw;
9632 if (! get_title ().
empty ())
9634 double fontsz = get_fontsize ();
9636 if (! fontunits_is (
"pixels"))
9640 if (fontunits_is (
"points"))
9641 fontsz *= (res / 72.0);
9642 else if (fontunits_is (
"inches"))
9644 else if (fontunits_is (
"centimeters"))
9645 fontsz *= (res / 2.54);
9646 else if (fontunits_is (
"normalized"))
9647 fontsz *= outer_height;
9650 if (titleposition_is (
"lefttop") || titleposition_is (
"centertop")
9651 || titleposition_is (
"righttop"))
9652 pos(1) += (fontsz / 2);
9653 pos(3) -= (fontsz / 2);
9665 if (units.set (
val,
true))
9667 update_units (old_units);
9675 Matrix pos = get_position ().matrix_value ();
9690 if (fontunits.set (
val,
true))
9692 update_fontunits (old_fontunits);
9701 double parent_height = get_boundingbox (
false).elem (3);
9702 double fontsz = get_fontsize ();
9712 double fontsz = get_fontsize ();
9713 double parent_height = box_pix_height;
9715 if (fontunits_is (
"normalized") && parent_height <= 0)
9716 parent_height = get_boundingbox (
false).elem (3);
9722 uibuttongroup::properties::set_selectedobject (
const octave_value& v)
9725 selectedobject = current_selectedobject;
9728 if (current_selectedobject.
ok ())
9743 && gop.get_parent () == get___myhandle__ ()
9744 && go.
isa (
"uicontrol"))
9749 if (style.
compare (
"radiobutton") || style.
compare (
"togglebutton"))
9751 selectedobject =
val;
9764 const Matrix& parent_pix_size)
const 9766 Matrix pos = get_position ().matrix_value ();
9767 Matrix parent_size (parent_pix_size);
9781 pos(1) = parent_size(1) - pos(1) - pos(3);
9785 double outer_height = pos(3);
9787 pos(0) = pos(1) = 0;
9789 if (! bordertype_is (
"none"))
9791 double bw = get_borderwidth ();
9794 if (bordertype_is (
"etchedin") || bordertype_is (
"etchedout"))
9799 pos(2) -= 2 * mul * bw;
9800 pos(3) -= 2 * mul * bw;
9803 if (! get_title ().
empty ())
9805 double fontsz = get_fontsize ();
9807 if (! fontunits_is (
"pixels"))
9811 if (fontunits_is (
"points"))
9812 fontsz *= (res / 72.0);
9813 else if (fontunits_is (
"inches"))
9815 else if (fontunits_is (
"centimeters"))
9816 fontsz *= (res / 2.54);
9817 else if (fontunits_is (
"normalized"))
9818 fontsz *= outer_height;
9821 if (titleposition_is (
"lefttop") || titleposition_is (
"centertop")
9822 || titleposition_is (
"righttop"))
9823 pos(1) += (fontsz / 2);
9824 pos(3) -= (fontsz / 2);
9836 if (units.set (
val,
true))
9838 update_units (old_units);
9844 uipanel::properties::update_units (
const caseless_str& old_units)
9846 Matrix pos = get_position ().matrix_value ();
9861 if (fontunits.set (
val,
true))
9863 update_fontunits (old_fontunits);
9869 uipanel::properties::update_fontunits (
const caseless_str& old_units)
9872 double parent_height = get_boundingbox (
false).elem (3);
9873 double fontsz = get_fontsize ();
9883 double fontsz = get_fontsize ();
9884 double parent_height = box_pix_height;
9886 if (fontunits_is (
"normalized") && parent_height <= 0)
9887 parent_height = get_boundingbox (
false).elem (3);
9942 : handle_map (), handle_free_list (),
9943 next_handle (-1.0 - (rand () + 1.0) / (RAND_MAX + 2.0)),
9944 figure_list (), graphics_lock (), event_queue (),
9945 callback_objects (), event_processing (0)
9967 bool integer_figure_handle,
9969 bool do_notify_toolkit)
9978 error (
"gh_manager::do_make_graphics_handle: invalid object type '%s'",
9987 go.override_defaults ();
9989 if (go_name ==
"axes")
10017 if (do_notify_toolkit)
10034 if (do_notify_toolkit)
10070 callback (), callback_data (data) { }
10075 callback (cb), callback_data (data) { }
10079 if (callback.is_defined ())
10118 function (function_data);
10135 property_value (
value), notify_toolkit (do_notify_toolkit) { }
10148 p.set (property_value,
true, notify_toolkit);
10191 bool notify_toolkit)
10203 props.set_callbackobject (
h.as_octave_value ());
10241 args(0) =
h.as_octave_value ();
10276 catch (octave::execution_exception&)
10278 std::cerr <<
"execution error in graphics callback function" 10280 Flasterr (
ovl (
"execution error in graphics callback function"));
10287 || cb.
cell_value ()(0).is_function_handle ()))
10291 fcn =
c(0).function_value ();
10293 for (
int i = 1;
i <
c.numel () ;
i++)
10299 error (
"trying to execute non-executable object (class = %s)",
10308 catch (octave::execution_exception&)
10310 std::cerr <<
"execution error in graphics callback function" 10312 Flasterr (
ovl (
"execution error in graphics callback function"));
10324 if (go_name.length () > 1
10325 && go_name[0] ==
'u' && go_name[1] ==
'i')
10366 if (busy_action ==
"queue")
10373 if (cname.
compare (
"deletefcn")
10374 || cname.
compare (
"createfcn")
10375 || (go.
isa (
"figure")
10376 && (cname.
compare (
"closerequestfcn")
10377 || cname.
compare (
"resizefcn"))))
10409 bool events_executed =
false;
10443 events_executed =
true;
10455 if (events_executed)
10516 DEFUN (ishghandle, args, ,
10529 if (args.length () != 1)
10573 else if (
val.isnumeric () &&
val.isreal ())
10588 DEFUN (__is_handle_visible__, args, ,
10594 if (args.length () != 1)
10600 DEFUN (reset, args, ,
10615 if (args.length () != 1)
10619 ColumnVector hcv = args(0).xvector_value (
"reset: H must be a graphics handle");
10836 error (
"set: invalid handle (= %g)",
hcv(n));
10840 if (args(2).cell_value ().rows () == 1)
10841 go.
set (args(1).cellstr_value (), args(2).cell_value (), 0);
10842 else if (
hcv.
numel () == args(2).cell_value ().rows ())
10843 go.
set (args(1).cellstr_value (), args(2).cell_value (), n);
10845 error (
"set: number of graphics handles must match number of value rows (%d != %d)",
10846 hcv.
numel (), args(2).cell_value ().rows ());
10848 else if (
nargin == 2 && args(1).isstruct ())
10849 go.
set (args(1).map_value ());
10850 else if (
nargin == 2 && args(1).is_string ())
10854 property.begin (), tolower);
10863 <<
" is read-only" << std::endl;
10876 error (
"set: unknown property");
10891 go.
set (args.splice (0, 1));
10912 error (
"get: invalid handle (= %g)",
val);
10917 DEFUN (
get, args, ,
10933 int nargin = args.length ();
10938 if (args(0).isempty ())
10941 ColumnVector hcv = args(0).xvector_value (
"get: H must be a graphics handle");
10945 if (
nargin == 1 && hcv_len > 1)
10954 error (
"get: vector of handles must all have the same type");
10960 bool use_cell_format =
false;
10968 use_cell_format =
true;
10977 error (
"get: invalid handle (= %g)",
hcv(n));
10992 property = args(1).xstring_value (
"get: second argument must be property name or cell array of property names");
11001 error (
"get: invalid handle (= %g)",
hcv(n));
11004 vals(n) = go.
get ();
11010 if (use_cell_format)
11018 else if (vals_len == 1)
11020 else if (vals_len > 1 &&
nargin == 1)
11025 tmp[n] = vals(n).scalar_map_value ();
11044 DEFUN (__get__, args, ,
11052 if (args.length () != 1)
11055 ColumnVector hcv = args(0).xvector_value (
"get: H must be a graphics handle");
11068 error (
"get: invalid handle (= %g)",
hcv(n));
11073 vals(n) = go.
get (
true);
11082 else if (vals_len == 1)
11083 return ovl (vals(0));
11089 make_graphics_object (
const std::string& go_name,
11090 bool integer_figure_handle,
11101 for (
int i = 0;
i < xargs.
length ();
i++)
11103 if (xargs(
i).is_string () &&
p.compare (xargs(
i).string_value ()))
11105 if (
i >= (xargs.
length () - 1))
11106 error (
"__go_%s__: missing value for parent property",
11109 val = xargs(
i+1).double_value ();
11117 val = args(0).xdouble_value (
"__go_%s__: invalid parent", go_name.c_str ());
11121 if (! parent.
ok ())
11122 error (
"__go_%s__: invalid parent", go_name.c_str ());
11129 integer_figure_handle,
11132 catch (octave::execution_exception&
e)
11134 error (
e,
"__go_%s__: unable to create graphics handle",
11144 catch (octave::execution_exception&
e)
11147 error (
e,
"__go_%s__: unable to create graphics handle",
11161 DEFUN (__go_figure__, args, ,
11169 if (args.
length () == 0)
11172 double val = args(0).xdouble_value (
"__go_figure__: figure number must be a double value");
11186 bool int_fig_handle =
true;
11196 for (
int i = 0;
i < xargs.
length ();
i++)
11198 if (xargs(
i).is_string ()
11199 &&
pname.compare (xargs(
i).string_value ()))
11201 if (
i < (xargs.
length () - 1))
11206 int_fig_handle =
on.compare (pval);
11218 if (! int_fig_handle)
11231 error (
"__go_figure__: failed to create figure handle");
11247 #define GO_BODY(TYPE) \ 11248 gh_manager::auto_lock guard; \ 11250 if (args.length () == 0) \ 11253 return octave_value (make_graphics_object (#TYPE, false, args)); \ 11260 if (go.
isa (
"surface"))
11262 else if ((go.
isa (
"line") || go.
isa (
"patch"))
11289 DEFUN (__calc_dimensions__, args, ,
11299 if (args.
length () != 1)
11302 double h = args(0).xdouble_value (
"__calc_dimensions__: first argument must be a graphics handle");
11307 DEFUN (__go_axes__, args, ,
11316 DEFUN (__go_line__, args, ,
11325 DEFUN (__go_text__, args, ,
11334 DEFUN (__go_image__, args, ,
11343 DEFUN (__go_surface__, args, ,
11352 DEFUN (__go_patch__, args, ,
11361 DEFUN (__go_light__, args, ,
11370 DEFUN (__go_hggroup__, args, ,
11379 DEFUN (__go_uimenu__, args, ,
11388 DEFUN (__go_uicontrol__, args, ,
11397 DEFUN (__go_uibuttongroup__, args, ,
11406 DEFUN (__go_uipanel__, args, ,
11415 DEFUN (__go_uicontextmenu__, args, ,
11424 DEFUN (__go_uitoolbar__, args, ,
11433 DEFUN (__go_uipushtool__, args, ,
11442 DEFUN (__go_uitoggletool__, args, ,
11451 DEFUN (__go_delete__, args, ,
11459 if (args.
length () != 1)
11464 const NDArray vals = args(0).xarray_value (
"delete: invalid graphics object");
11473 error (
"delete: invalid graphics object (= %g)", vals(
i));
11481 DEFUN (__go_handles__, args, ,
11489 bool show_hidden =
false;
11492 show_hidden = args(0).bool_value ();
11497 DEFUN (__go_figure_handles__, args, ,
11505 bool show_hidden =
false;
11508 show_hidden = args(0).bool_value ();
11513 DEFUN (__go_execute_callback__, args, ,
11525 const NDArray vals = args(0).xarray_value (
"__go_execute_callback__: invalid graphics object");
11527 std::string name = args(1).xstring_value (
"__go_execute_callback__: invalid callback name");
11531 double val = vals(
i);
11536 error (
"__go_execute_callback__: invalid graphics object (= %g)",
val);
11547 DEFUN (__image_pixel_size__, args, ,
11553 if (args.
length () != 1)
11556 double h = args(0).xdouble_value (
"__image_pixel_size__: argument is not a handle");
11559 if (! go || ! go.
isa (
"image"))
11560 error (
"__image_pixel_size__: object is not an image");
11566 dp(0) = ip.pixel_xsize ();
11567 dp(1) = ip.pixel_ysize ();
11571 DEFMETHOD (available_graphics_toolkits, interp, , ,
11585 DEFMETHOD (register_graphics_toolkit, interp, args, ,
11594 if (args.
length () != 1)
11597 std::string name = args(0).xstring_value (
"register_graphics_toolkit: TOOLKIT must be a string");
11606 DEFMETHOD (loaded_graphics_toolkits, interp, , ,
11620 DEFUN (drawnow, args, ,
11637 static int drawnow_executing = 0;
11656 for (
int i = 0;
i < hlist.
numel ();
i++)
11660 if (
h.ok () &&
h != 0)
11668 if (fprops.is_visible ())
11682 bool do_events =
true;
11684 if (args.
length () == 1)
11686 caseless_str val (args(0).xstring_value (
"drawnow: first argument must be a string"));
11688 if (
val.compare (
"expose"))
11691 error (
"drawnow: invalid argument, 'expose' is only valid option");
11707 term = args(0).xstring_value (
"drawnow: TERM must be a string");
11709 file = args(1).xstring_value (
"drawnow: FILE must be a string");
11712 error (
"drawnow: empty output ''");
11713 else if (
file.length () == 1 &&
file[0] ==
'|')
11714 error (
"drawnow: empty pipe '|'");
11715 else if (
file[0] !=
'|')
11719 if (pos != std::string::npos)
11726 error (
"drawnow: nonexistent directory '%s'",
11732 debug_file = (args.
length () > 2 ? args(2).xstring_value (
"drawnow: DEBUG_FILE must be a string") :
"");
11737 error (
"drawnow: nothing to draw");
11808 double h = args(0).xdouble_value (
"addlistener: invalid handle H");
11815 error (
"addlistener: invalid graphics object (= %g)",
h);
11821 if (args.
length () == 4)
11824 if (persistent.
compare (
"persistent"))
11831 DEFUN (dellistener, args, ,
11865 double h = args(0).xdouble_value (
"dellistener: invalid handle");
11867 std::string pname = args(1).xstring_value (
"dellistener: PROP must be a string");
11872 error (
"dellistener: invalid graphics object (= %g)",
h);
11876 if (args.
length () == 2)
11880 if (args(2).is_string ()
11881 && args(2).string_value () ==
"persistent")
11972 std::string name = args(0).xstring_value (
"addproperty: NAME must be a string");
11974 double h = args(1).xdouble_value (
"addproperty: invalid handle H");
11979 error (
"addproperty: invalid graphics object (= %g)",
h);
11983 std::string type = args(2).xstring_value (
"addproperty: TYPE must be a string");
11986 error (
"addproperty: a '%s' property already exists in the graphics object",
12005 error (
"%s: invalid handle (= %g)", func.c_str (),
handle);
12020 error (
"%s: invalid handle (= %g)", func.c_str (),
handle);
12039 if (
result.length () > 0)
12040 return result(0).bool_value ();
12059 if (
c.numel () >= 4)
12061 double h =
c(2).double_value ();
12097 uint32_t
id = args(2).uint32_scalar_value ().value ();
12101 double h = args(0).double_value ();
12114 if (compare_property_values (pvalue, args(5)))
12129 uint32_t
id = args(2).uint32_scalar_value ().value ();
12137 DEFUN (waitfor, args, ,
12179 if (args.
length () == 0)
12183 if (args(0).isempty ())
12186 double h = args(0).xdouble_value (
"waitfor: invalid handle value");
12202 pname = args(1).xstring_value (
"waitfor: PROP must be a string");
12204 if (
pname.empty ())
12205 error (
"waitfor: PROP must be a non-empty string");
12207 if (
pname !=
"timeout")
12209 if (
pname.compare (R
"(\timeout)")) 12217 "waitfor_listener"));
12222 if (args(2).is_string ())
12226 if (
s.compare (
"timeout"))
12241 listener(0) = wf_listener;
12244 listener(3) =
pname;
12247 listener(4) = args(2);
12260 && compare_property_values (go.
get (
pname), args(2)))
12277 "waitfor_del_listener"));
12279 Cell del_listener (1, 4);
12281 del_listener(0) = wf_del_listener;
12283 del_listener(2) =
h;
12284 del_listener(3) =
pname;
12302 if (!
s.compare (
"timeout"))
12303 error (
"waitfor: invalid parameter '%s'",
s.c_str ());
12311 error (
"waitfor: missing TIMEOUT value");
12317 warning (
"waitfor: TIMEOUT value must be >= 1, using 1 instead");
12377 DEFUN (__zoom__, args, ,
12390 double h = args(0).double_value ();
12397 error (
"__zoom__: invalid handle");
12408 if (opt ==
"out" || opt ==
"reset")
12422 double factor = args(2).scalar_value ();
12431 DEFUN (__get_frame__, args, ,
12440 if (args.
length () != 1)
12443 double h = args(0).xdouble_value (
"__get_frame__: HFIG is not a handle");
12446 if (! go || ! go.
isa (
"figure"))
12447 error (
"__get_frame__: HFIG is not a figure");
static Matrix default_axes_ticklength(void)
OCTINTERP_API octave_value_list feval(const std::string &name, const octave_value_list &args=octave_value_list(), int nargout=0)
int warning_enabled(const std::string &id)
Matrix do_get_children(bool return_hidden) const
std::map< graphics_handle, graphics_object >::iterator iterator
virtual std::string graphics_object_name(void) const
octave_idx_type rows(void) const
static void pop_figure(const graphics_handle &h)
void calc_ticks_and_lims(array_property &lims, array_property &ticks, array_property &mticks, bool limmode_is_auto, bool tickmode_is_auto, bool is_logscale)
static graphics_event create_set_event(const graphics_handle &h, const std::string &name, const octave_value &value, bool notify_toolkit=true)
void warning_with_id(const char *id, const char *fmt,...)
scalar structure containing the one value The second produces an empty struct array with one field and no values since being passed an empty cell array of struct array values When the value is a cell array containing a single entry this becomes a scalar struct with that single entry as the value of the field That single entry happens to be an empty cell array Finally if the value is a non scalar cell array then ode isstruct
Matrix get_axis_limits(double xmin, double xmax, double min_pos, double max_neg, const bool logscale)
OCTINTERP_API bool validate(const octave_value &v) const
bool is_bool_scalar(void) const
static void convert_cdata_2(bool is_scaled, bool is_real, double clim_0, double clim_1, const double *cmapv, double x, octave_idx_type lda, octave_idx_type nc, octave_idx_type i, double *av)
plist_map_iterator find(const std::string &go_name)
void build_user_defaults_map(property_list::pval_map_type &def, const std::string go_name) const
bool is_aliminclude(void) const
OCTINTERP_API void octave_sleep(double seconds)
static Matrix default_screensize(void)
octave_base_value * clone(void) const
static std::set< double > updating_aspectratios
bool is_handle_visible(void) const
static Matrix default_axes_tick(void)
void rotate3d(double x0, double x1, double y0, double y1, bool push_to_zoom_stack=true)
virtual void reparent(const graphics_handle &np)
OCTAVE_EXPORT octave_value_list column
For example cd octave end example noindent changes the current working directory to file
void update_axis_limits(const std::string &axis_type)
bool compare(const std::string &s, size_t limit=std::string::npos) const
static double default_screenpixelsperinch(void)
static caseless_str validate_property_name(const std::string &who, const std::string &what, const std::set< std::string > &pnames, const caseless_str &pname)
static octave_map cat(int dim, octave_idx_type n, const octave_scalar_map *map_list)
static Matrix default_axes_outerposition(void)
static Matrix default_axes_view(void)
virtual octave_value get_factory_default(const caseless_str &) const
bool is_uint32_type(void) const
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
void build_user_defaults_map(property_list::pval_map_type &def, const std::string go_name) const
graphics_toolkit find_toolkit(const std::string &name) const
virtual bool do_set(const octave_value &)
std::set< std::string > type_constraints
graphics_handle do_get_handle(bool integer_figure_handle)
void reset_default_properties(void)
void override_defaults(base_graphics_object &obj)
void convert_cdata_1(bool is_scaled, bool is_real, double clim_0, double clim_1, const double *cmapv, const T *cv, octave_idx_type lda, octave_idx_type nc, double *av)
static Matrix default_control_sliderstep(void)
std::string string_value(bool force=false) const
void do_renumber_figure(const graphics_handle &old_gh, const graphics_handle &new_gh)
string_vector keys(void) const
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
octave_int< T > xmax(const octave_int< T > &x, const octave_int< T > &y)
graphics_handle gca(void)
void erase(const std::string pname)
static octave_value convert_cdata(const base_properties &props, const octave_value &cdata, bool is_scaled, int cdim)
const T * data(void) const
static Matrix default_figure_paperposition(void)
void update_xlabel_position(void)
static Matrix do_translate(double x0, double x1, const Matrix &lims, bool is_logscale)
static Matrix default_patch_xdata(void)
static void recover_from_exception(void)
finite_type finite_constraint
void insert_property(const std::string &name, property p)
void do_execute_listener(const graphics_handle &h, const octave_value &l)
bool islogical(void) const
void update_axes_layout(void)
std::string join(const std::string &sep="") const
static Matrix default_data(void)
double get___fontsize_points__(double box_pix_height=0) const
double xdouble_value(const char *fmt,...) const
return ovl(is_hghandle(args(0)))
virtual void init_integerhandle(const octave_value &)
static void run_event_hooks(void)
OCTINTERP_API void print_usage(void)
std::string dir_sep_chars(void)
static Matrix default_patch_ydata(void)
const_iterator find(const std::string pname) const
graphics_handle get_handle(void) const
octave_value get_factory_default(const caseless_str &name) const
identity matrix If supplied two scalar respectively For allows like xample val
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE * f
octave_value get_color_data(void) const
OCTINTERP_API bool do_set(const octave_value &v)
std::string value_as_string(const std::string &prop)
Return the CPU time used by your Octave session The first output is the total time spent executing your process and is equal to the sum of second and third which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode
static OCTAVE_NORETURN void err_set_invalid(const std::string &pname)
#define CHECK_ARRAY_EQUAL(T, F, A)
static bool updating_zlabel_position
static bool updating_axes_layout
RowVector xform2cam(const ColumnVector &v)
virtual void remove_all_listeners(void)
static void cleanup_waitfor_postset_listener(const octave_value &listener)
void update_font(std::string prop="")
Matrix xform_matrix(void)
static bool is_hghandle(const graphics_handle &h)
void do_post_event(const graphics_event &e)
callback_props & operator=(const callback_props &)=delete
void sync_positions(void)
void resize(int n, int fill_value=0)
const T * fortran_vec(void) const
virtual void add_listener(const caseless_str &, const octave_value &, listener_mode=POSTSET)
int32NDArray int32_array_value(void) const
static void push_figure(const graphics_handle &h)
OCTINTERP_API void run_listeners(listener_mode mode=POSTSET)
void add_fcn(void(*fcn)(void))
graphics_handle handle_value(void) const
void do_post_function(graphics_event::event_fcn fcn, void *fcn_data)
pval_map_type::const_iterator pval_map_const_iterator
std::complex< T > ceil(const std::complex< T > &x)
static void execute_listener(const graphics_handle &h, const octave_value &l)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
virtual void update_uicontextmenu(void) const
set_event(const graphics_handle &h, const std::string &name, const octave_value &value, bool do_notify_toolkit=true)
void error(const char *fmt,...)
void set_dynamic(const caseless_str &pname, const octave_value &val)
octave_value_list splice(octave_idx_type offset, octave_idx_type len, const octave_value_list &lst=octave_value_list()) const
void do_free(const graphics_handle &h)
std::complex< T > floor(const std::complex< T > &x)
void zoom(const std::string &mode, double factor, bool push_to_zoom_stack=true)
callback_event(const graphics_handle &h, const std::string &name, const octave_value &data=Matrix())
OCTINTERP_API octave_value_list set_warning_state(const std::string &id, const std::string &state)
property get_property_dynamic(const caseless_str &pname)
std::set< std::string > type_constraints
void set(const caseless_str &name, const octave_value &val)
std::ostream & list_in_columns(std::ostream &, int width=0, const std::string &prefix="") const
static Matrix default_axes_position(void)
virtual void update_axis_limits(const std::string &axis_type)
pval_map_type::iterator pval_map_iterator
virtual void initialize(const graphics_object &go)
static Matrix figure_handle_list(bool show_hidden=false)
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
static graphics_event create_function_event(event_fcn fcn, void *data=nullptr)
void adopt(const graphics_handle &h)
OCTINTERP_API bool str2rgb(const std::string &str)
bool contains(const std::string &val, std::string &match)
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
void setfield(const std::string &key, const octave_value &val)
void update_handlevisibility(void)
static void xset_gcbo(const graphics_handle &h)
std::set< graphics_handle >::iterator free_list_iterator
static void restore_gcbo(void)
octave_value get_ylim(void) const
void translate_view(const std::string &mode, double x0, double x1, double y0, double y1, bool push_to_zoom_stack=true)
static double make_handle_fraction(void)
double get___fontsize_points__(double box_pix_height=0) const
Cell available_toolkits_list(void) const
static std::set< double > updating_axis_limits
std::string dirname(const std::string &path)
void do_restore_gcbo(void)
bool is_defined(void) const
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
double calc_tick_sep(double minval, double maxval)
void set_position(const octave_value &val)
graphics_xform get_transform(void) const
static graphics_handle make_graphics_handle(const std::string &go_name, const graphics_handle &parent, bool integer_figure_handle=false, bool do_createfcn=true, bool do_notify_toolkit=true)
octave_idx_type columns(void) const
T & elem(octave_idx_type n)
void update_ticklength(void)
bool is_modified(void) const
std::string default_toolkit(void) const
static void force_close_figure(const graphics_handle &h)
Complex atan(const Complex &x)
static double y_dpi(void)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
enum double_radio_property::current_enum current_type
static bool is_handle_visible(const graphics_handle &h)
bool isa(const std::string &go_name) const
bool has_dynamic_property(const std::string &pname)
virtual void delete_children(bool clear=false)
static void cleanup_waitfor_predelete_listener(const octave_value &listener)
std::pair< double, bool > minval
static std::string get_graphics_object_type(double val)
bool is_yliminclude(void) const
void update_axis_limits(const std::string &axis_type)
static void max_axes_scale(double &s, Matrix &limits, const Matrix &kids, double pbfactor, double dafactor, char limit_type, bool tight)
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
static Matrix default_surface_xdata(void)
virtual Matrix get_boundingbox(bool=false, const Matrix &=Matrix()) const
octave_value get_zlim(void) const
static double default_screendepth(void)
void delete_property_listener(const std::string &nm, const octave_value &v, listener_mode mode=POSTSET)
static int toggle_warn(std::string id, bool on, int state=-1)
virtual octave_value get(bool all=false) const
graphics_handle do_make_figure_handle(double val, bool do_notify_toolkit)
endfunction addlistener(gcf, "position", @my_listener, "my string") nd group nd example eealso
Matrix get_children(void) const
bool is_int16_type(void) const
void delete_text_child(handle_property &h)
graphics_handle current_val
static callback_props executing_callbacks
virtual void set(const caseless_str &pname, const octave_value &pval)
void renumber_child(graphics_handle old_gh, graphics_handle new_gh)
static Matrix default_lim(bool logscale=false)
void update_axis_limits(const std::string &axis_type)
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
OCTINTERP_API bool do_set(const octave_value &newval)
static gh_manager * instance
bool isa(const std::string &go_name) const
octave_value get_clim(void) const
octave_value get(void) const
std::set< caseless_str > possible_vals
virtual void update_boundingbox(void)
cell array If invoked with two or more scalar integer or a vector of integer values
virtual octave_value get_alim(void) const
octave_value resize(const dim_vector &dv, bool fill=false) const
std::list< dim_vector > size_constraints
static void delete_graphics_object(const graphics_handle &h)
#define CONVERT_CDATA_1(ARRAY_T, VAL_FN, IS_REAL)
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
uint32NDArray uint32_array_value(void) const
void do_post_callback(const graphics_handle &h, const std::string &name, const octave_value &data)
virtual void adopt(const graphics_handle &h)
static void check_limit_vals(double &min_val, double &max_val, double &min_pos, double &max_neg, const octave_value &data)
graphics_toolkit get_toolkit(void) const
graphics_handle gcf(void)
virtual void finalize(const graphics_object &go)
void pan(const std::string &mode, double factor, bool push_to_zoom_stack=true)
void update_aspectratios(void)
octave_value get_default(const caseless_str &name) const
static void cleanup_waitfor_id(uint32_t id)
static void initialize_r(const graphics_handle &h)
static void free(const graphics_handle &h)
callback_event(const graphics_handle &h, const octave_value &cb, const octave_value &data=Matrix())
bool valid_object(void) const
std::list< double > children_list
static bool updating_xlabel_position
Matrix xform_translate(double x, double y, double z)
int16NDArray int16_array_value(void) const
void initialize(const graphics_object &go)
Matrix transpose(void) const
virtual octave_value get_default(const caseless_str &) const
create a structure array and initialize its values The dimensions of each cell array of values must match Singleton cells and non cell values are repeated so that they fill the entire array If the cells are empty
nd deftypefn *std::string name
octave_value & assign(assign_op op, const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
void do_pop_figure(const graphics_handle &h)
OCTINTERP_API void disable_warning(const std::string &id)
MArray< T > reshape(const dim_vector &new_dims) const
static bool updating_ylabel_position
static bool updating_patch_data
octave_value get_default(const caseless_str &name) const
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
void do_enable_event_processing(bool enable=true)
static property_list::pval_map_type factory_defaults(void)
static Matrix default_patch_vertices(void)
std::list< graphics_object > callback_objects
Array< T > as_column(void) const
Return the array as a column vector.
bool is_function_handle(void) const
std::map< graphics_handle, graphics_object > handle_map
static octave_value box(JNIEnv *jni_env, void *jobj, void *jcls_arg=nullptr)
virtual bool has_property(const caseless_str &) const
void update_title_position(void)
static bool is_figure(double val)
OCTINTERP_API octave_value_list eval_string(const std::string &, bool silent, int &parse_status, int nargout)
OCTINTERP_API void execute(const octave_value &data=octave_value()) const
ColumnVector cam2xform(const Array< double > &m)
double get___fontsize_points__(double box_pix_height=0) const
plist_map_iterator end(void)
double force_in_range(double x, double lower, double upper)
virtual octave_value get_xlim(void) const
std::list< graphics_handle > figure_list
static char default_im_data[]
virtual void delete_listener(const caseless_str &, const octave_value &, listener_mode=POSTSET)
graphics_event(void)=default
octave_idx_type columns(void) const
ColumnVector xform_vector(void)
bool is_uint64_type(void) const
octave_value get(bool all=false) const
virtual void adopt(const graphics_handle &h)
void set_font(const std::string &name, const std::string &weight, const std::string &angle, double size)
static Matrix default_control_position(void)
std::string get_name(void) const
bool is_single_type(void) const
virtual graphics_toolkit get_toolkit(void) const
void do_delete_children(bool clear)
octave_value callback_data
OCTINTERP_API int calc_dimensions(const graphics_object &gh)
virtual void update_autopos(const std::string &elem_type)
octave_idx_type nelem(void) const
static void xset(const graphics_handle &h, const caseless_str &pname, const octave_value &val)
static octave_value_list waitfor_listener(const octave_value_list &args, int)
nd group nd example bool waitfor_results
Matrix xform_scale(double x, double y, double z)
octave_value as_octave_value(void) const
void rotate_view(double delta_az, double delta_el, bool push_to_zoom_stack=true)
dim_vector dims(void) const
static double x_dpi(void)
static Matrix default_figure_position(void)
double norm(const ColumnVector &v)
static void remove_event_hook(event_hook_fcn f)
string_vector & append(const std::string &s)
bool isinteger(void) const
static uint32_t id_counter
static bool updating_hggroup_limits
function_event(graphics_event::event_fcn fcn, void *data=nullptr)
void resize(const dim_vector &dv, const T &rfv)
Resizing (with fill).
void erase(const callback_property *ptr)
static base_graphics_object * make_graphics_object_from_type(const caseless_str &type, const graphics_handle &h=graphics_handle(), const graphics_handle &p=graphics_handle())
virtual octave_value get_ylim(void) const
~callback_props(void)=default
octave_int< T > pow(const octave_int< T > &a, const octave_int< T > &b)
octave_idx_type rows(void) const
static Matrix default_panel_position(void)
uint64NDArray uint64_array_value(void) const
void set_defaults(base_graphics_object &obj, const std::string &mode)
ColumnVector row_max(void) const
virtual base_properties & get_properties(void)
bool set_property_in_handle(double handle, const std::string &property, const octave_value &arg, const std::string &func)
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
virtual graphics_handle get_parent(void) const
static octave_value convert_linestyleorder_string(const octave_value &val)
octave_function * function_value(bool silent=false) const
const Cell & contents(const_iterator p) const
static Matrix default_figure_papersize(void)
base_properties & get_properties(void)
virtual void remove_child(const graphics_handle &h)
static void get_array_limits(const Array< T > &m, double &emin, double &emax, double &eminp, double &emaxp)
static bool lookup_object_name(const caseless_str &name, caseless_str &go_name, caseless_str &rest)
void register_toolkit(const std::string &name)
void reset_default_properties(void)
virtual text_element * parse(const std::string &s)=0
static Matrix default_light_position(void)
static Matrix papersize_from_type(const caseless_str punits, const caseless_str ptype)
virtual void update_axis_limits(const std::string &axis_type) const
static Matrix handle_list(bool show_hidden=false)
std::string class_name(void) const
void zoom_about_point(const std::string &mode, double x, double y, double factor, bool push_to_zoom_stack=true)
graphics_handle get_handle(void) const
bool is_function(void) const
void renumber_parent(graphics_handle new_gh)
octave_value getfield(const std::string &key) const
octave_value get_dynamic(const caseless_str &pname) const
static Matrix default_surface_ydata(void)
static Matrix convert_text_position(const Matrix &pos, const text::properties &props, const caseless_str &from_units, const caseless_str &to_units)
graphics_handle get_parent(void) const
ColumnVector cross(const ColumnVector &v1, const ColumnVector &v2)
octave_handle graphics_handle
static dim_vector alloc(int n)
bool is_int8_type(void) const
static Matrix default_colororder(void)
void calc_ticklabels(const array_property &ticks, any_property &labels, bool is_logscale, const bool is_origin, const int other_axislocation, const array_property &axis_lims)
void update_fontunits(const caseless_str &old_units)
void override_defaults(base_graphics_object &obj)
static void close_figure(const graphics_handle &h)
octave_value property_value
#define DECLARE_STATIC_FUNX(name, args_name, nargout_name)
OCTINTERP_API radio_values(const std::string &opt_string="")
virtual octave_value get_zlim(void) const
octave_idx_type numel(void) const
void set(const caseless_str &name, const octave_value &val)
void update_zlabel_position(void)
static graphics_event create_callback_event(const graphics_handle &h, const std::string &name, const octave_value &data=Matrix())
virtual void defaults(void) const
virtual void reset_default_properties(void)
With real return the complex result
static void execute_callback(const graphics_handle &h, const std::string &name, const octave_value &data=Matrix())
std::list< graphics_event > event_queue
octave_scalar_map as_struct(const std::string &prefix_arg) const
octave_value get_alim(void) const
octave_int< uint32_t > octave_uint32
static void cleanup_instance(void)
bool is_int32_type(void) const
void check_axis_limits(Matrix &limits, const Matrix kids, const bool logscale, char &update_type)
graphics_handle get_parent(void) const
void remove_child(const graphics_handle &h)
OCTAVE_EXPORT octave_value_list iscellstr
virtual std::string type(void) const
Matrix get_all_children(void) const
static uint32_t state[624]
graphics_handle do_make_graphics_handle(const std::string &go_name, const graphics_handle &p, bool integer_figure_handle, bool do_createfcn, bool do_notify_toolkit)
static Matrix convert_position(const Matrix &pos, const caseless_str &from_units, const caseless_str &to_units, const Matrix &parent_dim)
static octave_idx_type find(octave_idx_type i, octave_idx_type *pp)
virtual void set_defaults(const std::string &)
static Matrix default_surface_cdata(void)
octave_int< T > xmin(const octave_int< T > &x, const octave_int< T > &y)
static void magform(double x, double &a, int &b)
octave_idx_type nfields(void) const
void warning(const char *fmt,...)
void do_post_set(const graphics_handle &h, const std::string &name, const octave_value &value, bool notify_toolkit=true)
static std::map< caseless_str, graphics_object > dprop_obj_map
Matrix get_extent(bool with_text=false, bool only_text_height=false) const
void update_ylabel_position(void)
static std::string default_graphics_toolkit(void)
octave::unwind_protect frame
octave_value get_property_from_handle(double handle, const std::string &property, const std::string &func)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
N Dimensional Array with copy-on-write semantics.
void get_children_limits(double &min_val, double &max_val, double &min_pos, double &max_neg, const Matrix &kids, char limit_type)
std::string property_name
OCTINTERP_API bool validate(const octave_value &v)
charNDArray max(char d, const charNDArray &m)
Matrix get_extent(text_element *elt, double rotation=0.0)
static graphics_handle make_figure_handle(double val, bool do_notify_toolkit=true)
addproperty("my_style", gcf, "linelinestyle", "--")
octave_value get(void) const
ColumnVector extract_n(octave_idx_type r1, octave_idx_type n) const
std::set< intptr_t > m_set
const octave_char_matrix & v2
bool any_element_is_inf_or_nan(void) const
std::pair< double, bool > maxval
void update_autopos(const std::string &elem_type)
Cell values_as_cell(void) const
bool is_undefined(void) const
void do_close_all_figures(void)
void do_push_figure(const graphics_handle &h)
static void do_cleanup_waitfor_listener(const octave_value &listener, listener_mode mode=POSTSET)
static void adopt(const graphics_handle &parent_h, const graphics_handle &h)
enum color_property::current_enum current_type
double dot(const ColumnVector &v1, const ColumnVector &v2)
void insert(const callback_property *ptr)
octave_value get_colormap(void) const
virtual std::string value_as_string(const std::string &prop)
static octave_value xget(const graphics_handle &h, const caseless_str &name)
std::map< std::string, pval_map_type > plist_map_type
static octave_value convert_ticklabel_string(const octave_value &val)
void cross_product(double x1, double y1, double z1, double x2, double y2, double z2, double &x, double &y, double &z)
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the IEEE symbol NaN(Not a Number). NaN is the result of operations which do not produce a well defined 0 result. Common operations which produce a NaN are arithmetic with infinity ex($\infty - \infty$)
static void xinitialize(const graphics_handle &h)
void remove_child(const graphics_handle &h)
void push_zoom_stack(void)
uint16NDArray uint16_array_value(void) const
std::string default_value(void) const
static Matrix default_image_cdata(void)
void assign(const std::string &k, const octave_value &val)
OCTINTERP_API bool is_equal(const octave_value &v) const
static graphics_handle lookup(double val)
static OCTINTERP_API property create(const std::string &name, const graphics_handle &parent, const caseless_str &type, const octave_value_list &args)
bool is_int64_type(void) const
void add_property_listener(const std::string &nm, const octave_value &v, listener_mode mode=POSTSET)
void normalize(ColumnVector &v)
OCTINTERP_API bool set(const octave_value &v, bool do_run=true, bool do_notify_toolkit=true)
octave_map values_as_struct(void)
int do_process_events(bool force=false)
void set_value_or_default(const caseless_str &name, const octave_value &val)
octave_value lookup(const caseless_str &name) const
RowVector transpose(void) const
virtual void mark_modified(void)
static graphics_handle get_handle(bool integer_figure_handle)
std::string callback_name
double double_value(bool frc_str_conv=false) const
octave_idx_type length(void) const
bool is_zliminclude(void) const
octave_value get_color_data(void) const
int64NDArray int64_array_value(void) const
bool is_xliminclude(void) const
static void normalized_aspectratios(Matrix &aspectratios, const Matrix &scalefactors, double xlength, double ylength, double zlength)
bool contains(const callback_property *ptr) const
int8NDArray int8_array_value(void) const
the element is set to zero In other the statement xample y
static void renumber_figure(const graphics_handle &old_gh, const graphics_handle &new_gh)
virtual octave_value get_clim(void) const
void scale(Matrix &m, double x, double y, double z)
void clear_zoom_stack(bool do_unzoom=true)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
static graphics_object get_object(double val)
double get___fontsize_points__(double box_pix_height=0) const
friend class graphics_object
void update_fontunits(const caseless_str &old_fontunits)
octave::sys::file_stat fs(filename)
std::string values_as_string(void)
void add_method(T *obj, void(T::*method)(void))
ColumnVector transform(const Matrix &m, double x, double y, double z)
void do_execute_callback(const graphics_handle &h, const octave_value &cb, const octave_value &data)
static void add_event_hook(event_hook_fcn f)
bool iscomplex(void) const
void set_text_child(handle_property &h, const std::string &who, const octave_value &v)
static Matrix viridis_colormap(void)
string_vector string_vector_value(bool pad=false) const
bool is_string(void) const
void(* event_fcn)(void *)
bool is_double_type(void) const
static Matrix do_zoom(double val, double factor, const Matrix &lims, bool is_logscale)
bool is_climinclude(void) const
gtk_manager & __get_gtk_manager__(const std::string &who)
void reparent(const graphics_handle &h)
octave_idx_type ndims(void) const
Number of dimensions.
graphics_toolkit get_toolkit(void) const
void set_modified(const octave_value &val)
Matrix extract_n(octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const
octave_value get_color_data(void) const
std::string type(void) const
Matrix calc_tightbox(const Matrix &init_pos)
octave_value get_xlim(void) const
static double convert_font_size(double font_size, const caseless_str &from_units, const caseless_str &to_units, double parent_height=0)
octave_idx_type numel(void) const
Number of elements in the array.
octave_idx_type length(void) const
static Matrix screen_size_pixels(void)
graphics_object get_ancestor(const std::string &type) const
bool has_readonly_property(const caseless_str &pname) const
static octave_value_list waitfor_del_listener(const octave_value_list &args, int)
virtual octave_scalar_map values_as_struct(void)
Vector representing the dimensions (size) of an Array.
static bool delete_executing
bool discard_error_messages
static bool is_thread(void)
property_list get_factory_defaults_list(void) const
bool is_uint8_type(void) const
std::string values_as_string(void) const
Cell loaded_toolkits_list(void) const
Matrix get_ticklabel_extents(const Matrix &ticks, const string_vector &ticklabels, const Matrix &limits)
void update_units(const caseless_str &old_units)
std::string type_name(void) const
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
nd group nd example For each display the value
static bool updating_title_position
virtual std::string values_as_string(void)
static Matrix default_surface_zdata(void)
static void xcreatefcn(const graphics_handle &h)
static bool is_handle_visible(const graphics_handle &h)
Cell cell_value(void) const
NDArray array_value(bool frc_str_conv=false) const
bool isnumeric(void) const
plist_map_type::const_iterator plist_map_const_iterator
bool is_matrix_type(void) const
void set_parent(const octave_value &val)
Matrix matrix_value(bool frc_str_conv=false) const
void xform(ColumnVector &v, const Matrix &m)
static graphics_handle current_figure(void)
static void finalize_r(const graphics_handle &h)
void set_from_list(base_graphics_object &obj, property_list &defaults)
void translate(Matrix &m, double x, double y, double z)
where the brackets indicate optional arguments and and character or cell array For character arrays the conversion is repeated for every row
uint8NDArray uint8_array_value(void) const
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x
static ColumnVector convert_label_position(const ColumnVector &p, const text::properties &props, const graphics_xform &xform, const Matrix &bbox)
static void delete_graphics_objects(const NDArray vals)
void update_fontunits(const caseless_str &old_fontunits)
charNDArray min(char d, const charNDArray &m)
ColumnVector row_min(void) const
virtual property get_property(const caseless_str &pname)
static Matrix default_patch_faces(void)
static void create_instance(void)
void resize(octave_idx_type n, const double &rfv=0)
OCTINTERP_API bool do_set(const octave_value &v)
OCTINTERP_API void get_data_limits(void)
static void xreset_default_properties(graphics_handle h, property_list::pval_map_type factory_pval)
void F(const TSRC *v, TRES *r, octave_idx_type m, octave_idx_type n)
std::set< std::string > dynamic_property_names(void) const
static int process_events(void)
bool is_uint16_type(void) const
#define OCTAVE_DEFAULT_FONTNAME