X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FvtkInteractorStyleBaseView.cxx;h=89aee7044a585291e338a9306db000adccbc0f12;hb=eb653a89f177ee41fda8720ec32bfbf3aa57255e;hp=f68e2afcf42e519440fa871a094830a7d2d8bcc4;hpb=a4ee3758aa0477f677fb981e2c4d6e29995e8db8;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView.cxx index f68e2af..89aee70 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView.cxx @@ -17,6 +17,9 @@ vtkInteractorStyleBaseView::vtkInteractorStyleBaseView() _refresh_waiting = false; _parent_refresh_waiting = false; _blockRefresh = false; + + //EED27Juillet2011 + SetMouseWheelMotionFactor(0.5); } //--------------------------------------------------------------------------- vtkInteractorStyleBaseView::~vtkInteractorStyleBaseView() @@ -76,10 +79,28 @@ void vtkInteractorStyleBaseView::OnRightDClick() // virtual CallLstInteractorStyleMaracas( 12 ); } //--------------------------------------------------------------------------- +//EED27Juillet2011 void vtkInteractorStyleBaseView::OnMouseWheel() // virtual { + printf("EED vtkInteractorStyleBaseView::OnMouseWheel\n"); CallLstInteractorStyleMaracas( 14 ); } + +void vtkInteractorStyleBaseView::OnMouseWheelForward() // virtual +{ + printf("EED.. vtkInteractorStyleBaseView::OnMouseWheelForward\n"); + CallLstInteractorStyleMaracas( 15 ); +} + +void vtkInteractorStyleBaseView::OnMouseWheelBackward() // virtual +{ + printf("EED.. vtkInteractorStyleBaseView::OnMouseWheelBackward\n"); + CallLstInteractorStyleMaracas( 16 ); +} + + + + //--------------------------------------------------------------------------- void vtkInteractorStyleBaseView::AddInteractorStyleMaracas(InteractorStyleMaracas* interactorStyleMaracas) { @@ -99,8 +120,9 @@ void vtkInteractorStyleBaseView::RemoveInteractorStyleMaracas(InteractorStyleMa { _lstInteractorStyleMaracas.erase(iter); removed = true; + } else { + iter++; } - iter++; } } //--------------------------------------------------------------------------- @@ -130,8 +152,13 @@ void vtkInteractorStyleBaseView::CallLstInteractorStyleMaracas(int type) for (i=0;iGetActive()==true){ + if (i < (int)_lstInteractorStyleMaracas.size() ) + { + intStyMar = _lstInteractorStyleMaracas[i]; + } else { + intStyMar=NULL; + } + if (intStyMar!=NULL && intStyMar->GetActive()==true){ if (type ==1) { // OnRightButtonDown if (intStyMar->OnRightButtonDown()==false) @@ -209,6 +236,8 @@ void vtkInteractorStyleBaseView::CallLstInteractorStyleMaracas(int type) i=size; } } + + //EED ????? 27Juillet2011 if (type==14) { // OnMouseWheel if (intStyMar->OnMouseWheel()==false) @@ -216,6 +245,22 @@ void vtkInteractorStyleBaseView::CallLstInteractorStyleMaracas(int type) i=size; } } + if (type==15) + { // OnMouseWheelForward + if (intStyMar->OnMouseWheelForward()==false) + { + i=size; + } + } + if (type==16) + { // OnMouseWheelBackward + if (intStyMar->OnMouseWheelBackward()==false) + { + i=size; + } + } + + } // if active } // for @@ -230,25 +275,27 @@ void vtkInteractorStyleBaseView::OnChar() // virtual //--------------------------------------------------------------------------- void vtkInteractorStyleBaseView::TransformCoordinate(double &X, double &Y, double &Z) { - vtkImageViewer2 *imageViewer = ((wxVtk2DBaseView*)GetWxVtk2DBaseView())->_imageViewer2XYZ->GetVtkImageViewer2(); + if(((wxVtk2DBaseView*)GetWxVtk2DBaseView())->_imageViewer2XYZ){ + vtkImageViewer2 *imageViewer = ((wxVtk2DBaseView*)GetWxVtk2DBaseView())->_imageViewer2XYZ->GetVtkImageViewer2(); - imageViewer->GetRenderer()->SetDisplayPoint((int)X, (int)Y, (int)Z); - imageViewer->GetRenderer()->DisplayToWorld(); - double fP[4]; - imageViewer->GetRenderer()->GetWorldPoint( fP ); + imageViewer->GetRenderer()->SetDisplayPoint((int)X, (int)Y, (int)Z); + imageViewer->GetRenderer()->DisplayToWorld(); + double fP[4]; + imageViewer->GetRenderer()->GetWorldPoint( fP ); - if ( fP[3] ){ - fP[0] /= fP[3]; - fP[1] /= fP[3]; - fP[2] /= fP[3]; - } + if ( fP[3] ){ + fP[0] /= fP[3]; + fP[1] /= fP[3]; + fP[2] /= fP[3]; + } -// EEDx5 - ((wxVtk2DBaseView*)GetWxVtk2DBaseView())->TransformCoordinate_spacing_ViewToModel(fP[0],fP[1],fP[2]); + // EEDx5 + ((wxVtk2DBaseView*)GetWxVtk2DBaseView())->TransformCoordinate_spacing_ViewToModel(fP[0],fP[1],fP[2]); - X=fP[0]; - Y=fP[1]; - Z=fP[2]; + X=fP[0]; + Y=fP[1]; + Z=fP[2]; + } } //--------------------------------------------------------------------------- void vtkInteractorStyleBaseView::SetwxVtkBaseView(wxVtkBaseView *wxvtkbaseview) @@ -322,9 +369,16 @@ void vtkInteractorStyleBaseView::EvaluateToRefresh() { _parent_refresh_waiting = false; wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh +//CPR 13/01/2010 this->_wxvtkbaseview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); - } - } + int i; + int size = _lstParentToReport.size(); + for(i = 0; iProcessEvent(newevent1); + }//for + }//if + }//if _blockRefresh } //--------------------------------------------------------------------------- void vtkInteractorStyleBaseView::BlockRefresh() @@ -335,4 +389,20 @@ void vtkInteractorStyleBaseView::BlockRefresh() void vtkInteractorStyleBaseView::UnBlockRefresh() { _blockRefresh=false; -} \ No newline at end of file +} + +wxEvtHandler* vtkInteractorStyleBaseView::GetParentToReport(int i) +{ + wxEvtHandler* parentToReport = NULL; + if(i>=0 && i<_lstParentToReport.size()) + { + parentToReport = _lstParentToReport[i]; + } + return parentToReport; + +} + +void vtkInteractorStyleBaseView::AddParentToReport(wxEvtHandler* parentToReport) +{ + _lstParentToReport.push_back(parentToReport); +}