]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - src/tim/prune/data/Track.java
Add a panel to select by segment
[GpsPrune.git] / src / tim / prune / data / Track.java
index f45854a0e3d47a1fd5fc0ee6924732b3294decc0..b6e05496e17335628c577dd799408b19361bf6f0 100644 (file)
@@ -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
@@ -793,6 +818,24 @@ public class Track
                }
        }
 
+       /**
+        * Collect all segment starts into the given list
+        * @param inList List to fill with waypoints
+        */
+       public void getSegmentStarts(List<DataPoint> inList)
+       {
+               // clear list
+               inList.clear();
+               // loop over points and copy all segment starts into list
+               for (int i=0; i<=_numPoints-1; i++)
+               {
+                       if (_dataPoints[i] != null && _dataPoints[i].getSegmentStart())
+                       {
+                               inList.add(_dataPoints[i]);
+                       }
+               }
+       }
+
 
        /**
         * Search for the given Point in the track and return the index