From 7e3a7723c983b019163a99dd3d6dad03449927f6 Mon Sep 17 00:00:00 2001 From: lingutln Date: Thu, 4 Apr 2013 19:30:38 +0000 Subject: [PATCH] Add toggling between Segmentation and Labelling modes. Done by Nikhil. svn path=/; revision=456 --- Annotation/.classpath | 10 +- Annotation/resources/config/view.properties | 15 ++- .../dcu/apps/ist/views/SegmentationView.java | 91 +++++-------------- 3 files changed, 36 insertions(+), 80 deletions(-) diff --git a/Annotation/.classpath b/Annotation/.classpath index 6eb1bbe..2f52523 100644 --- a/Annotation/.classpath +++ b/Annotation/.classpath @@ -3,9 +3,11 @@ - - - - + + + + + + diff --git a/Annotation/resources/config/view.properties b/Annotation/resources/config/view.properties index a0cd0ac..e3a9cca 100644 --- a/Annotation/resources/config/view.properties +++ b/Annotation/resources/config/view.properties @@ -1,12 +1,9 @@ -SegmentationView.Action.Foreground.text=Segmentation Mode -SegmentationView.Action.Foreground.tooltip=Segmentation Mode -SegmentationView.Action.Foreground.image=file:resources/icons/foreground.png -SegmentationView.Action.Background.text=Markup Background -SegmentationView.Action.Background.tooltip=Markup Background Pixels -SegmentationView.Action.Background.image=file:resources/icons/background.png -SegmentationView.Action.OperatingMode.text=Labeling Mode -SegmentationView.Action.OperatingMode.tooltip=Labeling Mode -SegmentationView.Action.OperatingMode.image=file:resources/icons/copy.png +SegmentationView.Action.SegmentMode.text=Segmentation Mode +SegmentationView.Action.SegmentMode.tooltip=Segmentation Mode +SegmentationView.Action.SegmentMode.image=file:resources/icons/foreground.png +SegmentationView.Action.LabelMode.text=Labeling Mode +SegmentationView.Action.LabelMode.tooltip=Labeling Mode +SegmentationView.Action.LabelMode.image=file:resources/icons/copy.png SegmentationView.Action.FormSegment.text=Form segment SegmentationView.Action.FormSegment.tooltip=Form a segment from current view SegmentationView.Action.FormSegment.image=file:resources/icons/apply.png diff --git a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java index b3ac8f8..0af29cc 100644 --- a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java +++ b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java @@ -104,9 +104,8 @@ public class SegmentationView extends Composite { public enum Tool { - Foreground(true), - Background(true), - OperatingMode(true), + SegmentMode(true), + LabelMode(true), FormSegment(true), PredictSegments(false), ZoomIn(false), @@ -211,12 +210,11 @@ public class SegmentationView extends Composite { private void createToolMainToolbar() { + SwtUtils.addButton(mainToolbar, 300, getAction(Tool.SetPainter).getText()); ToolBarManager m = new ToolBarManager(mainToolbar); - m.add(getAction(Tool.Foreground)); - //m.add(getAction(Tool.Background)); - m.add(getAction(Tool.OperatingMode)); + m.add(getAction(Tool.SegmentMode)); + m.add(getAction(Tool.LabelMode)); m.add(getAction(Tool.FormSegment)); - //m.add(getAction(Tool.PredictSegments)); m.add(new Separator()); m.add(getAction(Tool.ZoomIn)); m.add(getAction(Tool.ZoomOut)); @@ -230,9 +228,6 @@ public class SegmentationView extends Composite { m.add(new Separator()); m.add(getAction(Tool.SetBrushSize)); m.add(new Separator()); - //m.add(getAction(Tool.AutoApply)); - //m.add(getAction(Tool.Apply)); - //m.add(getAction(Tool.SegmenterOptions)); m.update(true); } @@ -260,7 +255,7 @@ public class SegmentationView extends Composite { * TODO: then recall this method from the Open (Open Recent), Go Next, Go Previous, and Close...when you add Close */ public void resetView() { - Tool.OperatingMode.action.setChecked(false); + Tool.LabelMode.action.setChecked(false); resetViewSelectionToolbar(painters.get("Combined")); // clear metadata @@ -408,17 +403,7 @@ public class SegmentationView extends Composite { for (termDetailLabels code : values) { String currResponseValue = responseArray.getJSONObject(0).getString(code.toString()); // assumes an array of one response if (items[i].getText(0).equals(code.extendedLabel)) { - /*if (code.extendedLabel.equals("Synonyms")) { - String formattedSyns = new String(); - - JSONArray synArray = responseArray.getJSONObject(0).getJSONArray("synonyms"); - for (int j=0; j