X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;ds=sidebyside;f=tim%2Fprune%2Fdata%2FTrackInfo.java;h=bbbdefb2336d210a35d2336824d271a058557a76;hb=ca9bdb3916f9c39adbbf95d06ac95c21dafbb4e6;hp=b987ea9449d6dff66fd52f2af60031752f415413;hpb=5625a1abadb5f2ca5f017fe7dbda1d5141cb637b;p=GpsPrune.git diff --git a/tim/prune/data/TrackInfo.java b/tim/prune/data/TrackInfo.java index b987ea9..bbbdefb 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; } @@ -325,13 +328,4 @@ public class TrackInfo _selection.selectPhotoAndPoint(-1, -1); } } - - - /** - * Fire a trigger to all data subscribers - */ - public void triggerUpdate() - { - _broker.informSubscribers(); - } }