]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/data/Selection.java
Version 3, August 2007
[GpsPrune.git] / tim / prune / data / Selection.java
index f09088dc218e6f498cef7d78a498a5995e019c02..4849a4a42bcddb948172bf494f9180d5639eb9a0 100644 (file)
@@ -13,6 +13,7 @@ public class Selection
        private int _currentPoint = -1;
        private boolean _valid = false;
        private int _startIndex = -1, _endIndex = -1;
+       private int _currentPhotoIndex = -1;
        private IntegerRange _altitudeRange = null;
        private int _climb = -1, _descent = -1;
        private int _altitudeFormat = Altitude.FORMAT_NONE;
@@ -258,6 +259,7 @@ public class Selection
        {
                _currentPoint = -1;
                deselectRange();
+               deselectPhoto();
        }
 
 
@@ -377,6 +379,47 @@ public class Selection
        }
 
 
+       /**
+        * Deselect photo
+        */
+       public void deselectPhoto()
+       {
+               _currentPhotoIndex = -1;
+               check();
+       }
+
+
+       /**
+        * Select the specified photo and point
+        * @param inPhotoIndex index of selected photo in PhotoList
+        * @param inPointIndex index of selected point
+        */
+       public void selectPhotoAndPoint(int inPhotoIndex, int inPointIndex)
+       {
+               _currentPhotoIndex = inPhotoIndex;
+               if (inPointIndex > -1)
+               {
+                       // select associated point, if any
+                       selectPoint(inPointIndex);
+               }
+               else
+               {
+                       // Check if not already done
+                       check();
+               }
+       }
+
+
+       /**
+        * @return currently selected photo index
+        */
+       public int getCurrentPhotoIndex()
+       {
+               // System.out.println("Current photo index = " + _currentPhotoIndex);
+               return _currentPhotoIndex;
+       }
+
+
        /**
         * Check that the selection still makes sense
         * and fire update message to listeners