Hello!

To see the file structure, click on "tree".

Note that updates take place every 10 minutes, commits may not be seen immediately.
Modified Enable/Disable functionality. Done by Nikhil.
authorlingutln <lingutln@localhost>
Fri, 23 Dec 2011 19:15:30 +0000 (19:15 +0000)
committerlingutln <lingutln@localhost>
Fri, 23 Dec 2011 19:15:30 +0000 (19:15 +0000)
svn path=/; revision=235

Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java
Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java
Annotation/src/ie/dcu/segment/annotate/AnnotationManager.java

index 9c7b4a80c278acc93e8f1f5feb2eb36e83bc52cc..d7dadce8cd239c231e8a603946eef28113ac88e8 100644 (file)
@@ -449,8 +449,8 @@ public class SegmentationView extends Composite {
                return view.canUndo();
        }
        
-       public boolean canAnnotate() {
-               return view.canAnnotate();
+       public boolean CanLabel() {
+               return view.CanLabel();
        }
        public boolean canRedo() {
                return view.canRedo();
@@ -763,7 +763,7 @@ public class SegmentationView extends Composite {
                        Tool.ZoomOut.action.setEnabled(canZoomOut());
                        Tool.ZoomOriginal.action.setEnabled(canZoomOriginal());
                        Tool.ZoomBestFit.action.setEnabled(canZoomBestFit());
-                       comboLabel.setEnabled(canAnnotate());
+                       comboLabel.setEnabled(CanLabel());
                        assign.setEnabled(canZoomBestFit() & !(comboLabel.getText().isEmpty()));
                        Tool.Foreground.action.setChecked(isAnnotatingForeground());
                        Tool.Background.action.setChecked(isAnnotatingBackground());
index d3dea1d643b0b69aa30f296671df6d1ea808e3d6..ed1c4b164063381cb5fa8867ddee9e2bf62761cd 100644 (file)
@@ -202,16 +202,16 @@ public class AnnotatedImageControl extends Composite {
                return false;
        }
        
-       public boolean canAnnotate() {
+       public boolean CanLabel() {
                if (ctx != null) {
-                       return ctx.getAnnotations().canUndo();
+                       return ctx.getAnnotations().canLabel();
                }
                return false;
        }
        
        public boolean canRedo() {
                if (ctx != null) {
-                       return ctx.getAnnotations().canAnnotate();
+                       return ctx.getAnnotations().canLabel();
                }
                return false;
        }
index 88a94fede3c7fe3524364888aea8b4631f216f03..92ff8e43ed9f488bda3e1920a11aa8758b9b20a3 100644 (file)
@@ -35,19 +35,27 @@ public class AnnotationManager {
        public boolean canUndo() {
                return !annotations.isEmpty();
        }
-       
-       public boolean canAnnotate() {
+       /**
+        * Returns true only if there is atleast one Foreground Annotation and one Background Annotation.
+        * 
+        * @return boolean value
+        */
+       public boolean canLabel() {
                String[] temp  = new String[annotations.size()];
                int i = 0;
+               boolean containForeGround = false, containBackGround = false;
                for(Annotation ann : annotations)
                {
                        temp[i++] = ann.getType().toString();
                }
                for(int j=0;j<temp.length;j++)
                {
-                       System.out.println(temp[j]);
+                       if(temp[j] == "Foreground")
+                               containForeGround = true;
+                       if(temp[j] == "Background")
+                               containBackGround = true;
                }
-               return !annotations.isEmpty();
+               return (containForeGround && containBackGround);
        }
        
        public boolean canRedo() {