diff Framework/Radiography/RadiographyScene.cpp @ 1204:b519c1c878f1 broker

integration mainline->broker
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 29 Nov 2019 21:24:29 +0100
parents 54cbffabdc45 ab958fd99b07
children 21c2b0eee53c
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyScene.cpp	Fri Nov 29 21:22:21 2019 +0100
+++ b/Framework/Radiography/RadiographyScene.cpp	Fri Nov 29 21:24:29 2019 +0100
@@ -240,6 +240,21 @@
     }
   }
 
+  RadiographyLayer& RadiographyScene::GetLayer(size_t layerIndex)
+  {
+    Layers::const_iterator found = layers_.find(layerIndex);
+
+    if (found == layers_.end())
+    {
+      throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
+    }
+    else
+    {
+      assert(found->second != NULL);
+      return *found->second;
+    }
+  }
+
   bool RadiographyScene::GetWindowing(float& center,
                                       float& width) const
   {
@@ -278,13 +293,27 @@
   }
 
 
+  RadiographyLayer& RadiographyScene::UpdateText(size_t layerIndex,
+                                                 const std::string& utf8,
+                                                 unsigned int fontSize,
+                                                 uint8_t foreground)
+  {
+    RadiographyTextLayer& textLayer = dynamic_cast<RadiographyTextLayer&>(GetLayer(layerIndex));
+    textLayer.SetText(utf8, fontSize, foreground);
+
+    BroadcastMessage(RadiographyScene::ContentChangedMessage(*this, textLayer));
+    BroadcastMessage(RadiographyScene::LayerEditedMessage(*this, textLayer));
+    return textLayer;
+  }
+
+
   RadiographyLayer& RadiographyScene::LoadText(const std::string& utf8,
                                                unsigned int fontSize,
                                                uint8_t foreground,
                                                RadiographyLayer::Geometry* geometry)
   {
     std::auto_ptr<RadiographyTextLayer>  alpha(new RadiographyTextLayer(*this));
-    alpha->LoadText(utf8, fontSize, foreground);
+    alpha->SetText(utf8, fontSize, foreground);
     if (geometry != NULL)
     {
       alpha->SetGeometry(*geometry);