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::GConnectorController
37 #include "GConnectorController.h"
43 //=========================================================================
44 GConnectorController::GConnectorController()
49 //=========================================================================
51 GConnectorController::~GConnectorController()
55 //=========================================================================
57 bool GConnectorController::OnMouseMove()
60 if ( _vtkInteractorStyleBaseView!=NULL)
63 wxVTKRenderWindowInteractor *_wxVTKiren;
64 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
65 _wxVTKiren->GetEventPosition( X , Y );
67 if ( (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&(_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) )
69 _controller->MouseMove(X,Y);
76 //=========================================================================
78 bool GConnectorController::OnLeftButtonDown()
81 if ( _vtkInteractorStyleBaseView!=NULL )
84 wxVTKRenderWindowInteractor *wxVTKiren;
85 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
86 wxVTKiren->GetEventPosition(X,Y);
88 _controller->SetKeyBoardMoving( false );
89 _controller->MouseClickLeft(X,Y);
95 //=========================================================================
97 bool GConnectorController::OnLeftButtonUp()
99 if( _vtkInteractorStyleBaseView!= NULL )
102 wxVTKRenderWindowInteractor *wxVTKiren;
103 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
104 wxVTKiren->GetEventPosition(X, Y);
106 _controller->MouseReleaseLeft(X,Y);
107 if(_controller->GetManualViewBaseContour()->GetSelected()==true)
109 cout<<"RaC GConnectorController::OnLeftButtonUp GetSelected():"<<_controller->GetManualViewBaseContour()->GetSelected() <<endl;
110 _view->setState(SELECTED);
111 _model->notifyObservers(getId(),ADD_TO_SELECTED);
119 //=========================================================================
121 bool GConnectorController::OnLeftDClick()
124 if ( _vtkInteractorStyleBaseView!=NULL )
127 wxVTKRenderWindowInteractor *wxVTKiren;
128 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
129 wxVTKiren->GetEventPosition(X,Y);
131 _controller->MouseDLeft(X,Y);
137 //=========================================================================
139 bool GConnectorController::OnRightButtonDown()
141 if( _vtkInteractorStyleBaseView!= NULL )
144 wxVTKRenderWindowInteractor *wxVTKiren;
145 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
146 wxVTKiren->GetEventPosition(X, Y);
148 _controller->MouseClickRight(X,Y);
154 //=========================================================================
156 bool GConnectorController::OnRightButtonUp()
161 //=========================================================================
163 bool GConnectorController::OnMiddleButtonDown()
165 if ( _vtkInteractorStyleBaseView!=NULL )
168 wxVTKRenderWindowInteractor *wxVTKiren;
169 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
170 wxVTKiren->GetEventPosition(X, Y);
171 _controller->GetManualViewBaseContour()->InitMove( X, Y,Z);
175 //=========================================================================
176 bool GConnectorController::OnMiddleButtonUp()
181 //=========================================================================
183 manualConnectorContourController* GConnectorController::getManualContourController()
188 //=========================================================================
190 void GConnectorController::setManualContourController(manualConnectorContourController* controller)
192 _controller = controller;
193 _controller->SetVtkInteractorStyleBaseView(_vtkInteractorStyleBaseView);
196 //=========================================================================
198 void GConnectorController::removeFromScene()
200 GConnectorModel *conMod = (GConnectorModel*)_model;
201 conMod->disconnectConnection();
203 _controller->SetEditable(false);
204 _controller->DeleteContour();
207 //=========================================================================
209 } // EO namespace bbtk