*"表題 コンター描画 GTOOL3(GGCNTR)
*
*"履歴 90/08/17 沼口  敦
*"     97/12/01 竹広真一 SET -> STX
*
*********************************************************************
*"         << コンター描画 >>
*********************************************************************
      SUBROUTINE GGCNTR
     I         ( HHEAD, GDATA )
*
      CHARACTER  HHEAD ( * )*(*)         !" ヘッダー
      REAL       GDATA ( * )             !" データ
*
      PARAMETER (NBR3=3000*3)
      INTEGER   IBR ( NBR3 )
*
      CALL GUSMIS ( HHEAD )
*
      CALL GHPGET ( HHEAD, 'ASTR1', IXSTR )
      CALL GHPGET ( HHEAD, 'AEND1', IXEND )
      CALL GHPGET ( HHEAD, 'ASTR2', IYSTR )
      CALL GHPGET ( HHEAD, 'AEND2', IYEND )
      IXDIM = IXEND-IXSTR+1
      IYDIM = IYEND-IYSTR+1
*
      CALL GHPGET ( HHEAD, 'MISS' , VMISS )
      CALL GHPGET ( HHEAD, 'DMIN' , DMIN  )
      CALL GHPGET ( HHEAD, 'DMAX' , DMAX  )
      CALL GHPGET ( HHEAD, 'DIVS' , DIVS  )
      CALL GHPGET ( HHEAD, 'DIVL' , DIVL  )
*
      CALL GGPGET ( 'SREMK' , SREMK )
      CALL UDPSTX ( 'RSIZET', SREMK )
      CALL GGPGET ( 'SCONL' , SCONL )
      CALL UDPSTX ( 'RSIZEL', SCONL )
*
      CALL GGPGET ( 'ICYCLE', ICYCLE )
      CALL UDPSTX ( 'ICYCLE', ICYCLE )
*
      CALL GGPGET ( 'CONTSET', ICNSET )
      IF ( ICNSET .LE. 0 ) THEN
         CALL UDICLV
      ENDIF
*
      IF ( (ICNSET .NE. 1) .AND. (DIVS .NE. VMISS) ) THEN
*
         IF ( DIVL .NE. VMISS ) THEN
            ICYCLE = NINT( DIVL/DIVS )
            CALL UDPSTX( 'ICYCLE', ICYCLE )
         ENDIF
*
         CALL GGPGET( 'CONRFCT', CONFAC )
         IF      ( (DMIN.EQ.VMISS) .AND. (DMAX.NE.VMISS) ) THEN
            CONFAC = 1.
         ELSE IF ( (DMIN.NE.VMISS) .AND. (DMAX.EQ.VMISS) ) THEN
            CONFAC = 0.
         ENDIF
*
         IF ( DMIN .EQ. VMISS ) THEN
            DMIN = RMIN( GDATA, IXDIM*IYDIM, 1 )
         ENDIF
         IF ( DMAX .EQ. VMISS ) THEN
            DMAX = RMAX( GDATA, IXDIM*IYDIM, 1 )
         ENDIF
*
         CALL GGPGET( 'NCONMAX', NCONMX )
         NUMCON = INT( (DMAX-DMIN)/DIVS  ) + 1
         IF ( NUMCON .GT. NCONMX ) THEN
            RANGE = DIVS * ( NCONMX-1 )
            DMIN  = DMIN + CONFAC*( DMAX-DMIN - RANGE )
            DMAX  = DMIN + RANGE
         ENDIF
*
         CALL UDGCLA ( DMIN, DMAX, DIVS )
*
      ENDIF
*
      CALL UDCNTZ ( GDATA,
     &              IXDIM, IXDIM, IYDIM,
     &              IBR  , NBR3          )
*
      RETURN
      END
