X-Git-Url: https://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=src%2Ftim%2Fprune%2Fdata%2FTrack.java;h=ef099d4c171d1651bfd627a3beb71bd271943a15;hp=f45854a0e3d47a1fd5fc0ee6924732b3294decc0;hb=refs%2Fheads%2Fperso_changes2;hpb=f499af3454f9e4a3e14b436f7a06d26031bcd633 diff --git a/src/tim/prune/data/Track.java b/src/tim/prune/data/Track.java index f45854a..ef099d4 100644 --- a/src/tim/prune/data/Track.java +++ b/src/tim/prune/data/Track.java @@ -377,6 +377,31 @@ public class Track } + /** + * Remove altitudes from the specified range + * @param inStart start of range + * @param inEnd end of range + */ + public boolean removeAltitudes(int inStart, int inEnd) + { + // sanity check + if (inStart < 0 || inEnd < 0 || inStart >= inEnd || inEnd >= _numPoints) { + return false; + } + + boolean anyRemoved = false; + for (int i=inStart; i<=inEnd; i++) + { + DataPoint p = _dataPoints[i]; + if (p != null && p.hasAltitude()) + { + p.removeAltitude(); + anyRemoved = true; + } + } + return anyRemoved; + } + /** * Interleave all waypoints by each nearest track point * @return true if successful, false if no change