!******************************************************************************!
! Tests that extra blank margins are not present on lat lon continuous zooms
! (i.e. that the appropriate adjustments are made)
!
! @bug      NXM-3417 LatLonContinuous zoom
! @since    3.9.2
! @author:  Jeanette McCall
!******************************************************************************!
startmacro S:file_ext["shp"] 
  switch INTERACTIVE interAct   GET DEF=TRUE  SDEF=TRUE
  switch BASELINE    baseline   GET DEF=FALSE SDEF=TRUE

  call setDatDir

  if interAct then

    set instructions "Should see a plot of the world proportioned such that their are x margins:\n&
                      1) Try combinations of zooming in on boundaries near these margins, panning, and unzooming.\n\n&
                      2) The zoom that render less than 360 degrees should not show blank margins, but the appropriate map area.\n\n&
                      3) Right click zoom out should always back out a level and show the correct bounds."

    pipe init

      httpserv 9080 DIR="nxm/sys/test" NAME="test"
  
      ! Change the keyMap to custom settings
      env set KEYMAP {PLOT={LEFT="L",RIGHT="R",in=i,down=d,up=u,out=o}}

      panel/setup/controls=gc
      !/usemouseposition
      plot/msgid=MAIN/id=idplot/mousewheelzoom/USEMOUSEPOSITION/READOUT="+OnAxis"/zoomadj=.1/DBLCLICKZOOM &
              ^{datDir}.world.shp view=latloncontinuous

      gcontrol label mainLabel "Main"
      gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
      set gc.main.itemColors {PASS=GREEN,FAIL=RED}
      gcontrol text idtext "Instructions" instructions 46 20 /title
 
    pipe off

  endif

endmacro

!******************************************************************************!
procedure processMessage m:msg

  !say "msg.name ^msg.name, data ^msg.data"

  if msg.name eqs "MAIN" then
    assert/text="Plot ZOOM tests" msg.data eqss "PASS" 
    ! Set keyMap back to default
    res t:km "nxm.sys.cfg.keyMap.tbl"
    env set keymap ^km
    pipe stop
  elseif msg.fid eqs "IDPLOT"  then
    if msg.name eqs "DRAGBOX" then
      set box1.setBoundsFromTable(msg.data)
    endif
  else
    ! do nothing
    !say "^reg.main.name: Unhandled message name: ^msg.name from fid: ^msg.fid data: ^msg.data"
  endif

return

!******************************************************************************!
! Set the dat directory
!******************************************************************************!
procedure setDatDir
  invoke nxmMajor env.nmversion.subString(0,1)
  invoke major java.lang.Integer.valueOf(nxmMajor)
  if major GE 4 then
    invoke s:datDir           nxm.sys.test.DatLocator.getDatDirLocation()
    invoke s:datDirSlash      nxm.sys.test.DatLocator.getDatDirSlashLocation()
    invoke z:sysDatFull       nxm.sys.test.DatLocator.sysDatFull()
    invoke z:sysTestDatExists nxm.sys.test.DatLocator.sysTestDatExists()
  else
    set s:datDir           "nxm.sys.dat"
    set s:datDirSlash      "nxm/sys/dat"
    set z:sysDatFull       true
    set z:sysTestDatExists false
  endif
return

!******************************************************************************!
procedure open
  ! Automatically called
return
