% DISPLAY overloads display functionality for xyzdata objects.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: DISPLAY overloads display functionality for xyzdata objects.
%
% CALL:        txt    = display(xyzdata)
%
% INPUT:       xyzdata - an xyz data object
%
% OUTPUT:      txt    - cell array with strings to display the xyzdata object
%
% VERSION:     $Id: display.m,v 1.11 2011/02/18 16:48:56 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = display(varargin)

  xyzdatas = utils.helper.collect_objects(varargin(:), 'xyzdata');

  txt = {};

  for i=1:numel(xyzdatas)
    xyz = xyzdatas(i);
    banner = sprintf('-------- xyzdata %02d ------------', i);
    txt{end+1} = banner;

    txt{end+1} = ' ';

    txt{end+1} = sprintf('     x:  [%d %d], %s', size(xyz.x), class(xyz.x));
    txt{end+1} = sprintf('     y:  [%d %d], %s', size(xyz.y), class(xyz.y));
    txt{end+1} = sprintf('     z:  [%d %d], %s', size(xyz.z), class(xyz.z));
    txt{end+1} = sprintf('xunits:  %s', char(xyz.xunits));
    txt{end+1} = sprintf('yunits:  %s', char(xyz.yunits));
    txt{end+1} = sprintf('zunits:  %s', char(xyz.zunits));

    banner_end(1:length(banner)) = '-';
    txt{end+1} = banner_end;

    txt{end+1} = ' ';
  end

  if nargout == 0
    for ii=1:length(txt)
      disp(txt{ii});
    end
  elseif nargout == 1
    varargout{1} = txt;
  end

end

