www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/+xregbdrygui/DataView4.m
classdef DataView4 < xregbdrygui.AbstractBdryView %xregbdrygui.DataView4 class % xregbdrygui.DataView4 extends xregbdrygui.AbstractBdryView. % % xregbdrygui.DataView4 properties: % Parent - Property is of type 'MATLAB array' % Position - Property is of type 'rect' % Enable - Property is of type 'on/off' % Visible - Property is of type 'on/off' % UserData - Property is of type 'MATLAB array' % Tag - Property is of type 'string' % MessageService - Property is of type 'handle' % Options - Property is of type 'handle vector' % Actions - Property is of type 'handle vector' % UIContextMenu - Property is of type 'MATLAB array' % Graph - Property is of type 'MATLAB array' (read only) % % xregbdrygui.DataView4 methods: % gettitle - Return a suitable title for a window % Copyright 2005-2015 The MathWorks, Inc. and Ford Global Technologies, Inc. properties (SetAccess=protected, AbortSet) %GRAPH Property is of type 'MATLAB array' (read only) Graph = []; end methods % constructor block function obj = DataView4( varargin ) % XREGBDRYGUI.DATAVIEW4 class constructor % Call the inherited constructor obj@xregbdrygui.AbstractBdryView(varargin{ : }); % converted super class constructor call % Create action for properties dialog obj.Options.Actions = [ mbcmultiview.Action( @i_editPreferences, ... 'Plot &Properties...', 'Edit View Properties' ) ... % mbcmultiview.Action( @i_editColormap, ... 'Edit &Colormap...', 'Edit Colormap' ) ]; % Create the 4D graph object G = mvgraph4d( obj.Parent, ... 'visible', obj.Visible, ... 'position', obj.Position, ... 'frame', 'off', ... 'factorselection', 'exclusive' ); obj.Graph = G; obj.ContentHandle = G; % Force BMS change update now obj.pPostSetMessageService; pRefreshView(obj) function i_editPreferences(~, ~) prefsgui( G ); end function i_editColormap(~, ~) cmapgui( G ); end end end % constructor block methods % public methods %---------------------------------------- function s = gettitle(obj) %#ok<MANU> %GETTITLE Return a suitable title for a window % GETTITLE(OBJ) returns a string that can be used as a title for the view. s = '4D Data View'; end % gettitle %---------------------------------------- function pObjectBeingDestroyed(obj, ~) %POBJECTBEINGDESTROYED Called when the view is being destroyed % POBJECTBEINGDESTROYED(OBJ, EVENT) is called when the view (OBJ) is being % destroyed and this method ensures that the graph that the view holds is % also destroyed. if ~mbcgui.util.isBeingDestroyed( obj.Parent ) delete( obj.Graph ); end end % pObjectBeingDestroyed %---------------------------------------- function pRefreshView(obj) %PREFRESHVIEW Update the nD graph object's data % PREFRESHVIEW(OBJ) updates the nD graphs copy of the design data. if obj.hasData bms = obj.MessageService; cif = bms.getInputFactors; limits = mat2cell( getRange( cif ).', ones( 1, length( cif ) ), 2 ); set( obj.Graph, ... 'Data', bms.getDataPoints,... 'Factors', getFullNames( cif ), ... 'Limits', limits ); else set( obj.Graph, 'Data', [], 'Factors', {} ); end end % pRefreshView end % public methods methods (Access=protected) %---------------------------------------- function pPostSetMessageService(obj) %PPOSTSETMESSAGESERVICE Respond to change of MessageService % PPOSTSETMESSAGESERVICE(OBJ) is called when the MessageService property % is changed. % Clear the listeners obj.clearMessageServiceListeners; % Add new listeners obj.addMessageServiceListener( event.listener(obj.MessageService,'NodeChange', @(src, evt) pRefreshView( obj ) )); obj.addMessageServiceListener( event.listener(obj.MessageService,'ViewModeChange', @(src, evt) pRefreshView( obj ) )); obj.addMessageServiceListener( event.listener(obj.MessageService,'ViewTestChange', @(src, evt) pRefreshView( obj ) )); % Make sure that we do a draw obj.pRefreshView; end % pPostSetMessageService end end % classdef