Mercurial > hg > ishara
view arrows/@imager/construct.m @ 0:672052bd81f8
Initial partial import.
author | samer |
---|---|
date | Wed, 19 Dec 2012 22:38:28 +0000 |
parents | |
children |
line wrap: on
line source
function u=construct(s,sizes_in) acquire(s); figure(fig(s)); set(gcf,'Name',name(s)); X=nan(sizes_in{1}); if isfield(s.opts,'xdom') || isfield(s.opts,'ydom') xdom=getparam(s.opts,'xdom',[1,size(X,2)]); ydom=getparam(s.opts,'ydom',[1,size(X,1)]); h=s.opts.imagefn(xdom,ydom,X,s.opts.args{:}); else h=s.opts.imagefn(X,s.opts.args{:}); end if isfield(s.opts,'clickthru') && s.opts.clickthru parent=get(h,'Parent'); set(h,'ButtonDownFcn',@clickthru); end if ~isempty(s.opts.xlim), xlim(s.opts.xlim); end if ~isempty(s.opts.ylim), ylim(s.opts.ylim); end if isfield(s.opts,'ylabel'), ylabel(s.opts.ylabel); end if isfield(s.opts,'xlabel'), xlabel(s.opts.xlabel); end if getparam(s.opts,'colorbar',0), colorbar; end if ~isempty(s.opts.clim) caxis(s.opts.clim); end if ~isempty(s.opts.colormap), colormap(s.opts.colormap); end u=mkunit(s); if autoflush(s), u.process =@proc_flush; else u.process=@proc_noflush; end u.sizes_out = {}; u.dispose = @dispose; function dispose, delete(h); release(s); end function proc_flush(x), set(h,'CData',x); drawnow; end function proc_noflush(x), set(h,'CData',x); end function clickthru(a,b) fn=get(parent,'ButtonDownFcn'); if ~isempty(fn), fn(a,b); end end end