Appendix B: A routine for plotting grids

Previous: Appendix A: A routine for plotting arrows
Next: Appendix C: Contouring

Appendix B: A routine for plotting grids

      SUBROUTINE Draw_GRID (Grid_Step, Line_Kol)
C     --------------------
      IMPLICIT DOUBLE PRECISION (A-H, O-Z)
      INCLUDE 
      SAVE
      CHARACTER*(8) DUMB
      COMMON /Extents/   XMin, XMax,     YMin, YMax
      COMMON /SCALING/   SCRN_SCALE,     P2X,            P2Y
      COMMON /VIEW/      IHDC,           IXRES,          IYRES
      COMMON /HardCopyMap/   IS_HARD_COPY 
C     ------------------------------------------------------------------

       CALL SET_LINE_STYLE@ (PS_SOLID)
C
C      ... Set number of grid lines to draw (Sept 2007 code from WinTacheo!)
C
       ONSCRN_XMIN = P2X - SCRN_SCALE * IXRES/2 
       ONSCRN_YMIN = P2Y - SCRN_SCALE * IYRES/2

       NGRIDSX = (SCRN_SCALE * IXRES)/GRID_STEP + 1
       NGRIDSY = (SCRN_SCALE * IYRES)/GRID_STEP + 1
       NGRIDS  = MAX (NGRIDSX, NGRIDSY) + 1

       DO 110 I=1, NGRIDS + 1
       NGY = (INT(ONSCRN_YMIN/50)+I-2)*Grid_Step
       NGX = (INT(ONSCRN_XMIN/50)+I-2)*Grid_Step
       AGY = NGY
       AGX = NGX
       IX = (AGX-P2X)/SCRN_SCALE + IXRES/2 + 0.5D0
       IY = IYRES/2 - (AGY-P2Y)/SCRN_SCALE + 0.5D0

       IF (IY .LE. IYRES) THEN
          CALL DRAW_LINE_BETWEEN@(0, IY, IXRES, IY,   Line_Kol)
          ENDIF

       IF (IX .LE. IXRES) THEN
          CALL DRAW_LINE_BETWEEN@(IX,0,  IX,  IYRES,  Line_Kol)
          ENDIF

       IF (IX .GE. 20) THEN
          WRITE(DUMB,'(I6)') NGX
          CALL ROTATE_FONT@(90.0D0)
          CALL DRAW_CHARACTERS@ (DUMB, IX+15, IYRES,  Line_Kol)
          ENDIF

       IF (IY .LE. IYRES-50) THEN
          WRITE(DUMB,'(I6)') NGY
          CALL ROTATE_FONT@ (0.0D0)
          CALL DRAW_CHARACTERS@ (DUMB, 0, IY, Line_Kol)
          ENDIF

 110   CONTINUE

      RETURN
      END
Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited