I have an old routine that I wrote many years ago that allows me to perform simple on-screen digitizing, and saves the resulting points in a 2 x N array. I have recently upgraded to IDL 8.1, and this routine no longer works properly. I used to just type a 'q' on the keyboard to quit digitizing and ext out of the function, but now it doesn't recognize the keyboard input. Furthermore, attempting to use this function caused IDL to become unresponsive, and I had to exit and restart IDL. I could type commands in the console and IDL would echo them, but nothing would happen. I'm probably not a good enough programmer to understand what is going wrong with this function, or know how to write a more robust version. I am wondering if you might be able to help me fix this function, or know of a working substitute that I could download. Thanks!
=======================
function scrdig,dummy ; procedure to digitize onscreen
;adapted for 24-bit color 1/20/2000
xy=fltarr(2,100)
;loadct,13
print,'Type Q to quit.'
c=0
for i=0,99 do begin
if get_kbrd(0) eq 'q' then goto, done else begin
cursor,x,y,/data,/down
xy[*,c]=[x,y]
if c eq 0 then plots,x,y,color='ff00ff'x else plots,x,y,color='ff00ff'x,/continue
print,c,x,y
c=c+1
endelse
endfor
done:
plots,xy[ 0,0],xy[1,0],color='ff00ff'x,/continue
xy=xy(*,0:c-2)
print,'polygonal area = ',poly_area(xy[0,*],xy[1,*])
xy=[[xy],[xy[*,0]]]
return,xy
end
|