changeset 1806:0840a25c6d41

removed hard-coded test in AnnotationsSceneLayer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 20 May 2021 17:11:10 +0200
parents de7cea710008
children 634ff8993f6a
files Applications/Samples/Sdl/SingleFrameViewer/SdlSimpleViewer.cpp OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.cpp OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.h
diffstat 3 files changed, 43 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Samples/Sdl/SingleFrameViewer/SdlSimpleViewer.cpp	Thu May 20 17:05:30 2021 +0200
+++ b/Applications/Samples/Sdl/SingleFrameViewer/SdlSimpleViewer.cpp	Thu May 20 17:11:10 2021 +0200
@@ -193,6 +193,17 @@
 #if SAMPLE_USE_ANNOTATIONS_LAYER == 1
         OrthancStone::AnnotationsSceneLayer annotations(10);
         annotations.SetActiveTool(OrthancStone::AnnotationsSceneLayer::Tool_Edit);
+
+        /*
+        annotations.AddSegmentAnnotation(OrthancStone::ScenePoint2D(0, 0),
+                                         OrthancStone::ScenePoint2D(100, 100));
+        annotations.AddAngleAnnotation(OrthancStone::ScenePoint2D(100, 50),
+                                       OrthancStone::ScenePoint2D(150, 40),
+                                       OrthancStone::ScenePoint2D(200, 50));
+        annotations.AddCircleAnnotation(OrthancStone::ScenePoint2D(50, 200),
+                                        OrthancStone::ScenePoint2D(100, 250));
+        */
+        
 #else
         ActiveTool activeTool = ActiveTool_None;
 
--- a/OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.cpp	Thu May 20 17:05:30 2021 +0200
+++ b/OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.cpp	Thu May 20 17:11:10 2021 +0200
@@ -1328,9 +1328,6 @@
     macroLayerIndex_(macroLayerIndex),
     polylineSubLayer_(0)  // dummy initialization
   {
-    annotations_.insert(new SegmentAnnotation(*this, true /* show label */, ScenePoint2D(0, 0), ScenePoint2D(100, 100)));
-    annotations_.insert(new AngleAnnotation(*this, ScenePoint2D(100, 50), ScenePoint2D(150, 40), ScenePoint2D(200, 50)));
-    annotations_.insert(new CircleAnnotation(*this, ScenePoint2D(50, 200), ScenePoint2D(100, 250)));
   }
     
 
@@ -1346,6 +1343,28 @@
   }
 
 
+  void AnnotationsSceneLayer::AddSegmentAnnotation(const ScenePoint2D& p1,
+                                                   const ScenePoint2D& p2)
+  {
+    annotations_.insert(new SegmentAnnotation(*this, true /* show label */, p1, p2));
+  }
+  
+
+  void AnnotationsSceneLayer::AddCircleAnnotation(const ScenePoint2D& p1,
+                                                  const ScenePoint2D& p2)
+  {
+    annotations_.insert(new CircleAnnotation(*this, p1, p2));
+  }
+  
+
+  void AnnotationsSceneLayer::AddAngleAnnotation(const ScenePoint2D& p1,
+                                                 const ScenePoint2D& p2,
+                                                 const ScenePoint2D& p3)
+  {
+    annotations_.insert(new AngleAnnotation(*this, p1, p2, p3));
+  }
+  
+
   void AnnotationsSceneLayer::Render(Scene2D& scene)
   {
     MacroSceneLayer* macro = NULL;
--- a/OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.h	Thu May 20 17:05:30 2021 +0200
+++ b/OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.h	Thu May 20 17:11:10 2021 +0200
@@ -99,6 +99,16 @@
       return activeTool_;
     }
 
+    void AddSegmentAnnotation(const ScenePoint2D& p1,
+                              const ScenePoint2D& p2);
+
+    void AddCircleAnnotation(const ScenePoint2D& p1,
+                             const ScenePoint2D& p2);
+
+    void AddAngleAnnotation(const ScenePoint2D& p1,
+                            const ScenePoint2D& p2,
+                            const ScenePoint2D& p3);
+
     void Render(Scene2D& scene);
     
     bool ClearHover();