;------------------------------------------------------------- ;+ ; NAME: ; PROTRACTOR ; PURPOSE: ; Measure angles on the screen. ; CATEGORY: ; CALLING SEQUENCE: ; protractor ; INPUTS: ; KEYWORD PARAMETERS: ; Keywords: ; ANGLE=a measured angle returned. ; LENGTH=len measured lengths returned as 2 element array. ; FACTOR=f Length conversion factor (def=1). ; COLOR=c Plot color to use (def=!p.color). ; /QUIET suppresses messages. ; OUTPUTS: ; COMMON BLOCKS: ; protractor_com ; NOTES: ; Notes: lengths are listed and returned in pixels unless ; over-ridden by FACTOR. ; MODIFICATION HISTORY: ; R. Sterner, 12 Feb, 1993 (inspired by Bob Taylor's angle.pro). ; R. Sterner, 16 Mar, 1993 --- added no erase exit. ; R. Sterner, 16 Mar, 1993 --- added exit coordinate list. ; ; Copyright (C) 1993, Johns Hopkins University/Applied Physics Laboratory ; This software may be used, copied, or redistributed as long as it is not ; sold and this copyright notice is reproduced on each copy made. This ; routine is provided as is without any express or implied warranties ; whatsoever. Other limitations apply as described in the file disclaimer.txt. ;- ;------------------------------------------------------------- pro protractor, angle=ang, length=len, color=color, quiet=quiet, $ factor=fctr, help=hlp, initialize=init common protractor_com, xa, ya, xb, yb, xc, yc if keyword_set(hlp) then begin print,' Measure angles on the screen.' print,' protractor' print,' All args are output keywords.' print,' Keywords:' print,' ANGLE=a measured angle returned.' print,' LENGTH=len measured lengths returned as 2 element array.' print,' FACTOR=f Length conversion factor (def=1).' print,' COLOR=c Plot color to use (def=!p.color).' print,' /QUIET suppresses messages.' print,' Notes: lengths are listed and returned in pixels unless' print,' over-ridden by FACTOR.' return endif scrn = tvrd() ; Read screen image. if n_elements(color) eq 0 then color = !p.color if n_elements(fctr) eq 0 then fctr = 1. cflag = 1 ; Change flag. Start with yes. flag = 3 ; Active point flag (1=A, 2=B, 3=C). ;---------------------------------------------------------------- ; Protractor has 2 sides: AC and BC where C is center of angle ; and A and B are side endpoints. ;---------------------------------------------------------------- ;--------- Initialize common ----------- if (n_elements(xa) eq 0) or keyword_set(init) then begin xsz = !d.x_size ; Screen size in x and y. ysz = !d.y_size xc = xsz/2 ; Center of protractor. yc = ysz/2 r = .3*(xsz