gusucode.com > datamanager 工具箱matlab源码程序 > datamanager/@datamanager/getAllBrushedObjects.m

    function selected_sibs = getAllBrushedObjects(gobj)

% Copyright 2008-2015 The MathWorks, Inc.

% Get all the objects in the graphic container which have been brushed.
% Be sure to include the peer axes for any plotyy axes.

selected_sibs = findobj(gobj,'-property','type','-function',...
    @(x) isprop(x,'BrushData') && ~isempty(get(x,'BrushData')) && any(x.BrushData(:)>0));
if isappdata(gobj,'graphicsPlotyyPeer')
    selected_yysibs = findobj(getappdata(gobj,'graphicsPlotyyPeer'),'-function',...
       @(x) isprop(x,'BrushData') && ~isempty(get(x,'BrushData')) && any(x.BrushData(:)>0));
    selected_sibs = [selected_sibs(:);selected_yysibs(:)]';
end
 
% Check for objects brushed using behavior objects
custom = findobj(gobj.Parent,'HandleVis','on','-not',{'Behavior',struct},'-function',...
    @localHasBrushBehavior,'HandleVis','on');
if isempty(custom)
    return
end

% Add objects brushed by enabled behavior objects
Iinclude = false(length(custom),1);
for k=1:length(custom)
    bh = hggetbehavior(custom(k),'Brush');
    Iinclude(k) =  bh.Enable;
end 
selected_sibs = [selected_sibs(:); custom(Iinclude)];


function state = localHasBrushBehavior(h)

state = ~isempty(hggetbehavior(h,'Brush','-peek'));