# ****************************************************************************
# CUI
#
# The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
#
# The use, dissemination or disclosure of data in this file is subject to
# limitation or restriction. See accompanying README and LICENSE for details.
# ****************************************************************************



behavior draw_master_track_list

   script_variables
      WsfDraw draw = WsfDraw();
   end_script_variables


   on_init
   end_on_init


   precondition
      writeln_d("precondition draw_master_track_list");
      if (PLATFORM.MasterTrackList().Count() <= 0)
      {
         return false;
      }
      draw.SetDuration(PROCESSOR.UpdateInterval());
      return true;
   end_precondition


   execute
      writeln_d("executing draw_master_track_list");
      draw.SetLineSize(2);
      draw.BeginLines();
         foreach(WsfLocalTrack t in PLATFORM.MasterTrackList())
         {
            draw.SetColor(1.0, 1.0, 0.0); //yellowish
            draw.Vertex(PLATFORM.Location());
            draw.Vertex(t.CurrentLocation());
            for(int i=0; i<t.RawTrackCount(); i=i+1)
            {
               WsfTrack x = t.RawTrack(i);
               if (x.LocationValid())
               {
                  draw.SetColor(0.0, 1.0, 0.0); //green
                  draw.Vertex(x.CurrentLocation());
                  draw.Vertex(t.CurrentLocation());
               }
            }
            draw.SetColor(0.0, 0.0, 1.0); //blue
            draw.Vertex(t.CurrentLocation());
            draw.Vertex(t.Target().Location());
         }
      draw.End();
   end_execute

end_behavior
