Mercurial > octave-nkf
comparison libinterp/corefcn/graphics.cc @ 19631:db92e7e28e1f
strip trailing whitespace from most source files
* NEWS, doc/interpreter/contributors.in, doc/interpreter/func.txi,
doc/interpreter/genpropdoc.m, doc/interpreter/octave_logo.eps,
doc/interpreter/plot.txi, doc/interpreter/stmt.txi,
examples/data/Makefile.am, libinterp/corefcn/data.cc,
libinterp/corefcn/debug.cc, libinterp/corefcn/error.cc,
libinterp/corefcn/file-io.cc, libinterp/corefcn/gl-render.cc,
libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h,
libinterp/corefcn/load-path.cc, libinterp/corefcn/pr-output.cc,
libinterp/corefcn/pt-jit.cc, libinterp/corefcn/strfind.cc,
libinterp/corefcn/toplev.cc, libinterp/corefcn/toplev.h,
libinterp/corefcn/urlwrite.cc, libinterp/corefcn/variables.cc,
libinterp/octave-value/ov-classdef.cc,
libinterp/octave-value/ov-classdef.h, libinterp/octave.cc,
libinterp/parse-tree/lex.h, libinterp/parse-tree/oct-parse.in.yy,
libinterp/parse-tree/pt-classdef.h, liboctave/system/file-ops.cc,
liboctave/system/oct-env.cc, m4/acinclude.m4,
scripts/deprecated/finite.m, scripts/deprecated/fmod.m,
scripts/deprecated/fnmatch.m, scripts/deprecated/luinc.m,
scripts/deprecated/octave_tmp_file_name.m, scripts/deprecated/syl.m,
scripts/deprecated/usage.m, scripts/general/inputParser.m,
scripts/general/interp1.m, scripts/general/interp2.m,
scripts/general/interp3.m, scripts/general/isequal.m,
scripts/general/private/__isequal__.m, scripts/geometry/voronoi.m,
scripts/image/image.m, scripts/image/imshow.m,
scripts/image/ind2rgb.m, scripts/linear-algebra/bandwidth.m,
scripts/linear-algebra/isbanded.m, scripts/miscellaneous/bzip2.m,
scripts/miscellaneous/cast.m, scripts/miscellaneous/copyfile.m,
scripts/miscellaneous/delete.m, scripts/miscellaneous/fullfile.m,
scripts/miscellaneous/getappdata.m, scripts/miscellaneous/gunzip.m,
scripts/miscellaneous/isappdata.m, scripts/miscellaneous/ls.m,
scripts/miscellaneous/mex.m, scripts/miscellaneous/movefile.m,
scripts/miscellaneous/orderfields.m, scripts/miscellaneous/recycle.m,
scripts/miscellaneous/rmappdata.m, scripts/miscellaneous/setfield.m,
scripts/miscellaneous/symvar.m, scripts/miscellaneous/tar.m,
scripts/miscellaneous/tmpnam.m, scripts/miscellaneous/unpack.m,
scripts/miscellaneous/ver.m, scripts/miscellaneous/what.m,
scripts/miscellaneous/xor.m, scripts/miscellaneous/zip.m,
scripts/optimization/fminbnd.m, scripts/optimization/sqp.m,
scripts/path/private/getsavepath.m, scripts/path/savepath.m,
scripts/pkg/pkg.m, scripts/pkg/private/installed_packages.m,
scripts/plot/draw/plotyy.m, scripts/plot/draw/polar.m,
scripts/plot/draw/private/__quiver__.m,
scripts/plot/draw/private/__scatter__.m,
scripts/plot/draw/private/__stem__.m, scripts/plot/draw/surface.m,
scripts/plot/draw/surfnorm.m, scripts/plot/util/copyobj.m,
scripts/plot/util/hgload.m, scripts/plot/util/hgsave.m,
scripts/plot/util/isprop.m, scripts/plot/util/linkprop.m,
scripts/plot/util/private/__go_draw_axes__.m, scripts/set/setdiff.m,
scripts/set/union.m, scripts/signal/periodogram.m,
scripts/sparse/eigs.m, scripts/sparse/ilu.m, scripts/sparse/qmr.m,
scripts/sparse/sprand.m, scripts/sparse/sprandn.m,
scripts/specfun/beta.m, scripts/specfun/ellipke.m,
scripts/specfun/isprime.m, scripts/statistics/base/lscov.m,
scripts/testfun/__run_test_suite__.m, scripts/testfun/test.m:
Strip trailing whitespace.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 20 Jan 2015 10:29:54 -0500 |
parents | 0e1f5a750d00 |
children | 408361a8c72f |
comparison
equal
deleted
inserted
replaced
19630:0e1f5a750d00 | 19631:db92e7e28e1f |
---|---|
2771 // Don't reset internal properties and handle_properties | 2771 // Don't reset internal properties and handle_properties |
2772 if (! obj.has_readonly_property (pname) && | 2772 if (! obj.has_readonly_property (pname) && |
2773 pname.find ("__") != 0 && pname.find ("current") != 0 && | 2773 pname.find ("__") != 0 && pname.find ("current") != 0 && |
2774 pname != "uicontextmenu" && pname != "parent") | 2774 pname != "uicontextmenu" && pname != "parent") |
2775 { | 2775 { |
2776 // Store *mode prop/val in order to set them last | 2776 // Store *mode prop/val in order to set them last |
2777 if (pname.find ("mode") == (pname.length () - 4)) | 2777 if (pname.find ("mode") == (pname.length () - 4)) |
2778 pval[pname] = it->second; | 2778 pval[pname] = it->second; |
2779 else | 2779 else |
2780 obj.set (pname, it->second); | 2780 obj.set (pname, it->second); |
2781 } | 2781 } |
2934 { | 2934 { |
2935 // Remove child from current parent | 2935 // Remove child from current parent |
2936 graphics_object old_parent_obj; | 2936 graphics_object old_parent_obj; |
2937 old_parent_obj = gh_manager::get_object (get_parent ()); | 2937 old_parent_obj = gh_manager::get_object (get_parent ()); |
2938 | 2938 |
2939 | 2939 |
2940 if (old_parent_obj.get_handle () != hnp) | 2940 if (old_parent_obj.get_handle () != hnp) |
2941 old_parent_obj.remove_child (__myhandle__); | 2941 old_parent_obj.remove_child (__myhandle__); |
2942 else | 2942 else |
2943 // Do nothing more | 2943 // Do nothing more |
2944 return; | 2944 return; |
2945 | 2945 |
3132 if (! error_state && p.ok ()) | 3132 if (! error_state && p.ok ()) |
3133 p.delete_listener (); | 3133 p.delete_listener (); |
3134 } | 3134 } |
3135 } | 3135 } |
3136 | 3136 |
3137 void | 3137 void |
3138 base_graphics_object::reset_default_properties (void) | 3138 base_graphics_object::reset_default_properties (void) |
3139 { | 3139 { |
3140 if (valid_object ()) | 3140 if (valid_object ()) |
3141 { | 3141 { |
3142 property_list::pval_map_type factory_pval = | 3142 property_list::pval_map_type factory_pval = |
3143 gh_manager::get_object (0).get_factory_defaults_list () | 3143 gh_manager::get_object (0).get_factory_defaults_list () |
3144 .find (type ())->second; | 3144 .find (type ())->second; |
3145 | 3145 |
3146 xreset_default_properties (get_handle (), factory_pval); | 3146 xreset_default_properties (get_handle (), factory_pval); |
3147 | 3147 |
3148 override_defaults (*this); | 3148 override_defaults (*this); |
3149 } | 3149 } |
3150 } | 3150 } |
3350 { | 3350 { |
3351 if (! error_state) | 3351 if (! error_state) |
3352 { | 3352 { |
3353 // Input checking and abrev. matching | 3353 // Input checking and abrev. matching |
3354 diary.set (val, false); | 3354 diary.set (val, false); |
3355 | 3355 |
3356 if (! error_state) | 3356 if (! error_state) |
3357 { | 3357 { |
3358 Fdiary (ovl (diary.current_value ())); | 3358 Fdiary (ovl (diary.current_value ())); |
3359 | 3359 |
3360 diary.run_listeners (); | 3360 diary.run_listeners (); |
3373 { | 3373 { |
3374 if (! error_state) | 3374 if (! error_state) |
3375 { | 3375 { |
3376 // Input checking and abrev. matching | 3376 // Input checking and abrev. matching |
3377 diaryfile.set (val, false); | 3377 diaryfile.set (val, false); |
3378 | 3378 |
3379 if (! error_state) | 3379 if (! error_state) |
3380 { | 3380 { |
3381 Fdiary (ovl (diaryfile.string_value ())); | 3381 Fdiary (ovl (diaryfile.string_value ())); |
3382 | 3382 |
3383 diaryfile.run_listeners (); | 3383 diaryfile.run_listeners (); |
3400 { | 3400 { |
3401 if (! error_state) | 3401 if (! error_state) |
3402 { | 3402 { |
3403 // Input checking and abrev. matching | 3403 // Input checking and abrev. matching |
3404 echo.set (val, false); | 3404 echo.set (val, false); |
3405 | 3405 |
3406 if (! error_state) | 3406 if (! error_state) |
3407 { | 3407 { |
3408 Fecho (ovl (echo.current_value ())); | 3408 Fecho (ovl (echo.current_value ())); |
3409 | 3409 |
3410 echo.run_listeners (); | 3410 echo.run_listeners (); |
3429 { | 3429 { |
3430 if (! error_state) | 3430 if (! error_state) |
3431 { | 3431 { |
3432 // Input checking and abrev. matching | 3432 // Input checking and abrev. matching |
3433 format.set (val, false); | 3433 format.set (val, false); |
3434 | 3434 |
3435 if (! error_state) | 3435 if (! error_state) |
3436 { | 3436 { |
3437 Fformat (ovl (format.current_value ())); | 3437 Fformat (ovl (format.current_value ())); |
3438 | 3438 |
3439 format.run_listeners (); | 3439 format.run_listeners (); |
3440 } | 3440 } |
3441 } | 3441 } |
3442 } | 3442 } |
3456 { | 3456 { |
3457 if (! error_state) | 3457 if (! error_state) |
3458 { | 3458 { |
3459 // Input checking and abrev. matching | 3459 // Input checking and abrev. matching |
3460 formatspacing.set (val, false); | 3460 formatspacing.set (val, false); |
3461 | 3461 |
3462 if (! error_state) | 3462 if (! error_state) |
3463 { | 3463 { |
3464 std::string strval = formatspacing.current_value (); | 3464 std::string strval = formatspacing.current_value (); |
3465 | 3465 |
3466 if (strval == "compact") | 3466 if (strval == "compact") |
3485 { | 3485 { |
3486 if (! error_state) | 3486 if (! error_state) |
3487 { | 3487 { |
3488 // Input checking and abrev. matching | 3488 // Input checking and abrev. matching |
3489 recursionlimit.set (val, false); | 3489 recursionlimit.set (val, false); |
3490 | 3490 |
3491 if (! error_state) | 3491 if (! error_state) |
3492 { | 3492 { |
3493 double dval = recursionlimit.double_value (); | 3493 double dval = recursionlimit.double_value (); |
3494 | 3494 |
3495 Fmax_recursion_depth (ovl (dval)); | 3495 Fmax_recursion_depth (ovl (dval)); |
3637 root_figure::reset_default_properties (void) | 3637 root_figure::reset_default_properties (void) |
3638 { | 3638 { |
3639 // empty list of local defaults | 3639 // empty list of local defaults |
3640 default_properties = property_list (); | 3640 default_properties = property_list (); |
3641 | 3641 |
3642 xreset_default_properties (get_handle (), | 3642 xreset_default_properties (get_handle (), |
3643 xproperties.factory_defaults ()); | 3643 xproperties.factory_defaults ()); |
3644 } | 3644 } |
3645 | 3645 |
3646 // --------------------------------------------------------------------- | 3646 // --------------------------------------------------------------------- |
3647 | 3647 |
3685 | 3685 |
3686 currentaxes = new_currentaxes; | 3686 currentaxes = new_currentaxes; |
3687 } | 3687 } |
3688 } | 3688 } |
3689 | 3689 |
3690 void | 3690 void |
3691 figure::properties::adopt (const graphics_handle& h) | 3691 figure::properties::adopt (const graphics_handle& h) |
3692 { | 3692 { |
3693 base_properties::adopt (h); | 3693 base_properties::adopt (h); |
3694 | 3694 |
3695 if (! get_currentaxes ().ok ()) | 3695 if (! get_currentaxes ().ok ()) |
3827 if (modified) | 3827 if (modified) |
3828 { | 3828 { |
3829 position.run_listeners (POSTSET); | 3829 position.run_listeners (POSTSET); |
3830 mark_modified (); | 3830 mark_modified (); |
3831 } | 3831 } |
3832 | 3832 |
3833 if (paperpositionmode.is ("auto")) | 3833 if (paperpositionmode.is ("auto")) |
3834 paperposition.set (get_auto_paperposition ()); | 3834 paperposition.set (get_auto_paperposition ()); |
3835 } | 3835 } |
3836 } | 3836 } |
3837 | 3837 |
4055 Matrix | 4055 Matrix |
4056 figure::properties::get_auto_paperposition (void) | 4056 figure::properties::get_auto_paperposition (void) |
4057 { | 4057 { |
4058 Matrix pos = get_position ().matrix_value (); | 4058 Matrix pos = get_position ().matrix_value (); |
4059 Matrix sz; | 4059 Matrix sz; |
4060 | 4060 |
4061 caseless_str funits = get_units (); | 4061 caseless_str funits = get_units (); |
4062 caseless_str punits = get_paperunits (); | 4062 caseless_str punits = get_paperunits (); |
4063 | 4063 |
4064 // Convert position from figure units to paperunits | 4064 // Convert position from figure units to paperunits |
4065 if (funits == "normalized" || punits == "normalized") | 4065 if (funits == "normalized" || punits == "normalized") |
4066 { | 4066 { |
4067 sz = screen_size_pixels (); | 4067 sz = screen_size_pixels (); |
4068 pos = convert_position (pos, funits, "inches", sz); | 4068 pos = convert_position (pos, funits, "inches", sz); |
4069 | 4069 |
4088 %!test | 4088 %!test |
4089 %! hf = figure ("visible", "off", "paperpositionmode", "auto"); | 4089 %! hf = figure ("visible", "off", "paperpositionmode", "auto"); |
4090 %! in_pos = [0 0 4 5]; | 4090 %! in_pos = [0 0 4 5]; |
4091 %! tol = 20 * eps (); | 4091 %! tol = 20 * eps (); |
4092 %! unwind_protect | 4092 %! unwind_protect |
4093 %! ## paperpositionmode "auto" converts figure size to paper units | 4093 %! ## paperpositionmode "auto" converts figure size to paper units |
4094 %! set (hf, "units", "inches"); | 4094 %! set (hf, "units", "inches"); |
4095 %! set (hf, "position", in_pos); | 4095 %! set (hf, "position", in_pos); |
4096 %! set (hf, "paperunits", "centimeters"); | 4096 %! set (hf, "paperunits", "centimeters"); |
4097 %! psz = get (hf, "papersize"); | 4097 %! psz = get (hf, "papersize"); |
4098 %! fsz = in_pos(3:4) * 2.54; | 4098 %! fsz = in_pos(3:4) * 2.54; |
4099 %! pos = [(psz/2 .- fsz/2) fsz]; | 4099 %! pos = [(psz/2 .- fsz/2) fsz]; |
4100 %! set (hf, "paperpositionmode", "auto"); | 4100 %! set (hf, "paperpositionmode", "auto"); |
4101 %! assert (get (hf, "paperposition"), pos, tol) | 4101 %! assert (get (hf, "paperposition"), pos, tol) |
4102 %! unwind_protect_cleanup | 4102 %! unwind_protect_cleanup |
4103 %! close (hf); | 4103 %! close (hf); |
4104 %! end_unwind_protect | 4104 %! end_unwind_protect |
4106 %!test | 4106 %!test |
4107 %! hf = figure ("visible", "off", "paperpositionmode", "auto"); | 4107 %! hf = figure ("visible", "off", "paperpositionmode", "auto"); |
4108 %! in_pos = [0 0 4 5]; | 4108 %! in_pos = [0 0 4 5]; |
4109 %! tol = 20 * eps (); | 4109 %! tol = 20 * eps (); |
4110 %! unwind_protect | 4110 %! unwind_protect |
4111 %! ## likewise with normalized units | 4111 %! ## likewise with normalized units |
4112 %! set (hf, "units", "inches"); | 4112 %! set (hf, "units", "inches"); |
4113 %! set (hf, "position", in_pos); | 4113 %! set (hf, "position", in_pos); |
4114 %! psz = get (hf, "papersize"); | 4114 %! psz = get (hf, "papersize"); |
4115 %! set (hf, "paperunits", "normalized"); | 4115 %! set (hf, "paperunits", "normalized"); |
4116 %! fsz = in_pos(3:4) ./ psz; | 4116 %! fsz = in_pos(3:4) ./ psz; |
4117 %! pos = [([0.5 0.5] .- fsz/2) fsz]; | 4117 %! pos = [([0.5 0.5] .- fsz/2) fsz]; |
4118 %! assert (get (hf, "paperposition"), pos, tol) | 4118 %! assert (get (hf, "paperposition"), pos, tol) |
4119 %! unwind_protect_cleanup | 4119 %! unwind_protect_cleanup |
4120 %! close (hf); | 4120 %! close (hf); |
4121 %! end_unwind_protect | 4121 %! end_unwind_protect |
4122 | 4122 |
4123 %!test | 4123 %!test |
4124 %! hf = figure ("visible", "off", "paperpositionmode", "auto"); | 4124 %! hf = figure ("visible", "off", "paperpositionmode", "auto"); |
4125 %! in_pos = [0 0 4 5]; | 4125 %! in_pos = [0 0 4 5]; |
4126 %! tol = 20 * eps (); | 4126 %! tol = 20 * eps (); |
4127 %! unwind_protect | 4127 %! unwind_protect |
4128 %! ## changing papertype updates paperposition | 4128 %! ## changing papertype updates paperposition |
4129 %! set (hf, "units", "inches"); | 4129 %! set (hf, "units", "inches"); |
4130 %! set (hf, "position", in_pos); | 4130 %! set (hf, "position", in_pos); |
4131 %! set (hf, "papertype", "a4"); | 4131 %! set (hf, "papertype", "a4"); |
4132 %! psz = get (hf, "papersize"); | 4132 %! psz = get (hf, "papersize"); |
4133 %! fsz = in_pos(3:4); | 4133 %! fsz = in_pos(3:4); |
4134 %! pos = [(psz/2 .- fsz/2) fsz]; | 4134 %! pos = [(psz/2 .- fsz/2) fsz]; |
4135 %! assert (get (hf, "paperposition"), pos, tol) | 4135 %! assert (get (hf, "paperposition"), pos, tol) |
4136 %! unwind_protect_cleanup | 4136 %! unwind_protect_cleanup |
4137 %! close (hf); | 4137 %! close (hf); |
4138 %! end_unwind_protect | 4138 %! end_unwind_protect |
4139 | 4139 |
4146 %! set (hf, "units", "inches"); | 4146 %! set (hf, "units", "inches"); |
4147 %! set (hf, "position", in_pos); | 4147 %! set (hf, "position", in_pos); |
4148 %! set (hf, "paperorientation", "landscape"); | 4148 %! set (hf, "paperorientation", "landscape"); |
4149 %! psz = get (hf, "papersize"); | 4149 %! psz = get (hf, "papersize"); |
4150 %! fsz = in_pos(3:4); | 4150 %! fsz = in_pos(3:4); |
4151 %! pos = [(psz/2 .- fsz/2) fsz]; | 4151 %! pos = [(psz/2 .- fsz/2) fsz]; |
4152 %! assert (get (hf, "paperposition"), pos, tol) | 4152 %! assert (get (hf, "paperposition"), pos, tol) |
4153 %! unwind_protect_cleanup | 4153 %! unwind_protect_cleanup |
4154 %! close (hf); | 4154 %! close (hf); |
4155 %! end_unwind_protect | 4155 %! end_unwind_protect |
4156 | 4156 |
4969 { | 4969 { |
4970 outerposition = default_axes_outerposition (); | 4970 outerposition = default_axes_outerposition (); |
4971 position = default_axes_position (); | 4971 position = default_axes_position (); |
4972 activepositionproperty = "outerposition"; | 4972 activepositionproperty = "outerposition"; |
4973 } | 4973 } |
4974 | 4974 |
4975 if (mode != "reset") | 4975 if (mode != "reset") |
4976 { | 4976 { |
4977 delete_children (true); | 4977 delete_children (true); |
4978 | 4978 |
4979 xlabel = gh_manager::make_graphics_handle ("text", __myhandle__, | 4979 xlabel = gh_manager::make_graphics_handle ("text", __myhandle__, |
6877 lo = std::log10 (lo); | 6877 lo = std::log10 (lo); |
6878 } | 6878 } |
6879 } | 6879 } |
6880 | 6880 |
6881 double tick_sep; | 6881 double tick_sep; |
6882 | 6882 |
6883 if (is_logscale) | 6883 if (is_logscale) |
6884 { | 6884 { |
6885 if (! (xisinf (hi) || xisinf (lo))) | 6885 if (! (xisinf (hi) || xisinf (lo))) |
6886 tick_sep = 1; // Tick is every order of magnitude (bug #39449) | 6886 tick_sep = 1; // Tick is every order of magnitude (bug #39449) |
6887 else | 6887 else |
7130 | 7130 |
7131 void | 7131 void |
7132 axes::update_axis_limits (const std::string& axis_type, | 7132 axes::update_axis_limits (const std::string& axis_type, |
7133 const graphics_handle& h) | 7133 const graphics_handle& h) |
7134 { | 7134 { |
7135 if (updating_axis_limits.find (get_handle ().value ()) != | 7135 if (updating_axis_limits.find (get_handle ().value ()) != |
7136 updating_axis_limits.end ()) | 7136 updating_axis_limits.end ()) |
7137 return; | 7137 return; |
7138 | 7138 |
7139 Matrix kids = Matrix (1, 1, h.value ()); | 7139 Matrix kids = Matrix (1, 1, h.value ()); |
7140 | 7140 |
7333 } | 7333 } |
7334 | 7334 |
7335 void | 7335 void |
7336 axes::update_axis_limits (const std::string& axis_type) | 7336 axes::update_axis_limits (const std::string& axis_type) |
7337 { | 7337 { |
7338 if ((updating_axis_limits.find (get_handle ().value ()) != | 7338 if ((updating_axis_limits.find (get_handle ().value ()) != |
7339 updating_axis_limits.end ()) || | 7339 updating_axis_limits.end ()) || |
7340 (updating_aspectratios.find (get_handle ().value ()) != | 7340 (updating_aspectratios.find (get_handle ().value ()) != |
7341 updating_aspectratios.end ())) | 7341 updating_aspectratios.end ())) |
7342 return; | 7342 return; |
7343 | 7343 |
8007 Matrix yd = get_ydata ().matrix_value (); | 8007 Matrix yd = get_ydata ().matrix_value (); |
8008 Matrix zd = get_zdata ().matrix_value (); | 8008 Matrix zd = get_zdata ().matrix_value (); |
8009 NDArray cd = get_cdata ().array_value (); | 8009 NDArray cd = get_cdata ().array_value (); |
8010 | 8010 |
8011 bad_data_msg = std::string (); | 8011 bad_data_msg = std::string (); |
8012 if (xd.dims () != yd.dims () || | 8012 if (xd.dims () != yd.dims () || |
8013 (xd.dims () != zd.dims () && ! zd.is_empty ())) | 8013 (xd.dims () != zd.dims () && ! zd.is_empty ())) |
8014 { | 8014 { |
8015 bad_data_msg = "x/y/zdata should have the same dimensions"; | 8015 bad_data_msg = "x/y/zdata should have the same dimensions"; |
8016 return; | 8016 return; |
8017 } | 8017 } |
8119 else | 8119 else |
8120 valid_vert = idx(ii,jj); | 8120 valid_vert = idx(ii,jj); |
8121 } | 8121 } |
8122 } | 8122 } |
8123 } | 8123 } |
8124 | 8124 |
8125 // Build cdata | 8125 // Build cdata |
8126 dim_vector dv = dim_vector::alloc (3); | 8126 dim_vector dv = dim_vector::alloc (3); |
8127 NDArray cd; | 8127 NDArray cd; |
8128 bool pervertex = false; | 8128 bool pervertex = false; |
8129 | 8129 |
8132 dv(0) = 1; | 8132 dv(0) = 1; |
8133 dv(1) = fvc.rows (); | 8133 dv(1) = fvc.rows (); |
8134 dv(2) = fvc.columns (); | 8134 dv(2) = fvc.columns (); |
8135 cd = fvc.reshape (dv); | 8135 cd = fvc.reshape (dv); |
8136 } | 8136 } |
8137 else | 8137 else |
8138 { | 8138 { |
8139 if (! fvc.is_empty ()) | 8139 if (! fvc.is_empty ()) |
8140 { | 8140 { |
8141 dv(0) = idx.rows (); | 8141 dv(0) = idx.rows (); |
8142 dv(1) = nfaces; | 8142 dv(1) = nfaces; |
8144 cd.resize (dv); | 8144 cd.resize (dv); |
8145 pervertex = true; | 8145 pervertex = true; |
8146 } | 8146 } |
8147 } | 8147 } |
8148 | 8148 |
8149 // Build x,y,zdata and eventually per vertex cdata | 8149 // Build x,y,zdata and eventually per vertex cdata |
8150 Matrix xd (idx.dims ()); | 8150 Matrix xd (idx.dims ()); |
8151 Matrix yd (idx.dims ()); | 8151 Matrix yd (idx.dims ()); |
8152 Matrix zd; | 8152 Matrix zd; |
8153 bool has_zd = false; | 8153 bool has_zd = false; |
8154 if (vert.columns () > 2) | 8154 if (vert.columns () > 2) |
8155 { | 8155 { |
8156 zd = Matrix (idx.dims ()); | 8156 zd = Matrix (idx.dims ()); |
8157 has_zd = true; | 8157 has_zd = true; |
8158 } | 8158 } |
8159 | 8159 |
8160 | 8160 |
8161 for (octave_idx_type jj = 0; jj < nfaces; jj++) | 8161 for (octave_idx_type jj = 0; jj < nfaces; jj++) |
8162 { | 8162 { |
8163 for (octave_idx_type ii = 0; ii < idx.rows (); ii++) | 8163 for (octave_idx_type ii = 0; ii < idx.rows (); ii++) |
8164 { | 8164 { |
8165 octave_idx_type row = static_cast<octave_idx_type> (idx(ii,jj)-1); | 8165 octave_idx_type row = static_cast<octave_idx_type> (idx(ii,jj)-1); |
8166 xd(ii,jj) = vert(row,0); | 8166 xd(ii,jj) = vert(row,0); |
8167 yd(ii,jj) = vert(row,1); | 8167 yd(ii,jj) = vert(row,1); |
8168 | 8168 |
8169 if (has_zd) | 8169 if (has_zd) |
8170 zd(ii,jj) = vert(row,2); | 8170 zd(ii,jj) = vert(row,2); |
8171 | 8171 |
8172 if (pervertex) | 8172 if (pervertex) |
8173 for (int kk = 0; kk < fvc.columns (); kk++) | 8173 for (int kk = 0; kk < fvc.columns (); kk++) |
8174 cd(ii,jj,kk) = fvc(row,kk); | 8174 cd(ii,jj,kk) = fvc(row,kk); |
8175 } | 8175 } |
8176 } | 8176 } |
8827 uitoolbar::reset_default_properties (void) | 8827 uitoolbar::reset_default_properties (void) |
8828 { | 8828 { |
8829 // empty list of local defaults | 8829 // empty list of local defaults |
8830 default_properties = property_list (); | 8830 default_properties = property_list (); |
8831 | 8831 |
8832 xreset_default_properties (get_handle (), | 8832 xreset_default_properties (get_handle (), |
8833 xproperties.factory_defaults ()); | 8833 xproperties.factory_defaults ()); |
8834 | 8834 |
8835 // override with parents' defaults | 8835 // override with parents' defaults |
8836 override_defaults (*this); | 8836 override_defaults (*this); |
8837 } | 8837 } |
9500 %!test # line object | 9500 %!test # line object |
9501 %! hf = figure ("visible", "off"); | 9501 %! hf = figure ("visible", "off"); |
9502 %! unwind_protect | 9502 %! unwind_protect |
9503 %! tol = 20 * eps; | 9503 %! tol = 20 * eps; |
9504 %! hax = axes ("defaultlinelinewidth", 3); | 9504 %! hax = axes ("defaultlinelinewidth", 3); |
9505 %! | 9505 %! |
9506 %! hli = line (1:10, 1:10, 1:10, "marker", "o", | 9506 %! hli = line (1:10, 1:10, 1:10, "marker", "o", |
9507 %! "markerfacecolor", "b", "linestyle", ":"); | 9507 %! "markerfacecolor", "b", "linestyle", ":"); |
9508 %! | 9508 %! |
9509 %! reset (hli); | 9509 %! reset (hli); |
9510 %! assert (get (hli, "marker"), get (0, "defaultlinemarker")); | 9510 %! assert (get (hli, "marker"), get (0, "defaultlinemarker")); |
9511 %! assert (get (hli, "markerfacecolor"), | 9511 %! assert (get (hli, "markerfacecolor"), |
9512 %! get (0, "defaultlinemarkerfacecolor")); | 9512 %! get (0, "defaultlinemarkerfacecolor")); |
9513 %! assert (get (hli, "linestyle"), | 9513 %! assert (get (hli, "linestyle"), |
9514 %! get (0, "defaultlinelinestyle")); | 9514 %! get (0, "defaultlinelinestyle")); |
9515 %! assert (get (hli, "linewidth"), 3, tol); # parent axes defaults | 9515 %! assert (get (hli, "linewidth"), 3, tol); # parent axes defaults |
9516 %! | 9516 %! |
9517 %! unwind_protect_cleanup | 9517 %! unwind_protect_cleanup |
9518 %! close (hf); | 9518 %! close (hf); |
9519 %! end_unwind_protect | 9519 %! end_unwind_protect |
9520 | 9520 |
9521 %!test # patch object | 9521 %!test # patch object |
9558 %! end_unwind_protect | 9558 %! end_unwind_protect |
9559 | 9559 |
9560 %!test # image object | 9560 %!test # image object |
9561 %! hf = figure ("visible", "off"); | 9561 %! hf = figure ("visible", "off"); |
9562 %! unwind_protect | 9562 %! unwind_protect |
9563 %! tol = 20 * eps; | 9563 %! tol = 20 * eps; |
9564 %! him = image (rand (10,10), "cdatamapping", "scaled"); | 9564 %! him = image (rand (10,10), "cdatamapping", "scaled"); |
9565 %! | 9565 %! |
9566 %! reset (him); | 9566 %! reset (him); |
9567 %! assert (get (him, "cdata"), get (0, "defaultimagecdata"), tol); | 9567 %! assert (get (him, "cdata"), get (0, "defaultimagecdata"), tol); |
9568 %! assert (get (him, "cdatamapping"), | 9568 %! assert (get (him, "cdatamapping"), |
9572 %! end_unwind_protect | 9572 %! end_unwind_protect |
9573 | 9573 |
9574 %!test # text object | 9574 %!test # text object |
9575 %! hf = figure ("visible", "off"); | 9575 %! hf = figure ("visible", "off"); |
9576 %! unwind_protect | 9576 %! unwind_protect |
9577 %! tol = 20 * eps; | 9577 %! tol = 20 * eps; |
9578 %! hte = text (5, 5, "Hi!", "fontsize", 20 ,"color", "r"); | 9578 %! hte = text (5, 5, "Hi!", "fontsize", 20 ,"color", "r"); |
9579 %! | 9579 %! |
9580 %! reset (hte); | 9580 %! reset (hte); |
9581 %! assert (get (hte, "position"), get (0, "defaulttextposition"), tol); | 9581 %! assert (get (hte, "position"), get (0, "defaulttextposition"), tol); |
9582 %! assert (get (hte, "fontsize"), get (0, "defaulttextfontsize"), tol); | 9582 %! assert (get (hte, "fontsize"), get (0, "defaulttextfontsize"), tol); |
9583 %! assert (get (hte, "color"), get (0, "defaulttextcolor"), tol); | 9583 %! assert (get (hte, "color"), get (0, "defaulttextcolor"), tol); |
9584 %! unwind_protect_cleanup | 9584 %! unwind_protect_cleanup |
9585 %! close (hf); | 9585 %! close (hf); |
9586 %! end_unwind_protect | 9586 %! end_unwind_protect |
9587 | 9587 |
9588 %!test # axes object | 9588 %!test # axes object |
9589 %! hf = figure ("visible", "off"); | 9589 %! hf = figure ("visible", "off"); |
9590 %! unwind_protect | 9590 %! unwind_protect |
9591 %! tol = 20 * eps; | 9591 %! tol = 20 * eps; |
9592 %! pos = get (0, "defaultaxesposition") * .5; | 9592 %! pos = get (0, "defaultaxesposition") * .5; |
9593 %! hax = axes ("linewidth", 2, "position", pos); | 9593 %! hax = axes ("linewidth", 2, "position", pos); |
9594 %! title ("Reset me, please!"); | 9594 %! title ("Reset me, please!"); |
9595 %! | 9595 %! |
9596 %! reset (hax); | 9596 %! reset (hax); |
9597 %! assert (get (hax, "linewidth"), get (0, "defaultaxeslinewidth"), tol); | 9597 %! assert (get (hax, "linewidth"), get (0, "defaultaxeslinewidth"), tol); |
9598 %! assert (get (hax, "position"), pos, tol); # axes position is unchanged | 9598 %! assert (get (hax, "position"), pos, tol); # axes position is unchanged |
9599 %! assert (get (hax, "default"), struct ()); # no more axes' defaults | 9599 %! assert (get (hax, "default"), struct ()); # no more axes' defaults |
9600 %! assert (get (get (hax, "title"), "string"), ""); | 9600 %! assert (get (get (hax, "title"), "string"), ""); |
9602 %! close (hf); | 9602 %! close (hf); |
9603 %! end_unwind_protect | 9603 %! end_unwind_protect |
9604 | 9604 |
9605 %!test # root figure object | 9605 %!test # root figure object |
9606 %! set (0, "defaultfigurevisible", "off"); | 9606 %! set (0, "defaultfigurevisible", "off"); |
9607 %! hf = figure ("visible", "off", "paperunits", "centimeters", | 9607 %! hf = figure ("visible", "off", "paperunits", "centimeters", |
9608 %! "papertype", "a4"); | 9608 %! "papertype", "a4"); |
9609 %! unwind_protect | 9609 %! unwind_protect |
9610 %! reset (hf); | 9610 %! reset (hf); |
9611 %! assert (get (hf, "papertype"), get (0, "defaultfigurepapertype")); | 9611 %! assert (get (hf, "papertype"), get (0, "defaultfigurepapertype")); |
9612 %! assert (get (hf, "paperunits"), "centimeters"); # paperunits is unchanged | 9612 %! assert (get (hf, "paperunits"), "centimeters"); # paperunits is unchanged |
9730 obj.set (args(1).map_value ()); | 9730 obj.set (args(1).map_value ()); |
9731 } | 9731 } |
9732 else if (nargin == 2 && args(1).is_string ()) | 9732 else if (nargin == 2 && args(1).is_string ()) |
9733 { | 9733 { |
9734 std::string property = args(1).string_value (); | 9734 std::string property = args(1).string_value (); |
9735 | 9735 |
9736 octave_map pmap = obj.values_as_struct (); | 9736 octave_map pmap = obj.values_as_struct (); |
9737 | 9737 |
9738 if (obj.has_readonly_property (property)) | 9738 if (obj.has_readonly_property (property)) |
9739 if (nargout != 0) | 9739 if (nargout != 0) |
9740 retval = Matrix (); | 9740 retval = Matrix (); |