!******************************************************************************!
! Test plotting map from NeXtMidas (NeXtEarth) Map Server onto PLOT
! without an accompanying world.prm.
!
! Arguments: None
!
! @bug:     NXM-1267 LayerMap: WMS and NMS look strange if not accompanied
!                    by a world file
! @since:   NeXtMidas 2.9.0
! @author:  Neon Ngo
!******************************************************************************!
startmacro fn:url["http://nextmidas.com:8080/nms"] s:background["NightSky"]
  switch INTERACTIVE interAct    GET DEF=TRUE  SDEF=TRUE  ! for normal interactive test(s)
  switch BASELINE    baseline    GET DEF=FALSE SDEF=TRUE  ! for defects or more obscure test case(s)
  switch ALTTESTENV  alttestenv  GET DEF=FALSE SDEF=TRUE

  if alttestenv then
    res urlFileAltNms "nextmidas_url_alt_nms.txt"
    if urlFileAltNms nfexists then
      warn "^reg.main.name: SKIPPING since running in alternate test environment but ^{urlFileAltNms} not found"
      stop
    else
      file open tag urlFileAltNms
      file read tag url
      file close tag
    endif
  endif

  if interAct then
    pipe on
      panel/msgid=MAIN/setup/controls=gc
      plot/id=idplot {LT="NMS",URL="^url",Background=background} view=LatLon

      gcontrol label macro "MACRO"
      gcontrol menu    main "Exit with Status = " "PASS,FAIL" /tleft
      set gc.main.itemColors {PASS=GREEN,FAIL=RED}

      set instructions "World map from NMS Map Server should be displayed with Position (0,0) &
                        in the middle of the PLOT using the '^{background}' background."
      gcontrol text    idtext "Instructions" "^instructions" 24 8 /title

    pipe off
  endif

endmacro

!******************************************************************************!
procedure processMessage m:msg
  if msg.name eqs "MAIN" then
    assert/text="^reg.main.name: Interactive tests" msg.data eqss "PASS"
    pipe stop
  else
    say "Unhandled message name: ^msg.name from fid: ^msg.fid dats: ^msg.data"
  endif
return
