X-Git-Url: https://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fdata%2FTrackInfo.java;h=d58cc167d6353239983e846a4e41969d250e7c89;hp=4f3ce27e8f85b79c6b3582d5af20f27593f7fabb;hb=54b9d8bc8f0025ccf97a67d9dd217ef1f9cf082f;hpb=52bf9e8686c916be37a26a0b75340393d4478b05 diff --git a/tim/prune/data/TrackInfo.java b/tim/prune/data/TrackInfo.java index 4f3ce27..d58cc16 100644 --- a/tim/prune/data/TrackInfo.java +++ b/tim/prune/data/TrackInfo.java @@ -82,31 +82,17 @@ public class TrackInfo } - /** - * Load the specified data into the Track - * @param inFieldArray array of Field objects describing fields - * @param inPointArray 2d object array containing data - * @param inAltFormat altitude format - */ - public void loadTrack(Field[] inFieldArray, Object[][] inPointArray, int inAltFormat) - { - _track.cropTo(0); - _track.load(inFieldArray, inPointArray, inAltFormat); - _selection.clearAll(); - } - - /** * Add a Set of Photos * @param inSet Set containing Photo objects * @return array containing number of photos and number of points added */ - public int[] addPhotos(Set inSet) + public int[] addPhotos(Set inSet) { // Firstly count number of points and photos to add int numPhotosToAdd = 0; int numPointsToAdd = 0; - Iterator iterator = null; + Iterator iterator = null; if (inSet != null && !inSet.isEmpty()) { iterator = inSet.iterator(); @@ -114,7 +100,7 @@ public class TrackInfo { try { - Photo photo = (Photo) iterator.next(); + Photo photo = iterator.next(); if (photo != null && !_photoList.contains(photo)) { numPhotosToAdd++; @@ -139,7 +125,7 @@ public class TrackInfo { try { - Photo photo = (Photo) iterator.next(); + Photo photo = iterator.next(); if (photo != null && !_photoList.contains(photo)) { // Add photo @@ -240,28 +226,12 @@ public class TrackInfo /** - * Compress the track to the given resolution - * @param inResolution resolution - * @return number of points deleted - */ - public int compress(int inResolution) - { - int numDeleted = _track.compress(inResolution); - if (numDeleted > 0) { - _selection.clearAll(); - UpdateMessageBroker.informSubscribers(); - } - return numDeleted; - } - - - /** - * Delete all the duplicate points in the track + * Delete all the points which have been marked for deletion * @return number of points deleted */ - public int deleteDuplicates() + public int deleteMarkedPoints() { - int numDeleted = _track.deleteDuplicates(); + int numDeleted = _track.deleteMarkedPoints(); if (numDeleted > 0) { _selection.clearAll(); UpdateMessageBroker.informSubscribers(); @@ -295,6 +265,20 @@ public class TrackInfo } + /** + * Average selected points to create a new one + * @return true if successful + */ + public boolean average() + { + boolean success = _track.average(_selection.getStart(), _selection.getEnd()); + if (success) { + _selection.selectPoint(_selection.getEnd()+1); + } + return success; + } + + /** * Select the given DataPoint * @param inPoint DataPoint object to select