diff Framework/Radiography/RadiographyDicomLayer.cpp @ 1272:a989c7d46b9a

options to avoid multiple LayerEditedMessage
author Alain Mazy <alain@mazy.be>
date Mon, 03 Feb 2020 14:56:56 +0100
parents ab958fd99b07
children 7ec8fea061b9 1c7ae79c426d
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyDicomLayer.cpp	Tue Jan 21 16:52:37 2020 +0100
+++ b/Framework/Radiography/RadiographyDicomLayer.cpp	Mon Feb 03 14:56:56 2020 +0100
@@ -112,7 +112,7 @@
     BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this));
   }
 
-  void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image, double newPixelSpacingX, double newPixelSpacingY)   // Takes ownership
+  void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image, double newPixelSpacingX, double newPixelSpacingY, bool emitLayerEditedEvent)   // Takes ownership
   {
     std::auto_ptr<Orthanc::ImageAccessor> raii(image);
 
@@ -121,14 +121,17 @@
       throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
     }
 
-    SetSize(image->GetWidth(), image->GetHeight());
+    SetSize(image->GetWidth(), image->GetHeight(), false);
 
     source_ = raii;
     ApplyConverter();
 
     SetPixelSpacing(newPixelSpacingX, newPixelSpacingY, false);
 
-    BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this));
+    if (emitLayerEditedEvent)
+    {
+      BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this));
+    }
   }