www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtools/@cgbrowser/showSurfaceViewer.m

    function showSurfaceViewer(obj)
%SHOWSURFACEVIEWER Open the surface viewer for the current node
%
%  SHOWSURFACEVIEWER(OBJ) opens the surface viewer for the current node.
%  If the node provides a custom node list generation function for the
%  surface viewer this will be used, otherwise the viewer is opened up to
%  display all nodes of the current node's type.

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


pNode = obj.CurrentNode;
if ~isnull(pNode)
    surfviewfcn = obj.getBrowserOptions('surfaceviewernodesfcn');
    if isempty(surfviewfcn)
        % Default behaviour: get list of all nodes that are the same type
        % as the current one and select this node initially
        pProj = obj.RootNode;
        nodes = pProj.filterbytype(pNode.typeobject);
        pNodeList = null(xregpointer, size(nodes));
        for n = 1:length(nodes)
            pNodeList(n) = address(nodes{n});
        end
        selidx = find(pNodeList==pNode);
    else
        % Custom function has been provided
        [pNodeList, selidx] = feval(surfviewfcn, pNode.info);
    end
    if isempty(pNodeList)
        h = errordlg(['There are currently no items available for displaying' ...
            ' in the Surface Viewer'], 'Surface Viewer Unavailable', 'modal');
        waitfor(h);
    else
        cgsurfaceviewer(pNodeList, selidx);
    end
end