www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/+mbcgui/+graph/rotate3d.m

    function hMode = rotate3d(hObject, state)
%ROTATE3D Toggle rotation for specified axes.
%
%   ROTATE3D(AX, 'on') adds the axes AX to the list of ones that have
%   rotation enabled and ROTATE3D(AX, 'off') removes it.  Note that this
%   does not directly enable or disable rotation functionality - to do this
%   you must also active the rotation mode for the figure as a whole.
%
%   ROTATE3D(FIG, 'on') makes the rotation mode active for the figure.
%   ROTATE3D(FIG, 'off') deactives the rotation mode.

%   Copyright 2008-2010 The MathWorks, Inc.

hFig = ancestor(hObject, 'figure');

if hObject==hFig
    % Toggle rotation mode for figure
    hMode = mbcgui.graph.rotateMode(hFig);
    switch lower(state)
        case 'on'
            activateuimode(hFig, hMode.name);
        case 'off'
            activateuimode(hFig, '');
    end
    
else
    % Add/remove axes from the mode
    switch lower(state)
        case 'on'
            iSetRotate(hObject, true);
        case 'off'
            iSetRotate(hObject, false);
    end
 
end

function iSetRotate(hAxes, State)
if ~isprop(hAxes, 'mbcRotateMode')
    mbcgui.hgclassesutil.addprop(hAxes, 'mbcRotateMode', 'Hidden', true);
end
set(hAxes, 'mbcRotateMode', State);