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()->
#include <cmath>
//------------------------------------------------------------------------------
-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<vvInteractorStyleNavigator *>(caller);
if (KeyPress == "F1")
{
+ std::cerr << this << ":" << this->SM->GetId() << "\t" << VisibleInWindow << endl;
this->SM->GetSlicer(VisibleInWindow)->GetAnnotation()->SetText(2,"Sagital\n<slice>");
this->SM->GetSlicer(VisibleInWindow)->SetSliceOrientation(0);
this->SM->UpdateSliceRange(VisibleInWindow);
//------------------------------------------------------------------------------
-void vvSlicerManagerCallback::Dolly(double factor, vtkRenderWindowInteractor *interactor)
+void vvSlicerManagerCommand::Dolly(double factor, vtkRenderWindowInteractor *interactor)
{
int VisibleInWindow = this->FindSlicerNumber(interactor->GetRenderWindow());
vtkRenderer* renderer;
//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];
#include <string>
#include <sstream>
-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,
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:
double InitialLevel;
int mStartSlicer;
bool newLandmark;
+ ///The slicer this callback commands
+ int mSlicerNumber;
};
#endif