From 7828c4da33a93462646b2de3c1da3962920256d6 Mon Sep 17 00:00:00 2001 From: Ayman Habib Date: Thu, 21 Apr 2022 14:29:48 -0700 Subject: [PATCH] Prserve rates as ints rather than doubles to make header parsing less flaky --- .../view/experimentaldata/AnnotatedMotion.java | 18 +++++++++--------- .../view/motions/FileLoadDataAction.java | 4 ++-- .../motions/MotionAssociateMotionAction.java | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Gui/opensim/view/src/org/opensim/view/experimentaldata/AnnotatedMotion.java b/Gui/opensim/view/src/org/opensim/view/experimentaldata/AnnotatedMotion.java index a655df1aa..75d6e67c2 100644 --- a/Gui/opensim/view/src/org/opensim/view/experimentaldata/AnnotatedMotion.java +++ b/Gui/opensim/view/src/org/opensim/view/experimentaldata/AnnotatedMotion.java @@ -72,9 +72,9 @@ public class AnnotatedMotion extends Storage { private double unitConversion = 1.0; private boolean boundingBoxComputed=false; private double[] currentRotations = new double[]{0., 0., 0.}; - private double frameRate=0.; - private double cameraRate=0.; - private double dataRate=0.; + private int frameRate=0; + private int cameraRate=0; + private int dataRate=0; private MotionDisplayer motionDisplayer; private double displayForceScale = .001; private String displayForceShape = "arrow"; @@ -455,27 +455,27 @@ private void saveAsTRC(String newFile, Vec3 eulerAngles) throws FileNotFoundExce writer.close(); } - public void setDataRate(double d) { + public void setDataRate(int d) { this.dataRate = d; } - public void setCameraRate(double d) { + public void setCameraRate(int d) { this.cameraRate = d; } - public double getFrameRate() { + public int getFrameRate() { return frameRate; } - public void setFrameRate(double frameRate) { + public void setFrameRate(int frameRate) { this.frameRate = frameRate; } - public double getCameraRate() { + public int getCameraRate() { return cameraRate; } - public double getDataRate() { + public int getDataRate() { return dataRate; } diff --git a/Gui/opensim/view/src/org/opensim/view/motions/FileLoadDataAction.java b/Gui/opensim/view/src/org/opensim/view/motions/FileLoadDataAction.java index 85d77b325..a1a056e13 100644 --- a/Gui/opensim/view/src/org/opensim/view/motions/FileLoadDataAction.java +++ b/Gui/opensim/view/src/org/opensim/view/motions/FileLoadDataAction.java @@ -60,8 +60,8 @@ public void performAction() { AnnotatedMotion amot = new AnnotatedMotion(newStorage, markerData.getMarkerNames()); amot.setUnitConversion(markerData.getUnits().convertTo(Units.UnitType.Meters)); amot.setName(new File(fileName).getName()); - amot.setDataRate(markerData.getDataRate()); - amot.setCameraRate(markerData.getCameraRate()); + amot.setDataRate((int)markerData.getDataRate()); + amot.setCameraRate((int)markerData.getCameraRate()); amot.setUnits(markerData.getUnits()); // Add the visuals to support it ModelForExperimentalData modelForDataImport = new ModelForExperimentalData(nextNumber++, amot); diff --git a/Gui/opensim/view/src/org/opensim/view/motions/MotionAssociateMotionAction.java b/Gui/opensim/view/src/org/opensim/view/motions/MotionAssociateMotionAction.java index 19a1766c4..b9e72cb1b 100644 --- a/Gui/opensim/view/src/org/opensim/view/motions/MotionAssociateMotionAction.java +++ b/Gui/opensim/view/src/org/opensim/view/motions/MotionAssociateMotionAction.java @@ -62,8 +62,8 @@ else if (fileName.toLowerCase().endsWith(".trc")){ AnnotatedMotion amot = new AnnotatedMotion(newStorage, markerData.getMarkerNames()); amot.setUnitConversion(markerData.getUnits().convertTo(Units.UnitType.Meters)); amot.setName(new File(fileName).getName()); - amot.setDataRate(markerData.getDataRate()); - amot.setCameraRate(markerData.getCameraRate()); + amot.setDataRate((int)markerData.getDataRate()); + amot.setCameraRate((int)markerData.getCameraRate()); storage = amot; amot.setModel(node.getModelForNode()); }