X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fdata%2FTrackInfo.java;h=4f3ce27e8f85b79c6b3582d5af20f27593f7fabb;hb=52bf9e8686c916be37a26a0b75340393d4478b05;hp=b987ea9449d6dff66fd52f2af60031752f415413;hpb=5625a1abadb5f2ca5f017fe7dbda1d5141cb637b;p=GpsPrune.git diff --git a/tim/prune/data/TrackInfo.java b/tim/prune/data/TrackInfo.java index b987ea9..4f3ce27 100644 --- a/tim/prune/data/TrackInfo.java +++ b/tim/prune/data/TrackInfo.java @@ -1,7 +1,7 @@ package tim.prune.data; -import java.util.List; - +import java.util.Iterator; +import java.util.Set; import tim.prune.UpdateMessageBroker; /** @@ -10,7 +10,6 @@ import tim.prune.UpdateMessageBroker; */ public class TrackInfo { - private UpdateMessageBroker _broker = null; private Track _track = null; private Selection _selection = null; private FileInfo _fileInfo = null; @@ -20,13 +19,11 @@ public class TrackInfo /** * Constructor * @param inTrack Track object - * @param inBroker broker object */ - public TrackInfo(Track inTrack, UpdateMessageBroker inBroker) + public TrackInfo(Track inTrack) { - _broker = inBroker; _track = inTrack; - _selection = new Selection(_track, inBroker); + _selection = new Selection(_track); _fileInfo = new FileInfo(); _photoList = new PhotoList(); } @@ -100,23 +97,24 @@ public class TrackInfo /** - * Add a List of Photos - * @param inList List containing Photo objects + * 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(List inList) + public int[] addPhotos(Set inSet) { - // TODO: Should photos be sorted at load-time, either by filename or date? // Firstly count number of points and photos to add int numPhotosToAdd = 0; int numPointsToAdd = 0; - if (inList != null && !inList.isEmpty()) + Iterator iterator = null; + if (inSet != null && !inSet.isEmpty()) { - for (int i=0; i 0) + if (numDeleted > 0) { _selection.clearAll(); + UpdateMessageBroker.informSubscribers(); + } return numDeleted; } @@ -261,8 +262,10 @@ public class TrackInfo public int deleteDuplicates() { int numDeleted = _track.deleteDuplicates(); - if (numDeleted > 0) + if (numDeleted > 0) { _selection.clearAll(); + UpdateMessageBroker.informSubscribers(); + } return numDeleted; } @@ -279,15 +282,15 @@ public class TrackInfo /** * Interpolate extra points between two selected ones - * @param inStartIndex start index of interpolation * @param inNumPoints num points to insert * @return true if successful */ public boolean interpolate(int inNumPoints) { boolean success = _track.interpolate(_selection.getStart(), inNumPoints); - if (success) + if (success) { _selection.selectRangeEnd(_selection.getEnd() + inNumPoints); + } return success; } @@ -325,13 +328,4 @@ public class TrackInfo _selection.selectPhotoAndPoint(-1, -1); } } - - - /** - * Fire a trigger to all data subscribers - */ - public void triggerUpdate() - { - _broker.informSubscribers(); - } }