From: schaerer Date: Mon, 8 Mar 2010 07:49:50 +0000 (+0000) Subject: class name and file name should always match X-Git-Tag: v1.2.0~771 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=0ddd184a0431e279ec77860697d0418a6bf14179;p=clitk.git class name and file name should always match --- diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index 4aa48cf..74a0598 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -338,8 +338,10 @@ void vvSlicerManager::SetSlicerWindow(int i, vtkRenderWindow* RW) void vvSlicerManager::SetInteractorStyleNavigator(int i, vtkInteractorStyle* style) { - vvSlicerManagerCallback *smc = vvSlicerManagerCallback::New(); + vvSlicerManagerCommand *smc = vvSlicerManagerCommand::New(); + std::cerr << smc << ":" << i << " " << this << endl; smc->SM = this; + smc->SetSlicerNumber(i); mSlicers[i]->GetRenderWindow()->GetInteractor()->SetInteractorStyle(style); mSlicers[i]->GetRenderWindow()->GetInteractor()-> diff --git a/vv/vvSlicerManagerCommand.cxx b/vv/vvSlicerManagerCommand.cxx index 6e3298b..d9a1240 100644 --- a/vv/vvSlicerManagerCommand.cxx +++ b/vv/vvSlicerManagerCommand.cxx @@ -44,37 +44,32 @@ #include //------------------------------------------------------------------------------ -vvSlicerManagerCallback::vvSlicerManagerCallback() +vvSlicerManagerCommand::vvSlicerManagerCommand() { mStartSlicer = -1; + mSlicerNumber=-1; } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ //return the num of the current slicer if visible (-1 else) -int vvSlicerManagerCallback::FindSlicerNumber(vtkRenderWindow* renwin) +int vvSlicerManagerCommand::FindSlicerNumber(vtkRenderWindow* renwin) { - int result=-1; - for (int i = 0; i < SM->NumberOfSlicers(); i++) - { - if (SM->GetSlicer(i)->GetRenderWindow() == renwin - && SM->GetSlicer(i)->GetRenderer()->GetDraw()) - { - // DD(i); - result=i; - } - } - return result; + if (renwin != SM->GetSlicer(mSlicerNumber)->GetRenderWindow() || + !SM->GetSlicer(mSlicerNumber)->GetRenderer()->GetDraw()) + return -1; + else return mSlicerNumber; } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ -void vvSlicerManagerCallback::Execute(vtkObject *caller, +void vvSlicerManagerCommand::Execute(vtkObject *caller, unsigned long event, void *vtkNotUsed(callData)) { + std::cerr << this << ":" << mSlicerNumber << endl; //KeyPress event vvInteractorStyleNavigator *isi = dynamic_cast(caller); @@ -260,6 +255,7 @@ void vvSlicerManagerCallback::Execute(vtkObject *caller, if (KeyPress == "F1") { + std::cerr << this << ":" << this->SM->GetId() << "\t" << VisibleInWindow << endl; this->SM->GetSlicer(VisibleInWindow)->GetAnnotation()->SetText(2,"Sagital\n"); this->SM->GetSlicer(VisibleInWindow)->SetSliceOrientation(0); this->SM->UpdateSliceRange(VisibleInWindow); @@ -427,7 +423,7 @@ void vvSlicerManagerCallback::Execute(vtkObject *caller, //------------------------------------------------------------------------------ -void vvSlicerManagerCallback::Dolly(double factor, vtkRenderWindowInteractor *interactor) +void vvSlicerManagerCommand::Dolly(double factor, vtkRenderWindowInteractor *interactor) { int VisibleInWindow = this->FindSlicerNumber(interactor->GetRenderWindow()); vtkRenderer* renderer; @@ -505,7 +501,7 @@ void vvSlicerManagerCallback::Dolly(double factor, vtkRenderWindowInteractor *in //interactor->Render(); } -void vvSlicerManagerCallback::FlyToPosition(vtkRenderWindowInteractor *interactor,vvSlicer* slicer) +void vvSlicerManagerCommand::FlyToPosition(vtkRenderWindowInteractor *interactor,vvSlicer* slicer) { double flyFrom[3], flyTo[3]; double d[3], focalPt[3], position[3], positionFrom[3]; diff --git a/vv/vvSlicerManagerCommand.h b/vv/vvSlicerManagerCommand.h index e2c72d5..2152b9b 100644 --- a/vv/vvSlicerManagerCommand.h +++ b/vv/vvSlicerManagerCommand.h @@ -39,11 +39,11 @@ along with this program. If not, see . #include #include -class vvSlicerManagerCallback : public vtkCommand +class vvSlicerManagerCommand : public vtkCommand { public: - static vvSlicerManagerCallback *New() { - return new vvSlicerManagerCallback; + static vvSlicerManagerCommand *New() { + return new vvSlicerManagerCommand; } void Execute(vtkObject *caller, @@ -53,10 +53,11 @@ public: vvSlicerManager *SM; void Dolly(double factor, vtkRenderWindowInteractor *interactor); void FlyToPosition(vtkRenderWindowInteractor *interactor, vvSlicer* slicer); + void SetSlicerNumber(int slicer) {mSlicerNumber=slicer;} protected : - vvSlicerManagerCallback(); - ~vvSlicerManagerCallback() {} + vvSlicerManagerCommand(); + ~vvSlicerManagerCommand() {} private: @@ -66,6 +67,8 @@ private: double InitialLevel; int mStartSlicer; bool newLandmark; + ///The slicer this callback commands + int mSlicerNumber; }; #endif