]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInfoTextImageInteractor.cxx
4c82218a81b93af437b8d9dc1435f34583e9dd1f
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / vtkInfoTextImageInteractor.cxx
1 #include "vtkInfoTextImageInteractor.h"
2
3 #include "wxVtk2DBaseView.h"
4
5 //-------------------------------------------------------------------
6 //-------------------------------------------------------------------
7 //-------------------------------------------------------------------
8
9 vtkInfoTextImageInteractor::vtkInfoTextImageInteractor()
10 {
11 }
12
13 //-------------------------------------------------------------------
14 vtkInfoTextImageInteractor::~vtkInfoTextImageInteractor()
15 {
16 }
17
18 //-------------------------------------------------------------------
19
20 void vtkInfoTextImageInteractor::SetModelVtkInfoTextImage(vtkInfoTextImage *vtkinfotextimage)
21 {
22         _vtkinfotextimage       = vtkinfotextimage;
23 }
24
25 //-------------------------------------------------------------------
26 bool vtkInfoTextImageInteractor::OnMouseMove()
27 {
28         int X,Y;
29         wxVTKRenderWindowInteractor *wxVTKiren;
30         wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
31         wxVTKiren->GetEventPosition(X,Y);
32
33         /*JCP 14/05/2009
34          * int z = (int)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetVtkBaseData()->GetZ());*/
35         
36         double dxx,dyy,dzz;
37         double ixx,iyy,izz;
38
39                 int z = (int)((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->GetVtkBaseData()->GetZ();
40                 dxx=X;
41                 dyy=Y;
42                 dzz=z;
43         
44         _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->TransFromCoordScreenToWorld(dxx,dyy,dzz,true);
45
46         
47         GetVtkInfoTextImage()->PutWindowLevel();
48         GetVtkInfoTextImage()->PutColorLevel();
49
50         int tempext[6];
51         ((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->GetVtkBaseData()->GetImageData()->GetExtent(tempext);
52
53         if(tempext[0] <= dxx && dxx <= tempext[1] && tempext[2] <= dyy && dyy <= tempext[3])
54         {
55                 ixx=(int)(dxx+0.5);
56                 iyy=(int)(dyy+0.5);
57                 izz=(int)(dzz+0.0);
58                 GetVtkInfoTextImage()->PutPosition( ixx , iyy , izz );
59                 GetVtkInfoTextImage()->PutPixelIntensity( ixx , iyy , izz );
60         }
61
62         this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
63         return true;
64 }
65
66 //-------------------------------------------------------------------
67 vtkInfoTextImage *vtkInfoTextImageInteractor::GetVtkInfoTextImage()
68 {
69         return _vtkinfotextimage;
70 }