Package edu.nps.moves.dis7.examples
Class PduTrack
java.lang.Object
edu.nps.moves.dis7.examples.PduTrack
Create a track from DIS ESPDUs
- Author:
- brutzman@nps.edu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ByteArrayOutputStreamdirect access to byteArrayOutputStreamprotected DataOutputStreamdirect access to DataOutputStreamprotected PduFactorydirect access to pduFactory for creating new PDU instanceswhat kind of timestamp is being used -
Constructor Summary
ConstructorsConstructorDescriptionPduTrack()Constructor for PduTrackPduTrack(DisTime.TimestampStyle newTimestampStyle) Set timestampStyle used by PduFactory -
Method Summary
Modifier and TypeMethodDescriptionAdd PDU, typically ESPDUstatic StringbytesToHex(byte[] bytes) Convert byte array to hex stringbytesToHex(byte[] bytes, boolean insertCommas) Convert byte array to hex stringclear all PDUsCreate waypoints and angles using all ESPDU points, with no linear regression or array reduction.Create full X3D interpolator model from Pdu list, assembling sections of scene graphCreate PositionInterpolator from Pdu listCreate OrientationInterpolator from Pdu list TODO preliminary support only includes horizontal rotation.Create PositionInterpolator from Pdu listCreate X3D ROUTEs and footer to connect TimeSensor to interpolatorsUtility method to create TimeSensorprotected voidFlush all buffers to reduce console scrambling while threadedGet name of author used as creator of X3D modelfloatget defaultWaypointIntervalGet simple descriptor (such as parent class name) for this SimulationManager, used in trace statementsintCount ESPDUs in pduListcurrent eulerAnglesListDetermine initial location, reset to (0 0 0) if not foundDetermine current location, reset to (0 0 0) if not foundgetPdu(int index) Get individual Pdu from pduList, index must not exceed existing pduList sizeget current pduListTime in seconds corresponding to each PDUGet timestampStyle used by PduFactoryfloatCompute track duration in secondsintCompute track duration in timestamp ticksget current waypointsListGet name of online url identifier for X3D modelFile name for X3D model productionProvide DEF value if not defined by programProvide DEF value if not defined by programProvide DEF value if not defined by programbooleanVerbose (but more readable) output of numeric arrays in X3D modelbooleandetermine whether comma insertion is turned onbooleanDetermine whether any ESPDUs have been received by this trackstatic voidMain method for testing.reportPdu(EntityStatePdu anEspdu) Report current PDU information to consoleReverse order of PDU listvoidselfTest()Self test to check basic operation, invoked by main()voidsetAddLineBreaksWithinKeyValues(boolean addLineBreaksWithinKeyValues) Verbose (but more readable) output of numeric arrays in X3D modelvoidSet name of author used as creator of X3D modelsetDefaultWaypointInterval(float newWaypointInterval) Set uniform waypoint interval (currently for testing)setDescriptor(String newDescriptor) Set new simple descriptor (such as parent class name) for this SimulationManager, used in trace statementsvoidsetInsertCommas(boolean insertCommas) set whether comma insertion is turned onsetTimestampStyle(DisTime.TimestampStyle newTimestampStyle) Set timestampStyle used by PduFactoryvoidsetX3dModelIdentifier(String x3dModelIdentifier) Set name of online url identifier for X3D modelvoidsetX3dModelName(String x3dModelName) File name for X3D model productionvoidsetX3dOrientationInterpolatorDEF(String x3dOrientationInterpolatorDEF) Set DEF value for X3D nodevoidsetX3dPositionInterpolatorDEF(String x3dPositionInterpolatorDEF) Set DEF value for X3D nodevoidsetX3dTimeSensorDEF(String x3dTimeSensorDEF) Set DEF value for X3D nodesortPdus()Sort all PDUs by timestamp
-
Field Details
-
timestampStyle
what kind of timestamp is being used -
pduFactory
direct access to pduFactory for creating new PDU instances -
byteArrayOutputStream
direct access to byteArrayOutputStream -
dataOutputStream
direct access to DataOutputStream
-
-
Constructor Details
-
PduTrack
public PduTrack()Constructor for PduTrack -
PduTrack
Set timestampStyle used by PduFactory- Parameters:
newTimestampStyle- new value to set
-
-
Method Details
-
getDescriptor
Get simple descriptor (such as parent class name) for this SimulationManager, used in trace statements- Returns:
- simple descriptor name
-
setDescriptor
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
Get timestampStyle used by PduFactory- Returns:
- current timestampStyle
-
setTimestampStyle
Set timestampStyle used by PduFactory- Parameters:
newTimestampStyle- the timestampStyle to set- Returns:
- same object to permit progressive setters
-
getInitialLocation
Determine initial location, reset to (0 0 0) if not found- Returns:
- current initialLocation
-
getLatestLocation
Determine current location, reset to (0 0 0) if not found- Returns:
- current latestLocation
-
getPdu
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
get current pduList- Returns:
- current pduList
-
getWaypointsList
get current waypointsList- Returns:
- current waypointsList
-
getEulerAnglesList
current eulerAnglesList- Returns:
- current eulerAnglesList
-
getTimelineList
Time in seconds corresponding to each PDU- Returns:
- current timelineList
-
addPdu
Add PDU, typically ESPDU- Parameters:
newPdu- new Pdu to add, typically ESPDU- Returns:
- same object to permit progressive setters
-
clearPduLists
clear all PDUs- Returns:
- same object to permit progressive setters
-
getX3dTimeSensorDEF
Provide DEF value if not defined by program- Returns:
- current x3dTimeSensorDEF
-
setX3dTimeSensorDEF
Set DEF value for X3D node- Parameters:
x3dTimeSensorDEF- the x3dTimeSensorDEF to set
-
getX3dPositionInterpolatorDEF
Provide DEF value if not defined by program- Returns:
- current x3dPositionInterpolatorDEF
-
setX3dPositionInterpolatorDEF
Set DEF value for X3D node- Parameters:
x3dPositionInterpolatorDEF- the x3dPositionInterpolatorDEF to set
-
getX3dOrientationInterpolatorDEF
Provide DEF value if not defined by program- Returns:
- current x3dOrientationInterpolatorDEF
-
setX3dOrientationInterpolatorDEF
Set DEF value for X3D node- Parameters:
x3dOrientationInterpolatorDEF- the x3dOrientationInterpolatorDEF to set
-
sortPdus
Sort all PDUs by timestamp- Returns:
- same object to permit progressive setters
- See Also:
-
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
Create waypoints and angles using all ESPDU points, with no linear regression or array reduction.- Returns:
- same object to permit progressive setters
-
createX3dTimeSensorString
Utility method to create TimeSensor- Returns:
- TimeSensor string in XML format
-
createX3dPositionInterpolatorString
Create PositionInterpolator from Pdu list- Returns:
- X3D PositionInterpolator as string
-
createX3dOrientationInterpolatorString
Create OrientationInterpolator from Pdu list TODO preliminary support only includes horizontal rotation.- Returns:
- X3D OrientationInterpolator as string
-
getAuthor
Get name of author used as creator of X3D model- Returns:
- current author
-
setAuthor
Set name of author used as creator of X3D model- Parameters:
author- the author to set
-
getX3dModelIdentifier
Get name of online url identifier for X3D model- Returns:
- current x3dModelIdentifier
-
setX3dModelIdentifier
Set name of online url identifier for X3D model- Parameters:
x3dModelIdentifier- the x3dModelIdentifier to set
-
getX3dModelName
File name for X3D model production- Returns:
- current x3dModelName
-
setX3dModelName
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
Create full X3D interpolator model from Pdu list, assembling sections of scene graph- Returns:
- X3D model as string
-
createX3dModelHeaderString
Create PositionInterpolator from Pdu list- Returns:
- X3D PositionInterpolator as string
-
getDefaultWaypointInterval
public float getDefaultWaypointInterval()get defaultWaypointInterval- Returns:
- current wayPointInterval
-
setDefaultWaypointInterval
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
Convert byte array to hex string- Parameters:
bytes- input datainsertCommas- whether to insert commas between hex values- Returns:
- hex string
-
bytesToHex
Convert byte array to hex string- Parameters:
bytes- input data- Returns:
- hex string
- See Also:
-
reportPdu
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
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:
-