kauron/estraba
Archived
1
0
Fork 0

m/s to km/h and other fixes

This commit is contained in:
Jesús Vélez Palacios 2016-05-19 23:26:33 +02:00
parent a8c6e79e2e
commit 389499230d
3 changed files with 8 additions and 11 deletions

View file

@ -77,7 +77,7 @@ public class DashboardController implements Initializable, MapComponentInitializ
private LineChart<Double, Double> 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<Double, Double> speedChartData = new XYChart.Series<>();
XYChart.Series<Double, Double> hrChartData = new XYChart.Series<>();
XYChart.Series<Double, Double> cadenceChartData = new XYChart.Series<>();
// MVCArray pathArray = new MVCArray();
// traverse the chunks
ObservableList<Chunk> 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);
}

View file

@ -34,6 +34,7 @@ public class SplashController implements Initializable{
@FXML
void loadGPXFile(ActionEvent event) {
buttonLoad.setVisible(false);
labelWelcome.setVisible(false);
spinner.setVisible(true);

View file

@ -8,14 +8,13 @@
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.StackPane?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="300.0" prefWidth="300.0" styleClass="background" stylesheets="@../css/palette.css" xmlns="http://javafx.com/javafx/8.0.76-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="es.kauron.estraba.controller.SplashController">
<ImageView fx:id="imgLogo" fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" AnchorPane.leftAnchor="50.0" AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="25.0">
</ImageView>
<JFXSpinner fx:id="spinner" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
<Label fx:id="labelWelcome" alignment="CENTER" text="%label.welcome" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
<StackPane layoutX="-1.0" layoutY="251.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
<JFXButton maxHeight="-Infinity" maxWidth="-Infinity" onAction="#loadGPXFile" styleClass="accent-color" text="%label.loadGPX">
<JFXButton fx:id="buttonLoad" maxHeight="-Infinity" maxWidth="-Infinity" onAction="#loadGPXFile" styleClass="accent-color" text="%label.loadGPX">
<padding>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding>