From 538d3e731d847a163215919d32ece0699407313b Mon Sep 17 00:00:00 2001 From: sirtobi79 <brenni.usa@gmail.com> Date: Tue, 2 Jun 2020 15:08:53 -0700 Subject: [PATCH] Updated PduPlayer.java to have X3d autogenerated code --- .../dis7/utilities/stream/PduPlayer.java | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/edu/nps/moves/dis7/utilities/stream/PduPlayer.java b/src/edu/nps/moves/dis7/utilities/stream/PduPlayer.java index ffcac479eb..92d07ded6d 100644 --- a/src/edu/nps/moves/dis7/utilities/stream/PduPlayer.java +++ b/src/edu/nps/moves/dis7/utilities/stream/PduPlayer.java @@ -42,7 +42,7 @@ public class PduPlayer { static final String ENCODING_WIRESHARK_DATA_LOGGER = "ENCODING_WIRESHARK_DATA_LOGGER"; // static final String ENCODING_CDIS = "ENCODING_CDIS"; // future work based on new SISO standard - private static String pduLogEncoding = ENCODING_BASE64; // TODO use Java enumerations, generalize/share across library + private static String pduLogEncoding = ENCODING_PLAINTEXT; // TODO use Java enumerations, generalize/share across library public PduPlayer(String ip, int port, Path disLogDirectory) throws IOException { this.disLogDirectory = disLogDirectory; @@ -66,6 +66,13 @@ public class PduPlayer { private boolean netSend = true; private RawListener rawListener = null; + //ToDo: Add X3d for BASE64 Encoding + // -------------------- Begin Variables for X3D autogenerated code + private X3dCreateInterpolators x3dInterpolators = new X3dCreateInterpolators(); + private X3dCreateLineSet x3dLineSet = new X3dCreateLineSet(); + private byte[] globalByteBufferForX3dInterPolators = null; + // -------------------- End Variables for X3D autogenerated code + public void sendToNet(boolean tf) { netSend = tf; } @@ -109,15 +116,11 @@ public class PduPlayer { } if (line.length() <= 0) ; // blank lines ok - else if (line.trim().startsWith(COMMENT_MARKER)) - { - if (handleComment(line, f)) - { + else if (line.trim().startsWith(COMMENT_MARKER)) { + if (handleComment(line, f)) { break; } - } - else - { + } else { String[] sa = null; String REGEX = ""; Pattern pattern = null; @@ -285,6 +288,11 @@ public class PduPlayer { if (netSend) { DatagramPacket datagramPacket = new DatagramPacket(bufferShort, bufferShort.length, addr, port); datagramSocket.send(datagramPacket); + // Add Points to X3D Components + globalByteBufferForX3dInterPolators = new byte[byteBuffer2.array().length / 4]; + globalByteBufferForX3dInterPolators = bufferShort.clone(); + x3dInterpolators.addPointsToMap(globalByteBufferForX3dInterPolators); + x3dLineSet.addPointsToMap(globalByteBufferForX3dInterPolators); System.out.println("Sent PDU "); } break; @@ -310,6 +318,10 @@ public class PduPlayer { line = brdr.readLine(); } brdr.close(); + //create X3D components - methods will create console output + x3dInterpolators.makeX3dInterpolator(); + x3dLineSet.makeX3dLineSet(); + } if (rawListener != null) { rawListener.receiveBytes(null); // indicate the end -- GitLab