Skip to content

Commit 2d8cb72

Browse files
Version 19.2, December 2018
1 parent 1a735a9 commit 2d8cb72

24 files changed

+641
-138
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ GpsPrune is a map-based application for viewing, editing and converting coordina
33

44
It's a cross-platform java application, and its home page is at https://gpsprune.activityworkshop.net .
55

6-
Here on github you'll find all the sources from version 1 to the current version 19, and in the wiki at https://github.com/activityworkshop/GpsPrune/wiki there's the beginning of a translation effort for anyone to contribute.
6+
Here on github you'll find all the sources from version 1 to the current version 19.2, and in the wiki at https://github.com/activityworkshop/GpsPrune/wiki there's the beginning of a translation effort for anyone to contribute.
77
Currently just the Spanish translations are online, to see whether it's a workable idea or not. Please help with this if you can.

tim/prune/GpsPrune.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package tim.prune;
22

3-
import java.awt.event.WindowAdapter;
43
import java.awt.BorderLayout;
54
import java.awt.Component;
65
import java.awt.Image;
6+
import java.awt.event.WindowAdapter;
77
import java.awt.event.WindowEvent;
88
import java.io.File;
99
import java.io.FileNotFoundException;
10-
import java.util.Locale;
1110
import java.util.ArrayList;
11+
import java.util.Locale;
1212
import javax.swing.JFrame;
1313
import javax.swing.JSplitPane;
1414
import javax.swing.JToolBar;
@@ -17,10 +17,10 @@
1717
import tim.prune.config.Config;
1818
import tim.prune.config.ConfigException;
1919
import tim.prune.gui.DetailsDisplay;
20-
import tim.prune.gui.SidebarController;
2120
import tim.prune.gui.IconManager;
2221
import tim.prune.gui.MenuManager;
2322
import tim.prune.gui.SelectorDisplay;
23+
import tim.prune.gui.SidebarController;
2424
import tim.prune.gui.StatusBar;
2525
import tim.prune.gui.Viewport;
2626
import tim.prune.gui.map.MapCanvas;
@@ -36,9 +36,9 @@
3636
public class GpsPrune
3737
{
3838
/** Version number of application, used in about screen and for version check */
39-
public static final String VERSION_NUMBER = "19.1";
39+
public static final String VERSION_NUMBER = "19.2";
4040
/** Build number, just used for about screen */
41-
public static final String BUILD_NUMBER = "363c";
41+
public static final String BUILD_NUMBER = "363d";
4242
/** Static reference to App object */
4343
private static App APP = null;
4444

tim/prune/config/Config.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,9 @@ private static int parseInt(String inString)
238238
return val;
239239
}
240240

241-
/** @return File from which config was loaded (or null) */
241+
/**
242+
* @return File from which config was loaded (or null)
243+
*/
242244
public static File getConfigFile()
243245
{
244246
return _configFile;

tim/prune/data/AltitudeRange.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,6 @@ else if (overallDn)
126126
_previousValue = altValue;
127127
_gotPreviousValue = true;
128128
}
129-
130-
// if (!_empty)
131-
// {
132-
// if (altValue > _previousValue)
133-
// _climb += (altValue - _previousValue);
134-
// else
135-
// _descent += (_previousValue - altValue);
136-
// }
137-
// _previousValue = altValue;
138-
// _empty = false;
139129
}
140130
}
141131

tim/prune/data/FileInfo.java

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,18 @@ public int getNumFiles()
6868
*/
6969
public String getFilename()
7070
{
71-
if (getNumFiles() == 1)
71+
if (getNumFiles() == 1) {
7272
return _sources.get(0).getName();
73+
}
7374
return "";
7475
}
7576

