# HG changeset patch # User Alain Mazy # Date 1580738242 -3600 # Node ID 398ea4259e65ce0fc737cbbe879809ebf4a13db8 # Parent a989c7d46b9abe8dbbb6c8ecf68f0f1ca73a8600# Parent 2d8ab34c8c914a2f939353e95e4493ee3095f30b merge diff -r 2d8ab34c8c91 -r 398ea4259e65 Framework/Radiography/RadiographyDicomLayer.cpp --- a/Framework/Radiography/RadiographyDicomLayer.cpp Fri Jan 31 17:34:29 2020 +0100 +++ b/Framework/Radiography/RadiographyDicomLayer.cpp Mon Feb 03 14:57:22 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 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)); + } } diff -r 2d8ab34c8c91 -r 398ea4259e65 Framework/Radiography/RadiographyDicomLayer.h --- a/Framework/Radiography/RadiographyDicomLayer.h Fri Jan 31 17:34:29 2020 +0100 +++ b/Framework/Radiography/RadiographyDicomLayer.h Mon Feb 03 14:57:22 2020 +0100 @@ -80,7 +80,7 @@ void SetSourceImage(Orthanc::ImageAccessor* image); // Takes ownership - void SetSourceImage(Orthanc::ImageAccessor* image, double newPixelSpacingX, double newPixelSpacingY); // Takes ownership + void SetSourceImage(Orthanc::ImageAccessor* image, double newPixelSpacingX, double newPixelSpacingY, bool emitLayerEditedEvent = true); // Takes ownership const Orthanc::ImageAccessor* GetSourceImage() const {return source_.get();} // currently need this access to serialize scene in plain old data to send to a WASM worker diff -r 2d8ab34c8c91 -r 398ea4259e65 Framework/Radiography/RadiographyLayer.cpp --- a/Framework/Radiography/RadiographyLayer.cpp Fri Jan 31 17:34:29 2020 +0100 +++ b/Framework/Radiography/RadiographyLayer.cpp Mon Feb 03 14:57:22 2020 +0100 @@ -223,14 +223,19 @@ } void RadiographyLayer::SetSize(unsigned int width, - unsigned int height) + unsigned int height, + bool emitLayerEditedEvent) { hasSize_ = true; width_ = width; height_ = height; UpdateTransform(); - BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this)); + + if (emitLayerEditedEvent) + { + BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this)); + } } diff -r 2d8ab34c8c91 -r 398ea4259e65 Framework/Radiography/RadiographyLayer.h --- a/Framework/Radiography/RadiographyLayer.h Fri Jan 31 17:34:29 2020 +0100 +++ b/Framework/Radiography/RadiographyLayer.h Mon Feb 03 14:57:22 2020 +0100 @@ -298,7 +298,8 @@ } void SetSize(unsigned int width, - unsigned int height); + unsigned int height, + bool emitLayerEditedEvent = true); bool HasSize() const { diff -r 2d8ab34c8c91 -r 398ea4259e65 Framework/Radiography/RadiographyScene.cpp --- a/Framework/Radiography/RadiographyScene.cpp Fri Jan 31 17:34:29 2020 +0100 +++ b/Framework/Radiography/RadiographyScene.cpp Mon Feb 03 14:57:22 2020 +0100 @@ -229,6 +229,8 @@ LOG(INFO) << "Removing layer, there are now : " << layers_.size() << " layers"; + _OnLayerRemoved(); + BroadcastMessage(RadiographyScene::LayerRemovedMessage(*this, layerIndex)); } } diff -r 2d8ab34c8c91 -r 398ea4259e65 Framework/Radiography/RadiographyScene.h --- a/Framework/Radiography/RadiographyScene.h Fri Jan 31 17:34:29 2020 +0100 +++ b/Framework/Radiography/RadiographyScene.h Mon Feb 03 14:57:22 2020 +0100 @@ -173,6 +173,7 @@ protected: virtual void _RegisterLayer(RadiographyLayer* layer); + virtual void _OnLayerRemoved() {} void SetLayerIndex(RadiographyLayer* layer, size_t index) {