changeset 1982:ba45e1b0812a

preparing interfaces for rectangle probe, ellipse probe and text annotations
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 31 Oct 2022 08:55:14 +0100
parents c074c75cf416
children 20fa913272b7
files Applications/Samples/Sdl/SingleFrameViewer/SdlSimpleViewer.cpp Applications/StoneWebViewer/WebApplication/app.js Applications/StoneWebViewer/WebApplication/index.html Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.h
diffstat 5 files changed, 74 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Samples/Sdl/SingleFrameViewer/SdlSimpleViewer.cpp	Mon Oct 31 08:22:31 2022 +0100
+++ b/Applications/Samples/Sdl/SingleFrameViewer/SdlSimpleViewer.cpp	Mon Oct 31 08:55:14 2022 +0100
@@ -80,9 +80,11 @@
             << "  a\tCreate angle annotations" << std::endl
             << "  c\tCreate circle annotations" << std::endl
             << "  d\tDelete mode for annotations" << std::endl
-            << "  e\tEdit mode, don't create annotation (default)" << std::endl
+            << "  e\tCreate ellipse probe" << std::endl
             << "  l\tCreate line annotations" << std::endl
+            << "  m\tModification/edit mode, don't create annotation (default)" << std::endl
             << "  p\tCreate pixel probe" << std::endl
+            << "  r\tCreate rectangle probe" << std::endl
 #else
             << "  a\tEnable/disable the angle annotation tool" << std::endl
             << "  l\tEnable/disable the line annotation tool" << std::endl
@@ -302,7 +304,7 @@
 #endif
 
 #if SAMPLE_USE_ANNOTATIONS_LAYER == 1
-                  case SDLK_e:
+                  case SDLK_m:
                     annotations.SetActiveTool(OrthancStone::AnnotationsSceneLayer::Tool_Edit);
                     break;
 #endif
@@ -388,6 +390,18 @@
                     break;
 #endif
 
+#if SAMPLE_USE_ANNOTATIONS_LAYER == 1
+                  case SDLK_e:
+                    annotations.SetActiveTool(OrthancStone::AnnotationsSceneLayer::Tool_EllipseProbe);
+                    break;
+#endif
+
+#if SAMPLE_USE_ANNOTATIONS_LAYER == 1
+                  case SDLK_r:
+                    annotations.SetActiveTool(OrthancStone::AnnotationsSceneLayer::Tool_RectangleProbe);
+                    break;
+#endif
+
                   default:
                     break;
                 }
--- a/Applications/StoneWebViewer/WebApplication/app.js	Mon Oct 31 08:22:31 2022 +0100
+++ b/Applications/StoneWebViewer/WebApplication/app.js	Mon Oct 31 08:55:14 2022 +0100
@@ -46,7 +46,10 @@
 var MOUSE_TOOL_CREATE_ANGLE = 6;
 var MOUSE_TOOL_CREATE_CIRCLE = 7;
 var MOUSE_TOOL_REMOVE_MEASURE = 8;
