!
! Test for plotting a LARGE raster image (Type 2000 file) over a map.
! See Bug 724 for details.
!
! Author:  J. Czechowski
!
startmacro
  switch INTERACTIVE interAct GET DEF=TRUE  SDEF=TRUE
  switch BASELINE    baseline GET DEF=FALSE SDEF=TRUE

  call setDatDir

  if interAct then
    ! Make the sample file
    info "^reg.main.name: generating large input file..."
    WAVEFORM OUT=temp_file FORM=SF ELEM=2M SHAPE=white
    info "^reg.main.name: computing PSD..."
    fft/dbf IN=temp_file OUT=temp_file2
    headermod temp_file2 XS=0 YS=0 YD=0.01 XD=0.01
    set instructions "(KNOWN DR: The raster does not show up on the map.) &
                      Should be able to see the raster on the plot... TBD"

    pipe init
      panel/msgid=MAIN/setup/controls=gc
      plot/id=map ^{datDir}.world.prm|temp_file2 scale=-auto x1=-40 x2=40 y1=-10 y2=80
      plot/id=raster temp_file2

      gcontrol text idtext "Instructions" "^{instructions}" 24 5 /title
      gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
      set gc.main.itemColors {PASS=GREEN,FAIL=RED}

    pipe off

    erase/quiet/warn=n "temp_file"
    erase/quiet/warn=n "temp_file2"
  endif
endmacro

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

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

  if msg.name eqs "MAIN" then
    assert/text="Tests for DR 553688-1 (Bug 724)" msg.data eqss "PASS" 
    pipe stop
  else
    ! do nothing
    say "Unhandled message name: ^msg.name from fid: ^msg.fid dats: ^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
