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::GObjectController
37 #include "GObjectController.h"
43 //=========================================================================
44 GObjectController::GObjectController()
49 //=========================================================================
50 GObjectController::~GObjectController()
53 //=========================================================================
55 void GObjectController::setModelAndView(GObjectModel* model, vtkGObjectView* view)
60 //=========================================================================
62 bool GObjectController::OnMouseMove()
64 cout<<"RaC GObjectController::OnMouseMove "<<endl;
65 if ( _vtkInteractorStyleBaseView!=NULL)
68 wxVTKRenderWindowInteractor *_wxVTKiren;
69 _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
70 _wxVTKiren->GetEventPosition( X , Y );
72 int state = _model->getState();
77 _model->setState(DRAG);
86 if(state == NOTHING_HAPPENS)
88 if(_view->isPointInside(X,Y))
90 _model->setState(HIGHLIGHTED);
93 if(state==HIGHLIGHTED)
95 if(!_view->isPointInside(X,Y))
97 _model->setState(NOTHING_HAPPENS);
105 //=========================================================================
106 bool GObjectController::OnLeftButtonDown()
109 if ( _vtkInteractorStyleBaseView!=NULL )
112 wxVTKRenderWindowInteractor *wxVTKiren;
113 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
114 wxVTKiren->GetEventPosition(X,Y);
116 //MouseClickLeft(X,Y);
120 //=========================================================================
121 bool GObjectController::OnLeftButtonUp()
123 if ( _vtkInteractorStyleBaseView!=NULL )
126 wxVTKRenderWindowInteractor *wxVTKiren;
127 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
128 wxVTKiren->GetEventPosition(X,Y);
129 //MouseReleaseLeft(X,Y);
133 //=========================================================================
134 bool GObjectController::OnLeftDClick()
136 if ( _vtkInteractorStyleBaseView!=NULL )
139 wxVTKRenderWindowInteractor *wxVTKiren;
140 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
141 wxVTKiren->GetEventPosition(X,Y);
143 //this->MouseDLeft(X,Y);
147 //=========================================================================
148 bool GObjectController::OnMiddleButtonDown()
150 if ( _vtkInteractorStyleBaseView!=NULL )
153 wxVTKRenderWindowInteractor *wxVTKiren;
154 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
155 wxVTKiren->GetEventPosition(X,Y);
156 //GetManualViewBaseContour()->InitMove( X, Y,GetZ());
160 //=========================================================================
161 bool GObjectController::OnMiddleButtonUp()
165 //=========================================================================
166 bool GObjectController::OnRightButtonDown()
168 if( _vtkInteractorStyleBaseView!= NULL )
171 wxVTKRenderWindowInteractor *wxVTKiren;
172 wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
173 wxVTKiren->GetEventPosition(X, Y);
175 //SetCompleteCreation( true );
176 //SetKeyBoardMoving( false );
177 //this->GetManualContourModel()->SetCloseContour(true);
178 //MouseClickRight(X,Y);
182 //=========================================================================
183 bool GObjectController::OnRightButtonUp()
187 //=========================================================================
189 } // EO namespace bbtk