]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GObjectController.cxx
c4b0837ee52477062db225e0bfc1bba5e2f66a2c
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsVtkGUIEditorGraphic / GObjectController.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::GObjectController 
34 */
35
36
37 #include "GObjectController.h"
38
39 namespace bbtk
40 {
41
42
43         //=========================================================================
44         GObjectController::GObjectController()
45         {
46                 
47         }
48
49         //=========================================================================
50         GObjectController::~GObjectController()
51         {
52         }
53         //=========================================================================
54
55         void GObjectController::setModelAndView(GObjectModel* model, vtkGObjectView* view)
56         {
57                 _model = model;
58                 _view = view;
59         }
60         //=========================================================================
61
62 bool GObjectController::OnMouseMove()
63 {
64         cout<<"RaC GObjectController::OnMouseMove "<<endl;
65         if ( _vtkInteractorStyleBaseView!=NULL)
66         {
67                 int X,Y;
68                 wxVTKRenderWindowInteractor *_wxVTKiren;
69                 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
70                 _wxVTKiren->GetEventPosition( X , Y );
71
72                 int state  = _model->getState();
73                 
74                 //Evaluate new state
75                 if(state == CLICKED)
76                 {
77                         _model->setState(DRAG);
78                         //MoveObject(X,Y);
79                         
80                 }
81                 if(state == DRAG)
82                 {
83                         //MoveObject(X,Y);
84                         
85                 }
86                 if(state == NOTHING_HAPPENS)
87                 {
88                         if(_view->isPointInside(X,Y))
89                         {
90                                 _model->setState(HIGHLIGHTED);                  
91                         }                       
92                 }
93                 if(state==HIGHLIGHTED)
94                 {
95                         if(!_view->isPointInside(X,Y))
96                         {
97                                 _model->setState(NOTHING_HAPPENS);                      
98                         }
99                 }
100                 
101                 _view->update();
102         }
103         return true;
104 }
105 //=========================================================================
106 bool GObjectController::OnLeftButtonDown()
107 {
108         
109         if ( _vtkInteractorStyleBaseView!=NULL )
110         {
111                 int X,Y;
112                 wxVTKRenderWindowInteractor *wxVTKiren;
113                 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
114                 wxVTKiren->GetEventPosition(X,Y);
115
116                 //MouseClickLeft(X,Y);
117         }
118         return true;
119 }
120 //=========================================================================
121 bool GObjectController::OnLeftButtonUp()
122 {
123         if ( _vtkInteractorStyleBaseView!=NULL )
124         {
125                 int X,Y;
126                 wxVTKRenderWindowInteractor *wxVTKiren;
127                 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
128                 wxVTKiren->GetEventPosition(X,Y);
129                 //MouseReleaseLeft(X,Y);
130         }
131         return true;
132 }
133 //=========================================================================
134 bool GObjectController::OnLeftDClick()
135 {
136         if ( _vtkInteractorStyleBaseView!=NULL )
137         {
138                 int X,Y;
139                 wxVTKRenderWindowInteractor *wxVTKiren;
140                 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
141                 wxVTKiren->GetEventPosition(X,Y);
142
143                 //this->MouseDLeft(X,Y);
144         }
145         return true;
146 }
147 //=========================================================================
148 bool GObjectController::OnMiddleButtonDown()
149 {
150         if ( _vtkInteractorStyleBaseView!=NULL )
151         {
152                 int X,Y;
153                 wxVTKRenderWindowInteractor *wxVTKiren;
154                 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
155                 wxVTKiren->GetEventPosition(X,Y);
156                 //GetManualViewBaseContour()->InitMove( X, Y,GetZ());
157         }
158         return true;
159 }
160 //=========================================================================
161 bool GObjectController::OnMiddleButtonUp()
162 {
163         return true;
164 }
165 //=========================================================================
166 bool GObjectController::OnRightButtonDown()
167 {
168         if( _vtkInteractorStyleBaseView!= NULL )
169         {
170                 int X,Y;
171                 wxVTKRenderWindowInteractor *wxVTKiren;
172                 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
173                 wxVTKiren->GetEventPosition(X, Y);
174
175                 //SetCompleteCreation( true );
176                 //SetKeyBoardMoving( false );
177                 //this->GetManualContourModel()->SetCloseContour(true);
178                 //MouseClickRight(X,Y);
179         }
180         return true;
181 }
182 //=========================================================================
183 bool GObjectController::OnRightButtonUp()
184 {
185         return true;
186 }
187 //=========================================================================
188
189 }  // EO namespace bbtk
190
191 // EOF
192