C
C	$Id: drawpv.f,v 1.5 2008-07-27 00:23:03 haley Exp $
C                                                                      
C                Copyright (C)  2000
C        University Corporation for Atmospheric Research
C                All Rights Reserved
C
C The use of this Software is governed by a License Agreement.
C
      SUBROUTINE DRAWPV (IX,IY,IND)
C
C DRAWPV INTERCEPTS THE CALL TO PLOTIT TO CHECK IF THE PEN HAS TO BE
C MOVED OR IF IT IS ALREADY CLOSE ENOUGH TO THE WANTED POSITION.
C IF IND=2 NEVER MOVE PEN, JUST UPDATE VARIABLES IXSTOR AND IYSTOR.
C
C IN IXSTOR AND IYSTOR THE CURRENT POSITION OF THE PEN IS SAVED.
C
      COMMON /DSAVE3/ IXSTOR,IYSTOR
C
      COMMON/INTPR/IPAU,FPART,TENSN,NP,SMALL,L1,ADDLR,ADDTB,MLLINE,
     1    ICLOSE
      SAVE
      IIND = IND + 1
      GOTO (100,90,105), IIND
C
   90 CONTINUE
C
C DRAW LINE AND SAVE POSITION OF PEN.
C
      IXSTOR = IX
      IYSTOR = IY
      CALL PLOTIT (IXSTOR,IYSTOR,1)
      GOTO 110
C
  100 CONTINUE
C
C CHECK IF PEN IS ALREADY CLOSE ENOUGH TO THE WANTED POSITION.
C
      DIFF = REAL(ABS(IXSTOR-IX)+ABS(IYSTOR-IY))
      IF (DIFF .LE. REAL(ICLOSE)) GO TO 110
C
      IXSTOR = IX
      IYSTOR = IY
      CALL PLOTIT (IXSTOR,IYSTOR,0)
      GOTO 110
C
  105 CONTINUE
C
C DO NOT MOVE PEN. JUST UPDATE VARIABLES IXSTOR AND IYSTOR.
C
      IXSTOR = IX
      IYSTOR = IY
C
  110 CONTINUE
C
      RETURN
      END
