changeset 400:518f680dbf2e

SliceViewerWidget::DisplayedSliceMessage
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 10 Nov 2018 09:58:45 +0100
parents 885e1ebd315c
children f1c769b3a5c2
files Framework/StoneEnumerations.h Framework/Widgets/SliceViewerWidget.cpp Framework/Widgets/SliceViewerWidget.h
diffstat 3 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/StoneEnumerations.h	Sat Nov 10 09:50:30 2018 +0100
+++ b/Framework/StoneEnumerations.h	Sat Nov 10 09:58:45 2018 +0100
@@ -129,6 +129,8 @@
 
     MessageType_DicomSeriesVolumeSlicer_FrameReady,      // pixels data of the frame have been loaded
 
+    MessageType_SliceViewerWidget_DisplayedSlice,  // The displayed slice has changed
+
     MessageType_SliceLoader_GeometryReady,
     MessageType_SliceLoader_GeometryError,
     MessageType_SliceLoader_ImageReady,
--- a/Framework/Widgets/SliceViewerWidget.cpp	Sat Nov 10 09:50:30 2018 +0100
+++ b/Framework/Widgets/SliceViewerWidget.cpp	Sat Nov 10 09:58:45 2018 +0100
@@ -525,6 +525,8 @@
 
       InvalidateAllLayers();   // TODO Removing this line avoid loading twice the image in WASM
     }
+
+    EmitMessage(DisplayedSliceMessage(*this, displayedSlice));
   }
 
 
--- a/Framework/Widgets/SliceViewerWidget.h	Sat Nov 10 09:50:30 2018 +0100
+++ b/Framework/Widgets/SliceViewerWidget.h	Sat Nov 10 09:58:45 2018 +0100
@@ -39,6 +39,26 @@
     typedef OriginMessage<MessageType_Widget_GeometryChanged, SliceViewerWidget> GeometryChangedMessage;
     typedef OriginMessage<MessageType_Widget_ContentChanged, SliceViewerWidget> ContentChangedMessage;
 
+    // TODO - Use this message in ReferenceLineSource
+    class DisplayedSliceMessage : public OriginMessage<MessageType_SliceViewerWidget_DisplayedSlice, SliceViewerWidget>
+    {
+    private:
+      const Slice& slice_;
+
+    public:
+      DisplayedSliceMessage(SliceViewerWidget& origin,
+                            const Slice& slice) :
+        OriginMessage(origin),
+        slice_(slice)
+      {
+      }
+
+      const Slice& GetSlice() const
+      {
+        return slice_;
+      }
+    };
+
   private:
     class Scene;