kauron/estraba
kauron
/
estraba
Archived
1
0
Fork 0

CRAPLOAD OF CHANGES :D

This commit is contained in:
Jesús Vélez Palacios 2016-05-25 19:06:52 +02:00
parent 54b861ab87
commit 4efed80eee
5 changed files with 91 additions and 40 deletions

View File

@ -46,6 +46,7 @@ import javafx.scene.Scene;
import javafx.scene.chart.AreaChart;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.PieChart;
import javafx.scene.chart.XYChart;
import javafx.scene.control.Label;
import javafx.scene.control.Tab;
import javafx.scene.image.Image;
@ -148,24 +149,35 @@ public class DashboardController implements Initializable, MapComponentInitializ
@FXML
private void onMapButton(ActionEvent event) {
XYChart.Series<Double, Double> data = elevationChart.getData().get(0);
switch (((JFXButton) event.getSource()).getId()) {
String color = "#000000";
JFXButton b = ((JFXButton) event.getSource());
switch (b.getId()) {
case "elevationButton":
data = elevationChart.getData().get(0);
color = "#2c8f30";
break;
case "speedButton":
data = speedChart.getData().get(0);
color = "#c0775f";
break;
case "hrButton":
data = hrChart.getData().get(0);
color = "#df1d00";
break;
case "cadenceButton":
data = cadenceChart.getData().get(0);
color = "#1f31a5";
break;
}
if (mapChart.getData().contains(data))
if (mapChart.getData().contains(data)) {
mapChart.getData().remove(data);
else mapChart.getData().add(data);
} else {
mapChart.getData().add(data);
mapChart.setStyle(String.format(".default-color%d.chart-series-line { -fx-stroke: %s }",
mapChart.getData().size() - 1, color));
}
}

View File

@ -83,8 +83,8 @@ public class DataBundle {
}
elevation = (int)(track.getTotalAscent() - track.getTotalDescend()) + App.GENERAL_BUNDLE.getString("unit.m");
ascent = "+ " + (int) track.getTotalAscent() + App.GENERAL_BUNDLE.getString("unit.m");
descent = "- " + (int) track.getTotalDescend() + App.GENERAL_BUNDLE.getString("unit.m");
ascent = (int) track.getTotalAscent() + App.GENERAL_BUNDLE.getString("unit.m") + "";
descent = " " + (int) track.getTotalDescend() + App.GENERAL_BUNDLE.getString("unit.m");
// traverse the chunks
chunks = track.getChunks();
@ -100,7 +100,19 @@ public class DataBundle {
hrTSeries = new XYChart.Series<>();
speedSeries = new XYChart.Series<>();
speedTSeries = new XYChart.Series<>();
elevationSeries.setName(App.GENERAL_BUNDLE.getString("label.elevation"));
cadenceSeries.setName(App.GENERAL_BUNDLE.getString("label.cadence"));
hrSeries.setName(App.GENERAL_BUNDLE.getString("label.hr"));
speedSeries.setName(App.GENERAL_BUNDLE.getString("label.speed"));
pieData = FXCollections.observableArrayList();
pieData.add(new PieChart.Data(App.GENERAL_BUNDLE.getString("zone.recovery"), 0));
pieData.add(new PieChart.Data(App.GENERAL_BUNDLE.getString("zone.endurance"), 0));
pieData.add(new PieChart.Data(App.GENERAL_BUNDLE.getString("zone.tempo"), 0));
pieData.add(new PieChart.Data(App.GENERAL_BUNDLE.getString("zone.threshold"), 0));
pieData.add(new PieChart.Data(App.GENERAL_BUNDLE.getString("zone.anaerobic"), 0));
for (Chunk chunk : chunks) {
currentDistance += chunk.getDistance();
@ -125,15 +137,14 @@ public class DataBundle {
else if (chunk.getAvgHeartRate() > maxHR * .6) zone = App.GENERAL_BUNDLE.getString("zone.endurance");
else zone = App.GENERAL_BUNDLE.getString("zone.recovery");
boolean pieFound = false;
for (PieChart.Data d : pieData){
if (d.getName().equals(zone)) {
pieFound = true;
d.setPieValue(d.getPieValue() + 1);
break;
}
}
if (!pieFound) pieData.add( new PieChart.Data(zone, 1) );
}
}

View File

@ -24,17 +24,31 @@
*/
.root {
-fx-background-color: white;
-fx-font: 14px "DAGGERSQUARE";
-fx-font-smoothing-type: lcd;
-fx-font-family: DAGGERSQUARE;
}
.text {
-fx-font-smoothing-type: lcd;
.tab-label {
-fx-font: 14px "DAGGERSQUARE";
}
.tab-header-background {
-fx-background-color: #FF5722;
}
.tab-selected-line {
-fx-stroke: white;
}
.label {
}
.motivation {
-fx-font: 42px "DAGGERSQUARE";
}
.value-main {
-fx-font: 30px "DAGGERSQUARE";
}

View File

@ -25,27 +25,16 @@
~
-->
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXSpinner?>
<?import com.jfoenix.controls.JFXTabPane?>
<?import com.jfoenix.controls.JFXToggleButton?>
<?import com.jfoenix.controls.*?>
<?import com.lynden.gmapsfx.GoogleMapView?>
<?import java.lang.String?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.chart.AreaChart?>
<?import javafx.scene.chart.LineChart?>
<?import javafx.scene.chart.NumberAxis?>
<?import javafx.scene.chart.PieChart?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<AnchorPane fx:id="root" xmlns="http://javafx.com/javafx/8.0.76-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="es.kauron.estraba.controller.DashboardController">
<?import javafx.geometry.*?>
<?import javafx.scene.chart.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import java.lang.*?>
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" fx:id="root" xmlns="http://javafx.com/javafx/8.0.76-ea"
fx:controller="es.kauron.estraba.controller.DashboardController">
<JFXTabPane minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="1000.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<Tab fx:id="tabDashboard" text="%tab.dashboard">
<VBox prefHeight="200.0" prefWidth="100.0">
@ -298,7 +287,12 @@
</HBox>
<HBox alignment="CENTER" spacing="10.0">
<children>
<JFXButton minWidth="70.0" onAction="#loadFile" style="-fx-background-color: #fc4c02;" text="Load another file" textAlignment="CENTER" textFill="WHITE" />
<JFXButton minWidth="70.0" onAction="#loadFile" style="-fx-background-color: #fc4c02;"
text="Load another file" textAlignment="CENTER" textFill="WHITE">
<HBox.margin>
<Insets bottom="5.0" left="5.0" right="5.0" top="10.0"/>
</HBox.margin>
</JFXButton>
</children>
</HBox>
</VBox>
@ -349,7 +343,8 @@
</VBox.margin>
</JFXButton>
</VBox>
<LineChart fx:id="mapChart" animated="false" createSymbols="false" legendVisible="false" HBox.hgrow="ALWAYS">
<LineChart fx:id="mapChart" animated="false" createSymbols="false" legendSide="TOP" minHeight="0.0"
minWidth="0.0" HBox.hgrow="ALWAYS">
<xAxis>
<NumberAxis side="BOTTOM" />
</xAxis>
@ -368,7 +363,8 @@
<HBox alignment="CENTER" spacing="5.0">
<children>
<Label text="%label.distance" />
<JFXToggleButton fx:id="toggleCharts" unToggleColor="#fc4c02" unToggleLineColor="#ffba9e">
<JFXToggleButton fx:id="toggleCharts" toggleColor="#fc4c02" toggleLineColor="#ffba9e"
unToggleColor="#fc4c02" unToggleLineColor="#ffba9e">
<padding>
<Insets bottom="-5.0" left="-5.0" right="-5.0" top="-5.0" />
</padding>

View File

@ -31,21 +31,39 @@
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Spinner?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.Text?>
<AnchorPane fx:id="root" 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">
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" fx:id="root" 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"
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" layoutX="101.0" layoutY="91.0" text="%label.welcome" />
<JFXButton fx:id="buttonLoad" layoutX="87.0" layoutY="237.0" maxHeight="-Infinity" maxWidth="-Infinity" onAction="#loadGPXFile" styleClass="default-primary-color" text="%label.loadGPX">
<JFXButton fx:id="buttonLoad" layoutX="87.0" layoutY="237.0" maxHeight="-Infinity" maxWidth="-Infinity"
onAction="#loadGPXFile" styleClass="default-primary-color" text="%label.loadGPX" textFill="WHITE">
<padding>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding>
</JFXButton>
<Spinner fx:id="spinnerHR" layoutX="124.0" layoutY="118.0" />
<Spinner fx:id="spinnerAge" layoutX="124.0" layoutY="150.0" />
<Text fx:id="textHR" layoutX="14.0" layoutY="137.0" strokeType="OUTSIDE" strokeWidth="0.0" text="%label.maxHR" />
<Text fx:id="textAge" layoutX="14.0" layoutY="169.0" strokeType="OUTSIDE" strokeWidth="0.0" text="%label.age" />
<GridPane alignment="CENTER" hgap="15.0" layoutX="14.0" layoutY="118.0" vgap="5.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="128.0">
<columnConstraints>
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" minWidth="10.0"/>
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="10.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<Spinner fx:id="spinnerHR" minHeight="-Infinity" minWidth="-Infinity" prefWidth="100.0"
GridPane.columnIndex="1"/>
<Spinner fx:id="spinnerAge" minHeight="-Infinity" minWidth="-Infinity" prefWidth="100.0"
GridPane.columnIndex="1" GridPane.rowIndex="1"/>
<Text fx:id="textHR" strokeType="OUTSIDE" strokeWidth="0.0" text="%label.maxHR"/>
<Text fx:id="textAge" strokeType="OUTSIDE" strokeWidth="0.0" text="%label.age" GridPane.rowIndex="1"/>
</children>
</GridPane>
</AnchorPane>