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

    function obj = surfaceplot(varargin)
%SURFACEPLOT Constructor for surface plot component
%
%  obj = cgsurfview.surfaceplot('Parent',parent,'Options' opts)

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


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

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

obj.hAxisPanel = mbcgui.widget.AxesContainer(...
    'Parent',obj.Parent,...
    'Visible', obj.Visible,...
    'PositionSetting','outer');
obj.hAxes = obj.hAxisPanel.AxesHandle;
set(obj.hAxes,...
    'Visible',obj.Visible,...
    'Units','pixels');
view(obj.hAxes, 3);
mv_rotate3d(obj.hAxes, 'ON');


obj.cmap1 = parula(64);
obj.cmap2 = cool(64);

obj.hColorBar = mbcwidgets.ColorBar('Parent', obj.Parent, ...
    'Visible', obj.Visible, ...
    'Colormap', obj.cmap1);

obj.Display = xreggridbaglayout(obj.Parent,...
    'visible',obj.Visible,...
    'border',[10 10 10 10]);

if isempty(obj.PlotOptions)
    error(message('mbc:cgsurfview:surfaceplot:InvalidState'));
end
i_AddLinkedAxes(obj.PlotOptions,obj.hAxes);

%---------------------------
function i_AddLinkedAxes(opts,ax)

opts.linkedAxes = [opts.linkedAxes ax];
opts.listeners = mbcgui.hgclassesutil.proplistener(opts.linkedAxes, 'View', 'PostSet', ...
    mbcutils.callback(@i_AxesRotated,opts));


%---------------------------
function i_AxesRotated(src,evt,opts)
if opts.linkRotation
    vw = get(evt.AffectedObject, 'View');
    set(opts.linkedAxes,'View',vw);
end