! Macro - Procedures - Lab 1
!
! Author: George P. Burdell
!
startmacro fn:in d:start d:end d:delta
  ! Setup the numeric formats that we will use in printStateVector
  invoke timeFormat nxm.sys.lib.MFormat.getNumberFormatFor("HMS")
  invoke lonFormat  nxm.sys.lib.MFormat.getAngleFormatFor("ddd''mm''ss.sssE")
  invoke latFormat  nxm.sys.lib.MFormat.getAngleFormatFor("ddd''mm''ss.sssN")
  invoke altFormat  nxm.sys.lib.MFormat.getNumberFormatFor("#'m'")

  new nxm.sys.lib.StateVector(this,in) sv
  do time start end delta
    ! Update the time for the state vector (this recomputes the positional
    ! values for the given the input time).
    invoke ,, sv.setTime(time)
    
    ! Call the printStateVector procedure to print out the current value.
    call printStateVector sv
  enddo
  
endmacro


! Prints out a state vector. Be sure to use the formats setup up
! at the top of the macro.
!
procedure printStateVector o:stateVector
  invoke timeStr timeFormat.format(stateVector.t)
  invoke lonStr  lonFormat.format(stateVector.lon)
  invoke latStr  latFormat.format(stateVector.lat)
  invoke altStr  altFormat.format(stateVector.alt)
  
  say "^{timeStr}: ^lonStr ^latStr ^altStr"
return
