*-----------------------------------------------------------------------
      SUBROUTINE SGTNXR(N,RPX,RPY,ITPAT,ICOLOR)

      REAL      RPX(*),RPY(*)
      LOGICAL   LFCATR
      INTEGER   ITPATX

      CALL SGIGET('IFCIDX',IFCIDX)

      CALL SWQFCC(LFCATR)
      IF(.NOT.LFCATR) THEN
        CALL MSGDMP('M','SGTNXR','FULL COLOR MODE IS NOT SUPPORTED.')
      END IF

      IF (N.LT.3) THEN
        CALL MSGDMP('E','SGTNXR','NUMBER OF POINTS IS LESS THAN 3.')
      END IF
      IF (ITPAT.EQ.0) THEN
        CALL MSGDMP('M','SGTNXR','TONE PAT. INDEX IS 0 / DO NOTHING.')
        RETURN
      END IF
      IF (ITPAT.LT.0) THEN
        CALL MSGDMP('E','SGTNXR','TONE PAT. INDEX IS LESS THAN 0.')
      END IF

      CALL SWSFCM(.TRUE.)
      CALL SWSTCL(ICOLOR)
      CALL SWSLCL(ICOLOR)

      ITPATX=IFCIDX*1000+MOD(ITPAT,1000)
      CALL SZTNOP(ITPATX)
      CALL SZTNZR(N,RPX,RPY)
      CALL SZTNCL

      CALL SWSFCM(.FALSE.)

      END
