X-Git-Url: https://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fundo%2FUndoLoadPhotos.java;h=b8c2b35970fbb05482ad8cfc4dd1bbe95aa0f08a;hp=bb6a21176c48673f3a293115a97e6969fd98255e;hb=4d5796d02a15808311c09448d79e6e7d1de9d636;hpb=f1b92378a792131ac8fb33a869405851d5b2d1f7 diff --git a/tim/prune/undo/UndoLoadPhotos.java b/tim/prune/undo/UndoLoadPhotos.java index bb6a211..b8c2b35 100644 --- a/tim/prune/undo/UndoLoadPhotos.java +++ b/tim/prune/undo/UndoLoadPhotos.java @@ -1,6 +1,8 @@ package tim.prune.undo; import tim.prune.I18nManager; +import tim.prune.data.DataPoint; +import tim.prune.data.Photo; import tim.prune.data.TrackInfo; /** @@ -50,6 +52,18 @@ public class UndoLoadPhotos implements UndoOperation cropIndex = inTrackInfo.getTrack().getNumPoints() - _numPoints; inTrackInfo.getTrack().cropTo(cropIndex); } + else + { + // Loop through the points (if any) and detach them + for (int i=0; i<_numPhotos; i++) + { + Photo photo = inTrackInfo.getPhotoList().getPhoto(inTrackInfo.getPhotoList().getNumPhotos() - 1 - i); + if (photo.isConnected()) { + DataPoint point = photo.getDataPoint(); + if (point != null) {point.setPhoto(null);} + } + } + } // crop photo list to previous size cropIndex = inTrackInfo.getPhotoList().getNumPhotos() - _numPhotos; inTrackInfo.getPhotoList().cropTo(cropIndex);