├── gpx-ui-cal ├── .gitignore ├── src │ ├── main │ │ ├── resources │ │ │ ├── run.gif │ │ │ ├── META-INF │ │ │ │ └── services │ │ │ │ │ └── com.github.pfichtner.jrunalyser.ui.base.UiPlugin │ │ │ └── com │ │ │ │ └── github │ │ │ │ └── pfichtner │ │ │ │ └── jrunalyser │ │ │ │ └── ui │ │ │ │ └── cal │ │ │ │ └── resources │ │ │ │ ├── CalendarPlugin_de.properties │ │ │ │ └── CalendarPlugin.properties │ │ └── java │ │ │ └── com │ │ │ └── github │ │ │ └── pfichtner │ │ │ └── jrunalyser │ │ │ └── ui │ │ │ └── cal │ │ │ └── swing │ │ │ ├── DateComponentUI.java │ │ │ └── model │ │ │ ├── CalendarModelListener.java │ │ │ ├── CalendarEntry.java │ │ │ ├── CalenderModel.java │ │ │ ├── CalendarModelEvent.java │ │ │ ├── DefaultCalendarEntry.java │ │ │ ├── AbstractCalenderModel.java │ │ │ └── DefaultCalenderModel.java │ └── test │ │ └── java │ │ └── com │ │ └── github │ │ └── pfichtner │ │ └── jrunalyser │ │ └── ui │ │ └── cal │ │ └── Test.java ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.core.resources.prefs ├── .project ├── pom.xml └── .classpath ├── gpx-ui-map ├── .gitignore ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.core.resources.prefs ├── src │ └── main │ │ ├── resources │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── com.github.pfichtner.jrunalyser.ui.base.UiPlugin │ │ └── com │ │ │ └── github │ │ │ └── pfichtner │ │ │ └── jrunalyser │ │ │ └── ui │ │ │ └── map │ │ │ └── resources │ │ │ ├── MapViewPlugin.properties │ │ │ └── MapViewPlugin_de.properties │ │ └── java │ │ └── com │ │ └── github │ │ └── pfichtner │ │ └── jrunalyser │ │ └── ui │ │ └── map │ │ ├── wp │ │ ├── TrackEndWaypoint.java │ │ ├── TrackStartWaypoint.java │ │ ├── MarkedWaypoint.java │ │ ├── SelectedWaypoint.java │ │ └── SegmentBorderWaypoint.java │ │ ├── theme │ │ ├── Theme.java │ │ └── DefaultTheme.java │ │ ├── painter │ │ ├── StackedPainter.java │ │ ├── TrackPainter.java │ │ ├── TrackOutlinePainter.java │ │ ├── OffsetWaypointRendererDelegate.java │ │ ├── OffsetPainterDelegate.java │ │ └── HighlightTrackPainter.java │ │ ├── AdditonalTrackInfo.java │ │ └── wprenderer │ │ ├── SegmentBorderWaypointRendererStart.java │ │ ├── WaypointRendererDelegate.java │ │ ├── SegmentBorderWaypointRendererEnd.java │ │ └── AbstractSegmentBorderWaypointRenderer.java ├── .project ├── pom.xml └── .classpath ├── gpx-ui ├── .gitignore ├── src │ └── main │ │ └── resources │ │ ├── run.ico │ │ └── com │ │ └── github │ │ └── pfichtner │ │ └── jrunalyser │ │ └── ui │ │ └── dock │ │ └── resources │ │ ├── Dock_de.properties │ │ ├── Dock.properties │ │ ├── MenuHack_de.properties │ │ └── MenuHack.properties ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.core.resources.prefs ├── Dock.launch ├── .project └── .classpath ├── gpx-ui-base ├── .gitignore ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.core.resources.prefs ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── github │ │ │ └── pfichtner │ │ │ └── jrunalyser │ │ │ ├── ui │ │ │ ├── base │ │ │ │ ├── UiPlugin.java │ │ │ │ ├── GridDataProvider.java │ │ │ │ ├── GridData.java │ │ │ │ ├── DockPlugin.java │ │ │ │ ├── StaticSettings.java │ │ │ │ ├── UiPlugins.java │ │ │ │ ├── AbstractUiPlugin.java │ │ │ │ ├── Settings.java │ │ │ │ ├── DefaultGridData.java │ │ │ │ ├── i18n │ │ │ │ │ └── I18N.java │ │ │ │ ├── components │ │ │ │ │ ├── LoadTrackMouseListener.java │ │ │ │ │ └── SegmentTrackMouseListener.java │ │ │ │ ├── ImperialSettings.java │ │ │ │ └── MetricSettings.java │ │ │ ├── dock │ │ │ │ └── ebus │ │ │ │ │ ├── TrackLoaded.java │ │ │ │ │ ├── PositionSelected.java │ │ │ │ │ ├── SegmentationSelected.java │ │ │ │ │ ├── TrackAdded.java │ │ │ │ │ ├── TrackRemoved.java │ │ │ │ │ ├── AdditionalTracks.java │ │ │ │ │ ├── EventBusMessage.java │ │ │ │ │ ├── HighlightSegmentMessage.java │ │ │ │ │ ├── MouseOverWaypoint.java │ │ │ │ │ └── SegmentSelectedMessage.java │ │ │ ├── format │ │ │ │ ├── DistanceFormatter.java │ │ │ │ ├── DurationFormatter.java │ │ │ │ ├── SpeedFormatter.java │ │ │ │ └── PaceFormatter.java │ │ │ └── table │ │ │ │ └── renderers │ │ │ │ ├── PaceRenderer.java │ │ │ │ ├── SpeedRenderer.java │ │ │ │ ├── DistanceRenderer.java │ │ │ │ └── DurationRenderer.java │ │ │ └── di │ │ │ ├── Inject.java │ │ │ └── Injector.java │ │ └── resources │ │ └── com │ │ └── github │ │ └── pfichtner │ │ └── jrunalyser │ │ └── ui │ │ └── base │ │ └── resources │ │ ├── AbstractUiPlugin.properties │ │ └── AbstractUiPlugin_de.properties ├── .project ├── pom.xml └── .classpath ├── gpx-ui-lapinfo ├── .gitignore ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.core.resources.prefs ├── src │ └── main │ │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ └── com.github.pfichtner.jrunalyser.ui.base.UiPlugin │ │ └── com │ │ └── github │ │ └── pfichtner │ │ └── jrunalyser │ │ └── ui │ │ └── lapinfo │ │ └── resources │ │ ├── LapInfoPlugin.properties │ │ └── LapInfoPlugin_de.properties ├── .project ├── pom.xml └── .classpath ├── gpx-ui-mapprofile ├── .gitignore ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.core.resources.prefs ├── src │ └── main │ │ ├── resources │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── com.github.pfichtner.jrunalyser.ui.base.UiPlugin │ │ └── com │ │ │ └── github │ │ │ └── pfichtner │ │ │ └── jrunalyser │ │ │ └── ui │ │ │ └── mapprofile │ │ │ └── resources │ │ │ ├── MapProfilePlugin_de.properties │ │ │ └── MapProfilePlugin.properties │ │ └── java │ │ └── com │ │ └── github │ │ └── pfichtner │ │ └── jrunalyser │ │ └── ui │ │ └── mapprofile │ │ └── config │ │ ├── StrokeRendererConfigDecorator.java │ │ ├── DatasetConfig.java │ │ ├── DatasetConfigDelegate.java │ │ └── MovingAverageConfigDecorator.java ├── .project ├── pom.xml └── .classpath ├── gpx-ui-overallstats ├── .gitignore ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.core.resources.prefs ├── src │ └── main │ │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ └── com.github.pfichtner.jrunalyser.ui.base.UiPlugin │ │ └── com │ │ └── github │ │ └── pfichtner │ │ └── jrunalyser │ │ └── ui │ │ └── overallstats │ │ └── resources │ │ └── OverallStatsPlugin_de.properties ├── .project ├── pom.xml └── .classpath ├── gpx-ui-trackcompare ├── .gitignore ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.core.resources.prefs ├── src │ └── main │ │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ └── com.github.pfichtner.jrunalyser.ui.base.UiPlugin │ │ └── com │ │ └── github │ │ └── pfichtner │ │ └── jrunalyser │ │ └── ui │ │ └── trackcompare │ │ └── resources │ │ ├── TrackComparePlugin.properties │ │ └── TrackComparePlugin_de.properties ├── .project ├── pom.xml └── .classpath ├── gpx-ui-tracklist ├── .gitignore ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.core.resources.prefs ├── src │ └── main │ │ ├── resources │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── com.github.pfichtner.jrunalyser.ui.base.UiPlugin │ │ └── com │ │ │ └── github │ │ │ └── pfichtner │ │ │ └── jrunalyser │ │ │ └── ui │ │ │ └── tracklist │ │ │ └── resources │ │ │ ├── TrackListPlugin_de.properties │ │ │ └── TrackListPlugin.properties │ │ └── java │ │ └── com │ │ └── github │ │ └── pfichtner │ │ └── jrunalyser │ │ └── ui │ │ └── tracklist │ │ ├── MedalRendererDecorator.java │ │ ├── MinMaxElevation.java │ │ └── TrackRow.java ├── .project ├── pom.xml └── .classpath ├── .travis.yml ├── gpx-ui-segmentstats ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.core.resources.prefs ├── src │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── services │ │ │ └── com.github.pfichtner.jrunalyser.base.UiPlugin │ │ └── java │ │ └── com │ │ └── github │ │ └── pfichtner │ │ └── jrunalyser │ │ └── ui │ │ └── segmentstat │ │ └── SegmentStatsPlugin.java ├── .gitignore ├── .project ├── pom.xml └── .classpath ├── gpx-ui-trackstats ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.core.resources.prefs ├── src │ └── main │ │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ └── com.github.pfichtner.jrunalyser.ui.base.UiPlugin │ │ └── com │ │ └── github │ │ └── pfichtner │ │ └── jrunalyser │ │ └── ui │ │ └── trackstat │ │ └── resources │ │ ├── TrackStatsPlugin_de.properties │ │ └── TrackStatsPlugin.properties ├── .gitignore ├── .project ├── pom.xml └── .classpath ├── gpx-base ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.core.resources.prefs ├── src │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── github │ │ │ └── pfichtner │ │ │ └── jrunalyser │ │ │ └── base │ │ │ ├── Delegate.java │ │ │ ├── ViewMode.java │ │ │ ├── data │ │ │ ├── SegmentationUnit.java │ │ │ ├── LinkedTrackPoint.java │ │ │ ├── stat │ │ │ │ ├── StatType.java │ │ │ │ └── Statistics.java │ │ │ ├── WayPoint.java │ │ │ ├── track │ │ │ │ ├── StatisticsProvider.java │ │ │ │ ├── WaypointProvider.java │ │ │ │ ├── TrackpointProvider.java │ │ │ │ ├── Metadata.java │ │ │ │ ├── Track.java │ │ │ │ ├── Id.java │ │ │ │ └── comparator │ │ │ │ │ └── CombinedIterator.java │ │ │ ├── Gradient.java │ │ │ ├── MathObject.java │ │ │ ├── floater │ │ │ │ ├── HighlightableSegment.java │ │ │ │ └── DefaultHighlightableSegment.java │ │ │ ├── Distance.java │ │ │ ├── Link.java │ │ │ ├── Duration.java │ │ │ ├── segment │ │ │ │ ├── Segment.java │ │ │ │ └── DefaultSegment.java │ │ │ ├── Coordinate.java │ │ │ ├── Pace.java │ │ │ ├── Speed.java │ │ │ ├── DivideTrack.java │ │ │ ├── DefaultCoordinate.java │ │ │ ├── DefaultLinkedWayPoint.java │ │ │ ├── segmenter │ │ │ │ └── Segmenter.java │ │ │ ├── DefaultWayPoint.java │ │ │ ├── Durations.java │ │ │ └── Speeds.java │ │ │ ├── datasource │ │ │ ├── DatasourceFascadeListener.java │ │ │ ├── DatasourceFascadeEvent.java │ │ │ ├── DefaultDatasourceFascadeEvent.java │ │ │ ├── Datasource.java │ │ │ └── AbstractDatasourceFascade.java │ │ │ ├── Delegates.java │ │ │ ├── util │ │ │ ├── Distributor.java │ │ │ ├── MovingAverageIterator.java │ │ │ ├── FixedDuration.java │ │ │ ├── FixedDistance.java │ │ │ ├── Primitives.java │ │ │ ├── MovingAverage.java │ │ │ ├── format │ │ │ │ ├── LatLonFormatter.java │ │ │ │ ├── LatitudeFormatter.java │ │ │ │ └── LongitudeFormatter.java │ │ │ └── Validator.java │ │ │ ├── comparator │ │ │ ├── AbsDiffNumberComparator.java │ │ │ └── RelDiffNumberComparator.java │ │ │ └── showcase │ │ │ ├── TrackCompareShowcase.java │ │ │ ├── Util.java │ │ │ ├── SortWaypoints.java │ │ │ └── RemoveInvalidWaypoints.java │ └── test │ │ └── java │ │ └── com │ │ └── github │ │ └── pfichtner │ │ └── jrunalyser │ │ └── base │ │ ├── util │ │ ├── format │ │ │ └── LatLonFormatterTest.java │ │ ├── FixedDistanceTest.java │ │ ├── FixedDurationTest.java │ │ └── MovingAverageIteratorTest.java │ │ ├── data │ │ ├── DistanceUnitTest.java │ │ ├── SpeedsTest.java │ │ ├── DefaultDurationTest.java │ │ ├── track │ │ │ ├── comparator │ │ │ │ ├── RelDiffNumberComparatorTest.java │ │ │ │ └── AbsDiffNumberComparatorTest.java │ │ │ └── TracksTest.java │ │ ├── DurationsTest.java │ │ ├── SpeedPaceTest.java │ │ └── segmenter │ │ │ └── SegmenterTest.java │ │ ├── DelegatesTest.java │ │ └── comparator │ │ └── AbsDiffNumberComparatorTest.java ├── logging.properties ├── .gitignore ├── .project ├── .classpath └── pom.xml ├── .project └── .gitignore /gpx-ui-cal/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /gpx-ui-map/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /gpx-ui/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /gpx-ui-base/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /gpx-ui-lapinfo/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /gpx-ui-mapprofile/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /gpx-ui-overallstats/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /gpx-ui-trackcompare/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /gpx-ui-tracklist/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /gpx-ui/src/main/resources/run.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfichtner/jrunalyzer/HEAD/gpx-ui/src/main/resources/run.ico -------------------------------------------------------------------------------- /gpx-ui-cal/src/main/resources/run.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfichtner/jrunalyzer/HEAD/gpx-ui-cal/src/main/resources/run.gif -------------------------------------------------------------------------------- /gpx-ui/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /gpx-ui-base/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /gpx-ui-cal/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /gpx-ui-lapinfo/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /gpx-ui-map/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/resources/META-INF/services/com.github.pfichtner.jrunalyser.ui.base.UiPlugin: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.map.MapViewPlugin 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | 3 | sudo: required 4 | before_script: 5 | - sudo apt-get update 6 | - sudo apt-get install lib32z1 lib32ncurses5 7 | 8 | -------------------------------------------------------------------------------- /gpx-ui-cal/src/main/resources/META-INF/services/com.github.pfichtner.jrunalyser.ui.base.UiPlugin: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.cal.CalendarPlugin 2 | -------------------------------------------------------------------------------- /gpx-ui-mapprofile/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /gpx-ui-overallstats/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /gpx-ui-segmentstats/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /gpx-ui-trackcompare/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /gpx-ui-tracklist/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /gpx-ui-trackstats/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /gpx-ui-lapinfo/src/main/resources/META-INF/services/com.github.pfichtner.jrunalyser.ui.base.UiPlugin: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.lapinfo.LapInfoPlugin 2 | -------------------------------------------------------------------------------- /gpx-ui-tracklist/src/main/resources/META-INF/services/com.github.pfichtner.jrunalyser.ui.base.UiPlugin: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.tracklist.TrackListPlugin 2 | -------------------------------------------------------------------------------- /gpx-ui-mapprofile/src/main/resources/META-INF/services/com.github.pfichtner.jrunalyser.ui.base.UiPlugin: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin 2 | -------------------------------------------------------------------------------- /gpx-ui-overallstats/src/main/resources/META-INF/services/com.github.pfichtner.jrunalyser.ui.base.UiPlugin: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.overallstats.OverallStatsPlugin -------------------------------------------------------------------------------- /gpx-ui-segmentstats/src/main/resources/META-INF/services/com.github.pfichtner.jrunalyser.base.UiPlugin: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.segmentstat.SegmentStatsPlugin 2 | -------------------------------------------------------------------------------- /gpx-ui-trackstats/src/main/resources/META-INF/services/com.github.pfichtner.jrunalyser.ui.base.UiPlugin: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPlugin 2 | -------------------------------------------------------------------------------- /gpx-ui-trackcompare/src/main/resources/META-INF/services/com.github.pfichtner.jrunalyser.ui.base.UiPlugin: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.trackcompare.TrackComparePlugin 2 | -------------------------------------------------------------------------------- /gpx-base/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | #Tue Apr 10 18:07:15 CEST 2012 2 | activeProfiles= 3 | eclipse.preferences.version=1 4 | resolveWorkspaceProjects=true 5 | version=1 6 | -------------------------------------------------------------------------------- /gpx-ui/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding/=UTF-8 5 | -------------------------------------------------------------------------------- /gpx-ui-lapinfo/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding/=UTF-8 5 | -------------------------------------------------------------------------------- /gpx-ui-map/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding/=UTF-8 5 | -------------------------------------------------------------------------------- /gpx-ui-mapprofile/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding/=UTF-8 5 | -------------------------------------------------------------------------------- /gpx-ui-overallstats/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding/=UTF-8 5 | -------------------------------------------------------------------------------- /gpx-ui-segmentstats/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding/=UTF-8 5 | -------------------------------------------------------------------------------- /gpx-ui-trackcompare/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding/=UTF-8 5 | -------------------------------------------------------------------------------- /gpx-ui-tracklist/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding/=UTF-8 5 | -------------------------------------------------------------------------------- /gpx-ui-trackstats/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding/=UTF-8 5 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/Delegate.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base; 2 | 3 | public interface Delegate { 4 | 5 | T getDelegate(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/ViewMode.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base; 2 | 3 | public enum ViewMode { 4 | 5 | BY_DISTANCE, BY_DURATION; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/base/UiPlugin.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.base; 2 | 3 | public interface UiPlugin { 4 | 5 | // marker interface 6 | 7 | } 8 | -------------------------------------------------------------------------------- /gpx-ui-trackcompare/src/main/resources/com/github/pfichtner/jrunalyser/ui/trackcompare/resources/TrackComparePlugin.properties: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.trackcompare.TrackComparePlugin.title=Comparison 2 | -------------------------------------------------------------------------------- /gpx-ui-trackcompare/src/main/resources/com/github/pfichtner/jrunalyser/ui/trackcompare/resources/TrackComparePlugin_de.properties: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.trackcompare.TrackComparePlugin.title=Vergleich 2 | -------------------------------------------------------------------------------- /gpx-ui-cal/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/test/java=UTF-8 5 | encoding/=UTF-8 6 | -------------------------------------------------------------------------------- /gpx-base/logging.properties: -------------------------------------------------------------------------------- 1 | handlers= java.util.logging.ConsoleHandler 2 | java.util.logging.ConsoleHandler.level = FINEST 3 | java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter 4 | .level= FINEST 5 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/SegmentationUnit.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | public interface SegmentationUnit { 4 | 5 | // marker interface 6 | 7 | } 8 | -------------------------------------------------------------------------------- /gpx-ui-base/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/test/java=UTF-8 5 | encoding/=UTF-8 6 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/base/GridDataProvider.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.base; 2 | 3 | public interface GridDataProvider { 4 | 5 | GridData getGridData(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/LinkedTrackPoint.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | public interface LinkedTrackPoint extends WayPoint { 4 | 5 | Link getLink(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /gpx-ui/src/main/resources/com/github/pfichtner/jrunalyser/ui/dock/resources/Dock_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfichtner/jrunalyzer/HEAD/gpx-ui/src/main/resources/com/github/pfichtner/jrunalyser/ui/dock/resources/Dock_de.properties -------------------------------------------------------------------------------- /gpx-base/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/test/java=UTF-8 5 | encoding//src/test/resources=UTF-8 6 | encoding/=UTF-8 7 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jrunalyzer 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/datasource/DatasourceFascadeListener.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.datasource; 2 | 3 | public interface DatasourceFascadeListener { 4 | void contentChanged(DatasourceFascadeEvent e); 5 | } -------------------------------------------------------------------------------- /gpx-ui-base/src/main/resources/com/github/pfichtner/jrunalyser/ui/base/resources/AbstractUiPlugin.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfichtner/jrunalyzer/HEAD/gpx-ui-base/src/main/resources/com/github/pfichtner/jrunalyser/ui/base/resources/AbstractUiPlugin.properties -------------------------------------------------------------------------------- /gpx-ui-cal/src/main/resources/com/github/pfichtner/jrunalyser/ui/cal/resources/CalendarPlugin_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfichtner/jrunalyzer/HEAD/gpx-ui-cal/src/main/resources/com/github/pfichtner/jrunalyser/ui/cal/resources/CalendarPlugin_de.properties -------------------------------------------------------------------------------- /gpx-ui-base/src/main/resources/com/github/pfichtner/jrunalyser/ui/base/resources/AbstractUiPlugin_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfichtner/jrunalyzer/HEAD/gpx-ui-base/src/main/resources/com/github/pfichtner/jrunalyser/ui/base/resources/AbstractUiPlugin_de.properties -------------------------------------------------------------------------------- /gpx-ui-cal/src/main/java/com/github/pfichtner/jrunalyser/ui/cal/swing/DateComponentUI.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.cal.swing; 2 | 3 | import javax.swing.plaf.ComponentUI; 4 | 5 | public abstract class DateComponentUI extends ComponentUI { 6 | // 7 | } 8 | -------------------------------------------------------------------------------- /gpx-base/.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | 14 | /target 15 | -------------------------------------------------------------------------------- /gpx-ui-tracklist/src/main/resources/com/github/pfichtner/jrunalyser/ui/tracklist/resources/TrackListPlugin_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfichtner/jrunalyzer/HEAD/gpx-ui-tracklist/src/main/resources/com/github/pfichtner/jrunalyser/ui/tracklist/resources/TrackListPlugin_de.properties -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/stat/StatType.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.stat; 2 | 3 | public enum StatType { 4 | 5 | MAX_ELE, MIN_ELE, ASCENT, DESCENT, MAX_SPEED, MIN_SPEED, DISTANCE, MAX_LAT, MIN_LAT, MAX_LNG, MIN_LNG; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /gpx-ui-trackstats/src/main/resources/com/github/pfichtner/jrunalyser/ui/trackstat/resources/TrackStatsPlugin_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfichtner/jrunalyzer/HEAD/gpx-ui-trackstats/src/main/resources/com/github/pfichtner/jrunalyser/ui/trackstat/resources/TrackStatsPlugin_de.properties -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/base/GridData.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.base; 2 | 3 | public interface GridData { 4 | 5 | int getGridX(); 6 | 7 | int getGridY(); 8 | 9 | int getGridWidth(); 10 | 11 | int getGridHeight(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /gpx-ui-overallstats/src/main/resources/com/github/pfichtner/jrunalyser/ui/overallstats/resources/OverallStatsPlugin_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfichtner/jrunalyzer/HEAD/gpx-ui-overallstats/src/main/resources/com/github/pfichtner/jrunalyser/ui/overallstats/resources/OverallStatsPlugin_de.properties -------------------------------------------------------------------------------- /gpx-ui-segmentstats/.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | 14 | /target 15 | /test-output 16 | 17 | -------------------------------------------------------------------------------- /gpx-ui-trackstats/.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | 14 | /target 15 | /test-output 16 | 17 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/WayPoint.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | public interface WayPoint extends Coordinate { 4 | 5 | String getName(); 6 | 7 | Integer getElevation(); 8 | 9 | // TODO change to Date!? 10 | Long getTime(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/track/StatisticsProvider.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.track; 2 | 3 | import com.github.pfichtner.jrunalyser.base.data.stat.Statistics; 4 | 5 | public interface StatisticsProvider { 6 | 7 | Statistics getStatistics(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/base/DockPlugin.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.base; 2 | 3 | import javax.swing.JComponent; 4 | 5 | public interface DockPlugin extends UiPlugin { 6 | 7 | String getId(); 8 | 9 | String getTitle(); 10 | 11 | JComponent getPanel(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/Gradient.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | public interface Gradient extends MathObject { 4 | 5 | DistanceUnit getDistanceUnit(); 6 | 7 | double getValue(); 8 | 9 | Gradient convertTo(DistanceUnit targetUnit); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /gpx-ui-cal/src/main/java/com/github/pfichtner/jrunalyser/ui/cal/swing/model/CalendarModelListener.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.cal.swing.model; 2 | 3 | import java.util.EventListener; 4 | 5 | public interface CalendarModelListener extends EventListener { 6 | 7 | void modelChanged(CalendarModelEvent e); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/MathObject.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | public interface MathObject extends Comparable { 4 | 5 | T add(T other); 6 | 7 | T subtract(T other); 8 | 9 | T divide(double divider); 10 | 11 | T multiply(double multiplier); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/floater/HighlightableSegment.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.floater; 2 | 3 | import com.github.pfichtner.jrunalyser.base.data.segment.Segment; 4 | 5 | public interface HighlightableSegment extends Segment { 6 | 7 | boolean isHighligted(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | /velocity.log 14 | /target 15 | 16 | #intellij idea configuration files 17 | *.ipr 18 | *.iws 19 | *.iml 20 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/track/WaypointProvider.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.track; 2 | 3 | import java.util.List; 4 | 5 | import com.github.pfichtner.jrunalyser.base.data.WayPoint; 6 | 7 | public interface WaypointProvider { 8 | 9 | List getWaypoints(); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/base/StaticSettings.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.base; 2 | 3 | @Deprecated 4 | public final class StaticSettings { 5 | 6 | @Deprecated 7 | public static final Settings INSTANCE = MetricSettings.INSTANCE; 8 | 9 | private StaticSettings() { 10 | super(); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/Distance.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | public interface Distance extends MathObject, SegmentationUnit { 4 | 5 | DistanceUnit getDistanceUnit(); 6 | 7 | double getValue(DistanceUnit distanceUnit); 8 | 9 | Distance convertTo(DistanceUnit targetUnit); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/Link.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | public interface Link { 4 | 5 | int getElevationDifference(); 6 | 7 | Distance getDistance(); 8 | 9 | Duration getDuration(); 10 | 11 | Speed getSpeed(); 12 | 13 | Gradient getGradient(); 14 | 15 | WayPoint getNext(); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/track/TrackpointProvider.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.track; 2 | 3 | import java.util.List; 4 | 5 | import com.github.pfichtner.jrunalyser.base.data.LinkedTrackPoint; 6 | 7 | public interface TrackpointProvider { 8 | 9 | List getTrackpoints(); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /gpx-ui-cal/src/main/resources/com/github/pfichtner/jrunalyser/ui/cal/resources/CalendarPlugin.properties: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.cal.CalendarPlugin.title=Calender 2 | 3 | com.github.pfichtner.jrunalyser.ui.cal.CalendarPlugin.mDeleteTrack.title=Delete track 4 | com.github.pfichtner.jrunalyser.ui.cal.CalendarPlugin.mDeleteTrack.warning.title=Deleting track %s (can't be undone)? 5 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/Duration.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | public interface Duration extends MathObject, SegmentationUnit { 6 | 7 | TimeUnit getTimeUnit(); 8 | 9 | double getValue(TimeUnit timeUnit); 10 | 11 | Duration convertTo(TimeUnit targetUnit); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/resources/com/github/pfichtner/jrunalyser/ui/map/resources/MapViewPlugin.properties: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.map.MapViewPlugin.title=Map 2 | 3 | com.github.pfichtner.jrunalyser.ui.map.MapViewPlugin.centerAndZoom=Center & zoom to track 4 | com.github.pfichtner.jrunalyser.ui.map.MapViewPlugin.autocenter=Autocenter 5 | com.github.pfichtner.jrunalyser.ui.map.MapViewPlugin.autozoom=Autozoom 6 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/segment/Segment.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.segment; 2 | 3 | import com.github.pfichtner.jrunalyser.base.data.track.StatisticsProvider; 4 | import com.github.pfichtner.jrunalyser.base.data.track.TrackpointProvider; 5 | 6 | public interface Segment extends TrackpointProvider, StatisticsProvider { 7 | // marker interface 8 | } 9 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/wp/TrackEndWaypoint.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.wp; 2 | 3 | import org.jdesktop.swingx.mapviewer.DefaultWaypoint; 4 | import org.jdesktop.swingx.mapviewer.GeoPosition; 5 | 6 | public class TrackEndWaypoint extends DefaultWaypoint { 7 | 8 | public TrackEndWaypoint(GeoPosition geoPoint) { 9 | super(geoPoint); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/resources/com/github/pfichtner/jrunalyser/ui/map/resources/MapViewPlugin_de.properties: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.map.MapViewPlugin.title=Karte 2 | 3 | com.github.pfichtner.jrunalyser.ui.map.MapViewPlugin.centerAndZoom=Karte zentrieren & zoomen 4 | com.github.pfichtner.jrunalyser.ui.map.MapViewPlugin.autocenter=Autozentrierung 5 | com.github.pfichtner.jrunalyser.ui.map.MapViewPlugin.autozoom=Autozoom 6 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/wp/TrackStartWaypoint.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.wp; 2 | 3 | import org.jdesktop.swingx.mapviewer.DefaultWaypoint; 4 | import org.jdesktop.swingx.mapviewer.GeoPosition; 5 | 6 | public class TrackStartWaypoint extends DefaultWaypoint { 7 | 8 | public TrackStartWaypoint(GeoPosition geoPoint) { 9 | super(geoPoint); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/track/Metadata.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.track; 2 | 3 | public interface Metadata { 4 | 5 | String getName(); 6 | 7 | String getDescription(); 8 | 9 | Long getTime(); 10 | 11 | double getMinLatitude(); 12 | 13 | double getMinLongitude(); 14 | 15 | double getMaxLatitude(); 16 | 17 | double getMaxLongitude(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/datasource/DatasourceFascadeEvent.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.datasource; 2 | 3 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 4 | 5 | public interface DatasourceFascadeEvent { 6 | 7 | public enum Type { 8 | ADDED, REMOVED, MODIFIED; 9 | } 10 | 11 | DatasourceFascadeEvent.Type getType(); 12 | 13 | Track getTrack(); 14 | 15 | } -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/di/Inject.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.di; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(value = ElementType.METHOD) 10 | public @interface Inject { 11 | // 12 | } 13 | -------------------------------------------------------------------------------- /gpx-ui-cal/src/main/java/com/github/pfichtner/jrunalyser/ui/cal/swing/model/CalendarEntry.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.cal.swing.model; 2 | 3 | import java.util.Date; 4 | 5 | import javax.swing.Icon; 6 | 7 | public interface CalendarEntry { 8 | 9 | String getDescription(); 10 | 11 | Date getStartDate(); 12 | 13 | Date getEndDate(); 14 | 15 | Icon getIcon(); 16 | 17 | Object getUserObject(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /gpx-ui/src/main/resources/com/github/pfichtner/jrunalyser/ui/dock/resources/Dock.properties: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.dock.Dock.title=JRunalyser 2 | com.github.pfichtner.jrunalyser.ui.dock.Dock.miAddGpx.title=Add GPX 3 | com.github.pfichtner.jrunalyser.ui.dock.Dock.mWindows.title=Windows 4 | 5 | com.github.pfichtner.jrunalyser.ui.dock.Dock.importDialog.title=Import tracks 6 | com.github.pfichtner.jrunalyser.ui.dock.Dock.importDialog.format=Importing %s 7 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/track/Track.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.track; 2 | 3 | import java.util.List; 4 | 5 | import com.github.pfichtner.jrunalyser.base.data.segment.Segment; 6 | 7 | public interface Track extends TrackpointProvider, WaypointProvider, 8 | StatisticsProvider { 9 | 10 | Id getId(); 11 | 12 | List getSegments(); 13 | 14 | Metadata getMetadata(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/base/UiPlugins.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.base; 2 | 3 | import com.github.pfichtner.jrunalyser.ui.base.i18n.I18N; 4 | 5 | public final class UiPlugins { 6 | 7 | private static final I18N i18n = I18N.builder(AbstractUiPlugin.class) 8 | .build(); 9 | 10 | private UiPlugins() { 11 | super(); 12 | } 13 | 14 | public static I18N getI18n() { 15 | return i18n; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/dock/ebus/TrackLoaded.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.dock.ebus; 2 | 3 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 4 | 5 | @EventBusMessage 6 | public class TrackLoaded { 7 | 8 | private final Track track; 9 | 10 | public TrackLoaded(Track gpxTrack) { 11 | this.track = gpxTrack; 12 | } 13 | 14 | public Track getTrack() { 15 | return this.track; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/track/Id.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.track; 2 | 3 | import javax.annotation.concurrent.Immutable; 4 | 5 | /** 6 | * Id implementations must implement {@link #hashCode()} and 7 | * {@link #equals(Object)} to identify Tracks uniquely. This implementations 8 | * must also be immutable. 9 | * 10 | * @author Peter Fichtner 11 | */ 12 | @Immutable 13 | public interface Id { 14 | // marker interface 15 | } -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/base/AbstractUiPlugin.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.base; 2 | 3 | public abstract class AbstractUiPlugin implements DockPlugin, GridDataProvider { 4 | 5 | private static final GridData gridData = new DefaultGridData(1, 3, 3, 1); 6 | 7 | @Override 8 | public String getId() { 9 | return getClass().getName(); 10 | } 11 | 12 | @Override 13 | public GridData getGridData() { 14 | return gridData; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/Coordinate.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | public interface Coordinate { 4 | 5 | Coordinate ZERO_ZERO = new Coordinate() { 6 | 7 | @Override 8 | public double getLongitude() { 9 | return 0; 10 | } 11 | 12 | @Override 13 | public double getLatitude() { 14 | return 0; 15 | } 16 | 17 | }; 18 | 19 | public abstract double getLatitude(); 20 | 21 | public abstract double getLongitude(); 22 | 23 | } -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/Pace.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | public interface Pace extends Comparable { 6 | 7 | Pace convert(TimeUnit timeUnit, DistanceUnit distanceUnit); 8 | 9 | Speed toSpeed(DistanceUnit distanceUnit, TimeUnit timeUnit); 10 | 11 | TimeUnit getTimeUnit(); 12 | 13 | DistanceUnit getDistanceUnit(); 14 | 15 | double getValue(TimeUnit timeUnit, DistanceUnit distanceUnit); 16 | 17 | } -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/Speed.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | public interface Speed extends Comparable { 6 | 7 | Speed convert(DistanceUnit distanceUnit, TimeUnit timeUnit); 8 | 9 | Pace toPace(TimeUnit timeUnit, DistanceUnit distanceUnit); 10 | 11 | DistanceUnit getDistanceUnit(); 12 | 13 | TimeUnit getTimeUnit(); 14 | 15 | double getValue(DistanceUnit distanceUnit, TimeUnit timeUnit); 16 | 17 | } -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/dock/ebus/PositionSelected.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.dock.ebus; 2 | 3 | @EventBusMessage 4 | public class PositionSelected { 5 | 6 | private final double lat; 7 | private final double lng; 8 | 9 | public PositionSelected(double lat, double lng) { 10 | this.lat = lat; 11 | this.lng = lng; 12 | } 13 | 14 | public double getLat() { 15 | return this.lat; 16 | } 17 | 18 | public double getLng() { 19 | return this.lng; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/wp/MarkedWaypoint.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.wp; 2 | 3 | import org.jdesktop.swingx.mapviewer.DefaultWaypoint; 4 | import org.jdesktop.swingx.mapviewer.GeoPosition; 5 | 6 | public class MarkedWaypoint extends DefaultWaypoint { 7 | 8 | private String name; 9 | 10 | public MarkedWaypoint(GeoPosition geoPoint, String name) { 11 | super(geoPoint); 12 | this.name = name; 13 | } 14 | 15 | public String getName() { 16 | return this.name; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/dock/ebus/SegmentationSelected.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.dock.ebus; 2 | 3 | import com.github.pfichtner.jrunalyser.base.data.SegmentationUnit; 4 | 5 | @EventBusMessage 6 | public class SegmentationSelected { 7 | 8 | private final SegmentationUnit segmentationUnit; 9 | 10 | public SegmentationSelected(SegmentationUnit segmentationUnit) { 11 | this.segmentationUnit = segmentationUnit; 12 | } 13 | 14 | public SegmentationUnit getSegmentationUnit() { 15 | return this.segmentationUnit; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/dock/ebus/TrackAdded.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.dock.ebus; 2 | 3 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 4 | 5 | /** 6 | * Message is sent whenever a new Track was added to a datasource. 7 | * 8 | * @author Peter Fichtner 9 | */ 10 | @EventBusMessage 11 | public class TrackAdded { 12 | 13 | private final Track track; 14 | 15 | public TrackAdded(Track gpxTrack) { 16 | this.track = gpxTrack; 17 | } 18 | 19 | public Track getTrack() { 20 | return this.track; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/Delegates.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base; 2 | 3 | public final class Delegates { 4 | 5 | private Delegates() { 6 | super(); 7 | } 8 | 9 | @SuppressWarnings("unchecked") 10 | public static T getRoot(T object, Class clazz) { 11 | T result = object; 12 | while (result instanceof Delegate) { 13 | @SuppressWarnings("rawtypes") 14 | Object tmp = ((Delegate) result).getDelegate(); 15 | if (clazz.isInstance(tmp)) { 16 | result = (T) tmp; 17 | } 18 | } 19 | return result; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/dock/ebus/TrackRemoved.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.dock.ebus; 2 | 3 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 4 | 5 | /** 6 | * Message is sent whenever a new Track was removed from a datasource. 7 | * 8 | * @author Peter Fichtner 9 | */ 10 | @EventBusMessage 11 | public class TrackRemoved { 12 | 13 | private final Track track; 14 | 15 | public TrackRemoved(Track gpxTrack) { 16 | this.track = gpxTrack; 17 | } 18 | 19 | public Track getTrack() { 20 | return this.track; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/DivideTrack.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | public class DivideTrack implements SegmentationUnit { 4 | 5 | private final int parts; 6 | private final Class basedOn; 7 | 8 | public DivideTrack(int parts, Class basedOn) { 9 | this.parts = parts; 10 | this.basedOn = basedOn; 11 | } 12 | 13 | public int getParts() { 14 | return this.parts; 15 | } 16 | 17 | public Class getBasedOn() { 18 | return this.basedOn; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/dock/ebus/AdditionalTracks.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.dock.ebus; 2 | 3 | import java.util.List; 4 | 5 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 6 | import com.google.common.collect.ImmutableList; 7 | 8 | @EventBusMessage 9 | public class AdditionalTracks { 10 | 11 | private final List tracks; 12 | 13 | public AdditionalTracks(List tracks) { 14 | super(); 15 | this.tracks = ImmutableList.copyOf(tracks); 16 | } 17 | 18 | public List getTracks() { 19 | return this.tracks; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/theme/Theme.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.theme; 2 | 3 | import java.awt.Color; 4 | 5 | public interface Theme { 6 | 7 | /** 8 | * Returns the background color. 9 | * 10 | * @return background color 11 | */ 12 | Color getBgColor(); 13 | 14 | /** 15 | * Returns the foreground color. 16 | * 17 | * @return foreground color 18 | */ 19 | Color getFgColor(); 20 | 21 | /** 22 | * Returns the color used for highlights such as fasted segments. 23 | * 24 | * @return highlight color 25 | */ 26 | Color getHlColor(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/dock/ebus/EventBusMessage.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.dock.ebus; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Inherited; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * Marker annotation for messages send via the message bus. 11 | * 12 | * @author Peter Fichtner 13 | */ 14 | @Inherited 15 | @Target(ElementType.TYPE) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | public @interface EventBusMessage { 18 | // marker annotation 19 | } 20 | -------------------------------------------------------------------------------- /gpx-ui-mapprofile/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | gpx.ui.mapprofile 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /gpx-ui/src/main/resources/com/github/pfichtner/jrunalyser/ui/dock/resources/MenuHack_de.properties: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.dock.MenuHack.miDivideByDistance.title=In %s gleiche Streckenteile aufteilen 2 | com.github.pfichtner.jrunalyser.ui.dock.MenuHack.miDivideByTime.title=In %s gleiche Zeitteile aufteilen 3 | com.github.pfichtner.jrunalyser.ui.dock.MenuHack.mSegmentation.title=Segmentierung 4 | com.github.pfichtner.jrunalyser.ui.dock.MenuHack.mDistance.title=Strecke 5 | com.github.pfichtner.jrunalyser.ui.dock.MenuHack.mTime.title=Zeit 6 | com.github.pfichtner.jrunalyser.ui.dock.MenuHack.off=Aus 7 | com.github.pfichtner.jrunalyser.ui.dock.MenuHack.mHighlight.title=Highlight 8 | -------------------------------------------------------------------------------- /gpx-ui-cal/src/test/java/com/github/pfichtner/jrunalyser/ui/cal/Test.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.cal; 2 | 3 | import java.util.Date; 4 | 5 | import javax.swing.JDialog; 6 | import javax.swing.WindowConstants; 7 | 8 | import com.github.pfichtner.jrunalyser.ui.cal.swing.MyCalendar; 9 | 10 | public class Test { 11 | 12 | public static void main(String[] args) { 13 | JDialog jDialog = new JDialog(); 14 | 15 | MyCalendar pane = new MyCalendar(); 16 | pane.setDate(new Date()); 17 | jDialog.add(pane); 18 | jDialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); 19 | jDialog.pack(); 20 | jDialog.setVisible(true); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /gpx-ui/src/main/resources/com/github/pfichtner/jrunalyser/ui/dock/resources/MenuHack.properties: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.dock.MenuHack.miDivideByDistance.title=Split into %s similar parts by distances 2 | com.github.pfichtner.jrunalyser.ui.dock.MenuHack.miDivideByTime.title=Split into %s similar parts by duration 3 | com.github.pfichtner.jrunalyser.ui.dock.MenuHack.mSegmentation.title=Segmentation 4 | com.github.pfichtner.jrunalyser.ui.dock.MenuHack.mDistance.title=Distance 5 | com.github.pfichtner.jrunalyser.ui.dock.MenuHack.mTime.title=Duration 6 | com.github.pfichtner.jrunalyser.ui.dock.MenuHack.off=Off 7 | com.github.pfichtner.jrunalyser.ui.dock.MenuHack.mHighlight.title=Highlight 8 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/datasource/DefaultDatasourceFascadeEvent.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.datasource; 2 | 3 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 4 | 5 | public class DefaultDatasourceFascadeEvent implements DatasourceFascadeEvent { 6 | 7 | private final Type type; 8 | private final Track track; 9 | 10 | public DefaultDatasourceFascadeEvent(Type type, Track track) { 11 | this.type = type; 12 | this.track = track; 13 | } 14 | 15 | @Override 16 | public Type getType() { 17 | return this.type; 18 | } 19 | 20 | @Override 21 | public Track getTrack() { 22 | return this.track; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /gpx-ui-lapinfo/src/main/resources/com/github/pfichtner/jrunalyser/ui/lapinfo/resources/LapInfoPlugin.properties: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.title=Segments 2 | 3 | com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colNr.tile=Segment 4 | com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colLaptime.tile=Lap 5 | com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colTotaltime.tile=Overall 6 | com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colDistance.tile=Distance 7 | com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.coltotalDistance.tile=Overall 8 | com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colSpeed.tile=Speed 9 | com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colPace.tile=Pace 10 | -------------------------------------------------------------------------------- /gpx-ui-cal/src/main/java/com/github/pfichtner/jrunalyser/ui/cal/swing/model/CalenderModel.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.cal.swing.model; 2 | 3 | import java.util.Collection; 4 | import java.util.Date; 5 | 6 | public interface CalenderModel { 7 | 8 | int getCount(); 9 | 10 | CalendarEntry getEntry(int index); 11 | 12 | Collection getEntries(Date date); 13 | 14 | // --------------------------------------------- 15 | 16 | void addModelListener(CalendarModelListener l); 17 | 18 | void removeModelListener(CalendarModelListener l); 19 | 20 | void fireElementsInserted(Date startDate, Date endDate); 21 | 22 | void fireTableChanged(CalendarModelEvent e); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /gpx-ui-lapinfo/src/main/resources/com/github/pfichtner/jrunalyser/ui/lapinfo/resources/LapInfoPlugin_de.properties: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.title=Segmente 2 | 3 | com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colNr.tile=Segment 4 | com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colLaptime.tile=Runde 5 | com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colTotaltime.tile=Gesamt 6 | com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colDistance.tile=Strecke 7 | com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.coltotalDistance.tile=Gesamt 8 | com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colSpeed.tile=Geschwindigkeit 9 | com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colPace.tile=Schritt 10 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/dock/ebus/HighlightSegmentMessage.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.dock.ebus; 2 | 3 | import com.github.pfichtner.jrunalyser.base.data.SegmentationUnit; 4 | 5 | /** 6 | * Message that is sent if a part of the track should be highlighted. 7 | * 8 | * @author Peter Fichtner 9 | */ 10 | @EventBusMessage 11 | public class HighlightSegmentMessage { 12 | 13 | private final SegmentationUnit segmentationUnit; 14 | 15 | public HighlightSegmentMessage(SegmentationUnit segmentationUnit) { 16 | this.segmentationUnit = segmentationUnit; 17 | } 18 | 19 | public SegmentationUnit getSegmentationUnit() { 20 | return this.segmentationUnit; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/util/Distributor.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.util; 2 | 3 | import java.util.Collection; 4 | import java.util.List; 5 | 6 | import com.google.common.collect.Lists; 7 | 8 | public final class Distributor { 9 | 10 | private Distributor() { 11 | super(); 12 | } 13 | 14 | public static List> distribute(Collection in, int size) { 15 | List> result = Lists.newArrayListWithExpectedSize(size); 16 | for (int i = 0; i < size; i++) { 17 | result.add(Lists. newArrayList()); 18 | } 19 | int index = 0; 20 | for (T t : in) { 21 | result.get(index++ % size).add(t); 22 | } 23 | return result; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /gpx-base/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | gpx.base 4 | NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /gpx-ui-mapprofile/src/main/java/com/github/pfichtner/jrunalyser/ui/mapprofile/config/StrokeRendererConfigDecorator.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.mapprofile.config; 2 | 3 | import java.awt.Stroke; 4 | 5 | import org.jfree.chart.renderer.xy.XYItemRenderer; 6 | 7 | public class StrokeRendererConfigDecorator extends DatasetConfigDelegate { 8 | 9 | private final Stroke stroke; 10 | 11 | public StrokeRendererConfigDecorator(DatasetConfig delegate, Stroke stroke) { 12 | super(delegate); 13 | this.stroke = stroke; 14 | } 15 | 16 | @Override 17 | public XYItemRenderer getRenderer() { 18 | XYItemRenderer renderer = super.getRenderer(); 19 | renderer.setSeriesStroke(0, this.stroke); 20 | return renderer; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/dock/ebus/MouseOverWaypoint.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.dock.ebus; 2 | 3 | import com.github.pfichtner.jrunalyser.base.data.WayPoint; 4 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 5 | 6 | @EventBusMessage 7 | public class MouseOverWaypoint { 8 | 9 | private final Track track; 10 | private final WayPoint selectedWayPoint; 11 | 12 | public MouseOverWaypoint(Track track, WayPoint selectedWayPoint) { 13 | this.track = track; 14 | this.selectedWayPoint = selectedWayPoint; 15 | } 16 | 17 | public Track getTrack() { 18 | return this.track; 19 | } 20 | 21 | public WayPoint getSelectedWayPoint() { 22 | return this.selectedWayPoint; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/base/Settings.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.base; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import com.github.pfichtner.jrunalyser.base.data.DistanceUnit; 6 | 7 | // TODO http://docs.oracle.com/javase/tutorial/i18n/resbundle/list.html 8 | public interface Settings { 9 | 10 | public interface SpeedUnit { 11 | 12 | DistanceUnit getDistanceUnit(); 13 | 14 | TimeUnit getTimeUnit(); 15 | 16 | } 17 | 18 | public interface PaceUnit { 19 | 20 | TimeUnit getTimeUnit(); 21 | 22 | DistanceUnit getDistanceUnit(); 23 | 24 | } 25 | 26 | SpeedUnit getSpeedUnit(); 27 | 28 | PaceUnit getPaceUnit(); 29 | 30 | DistanceUnit getDistanceUnit(); 31 | 32 | TimeUnit getTimeUnit(); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /gpx-ui-base/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | gpx.ui.base 4 | NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. 5 | 6 | gpx.base 7 | 8 | 9 | 10 | org.eclipse.jdt.core.javabuilder 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Builder 16 | 17 | 18 | 19 | 20 | 21 | org.eclipse.m2e.core.maven2Nature 22 | org.eclipse.jdt.core.javanature 23 | 24 | 25 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/datasource/Datasource.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.datasource; 2 | 3 | import java.io.IOException; 4 | import java.util.Set; 5 | 6 | import com.github.pfichtner.jrunalyser.base.data.WayPoint; 7 | import com.github.pfichtner.jrunalyser.base.data.track.Id; 8 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 9 | 10 | public interface Datasource { 11 | 12 | Set getTrackIds() throws IOException; 13 | 14 | Track loadTrack(Id id) throws IOException; 15 | 16 | Iterable loadTracks(Iterable ids) throws IOException; 17 | 18 | Track addTrack(Track track) throws IOException; 19 | 20 | Track removeTrack(Id id) throws IOException; 21 | 22 | Set getCommonWaypoints(); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /gpx-ui-mapprofile/src/main/java/com/github/pfichtner/jrunalyser/ui/mapprofile/config/DatasetConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.mapprofile.config; 2 | 3 | import org.jfree.chart.axis.NumberAxis; 4 | import org.jfree.chart.renderer.xy.XYItemRenderer; 5 | import org.jfree.data.xy.XYDataset; 6 | 7 | import com.github.pfichtner.jrunalyser.base.data.LinkedTrackPoint; 8 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 9 | import com.google.common.base.Function; 10 | 11 | public interface DatasetConfig { 12 | 13 | int getIndex(); 14 | 15 | String getDescription(); 16 | 17 | XYItemRenderer getRenderer(); 18 | 19 | NumberAxis createNumberAxis(Track track); 20 | 21 | XYDataset createDataset(Track track, 22 | Function xFunc); 23 | 24 | } -------------------------------------------------------------------------------- /gpx-ui-cal/src/main/java/com/github/pfichtner/jrunalyser/ui/cal/swing/model/CalendarModelEvent.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.cal.swing.model; 2 | 3 | import java.util.Date; 4 | 5 | public class CalendarModelEvent { 6 | 7 | public enum Type { 8 | INSERTED, REMOVED, UPDATED; 9 | } 10 | 11 | private final Type type; 12 | private final Date startDate; 13 | private final Date endDate; 14 | 15 | public CalendarModelEvent(Type type, Date startDate, Date endDate) { 16 | this.type = type; 17 | this.startDate = startDate; 18 | this.endDate = endDate; 19 | } 20 | 21 | public Type getType() { 22 | return this.type; 23 | } 24 | 25 | public Date getStartDate() { 26 | return this.startDate; 27 | } 28 | 29 | public Date getEndDate() { 30 | return this.endDate; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/wp/SelectedWaypoint.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.wp; 2 | 3 | import org.jdesktop.swingx.mapviewer.DefaultWaypoint; 4 | 5 | import com.github.pfichtner.jrunalyser.base.data.WayPoint; 6 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 7 | 8 | public class SelectedWaypoint extends DefaultWaypoint { 9 | 10 | private WayPoint selectedWayPoint; 11 | private Track track; 12 | 13 | public WayPoint getSelectedWayPoint() { 14 | return this.selectedWayPoint; 15 | } 16 | 17 | public Track getTrack() { 18 | return this.track; 19 | } 20 | 21 | public void setSelectedWayPoint(Track track, WayPoint selectedWayPoint) { 22 | this.track = track; 23 | this.selectedWayPoint = selectedWayPoint; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /gpx-ui-cal/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | gpx.ui.cal 4 | NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. 5 | 6 | gpx.base 7 | gpx.ui.base 8 | 9 | 10 | 11 | org.eclipse.jdt.core.javabuilder 12 | 13 | 14 | 15 | 16 | org.eclipse.m2e.core.maven2Builder 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.m2e.core.maven2Nature 23 | org.eclipse.jdt.core.javanature 24 | 25 | 26 | -------------------------------------------------------------------------------- /gpx-ui-map/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | gpx.ui.map 4 | NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. 5 | 6 | gpx.base 7 | gpx.ui.base 8 | 9 | 10 | 11 | org.eclipse.jdt.core.javabuilder 12 | 13 | 14 | 15 | 16 | org.eclipse.m2e.core.maven2Builder 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.m2e.core.maven2Nature 23 | org.eclipse.jdt.core.javanature 24 | 25 | 26 | -------------------------------------------------------------------------------- /gpx-ui-lapinfo/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | gpx.ui.lapinfo 4 | NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. 5 | 6 | gpx.base 7 | gpx.ui.base 8 | 9 | 10 | 11 | org.eclipse.jdt.core.javabuilder 12 | 13 | 14 | 15 | 16 | org.eclipse.m2e.core.maven2Builder 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.m2e.core.maven2Nature 23 | org.eclipse.jdt.core.javanature 24 | 25 | 26 | -------------------------------------------------------------------------------- /gpx-ui-tracklist/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | gpx.ui.tracklist 4 | NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. 5 | 6 | gpx.base 7 | gpx.ui.base 8 | 9 | 10 | 11 | org.eclipse.jdt.core.javabuilder 12 | 13 | 14 | 15 | 16 | org.eclipse.m2e.core.maven2Builder 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.m2e.core.maven2Nature 23 | org.eclipse.jdt.core.javanature 24 | 25 | 26 | -------------------------------------------------------------------------------- /gpx-ui-trackstats/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | gpx.ui.trackstats 4 | NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. 5 | 6 | gpx.base 7 | gpx.ui.base 8 | 9 | 10 | 11 | org.eclipse.jdt.core.javabuilder 12 | 13 | 14 | 15 | 16 | org.eclipse.m2e.core.maven2Builder 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.m2e.core.maven2Nature 23 | org.eclipse.jdt.core.javanature 24 | 25 | 26 | -------------------------------------------------------------------------------- /gpx-ui-overallstats/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | gpx.ui.overallstats 4 | NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. 5 | 6 | gpx.base 7 | gpx.ui.base 8 | 9 | 10 | 11 | org.eclipse.jdt.core.javabuilder 12 | 13 | 14 | 15 | 16 | org.eclipse.m2e.core.maven2Builder 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.m2e.core.maven2Nature 23 | org.eclipse.jdt.core.javanature 24 | 25 | 26 | -------------------------------------------------------------------------------- /gpx-ui-segmentstats/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | gpx.ui.segmentstats 4 | NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. 5 | 6 | gpx.base 7 | gpx.ui.base 8 | 9 | 10 | 11 | org.eclipse.jdt.core.javabuilder 12 | 13 | 14 | 15 | 16 | org.eclipse.m2e.core.maven2Builder 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.m2e.core.maven2Nature 23 | org.eclipse.jdt.core.javanature 24 | 25 | 26 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/format/DistanceFormatter.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.format; 2 | 3 | import java.text.NumberFormat; 4 | 5 | import com.github.pfichtner.jrunalyser.base.data.Distance; 6 | import com.github.pfichtner.jrunalyser.base.data.DistanceUnit; 7 | import com.github.pfichtner.jrunalyser.ui.base.UiPlugins; 8 | 9 | public class DistanceFormatter { 10 | 11 | public enum Type { 12 | SHORT; 13 | } 14 | 15 | private final Type type; 16 | 17 | public DistanceFormatter(Type type) { 18 | this.type = type; 19 | } 20 | 21 | public String format(Distance distance) { 22 | NumberFormat nf = NumberFormat.getNumberInstance(); 23 | DistanceUnit du = distance.getDistanceUnit(); 24 | return nf.format(distance.getValue(du)) 25 | + UiPlugins.getI18n().getText(du, this.type); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/painter/StackedPainter.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.painter; 2 | 3 | import java.awt.Graphics2D; 4 | import java.util.Collection; 5 | import java.util.List; 6 | 7 | import org.jdesktop.swingx.painter.Painter; 8 | 9 | import com.google.common.collect.ImmutableList; 10 | 11 | public class StackedPainter implements Painter { 12 | 13 | private final List> painters; 14 | 15 | public StackedPainter(Collection> painters) { 16 | this.painters = ImmutableList.copyOf(painters); 17 | } 18 | 19 | @Override 20 | public void paint(Graphics2D g, T t, int w, int h) { 21 | for (Painter painter : this.painters) { 22 | Graphics2D clone = (Graphics2D) g.create(); 23 | painter.paint(clone, t, w, h); 24 | clone.dispose(); 25 | } 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/base/DefaultGridData.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.base; 2 | 3 | 4 | public class DefaultGridData implements GridData { 5 | 6 | private final int gridX; 7 | private final int gridY; 8 | private final int gridWidth; 9 | private final int gridHeight; 10 | 11 | public DefaultGridData(int gridX, int gridY, int gridWidth, int gridHeight) { 12 | super(); 13 | this.gridX = gridX; 14 | this.gridY = gridY; 15 | this.gridWidth = gridWidth; 16 | this.gridHeight = gridHeight; 17 | } 18 | 19 | public int getGridX() { 20 | return this.gridX; 21 | } 22 | 23 | public int getGridY() { 24 | return this.gridY; 25 | } 26 | 27 | public int getGridWidth() { 28 | return this.gridWidth; 29 | } 30 | 31 | public int getGridHeight() { 32 | return this.gridHeight; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/dock/ebus/SegmentSelectedMessage.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.dock.ebus; 2 | 3 | import com.github.pfichtner.jrunalyser.base.data.segment.Segment; 4 | 5 | /** 6 | * Message that is sent if a previously segmented part of the track (a segment) 7 | * should be highlighted, e.g. on a mouse over event in the LapInfoTable. 8 | * 9 | * @author Peter Fichtner 10 | */ 11 | @EventBusMessage 12 | public class SegmentSelectedMessage { 13 | 14 | private final int index; 15 | private final Segment segment; 16 | 17 | public SegmentSelectedMessage(int index, Segment segment) { 18 | this.index = index; 19 | this.segment = segment; 20 | } 21 | 22 | public int getIndex() { 23 | return this.index; 24 | } 25 | 26 | public Segment getSegment() { 27 | return this.segment; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /gpx-ui-trackcompare/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | gpx.ui.trackcompare 4 | NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. 5 | 6 | gpx.base 7 | gpx.ui.base 8 | gpx.ui.tracklist 9 | 10 | 11 | 12 | org.eclipse.jdt.core.javabuilder 13 | 14 | 15 | 16 | 17 | org.eclipse.m2e.core.maven2Builder 18 | 19 | 20 | 21 | 22 | 23 | org.eclipse.m2e.core.maven2Nature 24 | org.eclipse.jdt.core.javanature 25 | 26 | 27 | -------------------------------------------------------------------------------- /gpx-ui-mapprofile/src/main/resources/com/github/pfichtner/jrunalyser/ui/mapprofile/resources/MapProfilePlugin_de.properties: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.title=Profil 2 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.elevation=H\u00F6he 3 | 4 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.xaxis=X-Achse 5 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.distance=Strecke 6 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.duration=Zeit 7 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.distanceInMeter=Distanz in m 8 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.durationInSecs=Zeit in Sek. 9 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.pace=Schritt (Min./km) 10 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.gradient=Steigung (%) 11 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/floater/DefaultHighlightableSegment.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.floater; 2 | 3 | import java.util.List; 4 | 5 | import com.github.pfichtner.jrunalyser.base.data.LinkedTrackPoint; 6 | import com.github.pfichtner.jrunalyser.base.data.segment.DefaultSegment; 7 | import com.github.pfichtner.jrunalyser.base.data.stat.Statistics; 8 | 9 | public class DefaultHighlightableSegment extends DefaultSegment implements 10 | HighlightableSegment { 11 | 12 | private final boolean highlighted; 13 | 14 | public DefaultHighlightableSegment(List wps, 15 | boolean highlighted, Statistics statistics) { 16 | super(wps, statistics); 17 | this.highlighted = highlighted; 18 | } 19 | 20 | @Override 21 | public boolean isHighligted() { 22 | return this.highlighted; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /gpx-ui-mapprofile/src/main/resources/com/github/pfichtner/jrunalyser/ui/mapprofile/resources/MapProfilePlugin.properties: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.title=Profile 2 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.elevation=Elevation 3 | 4 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.xaxis=X-Axis 5 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.distance=Distance 6 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.duration=Duration 7 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.distanceInMeter=Distance in m 8 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.durationInSecs=Duration in secs 9 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.pace=Pace (min./km) 10 | com.github.pfichtner.jrunalyser.ui.mapprofile.MapProfilePlugin.gradient=Gradient (%) 11 | -------------------------------------------------------------------------------- /gpx-ui-cal/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | gpx.ui.cal 5 | 6 | 7 | com.github.pfichtner.jrunalyser 8 | parent 9 | 0.0.4-SNAPSHOT 10 | 11 | 12 | 13 | 14 | com.github.pfichtner.jrunalyser 15 | gpx.base 16 | 0.0.4-SNAPSHOT 17 | 18 | 19 | com.github.pfichtner.jrunalyser 20 | gpx.ui.base 21 | 0.0.4-SNAPSHOT 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /gpx-ui-lapinfo/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | gpx.ui.lapinfo 5 | 6 | 7 | com.github.pfichtner.jrunalyser 8 | parent 9 | 0.0.4-SNAPSHOT 10 | 11 | 12 | 13 | 14 | com.github.pfichtner.jrunalyser 15 | gpx.base 16 | 0.0.4-SNAPSHOT 17 | 18 | 19 | com.github.pfichtner.jrunalyser 20 | gpx.ui.base 21 | 0.0.4-SNAPSHOT 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /gpx-ui-tracklist/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | gpx.ui.tracklist 5 | 6 | 7 | com.github.pfichtner.jrunalyser 8 | parent 9 | 0.0.4-SNAPSHOT 10 | 11 | 12 | 13 | 14 | com.github.pfichtner.jrunalyser 15 | gpx.base 16 | 0.0.4-SNAPSHOT 17 | 18 | 19 | com.github.pfichtner.jrunalyser 20 | gpx.ui.base 21 | 0.0.4-SNAPSHOT 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /gpx-ui-trackstats/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | gpx.ui.trackstats 5 | 6 | 7 | com.github.pfichtner.jrunalyser 8 | parent 9 | 0.0.4-SNAPSHOT 10 | 11 | 12 | 13 | 14 | com.github.pfichtner.jrunalyser 15 | gpx.base 16 | 0.0.4-SNAPSHOT 17 | 18 | 19 | com.github.pfichtner.jrunalyser 20 | gpx.ui.base 21 | 0.0.4-SNAPSHOT 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /gpx-ui-overallstats/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | gpx.ui.overallstats 5 | 6 | 7 | com.github.pfichtner.jrunalyser 8 | parent 9 | 0.0.4-SNAPSHOT 10 | 11 | 12 | 13 | 14 | com.github.pfichtner.jrunalyser 15 | gpx.base 16 | 0.0.4-SNAPSHOT 17 | 18 | 19 | com.github.pfichtner.jrunalyser 20 | gpx.ui.base 21 | 0.0.4-SNAPSHOT 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /gpx-ui-segmentstats/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | gpx.ui.segmentstats 5 | 6 | 7 | com.github.pfichtner.jrunalyser 8 | parent 9 | 0.0.4-SNAPSHOT 10 | 11 | 12 | 13 | 14 | com.github.pfichtner.jrunalyser 15 | gpx.base 16 | 0.0.4-SNAPSHOT 17 | 18 | 19 | com.github.pfichtner.jrunalyser 20 | gpx.ui.base 21 | 0.0.4-SNAPSHOT 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/AdditonalTrackInfo.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map; 2 | 3 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 4 | import com.github.pfichtner.jrunalyser.ui.map.theme.Theme; 5 | 6 | public class AdditonalTrackInfo { 7 | 8 | private final Track track; 9 | private final Theme theme; 10 | private final int xoffset; 11 | private final int yoffset; 12 | 13 | public AdditonalTrackInfo(Track track, Theme theme, int xoffset, int yoffset) { 14 | this.track = track; 15 | this.theme = theme; 16 | this.xoffset = xoffset; 17 | this.yoffset = yoffset; 18 | } 19 | 20 | public Track getTrack() { 21 | return this.track; 22 | } 23 | 24 | public Theme getTheme() { 25 | return this.theme; 26 | } 27 | 28 | public int getXoffset() { 29 | return this.xoffset; 30 | } 31 | 32 | public int getYoffset() { 33 | return this.yoffset; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /gpx-base/src/test/java/com/github/pfichtner/jrunalyser/base/util/format/LatLonFormatterTest.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.util.format; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.util.Locale; 6 | 7 | import org.junit.Test; 8 | 9 | public class LatLonFormatterTest { 10 | 11 | @Test 12 | public void testSearsTowerChicago_us() { 13 | LatLonFormatter latLonFormatter = new LatLonFormatter(Locale.US); 14 | assertEquals("N41° 52.736 W087° 38.185", 15 | formatSearsTowerChicago(latLonFormatter)); 16 | } 17 | 18 | @Test 19 | public void testSearsTowerChicago_de() { 20 | LatLonFormatter latLonFormatter = new LatLonFormatter(Locale.GERMANY); 21 | assertEquals("N41° 52,736 W087° 38,185", 22 | formatSearsTowerChicago(latLonFormatter)); 23 | } 24 | 25 | public String formatSearsTowerChicago(LatLonFormatter formatter) { 26 | return formatter.format(41.878928, -87.636417); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /gpx-base/src/test/java/com/github/pfichtner/jrunalyser/base/data/DistanceUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import org.junit.Test; 6 | 7 | import com.github.pfichtner.jrunalyser.base.data.DistanceUnit; 8 | 9 | public class DistanceUnitTest { 10 | 11 | @Test 12 | public void testConvert1() { 13 | assertEquals(Double.valueOf(1000), Double.valueOf(DistanceUnit.METERS 14 | .convert(1, DistanceUnit.KILOMETERS))); 15 | assertEquals(Double.valueOf(2), Double.valueOf(DistanceUnit.KILOMETERS 16 | .convert(2000, DistanceUnit.METERS))); 17 | } 18 | 19 | @Test 20 | public void testConvert2() { 21 | assertEquals(Double.valueOf(1.60934), 22 | Double.valueOf(DistanceUnit.KILOMETERS.convert(1, 23 | DistanceUnit.MILES))); 24 | assertEquals(Double.valueOf(5280), Double.valueOf(DistanceUnit.FEET 25 | .convert(1, DistanceUnit.MILES))); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/util/MovingAverageIterator.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.util; 2 | 3 | import java.util.Iterator; 4 | 5 | public class MovingAverageIterator implements Iterator { 6 | 7 | private final Iterator delegate; 8 | private final MovingAverage movingAverage; 9 | 10 | public MovingAverageIterator(Iterator delegate, int period) { 11 | this.delegate = delegate; 12 | this.movingAverage = new MovingAverage(period); 13 | } 14 | 15 | @Override 16 | public boolean hasNext() { 17 | return this.delegate.hasNext(); 18 | } 19 | 20 | @Override 21 | public Double next() { 22 | Number next = this.delegate.next(); 23 | return Double.valueOf(next == null ? this.movingAverage.getValue() 24 | : this.movingAverage.add(next.doubleValue())); 25 | } 26 | 27 | @Override 28 | public void remove() { 29 | this.delegate.remove(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/wp/SegmentBorderWaypoint.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.wp; 2 | 3 | import org.jdesktop.swingx.mapviewer.DefaultWaypoint; 4 | import org.jdesktop.swingx.mapviewer.GeoPosition; 5 | 6 | import com.github.pfichtner.jrunalyser.base.data.SegmentationUnit; 7 | 8 | /** 9 | * Waypoint marking a Segment border. 10 | * 11 | * @author Peter Fichtner 12 | */ 13 | public class SegmentBorderWaypoint extends DefaultWaypoint { 14 | 15 | private final int cnt; 16 | 17 | private final SegmentationUnit segmentationUnit; 18 | 19 | public SegmentBorderWaypoint(GeoPosition geoPoint, int cnt, 20 | SegmentationUnit segmentationUnit) { 21 | super(geoPoint); 22 | this.cnt = cnt; 23 | this.segmentationUnit = segmentationUnit; 24 | } 25 | 26 | public int getCnt() { 27 | return this.cnt; 28 | } 29 | 30 | public SegmentationUnit getSegmentationUnit() { 31 | return this.segmentationUnit; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/wprenderer/SegmentBorderWaypointRendererStart.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.wprenderer; 2 | 3 | import java.awt.Font; 4 | import java.awt.Graphics2D; 5 | import java.awt.geom.Ellipse2D; 6 | 7 | import com.github.pfichtner.jrunalyser.ui.map.theme.Theme; 8 | import com.github.pfichtner.jrunalyser.ui.map.wp.TrackStartWaypoint; 9 | 10 | public class SegmentBorderWaypointRendererStart extends 11 | AbstractSegmentBorderWaypointRenderer { 12 | 13 | public SegmentBorderWaypointRendererStart(Theme theme, Font font) { 14 | super(theme, font); 15 | } 16 | 17 | /* 18 | * Instead of the simple circle we paint a dot 19 | */ 20 | @Override 21 | protected void drawCircleBackground(Graphics2D g, TrackStartWaypoint waypoint, int r) { 22 | int rr = r - 5; 23 | g.setColor(this.theme.getFgColor()); 24 | g.fill(new Ellipse2D.Double(-rr, -rr, 2 * rr + 2, 2 * rr + 2)); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/DefaultCoordinate.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | import java.io.Serializable; 4 | 5 | public class DefaultCoordinate implements Coordinate, Serializable { 6 | 7 | private static final long serialVersionUID = 6898515519217819762L; 8 | 9 | private final double lat; 10 | private final double lon; 11 | 12 | public DefaultCoordinate(double lat, double lon) { 13 | this.lat = lat; 14 | this.lon = lon; 15 | } 16 | 17 | public static DefaultCoordinate of(Coordinate coordinate) { 18 | return new DefaultCoordinate(coordinate.getLatitude(), 19 | coordinate.getLongitude()); 20 | } 21 | 22 | @Override 23 | public double getLatitude() { 24 | return this.lat; 25 | } 26 | 27 | @Override 28 | public double getLongitude() { 29 | return this.lon; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return String.valueOf(getLatitude()) + '/' + getLongitude(); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/table/renderers/PaceRenderer.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.table.renderers; 2 | 3 | import java.awt.Component; 4 | 5 | import javax.swing.JTable; 6 | import javax.swing.table.DefaultTableCellRenderer; 7 | 8 | import com.github.pfichtner.jrunalyser.ui.base.StaticSettings; 9 | import com.github.pfichtner.jrunalyser.ui.format.PaceFormatter; 10 | 11 | public class PaceRenderer extends DefaultTableCellRenderer { 12 | private static final long serialVersionUID = 1L; 13 | private final PaceFormatter formatter = new PaceFormatter( 14 | PaceFormatter.Type.SHORT); 15 | 16 | @Override 17 | public Component getTableCellRendererComponent(JTable table, 18 | Object value, boolean isSelected, boolean hasFocus, int row, 19 | int column) { 20 | setFont(null); 21 | setText(this.formatter.format(StaticSettings.INSTANCE, value)); 22 | setBackground(isSelected ? table.getSelectionBackground() : null); 23 | return this; 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/comparator/AbsDiffNumberComparator.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.comparator; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.Comparator; 5 | 6 | public class AbsDiffNumberComparator implements Comparator { 7 | 8 | // TODO negative maxDiffs!? 9 | private final BigDecimal maxDiff; 10 | 11 | public AbsDiffNumberComparator(int maxDiff) { 12 | this(new BigDecimal(maxDiff)); 13 | } 14 | 15 | public AbsDiffNumberComparator(BigDecimal maxDiff) { 16 | this.maxDiff = maxDiff; 17 | } 18 | 19 | @Override 20 | public int compare(Number n1, Number n2) { 21 | BigDecimal bd1 = new BigDecimal(String.valueOf(n1)); 22 | BigDecimal bd2 = new BigDecimal(String.valueOf(n2)); 23 | return bd1.subtract(bd2).abs().compareTo(this.maxDiff) <= 0 ? 0 : bd1 24 | .compareTo(bd2); 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return "AbsDiffNumberComparator [maxDiff=" + this.maxDiff + "]"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/table/renderers/SpeedRenderer.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.table.renderers; 2 | 3 | import java.awt.Component; 4 | 5 | import javax.swing.JTable; 6 | import javax.swing.table.DefaultTableCellRenderer; 7 | 8 | import com.github.pfichtner.jrunalyser.ui.base.StaticSettings; 9 | import com.github.pfichtner.jrunalyser.ui.format.SpeedFormatter; 10 | 11 | public class SpeedRenderer extends DefaultTableCellRenderer { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | private final SpeedFormatter formatter = new SpeedFormatter( 16 | SpeedFormatter.Type.SHORT); 17 | 18 | @Override 19 | public Component getTableCellRendererComponent(JTable table, Object value, 20 | boolean isSelected, boolean hasFocus, int row, int column) { 21 | setFont(null); 22 | setText(this.formatter.format(StaticSettings.INSTANCE, value)); 23 | setBackground(isSelected ? table.getSelectionBackground() : null); 24 | return this; 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/util/FixedDuration.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.util; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import com.github.pfichtner.jrunalyser.base.data.DefaultDistance; 6 | import com.github.pfichtner.jrunalyser.base.data.Distance; 7 | import com.github.pfichtner.jrunalyser.base.data.DistanceUnit; 8 | import com.github.pfichtner.jrunalyser.base.data.Duration; 9 | 10 | public final class FixedDuration { 11 | 12 | private final Duration fixedDuration; 13 | 14 | public FixedDuration(Duration fixedDuration) { 15 | this.fixedDuration = fixedDuration; // e.g. 1h 16 | } 17 | 18 | public Distance getDistance(Distance sourceDistance, Duration sourceDuration) { 19 | DistanceUnit du = sourceDistance.getDistanceUnit(); 20 | TimeUnit tu = sourceDuration.getTimeUnit(); 21 | double converted = sourceDistance.getValue(du) 22 | / sourceDuration.getValue(tu) * this.fixedDuration.getValue(tu); 23 | return DefaultDistance.of(converted, du); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/util/FixedDistance.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.util; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import com.github.pfichtner.jrunalyser.base.data.DefaultDuration; 6 | import com.github.pfichtner.jrunalyser.base.data.Distance; 7 | import com.github.pfichtner.jrunalyser.base.data.DistanceUnit; 8 | import com.github.pfichtner.jrunalyser.base.data.Duration; 9 | 10 | public final class FixedDistance { 11 | 12 | private final Distance fixedDistance; 13 | 14 | public FixedDistance(Distance fixedDistance) { 15 | this.fixedDistance = fixedDistance; // e.g. 400m 16 | } 17 | 18 | public Duration getDuration(Distance sourceDistance, Duration sourceDuration) { 19 | DistanceUnit du = sourceDistance.getDistanceUnit(); 20 | TimeUnit tu = sourceDuration.getTimeUnit(); 21 | double converted = sourceDuration.getValue(tu) 22 | / sourceDistance.getValue(du) * this.fixedDistance.getValue(du); 23 | return DefaultDuration.of(converted, tu); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/table/renderers/DistanceRenderer.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.table.renderers; 2 | 3 | import java.awt.Component; 4 | 5 | import javax.swing.JTable; 6 | import javax.swing.table.DefaultTableCellRenderer; 7 | 8 | import com.github.pfichtner.jrunalyser.base.data.Distance; 9 | import com.github.pfichtner.jrunalyser.ui.format.DistanceFormatter; 10 | 11 | public class DistanceRenderer extends DefaultTableCellRenderer { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | private final DistanceFormatter formatter = new DistanceFormatter( 16 | DistanceFormatter.Type.SHORT); 17 | 18 | @Override 19 | public Component getTableCellRendererComponent(JTable table, Object value, 20 | boolean isSelected, boolean hasFocus, int row, int column) { 21 | setFont(null); 22 | setText(value == null ? null : this.formatter.format((Distance) value)); 23 | setBackground(isSelected ? table.getSelectionBackground() : null); 24 | return this; 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/table/renderers/DurationRenderer.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.table.renderers; 2 | 3 | import java.awt.Component; 4 | 5 | import javax.swing.JTable; 6 | import javax.swing.table.DefaultTableCellRenderer; 7 | 8 | import com.github.pfichtner.jrunalyser.base.data.Duration; 9 | import com.github.pfichtner.jrunalyser.ui.format.DurationFormatter; 10 | 11 | public class DurationRenderer extends DefaultTableCellRenderer { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | private final DurationFormatter formatter = new DurationFormatter( 16 | DurationFormatter.Type.SHORT); 17 | 18 | @Override 19 | public Component getTableCellRendererComponent(JTable table, Object value, 20 | boolean isSelected, boolean hasFocus, int row, int column) { 21 | setFont(null); 22 | setText(value == null ? null : this.formatter.format((Duration) value)); 23 | setBackground(isSelected ? table.getSelectionBackground() : null); 24 | return this; 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /gpx-ui-mapprofile/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | gpx.ui.mapprofile 5 | 6 | 7 | com.github.pfichtner.jrunalyser 8 | parent 9 | 0.0.4-SNAPSHOT 10 | 11 | 12 | 13 | 14 | com.github.pfichtner.jrunalyser 15 | gpx.base 16 | 0.0.4-SNAPSHOT 17 | 18 | 19 | com.github.pfichtner.jrunalyser 20 | gpx.ui.base 21 | 0.0.4-SNAPSHOT 22 | 23 | 24 | org.jfree 25 | jfreechart 26 | 1.0.14 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/datasource/AbstractDatasourceFascade.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.datasource; 2 | 3 | import java.util.List; 4 | import java.util.concurrent.CopyOnWriteArrayList; 5 | 6 | /** 7 | * A DatasourceFascade that implements the methods for 8 | * {@link DatasourceFascadeListener}s. 9 | * 10 | * @author Peter Fichtner 11 | */ 12 | public abstract class AbstractDatasourceFascade implements DatasourceFascade { 13 | 14 | private final List listeners = new CopyOnWriteArrayList(); 15 | 16 | protected void fire(DatasourceFascadeEvent event) { 17 | for (DatasourceFascadeListener listener : this.listeners) { 18 | listener.contentChanged(event); 19 | } 20 | } 21 | 22 | @Override 23 | public void addListener(DatasourceFascadeListener listener) { 24 | this.listeners.add(listener); 25 | } 26 | 27 | @Override 28 | public void removeListener(DatasourceFascadeListener listener) { 29 | this.listeners.remove(listener); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/painter/TrackPainter.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.painter; 2 | 3 | import java.awt.BasicStroke; 4 | import java.awt.Graphics2D; 5 | import java.awt.Stroke; 6 | import java.awt.geom.Line2D; 7 | import java.awt.geom.Point2D; 8 | 9 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 10 | import com.github.pfichtner.jrunalyser.ui.map.theme.Theme; 11 | 12 | /** 13 | * Simple Painter that draws a line using the Theme's background color from 14 | * waypoint A to waypoint B 15 | * 16 | * @author Peter Fichtner 17 | */ 18 | public class TrackPainter extends AbstractTrackPainter { 19 | 20 | private final Stroke stroke; 21 | 22 | public TrackPainter(Track track, Theme theme, int stroke) { 23 | super(track, theme); 24 | this.stroke = new BasicStroke(stroke); 25 | } 26 | 27 | @Override 28 | protected void drawWaypoint(Graphics2D g, Point2D p1, Point2D p2) { 29 | g.setStroke(this.stroke); 30 | g.setColor(getTheme().getBgColor()); 31 | g.draw(new Line2D.Double(p1, p2)); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /gpx-ui-trackcompare/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | gpx.ui.trackcompare 5 | 6 | 7 | com.github.pfichtner.jrunalyser 8 | parent 9 | 0.0.4-SNAPSHOT 10 | 11 | 12 | 13 | 14 | com.github.pfichtner.jrunalyser 15 | gpx.base 16 | 0.0.4-SNAPSHOT 17 | 18 | 19 | com.github.pfichtner.jrunalyser 20 | gpx.ui.base 21 | 0.0.4-SNAPSHOT 22 | 23 | 24 | com.github.pfichtner.jrunalyser 25 | gpx.ui.tracklist 26 | 0.0.4-SNAPSHOT 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /gpx-ui-tracklist/src/main/java/com/github/pfichtner/jrunalyser/ui/tracklist/MedalRendererDecorator.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.tracklist; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | 6 | import javax.swing.JTable; 7 | import javax.swing.table.TableCellRenderer; 8 | 9 | import com.github.pfichtner.jrunalyser.ui.table.renderers.PositionRendererDecorator; 10 | 11 | public class MedalRendererDecorator extends PositionRendererDecorator { 12 | 13 | private static final Color GOLD = new Color(201, 137, 16); 14 | private static final Color SILVER = new Color(168, 168, 168); 15 | private static final Color BRONZE = new Color(150, 90, 56); 16 | 17 | private static final Color[] colors = new Color[] { GOLD, SILVER, BRONZE }; 18 | 19 | public MedalRendererDecorator(TableCellRenderer delegate) { 20 | super(delegate); 21 | } 22 | 23 | @Override 24 | protected void renderPos(JTable table, Component c, int pos) { 25 | c.setBackground(getColor(pos)); 26 | } 27 | 28 | private static Color getColor(int pos) { 29 | return pos < colors.length ? colors[pos] : null; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/painter/TrackOutlinePainter.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.painter; 2 | 3 | import java.awt.BasicStroke; 4 | import java.awt.Graphics2D; 5 | import java.awt.Stroke; 6 | import java.awt.geom.Line2D; 7 | import java.awt.geom.Point2D; 8 | 9 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 10 | import com.github.pfichtner.jrunalyser.ui.map.theme.Theme; 11 | 12 | /** 13 | * Simple Painter that draws a thick line using the Theme's foreground color 14 | * from waypoint A to waypoint B 15 | * 16 | * @author Peter Fichtner 17 | */ 18 | public class TrackOutlinePainter extends AbstractTrackPainter { 19 | 20 | private Stroke stroke; 21 | 22 | public TrackOutlinePainter(Track track, Theme theme, int stroke) { 23 | super(track, theme); 24 | this.stroke = new BasicStroke(stroke + 2); 25 | } 26 | 27 | @Override 28 | protected void drawWaypoint(Graphics2D g, Point2D p1, Point2D p2) { 29 | Theme theme = getTheme(); 30 | g.setColor(theme.getFgColor()); 31 | g.setStroke(this.stroke); 32 | g.draw(new Line2D.Double(p1, p2)); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /gpx-ui/Dock.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /gpx-ui-tracklist/src/main/resources/com/github/pfichtner/jrunalyser/ui/tracklist/resources/TrackListPlugin.properties: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.tracklist.TrackListPlugin.title=Tracks 2 | 3 | com.github.pfichtner.jrunalyser.ui.tracklist.TrackTableModel.colStartdate.title=Start time 4 | com.github.pfichtner.jrunalyser.ui.tracklist.TrackTableModel.colName.title=Name 5 | com.github.pfichtner.jrunalyser.ui.tracklist.TrackTableModel.colDescription.title=Comment 6 | com.github.pfichtner.jrunalyser.ui.tracklist.TrackTableModel.colDuration.title=Duration 7 | com.github.pfichtner.jrunalyser.ui.tracklist.TrackTableModel.colDistance.title=Distance 8 | com.github.pfichtner.jrunalyser.ui.tracklist.TrackTableModel.colElevation.title=Elevation min/max 9 | com.github.pfichtner.jrunalyser.ui.tracklist.TrackTableModel.colSpeed.title=\u2205 Speed 10 | com.github.pfichtner.jrunalyser.ui.tracklist.TrackTableModel.colPace.title=\u2205 Pace 11 | com.github.pfichtner.jrunalyser.ui.tracklist.TrackTableModel.colSimCount.title=Count 12 | com.github.pfichtner.jrunalyser.ui.tracklist.TrackTableModel.colAwayIsReturn.title=away=return 13 | 14 | com.github.pfichtner.jrunalyser.ui.tracklist.TrackTable.miOverlay.title=Overlay -------------------------------------------------------------------------------- /gpx-ui-map/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | gpx.ui.map 5 | 6 | 7 | com.github.pfichtner.jrunalyser 8 | parent 9 | 0.0.4-SNAPSHOT 10 | 11 | 12 | 13 | 14 | com.github.pfichtner.jrunalyser 15 | gpx.base 16 | 0.0.4-SNAPSHOT 17 | 18 | 19 | com.github.pfichtner.jrunalyser 20 | gpx.ui.base 21 | 0.0.4-SNAPSHOT 22 | 23 | 24 | org.swinglabs 25 | swingx 26 | 1.6.1 27 | 28 | 29 | org.swinglabs 30 | swingx-ws 31 | 1.0 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /gpx-ui-mapprofile/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /gpx-ui-base/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | gpx.ui.base 5 | 6 | 7 | com.github.pfichtner.jrunalyser 8 | parent 9 | 0.0.4-SNAPSHOT 10 | 11 | 12 | 13 | 14 | com.github.pfichtner.jrunalyser 15 | gpx.base 16 | 0.0.4-SNAPSHOT 17 | 18 | 19 | com.dteoh 20 | treasuremap 21 | 0.1.1 22 | 23 | 24 | com.github.pfichtner 25 | durationformatter 26 | 0.1.1 27 | 28 | 29 | junit 30 | junit 31 | 4.10 32 | test 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/wprenderer/WaypointRendererDelegate.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.wprenderer; 2 | 3 | import static com.google.common.base.Preconditions.checkNotNull; 4 | 5 | import java.awt.Graphics2D; 6 | import java.util.Map; 7 | 8 | import org.jdesktop.swingx.JXMapViewer; 9 | import org.jdesktop.swingx.mapviewer.Waypoint; 10 | import org.jdesktop.swingx.mapviewer.WaypointRenderer; 11 | 12 | import com.google.common.collect.ImmutableMap; 13 | 14 | public class WaypointRendererDelegate implements WaypointRenderer { 15 | 16 | private final ImmutableMap, WaypointRenderer> delegates; 17 | 18 | public WaypointRendererDelegate( 19 | Map, ? extends WaypointRenderer> delegates) { 20 | this.delegates = ImmutableMap.copyOf(delegates); 21 | } 22 | 23 | @Override 24 | public boolean paintWaypoint(Graphics2D g, JXMapViewer jxMapViewer, 25 | Waypoint waypoint) { 26 | Class wpClass = waypoint.getClass(); 27 | return checkNotNull(this.delegates.get(wpClass), 28 | "No painter registered for %s", wpClass).paintWaypoint(g, //$NON-NLS-1$ 29 | jxMapViewer, waypoint); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /gpx-ui/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | gpx.ui 4 | Desktop application to analyse your sport activities. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. 5 | 6 | gpx.base 7 | gpx.ui.base 8 | gpx.ui.cal 9 | gpx.ui.map 10 | gpx.ui.mapprofile 11 | gpx.ui.trackstats 12 | gpx.ui.overallstats 13 | gpx.ui.tracklist 14 | gpx.ui.trackcompare 15 | gpx.ui.lapinfo 16 | gpx.ui.importlistener 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javabuilder 21 | 22 | 23 | 24 | 25 | org.eclipse.m2e.core.maven2Builder 26 | 27 | 28 | 29 | 30 | 31 | org.eclipse.m2e.core.maven2Nature 32 | org.eclipse.jdt.core.javanature 33 | 34 | 35 | -------------------------------------------------------------------------------- /gpx-base/src/test/java/com/github/pfichtner/jrunalyser/base/data/SpeedsTest.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | import static com.github.pfichtner.jrunalyser.base.data.DistanceUnit.KILOMETERS; 4 | import static com.github.pfichtner.jrunalyser.base.data.Speeds.is; 5 | import static java.util.concurrent.TimeUnit.HOURS; 6 | import static org.junit.Assert.assertEquals; 7 | 8 | import java.util.concurrent.TimeUnit; 9 | 10 | import org.junit.Test; 11 | 12 | import com.github.pfichtner.jrunalyser.base.data.Speeds.SpeedComparator.Result; 13 | 14 | public class SpeedsTest { 15 | 16 | private static final Speed faster = new DefaultSpeed(DefaultDistance.of(10, 17 | KILOMETERS), DefaultDuration.of(1, HOURS)); 18 | private static final Speed slower = new DefaultSpeed(DefaultDistance.of(10, 19 | KILOMETERS), DefaultDuration.of(90, TimeUnit.MINUTES)); 20 | 21 | @Test 22 | public void testFasterThan() { 23 | Result r1 = is(faster).fasterThan(slower); 24 | assertEquals(1.5, r1.asMultiplicator(), 0.0); 25 | assertEquals(50, r1.inPercent()); 26 | 27 | Result r2 = is(slower).fasterThan(faster); 28 | assertEquals(0.6666666666666666, r2.asMultiplicator(), 0.0); 29 | assertEquals(-33, r2.inPercent()); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /gpx-base/src/test/java/com/github/pfichtner/jrunalyser/base/util/FixedDistanceTest.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.util; 2 | 3 | import static junit.framework.Assert.assertEquals; 4 | 5 | import java.util.concurrent.TimeUnit; 6 | 7 | import org.junit.Test; 8 | 9 | import com.github.pfichtner.jrunalyser.base.data.DefaultDistance; 10 | import com.github.pfichtner.jrunalyser.base.data.DefaultDuration; 11 | import com.github.pfichtner.jrunalyser.base.data.DistanceUnit; 12 | import com.github.pfichtner.jrunalyser.base.util.FixedDistance; 13 | 14 | public class FixedDistanceTest { 15 | 16 | @Test 17 | public void testFixedDistance() { 18 | DefaultDistance di = DefaultDistance.of(600, DistanceUnit.METERS); 19 | DefaultDuration du = DefaultDuration.of(3, TimeUnit.MINUTES); 20 | // when doing 600 meters within 3 minutes, how long does it take to do 21 | // 800 meters? 22 | FixedDistance fixedDistance = new FixedDistance(DefaultDistance.of(800, 23 | DistanceUnit.METERS)); 24 | assertEquals(DefaultDuration.of(4, TimeUnit.MINUTES), 25 | fixedDistance.getDuration(di, du)); 26 | assertEquals(DefaultDuration.of(240, TimeUnit.SECONDS), 27 | fixedDistance.getDuration(di, du.convertTo(TimeUnit.SECONDS))); 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /gpx-base/src/test/java/com/github/pfichtner/jrunalyser/base/util/FixedDurationTest.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.util; 2 | 3 | import static junit.framework.Assert.assertEquals; 4 | 5 | import java.util.concurrent.TimeUnit; 6 | 7 | import org.junit.Test; 8 | 9 | import com.github.pfichtner.jrunalyser.base.data.DefaultDistance; 10 | import com.github.pfichtner.jrunalyser.base.data.DefaultDuration; 11 | import com.github.pfichtner.jrunalyser.base.data.DistanceUnit; 12 | import com.github.pfichtner.jrunalyser.base.util.FixedDuration; 13 | 14 | public class FixedDurationTest { 15 | 16 | @Test 17 | public void testFixedDuration() { 18 | DefaultDistance di = DefaultDistance.of(90, DistanceUnit.METERS); 19 | DefaultDuration du = DefaultDuration.of(30, TimeUnit.MINUTES); 20 | // when doing 90 meters within 30 minutes, how many meters do you do 21 | // within one hour? 22 | FixedDuration fixedDistance = new FixedDuration(DefaultDuration.of(1, 23 | TimeUnit.HOURS)); 24 | assertEquals(DefaultDistance.of(180, DistanceUnit.METERS), 25 | fixedDistance.getDistance(di, du)); 26 | assertEquals(DefaultDistance.of(590.57064, DistanceUnit.FEET), 27 | fixedDistance.getDistance(di.convertTo(DistanceUnit.FEET), du)); 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/base/i18n/I18N.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.base.i18n; 2 | 3 | import org.jdesktop.application.ResourceMap; 4 | 5 | import com.dteoh.treasuremap.ResourceMaps; 6 | 7 | public class I18N { 8 | 9 | public static class Builder { 10 | 11 | private ResourceMaps resourceMaps; 12 | 13 | public Builder(Class clazz) { 14 | this.resourceMaps = new ResourceMaps(clazz); 15 | } 16 | 17 | public Builder withParent(I18N parent) { 18 | this.resourceMaps.withParent(parent.resourceMap); 19 | return this; 20 | } 21 | 22 | public I18N build() { 23 | return new I18N(this.resourceMaps.build()); 24 | } 25 | 26 | } 27 | 28 | private final ResourceMap resourceMap; 29 | 30 | private I18N(ResourceMap resourceMap) { 31 | this.resourceMap = resourceMap; 32 | } 33 | 34 | public String getText(String key, Object... args) { 35 | return this.resourceMap.getString(key, args); 36 | } 37 | 38 | public String getText(Enum enumType, Object type) { 39 | return getText(enumType.getDeclaringClass().getName() + '.' 40 | + enumType.name() + '$' + type); 41 | } 42 | 43 | public static Builder builder(Class clazz) { 44 | return new Builder(clazz); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/painter/OffsetWaypointRendererDelegate.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.painter; 2 | 3 | import java.awt.Graphics2D; 4 | 5 | import org.jdesktop.swingx.JXMapViewer; 6 | import org.jdesktop.swingx.mapviewer.Waypoint; 7 | import org.jdesktop.swingx.mapviewer.WaypointRenderer; 8 | 9 | import com.github.pfichtner.jrunalyser.base.Delegate; 10 | 11 | public class OffsetWaypointRendererDelegate implements WaypointRenderer, 12 | Delegate { 13 | 14 | private final WaypointRenderer delegate; 15 | private final int xoffset; 16 | private final int yoffset; 17 | 18 | @Override 19 | public WaypointRenderer getDelegate() { 20 | return this.delegate; 21 | } 22 | 23 | public OffsetWaypointRendererDelegate(int xoffset, int yoffset, 24 | WaypointRenderer delegate) { 25 | this.xoffset = xoffset; 26 | this.yoffset = yoffset; 27 | this.delegate = delegate; 28 | } 29 | 30 | @Override 31 | public boolean paintWaypoint(Graphics2D g, JXMapViewer mapViewer, 32 | Waypoint waypoint) { 33 | g.translate(this.xoffset, this.yoffset); 34 | boolean result = this.delegate.paintWaypoint(g, mapViewer, waypoint); 35 | g.translate(-this.xoffset, -this.yoffset); 36 | return result; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /gpx-ui-cal/src/main/java/com/github/pfichtner/jrunalyser/ui/cal/swing/model/DefaultCalendarEntry.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.cal.swing.model; 2 | 3 | import java.util.Date; 4 | 5 | import javax.swing.Icon; 6 | 7 | public class DefaultCalendarEntry implements CalendarEntry { 8 | 9 | private String description; 10 | 11 | private Date startDate, endDate; 12 | 13 | private Icon icon; 14 | 15 | private Object userObject; 16 | 17 | public String getDescription() { 18 | return this.description; 19 | } 20 | 21 | public Date getEndDate() { 22 | return this.endDate; 23 | } 24 | 25 | public Icon getIcon() { 26 | return this.icon; 27 | } 28 | 29 | public Date getStartDate() { 30 | return this.startDate; 31 | } 32 | 33 | public Object getUserObject() { 34 | return this.userObject; 35 | } 36 | 37 | public void setDescription(String description) { 38 | this.description = description; 39 | } 40 | 41 | public void setEndDate(Date endDate) { 42 | this.endDate = endDate; 43 | } 44 | 45 | public void setIcon(Icon icon) { 46 | this.icon = icon; 47 | } 48 | 49 | public void setStartDate(Date startDate) { 50 | this.startDate = startDate; 51 | } 52 | 53 | public void setUserObject(Object userObject) { 54 | this.userObject = userObject; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /gpx-ui-mapprofile/src/main/java/com/github/pfichtner/jrunalyser/ui/mapprofile/config/DatasetConfigDelegate.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.mapprofile.config; 2 | 3 | import org.jfree.chart.axis.NumberAxis; 4 | import org.jfree.chart.renderer.xy.XYItemRenderer; 5 | import org.jfree.data.xy.XYDataset; 6 | 7 | import com.github.pfichtner.jrunalyser.base.data.LinkedTrackPoint; 8 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 9 | import com.google.common.base.Function; 10 | 11 | public class DatasetConfigDelegate implements DatasetConfig { 12 | 13 | private final DatasetConfig delegate; 14 | 15 | public DatasetConfigDelegate(DatasetConfig delegate) { 16 | this.delegate = delegate; 17 | } 18 | 19 | public int getIndex() { 20 | return this.delegate.getIndex(); 21 | } 22 | 23 | public String getDescription() { 24 | return this.delegate.getDescription(); 25 | } 26 | 27 | public XYItemRenderer getRenderer() { 28 | return this.delegate.getRenderer(); 29 | } 30 | 31 | public NumberAxis createNumberAxis(Track track) { 32 | return this.delegate.createNumberAxis(track); 33 | } 34 | 35 | public XYDataset createDataset(Track track, 36 | Function xFunc) { 37 | return this.delegate.createDataset(track, xFunc); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/base/components/LoadTrackMouseListener.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.base.components; 2 | 3 | import java.awt.Component; 4 | import java.awt.Cursor; 5 | import java.awt.event.MouseAdapter; 6 | import java.awt.event.MouseEvent; 7 | 8 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 9 | import com.github.pfichtner.jrunalyser.ui.dock.ebus.TrackLoaded; 10 | import com.google.common.eventbus.EventBus; 11 | 12 | public class LoadTrackMouseListener extends MouseAdapter { 13 | 14 | private final Track track; 15 | 16 | private final EventBus eventBus; 17 | 18 | private Cursor oldPointer; 19 | 20 | public LoadTrackMouseListener(Track track, EventBus eventBus) { 21 | this.track = track; 22 | this.eventBus = eventBus; 23 | } 24 | 25 | @Override 26 | public void mouseEntered(MouseEvent e) { 27 | this.oldPointer = ((Component) e.getSource()).getCursor(); 28 | ((Component) e.getSource()) 29 | .setCursor(new Cursor(Cursor.HAND_CURSOR)); 30 | } 31 | 32 | @Override 33 | public void mouseClicked(MouseEvent e) { 34 | this.eventBus.post(new TrackLoaded(this.track)); 35 | } 36 | 37 | @Override 38 | public void mouseExited(MouseEvent e) { 39 | ((Component) e.getSource()).setCursor(this.oldPointer); 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /gpx-ui/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /gpx-ui-base/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/di/Injector.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.di; 2 | 3 | import java.beans.IntrospectionException; 4 | import java.beans.Introspector; 5 | import java.beans.PropertyDescriptor; 6 | import java.lang.reflect.InvocationTargetException; 7 | import java.lang.reflect.Method; 8 | 9 | import com.google.common.base.Throwables; 10 | 11 | public final class Injector { 12 | 13 | private Injector() { 14 | super(); 15 | } 16 | 17 | // poor man's @Inject ;-) 18 | public static T inject(final T instance, Class clazz, S toInject) { 19 | try { 20 | for (PropertyDescriptor pd : Introspector.getBeanInfo( 21 | instance.getClass()).getPropertyDescriptors()) { 22 | Method wm = pd.getWriteMethod(); 23 | if (wm != null && wm.isAnnotationPresent(Inject.class) 24 | && pd.getPropertyType().equals(clazz)) { 25 | wm.invoke(instance, toInject); 26 | } 27 | } 28 | } catch (IntrospectionException e) { 29 | throw Throwables.propagate(e); 30 | } catch (IllegalArgumentException e) { 31 | throw Throwables.propagate(e); 32 | } catch (IllegalAccessException e) { 33 | throw Throwables.propagate(e); 34 | } catch (InvocationTargetException e) { 35 | throw Throwables.propagate(e); 36 | } 37 | return instance; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /gpx-ui-cal/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /gpx-ui-map/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /gpx-ui-lapinfo/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/painter/OffsetPainterDelegate.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.painter; 2 | 3 | import java.awt.Graphics2D; 4 | 5 | import org.jdesktop.swingx.JXMapViewer; 6 | import org.jdesktop.swingx.painter.Painter; 7 | 8 | import com.github.pfichtner.jrunalyser.base.Delegate; 9 | 10 | /** 11 | * Class that implements {@link Painter} that delegates to the passed Painter 12 | * but let it draw with the offset passed. 13 | * 14 | * @author Peter Fichtner 15 | */ 16 | public class OffsetPainterDelegate implements Painter, 17 | Delegate> { 18 | 19 | private final Painter delegate; 20 | private final int xOffset; 21 | private final int yOffset; 22 | 23 | public OffsetPainterDelegate(Painter delegate, int xOffset, 24 | int yOffset) { 25 | this.delegate = delegate; 26 | this.xOffset = xOffset; 27 | this.yOffset = yOffset; 28 | } 29 | 30 | @Override 31 | public Painter getDelegate() { 32 | return this.delegate; 33 | } 34 | 35 | @Override 36 | public void paint(Graphics2D g, JXMapViewer viewer, int x, int y) { 37 | g.translate(this.xOffset, this.yOffset); 38 | this.delegate.paint(g, viewer, x, y); 39 | g.translate(-this.xOffset, -this.yOffset); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /gpx-ui-tracklist/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /gpx-ui-overallstats/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /gpx-ui-segmentstats/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /gpx-ui-trackcompare/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /gpx-ui-trackstats/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/theme/DefaultTheme.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.theme; 2 | 3 | import java.awt.Color; 4 | 5 | public class DefaultTheme implements Theme { 6 | 7 | private final Color bgColor; 8 | private final Color fgColor; 9 | private final Color hlColor; 10 | 11 | private DefaultTheme(Builder builder) { 12 | this.bgColor = builder.bgColor; 13 | this.fgColor = builder.fgColor; 14 | this.hlColor = builder.hlColor; 15 | } 16 | 17 | public Color getBgColor() { 18 | return this.bgColor; 19 | } 20 | 21 | public Color getFgColor() { 22 | return this.fgColor; 23 | } 24 | 25 | public Color getHlColor() { 26 | return this.hlColor; 27 | } 28 | 29 | public static class Builder { 30 | 31 | private Color bgColor = Color.ORANGE; 32 | private Color fgColor = Color.BLACK; 33 | private Color hlColor = Color.GREEN; 34 | 35 | public Theme build() { 36 | return new DefaultTheme(this); 37 | } 38 | 39 | public Builder bgColor(Color bgColor) { 40 | this.bgColor = bgColor; 41 | return this; 42 | } 43 | 44 | public Builder fgColor(Color fgColor) { 45 | this.fgColor = fgColor; 46 | return this; 47 | } 48 | 49 | public Builder hlColor(Color hlColor) { 50 | this.hlColor = hlColor; 51 | return this; 52 | } 53 | 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/util/Primitives.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.util; 2 | 3 | import com.google.common.base.Predicate; 4 | 5 | public final class Primitives { 6 | 7 | private Primitives() { 8 | super(); 9 | } 10 | 11 | public static int sum(int[] array) { 12 | int result = 0; 13 | for (int i : array) { 14 | result += i; 15 | } 16 | return result; 17 | } 18 | 19 | public static int avg(int[] ints) { 20 | return sum(ints) / ints.length; 21 | } 22 | 23 | // ----------------------------------------------------- 24 | 25 | public static double sum(double[] doubles) { 26 | double result = 0; 27 | for (double d : doubles) { 28 | result += d; 29 | } 30 | return result; 31 | } 32 | 33 | public static double sum(double[] doubles, Predicate predicate) { 34 | double sum = 0; 35 | double prev = Double.NaN; 36 | for (double number : doubles) { 37 | if (!Double.isNaN(prev)) { 38 | double diff = number - prev; 39 | if (predicate.apply(Double.valueOf(diff))) { 40 | sum += diff; 41 | } 42 | } 43 | prev = number; 44 | } 45 | return sum; 46 | } 47 | 48 | public static double avg(double[] doubles) { 49 | return sum(doubles) / doubles.length; 50 | } 51 | 52 | // ----------------------------------------------------- 53 | 54 | } 55 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/DefaultLinkedWayPoint.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | import java.io.Serializable; 4 | 5 | public class DefaultLinkedWayPoint implements LinkedTrackPoint, Serializable { 6 | 7 | private static final long serialVersionUID = -1565017996348212247L; 8 | 9 | private final WayPoint delegate; 10 | private final Link link; 11 | 12 | private DefaultLinkedWayPoint(WayPoint wayPoint, Link link) { 13 | this.delegate = wayPoint; 14 | this.link = link; 15 | } 16 | 17 | public static DefaultLinkedWayPoint of(WayPoint wayPoint, Link link) { 18 | return new DefaultLinkedWayPoint(wayPoint, link); 19 | } 20 | 21 | @Override 22 | public String getName() { 23 | return this.delegate.getName(); 24 | } 25 | 26 | public double getLatitude() { 27 | return this.delegate.getLatitude(); 28 | } 29 | 30 | public double getLongitude() { 31 | return this.delegate.getLongitude(); 32 | } 33 | 34 | public Integer getElevation() { 35 | return this.delegate.getElevation(); 36 | } 37 | 38 | public Long getTime() { 39 | return this.delegate.getTime(); 40 | } 41 | 42 | public Link getLink() { 43 | return this.link; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return "DefaultLinkedWayPoint [delegate=" + this.delegate + ", link=" 49 | + this.link + "]"; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/util/MovingAverage.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.util; 2 | 3 | import static com.google.common.base.Preconditions.checkArgument; 4 | 5 | import javax.annotation.Nonnegative; 6 | import javax.annotation.concurrent.NotThreadSafe; 7 | 8 | @NotThreadSafe 9 | public class MovingAverage { 10 | 11 | private final int period; 12 | private int pos; 13 | private double[] window = new double[0]; 14 | private double sum; 15 | 16 | public MovingAverage(@Nonnegative int period) { 17 | this.period = period; 18 | checkArgument(period > 0, "Period must be a positive integer"); 19 | } 20 | 21 | public double add(double num) { 22 | boolean resizeNeeded = this.pos >= this.window.length 23 | && this.pos < this.period; 24 | this.sum += num; // add new value 25 | if (resizeNeeded) { 26 | resize(); 27 | } else { 28 | this.sum -= this.window[this.pos]; // subtract old value 29 | } 30 | this.window[this.pos] = num; 31 | if (++this.pos == this.period) { 32 | this.pos = 0; 33 | } 34 | return getValue(); 35 | } 36 | 37 | public double getValue() { 38 | return this.sum / this.window.length; 39 | } 40 | 41 | private void resize() { 42 | double[] tmp = new double[this.window.length + 1]; 43 | System.arraycopy(this.window, 0, tmp, 0, this.window.length); 44 | this.window = tmp; 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/util/format/LatLonFormatter.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.util.format; 2 | 3 | import java.text.DecimalFormatSymbols; 4 | import java.util.Locale; 5 | 6 | import com.github.pfichtner.jrunalyser.base.data.Coordinate; 7 | 8 | public class LatLonFormatter { 9 | 10 | // http://www.cachewiki.de/wiki/Koordinaten 11 | 12 | public static final LatLonFormatter instance = new LatLonFormatter(); 13 | 14 | private final LatitudeFormatter latitudeFormatter; 15 | private final LongitudeFormatter longitudeFormatter; 16 | 17 | public LatLonFormatter() { 18 | this(Locale.getDefault()); 19 | } 20 | 21 | public LatLonFormatter(Locale locale) { 22 | this(new LatitudeFormatter(new DecimalFormatSymbols(locale)), 23 | new LongitudeFormatter(new DecimalFormatSymbols(locale))); 24 | } 25 | 26 | public LatLonFormatter(LatitudeFormatter latitudeFormatter, 27 | LongitudeFormatter longitudeFormatter) { 28 | this.latitudeFormatter = latitudeFormatter; 29 | this.longitudeFormatter = longitudeFormatter; 30 | } 31 | 32 | public String format(Coordinate coordinate) { 33 | return format(coordinate.getLatitude(), coordinate.getLongitude()); 34 | } 35 | 36 | public String format(double lat, double lng) { 37 | return this.latitudeFormatter.format(lat) + ' ' 38 | + this.longitudeFormatter.format(lng); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/base/ImperialSettings.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.base; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import com.github.pfichtner.jrunalyser.base.data.DistanceUnit; 6 | 7 | public final class ImperialSettings implements Settings { 8 | 9 | public static final Settings INSTANCE = new ImperialSettings(); 10 | private static final SpeedUnit MI_PER_H = new SpeedUnit() { 11 | 12 | @Override 13 | public TimeUnit getTimeUnit() { 14 | return TimeUnit.HOURS; 15 | } 16 | 17 | @Override 18 | public DistanceUnit getDistanceUnit() { 19 | return DistanceUnit.MILES; 20 | } 21 | }; 22 | private static final PaceUnit MI_PER_MIN = new PaceUnit() { 23 | 24 | @Override 25 | public TimeUnit getTimeUnit() { 26 | return TimeUnit.MINUTES; 27 | } 28 | 29 | @Override 30 | public DistanceUnit getDistanceUnit() { 31 | return DistanceUnit.MILES; 32 | } 33 | }; 34 | 35 | private ImperialSettings() { 36 | super(); 37 | } 38 | 39 | @Override 40 | public SpeedUnit getSpeedUnit() { 41 | return MI_PER_H; 42 | } 43 | 44 | @Override 45 | public PaceUnit getPaceUnit() { 46 | return MI_PER_MIN; 47 | } 48 | 49 | @Override 50 | public DistanceUnit getDistanceUnit() { 51 | return DistanceUnit.MILES; 52 | } 53 | 54 | @Override 55 | public TimeUnit getTimeUnit() { 56 | return TimeUnit.MINUTES; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/base/components/SegmentTrackMouseListener.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.base.components; 2 | 3 | import java.awt.Component; 4 | import java.awt.Cursor; 5 | import java.awt.event.MouseAdapter; 6 | import java.awt.event.MouseEvent; 7 | 8 | import com.github.pfichtner.jrunalyser.base.data.SegmentationUnit; 9 | import com.github.pfichtner.jrunalyser.ui.dock.ebus.HighlightSegmentMessage; 10 | import com.google.common.eventbus.EventBus; 11 | 12 | public class SegmentTrackMouseListener extends MouseAdapter { 13 | 14 | private final SegmentationUnit segmentationUnit; 15 | 16 | private final EventBus eventBus; 17 | 18 | private Cursor oldPointer; 19 | 20 | public SegmentTrackMouseListener(SegmentationUnit segmentationUnit, 21 | EventBus eventBus) { 22 | this.segmentationUnit = segmentationUnit; 23 | this.eventBus = eventBus; 24 | } 25 | 26 | @Override 27 | public void mouseEntered(MouseEvent e) { 28 | this.oldPointer = ((Component) e.getSource()).getCursor(); 29 | ((Component) e.getSource()).setCursor(new Cursor(Cursor.HAND_CURSOR)); 30 | } 31 | 32 | @Override 33 | public void mouseClicked(MouseEvent e) { 34 | this.eventBus.post(new HighlightSegmentMessage(this.segmentationUnit)); 35 | } 36 | 37 | @Override 38 | public void mouseExited(MouseEvent e) { 39 | ((Component) e.getSource()).setCursor(this.oldPointer); 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/base/MetricSettings.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.base; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import com.github.pfichtner.jrunalyser.base.data.DistanceUnit; 6 | 7 | public final class MetricSettings implements Settings { 8 | 9 | public static final Settings INSTANCE = new MetricSettings(); 10 | private static final SpeedUnit KM_PER_H = new SpeedUnit() { 11 | 12 | @Override 13 | public TimeUnit getTimeUnit() { 14 | return TimeUnit.HOURS; 15 | } 16 | 17 | @Override 18 | public DistanceUnit getDistanceUnit() { 19 | return DistanceUnit.KILOMETERS; 20 | } 21 | }; 22 | private static final PaceUnit MIN_PER_KM = new PaceUnit() { 23 | 24 | @Override 25 | public TimeUnit getTimeUnit() { 26 | return TimeUnit.MINUTES; 27 | } 28 | 29 | @Override 30 | public DistanceUnit getDistanceUnit() { 31 | return DistanceUnit.KILOMETERS; 32 | } 33 | }; 34 | 35 | private MetricSettings() { 36 | super(); 37 | } 38 | 39 | @Override 40 | public SpeedUnit getSpeedUnit() { 41 | return KM_PER_H; 42 | } 43 | 44 | @Override 45 | public PaceUnit getPaceUnit() { 46 | return MIN_PER_KM; 47 | } 48 | 49 | @Override 50 | public DistanceUnit getDistanceUnit() { 51 | return DistanceUnit.KILOMETERS; 52 | } 53 | 54 | @Override 55 | public TimeUnit getTimeUnit() { 56 | return TimeUnit.MINUTES; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/comparator/RelDiffNumberComparator.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.comparator; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.Comparator; 5 | 6 | public class RelDiffNumberComparator implements Comparator { 7 | 8 | private static final BigDecimal ONE_HUNDRED = new BigDecimal(100); 9 | 10 | private final BigDecimal maxDiff; 11 | 12 | public RelDiffNumberComparator(int i) { 13 | this(new BigDecimal(i)); 14 | } 15 | 16 | public RelDiffNumberComparator(BigDecimal maxDiff) { 17 | this.maxDiff = maxDiff; 18 | } 19 | 20 | @Override 21 | public int compare(Number o1, Number o2) { 22 | 23 | BigDecimal diff = new BigDecimal(String.valueOf(o1)) 24 | .subtract(new BigDecimal(String.valueOf(o2))); 25 | if (diff.signum() == 0) { 26 | return 0; 27 | } 28 | 29 | BigDecimal bd1 = new BigDecimal(String.valueOf(o1)); 30 | BigDecimal bd2 = new BigDecimal(String.valueOf(o2)); 31 | 32 | BigDecimal greater = bd1.abs().compareTo(bd2.abs()) > 0 ? bd1 : bd2; 33 | 34 | if (greater.signum() != 0) { 35 | BigDecimal relDiff = diff.multiply(ONE_HUNDRED).divide(greater, 2, 36 | BigDecimal.ROUND_HALF_UP); 37 | if (relDiff.abs().compareTo(this.maxDiff) <= 0) 38 | return 0; 39 | } 40 | return bd1.compareTo(bd2); 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return "RelDiffNumberComparator [maxDiff=" + this.maxDiff + "]"; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/segmenter/Segmenter.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.segmenter; 2 | 3 | import java.util.List; 4 | 5 | import com.github.pfichtner.jrunalyser.base.data.LinkedTrackPoint; 6 | import com.github.pfichtner.jrunalyser.base.data.segment.DefaultSegment; 7 | import com.github.pfichtner.jrunalyser.base.data.segment.Segment; 8 | import com.github.pfichtner.jrunalyser.base.data.stat.DefaultStatistics; 9 | import com.github.pfichtner.jrunalyser.base.data.track.DefaultTrack; 10 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 11 | import com.google.common.collect.ImmutableList; 12 | import com.google.common.collect.Lists; 13 | 14 | public interface Segmenter { 15 | 16 | Segmenter NULL_SEGMENTER = new Segmenter() { 17 | @Override 18 | public Track segment(Track track) { 19 | return track.getSegments().size() <= 1 ? track 20 | : combineSegments(track); 21 | } 22 | 23 | private Track combineSegments(Track track) { 24 | List trkpts = Lists.newArrayList(); 25 | for (Segment segment : track.getSegments()) { 26 | trkpts.addAll(segment.getTrackpoints()); 27 | } 28 | return new DefaultTrack(track.getId(), track.getMetadata(), 29 | track.getWaypoints(), ImmutableList.of(new DefaultSegment( 30 | trkpts, DefaultStatistics.ofWaypoints(trkpts))), 31 | track.getStatistics()); 32 | } 33 | }; 34 | 35 | Track segment(Track track); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /gpx-base/src/test/java/com/github/pfichtner/jrunalyser/base/data/DefaultDurationTest.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.util.Arrays; 6 | import java.util.Collections; 7 | import java.util.List; 8 | import java.util.concurrent.TimeUnit; 9 | 10 | import org.junit.Test; 11 | 12 | import com.github.pfichtner.jrunalyser.base.data.DefaultDuration; 13 | import com.github.pfichtner.jrunalyser.base.data.Duration; 14 | import com.google.common.collect.Lists; 15 | 16 | public class DefaultDurationTest { 17 | 18 | @Test 19 | public void testComprable() { 20 | Duration a = DefaultDuration.of(5, TimeUnit.MINUTES); 21 | Duration b = DefaultDuration.of(1, TimeUnit.HOURS); 22 | Duration c = DefaultDuration.of(65, TimeUnit.MINUTES); 23 | Duration d = DefaultDuration.of(2, TimeUnit.MINUTES); 24 | Duration e = DefaultDuration.of(190, TimeUnit.SECONDS); 25 | 26 | List list = Lists.newArrayList(Arrays.asList(a, b, c, d, e)); 27 | Collections.sort(list); 28 | 29 | assertEquals(Arrays.asList(d, e, a, b, c), list); 30 | } 31 | 32 | @Test 33 | public void testAdd() { 34 | Duration d1 = DefaultDuration.of(1, TimeUnit.SECONDS); 35 | Duration d2 = DefaultDuration.of(1, TimeUnit.MINUTES); 36 | assertEquals(DefaultDuration.of(61, TimeUnit.SECONDS), d1.add(d2)); 37 | assertEquals(DefaultDuration.of(1.0166666666666666, TimeUnit.MINUTES), 38 | d2.add(d1)); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /gpx-base/src/test/java/com/github/pfichtner/jrunalyser/base/data/track/comparator/RelDiffNumberComparatorTest.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.track.comparator; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertTrue; 5 | 6 | import org.junit.Test; 7 | 8 | import com.github.pfichtner.jrunalyser.base.comparator.RelDiffNumberComparator; 9 | 10 | public class RelDiffNumberComparatorTest { 11 | 12 | @Test 13 | public void testEqual() { 14 | RelDiffNumberComparator ten = new RelDiffNumberComparator(10); 15 | assertEquals(0, ten.compare(Integer.valueOf(0), Integer.valueOf(0))); 16 | assertEquals(0, ten.compare(Integer.valueOf(100), Integer.valueOf(90))); 17 | assertEquals(0, ten.compare(Integer.valueOf(90), Integer.valueOf(100))); 18 | } 19 | 20 | @Test 21 | public void testNotEqual() { 22 | RelDiffNumberComparator ten = new RelDiffNumberComparator(10); 23 | 24 | assertPositive(ten.compare(Integer.valueOf(1), Integer.valueOf(0))); 25 | assertNegative(ten.compare(Integer.valueOf(0), Integer.valueOf(1))); 26 | 27 | assertPositive(ten.compare(Integer.valueOf(100), Integer.valueOf(89))); 28 | assertNegative(ten.compare(Integer.valueOf(89), Integer.valueOf(100))); 29 | 30 | } 31 | 32 | private void assertPositive(int value) { 33 | assertTrue(String.valueOf(value), value > 0); 34 | } 35 | 36 | private void assertNegative(int value) { 37 | assertTrue(String.valueOf(value), value < 0); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /gpx-base/src/test/java/com/github/pfichtner/jrunalyser/base/data/track/comparator/AbsDiffNumberComparatorTest.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.track.comparator; 2 | 3 | import static org.junit.Assert.*; 4 | 5 | import org.junit.Test; 6 | 7 | import com.github.pfichtner.jrunalyser.base.comparator.AbsDiffNumberComparator; 8 | 9 | public class AbsDiffNumberComparatorTest { 10 | 11 | @Test 12 | public void testEqual() { 13 | AbsDiffNumberComparator one = new AbsDiffNumberComparator(1); 14 | 15 | assertEquals(0, one.compare(Integer.valueOf(0), Integer.valueOf(0))); 16 | assertEquals(0, one.compare(Integer.valueOf(1), Integer.valueOf(0))); 17 | assertEquals(0, one.compare(Integer.valueOf(0), Integer.valueOf(1))); 18 | 19 | assertEquals(0, one.compare(Double.valueOf(0), Double.valueOf(0))); 20 | assertEquals(0, one.compare(Double.valueOf(1), Double.valueOf(0))); 21 | assertEquals(0, one.compare(Double.valueOf(0), Double.valueOf(1))); 22 | 23 | assertEquals(0, one.compare(Integer.valueOf(0), Double.valueOf(0))); 24 | assertEquals(0, one.compare(Double.valueOf(1), Integer.valueOf(0))); 25 | assertEquals(0, one.compare(Integer.valueOf(0), Double.valueOf(1))); 26 | } 27 | 28 | @Test 29 | public void testNotEqual() { 30 | AbsDiffNumberComparator one = new AbsDiffNumberComparator(1); 31 | 32 | assertTrue(one.compare(Integer.valueOf(2), Integer.valueOf(0)) > 0); 33 | assertTrue(one.compare(Integer.valueOf(0), Integer.valueOf(2)) < 0); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /gpx-ui-cal/src/main/java/com/github/pfichtner/jrunalyser/ui/cal/swing/model/AbstractCalenderModel.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.cal.swing.model; 2 | 3 | import java.util.Date; 4 | 5 | import javax.swing.event.EventListenerList; 6 | 7 | public abstract class AbstractCalenderModel implements CalenderModel { 8 | 9 | private final EventListenerList listenerList = new EventListenerList(); 10 | 11 | // ----------------------------------------------------------------- 12 | 13 | public void addModelListener(CalendarModelListener l) { 14 | this.listenerList.add(CalendarModelListener.class, l); 15 | } 16 | 17 | public void removeModelListener(CalendarModelListener l) { 18 | this.listenerList.remove(CalendarModelListener.class, l); 19 | } 20 | 21 | // ----------------------------------------------------------------- 22 | 23 | public void fireElementsInserted(Date startDate, Date endDate) { 24 | fireTableChanged(new CalendarModelEvent( 25 | CalendarModelEvent.Type.INSERTED, startDate, endDate)); 26 | } 27 | 28 | public void fireTableChanged(CalendarModelEvent e) { 29 | // Guaranteed to return a non-null array 30 | Object[] listeners = this.listenerList.getListenerList(); 31 | // Process the listeners last to first, notifying 32 | // those that are interested in this event 33 | for (int i = listeners.length - 2; i >= 0; i -= 2) { 34 | if (listeners[i] == CalendarModelListener.class) { 35 | ((CalendarModelListener) listeners[i + 1]).modelChanged(e); 36 | } 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /gpx-base/src/test/java/com/github/pfichtner/jrunalyser/base/DelegatesTest.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertSame; 5 | 6 | import org.junit.Test; 7 | 8 | import com.github.pfichtner.jrunalyser.base.Delegate; 9 | import com.github.pfichtner.jrunalyser.base.Delegates; 10 | 11 | public class DelegatesTest { 12 | 13 | private static class Bar { 14 | 15 | private String value; 16 | 17 | public void setValue(String value) { 18 | this.value = value; 19 | } 20 | 21 | public String getValue() { 22 | return this.value; 23 | } 24 | 25 | } 26 | 27 | private static class Foo extends Bar { 28 | // 29 | } 30 | 31 | private static class TestDelegate extends Bar implements Delegate { 32 | 33 | private final Bar delegate; 34 | 35 | public TestDelegate(Bar delegate) { 36 | this.delegate = delegate; 37 | } 38 | 39 | @Override 40 | public Bar getDelegate() { 41 | return this.delegate; 42 | } 43 | } 44 | 45 | @Test 46 | public void testNoDelegate() { 47 | String s = "foo"; 48 | assertSame(s, Delegates.getRoot(s, String.class)); 49 | } 50 | 51 | @Test 52 | public void testChained() { 53 | Bar bar = new Foo(); 54 | bar.setValue("foo"); 55 | assertSame("foo", Delegates.getRoot(new TestDelegate(bar), Bar.class) 56 | .getValue()); 57 | 58 | Bar chain = new TestDelegate(new TestDelegate(new TestDelegate( 59 | new TestDelegate(new TestDelegate(bar))))); 60 | assertEquals("foo", Delegates.getRoot(chain, Bar.class).getValue()); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /gpx-ui-segmentstats/src/main/java/com/github/pfichtner/jrunalyser/ui/segmentstat/SegmentStatsPlugin.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.segmentstat; 2 | 3 | import javax.swing.JPanel; 4 | 5 | import com.github.pfichtner.jrunalyser.base.datasource.DatasourceFascade; 6 | import com.github.pfichtner.jrunalyser.di.Inject; 7 | import com.github.pfichtner.jrunalyser.ui.base.AbstractUiPlugin; 8 | import com.github.pfichtner.jrunalyser.ui.base.DefaultGridData; 9 | import com.github.pfichtner.jrunalyser.ui.base.GridData; 10 | import com.github.pfichtner.jrunalyser.ui.base.GridDataProvider; 11 | import com.github.pfichtner.jrunalyser.ui.dock.ebus.SegmentSelectedMessage; 12 | import com.google.common.eventbus.Subscribe; 13 | 14 | public class SegmentStatsPlugin extends AbstractUiPlugin implements 15 | GridDataProvider { 16 | 17 | private static final GridData gridData = new DefaultGridData(0, 1, 1, 3); 18 | 19 | private SegmentStatsPanel panel; 20 | 21 | public SegmentStatsPlugin() { 22 | this.panel = new SegmentStatsPanel(); 23 | } 24 | 25 | @Override 26 | public String getTitle() { 27 | return "Segment Statistik"; 28 | } 29 | 30 | @Override 31 | public JPanel getPanel() { 32 | return this.panel; 33 | } 34 | 35 | @Override 36 | public GridData getGridData() { 37 | return gridData; 38 | } 39 | 40 | @Inject 41 | public void setDatasourceFascade(DatasourceFascade dsf) { 42 | this.panel.setDatasourceFascade(dsf); 43 | } 44 | 45 | @Subscribe 46 | public void setActiveSegment(SegmentSelectedMessage message) { 47 | this.panel.setActiveSegment(message); 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /gpx-base/src/test/java/com/github/pfichtner/jrunalyser/base/util/MovingAverageIteratorTest.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.util; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.util.List; 6 | 7 | import org.junit.Test; 8 | 9 | import com.github.pfichtner.jrunalyser.base.util.MovingAverageIterator; 10 | import com.google.common.collect.Lists; 11 | import com.google.common.primitives.Doubles; 12 | 13 | public class MovingAverageIteratorTest { 14 | 15 | @Test 16 | public void testX() { 17 | List in = Doubles.asList(1, 2, 2, 3, 9, 1, 2); 18 | check(1, in, in); 19 | check(2, Doubles.asList(1, 1.5, 2, 2.5, 6, 5, 1.5), in); 20 | check(3, Doubles.asList(1, 1.5, 1.6666666666666667, 2.3333333333333335, 21 | 4.666666666666667, 4.333333333333333, 4), in); 22 | check(4, 23 | Doubles.asList(1.0, 1.5, 1.6666666666666667, 2, 4, 3.75, 3.75), 24 | in); 25 | check(5, Doubles.asList(1.0, 1.5, 1.6666666666666667, 2.0, 3.4, 3.4, 26 | 3.4), in); 27 | check(6, Doubles.asList(1.0, 1.5, 1.6666666666666667, 2.0, 3.4, 3.0, 28 | 3.1666666666666665), in); 29 | check(7, Doubles.asList(1.0, 1.5, 1.6666666666666667, 2.0, 3.4, 3.0, 30 | 2.857142857142857), in); 31 | 32 | for (int i = 8; i < 20; i++) { 33 | check(i, Doubles.asList(1.0, 1.5, 1.6666666666666667, 2.0, 3.4, 34 | 3.0, 2.857142857142857), in); 35 | } 36 | } 37 | 38 | private static void check(int period, List expected, 39 | List values) { 40 | assertEquals(expected, Lists.newArrayList(new MovingAverageIterator( 41 | values.iterator(), period))); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/format/DurationFormatter.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.format; 2 | 3 | import static com.github.pfichtner.durationformatter.DurationFormatter.SuppressZeros.LEADING; 4 | import static com.github.pfichtner.durationformatter.DurationFormatter.SuppressZeros.MIDDLE; 5 | import static com.github.pfichtner.durationformatter.DurationFormatter.SuppressZeros.TRAILING; 6 | 7 | import java.util.concurrent.TimeUnit; 8 | 9 | import com.github.pfichtner.jrunalyser.base.data.Duration; 10 | 11 | public class DurationFormatter { 12 | 13 | public enum Type { 14 | SHORT_SYMBOLS, SHORT, MEDIUM_SYMBOLS; 15 | } 16 | 17 | private final com.github.pfichtner.durationformatter.DurationFormatter df; 18 | 19 | public DurationFormatter(Type type) { 20 | switch (type) { 21 | case SHORT_SYMBOLS: 22 | this.df = com.github.pfichtner.durationformatter.DurationFormatter.Builder.SYMBOLS 23 | .suppressZeros(LEADING, TRAILING).build(); 24 | break; 25 | case MEDIUM_SYMBOLS: 26 | this.df = com.github.pfichtner.durationformatter.DurationFormatter.Builder.SYMBOLS 27 | .suppressZeros(LEADING, MIDDLE, TRAILING) 28 | .maximumAmountOfUnitsToShow(2).build(); 29 | break; 30 | case SHORT: 31 | this.df = com.github.pfichtner.durationformatter.DurationFormatter.DIGITS; 32 | break; 33 | default: 34 | throw new IllegalStateException("Unknown case " + type); //$NON-NLS-1$ 35 | } 36 | } 37 | 38 | public String format(Duration duration) { 39 | return this.df.formatMillis((long) duration 40 | .getValue(TimeUnit.MILLISECONDS)); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/DefaultWayPoint.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | import java.io.Serializable; 4 | 5 | public class DefaultWayPoint extends DefaultCoordinate implements WayPoint, 6 | Serializable { 7 | 8 | private static final long serialVersionUID = -7788601188509730103L; 9 | 10 | private final Integer ele; 11 | private final Long time; 12 | 13 | private String name; 14 | 15 | public DefaultWayPoint(double lat, double lon, Integer ele, Long time) { 16 | super(lat, lon); 17 | this.ele = ele; 18 | this.time = time; 19 | } 20 | 21 | public DefaultWayPoint(Coordinate coordinate, Integer ele, Long time) { 22 | this(coordinate.getLatitude(), coordinate.getLongitude(), ele, time); 23 | } 24 | 25 | public static DefaultWayPoint of(WayPoint wayPoint) { 26 | DefaultWayPoint wp = new DefaultWayPoint(wayPoint.getLatitude(), 27 | wayPoint.getLongitude(), wayPoint.getElevation(), 28 | wayPoint.getTime()); 29 | wp.setName(wayPoint.getName()); 30 | return wp; 31 | } 32 | 33 | @Override 34 | public Integer getElevation() { 35 | return this.ele; 36 | } 37 | 38 | @Override 39 | public Long getTime() { 40 | return this.time; 41 | } 42 | 43 | @Override 44 | public String getName() { 45 | return this.name; 46 | } 47 | 48 | public void setName(String name) { 49 | this.name = name; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "DefaultWayPoint [latitude=" + getLatitude() + ", longitude=" 55 | + getLongitude() + ", ele=" + this.ele + ", time=" + this.time 56 | + "]"; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/util/Validator.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.util; 2 | 3 | import static com.google.common.base.Preconditions.checkNotNull; 4 | import static com.google.common.base.Preconditions.checkState; 5 | 6 | import java.util.Date; 7 | import java.util.List; 8 | 9 | import com.github.pfichtner.jrunalyser.base.data.LinkedTrackPoint; 10 | import com.github.pfichtner.jrunalyser.base.data.segment.Segment; 11 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 12 | 13 | public final class Validator { 14 | 15 | private Validator() { 16 | super(); 17 | } 18 | 19 | public static Track validate(Track trackArg) { 20 | Track track = checkNotNull(trackArg); 21 | validateSegments(track.getSegments()); 22 | validateWaypoints(track.getTrackpoints()); 23 | return trackArg; 24 | } 25 | 26 | public static List validateSegments(List segments) { 27 | for (Segment segment : checkNotNull(segments)) { 28 | validateWaypoints(segment.getTrackpoints()); 29 | } 30 | return segments; 31 | } 32 | 33 | public static List validateWaypoints( 34 | List wps) { 35 | checkState(!checkNotNull(wps).isEmpty()); 36 | LinkedTrackPoint old = null; 37 | for (LinkedTrackPoint wp : wps) { 38 | if (old != null) { 39 | checkState(wp.getTime().longValue() >= old.getTime() 40 | .longValue(), "%s < %s (%s %s", new Date(wp.getTime() 41 | .longValue()), new Date(old.getTime().longValue()), 42 | old, wp); 43 | } 44 | old = wp; 45 | } 46 | return wps; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/util/format/LatitudeFormatter.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.util.format; 2 | 3 | import java.text.DecimalFormat; 4 | import java.text.DecimalFormatSymbols; 5 | import java.util.Locale; 6 | 7 | public class LatitudeFormatter { 8 | 9 | private final String n; 10 | private final String s; 11 | 12 | private final DecimalFormat wholeFormatter; 13 | private final DecimalFormat fractionFormatter; 14 | 15 | public LatitudeFormatter() { 16 | this(Locale.getDefault()); 17 | } 18 | 19 | public LatitudeFormatter(Locale locale) { 20 | this(new DecimalFormatSymbols(locale)); 21 | } 22 | 23 | public LatitudeFormatter(DecimalFormatSymbols decimalFormatSymbols) { 24 | this(decimalFormatSymbols, "N", "S"); 25 | } 26 | 27 | public LatitudeFormatter(String n, String s) { 28 | this(Locale.US, n, s); 29 | } 30 | 31 | public LatitudeFormatter(Locale locale, String n, String s) { 32 | this(new DecimalFormatSymbols(locale), n, s); 33 | } 34 | 35 | public LatitudeFormatter(DecimalFormatSymbols decimalFormatSymbols, 36 | String n, String s) { 37 | this.n = n; 38 | this.s = s; 39 | this.wholeFormatter = new DecimalFormat("00.###", decimalFormatSymbols); 40 | this.fractionFormatter = new DecimalFormat("##.###", 41 | decimalFormatSymbols); 42 | } 43 | 44 | public String format(double lat) { 45 | int whole = (int) lat; 46 | double remainder = lat - whole; 47 | return (whole > 0 ? this.n : this.s) 48 | + this.wholeFormatter.format(Math.abs(whole)) + "° " 49 | + this.fractionFormatter.format(Math.abs(remainder * 60)); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/util/format/LongitudeFormatter.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.util.format; 2 | 3 | import java.text.DecimalFormat; 4 | import java.text.DecimalFormatSymbols; 5 | import java.util.Locale; 6 | 7 | public class LongitudeFormatter { 8 | 9 | private final String w; 10 | private final String e; 11 | 12 | private final DecimalFormat wholeFormatter; 13 | private final DecimalFormat fractionFormatter; 14 | 15 | public LongitudeFormatter() { 16 | this(Locale.US); 17 | } 18 | 19 | public LongitudeFormatter(Locale locale) { 20 | this(new DecimalFormatSymbols(locale)); 21 | } 22 | 23 | public LongitudeFormatter(DecimalFormatSymbols decimalFormatSymbols) { 24 | this(decimalFormatSymbols, "W", "E"); 25 | } 26 | 27 | public LongitudeFormatter(String w, String e) { 28 | this(Locale.US, w, e); 29 | } 30 | 31 | public LongitudeFormatter(Locale locale, String w, String e) { 32 | this(new DecimalFormatSymbols(locale), w, e); 33 | } 34 | 35 | public LongitudeFormatter(DecimalFormatSymbols decimalFormatSymbols, 36 | String w, String e) { 37 | this.w = w; 38 | this.e = e; 39 | this.wholeFormatter = new DecimalFormat("000.###", decimalFormatSymbols); 40 | this.fractionFormatter = new DecimalFormat("##.###", 41 | decimalFormatSymbols); 42 | } 43 | 44 | public String format(double lng) { 45 | int whole = (int) lng; 46 | double remainder = lng - whole; 47 | return (whole > 0 ? this.e : this.w) 48 | + this.wholeFormatter.format(Math.abs(whole)) + "° " 49 | + this.fractionFormatter.format(Math.abs(remainder * 60)); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /gpx-ui-mapprofile/src/main/java/com/github/pfichtner/jrunalyser/ui/mapprofile/config/MovingAverageConfigDecorator.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.mapprofile.config; 2 | 3 | import org.jfree.data.time.MovingAverage; 4 | import org.jfree.data.xy.XYDataset; 5 | 6 | import com.github.pfichtner.jrunalyser.base.data.LinkedTrackPoint; 7 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 8 | import com.google.common.base.Function; 9 | 10 | public class MovingAverageConfigDecorator extends DatasetConfigDelegate { 11 | 12 | private final String suffix; 13 | private final int periodCount; 14 | private final int skip; 15 | 16 | public MovingAverageConfigDecorator(DatasetConfig delegate) { 17 | this(delegate, "", 10, 0); //$NON-NLS-1$ 18 | } 19 | 20 | public MovingAverageConfigDecorator(DatasetConfig delegate, String suffix, 21 | int periodCount, int skip) { 22 | super(delegate); 23 | this.suffix = suffix; 24 | this.periodCount = periodCount; 25 | this.skip = skip; 26 | } 27 | 28 | @Override 29 | public XYDataset createDataset(Track track, 30 | Function xFunc) { 31 | 32 | // source - the source collection. 33 | // suffix - the suffix added to each source series name to create the 34 | // corresponding moving average series name. 35 | // periodCount - the number of periods in the moving average 36 | // calculation. 37 | // skip - the number of initial periods to skip. 38 | XYDataset undecorated = super.createDataset(track, xFunc); 39 | return MovingAverage.createMovingAverage(undecorated, this.suffix, 40 | this.periodCount, this.skip); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /gpx-ui-cal/src/main/java/com/github/pfichtner/jrunalyser/ui/cal/swing/model/DefaultCalenderModel.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.cal.swing.model; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Collection; 5 | import java.util.Comparator; 6 | import java.util.Date; 7 | 8 | import com.google.common.collect.Iterables; 9 | import com.google.common.collect.Multimap; 10 | import com.google.common.collect.Ordering; 11 | import com.google.common.collect.TreeMultimap; 12 | 13 | public class DefaultCalenderModel extends AbstractCalenderModel { 14 | 15 | private final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); //$NON-NLS-1$ 16 | private final Multimap data = TreeMultimap.create( 17 | Ordering.natural(), new Comparator() { 18 | @Override 19 | public int compare(CalendarEntry o1, CalendarEntry o2) { 20 | return o1.getStartDate().compareTo(o2.getStartDate()); 21 | } 22 | }); 23 | 24 | @Override 25 | public int getCount() { 26 | return this.data.size(); 27 | } 28 | 29 | @Override 30 | public CalendarEntry getEntry(int index) { 31 | return Iterables.get(this.data.values(), index); 32 | } 33 | 34 | @Override 35 | public Collection getEntries(Date date) { 36 | return this.data.get(getKey(date)); 37 | } 38 | 39 | private String getKey(Date date) { 40 | synchronized (this.sdf) { 41 | return this.sdf.format(date); 42 | } 43 | } 44 | 45 | public void addElement(CalendarEntry entry) { 46 | this.data.put(getKey(entry.getStartDate()), entry); 47 | fireElementsInserted(entry.getStartDate(), entry.getEndDate()); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /gpx-ui-trackstats/src/main/resources/com/github/pfichtner/jrunalyser/ui/trackstat/resources/TrackStatsPlugin.properties: -------------------------------------------------------------------------------- 1 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPlugin.title=Statistics 2 | 3 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPanel.avgPace.title=\u2205 Pace 4 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPanel.avgSpeed.title=\u2205 Speed 5 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPanel.description.title=Description 6 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPanel.distance.title=Distance 7 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPanel.duration.title=Duration 8 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPanel.elevationGainedLost.title=Elevation gained/lost 9 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPanel.elevationGainedLost.format=%sm / %sm 10 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPanel.elevation.title=Elevation 11 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPanel.elevation.format=\u2191%sm / \u2193%sm 12 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPanel.name.title=Name 13 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPanel.placement.title=Placement 14 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPanel.starttime.title=Start time 15 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPanel.400m.title=400m 16 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPanel.cooper.title=Cooper 17 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPanel.placement.format=%s/%s 18 | com.github.pfichtner.jrunalyser.ui.trackstat.TrackStatsPanel.valueAndPlacement.format=\#%s (%s) 19 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/showcase/TrackCompareShowcase.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.showcase; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.util.Comparator; 6 | import java.util.Date; 7 | 8 | import com.github.pfichtner.jrunalyser.base.data.StaticFileProvider; 9 | import com.github.pfichtner.jrunalyser.base.data.jaxb.GpxUnmarshaller; 10 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 11 | import com.github.pfichtner.jrunalyser.base.data.track.comparator.TrackComparators; 12 | 13 | public class TrackCompareShowcase { 14 | 15 | public static void main(String[] args) throws IOException { 16 | 17 | File[] fixFiles = StaticFileProvider.getFixFiles(); 18 | 19 | Comparator tc = TrackComparators.byAttributes; 20 | 21 | Track a = loadTrack(fixFiles[50]); 22 | Track b = loadTrack(fixFiles[48]); 23 | 24 | System.out.println("Comparing " + getDate(a) + " to " + getDate(b)); 25 | sysout(tc, a, b); 26 | 27 | System.out.println(); 28 | System.out.println("Comparing to " + getDate(a)); 29 | 30 | int cnt = 0; 31 | for (File file : fixFiles) { 32 | System.out.print((++cnt) + "# "); 33 | sysout(tc, a, loadTrack(file)); 34 | } 35 | 36 | } 37 | 38 | private static void sysout(Comparator tc, Track a, Track b) { 39 | System.out.println(getDate(b) + ": " + (tc.compare(a, b) == 0)); 40 | } 41 | 42 | private static Date getDate(Track track) { 43 | return new Date(track.getTrackpoints().get(0).getTime().longValue()); 44 | } 45 | 46 | private static Track loadTrack(File file) throws IOException { 47 | return GpxUnmarshaller.loadTrack(file); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/showcase/Util.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.showcase; 2 | 3 | import java.util.Comparator; 4 | import java.util.List; 5 | 6 | import com.github.pfichtner.jrunalyser.base.data.Coordinate; 7 | import com.github.pfichtner.jrunalyser.base.data.GeoUtil; 8 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 9 | import com.github.pfichtner.jrunalyser.base.data.track.comparator.TrackComparators.FBC; 10 | import com.github.pfichtner.jrunalyser.base.util.format.LatLonFormatter; 11 | 12 | public final class Util { 13 | 14 | private Util() { 15 | super(); 16 | } 17 | 18 | public static void dumpComparators(final Track ta, final Track tb, 19 | List> comparators) { 20 | for (Comparator comparator : comparators) { 21 | dumpComparator(ta, tb, comparator); 22 | } 23 | } 24 | 25 | public static void dumpComparator(final Track ta, final Track tb, 26 | Comparator comparator) { 27 | String add = ""; 28 | if (comparator instanceof FBC) { 29 | FBC fbc = ((FBC) comparator); 30 | Object oa = fbc.applyA(ta); 31 | Object ob = fbc.applyB(tb); 32 | if (oa instanceof Coordinate && ob instanceof Coordinate) { 33 | Coordinate ca = (Coordinate) oa; 34 | Coordinate cb = (Coordinate) ob; 35 | add = " (" + LatLonFormatter.instance.format(ca) + " vs. " 36 | + LatLonFormatter.instance.format(cb) + " (diff: " 37 | + GeoUtil.calcDistance(ca, cb) + "))"; 38 | } else { 39 | add = " (" + oa + " vs. " + ob + ")"; 40 | } 41 | 42 | } 43 | System.out 44 | .println(comparator + ": " + comparator.compare(ta, tb) + add); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/Durations.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | import static com.google.common.collect.Iterables.filter; 4 | import static com.google.common.collect.Range.atMost; 5 | 6 | import java.util.EnumSet; 7 | import java.util.List; 8 | import java.util.concurrent.TimeUnit; 9 | 10 | import com.google.common.collect.ImmutableList; 11 | import com.google.common.collect.Lists; 12 | import com.google.common.collect.Ordering; 13 | 14 | public final class Durations { 15 | 16 | private Durations() { 17 | super(); 18 | } 19 | 20 | private static final Iterable durations = ImmutableList 21 | .copyOf(Ordering.natural().sortedCopy(all())); 22 | 23 | private static Iterable all() { 24 | List result = Lists. newArrayList(DefaultDuration 25 | .of(12, TimeUnit.MINUTES)); 26 | for (TimeUnit timeUnit : sort(EnumSet.of(TimeUnit.HOURS, TimeUnit.DAYS))) { 27 | for (int i : new int[] { 1, 2, 5, 10, 12 }) { 28 | result.add(DefaultDuration.of(i, timeUnit)); 29 | } 30 | } 31 | return result; 32 | } 33 | 34 | private static final List defaultDurations = sort(Lists 35 | .newArrayList(durationIterator(DefaultDuration 36 | .of(1, TimeUnit.HOURS)))); 37 | 38 | private static > List sort(Iterable build) { 39 | return ImmutableList.copyOf(Ordering.natural().sortedCopy(build)); 40 | } 41 | 42 | public static Iterable getDefaultDurations() { 43 | return defaultDurations; 44 | } 45 | 46 | public static Iterable durationIterator(Duration upto) { 47 | return filter(durations, atMost(upto)); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/track/comparator/CombinedIterator.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.track.comparator; 2 | 3 | import java.util.Iterator; 4 | 5 | import com.google.common.base.Function; 6 | 7 | public class CombinedIterator implements Iterator { 8 | 9 | public static class Pair { 10 | private final T value1; 11 | private final T value2; 12 | 13 | public Pair(T value1, T value2) { 14 | this.value1 = value1; 15 | this.value2 = value2; 16 | } 17 | 18 | public T getValue1() { 19 | return this.value1; 20 | } 21 | 22 | public T getValue2() { 23 | return this.value2; 24 | } 25 | 26 | } 27 | 28 | private final Iterator it1, it2; 29 | private final Function, E> reduceFunction; 30 | 31 | public CombinedIterator(Iterator it1, Iterator it2, 32 | Function, E> reduceFunction) { 33 | this.it1 = it1; 34 | this.it2 = it2; 35 | this.reduceFunction = reduceFunction; 36 | } 37 | 38 | @Override 39 | public boolean hasNext() { 40 | return this.it1.hasNext() && this.it2.hasNext(); 41 | } 42 | 43 | public boolean isTotallyCollected() { 44 | return !this.it1.hasNext() && !this.it2.hasNext(); 45 | } 46 | 47 | @Override 48 | public E next() { 49 | return this.reduceFunction.apply(new Pair(this.it1.next(), this.it2 50 | .next())); 51 | } 52 | 53 | @Override 54 | public void remove() { 55 | this.it1.remove(); 56 | this.it2.remove(); 57 | } 58 | 59 | @Override 60 | public String toString() { 61 | return "CombinedIterator [it1=" + this.it1 + ", it2=" + this.it2 62 | + ", reduceFunction=" + this.reduceFunction + "]"; 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /gpx-base/src/test/java/com/github/pfichtner/jrunalyser/base/data/DurationsTest.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.util.concurrent.TimeUnit; 6 | 7 | import org.junit.Test; 8 | 9 | import com.github.pfichtner.jrunalyser.base.data.DefaultDuration; 10 | import com.github.pfichtner.jrunalyser.base.data.Duration; 11 | import com.github.pfichtner.jrunalyser.base.data.Durations; 12 | import com.google.common.collect.Lists; 13 | 14 | public class DurationsTest { 15 | 16 | @Test 17 | public void test15m() { 18 | Duration upto = DefaultDuration.of(15, TimeUnit.MINUTES); 19 | assertEquals( 20 | Lists.newArrayList(DefaultDuration.of(12, TimeUnit.MINUTES)), 21 | Lists.newArrayList(Durations.durationIterator(upto))); 22 | } 23 | 24 | @Test 25 | public void test30m() { 26 | Duration upto = DefaultDuration.of(30, TimeUnit.MINUTES); 27 | assertEquals( 28 | Lists.newArrayList(DefaultDuration.of(12, TimeUnit.MINUTES)), 29 | Lists.newArrayList(Durations.durationIterator(upto))); 30 | } 31 | 32 | @Test 33 | public void test60m() { 34 | Duration upto = DefaultDuration.of(60, TimeUnit.MINUTES); 35 | assertEquals(Lists.newArrayList( 36 | DefaultDuration.of(12, TimeUnit.MINUTES), 37 | DefaultDuration.of(1, TimeUnit.HOURS)), 38 | Lists.newArrayList(Durations.durationIterator(upto))); 39 | } 40 | 41 | @Test 42 | public void test90m() { 43 | Duration upto = DefaultDuration.of(60, TimeUnit.MINUTES); 44 | assertEquals(Lists.newArrayList( 45 | DefaultDuration.of(12, TimeUnit.MINUTES), 46 | DefaultDuration.of(1, TimeUnit.HOURS)), 47 | Lists.newArrayList(Durations.durationIterator(upto))); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/wprenderer/SegmentBorderWaypointRendererEnd.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.wprenderer; 2 | 3 | import java.awt.Color; 4 | import java.awt.Font; 5 | import java.awt.Graphics2D; 6 | import java.awt.Rectangle; 7 | import java.awt.TexturePaint; 8 | import java.awt.geom.Ellipse2D; 9 | import java.awt.image.BufferedImage; 10 | 11 | import com.github.pfichtner.jrunalyser.ui.map.theme.Theme; 12 | import com.github.pfichtner.jrunalyser.ui.map.wp.TrackEndWaypoint; 13 | 14 | public class SegmentBorderWaypointRendererEnd extends 15 | AbstractSegmentBorderWaypointRenderer { 16 | 17 | private final static BufferedImage checkedFlag = createCheckedFlag(3); 18 | 19 | public SegmentBorderWaypointRendererEnd(Theme theme, Font font) { 20 | super(theme, font); 21 | } 22 | 23 | @Override 24 | protected void drawCircleBorder(Graphics2D g, TrackEndWaypoint waypoint, int r) { 25 | // draw the checked flag 26 | g.setColor(null); 27 | g.setPaint(new TexturePaint(checkedFlag, new Rectangle(0, 0, 28 | checkedFlag.getWidth(), checkedFlag.getHeight()))); 29 | g.fill(new Ellipse2D.Double(-r, -r, 2 * r + 1, 2 * r + 1)); 30 | } 31 | 32 | private static BufferedImage createCheckedFlag(int stroke) { 33 | BufferedImage image = new BufferedImage(2 * stroke, 2 * stroke, 34 | BufferedImage.TYPE_INT_RGB); 35 | Graphics2D g = image.createGraphics(); 36 | g.setColor(Color.BLACK); 37 | g.fillRect(0, 0, stroke, stroke); 38 | g.fillRect(stroke, stroke, stroke, stroke); 39 | g.setColor(Color.WHITE); 40 | g.fillRect(stroke, 0, stroke, stroke); 41 | g.fillRect(0, stroke, stroke, stroke); 42 | g.dispose(); 43 | return image; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/wprenderer/AbstractSegmentBorderWaypointRenderer.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.wprenderer; 2 | 3 | import java.awt.BasicStroke; 4 | import java.awt.Font; 5 | import java.awt.Graphics2D; 6 | import java.awt.geom.Ellipse2D; 7 | 8 | import org.jdesktop.swingx.JXMapViewer; 9 | import org.jdesktop.swingx.mapviewer.Waypoint; 10 | import org.jdesktop.swingx.mapviewer.WaypointRenderer; 11 | 12 | import com.github.pfichtner.jrunalyser.ui.map.theme.Theme; 13 | 14 | public abstract class AbstractSegmentBorderWaypointRenderer 15 | implements WaypointRenderer { 16 | 17 | protected final Theme theme; 18 | protected final Font font; 19 | 20 | private final BasicStroke stroke = new BasicStroke(1); 21 | 22 | public AbstractSegmentBorderWaypointRenderer(Theme theme, Font font) { 23 | this.theme = theme; 24 | this.font = font; 25 | } 26 | 27 | @Override 28 | public boolean paintWaypoint(Graphics2D g, JXMapViewer jxMapViewer, 29 | Waypoint waypoint) { 30 | int r = this.font.getSize() - 2; 31 | @SuppressWarnings("unchecked") 32 | T casted = (T) waypoint; 33 | drawCircleBackground(g, casted, r); 34 | drawCircleBorder(g, casted, r - 2); 35 | 36 | return false; 37 | } 38 | 39 | protected void drawCircleBackground(Graphics2D g, T waypoint, int r) { 40 | g.setColor(this.theme.getBgColor()); 41 | g.setStroke(this.stroke); 42 | g.fill(new Ellipse2D.Double(-r, -r, 2 * r + 1, 2 * r + 1)); 43 | } 44 | 45 | protected void drawCircleBorder(Graphics2D g, T waypoint, int r) { 46 | g.setColor(this.theme.getFgColor()); 47 | g.setStroke(this.stroke); 48 | g.draw(new Ellipse2D.Double(-r, -r, 2 * r + 1, 2 * r + 1)); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/Speeds.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import com.google.common.collect.Ordering; 6 | 7 | public final class Speeds { 8 | 9 | public static class SpeedComparator { 10 | 11 | public class Result { 12 | 13 | private final Speed comparedTo; 14 | 15 | public Result(Speed comparedTo) { 16 | this.comparedTo = comparedTo; 17 | } 18 | 19 | public double asMultiplicator() { 20 | Speed s1 = this.comparedTo; 21 | Speed s2 = SpeedComparator.this.reference; 22 | 23 | DistanceUnit lowerDu = lowerDu(s1, s2); 24 | TimeUnit lowerTu = lowerTu(s1, s2); 25 | return s2.getValue(lowerDu, lowerTu) 26 | / s1.getValue(lowerDu, lowerTu); 27 | } 28 | 29 | private TimeUnit lowerTu(Speed s1, Speed s2) { 30 | return min(s1.getTimeUnit(), s2.getTimeUnit()); 31 | } 32 | 33 | private DistanceUnit lowerDu(Speed s1, Speed s2) { 34 | return min(s1.getDistanceUnit(), s2.getDistanceUnit()); 35 | } 36 | 37 | private > T min(T val1, T tu2) { 38 | return Ordering.natural().min(val1, tu2); 39 | } 40 | 41 | public int inPercent() { 42 | return (int) (asMultiplicator() * 100 - 100); 43 | } 44 | 45 | } 46 | 47 | private final Speed reference; 48 | 49 | public SpeedComparator(Speed reference) { 50 | this.reference = reference; 51 | } 52 | 53 | public Result fasterThan(Speed compareTo) { 54 | return new Result(compareTo); 55 | } 56 | 57 | } 58 | 59 | private Speeds() { 60 | super(); 61 | } 62 | 63 | public static SpeedComparator is(Speed reference) { 64 | return new SpeedComparator(reference); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /gpx-base/src/test/java/com/github/pfichtner/jrunalyser/base/data/track/TracksTest.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.track; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertFalse; 5 | 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | 9 | import org.junit.Test; 10 | 11 | import com.github.pfichtner.jrunalyser.base.data.jaxb.GpxUnmarshaller; 12 | import com.github.pfichtner.jrunalyser.base.data.stat.DefaultStatistics; 13 | import com.github.pfichtner.jrunalyser.base.util.Validator; 14 | 15 | public class TracksTest { 16 | 17 | @Test 18 | public void testSimpleReverse() throws IOException { 19 | Track track = toDefault(loadTrack()); 20 | Track rev1 = Tracks.reverse(track); 21 | Track rev2 = Tracks.reverse(rev1); 22 | assertEquals(track, rev2); 23 | } 24 | 25 | @Test 26 | public void testSegmentedReverse() throws IOException { 27 | Track track = toDefault(loadTrack()); 28 | Track rev1 = Tracks.reverse(track); 29 | Track rev2 = Tracks.reverse(rev1); 30 | assertEquals(track, rev2); 31 | } 32 | 33 | @Test 34 | public void testIsAwayEqReturn() throws IOException { 35 | assertFalse(Tracks.isAwayEqReturn(toDefault(loadTrack()))); 36 | } 37 | 38 | private Track toDefault(Track track) { 39 | return new DefaultTrack(null, track.getMetadata(), 40 | GpxUnmarshaller.toLinked(track.getWaypoints()), 41 | track.getSegments(), DefaultStatistics.ofTrack(track)); 42 | } 43 | 44 | private Track loadTrack() throws IOException { 45 | InputStream stream = getClass().getResourceAsStream( 46 | "/Portland-Ape Cave.gpx"); 47 | try { 48 | return Validator.validate(GpxUnmarshaller.loadTrack(stream)); 49 | } finally { 50 | stream.close(); 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /gpx-base/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/stat/Statistics.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.stat; 2 | 3 | import com.github.pfichtner.jrunalyser.base.data.Distance; 4 | import com.github.pfichtner.jrunalyser.base.data.Duration; 5 | import com.github.pfichtner.jrunalyser.base.data.LinkedTrackPoint; 6 | import com.github.pfichtner.jrunalyser.base.data.Speed; 7 | import com.github.pfichtner.jrunalyser.base.data.WayPoint; 8 | 9 | public interface Statistics { 10 | 11 | Statistics NULL = new Statistics() { 12 | 13 | @Override 14 | public LinkedTrackPoint getMinSpeed() { 15 | return null; 16 | } 17 | 18 | @Override 19 | public WayPoint getMinElevation() { 20 | return null; 21 | } 22 | 23 | @Override 24 | public LinkedTrackPoint getMaxSpeed() { 25 | return null; 26 | } 27 | 28 | @Override 29 | public WayPoint getMaxElevation() { 30 | return null; 31 | } 32 | 33 | @Override 34 | public Duration getDuration() { 35 | return null; 36 | } 37 | 38 | @Override 39 | public Distance getDistance() { 40 | return null; 41 | } 42 | 43 | @Override 44 | public int getDescent() { 45 | return 0; 46 | } 47 | 48 | @Override 49 | public Speed getAvgSpeed() { 50 | return null; 51 | } 52 | 53 | @Override 54 | public int getAscent() { 55 | return 0; 56 | } 57 | }; 58 | 59 | // ----------------------------------------- 60 | 61 | Distance getDistance(); 62 | 63 | Duration getDuration(); 64 | 65 | // ----------------------------------------- 66 | 67 | WayPoint getMinElevation(); 68 | 69 | WayPoint getMaxElevation(); 70 | 71 | int getAscent(); 72 | 73 | int getDescent(); 74 | 75 | LinkedTrackPoint getMinSpeed(); 76 | 77 | LinkedTrackPoint getMaxSpeed(); 78 | 79 | Speed getAvgSpeed(); 80 | 81 | } 82 | -------------------------------------------------------------------------------- /gpx-ui-map/src/main/java/com/github/pfichtner/jrunalyser/ui/map/painter/HighlightTrackPainter.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.map.painter; 2 | 3 | import java.awt.BasicStroke; 4 | import java.awt.Graphics2D; 5 | import java.awt.Stroke; 6 | import java.awt.geom.Line2D; 7 | import java.awt.geom.Point2D; 8 | 9 | import org.jdesktop.swingx.JXMapViewer; 10 | 11 | import com.github.pfichtner.jrunalyser.base.data.floater.HighlightableSegment; 12 | import com.github.pfichtner.jrunalyser.base.data.segment.Segment; 13 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 14 | import com.github.pfichtner.jrunalyser.ui.map.theme.Theme; 15 | 16 | /** 17 | * Simple Painter that draws only {@link HighlightableSegment}s using Theme's 18 | * highlight color. 19 | * 20 | * @author Peter Fichtner 21 | */ 22 | public class HighlightTrackPainter extends AbstractTrackPainter { 23 | 24 | private final Stroke stroke; 25 | 26 | /** 27 | * Creates a new HighlightTrackPainter that draws only 28 | * {@link HighlightableSegment}s using Theme's highlight color. 29 | */ 30 | public HighlightTrackPainter(Track track, Theme theme, int stroke) { 31 | super(track, theme); 32 | this.stroke = new BasicStroke(stroke); 33 | } 34 | 35 | @Override 36 | protected void drawSegment(Graphics2D g, Segment segment, 37 | JXMapViewer jxMapViewer) { 38 | // ignore all non-highlightable and all non-highlighted segments 39 | if (segment instanceof HighlightableSegment 40 | && ((HighlightableSegment) segment).isHighligted()) { 41 | super.drawSegment(g, segment, jxMapViewer); 42 | } 43 | } 44 | 45 | @Override 46 | protected void drawWaypoint(Graphics2D g, Point2D p1, Point2D p2) { 47 | g.setStroke(this.stroke); 48 | g.setColor(getTheme().getHlColor()); 49 | g.draw(new Line2D.Double(p1, p2)); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /gpx-base/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | gpx.base 5 | 6 | 7 | com.github.pfichtner.jrunalyser 8 | parent 9 | 0.0.4-SNAPSHOT 10 | 11 | 12 | 13 | 14 | com.google.code.findbugs 15 | jsr305 16 | 2.0.1 17 | 18 | 19 | com.google.guava 20 | guava 21 | 14.0 22 | 23 | 24 | org.slf4j 25 | slf4j-api 26 | 1.6.6 27 | 28 | 29 | org.slf4j 30 | slf4j-jdk14 31 | 1.6.6 32 | runtime 33 | 34 | 35 | junit 36 | junit 37 | 4.10 38 | test 39 | 40 | 41 | 42 | 43 | 44 | 45 | org.codehaus.mojo 46 | jaxb2-maven-plugin 47 | 1.3.1 48 | 49 | 50 | 51 | xjc 52 | 53 | 54 | 55 | 56 | ${basedir}/src/main/generated-source 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /gpx-base/src/test/java/com/github/pfichtner/jrunalyser/base/data/SpeedPaceTest.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import java.util.concurrent.TimeUnit; 6 | 7 | import org.junit.Test; 8 | 9 | import com.github.pfichtner.jrunalyser.base.data.DefaultPace; 10 | import com.github.pfichtner.jrunalyser.base.data.DefaultSpeed; 11 | import com.github.pfichtner.jrunalyser.base.data.DistanceUnit; 12 | import com.github.pfichtner.jrunalyser.base.data.Pace; 13 | import com.github.pfichtner.jrunalyser.base.data.Speed; 14 | 15 | public class SpeedPaceTest { 16 | 17 | @Test 18 | public void testSpeedConvert() { 19 | Speed mps = new DefaultSpeed(5.0, DistanceUnit.METERS, TimeUnit.SECONDS); 20 | assertEquals(18.0, 21 | mps.getValue(DistanceUnit.KILOMETERS, TimeUnit.HOURS), 0.0); 22 | assertEquals(5.0, mps.getValue(DistanceUnit.METERS, TimeUnit.SECONDS), 23 | 0.0); 24 | } 25 | 26 | @Test 27 | public void testPaceConvert() { 28 | Pace secsPerMeter = new DefaultPace(20.0, TimeUnit.SECONDS, 29 | DistanceUnit.METERS); 30 | assertEquals(5.555, 31 | secsPerMeter.getValue(TimeUnit.HOURS, DistanceUnit.KILOMETERS), 32 | 0.001); 33 | assertEquals(20.0, 34 | secsPerMeter.getValue(TimeUnit.SECONDS, DistanceUnit.METERS), 35 | 0.0); 36 | } 37 | 38 | @Test 39 | public void testCrossConvert() throws Exception { 40 | Speed kmh = new DefaultSpeed(10.0, DistanceUnit.KILOMETERS, 41 | TimeUnit.HOURS); 42 | 43 | Pace minsPerKm = kmh.toPace(TimeUnit.MINUTES, DistanceUnit.KILOMETERS); 44 | assertEquals(6.0, 45 | minsPerKm.getValue(TimeUnit.MINUTES, DistanceUnit.KILOMETERS), 46 | 0.0); 47 | 48 | assertEquals(10.0, 49 | minsPerKm.toSpeed(DistanceUnit.KILOMETERS, TimeUnit.HOURS) 50 | .getValue(DistanceUnit.KILOMETERS, TimeUnit.HOURS), 0.0); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/data/segment/DefaultSegment.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.segment; 2 | 3 | import java.util.List; 4 | 5 | import com.github.pfichtner.jrunalyser.base.data.LinkedTrackPoint; 6 | import com.github.pfichtner.jrunalyser.base.data.stat.Statistics; 7 | import com.google.common.collect.ImmutableList; 8 | 9 | public class DefaultSegment implements Segment { 10 | 11 | private final List wayPoints; 12 | private final Statistics statistics; 13 | 14 | public DefaultSegment(List wps, 15 | Statistics statistics) { 16 | this.wayPoints = ImmutableList.copyOf(wps); 17 | this.statistics = statistics; 18 | } 19 | 20 | public List getTrackpoints() { 21 | return this.wayPoints; 22 | } 23 | 24 | @Override 25 | public Statistics getStatistics() { 26 | return this.statistics; 27 | } 28 | 29 | @Override 30 | public int hashCode() { 31 | final int prime = 31; 32 | int result = 1; 33 | result = prime * result 34 | + ((this.statistics == null) ? 0 : this.statistics.hashCode()); 35 | result = prime * result 36 | + ((this.wayPoints == null) ? 0 : this.wayPoints.hashCode()); 37 | return result; 38 | } 39 | 40 | @Override 41 | public boolean equals(Object obj) { 42 | if (this == obj) 43 | return true; 44 | if (obj == null) 45 | return false; 46 | if (getClass() != obj.getClass()) 47 | return false; 48 | DefaultSegment other = (DefaultSegment) obj; 49 | if (this.statistics == null) { 50 | if (other.statistics != null) 51 | return false; 52 | } else if (!this.statistics.equals(other.statistics)) 53 | return false; 54 | if (this.wayPoints == null) { 55 | if (other.wayPoints != null) 56 | return false; 57 | } else if (!this.wayPoints.equals(other.wayPoints)) 58 | return false; 59 | return true; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /gpx-ui-tracklist/src/main/java/com/github/pfichtner/jrunalyser/ui/tracklist/MinMaxElevation.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.tracklist; 2 | 3 | import com.github.pfichtner.jrunalyser.base.data.WayPoint; 4 | import com.google.common.math.IntMath; 5 | import com.google.common.primitives.Ints; 6 | 7 | public class MinMaxElevation implements Comparable { 8 | 9 | private final WayPoint minElevation; 10 | private final WayPoint maxElevation; 11 | 12 | public MinMaxElevation(WayPoint minElevation, WayPoint maxElevation) { 13 | this.minElevation = minElevation; 14 | this.maxElevation = maxElevation; 15 | } 16 | 17 | public WayPoint getMinElevation() { 18 | return this.minElevation; 19 | } 20 | 21 | public WayPoint getMaxElevation() { 22 | return this.maxElevation; 23 | } 24 | 25 | public int getDiff() { 26 | return IntMath.checkedSubtract(getMaxElevation().getElevation() 27 | .intValue(), getMinElevation().getElevation().intValue()); 28 | } 29 | 30 | public int getDiffAbs() { 31 | return Math.abs(getDiff()); 32 | } 33 | 34 | public String getText() { 35 | return getMinElevation().getElevation().intValue() + "/" //$NON-NLS-1$ 36 | + getMaxElevation().getElevation().intValue(); 37 | } 38 | 39 | public String getTextLong() { 40 | return getText() + " (" + getDiffAbs() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ 41 | } 42 | 43 | @Override 44 | public int compareTo(MinMaxElevation other) { 45 | return Ints.compare(getDiffAbs(), other.getDiffAbs()); 46 | } 47 | 48 | @Override 49 | public int hashCode() { 50 | return getDiff(); 51 | } 52 | 53 | @Override 54 | public boolean equals(Object obj) { 55 | MinMaxElevation other = (MinMaxElevation) obj; 56 | return getDiff() == other.getDiff() 57 | && getTextLong().equals(other.getTextLong()); 58 | } 59 | 60 | @Override 61 | public String toString() { 62 | return getTextLong(); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/showcase/SortWaypoints.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.showcase; 2 | 3 | import static com.github.pfichtner.jrunalyser.base.util.Validator.validateWaypoints; 4 | 5 | import java.io.File; 6 | import java.io.IOException; 7 | import java.util.Collections; 8 | import java.util.List; 9 | 10 | import com.github.pfichtner.jrunalyser.base.data.LinkedTrackPoint; 11 | import com.github.pfichtner.jrunalyser.base.data.jaxb.GpxMarshaller; 12 | import com.github.pfichtner.jrunalyser.base.data.jaxb.GpxUnmarshaller; 13 | import com.github.pfichtner.jrunalyser.base.data.segment.DefaultSegment; 14 | import com.github.pfichtner.jrunalyser.base.data.stat.DefaultStatistics; 15 | import com.github.pfichtner.jrunalyser.base.data.track.DefaultTrack; 16 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 17 | import com.google.common.base.Function; 18 | import com.google.common.collect.Ordering; 19 | 20 | public class SortWaypoints { 21 | 22 | public static void main(String[] args) throws IOException { 23 | File file = new File("/home/xck10h6/", "test.gpx"); 24 | 25 | Track track = GpxUnmarshaller.loadTrack(file); 26 | List sortedCopy = validateWaypoints(createOrdering() 27 | .sortedCopy(track.getTrackpoints())); 28 | Track sorted = new DefaultTrack(track.getId(), track.getMetadata(), 29 | track.getWaypoints(), 30 | Collections.singletonList(new DefaultSegment(sortedCopy, 31 | DefaultStatistics.ofWaypoints(sortedCopy))), track.getStatistics()); 32 | 33 | GpxMarshaller.writeTrack(file, sorted); 34 | } 35 | 36 | private static Ordering createOrdering() { 37 | return Ordering.natural().onResultOf( 38 | new Function() { 39 | @Override 40 | public Long apply(LinkedTrackPoint wp) { 41 | return wp.getTime(); 42 | } 43 | }); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /gpx-base/src/test/java/com/github/pfichtner/jrunalyser/base/comparator/AbsDiffNumberComparatorTest.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.comparator; 2 | 3 | import static org.junit.Assert.*; 4 | 5 | import org.junit.Test; 6 | 7 | import com.github.pfichtner.jrunalyser.base.comparator.AbsDiffNumberComparator; 8 | 9 | public class AbsDiffNumberComparatorTest { 10 | 11 | private static final Integer zero = Integer.valueOf(0); 12 | 13 | private static final Integer p10 = Integer.valueOf(10); 14 | private static final Integer n10 = Integer.valueOf(-10); 15 | 16 | private static final Integer p11 = Integer.valueOf(11); 17 | private static final Integer n11 = Integer.valueOf(-11); 18 | 19 | private static final Integer maxVal = Integer.valueOf(Integer.MAX_VALUE); 20 | private static final Integer minVal = Integer.valueOf(Integer.MIN_VALUE); 21 | 22 | // values can differ up to 10 (absolut) 23 | private final AbsDiffNumberComparator comparator = new AbsDiffNumberComparator( 24 | 10); 25 | 26 | @Test 27 | public void testCompare_resultMustBeZero() { 28 | assertEquals(0, this.comparator.compare(zero, zero)); 29 | assertEquals(0, this.comparator.compare(p10, zero)); 30 | assertEquals(0, this.comparator.compare(zero, p10)); 31 | assertEquals(0, this.comparator.compare(n10, zero)); 32 | assertEquals(0, this.comparator.compare(zero, n10)); 33 | } 34 | 35 | @Test 36 | public void testCompare_resultMustBeNonZero() { 37 | assertTrue(this.comparator.compare(p11, zero) > 0); 38 | assertTrue(this.comparator.compare(zero, p11) < 0); 39 | assertTrue(this.comparator.compare(n11, zero) < 0); 40 | assertTrue(this.comparator.compare(zero, n11) > 0); 41 | 42 | assertTrue(this.comparator.compare(maxVal, zero) > 0); 43 | assertTrue(this.comparator.compare(zero, maxVal) < 0); 44 | assertTrue(this.comparator.compare(minVal, zero) < 0); 45 | assertTrue(this.comparator.compare(zero, minVal) > 0); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /gpx-base/src/test/java/com/github/pfichtner/jrunalyser/base/data/segmenter/SegmenterTest.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.data.segmenter; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertFalse; 5 | 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | import java.util.concurrent.TimeUnit; 9 | 10 | import org.junit.Test; 11 | 12 | import com.github.pfichtner.jrunalyser.base.data.DefaultDuration; 13 | import com.github.pfichtner.jrunalyser.base.data.jaxb.GpxUnmarshaller; 14 | import com.github.pfichtner.jrunalyser.base.data.segmenter.Segmenter; 15 | import com.github.pfichtner.jrunalyser.base.data.segmenter.Segmenters; 16 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 17 | import com.github.pfichtner.jrunalyser.base.util.Validator; 18 | import com.google.common.io.Closeables; 19 | 20 | public class SegmenterTest { 21 | 22 | @Test 23 | public void testSegmentUnsegment() throws IOException { 24 | Track track = loadTrack(); 25 | assertTrackSize(track); 26 | 27 | for (int i = 1; i < 90; i += 2) { 28 | track = Segmenters 29 | .duration(DefaultDuration.of(i, TimeUnit.MINUTES)).segment( 30 | track); 31 | assertFalse(String.valueOf(i + " minutes = " 32 | + track.getTrackpoints().size() + " waypoints (" 33 | + track.getSegments().size() + " segments)"), track 34 | .getSegments().size() == 1); 35 | track = Segmenter.NULL_SEGMENTER.segment(track); 36 | assertTrackSize(track); 37 | } 38 | } 39 | 40 | private void assertTrackSize(Track track) { 41 | assertEquals(4038, track.getTrackpoints().size()); 42 | } 43 | 44 | private Track loadTrack() throws IOException { 45 | InputStream stream = getClass().getResourceAsStream( 46 | "/Portland-Ape Cave.gpx"); 47 | try { 48 | return Validator.validate(GpxUnmarshaller.loadTrack(stream)); 49 | } finally { 50 | Closeables.closeQuietly(stream); 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/format/SpeedFormatter.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.format; 2 | 3 | import java.text.NumberFormat; 4 | 5 | import com.github.pfichtner.jrunalyser.base.data.Pace; 6 | import com.github.pfichtner.jrunalyser.base.data.Speed; 7 | import com.github.pfichtner.jrunalyser.ui.base.Settings; 8 | import com.github.pfichtner.jrunalyser.ui.base.Settings.SpeedUnit; 9 | import com.github.pfichtner.jrunalyser.ui.base.UiPlugins; 10 | 11 | public class SpeedFormatter { 12 | 13 | public enum Type { 14 | SHORT; 15 | } 16 | 17 | private final Type type; 18 | 19 | public SpeedFormatter(Type type) { 20 | this.type = type; 21 | } 22 | 23 | public String format(Settings settings, Object object) { 24 | if (object == null) { 25 | return null; 26 | } else if (object instanceof Speed) { 27 | return format(settings, (Speed) object); 28 | } else if (object instanceof Pace) { 29 | SpeedUnit su = settings.getSpeedUnit(); 30 | Speed speed = ((Pace) object).toSpeed(su.getDistanceUnit(), 31 | su.getTimeUnit()); 32 | return format(settings, speed); 33 | } else { 34 | throw new IllegalArgumentException("Cannot handle " + object + "(" //$NON-NLS-1$ //$NON-NLS-2$ 35 | + object.getClass() + ")"); //$NON-NLS-1$ 36 | } 37 | 38 | } 39 | 40 | private String format(Settings settings, Speed speed) { 41 | SpeedUnit spu = settings.getSpeedUnit(); 42 | double distance = speed.getValue(spu.getDistanceUnit(), 43 | spu.getTimeUnit()); 44 | NumberFormat nf = NumberFormat.getNumberInstance(); 45 | String key = this.type == Type.SHORT ? "speed.template$SHORT" //$NON-NLS-1$ 46 | : "speed.template"; //$NON-NLS-1$ 47 | String app = UiPlugins.getI18n().getText(key, 48 | UiPlugins.getI18n().getText(spu.getDistanceUnit(), this.type), 49 | UiPlugins.getI18n().getText(spu.getTimeUnit(), this.type)); 50 | return nf.format(distance) + " " + app; //$NON-NLS-1$ 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /gpx-ui-tracklist/src/main/java/com/github/pfichtner/jrunalyser/ui/tracklist/TrackRow.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.tracklist; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.annotation.Nullable; 6 | 7 | import com.github.pfichtner.jrunalyser.base.data.SegmentationUnit; 8 | import com.github.pfichtner.jrunalyser.base.data.WayPoint; 9 | import com.github.pfichtner.jrunalyser.base.data.stat.Statistics; 10 | import com.github.pfichtner.jrunalyser.base.data.track.Id; 11 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 12 | import com.github.pfichtner.jrunalyser.base.datasource.DatasourceFascade; 13 | import com.google.common.base.Optional; 14 | import com.google.common.base.Throwables; 15 | 16 | public class TrackRow { 17 | 18 | private final DatasourceFascade dsf; 19 | private final Track track; 20 | private final MinMaxElevation mme; 21 | private final Integer simCount; 22 | 23 | public TrackRow(DatasourceFascade dsf, Id id) throws IOException { 24 | this.dsf = dsf; 25 | this.track = dsf.loadTrack(id); 26 | WayPoint min = this.track.getStatistics().getMinElevation(); 27 | WayPoint max = this.track.getStatistics().getMaxElevation(); 28 | this.mme = min == null || max == null ? null : new MinMaxElevation(min, 29 | max); 30 | this.simCount = Integer.valueOf(dsf.getSimilarTracks(id).size()); 31 | } 32 | 33 | public Track getTrack() { 34 | return this.track; 35 | } 36 | 37 | @Nullable 38 | public MinMaxElevation getMinMaxElevation() { 39 | return this.mme; 40 | } 41 | 42 | public Optional getBestSegment(SegmentationUnit segmentationUnit) { 43 | try { 44 | return this.dsf.loadBestSegment(this.track.getId(), 45 | segmentationUnit); 46 | } catch (IOException e) { 47 | throw Throwables.propagate(e); 48 | } 49 | } 50 | 51 | public Integer getSimCount() { 52 | return this.simCount; 53 | } 54 | 55 | public Boolean isAwayEqReturn() { 56 | return Boolean.valueOf(this.dsf.isAwayEqReturn(this.track.getId())); 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /gpx-base/src/main/java/com/github/pfichtner/jrunalyser/base/showcase/RemoveInvalidWaypoints.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.base.showcase; 2 | 3 | import static com.github.pfichtner.jrunalyser.base.util.Validator.validateWaypoints; 4 | 5 | import java.io.File; 6 | import java.io.IOException; 7 | import java.util.Collections; 8 | import java.util.List; 9 | 10 | import com.github.pfichtner.jrunalyser.base.data.LinkedTrackPoint; 11 | import com.github.pfichtner.jrunalyser.base.data.jaxb.GpxMarshaller; 12 | import com.github.pfichtner.jrunalyser.base.data.jaxb.GpxUnmarshaller; 13 | import com.github.pfichtner.jrunalyser.base.data.segment.DefaultSegment; 14 | import com.github.pfichtner.jrunalyser.base.data.stat.DefaultStatistics; 15 | import com.github.pfichtner.jrunalyser.base.data.track.DefaultTrack; 16 | import com.github.pfichtner.jrunalyser.base.data.track.Track; 17 | import com.google.common.collect.Lists; 18 | 19 | public class RemoveInvalidWaypoints { 20 | 21 | public static void main(String[] args) throws IOException { 22 | File file = new File("/home/xck10h6/", "test.gpx"); 23 | 24 | Track track = GpxUnmarshaller.loadTrack(file); 25 | List sortedCopy = removeInvalids(track 26 | .getTrackpoints()); 27 | List vwps = validateWaypoints(sortedCopy); 28 | Track newTrack = new DefaultTrack(track.getId(), track.getMetadata(), 29 | track.getWaypoints(), 30 | Collections.singletonList(new DefaultSegment(vwps, 31 | DefaultStatistics.ofWaypoints(vwps))), track.getStatistics()); 32 | GpxMarshaller.writeTrack(file, newTrack); 33 | } 34 | 35 | private static List removeInvalids( 36 | List wps) { 37 | List result = Lists.newArrayListWithExpectedSize(wps 38 | .size()); 39 | LinkedTrackPoint old = null; 40 | for (LinkedTrackPoint next : wps) { 41 | if (old == null 42 | || old.getTime().longValue() < next.getTime().longValue()) { 43 | result.add(next); 44 | old = next; 45 | } 46 | } 47 | return result; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /gpx-ui-base/src/main/java/com/github/pfichtner/jrunalyser/ui/format/PaceFormatter.java: -------------------------------------------------------------------------------- 1 | package com.github.pfichtner.jrunalyser.ui.format; 2 | 3 | import java.text.DateFormat; 4 | import java.text.SimpleDateFormat; 5 | import java.util.concurrent.TimeUnit; 6 | 7 | import com.github.pfichtner.jrunalyser.base.data.Pace; 8 | import com.github.pfichtner.jrunalyser.base.data.Speed; 9 | import com.github.pfichtner.jrunalyser.ui.base.Settings; 10 | import com.github.pfichtner.jrunalyser.ui.base.Settings.PaceUnit; 11 | import com.github.pfichtner.jrunalyser.ui.base.UiPlugins; 12 | 13 | public class PaceFormatter { 14 | 15 | public enum Type { 16 | SHORT; 17 | } 18 | 19 | private final Type type; 20 | 21 | public PaceFormatter(Type type) { 22 | this.type = type; 23 | } 24 | 25 | public String format(Settings settings, Object object) { 26 | if (object == null) { 27 | return null; 28 | } else if (object instanceof Pace) { 29 | return format(settings, (Pace) object); 30 | } else if (object instanceof Speed) { 31 | PaceUnit pu = settings.getPaceUnit(); 32 | Pace pace = ((Speed) object).toPace(pu.getTimeUnit(), 33 | pu.getDistanceUnit()); 34 | return format(settings, pace); 35 | } else { 36 | throw new IllegalArgumentException("Cannot handle " + object + "(" //$NON-NLS-1$ //$NON-NLS-2$ 37 | + object.getClass() + ")"); //$NON-NLS-1$ 38 | } 39 | 40 | } 41 | 42 | // http://stackoverflow.com/questions/266825/how-to-format-a-duration-in-java-e-g-format-hmmss 43 | private String format(Settings settings, Pace pace) { 44 | PaceUnit pu = settings.getPaceUnit(); 45 | String key = this.type == Type.SHORT ? "pace.template$SHORT" //$NON-NLS-1$ 46 | : "pace.template"; //$NON-NLS-1$ 47 | String app = UiPlugins.getI18n().getText(key, 48 | UiPlugins.getI18n().getText(pu.getTimeUnit(), this.type), 49 | UiPlugins.getI18n().getText(pu.getDistanceUnit(), this.type)); 50 | DateFormat df = new SimpleDateFormat("mm:ss"); //$NON-NLS-1$ 51 | return df.format(Double.valueOf((long) pace.getValue( 52 | TimeUnit.MILLISECONDS, pace.getDistanceUnit()))) + " " + app; //$NON-NLS-1$ 53 | } 54 | 55 | } 56 | --------------------------------------------------------------------------------