! Macro - Messages Lab
!
! Author: George P. Burdell
!
startmacro
  pipe on
    panel/setup
    plot/id=myplot/msgid=main nxm.sys.dat.world.shp
  pipe off
endmacro


procedure processMessage m:msg
  say "Got message name=^msg.name info=^msg.info data=^msg.data from=^msg.fid"

  if msg.name eqs "MARK" then
    calc width  reg.myplot.x2 reg.myplot.x1 - 2 /
    calc height reg.myplot.y2 reg.myplot.y1 - 2 /

    set box { }
    calc box.xmin msg.data.lon width/2  -
    calc box.xmax msg.data.lon width/2  +
    calc box.ymin msg.data.lat height/2 -
    calc box.ymax msg.data.lat height/2 +

    message send myplot NAME="ZOOM" INFO=0 DATA=box

  endif
return
