diff Framework/Volumes/VolumeSceneLayerSource.cpp @ 1324:4d8d642f7036 broker

Added a NullLayer scene layer type that allows "booking" a scene depth entry.
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 24 Mar 2020 16:24:26 +0100
parents 0da659f8579c
children 00c8322bbe69
line wrap: on
line diff
--- a/Framework/Volumes/VolumeSceneLayerSource.cpp	Tue Mar 24 16:17:03 2020 +0100
+++ b/Framework/Volumes/VolumeSceneLayerSource.cpp	Tue Mar 24 16:24:26 2020 +0100
@@ -21,6 +21,9 @@
 
 #include "VolumeSceneLayerSource.h"
 
+#include "../Scene2D/NullLayer.h"
+#include "../StoneException.h"
+
 #include <Core/OrthancException.h>
 
 namespace OrthancStone
@@ -54,6 +57,11 @@
     {
       throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
     }
+    ORTHANC_ASSERT(!scene_.HasLayer(layerDepth_));
+
+    // we need to book the scene layer depth by adding a dummy layer
+    std::unique_ptr<NullLayer> nullLayer(new NullLayer);
+    scene_.SetLayer(layerDepth_,nullLayer.release());
   }
 
   VolumeSceneLayerSource::~VolumeSceneLayerSource()