*"$BI=Bj(B $B%Y%/%H%kIA2h(B GTOOL3(GGVECT)
*
*"$BMzNr(B 90/08/17 $B>B8}(B  $BFX(B
*"     90/10/17 $B>B8}(B  $BFX(B
*"     95/05/31 $BC]9-??0l(B for dcl-5.0
*"     97/12/01 $BC]9-??0l(B UGPSET -> UGPSTX
*
*********************************************************************
*"         << $B%Y%/%H%kIA2h(B >>
*********************************************************************
      SUBROUTINE GGVECT
     I         ( HHEADU, GDATAU,
     I           HHEADV, GDATAV )
*
      CHARACTER  HHEADU ( * )*(*)        !" $B%X%C%@!<(B(u$B@.J,(B)
      CHARACTER  HHEADV ( * )*(*)        !" $B%X%C%@!<(B(v$B@.J,(B)
      REAL       GDATAU ( * )            !" $B%G!<%?(B(u$B@.J,(B)
      REAL       GDATAV ( * )            !" $B%G!<%?(B(v$B@.J,(B)
*
      LOGICAL    OUNIT
      LOGICAL    OEQRAT
*
      CALL GUSMIS ( HHEADU )
*
      CALL GUQSIZ
     I         ( HHEADU,
     O           IXSTR , IXEND , IXDIM ,
     O           IYSTR , IYEND , IYDIM ,
     O           IZSTR , IZEND , IZDIM  )
*
      CALL GHPGET ( HHEADU, 'MISS' , UMISS  )
      CALL GHPGET ( HHEADU, 'DMIN' , UMIN   )
      CALL GHPGET ( HHEADU, 'DMAX' , UMAX   )
      CALL GHPGET ( HHEADU, 'STYP' , ISTYPU )
*
      CALL GHPGET ( HHEADV, 'MISS' , VMISS  )
      CALL GHPGET ( HHEADV, 'DMIN' , VMIN   )
      CALL GHPGET ( HHEADV, 'DMAX' , VMAX   )
      CALL GHPGET ( HHEADV, 'STYP' , ISTYPV )
*
      CALL GGPGET ( 'VXINT'  , IXINT )
      CALL GGPGET ( 'VYINT'  , IYINT )
      CALL UGPSTX ( 'IXINT'  , IXINT )
      CALL UGPSTX ( 'IYINT'  , IYINT )
*
      CALL GGPGET ( 'LUNIT'  , OUNIT   )
      CALL UGPSTX ( 'LUNIT'  , OUNIT   )
      CALL GGPGET ( 'VXULOC' , VXULOC  )
      CALL GGPGET ( 'VYULOC' , VYULOC  )
      CALL UGPSTX ( 'VXULOC' , VXULOC  )
      CALL UGPSTX ( 'VYULOC' , VYULOC  )
      CALL GGPGET ( 'SREMK'  , SREMK   )
      CALL UGPSTX ( 'RSIZET' , SREMK   )
      CALL UGPSTX ( 'RSIZEUT', SREMK   )
*
      CALL GGPGET ( 'LEQRAT' , OEQRAT  )
      CALL UGPSTX ( 'LEQRAT' , OEQRAT  )
      CALL UGPSTX ( 'LNRMAL' , .FALSE. )
*
      CALL GGPGET ( 'VECFCT' , VECFCT )
*
      CALL SGQVPT ( VXMIN , VXMAX , VYMIN , VYMAX )
*
      IF ( UMIN .EQ. UMISS ) UMIN = RMIN( GDATAU, IXDIM*IYDIM, 1 )
      IF ( UMAX .EQ. UMISS ) UMAX = RMAX( GDATAU, IXDIM*IYDIM, 1 )
      AUMAX = MAX( ABS( UMIN ), ABS( UMAX ) )
      XFACT = VECFCT/AUMAX
     &        * ( VXMAX-VXMIN )/MAX( 1,IXDIM-1 ) * IXINT
      XFACT = RGNLE ( XFACT )
*
      IF ( VMIN .EQ. VMISS ) VMIN = RMIN( GDATAV, IXDIM*IYDIM, 1 )
      IF ( VMAX .EQ. VMISS ) VMAX = RMAX( GDATAV, IXDIM*IYDIM, 1 )
      AVMAX = MAX( ABS( VMIN ), ABS( VMAX ) )
      YFACT = VECFCT/AVMAX
     &        * ( VYMAX-VYMIN )/MAX( 1,IYDIM-1 ) * IYINT
      YFACT = RGNLE ( YFACT )
*
      IF ( OEQRAT ) THEN
         XFACT = MIN( XFACT, YFACT )
         YFACT = XFACT
      ENDIF
      IF ( ISTYPU .LT. 0 ) XFACT = - XFACT
      IF ( ISTYPV .LT. 0 ) YFACT = - YFACT
*
      CALL UGPSTX ( 'XFACT1', XFACT )
      CALL UGPSTX ( 'YFACT1', YFACT )
*
      CALL UGVECT ( GDATAU, IXEND-IXSTR+1,
     &              GDATAV, IXEND-IXSTR+1,
     &              IXEND-IXSTR+1, IYEND-IYSTR+1 )
*
      RETURN
      END
