GObjectController.cxx

Go to the documentation of this file.
00001 /*=========================================================================
00002 Program:   bbtk
00003 Module:    $RCSfile: GObjectController.cxx,v $
00004 Language:  C++
00005 Date:      $Date: 2012/05/23 15:57:13 $
00006 Version:   $Revision: 1.17 $
00007 =========================================================================*/
00008 
00009 /* ---------------------------------------------------------------------
00010 
00011  * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
00012  * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
00013  *
00014  *  This software is governed by the CeCILL-B license under French law and
00015  *  abiding by the rules of distribution of free software. You can  use,
00016  *  modify and/ or redistribute the software under the terms of the CeCILL-B
00017  *  license as circulated by CEA, CNRS and INRIA at the following URL
00018  *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
00019  *  or in the file LICENSE.txt.
00020  *
00021  *  As a counterpart to the access to the source code and  rights to copy,
00022  *  modify and redistribute granted by the license, users are provided only
00023  *  with a limited warranty  and the software's author,  the holder of the
00024  *  economic rights,  and the successive licensors  have only  limited
00025  *  liability.
00026  *
00027  *  The fact that you are presently reading this means that you have had
00028  *  knowledge of the CeCILL-B license and that you accept its terms.
00029  * ------------------------------------------------------------------------ */
00030 
00037 #include "GObjectController.h"
00038 
00039 
00040 #ifdef _DEBUG
00041 #define new DEBUG_NEW
00042 #endif
00043 namespace bbtk
00044 {
00045     //=========================================================================
00046 
00047     GObjectController::GObjectController( ) {
00048 
00049     }
00050 
00051     //=========================================================================
00052 
00053     GObjectController::~GObjectController( ) {
00054     }
00055 
00056     //=========================================================================
00057 
00058     void GObjectController::setModelAndView( GObjectModel* model , vtkGObjectView* view ) {
00059         _model = model ;
00060         _view = view ;
00061     }
00062 
00063     //=========================================================================
00064 
00065     bool GObjectController::OnMouseMove( ) {
00066         int X , Y ;
00067         wxVTKRenderWindowInteractor *_wxVTKiren ;
00068         _wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView( )->GetWxVTKRenderWindowInteractor( ) ;
00069         _wxVTKiren->GetEventPosition( X , Y ) ;
00070         int state = _view->getState( ) ;
00071 
00072 
00073         //Evaluate new state
00074         if ( state == NOTHING_HAPPENS ) {
00075             if ( _view->isPointInside( X , Y ) ) {
00076                 _view->setState( HIGHLIGHTED ) ;
00077             }
00078         }
00079         if ( state == HIGHLIGHTED ) {
00080             if ( !_view->isPointInside( X , Y ) ) {
00081                 _view->setState( NOTHING_HAPPENS ) ;
00082             }
00083         }
00084 
00085         // JGRR & CM WH
00086 
00087         if ( state == POSSIBLE_CONNECTION ) {
00088             if ( _view->isPointInside( X , Y ) ) {
00089                 _view->setState( SELECTED_POSSIBLE_CONNECTION ) ;
00090             }
00091         }
00092 
00093         if ( state == SELECTED_POSSIBLE_CONNECTION ) {
00094             if ( !_view->isPointInside( X , Y ) ) {
00095                 _view->setState( POSSIBLE_CONNECTION ) ;
00096             }
00097         }
00098 
00099         // EO JGRR & CM WH
00100 
00101         _model->notifyObservers( getId( ) ) ;
00102 
00103 
00104         return true ;
00105     }
00106 
00107     //=========================================================================
00108 
00109     bool GObjectController::OnLeftButtonDown( )//virtual
00110     {
00111         int state = _view->getState( ) ;
00112 
00113         //Evaluate new state
00114         if ( state == HIGHLIGHTED ) {
00115             _isLeftClickDown = true ;
00116             _view->setState( SELECTED ) ;
00117         }
00118         return true ;
00119     }
00120 
00121     //=========================================================================
00122 
00123     bool GObjectController::OnLeftButtonUp( )//virtual
00124     {
00125         return true ;
00126     }
00127 
00128     //=========================================================================
00129 
00130     bool GObjectController::OnLeftDClick( )//virtual
00131     {
00132 
00133         return true ;
00134     }
00135 
00136     //=========================================================================
00137 
00138     bool GObjectController::OnMiddleButtonDown( )//virtual
00139     {
00140         return true ;
00141     }
00142 
00143     //=========================================================================
00144 
00145     void GObjectController::moveObject( int X , int Y ) {
00146         _view->moveObject( X , Y ) ;
00147     }
00148 
00149     //=========================================================================
00150 
00151     int GObjectController::getGObjectType( ) {
00152         return _model->getGObjectType( ) ;
00153     }
00154 
00155     //=========================================================================
00156 
00157     GObjectModel* GObjectController::getModel( ) {
00158         return _model ;
00159     }
00160 
00161     //=========================================================================
00162 
00163     vtkGObjectView* GObjectController::getView( ) {
00164         return _view ;
00165     }
00166 
00167     //=========================================================================
00168 
00169     int GObjectController::getId( ) {
00170         return _model->getObjectId( ) ;
00171     }
00172 
00173     //=========================================================================
00174 
00175     void GObjectController::setId( int id ) {
00176         _model->setObjectId( id ) ;
00177     }
00178 
00179     //=========================================================================
00180 
00181     std::string GObjectController::getStatusText( ) {
00182         return _model->getStatusText( ) ;
00183     }
00184 
00185     //=========================================================================
00186 
00187     void GObjectController::removeFromScene( ) {
00188         _view->removeFromScene( ) ;
00189     }
00190 
00191     //=========================================================================
00192 
00193 } // EO namespace bbtk
00194 
00195 // EOF
00196 

Generated on Thu May 31 15:12:19 2012 for bbtkGEditor by  doxygen 1.5.7.1