changeset 1257:6af941a68472

RadiographyScene: virtual methods to use in derived class
author Alain Mazy <alain@mazy.be>
date Tue, 14 Jan 2020 12:05:01 +0100
parents 771913258728
children 9c20ae049669
files Framework/Radiography/RadiographyScene.cpp Framework/Radiography/RadiographyScene.h
diffstat 2 files changed, 19 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyScene.cpp	Thu Jan 09 15:24:43 2020 +0100
+++ b/Framework/Radiography/RadiographyScene.cpp	Tue Jan 14 12:05:01 2020 +0100
@@ -125,6 +125,17 @@
     }
   }
 
+  void RadiographyScene::_RegisterLayer(RadiographyLayer* layer)
+  {
+    std::auto_ptr<RadiographyLayer> raii(layer);
+
+    // LOG(INFO) << "Registering layer: " << countLayers_;
+
+    size_t index = nextLayerIndex_++;
+    raii->SetIndex(index);
+    layers_[index] = raii.release();
+  }
+
   RadiographyLayer& RadiographyScene::RegisterLayer(RadiographyLayer* layer)
   {
     if (layer == NULL)
@@ -132,13 +143,7 @@
       throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
     }
 
-    std::auto_ptr<RadiographyLayer> raii(layer);
-
-    // LOG(INFO) << "Registering layer: " << countLayers_;
-
-    size_t index = nextLayerIndex_++;
-    raii->SetIndex(index);
-    layers_[index] = raii.release();
+    _RegisterLayer(layer);
 
     BroadcastMessage(GeometryChangedMessage(*this, *layer));
     BroadcastMessage(ContentChangedMessage(*this, *layer));
--- a/Framework/Radiography/RadiographyScene.h	Thu Jan 09 15:24:43 2020 +0100
+++ b/Framework/Radiography/RadiographyScene.h	Tue Jan 14 12:05:01 2020 +0100
@@ -170,6 +170,13 @@
   protected:
     RadiographyLayer& RegisterLayer(RadiographyLayer* layer);
 
+    virtual void _RegisterLayer(RadiographyLayer* layer);
+
+    void SetLayerIndex(RadiographyLayer* layer, size_t index)
+    {
+      layer->SetIndex(index);
+    }
+
     virtual void OnTagsReceived(const Deprecated::OrthancApiClient::BinaryResponseReadyMessage& message);
 
     virtual void OnFrameReceived(const Deprecated::OrthancApiClient::BinaryResponseReadyMessage& message);