www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtools/@comparisonpane/comparisonpane.m
function obj = comparisonpane(varargin) %COMPARISONPANE Constructor for pane which compares two sets of data % % OBJ = COMPARISONPANE(PROP, VALUE, ...) create a set of comparison axes % that compare two sets of data. % Copyright 2000-2013 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin && isa(varargin{1}, 'cgtools.comparisonpane') obj = varargin{1}; varargin(1) = []; else obj = cgtools.comparisonpane; end % Call the inherited constructor abstractlayoutcomponent(obj, varargin{:}); % Construct the objects AxPanel2d = mbcgui.widget.AxesContainer(... 'Parent', obj.Parent, ... 'Visible', 'off', ... 'Border', [40 35 20 15]); obj.Axes2D = AxPanel2d.AxesHandle; set(obj.Axes2D,... 'Units', 'pixels', ... 'Box','on',... 'XGrid', 'on', ... 'YGrid', 'on'); set(get(obj.Axes2D, 'XLabel'), 'Interpreter', 'none'); AxPanel3d = mbcgui.widget.AxesContainer(... 'Parent', obj.Parent, ... 'Visible', 'off', ... 'Border', [45 45 45 15]); obj.Axes3D = AxPanel3d.AxesHandle; set(obj.Axes3D , ... 'Units', 'pixels', ... 'Box','on',... 'XGrid', 'on', ... 'YGrid', 'on', ... 'ZGrid', 'on'); view(obj.Axes3D, 3); mv_rotate3d(obj.Axes3D, 'ON'); set(get(obj.Axes3D, 'XLabel'), 'Interpreter', 'none'); set(get(obj.Axes3D, 'YLabel'), 'Interpreter', 'none'); obj.Line1 = line('Parent', obj.Axes2D, ... 'XData', [], 'YData', [], ... 'Color', 'b'); obj.Line2 = line('Parent', obj.Axes2D, ... 'XData', [], 'YData', [], ... 'Color', 'r'); obj.Surface1 = surface('Parent', obj.Axes3D, ... 'XData', [], 'YData', [], 'ZData', [], 'CData', [], ... 'EdgeColor','none',... 'FaceColor', 'b', ... 'FaceLighting','gouraud'); obj.Surface2 = surface('Parent', obj.Axes3D, ... 'XData', [], 'YData', [], 'ZData', [], 'CData', [], ... 'EdgeColor','none',... 'FaceLighting','gouraud'); L = mbcgraph.camlight(obj.Axes3D,'headlight'); set(L, 'Visible', 'off'); obj.Message = [ ... text('Parent', obj.Axes2D, ... 'Position', [0.5, 0.5], ... 'HorizontalAlignment','center'); ... text('Parent', obj.Axes3D, ... 'Position', [0.5, 0.5, 0.5], ... 'HorizontalAlignment','center'); ... ]; crds = xregcardlayout(obj.Parent, ... 'visible', obj.Visible, ... 'position', obj.Position, ... 'numcards', 2); attach(crds, AxPanel2d, 1); attach(crds, AxPanel3d, 2); obj.Display = crds; % Add property listeners obj.addPropertyListeners({'PlotType', 'PlotDimensions'}, ... {@i_setplottype, {@i_setplotdims, crds}}); function i_setplottype(src, evt) evt.AffectedObject.pPlotSurface; evt.AffectedObject.pUpdateControllerValues; function i_setplotdims(src, evt, crds) % Ensure we only ever set card 1 or 2. card = max(1, min(2, evt.NewValue-1)); set(crds, 'currentcard', card);