-var MOUSE_TOOL_CREATE_PIXEL_PROBE = 9;
+var MOUSE_TOOL_CREATE_PIXEL_PROBE = 9;       // New in 2.4
+var MOUSE_TOOL_CREATE_ELLIPSE_PROBE = 10;    // New in 2.4
+var MOUSE_TOOL_CREATE_RECTANGLE_PROBE = 11;  // New in 2.4
+var MOUSE_TOOL_CREATE_TEXT_ANNOTATION = 12;  // New in 2.4
 
 
 function getParameterFromUrl(key) {
--- a/Applications/StoneWebViewer/WebApplication/index.html	Mon Oct 31 08:22:31 2022 +0100
+++ b/Applications/StoneWebViewer/WebApplication/index.html	Mon Oct 31 08:55:14 2022 +0100
@@ -504,7 +504,7 @@
                       v-bind:class="{ 'active' : mouseTool == MOUSE_TOOL_CREATE_SEGMENT }"
                       v-on:click="SetLeftMouseButtonAction(MOUSE_TOOL_CREATE_SEGMENT, stone.WebViewerAction.CREATE_SEGMENT)"
                       data-toggle="tooltip" data-title="Measure length">
-                <i class="fas fa-arrows-alt-h"></i>
+                <i class="fas fa-ruler"></i>
               </button>
             </div>
 
@@ -513,7 +513,7 @@
                       v-bind:class="{ 'active' : mouseTool == MOUSE_TOOL_CREATE_ANGLE }"
                       v-on:click="SetLeftMouseButtonAction(MOUSE_TOOL_CREATE_ANGLE, stone.WebViewerAction.CREATE_ANGLE)"
                       data-toggle="tooltip" data-title="Measure angle">
-                <i class="fas fa-angle-left fa-lg"></i>
+                <i class="fas fa-drafting-compass"></i>
               </button>
             </div>
 
@@ -531,7 +531,34 @@
                       v-bind:class="{ 'active' : mouseTool == MOUSE_TOOL_CREATE_PIXEL_PROBE }"
                       v-on:click="SetLeftMouseButtonAction(MOUSE_TOOL_CREATE_PIXEL_PROBE, stone.WebViewerAction.CREATE_PIXEL_PROBE)"
                       data-toggle="tooltip" data-title="Pixel probe">
-                <i class="far fa-dot-circle"></i>
+                <i class="fas fa-microscope"></i>
+              </button>
+            </div>
+
+            <div class="ng-scope inline-object">
+              <button class="wvButton--underline text-center"
+                      v-bind:class="{ 'active' : mouseTool == MOUSE_TOOL_CREATE_RECTANGLE_PROBE }"
+                      v-on:click="SetLeftMouseButtonAction(MOUSE_TOOL_CREATE_RECTANGLE_PROBE, stone.WebViewerAction.CREATE_RECTANGLE_PROBE)"
+                      data-toggle="tooltip" data-title="Rectangle probe">
+                <i class="fas fa-plus-square"></i>
+              </button>
+            </div>
+
+            <div class="ng-scope inline-object">
+              <button class="wvButton--underline text-center"
+                      v-bind:class="{ 'active' : mouseTool == MOUSE_TOOL_CREATE_ELLIPSE_PROBE }"
+                      v-on:click="SetLeftMouseButtonAction(MOUSE_TOOL_CREATE_ELLIPSE_PROBE, stone.WebViewerAction.CREATE_ELLIPSE_PROBE)"
+                      data-toggle="tooltip" data-title="Ellipse probe">
+                <i class="fas fa-plus-circle"></i>
+              </button>
+            </div>
+
+            <div class="ng-scope inline-object">
+              <button class="wvButton--underline text-center"
+                      v-bind:class="{ 'active' : mouseTool == MOUSE_TOOL_CREATE_TEXT_ANNOTATION }"
+                      v-on:click="SetLeftMouseButtonAction(MOUSE_TOOL_CREATE_TEXT_ANNOTATION, stone.WebViewerAction.CREATE_TEXT_ANNOTATION)"
+                      data-toggle="tooltip" data-title="Add text annotation">
+                <i class="fas fa-comment-dots"></i>
               </button>
             </div>
 
@@ -539,7 +566,7 @@
               <button class="wvButton--underline text-center"
                       v-bind:class="{ 'active' : mouseTool == MOUSE_TOOL_REMOVE_MEASURE }"
                       v-on:click="SetLeftMouseButtonAction(MOUSE_TOOL_REMOVE_MEASURE, stone.WebViewerAction.REMOVE_MEASURE)"
-                      data-toggle="tooltip" data-title="Delete measurement">
+                      data-toggle="tooltip" data-title="Delete annotation">
                 <i class="fas fa-trash"></i>
               </button>
             </div>
--- a/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Mon Oct 31 08:22:31 2022 +0100
+++ b/Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp	Mon Oct 31 08:55:14 2022 +0100
@@ -143,7 +143,10 @@
     WebViewerAction_CreateCircle,
     WebViewerAction_CreateSegment,
     WebViewerAction_RemoveMeasure,
-    WebViewerAction_CreatePixelProbe
+    WebViewerAction_CreatePixelProbe,      // New in 2.4
+    WebViewerAction_CreateEllipseProbe,    // New in 2.4
+    WebViewerAction_CreateRectangleProbe,  // New in 2.4
+    WebViewerAction_CreateTextAnnotation   // New in 2.4
     };
   
 
@@ -171,6 +174,9 @@
     case WebViewerAction_CreateSegment:
     case WebViewerAction_RemoveMeasure:
     case WebViewerAction_CreatePixelProbe:
+    case WebViewerAction_CreateEllipseProbe:
+    case WebViewerAction_CreateRectangleProbe:
+    case WebViewerAction_CreateTextAnnotation:
       return OrthancStone::MouseAction_None;
 
     default:
@@ -3225,6 +3231,18 @@
               viewer_.stoneAnnotations_->SetActiveTool(OrthancStone::AnnotationsSceneLayer::Tool_PixelProbe);
               break;
 
+            case WebViewerAction_CreateEllipseProbe:
+              viewer_.stoneAnnotations_->SetActiveTool(OrthancStone::AnnotationsSceneLayer::Tool_EllipseProbe);
+              break;
+
+            case WebViewerAction_CreateRectangleProbe:
+              viewer_.stoneAnnotations_->SetActiveTool(OrthancStone::AnnotationsSceneLayer::Tool_RectangleProbe);
+              break;
+
+            case WebViewerAction_CreateTextAnnotation:
+              viewer_.stoneAnnotations_->SetActiveTool(OrthancStone::AnnotationsSceneLayer::Tool_TextAnnotation);
+              break;
+
             default:
               viewer_.stoneAnnotations_->SetActiveTool(OrthancStone::AnnotationsSceneLayer::Tool_Edit);
               break;
--- a/OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.h	Mon Oct 31 08:22:31 2022 +0100
+++ b/OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.h	Mon Oct 31 08:55:14 2022 +0100
@@ -42,7 +42,10 @@
       Tool_Angle,
       Tool_Circle,
       Tool_Remove,
-      Tool_PixelProbe
+      Tool_PixelProbe,
+      Tool_RectangleProbe,
+      Tool_EllipseProbe,
+      Tool_TextAnnotation
     };
 
   private: