C
C SUBROUTINE 'QGCIRC'
C ===================
C
C DRAW A CIRCLE (OR PART THEREOF)
C
      SUBROUTINE QGCIRC (XC,YC,RAD,THST,THARC,NSEG)
C
C PARAMETERS
C
C       XC (I)   X CENTRE COORDINATE IN PIXELS 0.0 TO 1023.0 (OR MAPPED 
C                         COORDINATE IF 'QGMAPC' HAS BEEN CALLED)
C       YC (I)   Y CENTRE COORDINATE IN PIXELS 0.0 TO 767.0 (OR MAPPED 
C                         COORDINATE IF 'QGMAPC' HAS BEEN CALLED)
C      RAD (I)   RADIUS OF CIRCLE IN SCREEN PIXELS (0.0-383.5) (OR
C                MAPPED COORDINATE SPACE IF 'QGMAPC' HAS BEEN CALLED; IF
C                THE MAPPING IS NOT THE SAME ON BOTH AXES, AN ELLIPSE WILL
C                BE DRAWN AND THE ANGLES GIVEN BELOW WILL APPLY TO THE
C                EXCENTRIC CIRCLE)
C     THST (I)   START THETA VALUE IN DEGREES (ANTICLOCKWISE FROM X AXIS)
C    THARC (I)   LENGTH OF ARC IN DEGREES (ANTICLOCKWISE)
C     NSEG (I)   NUMBER OF SEGMENTS TO USE IN DRAWING THE ARC
C
C SPECIFICATION STATEMENTS
C ------------------------
C
      LOGICAL MAPSAV
      LOGICAL MAP
      COMMON /QQMAP/ MAP, XPMIN, XPMAX, YPMIN, YPMAX, 
     *               XMMIN, XMMAX, YMMIN, YMMAX, XSC, YSC
      SAVE /QQMAP/
C
C DRAW ARC/CIRCLE
C ---------------
C
      DTOR = 0.0174533
      CALL QGMPXY(XC,YC,XXC,YYC)
      IF (MAP) THEN
         A = RAD*XSC
         B = RAD*YSC
      ELSE
         A = RAD
         B = RAD
      ENDIF
      MAPSAV = MAP
      MAP = .FALSE.
      X = XXC + A*COS(THST*DTOR)
      Y = YYC + B*SIN(THST*DTOR)
      CALL QGMOVE (X,Y)
      DO 100 I=1,NSEG
         TH = DTOR*(THST + I*(THARC/FLOAT(NSEG)))
         X = XXC + A*COS(TH)
         Y = YYC + B*SIN(TH)
         CALL QGDRAW (X,Y)
100   CONTINUE
      MAP = MAPSAV
      RETURN
      END
