NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/opnml/basics/az_el.m

Revision 495 (checked in by cbc, 11 years ago)

Initial import of Stark code.

Line 
1 %
2 % AZ_EL set up azimuth and elevation slider controls for 3-D viewing
3 %
4 % AZ_EL generates 2 uicontrols (sliders) to allow changing the view point
5 %       of a 3-D plot by moving the slider controls.  The user may
6 %       call AZ_EL from the command-line or within a function by
7 %       passing AZ_EL "1" as the argument.   
8 %
9 % Call as: >>  az_el(1);
10 %
11 % AZ_EL was gutted from a MATLAB demo
12 % and turned into a function by:
13 % Brian O. Blanton
14 %
15 function az_el(arg)
16
17 if ~exist('arg'),return,end
18
19 if arg==1 
20    fig=gcf;
21    % Define Azimuth Slider
22    sli_azm=uicontrol(fig,'Style','Slider','Units','Pixels',...
23                      'Position',[50 10 120 20],...
24                      'Tag','sli_azm',...
25                      'Min',-90,'Max',90,'Value',-27,...
26                      'CallBack','az_el(2)');
27    % Define Elevation Slider
28    sli_elv=uicontrol(fig,'Style','Slider','Units','Pixels',...
29                      'Position',[240 10 120 20],...
30                      'Tag','sli_elv',...
31                      'Min',-90,'Max',90,'Value',30,...
32                      'CallBack','az_el(3)');
33    % Define Text Controls for the Minimum values
34    azm_min=uicontrol(fig,'Style','text','Units','Pixels',...
35                      'Position',[20 10 30 20],...
36                      'Tag','azm_min',...
37                      'String',num2str(get(sli_azm,'Min')));
38    elv_min=uicontrol(fig,'Style','text','Units','Pixels',...
39                      'Position',[210 10 30 20],...
40                      'Tag','elv_min',...
41                      'String',num2str(get(sli_elv,'Min')));
42    % Define Text Controls for the Maximum values
43    azm_max=uicontrol(fig,'Style','text','Units','Pixels',...
44                      'Position',[170 10 30 20],...
45                      'String',num2str(get(sli_azm,'Max')),...
46                      'Tag','azm_max',...
47                      'Horizon','right');
48    elv_max=uicontrol(fig,'Style','text','Units','Pixels',...
49                      'Position',[360 10 30 20],...
50                      'String',num2str(get(sli_elv,'Max')),...
51                      'Tag','elv_max',...
52                      'Horizon','right');
53    % Define Slider Labels
54    azm_label=uicontrol(fig,'Style','text','Units','Pixels',...
55                        'Position',[50 40 65 20],...
56                        'Tag','azm_label',...
57                        'String','Azimuth');                     
58    elv_label=uicontrol(fig,'Style','text','Units','Pixels',...
59                        'Position',[240 40 65 20],...
60                        'Tag','elv_label',...
61                        'String','Elevation');                     
62    % Define Text Controls for Current Values
63    azm_cur = uicontrol(fig,'Style','text','Units','Pixels',...
64                       'Position',[120 40 50 20],...
65                       'Tag','azm_cur',...
66                       'String',num2str(get(sli_azm,'Value')));
67    elv_cur = uicontrol(fig,'Style','text','Units','Pixels',...
68                       'Position',[310 40 50 20],...
69                       'Tag','elv_cur',...
70                       'String',num2str(get(sli_elv,'Value')));
71 elseif arg==2
72    sli_azm=findobj(gcf,'Type','uicontrol','Tag','sli_azm');
73    sli_elv=findobj(gcf,'Type','uicontrol','Tag','sli_elv');
74    azm_cur=findobj(gcf,'Type','uicontrol','Tag','azm_cur');
75    set(azm_cur,'String',num2str(get(sli_azm,'Val')))
76    set(gca,'View',[get(sli_azm,'Val'),get(sli_elv,'Val')])
77 elseif arg==3
78    sli_azm=findobj(gcf,'Type','uicontrol','Tag','sli_azm');
79    sli_elv=findobj(gcf,'Type','uicontrol','Tag','sli_elv');
80    elv_cur=findobj(gcf,'Type','uicontrol','Tag','elv_cur');
81    set(elv_cur,'String',num2str(get(sli_elv,'Val')))
82    set(gca,'View',[get(sli_azm,'Val'),get(sli_elv,'Val')])
83 end
84
85 %
86 %        Brian O. Blanton
87 %        Curr. in Marine Sciences
88 %        15-1A Venable Hall
89 %        CB# 3300
90 %        Uni. of North Carolina
91 %        Chapel Hill, NC
92 %                 27599-3300
93 %
94 %        919-962-4466
95 %        blanton@cuda.chem.unc.edu
96 %
Note: See TracBrowser for help on using the browser.