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

View file

@ -2,6 +2,5 @@
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" />
</component>
</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"?>
<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">
<option name="originalFiles">
<list>
@ -48,17 +7,5 @@
</list>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="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>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" assert-keyword="false" jdk-15="false" />
</project>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</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-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-roboto:8.0-r4" level="project" />
<orderEntry type="library" name="Maven: com.jfoenix:jfoenix:0.0.0-SNAPSHOT" level="project" />
</component>
</module>

View file

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

View file

@ -24,6 +24,7 @@
package es.kauron.estraba;
import es.kauron.estraba.controller.DashboardController;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
@ -56,5 +57,6 @@ public class App extends Application {
stage.setScene(new Scene(root));
stage.setResizable(true);
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.JFXListView;
import com.jfoenix.controls.JFXTabPane;
import com.jfoenix.controls.JFXSnackbar;
import com.lynden.gmapsfx.GoogleMapView;
import com.lynden.gmapsfx.javascript.object.GoogleMap;
import es.kauron.estraba.App;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.chart.AreaChart;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.PieChart;
import javafx.scene.control.Label;
import javafx.scene.control.Tab;
import javafx.scene.image.Image;
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.util.ResourceBundle;
@ -25,11 +41,23 @@ import java.util.ResourceBundle;
public class DashboardController implements Initializable {
@FXML
private JFXTabPane root;
private AnchorPane root;
@FXML
private Tab tabDashboard;
@FXML
private JFXListView<?> listLeft;
@FXML
private PieChart zoneChart;
@FXML
private JFXListView<?> listRight;
@FXML
private Label motivationLabel;
@FXML
private Tab tabMap;
@ -55,31 +83,87 @@ public class DashboardController implements Initializable {
private Tab tabGraph;
@FXML
private AreaChart<Double, Double> elevationChart;
private AreaChart<Number, Number> elevationChart;
@FXML
private LineChart<Double, Double> speedChart;
private LineChart<Number, Number> speedChart;
@FXML
private LineChart<Double, Double> hrChart;
private LineChart<Number, Number> hrChart;
@FXML
private LineChart<Double, Double> cadenceChart;
private LineChart<Number, Number> cadenceChart;
@FXML
private Tab tabSettings;
private GoogleMap map;
private TrackData trackData;
private JFXSnackbar snackbar;
@Override
public void initialize(URL location, ResourceBundle resources) {
((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)hrButton.getGraphic()).setImage(new Image(App.class.getResourceAsStream("img/hr.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
private void onMapButton(ActionEvent event){
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.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?>
@ -17,65 +18,122 @@
<?import javafx.scene.layout.VBox?>
<?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">
<tabs>
<Tab fx:id="tabDashboard" text="%tab.dashboard">
<content>
<AnchorPane>
<children>
<Label alignment="CENTER" text="%label.welcome" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<font>
<Font name="Roboto" size="50.0" />
</font>
</Label>
</children></AnchorPane>
</content>
</Tab>
<Tab fx:id="tabMap" text="%tab.map">
<content>
<VBox>
<children>
<HBox VBox.vgrow="ALWAYS">
<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>
<Tab fx:id="tabDashboard" text="%tab.dashboard">
<content>
<VBox prefHeight="200.0" prefWidth="100.0">
<children>
<GoogleMapView fx:id="mapView" HBox.hgrow="ALWAYS" />
<JFXListView fx:id="mapSummary" minWidth="100.0" />
</children>
</HBox>
<HBox minHeight="128.0" prefHeight="0.0">
<children>
<VBox prefHeight="128.0" prefWidth="100.0" HBox.hgrow="ALWAYS">
<HBox prefHeight="100.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
<children>
<JFXButton fx:id="elevationButton" minHeight="32.0" minWidth="32.0" onAction="#onMapButton">
<graphic>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" />
</graphic>
<VBox.margin>
<Insets />
</VBox.margin></JFXButton>
<JFXButton fx:id="speedButton" layoutX="10.0" layoutY="10.0" minHeight="32.0" minWidth="32.0" onAction="#onMapButton">
<graphic>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" />
</graphic>
<VBox.margin>
<Insets />
</VBox.margin></JFXButton>
<JFXButton fx:id="hrButton" layoutX="10.0" layoutY="10.0" minHeight="32.0" minWidth="32.0" onAction="#onMapButton">
<graphic>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" />
</graphic>
<VBox.margin>
<Insets />
</VBox.margin></JFXButton>
<JFXButton fx:id="cadenceButton" layoutX="10.0" layoutY="42.0" minHeight="32.0" minWidth="32.0" onAction="#onMapButton">
<graphic>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" />
</graphic>
<VBox.margin>
<Insets />
</VBox.margin></JFXButton>
<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>
</VBox>
<LineChart minHeight="100.0" prefWidth="9999.0">
</HBox>
<Label fx:id="motivationLabel" alignment="CENTER" focusTraversable="false" maxWidth="1.7976931348623157E308" text="%label.motivation">
<font>
<Font name="Roboto" size="56.0" />
</font>
<VBox.margin>
<Insets bottom="60.0" top="55.0" />
</VBox.margin>
</Label>
</children>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</VBox>
</content>
</Tab>
<Tab fx:id="tabMap" text="%tab.map">
<content>
<VBox>
<children>
<HBox VBox.vgrow="ALWAYS">
<children>
<GoogleMapView fx:id="mapView" HBox.hgrow="ALWAYS" />
<JFXListView fx:id="mapSummary" minWidth="180.0" />
</children>
</HBox>
<HBox minHeight="128.0" prefHeight="0.0">
<children>
<VBox prefHeight="128.0" prefWidth="100.0" HBox.hgrow="ALWAYS">
<children>
<JFXButton fx:id="elevationButton" minHeight="32.0" minWidth="32.0" onAction="#onMapButton">
<graphic>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" />
</graphic>
<VBox.margin>
<Insets />
</VBox.margin>
</JFXButton>
<JFXButton fx:id="speedButton" layoutX="10.0" layoutY="10.0" minHeight="32.0" minWidth="32.0" onAction="#onMapButton">
<graphic>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" />
</graphic>
<VBox.margin>
<Insets />
</VBox.margin>
</JFXButton>
<JFXButton fx:id="hrButton" layoutX="10.0" layoutY="10.0" minHeight="32.0" minWidth="32.0" onAction="#onMapButton">
<graphic>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" />
</graphic>
<VBox.margin>
<Insets />
</VBox.margin>
</JFXButton>
<JFXButton fx:id="cadenceButton" layoutX="10.0" layoutY="42.0" minHeight="32.0" minWidth="32.0" onAction="#onMapButton">
<graphic>
<ImageView fitHeight="32.0" fitWidth="32.0" pickOnBounds="true" preserveRatio="true" />
</graphic>
<VBox.margin>
<Insets />
</VBox.margin>
</JFXButton>
</children>
</VBox>
<LineChart minHeight="100.0" prefWidth="9999.0">
<xAxis>
<CategoryAxis side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis side="LEFT" />
</yAxis>
</LineChart>
</children>
</HBox>
</children>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</VBox>
</content>
</Tab>
<Tab fx:id="tabGraph" text="%tab.graph">
<content>
<VBox>
<children>
<AreaChart fx:id="elevationChart" minHeight="100.0">
<xAxis>
<CategoryAxis side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis side="LEFT" />
</yAxis>
</AreaChart>
<LineChart fx:id="speedChart" minHeight="100.0">
<xAxis>
<CategoryAxis side="BOTTOM" />
</xAxis>
@ -83,56 +141,35 @@
<NumberAxis side="LEFT" />
</yAxis>
</LineChart>
<LineChart fx:id="hrChart" minHeight="100.0">
<xAxis>
<CategoryAxis side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis side="LEFT" />
</yAxis>
</LineChart>
<LineChart fx:id="cadenceChart" minHeight="100.0">
<xAxis>
<CategoryAxis side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis side="LEFT" />
</yAxis>
</LineChart>
</children>
</HBox>
</children>
</VBox>
</content>
</Tab>
<Tab fx:id="tabGraph" text="%tab.graph">
<content>
<VBox>
<children>
<AreaChart fx:id="elevationChart" minHeight="100.0">
<xAxis>
<CategoryAxis side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis side="LEFT" />
</yAxis>
</AreaChart>
<LineChart fx:id="speedChart" minHeight="100.0">
<xAxis>
<CategoryAxis side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis side="LEFT" />
</yAxis>
</LineChart>
<LineChart fx:id="hrChart" minHeight="100.0">
<xAxis>
<CategoryAxis side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis side="LEFT" />
</yAxis>
</LineChart>
<LineChart fx:id="cadenceChart" minHeight="100.0">
<xAxis>
<CategoryAxis side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis side="LEFT" />
</yAxis>
</LineChart>
</children>
</VBox>
</content>
</Tab>
<Tab fx:id="tabSettings" text="%tab.settings">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
</content>
</Tab>
</tabs>
</JFXTabPane>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</VBox>
</content>
</Tab>
<Tab fx:id="tabSettings" text="%tab.settings">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
</content>
</Tab>
</tabs>
</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.graph=Stats
tab.map=Your Route

View file

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

View file

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