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

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

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

Initial import of Stark code.

Line 
1 %
2 % PAN   Mouse-driven pan-around facility.   
3 %
4 % PAN   Mouse-driven pan-around facility.  PAN prompts the user to choose
5 %       the new center of the viewing box with the left mouse button
6 %       and then shifts the view accordingly.
7 %
8 % Call as: ">> pan"
9 %
10 % Written by: Brian O. Blanton
11 %
12
13 % get current axis limits
14 OLDXP = get(gca,'Xlim');
15 OLDYP = get(gca,'Ylim');
16  
17 % compute width and height of axes
18 width=OLDXP(2)-OLDXP(1);
19 height=OLDYP(2)-OLDYP(1);
20 waitforbuttonpress;
21 Pt1=get(gca,'CurrentPoint');
22 xcen=Pt1(1,1);
23 ycen=Pt1(1,2);
24
25 % compute new window extent
26 xmin=xcen-width/2;
27 xmax=xcen+width/2;
28 ymin=ycen-height/2;
29 ymax=ycen+height/2;
30
31 % set new axis limits
32 set(gca,'Xlim',[xmin xmax]);
33 set(gca,'Ylim',[ymin ymax]);
34 clear OLDXP OLDYP width height xcen ycen xmin xmax ymin ymax
35
36 %
37 %        Brian O. Blanton
38 %        Curr. in Marine Science
39 %        15-1A Venable Hall
40 %        CB# 3300
41 %        Uni. of North Carolina
42 %        Chapel Hill, NC
43 %                 27599-3300
44 %
45 %        919-962-4466
46 %        blanton@marine.unc.edu
47 %
48
49
Note: See TracBrowser for help on using the browser.