7677
/**
77-
* @param inIndex index number
78+
* @param inIndex index number, starting from zero
7879
* @return source info object
7980
*/
80-
public SourceInfo getSource(int inIndex) {
81+
public SourceInfo getSource(int inIndex)
82+
{
8183
return _sources.get(inIndex);
8284
}
8385

@@ -88,14 +90,52 @@ public SourceInfo getSource(int inIndex) {
8890
*/
8991
public SourceInfo getSourceForPoint(DataPoint inPoint)
9092
{
91-
for (SourceInfo source : _sources) {
93+
for (SourceInfo source : _sources)
94+
{
9295
if (source.getIndex(inPoint) >= 0) {
9396
return source;
9497
}
9598
}
9699
return null;
97100
}
98101

102+
/**
103+
* @return the info about the last file loaded, if any
104+
*/
105+
public SourceInfo getLastFileInfo()
106+
{
107+
if (getNumFiles() == 0)
108+
{
109+
return null;
110+
}
111+
return getSource(getNumFiles()-1);
112+
}
113+
114+
/**
115+
* @return the most recent file title loaded, if any
116+
*/
117+
public String getLastFileTitle()
118+
{
119+
final int numFiles = getNumFiles();
120+
if (numFiles == 0)
121+
{
122+
return null;
123+
}
124+
for (int i=(numFiles-1); i>=0; i--)
125+
{
126+
SourceInfo info = getSource(i);
127+
if (info != null)
128+
{
129+
String title = info.getFileTitle();
130+
if (title != null && !title.equals(""))
131+
{
132+
return title;
133+
}
134+
}
135+
}
136+
return null;
137+
}
138+
99139
/**
100140
* Clone contents of file info
101141
*/

tim/prune/data/RangeStats.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class RangeStats
2121
private boolean _timesIncomplete = false;
2222
private boolean _timesOutOfSequence = false;
2323
private double _totalDistanceRads = 0.0, _movingDistanceRads = 0.0;
24-
// Note, maximum speed is not calculated here, use the SpeedData method instead
24+
// Note, maximum speed is not calculated here, use the SpeedData class instead
2525

2626
private static final double STEEP_ANGLE = 0.15; // gradient steeper than 15% counts as steep
2727

@@ -50,7 +50,8 @@ public RangeStats(Track inTrack, int inStartIndex, int inEndIndex)
5050
*/
5151
private boolean calculateStats(Track inTrack, int inStartIndex, int inEndIndex)
5252
{
53-
_startIndex = inStartIndex; _endIndex = inEndIndex;
53+
_startIndex = inStartIndex;
54+
_endIndex = inEndIndex;
5455
_numPoints = inEndIndex - inStartIndex + 1;
5556
_totalAltitudeRange = new AltitudeRange();
5657
_movingAltitudeRange = new AltitudeRange();
@@ -70,7 +71,9 @@ private boolean calculateStats(Track inTrack, int inStartIndex, int inEndIndex)
7071
// ignore all waypoints
7172
if (p.isWaypoint()) continue;
7273

73-
if (p.getSegmentStart()) {_numSegments++;}
74+
if (p.getSegmentStart()) {
75+
_numSegments++;
76+
}
7477
// Get the distance to the previous track point
7578
if (prevPoint != null)
7679
{

tim/prune/data/SourceInfo.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public enum FILE_TYPE {TEXT, GPX, KML, NMEA, GPSBABEL, GPSIES, JSON};
1717
private String _sourceName = null;
1818
/** File type */
1919
private FILE_TYPE _fileType = null;
20+
/** File title, if any */
21+
private String _fileTitle = null;
2022

2123
/** Array of datapoints */
2224
private DataPoint[] _points = null;
@@ -50,6 +52,14 @@ public SourceInfo(String inName, FILE_TYPE inType)
5052
_fileType = inType;
5153
}
5254

55+
/**
56+
* @param inTitle title of file, eg from <name> tag in gpx
57+
*/
58+
public void setFileTitle(String inTitle)
59+
{
60+
_fileTitle = inTitle;
61+
}
62+
5363
/**
5464
* @return source file
5565
*/
@@ -74,6 +84,14 @@ public FILE_TYPE getFileType()
7484
return _fileType;
7585
}
7686

87+
/**
88+
* @return title of file
89+
*/
90+
public String getFileTitle()
91+
{
92+
return _fileTitle;
93+
}
94+
7795
/**
7896
* @return number of points from this source
7997
*/

tim/prune/data/TimestampLocal.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,17 @@ protected boolean hasMilliseconds()
9191
/**
9292
* Utility method for formatting dates / times
9393
* @param inFormat formatter object
94-
* @param inTimezone timezone to use
94+
* @param inTimezone timezone to use, or null
9595
* @return formatted String
9696
*/
9797
@Override
9898
protected String format(DateFormat inFormat, TimeZone inTimezone)
9999
{
100100
Calendar cal = getCalendar(inTimezone);
101-
inFormat.setTimeZone(inTimezone);
101+
if (inTimezone != null)
102+
{
103+
inFormat.setTimeZone(inTimezone);
104+
}
102105
return inFormat.format(cal.getTime());
103106
}
104107
}

tim/prune/data/TrackInfo.java

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,8 @@ public boolean mergeTrackSegments(int inStart, int inEnd)
306306
{
307307
boolean firstTrackPoint = true;
308308
// Loop between start and end
309-
for (int i=inStart; i<=inEnd; i++) {
309+
for (int i=inStart; i<=inEnd; i++)
310+
{
310311
DataPoint point = _track.getPoint(i);
311312
// Set all segments to false apart from first track point
312313
if (point != null && !point.isWaypoint()) {
@@ -316,7 +317,9 @@ public boolean mergeTrackSegments(int inStart, int inEnd)
316317
}
317318
// Find following track point, if any
318319
DataPoint nextPoint = _track.getNextTrackPoint(inEnd+1);
319-
if (nextPoint != null) {nextPoint.setSegmentStart(true);}
320+
if (nextPoint != null) {
321+
nextPoint.setSegmentStart(true);
322+
}
320323
_selection.markInvalid();
321324
UpdateMessageBroker.informSubscribers();
322325
return true;
@@ -353,8 +356,10 @@ public void selectPoint(DataPoint inPoint)
353356
public void incrementPointIndex(int inPointIncrement)
354357
{
355358
int index = _selection.getCurrentPointIndex() + inPointIncrement;
356-
if (index < 0) index = 0;
357-
else if (index >= _track.getNumPoints()) index = _track.getNumPoints()-1;
359+
if (index < 0)
360+
index = 0;
361+
else if (index >= _track.getNumPoints())
362+
index = _track.getNumPoints()-1;
358363
selectPoint(index);
359364
}
360365

@@ -364,7 +369,9 @@ public void incrementPointIndex(int inPointIncrement)
364369
*/
365370
public void selectPoint(int inPointIndex)
366371
{
367-
if (_selection.getCurrentPointIndex() == inPointIndex || inPointIndex >= _track.getNumPoints()) {return;}
372+
if (_selection.getCurrentPointIndex() == inPointIndex || inPointIndex >= _track.getNumPoints()) {
373+
return;
374+
}
368375
DataPoint selectedPoint = _track.getPoint(inPointIndex);
369376
// get the index of the current photo
370377
int photoIndex = _selection.getCurrentPhotoIndex();
@@ -397,7 +404,9 @@ else if (audioIndex < 0 || _audioList.getAudio(audioIndex).isConnected()) {
397404
*/
398405
public void selectPhoto(int inPhotoIndex)
399406
{
400-
if (_selection.getCurrentPhotoIndex() == inPhotoIndex) {return;}
407+
if (_selection.getCurrentPhotoIndex() == inPhotoIndex) {
408+
return;
409+
}
401410
// Photo is primary selection here, not as a result of a point selection
402411
// Therefore the photo selection takes priority, deselecting point if necessary
403412
// Find Photo object
@@ -426,11 +435,13 @@ public void selectPhoto(int inPhotoIndex)
426435
// Has the new point got an audio clip?
427436
DataPoint selectedPoint = _track.getPoint(pointIndex);
428437
int audioIndex = _selection.getCurrentAudioIndex();
429-
if (selectedPoint != null && selectedPoint.getAudio() != null) {
438+
if (selectedPoint != null && selectedPoint.getAudio() != null)
439+
{
430440
// New point has an audio, so select it
431441
audioIndex = _audioList.getAudioIndex(selectedPoint.getAudio());
432442
}
433-
else if (currPoint != null && selectedPoint != currPoint && currPoint.getAudio() != null) {
443+
else if (currPoint != null && selectedPoint != currPoint && currPoint.getAudio() != null)
444+
{
434445
// Old point had an audio, so deselect it
435446
audioIndex = -1;
436447
}
@@ -444,7 +455,9 @@ else if (currPoint != null && selectedPoint != currPoint && currPoint.getAudio()
444455
*/
445456
public void selectAudio(int inAudioIndex)
446457
{
447-
if (_selection.getCurrentAudioIndex() == inAudioIndex) {return;}
458+
if (_selection.getCurrentAudioIndex() == inAudioIndex) {
459+
return;
460+
}
448461
// Audio selection takes priority, deselecting point if necessary
449462
AudioClip audio = _audioList.getAudio(inAudioIndex);
450463
int pointIndex = _selection.getCurrentPointIndex();

tim/prune/gui/images/add_photo_icon.png

100644100755
File mode changed.

0 commit comments

Comments
 (0)