SUBROUTINE LEGEND(X,Y,LENGTH,DIA,ISYMB,ILINE,STRING,NCHRS) C C This subroutine generates a sample of line type and an C identifing label. Where, C C X,Y Location of the start of the line sample in scale C inches relative to the relocatable origin. C LENGTH Length of the line sample. If zero, only one symbol C will be drawn; if negative, the line is drawn to the C left and the label is to the left of the line. NOTE: C LENGTH is assumed to be real. C DIA Diameter of the symbols in scale inches. If not positive, C the symbols are not drawn. C ISYMB Symbol type (see SUBROUTINE SYMBOL). If zero, no C symbols are drawn. C ILINE Line type (see SUBROUTINE DSHPLT). If zero, no line C is drawn. C STRING ASCII character string containing the label. C NCHRS Number of characters in the above string. C COMMON /PLTR/ ILun, IDev, IsTerm, IMode, IXMax, IYMax, 1 Cnvrsn, CMag, CnvMag, IX0, IY0, KSetNo, IFancy, IBfDv3, 1 CSize, DeltaH, DeltaV, Upsiln, CosUp, SinUp, WidAdj REAL LENGTH C C - CORRECT NUMBER OF ARGUMENTS? NARG = 0 CALL NUMARG( NARG ) IF( NARG .EQ. 8 ) GO TO 100 CALL OTSERR( 80 ) STOP C C - DRAW SYMBOLS? 100 R = 0. IF( ( DIA .LE. 0. ) .OR. ( ISYMB .EQ. 0 ) ) GO TO 200 CALL SYMBOL(X,Y,DIA,ISYMB) IF( ABS( LENGTH ) .LT. DIA ) GO TO 200 XP = X + CosUp*LENGTH YP = Y + SinUp*LENGTH CALL SYMBOL(XP,YP,DIA,ISYMB) R = SIGN( 0.75*DIA, LENGTH ) C C - DRAW LINE (BETWEEN SYMBOLS)? 200 IF( ( ABS( LENGTH ) .LE. 0. ) .OR. ( ILINE .EQ. 0 ) ) 1 GO TO 300 XP = X + CosUp*R YP = Y + SinUp*R CALL DSHPLT(XP,YP,3,ILINE) R = LENGTH - SIGN( R, LENGTH ) XP = X + CosUp*R YP = Y + SinUp*R CALL DSHPLT(XP,YP,2,ILINE) C C - ADD LABEL. 300 IF( NCHRS .LE. 0 ) RETURN R = LENGTH + 2.*DeltaH IF( LENGTH .GE. 0. ) GO TO 400 CALL HCSIZE(STRING,NCHRS,W,HA,HB) R = LENGTH - W - 2.*DeltaH C 400 XP = X + CosUp*R + SinUp*CSize/2. YP = Y + SinUp*R - CosUp*CSize/2. CALL HCGEN(XP,YP,STRING,NCHRS) C RETURN END