kauron/estraba
Archived
1
0
Fork 0
This commit is contained in:
Jesús Vélez Palacios 2016-05-18 13:01:11 +02:00
parent dbbe15ec9e
commit 169b8a8396
15 changed files with 243 additions and 193 deletions

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<resourceExtensions /> <resourceExtensions />
<wildcardResourcePatterns> <wildcardResourcePatterns>
<entry name="!?*.java" /> <entry name="!?*.java" />
@ -12,6 +11,7 @@
<entry name="!?*.flex" /> <entry name="!?*.flex" />
<entry name="!?*.kt" /> <entry name="!?*.kt" />
<entry name="!?*.clj" /> <entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns> </wildcardResourcePatterns>
<annotationProcessing> <annotationProcessing>
<profile default="true" name="Default" enabled="false"> <profile default="true" name="Default" enabled="false">

View file

@ -2,6 +2,5 @@
<project version="4"> <project version="4">
<component name="Encoding"> <component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" /> <file url="file://$PROJECT_DIR$" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" />
</component> </component>
</project> </project>

View file

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: org.vesalainen.gpx:GPX11:1.0.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/vesalainen/gpx/GPX11/1.0.2/GPX11-1.0.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/vesalainen/gpx/GPX11/1.0.2/GPX11-1.0.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/vesalainen/gpx/GPX11/1.0.2/GPX11-1.0.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -1,46 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ClientPropertiesManager">
<properties class="javax.swing.AbstractButton">
<property name="hideActionText" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JComponent">
<property name="html.disable" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JEditorPane">
<property name="JEditorPane.w3cLengthUnits" class="java.lang.Boolean" />
<property name="JEditorPane.honorDisplayProperties" class="java.lang.Boolean" />
<property name="charset" class="java.lang.String" />
</properties>
<properties class="javax.swing.JList">
<property name="List.isFileList" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JPasswordField">
<property name="JPasswordField.cutCopyAllowed" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JSlider">
<property name="Slider.paintThumbArrowShape" class="java.lang.Boolean" />
<property name="JSlider.isFilled" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JTable">
<property name="Table.isFileList" class="java.lang.Boolean" />
<property name="JTable.autoStartsEdit" class="java.lang.Boolean" />
<property name="terminateEditOnFocusLost" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JToolBar">
<property name="JToolBar.isRollover" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JTree">
<property name="JTree.lineStyle" class="java.lang.String" />
</properties>
<properties class="javax.swing.text.JTextComponent">
<property name="caretAspectRatio" class="java.lang.Double" />
<property name="caretWidth" class="java.lang.Integer" />
</properties>
</component>
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="MavenProjectsManager"> <component name="MavenProjectsManager">
<option name="originalFiles"> <option name="originalFiles">
<list> <list>
@ -48,17 +7,5 @@
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" assert-keyword="false" jdk-15="false" />
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project> </project>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
</component> </component>
</project> </project>

View file

@ -21,7 +21,6 @@
<orderEntry type="library" name="Maven: org.jfxtras:jfxtras-common:8.0-r4" level="project" /> <orderEntry type="library" name="Maven: org.jfxtras:jfxtras-common:8.0-r4" level="project" />
<orderEntry type="library" name="Maven: org.jfxtras:jfxtras-controls:8.0-r4" level="project" /> <orderEntry type="library" name="Maven: org.jfxtras:jfxtras-controls:8.0-r4" level="project" />
<orderEntry type="library" name="Maven: org.jfxtras:jfxtras-fxml:8.0-r4" level="project" /> <orderEntry type="library" name="Maven: org.jfxtras:jfxtras-fxml:8.0-r4" level="project" />
<orderEntry type="library" name="Maven: org.jfxtras:jfxtras-roboto:8.0-r4" level="project" />
<orderEntry type="library" name="Maven: com.jfoenix:jfoenix:0.0.0-SNAPSHOT" level="project" /> <orderEntry type="library" name="Maven: com.jfoenix:jfoenix:0.0.0-SNAPSHOT" level="project" />
</component> </component>
</module> </module>

View file

@ -93,11 +93,6 @@
<artifactId>jfxtras-fxml</artifactId> <artifactId>jfxtras-fxml</artifactId>
<version>8.0-r4</version> <version>8.0-r4</version>
</dependency> </dependency>
<dependency>
<groupId>org.jfxtras</groupId>
<artifactId>jfxtras-roboto</artifactId>
<version>8.0-r4</version>
</dependency>
<dependency> <dependency>
<groupId>com.jfoenix</groupId> <groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId> <artifactId>jfoenix</artifactId>

