www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/+cgtools/MBCModelFilteredProjectView.m

    classdef MBCModelFilteredProjectView < cgtools.AbstractFilteredProjectView
    %cgtools.MBCModelFilteredProjectView class
    %   cgtools.MBCModelFilteredProjectView extends cgtools.AbstractFilteredProjectView.
    %
    %    cgtools.MBCModelFilteredProjectView 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'
    %       UIContextMenu - Property is of type 'MATLAB array'
    %       Project - Property is of type 'MATLAB array'
    %       Items - Property is of type 'MATLAB array'
    %       Names - Property is of type 'MATLAB array' (read only)
    %       Types - Property is of type 'MATLAB array' (read only)
    %       Icons - Property is of type 'MATLAB array' (read only)
    %       List - Property is of type 'handle' (read only)
    %       Filter - Property is of type 'handle' (read only)
    %       CurrentProjectLabel - Property is of type 'handle' (read only)
    
    %  Copyright 2005-2016 The MathWorks, Inc.
    
    methods  % constructor block
        function obj = MBCModelFilteredProjectView( varargin )
        % xregtools.filteredprojectview class constructor
        
        % Call the inherited constructor
        obj@cgtools.AbstractFilteredProjectView(varargin{ : }); % converted super class constructor call
        
        end  % filteredprojectview
        
    end  % constructor block
    
    methods  (Access=protected)
        %----------------------------------------
        function alltypes = pGetAllTypes(obj) %#ok<MANU>
        %PGETALLTYPES Get all the types of item we want to show.
        %   ALLTYPES = PGETALLTYPES(OBJ)
        
        alltypes = {'All', 'Response', 'Point-by-Point', 'Datum', 'Response Feature'};
        
        end  % pGetAllTypes
        
        %----------------------------------------
        function colnames = pGetColumnData(obj) %#ok<MANU>
        %PGETCOLUMNDATA Return the column names for this view.
        %   COLNAMES = PGETCOLUMNDATA(OBJ)
        
        colnames = {'Name', 'Type', 'Location'};
        end  % pGetColumnData
        
        %----------------------------------------
        function [pItems, names, icons, typestrs, location] = pGetItemsByType(obj, typestr )
        %PGETITEMSBYYYPE Return the items that match the supplied type.
        %   [PITEMS, NAMES, ICONS, TYPESTR, LOCATION] = PGETITEMSBYYYPE(OBJ, TYPESTR )
        %
        %   Subclasses overload this to do the actual matching.
        
        if isempty( obj.Project )
            pItems = null( xregpointer, 0, 0 );
            names = {};
            icons = {};
            typestrs = {};
            location = {};
        else
            if strcmp( typestr, 'All' )
                types2get = obj.pGetAllTypes();
                types2get = types2get(2:end);
            else
                types2get = {typestr};
            end
            pItems = cell(1,length( types2get ));
            names = cell(1,length( types2get ));
            typestrs = cell(1,length( types2get ));
            icons = cell(1,length( types2get ));
            location = cell(1,length( types2get ));
            for n = 1:length( types2get )
                pItems{n} = obj.Project.ImportList( types2get{n} );
                names{n} = pveceval( pItems{n}, @iName );
                typestrs{n} = repmat( types2get(n), size( pItems{n} ) );
                if strcmpi(types2get{n},'point-by-point')
                    icons{n} = repmat( {cgrespath('modelSwitch.bmp')}, size( pItems{n} ) );
                else
                    icons{n} = repmat( {cgrespath('cgmodelnode.bmp')}, size( pItems{n} ) );
                end
                location{n} = pveceval( pItems{n}, @fullname );
            end
            pItems = [pItems{:}];
            names = [names{:}];
            typestrs = [typestrs{:}];
            icons = [icons{:}];
            location = [location{:}];
        end
        end  % pGetItemsByType
        
    end  % public methods
    
end  % classdef

function itemname = iName( mdev )
if isa( mdev, 'mdev_local' )
    itemname = varname(mdev) ;
else
    itemname = name( mdev );
end
end  % iName