www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgsurfview/@contourplot/contourplot.m

    function obj = contourplot(varargin)
%CONTOURPLOT Constructor for contour plot component
%
% obj = cgsurfview.contourplot('Parent',parent);

%  Copyright 2000-2013 The MathWorks, Inc. and Ford Global Technologies, Inc.


if nargin && isa(varargin{1}, 'cgsurfview.contourplot')
   obj = varargin{1};
   varargin(1) = [];
else
   obj = cgsurfview.contourplot;
end

% Call parent class constructor
obj.abstractlayoutcomponent(varargin{:});

axPnl = mbcgui.widget.AxesContainer(...
    'Parent',obj.Parent,...
    'Visible', obj.Visible,...
    'PositionSetting','outer');
obj.hAxes = axPnl.AxesHandle;
set(obj.hAxes,...
    'NextPlot','replacechildren',...
    'Box', 'on', ...
    'HitTest', 'off');

obj.hButton = uicontrol('Parent', obj.Parent,...
                'String','Set Contour Values',...
                'Callback',{@i_editContourValues,obj},...
                'Visible',obj.Visible); % default style: pushbutton
obj.hCheckBox  = uicontrol('Parent', obj.Parent,...
        'Style','checkbox',...
        'Value',1,...
        'Visible',obj.Visible,...
        'String','Automatically choose contour values',...
        'Callback',{@i_toggleContourMode,obj});

obj.Display = xreggridbaglayout(obj.Parent,...
    'dimension',[2 3],...
    'rowsizes',[-1 25],...
    'colsizes',[-1 200 110],...
    'mergeblock',{[1 1],[1 3]},... % top row
    'visible',obj.Visible,...
    'elements',{ axPnl, [], []; [], obj.hCheckBox, obj.hButton } );


%%%%%%%%%%%%%%%%%%%%%
function i_editContourValues(src,evt,obj)

obj.pEditContourValues;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function i_toggleContourMode(src,evt,obj)

x = get(obj.hCheckBox,'Value'); % new value

if x
    % replot with automatically chosen contour values
    obj.contour_values = obj.PlotOptions.numlines;
    obj.pReplot;
end