View file

@ -24,6 +24,7 @@
package es.kauron.estraba; package es.kauron.estraba;
import es.kauron.estraba.controller.DashboardController;
import javafx.application.Application; import javafx.application.Application;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Parent; import javafx.scene.Parent;
@ -56,5 +57,6 @@ public class App extends Application {
stage.setScene(new Scene(root)); stage.setScene(new Scene(root));
stage.setResizable(true); stage.setResizable(true);
stage.show(); stage.show();
loader.<DashboardController>getController().postinit();
} }
} }

View file

@ -2,18 +2,34 @@ package es.kauron.estraba.controller;
import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXListView; import com.jfoenix.controls.JFXListView;
import com.jfoenix.controls.JFXTabPane; import com.jfoenix.controls.JFXSnackbar;
import com.lynden.gmapsfx.GoogleMapView; import com.lynden.gmapsfx.GoogleMapView;
import com.lynden.gmapsfx.javascript.object.GoogleMap;
import es.kauron.estraba.App; import es.kauron.estraba.App;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.Initializable; import javafx.fxml.Initializable;
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.control.Label;
import javafx.scene.control.Tab; import javafx.scene.control.Tab;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.stage.FileChooser;
import jgpx.model.analysis.Chunk;
import jgpx.model.analysis.TrackData;
import jgpx.model.gpx.Track;
import jgpx.model.jaxb.GpxType;
import jgpx.model.jaxb.TrackPointExtensionT;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import java.io.File;
import java.net.URL; import java.net.URL;
import java.util.ResourceBundle; import java.util.ResourceBundle;
@ -25,11 +41,23 @@ import java.util.ResourceBundle;
public class DashboardController implements Initializable { public class DashboardController implements Initializable {
@FXML @FXML
private JFXTabPane root; private AnchorPane root;
@FXML @FXML
private Tab tabDashboard; private Tab tabDashboard;
@FXML
private JFXListView<?> listLeft;
@FXML
private PieChart zoneChart;
@FXML
private JFXListView<?> listRight;
@FXML
private Label motivationLabel;
@FXML @FXML
private Tab tabMap; private Tab tabMap;
@ -55,31 +83,87 @@ public class DashboardController implements Initializable {
private Tab tabGraph; private Tab tabGraph;
@FXML @FXML
private AreaChart<Double, Double> elevationChart; private AreaChart<Number, Number> elevationChart;
@FXML @FXML
private LineChart<Double, Double> speedChart; private LineChart<Number, Number> speedChart;
@FXML @FXML
private LineChart<Double, Double> hrChart; private LineChart<Number, Number> hrChart;
@FXML @FXML
private LineChart<Double, Double> cadenceChart; private LineChart<Number, Number> cadenceChart;
@FXML @FXML
private Tab tabSettings; private Tab tabSettings;
private GoogleMap map;
private TrackData trackData;
private JFXSnackbar snackbar;
@Override @Override
public void initialize(URL location, ResourceBundle resources) { public void initialize(URL location, ResourceBundle resources) {
((ImageView)elevationButton.getGraphic()).setImage(new Image(App.class.getResourceAsStream("img/elevation.png"))); ((ImageView)elevationButton.getGraphic()).setImage(new Image(App.class.getResourceAsStream("img/elevation.png")));
((ImageView)speedButton.getGraphic()).setImage(new Image(App.class.getResourceAsStream("img/speed.png"))); ((ImageView)speedButton.getGraphic()).setImage(new Image(App.class.getResourceAsStream("img/speed.png")));
((ImageView)hrButton.getGraphic()).setImage(new Image(App.class.getResourceAsStream("img/hr.png"))); ((ImageView)hrButton.getGraphic()).setImage(new Image(App.class.getResourceAsStream("img/hr.png")));
((ImageView)cadenceButton.getGraphic()).setImage(new Image(App.class.getResourceAsStream("img/cadence.png"))); ((ImageView)cadenceButton.getGraphic()).setImage(new Image(App.class.getResourceAsStream("img/cadence.png")));
trackData.getStartTime();
trackData.getTotalDuration();
trackData.getMovingTime();
trackData.getTotalDistance();
trackData.getTotalAscent();
trackData.getTotalDescend();
trackData.getMaxSpeed();
trackData.getAverageSpeed();
trackData.getMaxHeartrate();
trackData.getMinHeartRate();
trackData.getAverageHeartrate();
trackData.getMaxCadence();
trackData.getAverageCadence();
// populate charts
ObservableList<Chunk> chunks = trackData.getChunks();
double lastDistance = Double.MIN_VALUE;
for (Chunk chunk : chunks) {
//elevationChart (range min-max+10)
//speedChart (range 0-max+10)
//hrChart (range 30-200)
//cadenceChart (range 0-200 (rollapalluza))
}
} }
@FXML @FXML
private void onMapButton(ActionEvent event){ private void onMapButton(ActionEvent event){
System.out.println(((JFXButton)event.getSource()).getId()); System.out.println(((JFXButton)event.getSource()).getId());
} }
public void postinit() {
snackbar = new JFXSnackbar();
snackbar.registerSnackbarContainer(root);
}
@FXML
private void load(ActionEvent event) throws JAXBException {
FileChooser fileChooser = new FileChooser();
File file = fileChooser.showOpenDialog(root.getScene().getWindow());
if (file == null) return;
String name = file.getName();
JAXBContext jaxbContext = JAXBContext.newInstance(GpxType.class, TrackPointExtensionT.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
JAXBElement<Object> jaxbElement = (JAXBElement<Object>) unmarshaller.unmarshal(file);
GpxType gpx = (GpxType) jaxbElement.getValue();
if (gpx != null) {
trackData = new TrackData(new Track(gpx.getTrk().get(0)));
snackbar.show("GPX file: " + name + "successfully loaded", 3000);
} else {
snackbar.show("Error loading GPX file: " + name, 3000);
}
}
} }

View file

@ -9,6 +9,7 @@
<?import javafx.scene.chart.CategoryAxis?> <?import javafx.scene.chart.CategoryAxis?>
<?import javafx.scene.chart.LineChart?> <?import javafx.scene.chart.LineChart?>
<?import javafx.scene.chart.NumberAxis?> <?import javafx.scene.chart.NumberAxis?>
<?import javafx.scene.chart.PieChart?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.Tab?> <?import javafx.scene.control.Tab?>
<?import javafx.scene.image.ImageView?> <?import javafx.scene.image.ImageView?>
@ -17,18 +18,42 @@
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<JFXTabPane fx:id="root" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.76-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="es.kauron.estraba.controller.DashboardController"> <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">
<children>
<JFXTabPane minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<tabs> <tabs>
<Tab fx:id="tabDashboard" text="%tab.dashboard"> <Tab fx:id="tabDashboard" text="%tab.dashboard">
<content> <content>
<AnchorPane> <VBox prefHeight="200.0" prefWidth="100.0">
<children> <children>
<Label alignment="CENTER" text="%label.welcome" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <HBox prefHeight="100.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
<children>
<VBox minHeight="375.0" minWidth="180.0">
<children>
<HBox prefHeight="75.0" prefWidth="180.0" />
<HBox layoutX="10.0" layoutY="10.0" prefHeight="75.0" prefWidth="180.0" />
<HBox layoutX="10.0" layoutY="10.0" prefHeight="75.0" prefWidth="180.0" />
<HBox layoutX="10.0" layoutY="110.0" prefHeight="75.0" prefWidth="180.0" />
<HBox layoutX="10.0" layoutY="102.0" prefHeight="75.0" prefWidth="180.0" />
</children>
</VBox>
<PieChart fx:id="zoneChart" legendVisible="false" minHeight="375.0" minWidth="0.0" HBox.hgrow="ALWAYS" />
<VBox layoutX="10.0" layoutY="10.0" minHeight="375.0" minWidth="180.0" />
</children>
</HBox>
<Label fx:id="motivationLabel" alignment="CENTER" focusTraversable="false" maxWidth="1.7976931348623157E308" text="%label.motivation">
<font> <font>
<Font name="Roboto" size="50.0" /> <Font name="Roboto" size="56.0" />
</font> </font>
<VBox.margin>
<Insets bottom="60.0" top="55.0" />
</VBox.margin>
</Label> </Label>
</children></AnchorPane> </children>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</VBox>
</content> </content>
</Tab> </Tab>
<Tab fx:id="tabMap" text="%tab.map"> <Tab fx:id="tabMap" text="%tab.map">
@ -38,7 +63,7 @@
<HBox VBox.vgrow="ALWAYS"> <HBox VBox.vgrow="ALWAYS">
<children> <children>
<GoogleMapView fx:id="mapView" HBox.hgrow="ALWAYS" /> <GoogleMapView fx:id="mapView" HBox.hgrow="ALWAYS" />
<JFXListView fx:id="mapSummary" minWidth="100.0" /> <JFXListView fx:id="mapSummary" minWidth="180.0" />
</children> </children>
</HBox> </HBox>
<HBox minHeight="128.0" prefHeight="0.0"> <HBox minHeight="128.0" prefHeight="0.0">
@ -51,28 +76,32 @@
</graphic> </graphic>
<VBox.margin> <VBox.margin>
<Insets /> <Insets />
</VBox.margin></JFXButton> </VBox.margin>
</JFXButton>
<JFXButton fx:id="speedButton" layoutX="10.0" layoutY="10.0" minHeight="32.0" minWidth="32.0" onAction="#onMapButton"> <JFXButton fx:id="speedButton" layoutX="10.0" layoutY="10.0" minHeight="32.0" minWidth="32.0" onAction="#onMapButton">
<graphic> <graphic>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" /> <ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" />
</graphic> </graphic>
<VBox.margin> <VBox.margin>
<Insets /> <Insets />
</VBox.margin></JFXButton> </VBox.margin>
</JFXButton>
<JFXButton fx:id="hrButton" layoutX="10.0" layoutY="10.0" minHeight="32.0" minWidth="32.0" onAction="#onMapButton"> <JFXButton fx:id="hrButton" layoutX="10.0" layoutY="10.0" minHeight="32.0" minWidth="32.0" onAction="#onMapButton">
<graphic> <graphic>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" /> <ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" />
</graphic> </graphic>
<VBox.margin> <VBox.margin>
<Insets /> <Insets />
</VBox.margin></JFXButton> </VBox.margin>
</JFXButton>
<JFXButton fx:id="cadenceButton" layoutX="10.0" layoutY="42.0" minHeight="32.0" minWidth="32.0" onAction="#onMapButton"> <JFXButton fx:id="cadenceButton" layoutX="10.0" layoutY="42.0" minHeight="32.0" minWidth="32.0" onAction="#onMapButton">
<graphic> <graphic>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" /> <ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" />
</graphic> </graphic>
<VBox.margin> <VBox.margin>
<Insets /> <Insets />
</VBox.margin></JFXButton> </VBox.margin>
</JFXButton>
</children> </children>
</VBox> </VBox>
<LineChart minHeight="100.0" prefWidth="9999.0"> <LineChart minHeight="100.0" prefWidth="9999.0">
@ -86,6 +115,9 @@
</children> </children>
</HBox> </HBox>
</children> </children>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</VBox> </VBox>
</content> </content>
</Tab> </Tab>
@ -126,6 +158,9 @@
</yAxis> </yAxis>
</LineChart> </LineChart>
</children> </children>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</VBox> </VBox>
</content> </content>
</Tab> </Tab>
@ -136,3 +171,5 @@
</Tab> </Tab>
</tabs> </tabs>
</JFXTabPane> </JFXTabPane>
</children>
</AnchorPane>

View file

Before

Width:  |  Height:  |  Size: 922 B

After

Width:  |  Height:  |  Size: 922 B

View file

Before

Width:  |  Height:  |  Size: 857 B

After

Width:  |  Height:  |  Size: 857 B

View file

@ -1,4 +1,4 @@
label.welcome=Welcome! label.motivation=Welcome!
tab.dashboard=Dashboard tab.dashboard=Dashboard
tab.graph=Stats tab.graph=Stats
tab.map=Your Route tab.map=Your Route

View file

@ -1,4 +1,4 @@
label.welcome=¡Benvinguts! label.motivation=¡Benvinguts!
tab.dashboard=Sumari tab.dashboard=Sumari
tab.graph=Estadístiques tab.graph=Estadístiques
tab.map=La teva ruta tab.map=La teva ruta

View file

@ -1,4 +1,4 @@
label.welcome=¡Bienvenido! label.motivation=¡Bienvenido!
tab.dashboard=Resúmen tab.dashboard=Resúmen
tab.graph=Estadísticas tab.graph=Estadísticas
tab.map=Tu ruta tab.map=Tu ruta