!-------------------------------------------------
!  UMpack Module
!-------------------------------------------------
module umpack
  use dcl_common
  contains
!以下の２つは見当たらない
!UMQCNT(XCNT, YCNT, ROT)				DclGetMapContactPoint
!UMQCWD(XCNTR, YCNTR, R)				DclGetCircleWindow

!-------------------------------------------------
    subroutine DclSetMapContactPoint(x, y, rot)  !投影面の「接点」を指定する．
      real, intent(in), optional :: x, y, rot 

      call glrget('rundef', rundef)

      x0   = rundef
      y0   = rundef
      rot0 = rundef

      if(present(x))    x0   = x
      if(present(y))    y0   = y
      if(present(rot))  rot0 = rot
      
      call umscnt(x0, y0, rot0) 
    end subroutine
!-------------------------------------------------
    subroutine DclSetCircleWindow(x, y, r)  !円形のウィンドウを設定する．
      real,intent(in), optional :: x, y, r  

      call glrget('rundef', rundef)

      x0   = rundef
      y0   = rundef
      rot0 = rundef

      if(present(x))  x0 = x
      if(present(y))  y0 = y
      if(present(r))  r0 = r
      
      call umscwd(x0, y0, r0) 
    end subroutine
!-------------------------------------------------
    subroutine DclSetMapPoint(x, y)        !地図に含める点を指定する．
      real, intent(in), dimension(:) :: x,y  !点の経度，緯度

      nx = size(x)
      ny = size(y)

      if(nx.ne.ny) call msgdmp('M', 'DclSetMapPoint', 'Length of x and y don''t match.')

      n = min(nx, ny)
      call umspnt(n, x, y)
    end subroutine
!-------------------------------------------------
    subroutine DclFitMapParm()         !地図投影の変換関数のパラメタを適切に決める．
      call umpfit() 
    end subroutine
!-------------------------------------------------
    subroutine DclDrawGlobe()          !地図の境界線（縁）と緯度線,経度線を描く．
      call umpglb() 
    end subroutine
!-------------------------------------------------
    subroutine DclDrawGrid()           !緯度線・経度線を描く．
      call umpgrd()  
    end subroutine
!-------------------------------------------------
    subroutine DclDrawLimb()           !地図の境界線（縁）を描く．
      call umplim()
    end subroutine
!-------------------------------------------------
    subroutine DclDrawMap(cdsn)        !各種地図情報を描く．
      character(len=*), intent(in) :: cdsn        !地図情報ファイル名
      call umpmap(cdsn)
    end subroutine
!-------------------------------------------------
end module
