]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/undo/UndoLoadPhotos.java
Version 14, October 2012
[GpsPrune.git] / tim / prune / undo / UndoLoadPhotos.java
index bb6a21176c48673f3a293115a97e6969fd98255e..b8c2b35970fbb05482ad8cfc4dd1bbe95aa0f08a 100644 (file)
@@ -1,6 +1,8 @@
 package tim.prune.undo;\r
 \r
 import tim.prune.I18nManager;\r
+import tim.prune.data.DataPoint;\r
+import tim.prune.data.Photo;\r
 import tim.prune.data.TrackInfo;\r
 \r
 /**\r
@@ -50,6 +52,18 @@ public class UndoLoadPhotos implements UndoOperation
                        cropIndex = inTrackInfo.getTrack().getNumPoints() - _numPoints;\r
                        inTrackInfo.getTrack().cropTo(cropIndex);\r
                }\r
+               else\r
+               {\r
+                       // Loop through the points (if any) and detach them\r
+                       for (int i=0; i<_numPhotos; i++)\r
+                       {\r
+                               Photo photo = inTrackInfo.getPhotoList().getPhoto(inTrackInfo.getPhotoList().getNumPhotos() - 1 - i);\r
+                               if (photo.isConnected()) {\r
+                                       DataPoint point = photo.getDataPoint();\r
+                                       if (point != null) {point.setPhoto(null);}\r
+                               }\r
+                       }\r
+               }\r
                // crop photo list to previous size\r
                cropIndex = inTrackInfo.getPhotoList().getNumPhotos() - _numPhotos;\r
                inTrackInfo.getPhotoList().cropTo(cropIndex);\r