]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/undo/UndoDeletePhoto.java
Moved source into separate src directory due to popular request
[GpsPrune.git] / tim / prune / undo / UndoDeletePhoto.java
diff --git a/tim/prune/undo/UndoDeletePhoto.java b/tim/prune/undo/UndoDeletePhoto.java
deleted file mode 100644 (file)
index 45be6ad..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-package tim.prune.undo;\r
-\r
-import tim.prune.I18nManager;\r
-import tim.prune.UpdateMessageBroker;\r
-import tim.prune.data.DataPoint;\r
-import tim.prune.data.Photo;\r
-import tim.prune.data.TrackInfo;\r
-\r
-/**\r
- * Operation to undo a delete of a single photo, either with or without point\r
- */\r
-public class UndoDeletePhoto extends UndoDeleteOperation\r
-{\r
-       private int _photoIndex = -1;\r
-       private Photo _photo = null;\r
-       private int _pointIndex = -1;\r
-       private DataPoint _point = null;\r
-\r
-\r
-       /**\r
-        * Constructor\r
-        * @param inPhoto photo\r
-        * @param inPhotoIndex index number of photo within photo list\r
-        * @param inPoint data point\r
-        * @param inPointIndex index number of point within track\r
-        */\r
-       public UndoDeletePhoto(Photo inPhoto, int inPhotoIndex, DataPoint inPoint, int inPointIndex)\r
-       {\r
-               _photo = inPhoto;\r
-               _photoIndex = inPhotoIndex;\r
-               _point = inPoint;\r
-               _pointIndex = inPointIndex;\r
-       }\r
-\r
-\r
-       /**\r
-        * @return description of operation including photo name\r
-        */\r
-       public String getDescription()\r
-       {\r
-               String desc = I18nManager.getText("undo.removephoto") + " " + _photo.getName();\r
-               return desc;\r
-       }\r
-\r
-\r
-       /**\r
-        * Perform the undo operation on the given Track\r
-        * @param inTrackInfo TrackInfo object on which to perform the operation\r
-        */\r
-       public void performUndo(TrackInfo inTrackInfo) throws UndoException\r
-       {\r
-               // restore photo\r
-               inTrackInfo.getPhotoList().addPhoto(_photo, _photoIndex);\r
-               // if there's a point to restore, restore it\r
-               if (_point != null)\r
-               {\r
-                       if (!inTrackInfo.getTrack().insertPoint(_point, _pointIndex))\r
-                       {\r
-                               throw new UndoException(getDescription());\r
-                       }\r
-                       // Change the current point/range selection if required\r
-                       modifySelection(inTrackInfo, _pointIndex, _pointIndex);\r
-               }\r
-               else\r
-               {\r
-                       // update needed if not already triggered by track update\r
-                       UpdateMessageBroker.informSubscribers();\r
-               }\r
-               // Ensure that photo is associated with point and vice versa\r
-               _photo.setDataPoint(_point);\r
-               if (_point != null) {\r
-                       _point.setPhoto(_photo);\r
-               }\r
-       }\r
-}\r