1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 #include "vtkmyPWCallback_3DPointWidget.h"
27 #include "vtkInteractorStyleBaseView.h"
29 //-------------------------------------------------------------------
30 //-------------------------------------------------------------------
31 //-------------------------------------------------------------------
32 void vtkmyPWCallback_3DPointWidget::Execute(vtkObject *caller, unsigned long, void*)
36 double delta = 0.000000001;
38 vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)_wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetInteractorStyleBaseView();
40 if (caller==_pointWidget)
42 _pointWidget->GetPosition(p);
44 if (caller==_planeWidget)
46 _planeWidget->GetCenter(p);
47 _planeWidget->GetNormal(n);
48 _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetNormal(n[0],n[1],n[2]);
49 //EED 2017-01-01 Migration VTK7
50 #if VTK_MAJOR_VERSION <= 5
53 _planeWidget->GetPolyData(_vtkplane);
60 _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData()->GetSpacing(spc);
66 if ( (fabs(n[0]-_backNormal[0])>delta) || (fabs(n[1]-_backNormal[1])>delta) || (fabs(n[2]-_backNormal[2])>delta) )
68 _backNormal[0] = n[0];
69 _backNormal[1] = n[1];
70 _backNormal[2] = n[2];
71 isbv->SetParent_refresh_waiting();
76 double tx = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetX();
77 double ty = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetY();
78 double tz = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetZ();
81 if ( (fabs(tx-p[0])>delta) || (fabs(ty-p[1])>delta) || (fabs(tz-p[2])>delta) )
83 _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetX( p[0] );
84 _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetY( p[1] );
85 _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetZ( p[2] );
86 vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)_wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetInteractorStyleBaseView();
88 isbv->vtkInteractorStyleBaseView::OnLeftButtonDown();
89 isbv->SetParent_refresh_waiting();
90 isbv->vtkInteractorStyleBaseView::OnMouseMove();
91 isbv->UnBlockRefresh();
93 isbv->EvaluateToRefresh();
95 //-------------------------------------------------------------------
96 void vtkmyPWCallback_3DPointWidget::SetWxVtkMPR3DView( wxVtkMPR3DView *wxvtkmpr3Dview )
98 _wxvtkmpr3Dview=wxvtkmpr3Dview;
100 //-------------------------------------------------------------------
101 void vtkmyPWCallback_3DPointWidget::SetVtkPointWidget( vtkPointWidget *pointWidget )
103 _pointWidget=pointWidget;
105 //-------------------------------------------------------------------
106 void vtkmyPWCallback_3DPointWidget::SetVtkPlaneWidget( vtkPlaneWidget *planeWidget )
108 _planeWidget=planeWidget;
111 //-------------------------------------------------------------------
112 void vtkmyPWCallback_3DPointWidget::SetVtkPolyData( vtkPolyData *vtkplane)
117 //-------------------------------------------------------------------
118 void vtkmyPWCallback_3DPointWidget::SetVtkProbeFilter( vtkProbeFilter *probe)