diff --git a/src/src/Interaction/ActorDraggableInteractorStyle.cpp b/src/src/Interaction/ActorDraggableInteractorStyle.cpp index ed8bc59..7732f8f 100644 --- a/src/src/Interaction/ActorDraggableInteractorStyle.cpp +++ b/src/src/Interaction/ActorDraggableInteractorStyle.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -544,25 +543,7 @@ void ActorDraggableInteractorStyle::SetCurrentImageNumber(int i) { } void ActorDraggableInteractorStyle::DispatchEvent() { - switch (this->State) { - case VTKIS_SLICE: - if (this->HandleObservers) { - //double check - if (!this->CurrentImageSlice) { - this->SetCurrentImageNumber(this->CurrentImageNumber); - } - if (!this->CurrentImageSlice) return; - vtkImageSliceMapper *mapper = vtkImageSliceMapper::SafeDownCast(this->CurrentImageSlice->GetMapper()); - int slice[1] = {mapper ? mapper->GetSliceNumber() : -1}; - //鼠标滑动不一定能造成翻页!!!所以需要进行一次判定 - if (slice[0] != lastslice) { - this->InvokeEvent(DraggableStyleEvents::SlicedEvent, slice); - lastslice = slice[0]; - } - break; - } - } } diff --git a/src/src/Rendering/infinitiViewer.cxx b/src/src/Rendering/infinitiViewer.cxx index 06574ab..6bb5253 100644 --- a/src/src/Rendering/infinitiViewer.cxx +++ b/src/src/Rendering/infinitiViewer.cxx @@ -358,9 +358,6 @@ infinitiViewer::infinitiViewer() infinitiViewer::InstallPipeline(); - this->AddObserver(infinitiViewerEvents::SlicedEvent, this, &infinitiViewer::LoadMeasures); - this->AddObserver(infinitiViewerEvents::SlicedEvent, this, &infinitiViewer::updateTopLeftCornerInfo); - uintptr_t handler = reinterpret_cast(this); sprintf(SOP_UID, "%llu", handler); } @@ -611,8 +608,8 @@ void infinitiViewer::SetSlice(int slice) } this->Render(); - - this->InvokeEvent(infinitiViewerEvents::SlicedEvent, nullptr); + if (InteractorStyle) + InteractorStyle->InvokeEvent(ActorDraggableInteractorStyle::SlicedEvent, &this->Slice); } int infinitiViewer::GetSlice() { @@ -844,6 +841,7 @@ void infinitiViewer::InstallPipeline() this->InteractorStyle->AddObserver(ActorDraggableInteractorStyle::DraggableStyleEvents::DeleteMeasureEvent, this, &infinitiViewer::RemoveMeasures); this->InteractorStyle->AddObserver(ActorDraggableInteractorStyle::DraggableStyleEvents::SliceEvent, this, &infinitiViewer::ChangeSlice); this->InteractorStyle->AddObserver(ActorDraggableInteractorStyle::DraggableStyleEvents::SlicedEvent, this, &infinitiViewer::LoadMeasures); + InteractorStyle->AddObserver(ActorDraggableInteractorStyle::SlicedEvent, this, &infinitiViewer::updateTopLeftCornerInfo); //for convert vtkEvent to Qt signal this->InteractorStyle->AddObserver(ActorDraggableInteractorStyle::DraggableStyleEvents::SlicedEvent, this, &infinitiViewer::raiseEvent); diff --git a/src/src/Rendering/infinitiViewer.h b/src/src/Rendering/infinitiViewer.h index cec9ca8..46bbcbb 100644 --- a/src/src/Rendering/infinitiViewer.h +++ b/src/src/Rendering/infinitiViewer.h @@ -46,12 +46,6 @@ public: vtkTypeMacro(infinitiViewer, vtkObject); void PrintSelf(ostream& os, vtkIndent indent) override; - - enum infinitiViewerEvents - { - SlicedEvent = vtkCommand::UserEvent + 500, - }; - //vtkGetMacro(m_cornerAnnotation, vtkCornerAnnotation); vtkCornerAnnotation* GetvtkCornerAnnotation() { @@ -342,7 +336,7 @@ protected: vtkImageSliceMapper* ImageMapper; vtkImageSliceMapper* FusionMapper; vtkRenderWindowInteractor* Interactor; - ActorDraggableInteractorStyle* InteractorStyle; + ActorDraggableInteractorStyle* InteractorStyle = nullptr; vtkTextActor* OpacityActor; vtkCornerAnnotation* cornerAnnotation;