1 /*=========================================================================
7 =========================================================================*/
9 /* ---------------------------------------------------------------------
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
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.
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
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 * ------------------------------------------------------------------------ */
33 * \brief Class bbtk::GBlackBoxController
37 #include "GBlackBoxController.h"
43 //=========================================================================
44 GBlackBoxController::GBlackBoxController()
49 //=========================================================================
50 GBlackBoxController::~GBlackBoxController()
53 //=========================================================================
55 bool GBlackBoxController::OnMouseMove()
58 if ( _vtkInteractorStyleBaseView!=NULL)
61 wxVTKRenderWindowInteractor *_wxVTKiren;
62 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
63 _wxVTKiren->GetEventPosition( X , Y );
65 int state = _view->getState();
73 if(state == NOTHING_HAPPENS)
75 if(_view->isPointInside(X,Y))
77 _view->setState(HIGHLIGHTED);
80 if( state==HIGHLIGHTED)
82 if(!_view->isPointInside(X,Y))
84 _view->setState(NOTHING_HAPPENS);
88 _model->notifyObservers(_id);
94 //=========================================================================
96 bool GBlackBoxController::OnLeftButtonDown()
99 if ( _vtkInteractorStyleBaseView!=NULL )
102 wxVTKRenderWindowInteractor *wxVTKiren;
103 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
104 wxVTKiren->GetEventPosition(X,Y);
106 int state = _view->getState();
109 if( state==HIGHLIGHTED)
111 _view->isStartDragging(true);
112 _view->setState(DRAG);
115 if( state == SELECTED)
117 if(_view->isPointInside(X,Y))
119 _view->isStartDragging(true);
120 _view->setState(DRAG);
124 _model->notifyObservers(_id);
129 //=========================================================================
131 bool GBlackBoxController::OnLeftButtonUp()
133 if ( _vtkInteractorStyleBaseView!=NULL )
136 wxVTKRenderWindowInteractor *wxVTKiren;
137 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
138 wxVTKiren->GetEventPosition(X,Y);
140 int state = _view->getState();
145 _view->setState(SELECTED);
150 _view->setState(SELECTED);
153 _model->notifyObservers(_id);
159 //=========================================================================
161 bool GBlackBoxController::OnLeftDClick()
163 if ( _vtkInteractorStyleBaseView!=NULL )
166 wxVTKRenderWindowInteractor *wxVTKiren;
167 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
168 wxVTKiren->GetEventPosition(X,Y);
170 _model->notifyObservers(_id);
175 //=========================================================================
177 bool GBlackBoxController::OnRightButtonDown()
179 if( _vtkInteractorStyleBaseView!= NULL )
182 wxVTKRenderWindowInteractor *wxVTKiren;
183 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
184 wxVTKiren->GetEventPosition(X, Y);
186 int state = _view->getState();
189 if( state == SELECTED)
191 _view->setState(NOTHING_HAPPENS);
194 _model->notifyObservers(_id);
199 //=========================================================================
201 } // EO namespace bbtk