# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1282662527 18000 # Node ID 6ac8cc8ec3f757758f8db91d5a824cf54a9bde11 # Parent 4e43ea8c7524db57ae4633c916e97bef7b05b29e imported patch calc_dim diff -r 4e43ea8c7524 -r 6ac8cc8ec3f7 scripts/plot/__go_draw_axes__.m --- a/scripts/plot/__go_draw_axes__.m Tue Aug 24 10:08:46 2010 -0500 +++ b/scripts/plot/__go_draw_axes__.m Tue Aug 24 10:08:47 2010 -0500 @@ -45,7 +45,8 @@ ymirror = true; endif - nd = __calc_dimensions__ (axis_obj); + nd = __calc_dimensions__ (h); + if (strcmpi (axis_obj.plotboxaspectratiomode, "manual")) pos = __actual_axis_position__ (axis_obj); else @@ -1779,29 +1780,6 @@ endfunction -function nd = __calc_dimensions__ (obj) - kids = obj.children; - nd = 2; - for i = 1:length (kids) - obj = get (kids(i)); - switch (obj.type) - case {"image", "text"} - ## ignore as they - case {"line", "patch"} - if (! isempty (obj.zdata)) - nd = 3; - endif - case "surface" - nd = 3; - case "hggroup" - obj_nd = __calc_dimensions__ (obj); - if (obj_nd == 3) - nd = 3; - endif - endswitch - endfor -endfunction - function __gnuplot_write_data__ (plot_stream, data, nd, parametric, cdata) ## DATA is already transposed. diff -r 4e43ea8c7524 -r 6ac8cc8ec3f7 src/graphics.cc --- a/src/graphics.cc Tue Aug 24 10:08:46 2010 -0500 +++ b/src/graphics.cc Tue Aug 24 10:08:47 2010 -0500 @@ -58,6 +58,8 @@ static graphics_object xget_ancestor (const graphics_object& go_arg, const std::string& type); +static octave_value calc_dimensions(const graphics_object& gh); + static void gripe_set_invalid (const std::string& pname) { @@ -5502,6 +5504,61 @@ \ return retval +//debug +#include + +static octave_value calc_dimensions(const graphics_object& go) +{ + using namespace std;//debug + const base_properties& props = go.get_properties(); + + string go_name = props.graphics_object_name(); + cout << "go_name: " << go_name << endl;//debug + + if(go_name == "surface") + return 3; + + if(go_name == "hggroup") + { + Matrix kids = props.get_children(); + for(octave_idx_type i = 0; i < kids.numel(); i++) + { + const graphics_object& kid = gh_manager::get_object(kids(i)); + if(kid.valid_object()) + return calc_dimensions(kid); + } + } + + return 2; +} + +DEFUN (__calc_dimensions__, args, , + "-*- texinfo -*-\n\ address@hidden {Built-in Function} {} __calc_dimensions__ (@var{axes})\n\ +Internal function. Determine the number of dimensions in a graphics\n\ +object, whether 2 or 3.\n\ address@hidden deftypefn") +{ + gh_manager::autolock guard; + + octave_value retval; + + 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"); + } + else + print_usage(); + + return retval; +} + DEFUN (__go_axes__, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __go_axes__ (@var{parent})\n\ # HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1282662526 18000 # Node ID 4e43ea8c7524db57ae4633c916e97bef7b05b29e # Parent 5a6bbdb7861c843995f99a68447ba971db7cb55e Make rotation the default mode in 3d plot diff -r 5a6bbdb7861c -r 4e43ea8c7524 src/DLD-FUNCTIONS/fltk_backend.cc --- a/src/DLD-FUNCTIONS/fltk_backend.cc Tue Aug 24 10:08:46 2010 -0500 +++ b/src/DLD-FUNCTIONS/fltk_backend.cc Tue Aug 24 10:08:46 2010 -0500 @@ -224,7 +224,8 @@ public: plot_window (int xx, int yy, int ww, int hh, figure::properties& xfp) : Fl_Window (xx, yy, ww, hh, "octave"), window_label (), shift (0), - fp (xfp), canvas (0), autoscale (0), togglegrid (0), panzoom (0), rotate (0), help (0), status (0) + fp (xfp), canvas (0), autoscale (0), togglegrid (0), panzoom (0), + rotate (0), help (0), status (0) { callback (window_close, static_cast (this)); @@ -317,7 +318,7 @@ set_name (); resizable (canvas); size_range (4*status_h, 2*status_h); - gui_mode = pan_zoom; + gui_mode = rotate_zoom; } ~plot_window (void) # HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1282662526 18000 # Node ID 5a6bbdb7861c843995f99a68447ba971db7cb55e # Parent c98a0d05b24a27a0915381c71505d566ccf73688 Don't rotate past the top and bottom diff -r c98a0d05b24a -r 5a6bbdb7861c src/graphics.cc --- a/src/graphics.cc Tue Aug 24 12:18:57 2010 +0200 +++ b/src/graphics.cc Tue Aug 24 10:08:46 2010 -0500 @@ -4287,8 +4287,12 @@ { Matrix v = get_view ().matrix_value (); - v (1) += delta_el; - v (0) -= delta_az; + double new_el = v(1) + delta_el; + if( new_el > 90 or new_el < -90) + new_el = v(1); + + v (1) = new_el; + v (0) = fmod(v(0) + delta_az,360); set_view(v); update_transform();