Mercurial > hg > octave-nkf
diff libinterp/corefcn/graphics.cc @ 17564:234731d524c2
axis.m: Fix 'axis tight' with pcolor plots.
* libinterp/corefcn/graphics.cc(calc_dimensions): Use if/else if tree to avoid
unnecessary comparisons once object has been determined to be 3-D.
* libinterp/corefcn/graphics.cc(F__calc_dimensions__): Put input validation first.
* scripts/plot/axis.m: Check for 2D view (elevation = 90) before setting Z limits.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 04 Oct 2013 06:59:31 -0700 |
parents | fc31cd1bd503 |
children | 07a4597fcbac |
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc +++ b/libinterp/corefcn/graphics.cc @@ -4614,7 +4614,7 @@ double yo = ylimits(yd > 0 ? 0 : 1); double zo = zlimits(zd > 0 ? 0 : 1); - Matrix pb = get_plotboxaspectratio ().matrix_value (); + Matrix pb = get_plotboxaspectratio ().matrix_value (); bool autocam = (camerapositionmode_is ("auto") && cameratargetmode_is ("auto") @@ -9088,25 +9088,27 @@ if (go.isa ("surface")) nd = 3; - - if ((go.isa ("line") || go.isa ("patch")) && ! go.get("zdata").is_empty ()) + else if ((go.isa ("line") || go.isa ("patch")) + && ! go.get ("zdata").is_empty ()) nd = 3; - - Matrix kids = go.get_properties ().get_children (); - - for (octave_idx_type i = 0; i < kids.length (); i++) - { - graphics_handle hnd = gh_manager::lookup (kids(i)); - - if (hnd.ok ()) - { - const graphics_object& kid = gh_manager::get_object (hnd); - - if (kid.valid_object ()) - nd = calc_dimensions (kid); - - if (nd == 3) - break; + else + { + Matrix kids = go.get_properties ().get_children (); + + for (octave_idx_type i = 0; i < kids.length (); i++) + { + graphics_handle hnd = gh_manager::lookup (kids(i)); + + if (hnd.ok ()) + { + const graphics_object& kid = gh_manager::get_object (hnd); + + if (kid.valid_object ()) + nd = calc_dimensions (kid); + + if (nd == 3) + break; + } } } @@ -9126,17 +9128,15 @@ int nargin = args.length (); - if (nargin == 1) - { - double h = args(0).double_value (); - - if (! error_state) - retval = calc_dimensions (gh_manager::get_object (h)); - else - error ("__calc_dimensions__: expecting graphics handle as only argument"); - } + if (nargin != 1) + print_usage (); + + double h = args(0).double_value (); + + if (! error_state) + retval = calc_dimensions (gh_manager::get_object (h)); else - print_usage (); + error ("__calc_dimensions__: expecting graphics handle as only argument"); return retval; }