diff Framework/Loaders/DicomStructureSetLoader.cpp @ 937:86ac61a040c9

Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 31 Jul 2019 10:24:09 +0200
parents 401808e7ff2e
children bd979d435e9d
line wrap: on
line diff
--- a/Framework/Loaders/DicomStructureSetLoader.cpp	Mon Jul 29 15:39:45 2019 +0200
+++ b/Framework/Loaders/DicomStructureSetLoader.cpp	Wed Jul 31 10:24:09 2019 +0200
@@ -58,6 +58,7 @@
         // All the referenced instances have been loaded, finalize the RT-STRUCT
         loader.content_->CheckReferencedSlices();
         loader.revision_++;
+        loader.SetStructuresReady();
       }
     }
   };
@@ -225,10 +226,12 @@
 
   DicomStructureSetLoader::DicomStructureSetLoader(IOracle& oracle,
                                                    IObservable& oracleObservable) :
+    IObservable(oracleObservable.GetBroker()),
     LoaderStateMachine(oracle, oracleObservable),
     revision_(0),
     countProcessedInstances_(0),
-    countReferencedInstances_(0)
+    countReferencedInstances_(0),
+    structuresReady_(false)
   {
   }
     
@@ -266,4 +269,17 @@
       return new Slice(*content_, revision_, cuttingPlane);
     }
   }
+
+  void DicomStructureSetLoader::SetStructuresReady()
+  {
+    ORTHANC_ASSERT(!structuresReady_);
+    structuresReady_ = true;
+    BroadcastMessage(DicomStructureSetLoader::StructuresReady(*this));
+  }
+
+  bool DicomStructureSetLoader::AreStructuresReady() const
+  {
+    return structuresReady_;
+  }
+
 }