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( ) {
92 crea::wxVTKRenderWindowInteractor *_wxVTKiren ;
93 _wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView( )->GetWxVTKRenderWindowInteractor( ) ;
94 _wxVTKiren->GetEventPosition( X , Y ) ;
95 int state = _view->getState( ) ;
99 if ( state == NOTHING_HAPPENS ) {
100 if ( _view->isPointInside( X , Y ) ) {
101 _view->setState( HIGHLIGHTED ) ;
104 if ( state == HIGHLIGHTED ) {
105 if ( !_view->isPointInside( X , Y ) ) {
106 _view->setState( NOTHING_HAPPENS ) ;
112 if ( state == POSSIBLE_CONNECTION ) {
113 if ( _view->isPointInside( X , Y ) ) {
114 _view->setState( SELECTED_POSSIBLE_CONNECTION ) ;
118 if ( state == SELECTED_POSSIBLE_CONNECTION ) {
119 if ( !_view->isPointInside( X , Y ) ) {
120 _view->setState( POSSIBLE_CONNECTION ) ;
126 _model->notifyObservers( getId( ) ) ;
132 //=========================================================================
134 bool GObjectController::OnLeftButtonDown( )//virtual
136 int state = _view->getState( ) ;
139 if ( state == HIGHLIGHTED ) {
140 _isLeftClickDown = true ;
141 _view->setState( SELECTED ) ;
146 //=========================================================================
148 bool GObjectController::OnLeftButtonUp( )//virtual
153 //=========================================================================
155 bool GObjectController::OnLeftDClick( )//virtual
161 //=========================================================================
163 bool GObjectController::OnMiddleButtonDown( )//virtual
168 //=========================================================================
170 void GObjectController::moveObject( int X , int Y ) {
171 _view->moveObject( X , Y ) ;
174 //=========================================================================
176 int GObjectController::getGObjectType( ) {
177 return _model->getGObjectType( ) ;
180 //=========================================================================
182 GObjectModel* GObjectController::getModel( ) {
186 //=========================================================================
188 vtkGObjectView* GObjectController::getView( ) {
192 //=========================================================================
194 int GObjectController::getId( ) {
195 return _model->getObjectId( ) ;
198 //=========================================================================
200 void GObjectController::setId( int id ) {
201 _model->setObjectId( id ) ;
204 //=========================================================================
206 std::string GObjectController::getStatusText( ) {
207 return _model->getStatusText( ) ;
210 //=========================================================================
212 void GObjectController::removeFromScene( ) {
213 _view->removeFromScene( ) ;
216 //=========================================================================
218 } // EO namespace bbtk