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.AreaChart;
import javafx.scene.chart.LineChart; import javafx.scene.chart.LineChart;
import javafx.scene.chart.PieChart; import javafx.scene.chart.PieChart;
import javafx.scene.chart.XYChart;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.Tab; import javafx.scene.control.Tab;
import javafx.scene.image.Image; import javafx.scene.image.Image;
@ -148,24 +149,35 @@ public class DashboardController implements Initializable, MapComponentInitializ
@FXML @FXML
private void onMapButton(ActionEvent event) { private void onMapButton(ActionEvent event) {
XYChart.Series<Double, Double> data = elevationChart.getData().get(0); 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": case "elevationButton":
data = elevationChart.getData().get(0); data = elevationChart.getData().get(0);
color = "#2c8f30";
break; break;
case "speedButton": case "speedButton":
data = speedChart.getData().get(0); data = speedChart.getData().get(0);
color = "#c0775f";
break; break;
case "hrButton": case "hrButton":
data = hrChart.getData().get(0); data = hrChart.getData().get(0);
color = "#df1d00";
break; break;
case "cadenceButton": case "cadenceButton":
data = cadenceChart.getData().get(0); data = cadenceChart.getData().get(0);
color = "#1f31a5";
break; break;
} }
if (mapChart.getData().contains(data)) if (mapChart.getData().contains(data)) {
mapChart.getData().remove(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"); elevation = (int)(track.getTotalAscent() - track.getTotalDescend()) + App.GENERAL_BUNDLE.getString("unit.m");
ascent = "+ " + (int) track.getTotalAscent() + 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"); descent = " " + (int) track.getTotalDescend() + App.GENERAL_BUNDLE.getString("unit.m");
// traverse the chunks // traverse the chunks
chunks = track.getChunks(); chunks = track.getChunks();
@ -100,7 +100,19 @@ public class DataBundle {
hrTSeries = new XYChart.Series<>(); hrTSeries = new XYChart.Series<>();
speedSeries = new XYChart.Series<>(); speedSeries = new XYChart.Series<>();
speedTSeries = 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 = 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) { for (Chunk chunk : chunks) {
currentDistance += chunk.getDistance(); currentDistance += chunk.getDistance();
@ -125,15 +137,14 @@ public class DataBundle {
else if (chunk.getAvgHeartRate() > maxHR * .6) zone = App.GENERAL_BUNDLE.getString("zone.endurance"); else if (chunk.getAvgHeartRate() > maxHR * .6) zone = App.GENERAL_BUNDLE.getString("zone.endurance");
else zone = App.GENERAL_BUNDLE.getString("zone.recovery"); else zone = App.GENERAL_BUNDLE.getString("zone.recovery");
boolean pieFound = false; boolean pieFound = false;
for (PieChart.Data d : pieData){ for (PieChart.Data d : pieData){
if (d.getName().equals(zone)) { if (d.getName().equals(zone)) {
pieFound = true;
d.setPieValue(d.getPieValue() + 1); d.setPieValue(d.getPieValue() + 1);
break; break;
} }
} }
if (!pieFound) pieData.add( new PieChart.Data(zone, 1) );
} }
} }

View file

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

View file

@ -25,27 +25,16 @@
~ ~
--> -->
<?import com.jfoenix.controls.JFXButton?> <?import com.jfoenix.controls.*?>
<?import com.jfoenix.controls.JFXSpinner?>
<?import com.jfoenix.controls.JFXTabPane?>
<?import com.jfoenix.controls.JFXToggleButton?>
<?import com.lynden.gmapsfx.GoogleMapView?> <?import com.lynden.gmapsfx.GoogleMapView?>
<?import java.lang.String?> <?import javafx.geometry.*?>
<?import javafx.geometry.Insets?> <?import javafx.scene.chart.*?>
<?import javafx.scene.chart.AreaChart?> <?import javafx.scene.control.*?>
<?import javafx.scene.chart.LineChart?> <?import javafx.scene.image.*?>
<?import javafx.scene.chart.NumberAxis?> <?import javafx.scene.layout.*?>
<?import javafx.scene.chart.PieChart?> <?import java.lang.*?>
<?import javafx.scene.control.Label?> <AnchorPane xmlns:fx="http://javafx.com/fxml/1" fx:id="root" xmlns="http://javafx.com/javafx/8.0.76-ea"
<?import javafx.scene.control.Tab?> fx:controller="es.kauron.estraba.controller.DashboardController">
<?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">
<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"> <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"> <Tab fx:id="tabDashboard" text="%tab.dashboard">
<VBox prefHeight="200.0" prefWidth="100.0"> <VBox prefHeight="200.0" prefWidth="100.0">
@ -298,7 +287,12 @@
</HBox> </HBox>
<HBox alignment="CENTER" spacing="10.0"> <HBox alignment="CENTER" spacing="10.0">
<children> <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> </children>
</HBox> </HBox>
</VBox> </VBox>
@ -349,7 +343,8 @@
</VBox.margin> </VBox.margin>
</JFXButton> </JFXButton>
</VBox> </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> <xAxis>
<NumberAxis side="BOTTOM" /> <NumberAxis side="BOTTOM" />
</xAxis> </xAxis>
@ -368,7 +363,8 @@
<HBox alignment="CENTER" spacing="5.0"> <HBox alignment="CENTER" spacing="5.0">
<children> <children>
<Label text="%label.distance" /> <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> <padding>
<Insets bottom="-5.0" left="-5.0" right="-5.0" top="-5.0" /> <Insets bottom="-5.0" left="-5.0" right="-5.0" top="-5.0" />
</padding> </padding>

View file

@ -31,21 +31,39 @@
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.Spinner?> <?import javafx.scene.control.Spinner?>
<?import javafx.scene.image.ImageView?> <?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.*?>
<?import javafx.scene.text.Text?> <?import javafx.scene.text.Text?>
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" fx:id="root" maxHeight="-Infinity" maxWidth="-Infinity"
<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"> 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 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> </ImageView>
<JFXSpinner fx:id="spinner" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" /> <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" /> <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> <padding>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" /> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding> </padding>
</JFXButton> </JFXButton>
<Spinner fx:id="spinnerHR" layoutX="124.0" layoutY="118.0" /> <GridPane alignment="CENTER" hgap="15.0" layoutX="14.0" layoutY="118.0" vgap="5.0" AnchorPane.leftAnchor="0.0"
<Spinner fx:id="spinnerAge" layoutX="124.0" layoutY="150.0" /> AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="128.0">
<Text fx:id="textHR" layoutX="14.0" layoutY="137.0" strokeType="OUTSIDE" strokeWidth="0.0" text="%label.maxHR" /> <columnConstraints>
<Text fx:id="textAge" layoutX="14.0" layoutY="169.0" strokeType="OUTSIDE" strokeWidth="0.0" text="%label.age" /> <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> </AnchorPane>