Class PduTrack

java.lang.Object
edu.nps.moves.dis7.examples.PduTrack

public class PduTrack extends Object
Create a track from DIS ESPDUs
Author:
brutzman@nps.edu
  • Field Details

    • timestampStyle

      public DisTime.TimestampStyle timestampStyle
      what kind of timestamp is being used
    • pduFactory

      protected PduFactory pduFactory
      direct access to pduFactory for creating new PDU instances
    • byteArrayOutputStream

      protected ByteArrayOutputStream byteArrayOutputStream
      direct access to byteArrayOutputStream
    • dataOutputStream

      protected DataOutputStream dataOutputStream
      direct access to DataOutputStream
  • Constructor Details

    • PduTrack

      public PduTrack()
      Constructor for PduTrack
    • PduTrack

      public PduTrack(DisTime.TimestampStyle newTimestampStyle)
      Set timestampStyle used by PduFactory
      Parameters:
      newTimestampStyle - new value to set
  • Method Details

    • getDescriptor

      public String getDescriptor()
      Get simple descriptor (such as parent class name) for this SimulationManager, used in trace statements
      Returns:
      simple descriptor name
    • setDescriptor

      public PduTrack setDescriptor(String newDescriptor)
      Set new simple descriptor (such as parent class name) for this SimulationManager, used in trace statements
      Parameters:
      newDescriptor - simple descriptor name for this interface
      Returns:
      same object to permit progressive setters
    • getTimestampStyle

      public DisTime.TimestampStyle getTimestampStyle()
      Get timestampStyle used by PduFactory
      Returns:
      current timestampStyle
    • setTimestampStyle

      public PduTrack setTimestampStyle(DisTime.TimestampStyle newTimestampStyle)
      Set timestampStyle used by PduFactory
      Parameters:
      newTimestampStyle - the timestampStyle to set
      Returns:
      same object to permit progressive setters
    • getInitialLocation

      public Vector3Double getInitialLocation()
      Determine initial location, reset to (0 0 0) if not found
      Returns:
      current initialLocation
    • getLatestLocation

      public Vector3Double getLatestLocation()
      Determine current location, reset to (0 0 0) if not found
      Returns:
      current latestLocation
    • getPdu

      public Pdu getPdu(int index) throws IndexOutOfBoundsException
      Get individual Pdu from pduList, index must not exceed existing pduList size
      Parameters:
      index - for pdu of interest
      Returns:
      pdu of interest
      Throws:
      IndexOutOfBoundsException
    • getPduList

      public ArrayList<Pdu> getPduList()
      get current pduList
      Returns:
      current pduList
    • getWaypointsList

      public ArrayList<Vector3Double> getWaypointsList()
      get current waypointsList
      Returns:
      current waypointsList
    • getEulerAnglesList

      public ArrayList<EulerAngles> getEulerAnglesList()
      current eulerAnglesList
      Returns:
      current eulerAnglesList
    • getTimelineList

      public ArrayList<Float> getTimelineList()
      Time in seconds corresponding to each PDU
      Returns:
      current timelineList
    • addPdu

      public PduTrack addPdu(Pdu newPdu)
      Add PDU, typically ESPDU
      Parameters:
      newPdu - new Pdu to add, typically ESPDU
      Returns:
      same object to permit progressive setters
    • clearPduLists

      public PduTrack clearPduLists()
      clear all PDUs
      Returns:
      same object to permit progressive setters
    • getX3dTimeSensorDEF

      public String getX3dTimeSensorDEF()
      Provide DEF value if not defined by program
      Returns:
      current x3dTimeSensorDEF
    • setX3dTimeSensorDEF

      public void setX3dTimeSensorDEF(String x3dTimeSensorDEF)
      Set DEF value for X3D node
      Parameters:
      x3dTimeSensorDEF - the x3dTimeSensorDEF to set
    • getX3dPositionInterpolatorDEF

      public String getX3dPositionInterpolatorDEF()
      Provide DEF value if not defined by program
      Returns:
      current x3dPositionInterpolatorDEF
    • setX3dPositionInterpolatorDEF

      public void setX3dPositionInterpolatorDEF(String x3dPositionInterpolatorDEF)
      Set DEF value for X3D node
      Parameters:
      x3dPositionInterpolatorDEF - the x3dPositionInterpolatorDEF to set
    • getX3dOrientationInterpolatorDEF

      public String getX3dOrientationInterpolatorDEF()
      Provide DEF value if not defined by program
      Returns:
      current x3dOrientationInterpolatorDEF
    • setX3dOrientationInterpolatorDEF

      public void setX3dOrientationInterpolatorDEF(String x3dOrientationInterpolatorDEF)
      Set DEF value for X3D node
      Parameters:
      x3dOrientationInterpolatorDEF - the x3dOrientationInterpolatorDEF to set
    • sortPdus

      public PduTrack sortPdus()
      Sort all PDUs by timestamp
      Returns:
      same object to permit progressive setters
      See Also:
    • reversePdus

      public PduTrack reversePdus()
      Reverse order of PDU list
      Returns:
      same object to permit progressive setters
      See Also:
    • isTrackEmpty

      public boolean isTrackEmpty()
      Determine whether any ESPDUs have been received by this track
      Returns:
      whether track is empty
    • getEspduCount

      public int getEspduCount()
      Count ESPDUs in pduList
      Returns:
      number of ESPDUs in pduList
    • getTotalDurationTicks

      public int getTotalDurationTicks()
      Compute track duration in timestamp ticks
      Returns:
      duration in timestamp ticks between initial and final ESPDU timestamps in waypointList
    • getTotalDurationSeconds

      public float getTotalDurationSeconds()
      Compute track duration in seconds
      Returns:
      duration in seconds between initial and final ESPDU timestamps in waypointList
    • createRawWaypoints

      public PduTrack createRawWaypoints()
      Create waypoints and angles using all ESPDU points, with no linear regression or array reduction.
      Returns:
      same object to permit progressive setters
    • createX3dTimeSensorString

      public String createX3dTimeSensorString()
      Utility method to create TimeSensor
      Returns:
      TimeSensor string in XML format
    • createX3dPositionInterpolatorString

      public String createX3dPositionInterpolatorString()
      Create PositionInterpolator from Pdu list
      Returns:
      X3D PositionInterpolator as string
    • createX3dOrientationInterpolatorString

      public String createX3dOrientationInterpolatorString()
      Create OrientationInterpolator from Pdu list TODO preliminary support only includes horizontal rotation.
      Returns:
      X3D OrientationInterpolator as string
    • getAuthor

      public String getAuthor()
      Get name of author used as creator of X3D model
      Returns:
      current author
    • setAuthor

      public void setAuthor(String author)
      Set name of author used as creator of X3D model
      Parameters:
      author - the author to set
    • getX3dModelIdentifier

      public String getX3dModelIdentifier()
      Get name of online url identifier for X3D model
      Returns:
      current x3dModelIdentifier
    • setX3dModelIdentifier

      public void setX3dModelIdentifier(String x3dModelIdentifier)
      Set name of online url identifier for X3D model
      Parameters:
      x3dModelIdentifier - the x3dModelIdentifier to set
    • getX3dModelName

      public String getX3dModelName()
      File name for X3D model production
      Returns:
      current x3dModelName
    • setX3dModelName

      public void setX3dModelName(String x3dModelName)
      File name for X3D model production
      Parameters:
      x3dModelName - the x3dModelName to set
    • hasAddLineBreaksWithinKeyValues

      public boolean hasAddLineBreaksWithinKeyValues()
      Verbose (but more readable) output of numeric arrays in X3D model
      Returns:
      current addLineBreaksWithinKeyValues
    • setAddLineBreaksWithinKeyValues

      public void setAddLineBreaksWithinKeyValues(boolean addLineBreaksWithinKeyValues)
      Verbose (but more readable) output of numeric arrays in X3D model
      Parameters:
      addLineBreaksWithinKeyValues - the addLineBreaksWithinKeyValues to set
    • createX3dModel

      public String createX3dModel()
      Create full X3D interpolator model from Pdu list, assembling sections of scene graph
      Returns:
      X3D model as string
    • createX3dModelHeaderString

      public String createX3dModelHeaderString()
      Create PositionInterpolator from Pdu list
      Returns:
      X3D PositionInterpolator as string
    • createX3dRoutesGeometryFooterString

      public String createX3dRoutesGeometryFooterString()
      Create X3D ROUTEs and footer to connect TimeSensor to interpolators
      Returns:
      X3D PositionInterpolator as string
    • getDefaultWaypointInterval

      public float getDefaultWaypointInterval()
      get defaultWaypointInterval
      Returns:
      current wayPointInterval
    • setDefaultWaypointInterval

      public PduTrack setDefaultWaypointInterval(float newWaypointInterval)
      Set uniform waypoint interval (currently for testing)
      Parameters:
      newWaypointInterval - the wayPointInterval to set, in seconds, must be greater than zero
      Returns:
      same object to permit progressive setters
    • hasInsertCommas

      public boolean hasInsertCommas()
      determine whether comma insertion is turned on
      Returns:
      whether or not to insert commas between hex values
    • setInsertCommas

      public void setInsertCommas(boolean insertCommas)
      set whether comma insertion is turned on
      Parameters:
      insertCommas - the insertCommas value to set
    • bytesToHex

      public String bytesToHex(byte[] bytes, boolean insertCommas)
      Convert byte array to hex string
      Parameters:
      bytes - input data
      insertCommas - whether to insert commas between hex values
      Returns:
      hex string
    • bytesToHex

      public static String bytesToHex(byte[] bytes)
      Convert byte array to hex string
      Parameters:
      bytes - input data
      Returns:
      hex string
      See Also:
    • reportPdu

      public PduTrack reportPdu(EntityStatePdu anEspdu)
      Report current PDU information to console
      Parameters:
      anEspdu - EntityStatePdu of interest
      Returns:
      same object to permit progressive setters
    • flushBuffers

      protected void flushBuffers()
      Flush all buffers to reduce console scrambling while threaded
    • selfTest

      public void selfTest()
      Self test to check basic operation, invoked by main()
    • main

      public static void main(String[] args)
      Main method for testing.
      Parameters:
      args - [address, port, descriptor] command-line arguments are an array of optional String parameters that are passed from execution environment during invocation
      See Also: