X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fdata%2FSelection.java;h=cbfb3504b4049f1597ca4dba8337102dc7ff5385;hp=6924d133abca3c541a44d5bf257955a7e1bd3440;hb=1ee49ae3c8ef3aa2e63eadd458531e5f8bd4f92c;hpb=112bb0c9b46894adca9a33ed8c99ea712b253185 diff --git a/tim/prune/data/Selection.java b/tim/prune/data/Selection.java index 6924d13..cbfb350 100644 --- a/tim/prune/data/Selection.java +++ b/tim/prune/data/Selection.java @@ -19,7 +19,7 @@ public class Selection private Altitude.Format _altitudeFormat = Altitude.Format.NO_FORMAT; private long _totalSeconds = 0L, _movingSeconds = 0L; private double _angDistance = -1.0, _angMovingDistance = -1.0; - private boolean _multipleSegments = false; + private int _numSegments = 0; /** @@ -65,7 +65,7 @@ public class Selection private void recalculate() { _altitudeFormat = Altitude.Format.NO_FORMAT; - _multipleSegments = false; + _numSegments = 0; if (_track.getNumPoints() > 0 && hasRangeSelected()) { _altitudeRange = new IntegerRange(); @@ -121,13 +121,15 @@ public class Selection double radians = DataPoint.calculateRadiansBetween(lastPoint, currPoint); _angDistance += radians; if (currPoint.getSegmentStart()) { - _multipleSegments = true; + _numSegments++; } else { _angMovingDistance += radians; } } lastPoint = currPoint; + // If it's a track point then there must be at least one segment + if (_numSegments == 0) {_numSegments = 1;} } } if (endTime != null) { @@ -232,11 +234,11 @@ public class Selection } /** - * @return true if track has multiple segments + * @return number of segments in selection */ - public boolean getHasMultipleSegments() + public int getNumSegments() { - return _multipleSegments; + return _numSegments; } /** @@ -252,7 +254,7 @@ public class Selection /** - * Deselect range + * Select range from start to end * @param inStartIndex index of start of range * @param inEndIndex index of end of range */