!
! Test PLOT's handling of cartesian coordinates with a map view. For this test, we are just checking
! to see that CARTESIAN coordinates have the same pixel position as the corresponding GEODETIC
! coordinates would have. This aleviates any issues with screen sizing, etc. since we are just
! checking to see that the two match. This test is non-interactive, but is graphical since it
! needs to launch PLOT in order to do the tests.
!
! 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
    pipe init
      panel/msgid=MAIN/setup/controls=gc

      foreach view inList "LatLon,Geodetic,Mercator"
        plot/id=plot^{view} ^{datDir}.world.prm view=^{view}
        
        invoke posGeo nxm.sys.lib.Position.fromGeo(1000,30,45)
        new nxm.sys.lib.Position(0) posCar
        invoke posCar.setCar(^{posGeo.x},^{posGeo.y},^{posGeo.z})
        
        invoke pixGeo reg.plot^{view}.getPoint(posGeo)
        invoke pixCar reg.plot^{view}.getPoint(posCar)

        assert/text="^reg.main.name: Check MPlot.getPoint(..) view=^{view} (X)" pixGeo.x eq pixCar.x
        assert/text="^reg.main.name: Check MPlot.getPoint(..) view=^{view} (Y)" pixGeo.y eq pixCar.y
      endfor

      pipe stop ! done tests
    pipe off
  endif
endmacro

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