GConnectorController.cxx

Go to the documentation of this file.
00001 /*=========================================================================
00002 Program:   bbtk
00003 Module:    $RCSfile: GConnectorController.cxx,v $
00004 Language:  C++
00005 Date:      $Date: 2012/05/22 15:13:36 $
00006 Version:   $Revision: 1.8 $
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 "GConnectorController.h"
00038 
00039 #ifdef _DEBUG
00040 #define new DEBUG_NEW
00041 #endif
00042 namespace bbtk
00043 {
00044 
00045 
00046         //=========================================================================
00047         GConnectorController::GConnectorController()
00048         {
00049 
00050         }
00051 
00052         //=========================================================================
00053 
00054         GConnectorController::~GConnectorController()
00055         {
00056         }
00057 
00058         //=========================================================================
00059 
00060         bool GConnectorController::OnMouseMove()
00061         {
00062 
00063                 if ( _vtkInteractorStyleBaseView!=NULL)
00064                 {
00065                         int X,Y;
00066                         wxVTKRenderWindowInteractor *_wxVTKiren;
00067                         _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
00068                         _wxVTKiren->GetEventPosition( X , Y );
00069 
00070                         if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&(_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) )
00071                         {
00072                                 _controller->MouseMove(X,Y);
00073                         }
00074 
00075                 }
00076                 return true;
00077         }
00078 
00079         //=========================================================================
00080 
00081         bool GConnectorController::OnLeftButtonDown()
00082         {
00083 
00084                 if ( _vtkInteractorStyleBaseView!=NULL )
00085                 {
00086                         int X,Y;
00087                         wxVTKRenderWindowInteractor *wxVTKiren;
00088                         wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
00089                         wxVTKiren->GetEventPosition(X,Y);
00090 
00091                         _controller->SetKeyBoardMoving( false );
00092                         _controller->MouseClickLeft(X,Y);
00093 
00094                 }
00095                 return true;
00096         }
00097 
00098         //=========================================================================
00099 
00100         bool GConnectorController::OnLeftButtonUp()
00101         {
00102                 if( _vtkInteractorStyleBaseView!= NULL )
00103                 {
00104                         int X,Y;
00105                         wxVTKRenderWindowInteractor *wxVTKiren;
00106                         wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
00107                         wxVTKiren->GetEventPosition(X, Y);
00108 
00109                         _controller->MouseReleaseLeft(X,Y);
00110                         if(_controller->GetManualViewBaseContour()->GetSelected()==true)
00111                         {
00112                                 _view->setState(SELECTED);
00113                                 _model->notifyObservers(getId(),ADD_TO_SELECTED);
00114                         }
00115 
00116                 }
00117                 return true;
00118 
00119         }
00120 
00121         //=========================================================================
00122 
00123         bool GConnectorController::OnLeftDClick()
00124         {
00125 
00126                 if ( _vtkInteractorStyleBaseView!=NULL )
00127                 {
00128                         int X,Y;
00129                         wxVTKRenderWindowInteractor *wxVTKiren;
00130                         wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
00131                         wxVTKiren->GetEventPosition(X,Y);
00132 
00133                         _controller->MouseDLeft(X,Y);
00134 
00135                 }
00136                 return true;
00137         }
00138 
00139         //=========================================================================
00140 
00141         bool GConnectorController::OnRightButtonDown()
00142         {
00143                 if( _vtkInteractorStyleBaseView!= NULL )
00144                 {
00145                         int X,Y;
00146                         wxVTKRenderWindowInteractor *wxVTKiren;
00147                         wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
00148                         wxVTKiren->GetEventPosition(X, Y);
00149 
00150                         _controller->MouseClickRight(X,Y);
00151 
00152                 }
00153                 return true;
00154         }
00155 
00156         //=========================================================================
00157 
00158         bool GConnectorController::OnRightButtonUp()
00159         {
00160                 return true;
00161         }
00162 
00163         //=========================================================================
00164 
00165         bool GConnectorController::OnMiddleButtonDown()
00166         {
00167                 if ( _vtkInteractorStyleBaseView!=NULL )
00168                 {
00169                         int X,Y,Z=900;
00170                         wxVTKRenderWindowInteractor *wxVTKiren;
00171                         wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
00172                         wxVTKiren->GetEventPosition(X, Y);
00173                         _controller->GetManualViewBaseContour()->InitMove( X, Y,Z);
00174                 }
00175                 return true;
00176         }
00177         //=========================================================================
00178         bool GConnectorController::OnMiddleButtonUp()
00179         {
00180                 return true;
00181         }
00182 
00183         //=========================================================================
00184 
00185         manualConnectorContourController* GConnectorController::getManualContourController()
00186         {
00187                 return _controller;
00188         }
00189 
00190         //=========================================================================
00191 
00192         void GConnectorController::setManualContourController(manualConnectorContourController* controller)
00193         {
00194                 _controller = controller;
00195                 _controller->SetVtkInteractorStyleBaseView(_vtkInteractorStyleBaseView);
00196         }
00197 
00198         //=========================================================================
00199 
00200         void GConnectorController::removeFromScene()
00201         {
00202                 GConnectorModel *conMod = (GConnectorModel*)_model;
00203                 conMod->disconnectConnection();
00204 
00205                 _controller->SetEditable(false);
00206                 _controller->DeleteContour();
00207         }
00208 
00209         //=========================================================================
00210 
00211         void GConnectorController::endContourCreation()
00212         {
00213                 _controller->endContourCreation();
00214         }
00215 
00216         //=========================================================================
00217 
00218 }  // EO namespace bbtk
00219 
00220 // EOF
00221 

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