From 389499230d20822405c75187ab51d2139dd09db6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20V=C3=A9lez=20Palacios?= Date: Thu, 19 May 2016 23:26:33 +0200 Subject: [PATCH] m/s to km/h and other fixes --- .../estraba/controller/DashboardController.java | 15 ++++++--------- .../estraba/controller/SplashController.java | 1 + .../resources/es/kauron/estraba/fxml/Splash.fxml | 3 +-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/main/java/es/kauron/estraba/controller/DashboardController.java b/src/main/java/es/kauron/estraba/controller/DashboardController.java index 8a3ce2e..790ea52 100644 --- a/src/main/java/es/kauron/estraba/controller/DashboardController.java +++ b/src/main/java/es/kauron/estraba/controller/DashboardController.java @@ -77,7 +77,7 @@ public class DashboardController implements Initializable, MapComponentInitializ private LineChart speedChart, hrChart, cadenceChart, mapChart; private JFXSnackbar snackbar; - private static final double DISTANCE_EPSILON = 1e-6; + private static final double DISTANCE_EPSILON = 1E-6; private static final double KILOMETER_CUTOFF = 10000; @Override @@ -130,9 +130,10 @@ public class DashboardController implements Initializable, MapComponentInitializ valueHRMin.setText(track.getMinHeartRate() + App.GENERAL_BUNDLE.getString("unit.bpm")); - valueSpeedAvg.setText(String.format("%.2f", track.getAverageSpeed()) + // speed is given as m/s + valueSpeedAvg.setText(String.format("%.2f", track.getAverageSpeed() * 3.6) + App.GENERAL_BUNDLE.getString("unit.kmph")); - valueSpeedMax.setText(String.format("%.2f", track.getMaxSpeed()) + valueSpeedMax.setText(String.format("%.2f", track.getMaxSpeed() * 3.6) + App.GENERAL_BUNDLE.getString("unit.kmph")); valueCadenceAvg.setText(track.getAverageCadence() @@ -168,8 +169,6 @@ public class DashboardController implements Initializable, MapComponentInitializ XYChart.Series speedChartData = new XYChart.Series<>(); XYChart.Series hrChartData = new XYChart.Series<>(); XYChart.Series cadenceChartData = new XYChart.Series<>(); - // MVCArray pathArray = new MVCArray(); - // traverse the chunks ObservableList chunks = track.getChunks(); @@ -180,9 +179,8 @@ public class DashboardController implements Initializable, MapComponentInitializ if (chunk.getDistance() < DISTANCE_EPSILON) continue; currentHeight += chunk.getAscent() - chunk.getDescend(); - // pathArray.push(new LatLong(chunk.getLastPoint().getLatitude(), chunk.getLastPoint().getLongitude())); elevationChartData.getData().add(new XYChart.Data<>(currentDistance, currentHeight)); - speedChartData.getData().add(new XYChart.Data<>(currentDistance, chunk.getSpeed())); + speedChartData.getData().add(new XYChart.Data<>(currentDistance, chunk.getSpeed()*3.6)); // m/s hrChartData.getData().add(new XYChart.Data<>(currentDistance, chunk.getAvgHeartRate())); cadenceChartData.getData().add(new XYChart.Data<>(currentDistance, chunk.getAvgCadence())); @@ -210,8 +208,7 @@ public class DashboardController implements Initializable, MapComponentInitializ hrChart.getData().add(hrChartData); cadenceChart.getData().add(cadenceChartData); - // populate and render the map - chunks = track.getChunks(); + //initialize map mapView.addMapInializedListener(this); } diff --git a/src/main/java/es/kauron/estraba/controller/SplashController.java b/src/main/java/es/kauron/estraba/controller/SplashController.java index 8e875f4..1c489e7 100644 --- a/src/main/java/es/kauron/estraba/controller/SplashController.java +++ b/src/main/java/es/kauron/estraba/controller/SplashController.java @@ -34,6 +34,7 @@ public class SplashController implements Initializable{ @FXML void loadGPXFile(ActionEvent event) { + buttonLoad.setVisible(false); labelWelcome.setVisible(false); spinner.setVisible(true); diff --git a/src/main/resources/es/kauron/estraba/fxml/Splash.fxml b/src/main/resources/es/kauron/estraba/fxml/Splash.fxml index 6d6cd6b..57b7392 100644 --- a/src/main/resources/es/kauron/estraba/fxml/Splash.fxml +++ b/src/main/resources/es/kauron/estraba/fxml/Splash.fxml @@ -8,14 +8,13 @@ -