Remove infinitiViewerEvents use style SlicedEvent instead
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
#include <vtkPropCollection.h>
|
||||
#include <vtkAssemblyPath.h>
|
||||
#include <vtkRenderer.h>
|
||||
#include <vtkImageSliceMapper.h>
|
||||
#include <vtkCamera.h>
|
||||
#include <vtkCellPicker.h>
|
||||
#include <vtkCallbackCommand.h>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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<uintptr_t>(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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user