diff Framework/Radiography/RadiographySceneReader.cpp @ 1195:bdc6837d5917 broker

integration mainline->broker
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 27 Nov 2019 14:34:34 +0100
parents d7887f88710f f417a0ae282b
children 37bc7f115f81
line wrap: on
line diff
--- a/Framework/Radiography/RadiographySceneReader.cpp	Sat Nov 23 11:57:03 2019 +0100
+++ b/Framework/Radiography/RadiographySceneReader.cpp	Wed Nov 27 14:34:34 2019 +0100
@@ -97,18 +97,8 @@
       }
       else if (jsonLayer["type"].asString() == "text")
       {
-        if (fontRegistry_ == NULL || fontRegistry_->GetSize() == 0)
-        {
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); // you must provide a FontRegistry if you need to re-create text layers.
-        }
-
         ReadLayerGeometry(geometry, jsonLayer);
-        const Orthanc::Font* font = fontRegistry_->FindFont(jsonLayer["fontName"].asString());
-        if (font == NULL) // if not found, take the first font in the registry
-        {
-          font = &(fontRegistry_->GetFont(0));
-        }
-        scene_.LoadText(*font, jsonLayer["text"].asString(), &geometry);
+        scene_.LoadText(jsonLayer["text"].asString(), jsonLayer["fontSize"].asUInt(), static_cast<uint8_t>(jsonLayer["foreground"].asUInt()), &geometry);
       }
       else if (jsonLayer["type"].asString() == "alpha")
       {
@@ -184,18 +174,8 @@
       }
       else if (jsonLayer["type"].asString() == "text")
       {
-        if (fontRegistry_ == NULL || fontRegistry_->GetSize() == 0)
-        {
-          throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); // you must provide a FontRegistry if you need to re-create text layers.
-        }
-
         ReadLayerGeometry(geometry, jsonLayer);
-        const Orthanc::Font* font = fontRegistry_->FindFont(jsonLayer["fontName"].asString());
-        if (font == NULL) // if not found, take the first font in the registry
-        {
-          font = &(fontRegistry_->GetFont(0));
-        }
-        scene_.LoadText(*font, jsonLayer["text"].asString(), &geometry);
+        scene_.LoadText(jsonLayer["text"].asString(), jsonLayer["fontSize"].asUInt(), static_cast<uint8_t>(jsonLayer["foreground"].asUInt()), &geometry);
       }
       else if (jsonLayer["type"].asString() == "alpha")
       {