]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/data/Selection.java
Version 5, May 2008
[GpsPrune.git] / tim / prune / data / Selection.java
index 4849a4a42bcddb948172bf494f9180d5639eb9a0..cdbe58ecca33035a7a012d5ee5e3be402e422ccc 100644 (file)
@@ -1,5 +1,6 @@
 package tim.prune.data;
 
+import tim.prune.DataSubscriber;
 import tim.prune.UpdateMessageBroker;
 
 /**
@@ -9,7 +10,6 @@ import tim.prune.UpdateMessageBroker;
 public class Selection
 {
        private Track _track = null;
-       private UpdateMessageBroker _broker = null;
        private int _currentPoint = -1;
        private boolean _valid = false;
        private int _startIndex = -1, _endIndex = -1;
@@ -24,12 +24,10 @@ public class Selection
        /**
         * Constructor
         * @param inTrack track object
-        * @param inBroker broker object
         */
-       public Selection(Track inTrack, UpdateMessageBroker inBroker)
+       public Selection(Track inTrack)
        {
                _track = inTrack;
-               _broker = inBroker;
        }
 
 
@@ -243,12 +241,12 @@ public class Selection
 
 
        /**
-        * @param inFormat distance units to use, from class Distance
+        * @param inUnits distance units to use, from class Distance
         * @return distance of Selection in specified units
         */
        public double getDistance(int inUnits)
        {
-               return Distance.convertRadians(_angDistance, inUnits);
+               return Distance.convertRadiansToDistance(_angDistance, inUnits);
        }
 
 
@@ -303,7 +301,7 @@ public class Selection
                        }
                }
                reset();
-               _broker.informSubscribers();
+               UpdateMessageBroker.informSubscribers();
        }
 
 
@@ -336,7 +334,7 @@ public class Selection
                        }
                }
                reset();
-               _broker.informSubscribers();
+               UpdateMessageBroker.informSubscribers();
        }
 
 
@@ -415,11 +413,9 @@ public class Selection
         */
        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
@@ -450,6 +446,6 @@ public class Selection
                                _currentPoint = _startIndex = _endIndex = -1;
                        }
                }
-               _broker.informSubscribers();
+               UpdateMessageBroker.informSubscribers(DataSubscriber.SELECTION_CHANGED);
        }
 }