[3] | 1 | %SI_DETTACH_DISPLAY Dettach an additional display to the spectral image |
---|
| 2 | % |
---|
| 3 | % SI_DETTACH_DISPLAY(SIH,IMH) |
---|
| 4 | % |
---|
| 5 | % INPUT |
---|
| 6 | % SIH spectral image handle (see showsi) |
---|
| 7 | % IMH figure handle to be dettached |
---|
| 8 | % |
---|
| 9 | |
---|
| 10 | % Copyright: Pavel Paclik, pavel@ph.tn.tudelft.nl |
---|
| 11 | % Faculty of Applied Physics, Delft University of Technology |
---|
| 12 | % P.O. Box 5046, 2600 GA Delft, The Netherlands |
---|
| 13 | |
---|
| 14 | function si_dettach_display(sih,imh) |
---|
| 15 | |
---|
| 16 | udpim=get(sih,'userdata'); |
---|
| 17 | udim=get(imh,'userdata'); |
---|
| 18 | |
---|
| 19 | if udim.hpim ~= udpim.hpim |
---|
| 20 | error('the display is attached to a different spectral image'); |
---|
| 21 | end |
---|
| 22 | |
---|
| 23 | % remove added fields |
---|
| 24 | udim=rmfield(udim,{'hpim','hspec','si_ax'}); |
---|
| 25 | |
---|
| 26 | % what figure we attach? |
---|
| 27 | tag=get(imh,'tag'); |
---|
| 28 | |
---|
| 29 | if strcmp(tag,'scatterdui') |
---|
| 30 | |
---|
| 31 | % update callbacks |
---|
| 32 | set(imh,'CloseRequestFcn','closereq'); |
---|
| 33 | |
---|
| 34 | % remove the point |
---|
| 35 | delete(udim.si_point); |
---|
| 36 | udim=rmfield(udim,{'si_point'}); |
---|
| 37 | |
---|
| 38 | % remove the link to this display from the list in pim |
---|
| 39 | udpim.si_attached_scatters=setdiff(udpim.si_attached_scatters,imh); |
---|
| 40 | |
---|
| 41 | else |
---|
| 42 | |
---|
| 43 | % remove all the points from this figure |
---|
| 44 | h=findobj(get(imh,'children'),'type','line'); |
---|
| 45 | delete(h); |
---|
| 46 | |
---|
| 47 | % remove spectral menus |
---|
| 48 | h = findobj(imh,'Type','uimenu','tag','actions'); |
---|
| 49 | h = findobj(gcf,'Type','uimenu','tag','mouse_si_visualisation'); |
---|
| 50 | delete(h); |
---|
| 51 | udim.state = 'none'; |
---|
| 52 | dipfig_set_action_check(imh,'none'); |
---|
| 53 | set(imh,'pointer','arrow') |
---|
| 54 | |
---|
| 55 | % update callbacks |
---|
| 56 | set(imh,'WindowButtonMotionFcn',''); |
---|
| 57 | set(imh,'WindowButtonDownFcn',''); |
---|
| 58 | set(imh,'CloseRequestFcn','closereq'); |
---|
| 59 | |
---|
| 60 | % remove the link to this display from the list in pim |
---|
| 61 | udpim.si_attached_displays=setdiff(udpim.si_attached_displays,imh); |
---|
| 62 | |
---|
| 63 | end |
---|
| 64 | % update user data |
---|
| 65 | set(sih,'UserData',[]); |
---|
| 66 | set(sih,'UserData',udpim); |
---|
| 67 | |
---|
| 68 | set(imh,'UserData',[]); |
---|
| 69 | set(imh,'UserData',udim); |
---|
| 70 | |
---|
| 71 | return |
---|