]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GConnectorController.cxx
02c5fedd20a30d615400acb853ad710ebc03fe7d
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsVtkGUIEditorGraphic / GConnectorController.cxx
1 /*=========================================================================                                                                               
2 Program:   bbtk
3 Module:    $RCSfile$
4 Language:  C++
5 Date:      $Date$
6 Version:   $Revision$
7 =========================================================================*/
8
9 /* ---------------------------------------------------------------------
10
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
13 *
14 *  This software is governed by the CeCILL-B license under French law and 
15 *  abiding by the rules of distribution of free software. You can  use, 
16 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
17 *  license as circulated by CEA, CNRS and INRIA at the following URL 
18 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
19 *  or in the file LICENSE.txt.
20 *
21 *  As a counterpart to the access to the source code and  rights to copy,
22 *  modify and redistribute granted by the license, users are provided only
23 *  with a limited warranty  and the software's author,  the holder of the
24 *  economic rights,  and the successive licensors  have only  limited
25 *  liability. 
26 *
27 *  The fact that you are presently reading this means that you have had
28 *  knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */                                                                         
30
31 /**
32 *  \file 
33 *  \brief Class bbtk::GConnectorController 
34 */
35
36
37 #include "GConnectorController.h"
38
39 namespace bbtk
40 {
41
42
43         //=========================================================================
44         GConnectorController::GConnectorController()
45         {
46
47         }
48
49         //=========================================================================
50
51         GConnectorController::~GConnectorController()
52         {
53         }
54
55         //=========================================================================
56
57         bool GConnectorController::OnMouseMove()
58         {
59                 
60                 if ( _vtkInteractorStyleBaseView!=NULL)
61                 {
62                         int X,Y;
63                         wxVTKRenderWindowInteractor *_wxVTKiren;
64                         _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
65                         _wxVTKiren->GetEventPosition( X , Y );
66
67                         if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&(_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ) 
68                         {
69                                 _controller->MouseMove(X,Y);
70                         }
71                         
72                 }
73                 return true;
74         }
75
76         //=========================================================================
77         
78         bool GConnectorController::OnLeftButtonDown()
79         {
80                 
81                 if ( _vtkInteractorStyleBaseView!=NULL )
82                 {
83                         int X,Y;
84                         wxVTKRenderWindowInteractor *wxVTKiren;
85                         wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
86                         wxVTKiren->GetEventPosition(X,Y);
87                         
88                         _controller->SetKeyBoardMoving( false );
89                         _controller->MouseClickLeft(X,Y);
90
91                 }
92                 return true;
93         }
94
95         //=========================================================================
96
97         bool GConnectorController::OnLeftButtonUp()
98         {
99                 if( _vtkInteractorStyleBaseView!= NULL )
100                 {
101                         int X,Y;
102                         wxVTKRenderWindowInteractor *wxVTKiren;
103                         wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
104                         wxVTKiren->GetEventPosition(X, Y);
105
106                         _controller->MouseReleaseLeft(X,Y);
107                         
108                 }
109                 return true;
110
111         }
112         
113         //=========================================================================
114         
115         bool GConnectorController::OnLeftDClick()
116         {
117
118                 if ( _vtkInteractorStyleBaseView!=NULL )
119                 {
120                         int X,Y;
121                         wxVTKRenderWindowInteractor *wxVTKiren;
122                         wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
123                         wxVTKiren->GetEventPosition(X,Y);
124
125                         _controller->MouseDLeft(X,Y);
126
127                 }
128                 return true;
129         }
130         
131         //=========================================================================
132         
133         bool GConnectorController::OnRightButtonDown()
134         {
135                 if( _vtkInteractorStyleBaseView!= NULL )
136                 {
137                         int X,Y;
138                         wxVTKRenderWindowInteractor *wxVTKiren;
139                         wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
140                         wxVTKiren->GetEventPosition(X, Y);
141                         
142                         _controller->MouseClickRight(X,Y);
143                         
144                 }
145                 return true;
146         }
147                 
148         //=========================================================================
149
150         bool GConnectorController::OnRightButtonUp()
151         {
152                 return true;
153         }
154
155         //=========================================================================
156
157         bool GConnectorController::OnMiddleButtonDown()
158         {
159                 if ( _vtkInteractorStyleBaseView!=NULL )
160                 {
161                         int X,Y,Z=900;
162                         wxVTKRenderWindowInteractor *wxVTKiren;
163                         wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
164                         wxVTKiren->GetEventPosition(X, Y);
165                         _controller->GetManualViewBaseContour()->InitMove( X, Y,Z);
166                 }
167                 return true;
168         }
169         //=========================================================================
170         bool GConnectorController::OnMiddleButtonUp()
171         {
172                 return true;
173         }
174
175         //=========================================================================
176
177         manualContourControler* GConnectorController::getManualContourController()
178         {
179                 return _controller;
180         }
181
182         //=========================================================================
183         
184         void GConnectorController::setManualContourController(manualContourControler* controller)
185         {
186                 _controller = controller;
187                 _controller->SetVtkInteractorStyleBaseView(_vtkInteractorStyleBaseView);
188         }
189
190         //=========================================================================
191
192 }  // EO namespace bbtk
193
194 // EOF
195