!******************************************************************************!
! Tests the counting of points in LayerT5 in LatLonContinuous.
!
! Arguments: None
!
! @bug      NXM-4014 LayerT5 Point count inaccurate in LatLonContinuous
! @since    NeXtMidas 4.1.3
! @author:  Zachary Matthews
!******************************************************************************!
startmacro
  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)

  if interAct then
    call setDatDir

    set instructions "The point count should be 2.\n&
                      _________________________________________\n&
                      Note:\n&
                      Background: Point3D.hit had incorrect logic when checking the longitude for points in LatLonContinous, &
                      causing LayerT5 to give inaccurate point counts in LatLonContinuous that were larger &
                      than the amount of points actually displayed."
    pipe on
      panel/msgid=MAIN/setup/controls=gc
      plot/mousewheelzoom/usemouseposition/id=cities ^{datDir}.world.prm|{LT="Drawable",name=t5Group,listlayers=true}|&
                                                    ^{datDir}.cities.prm{Layer={NAME=cities,group=t5Group,formRegions=true}}|&
                                                    ^{datDir}.ellipse5000.prm{Layer={NAME=ellipse5000,group=t5Group}} &
                                                    readoutExt=+SHOW|+FEATURE|+POINTS readout=+OnAxis view=latloncontinuous

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

      message sendw id=cities name=ZOOM data={xmin=182.3,xmax=223.8,ymin=10.1,ymax=31.0}
    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

!******************************************************************************!
! 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
