2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
8 # This software is governed by the CeCILL-B license under French law and
9 # abiding by the rules of distribution of free software. You can use,
10 # modify and/ or redistribute the software under the terms of the CeCILL-B
11 # license as circulated by CEA, CNRS and INRIA at the following URL
12 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
13 # or in the file LICENSE.txt.
15 # As a counterpart to the access to the source code and rights to copy,
16 # modify and redistribute granted by the license, users are provided only
17 # with a limited warranty and the software's author, the holder of the
18 # economic rights, and the successive licensors have only limited
21 # The fact that you are presently reading this means that you have had
22 # knowledge of the CeCILL-B license and that you accept its terms.
23 # ------------------------------------------------------------------------
26 /*=========================================================================
32 =========================================================================*/
34 /* ---------------------------------------------------------------------
36 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
37 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
39 * This software is governed by the CeCILL-B license under French law and
40 * abiding by the rules of distribution of free software. You can use,
41 * modify and/ or redistribute the software under the terms of the CeCILL-B
42 * license as circulated by CEA, CNRS and INRIA at the following URL
43 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
44 * or in the file LICENSE.txt.
46 * As a counterpart to the access to the source code and rights to copy,
47 * modify and redistribute granted by the license, users are provided only
48 * with a limited warranty and the software's author, the holder of the
49 * economic rights, and the successive licensors have only limited
52 * The fact that you are presently reading this means that you have had
53 * knowledge of the CeCILL-B license and that you accept its terms.
54 * ------------------------------------------------------------------------ */
58 * \brief Class bbtk::GObjectController
62 #include "GObjectController.h"
70 //=========================================================================
72 GObjectController::GObjectController( ) {
76 //=========================================================================
78 GObjectController::~GObjectController( ) {
81 //=========================================================================
83 void GObjectController::setModelAndView( GObjectModel* model , vtkGObjectView* view ) {
88 //=========================================================================
90 bool GObjectController::OnMouseMove( )
93 crea::wxVTKRenderWindowInteractor *_wxVTKiren ;
94 _wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView( )->GetWxVTKRenderWindowInteractor( ) ;
95 _wxVTKiren->GetEventPosition( X , Y ) ;
96 int state = _view->getState( ) ;
99 if ( state == NOTHING_HAPPENS )
101 if ( _view->isPointInside( X , Y ) )
103 _view->setState( HIGHLIGHTED ) ;
106 if ( state == HIGHLIGHTED )
108 if ( !_view->isPointInside( X , Y ) )
110 _view->setState( NOTHING_HAPPENS ) ;
116 if ( state == POSSIBLE_CONNECTION )
118 if ( _view->isPointInside( X , Y ) )
120 _view->setState( SELECTED_POSSIBLE_CONNECTION ) ;
124 if ( state == SELECTED_POSSIBLE_CONNECTION )
126 if ( !_view->isPointInside( X , Y ) )
128 _view->setState( POSSIBLE_CONNECTION ) ;
134 _model->notifyObservers( getId( ) ) ;
140 //=========================================================================
142 bool GObjectController::OnLeftButtonDown( )//virtual
144 int state = _view->getState( ) ;
147 if ( state == HIGHLIGHTED ) {
148 _isLeftClickDown = true ;
149 _view->setState( SELECTED ) ;
154 //=========================================================================
156 bool GObjectController::OnLeftButtonUp( )//virtual
161 //=========================================================================
163 bool GObjectController::OnLeftDClick( )//virtual
169 //=========================================================================
171 bool GObjectController::OnMiddleButtonDown( )//virtual
176 //=========================================================================
178 void GObjectController::moveObject( int X , int Y ) {
179 _view->moveObject( X , Y ) ;
182 //=========================================================================
184 int GObjectController::getGObjectType( ) {
185 return _model->getGObjectType( ) ;
188 //=========================================================================
190 GObjectModel* GObjectController::getModel( ) {
194 //=========================================================================
196 vtkGObjectView* GObjectController::getView( ) {
200 //=========================================================================
202 int GObjectController::getId( ) {
203 return _model->getObjectId( ) ;
206 //=========================================================================
208 void GObjectController::setId( int id ) {
209 _model->setObjectId( id ) ;
212 //=========================================================================
214 std::string GObjectController::getStatusText( ) {
215 return _model->getStatusText( ) ;
218 //=========================================================================
220 void GObjectController::removeFromScene( ) {
221 _view->removeFromScene( ) ;
224 //=========================================================================
226 } // EO namespace bbtk