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 # ------------------------------------------------------------------------
27 /*=========================================================================
33 =========================================================================*/
35 /* ---------------------------------------------------------------------
37 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
38 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
40 * This software is governed by the CeCILL-B license under French law and
41 * abiding by the rules of distribution of free software. You can use,
42 * modify and/ or redistribute the software under the terms of the CeCILL-B
43 * license as circulated by CEA, CNRS and INRIA at the following URL
44 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
45 * or in the file LICENSE.txt.
47 * As a counterpart to the access to the source code and rights to copy,
48 * modify and redistribute granted by the license, users are provided only
49 * with a limited warranty and the software's author, the holder of the
50 * economic rights, and the successive licensors have only limited
53 * The fact that you are presently reading this means that you have had
54 * knowledge of the CeCILL-B license and that you accept its terms.
55 * ------------------------------------------------------------------------ */
59 * \brief Class bbtk::vtkGObjectView
63 #include "vtkGObjectView.h"
68 //=========================================================================
69 vtkGObjectView::vtkGObjectView()
72 // _borderObjectActor = NULL;
73 _fillObjectActor = NULL;
74 _isStartDragging = false;
76 _state = NOTHING_HAPPENS;
79 //=========================================================================
80 vtkGObjectView::~vtkGObjectView()
83 //=========================================================================
84 void vtkGObjectView::update(int idController,int command)//virtual
89 //=========================================================================
90 void vtkGObjectView::setModel(GObjectModel *model)
95 //=========================================================================
96 void vtkGObjectView::setBaseView(wxVtkBaseView* baseView)
101 //=========================================================================
102 void vtkGObjectView::initVtkObjects()
108 //=========================================================================
109 void vtkGObjectView::createVtkObjects() //virtual
114 //=========================================================================
115 void vtkGObjectView::updateColors() //virtual
120 //=========================================================================
121 void vtkGObjectView::addVtkActors()//virtual
123 _baseView->GetRenderer()->AddActor(_fillObjectActor);
124 //EED2017 _baseView->GetRenderer()->Render();
127 //=========================================================================
128 void vtkGObjectView::removeVtkActors()//virtual
130 _baseView->GetRenderer()->RemoveActor(_fillObjectActor);
131 //EED2017 _baseView->GetRenderer()->Render();
134 //=========================================================================
135 bool vtkGObjectView::isPointInside(int X,int Y) //virtual
137 // RaC In the actual version, always z=GPOSITION_Z
138 double xx=X,yy=Y,zz=GPOSITION_Z;
139 _baseView->TransCoordScreenToWorld(xx,yy,zz);
140 return _model->isPointInside(xx,yy,zz);
143 //=========================================================================
144 bool vtkGObjectView::isBoxInsideRectangle(int X1,int Y1, int X2, int Y2) //virtual
146 // RaC In the actual version, always z=GPOSITION_Z
147 double xx1=X1,yy1=Y1,zz1=GPOSITION_Z;
148 _baseView->TransCoordScreenToWorld(xx1,yy1,zz1);
149 double xx2=X2,yy2=Y2,zz2=GPOSITION_Z;
150 _baseView->TransCoordScreenToWorld(xx2,yy2,zz2);
152 return _model->isBoxInsideRectangle(xx1,yy1,zz1, xx2,yy2,zz2 );
155 //=========================================================================
156 void vtkGObjectView::moveObject(int X,int Y) //virtual
158 // RaC In the actual version, always z=GPOSITION_Z
159 double xx=X,yy=Y,zz=GPOSITION_Z;
160 _baseView->TransCoordScreenToWorld(xx,yy,zz);
163 _isStartDragging=false;
165 double xInic,yInic,zInic;
166 _model->getInicPoint(xInic,yInic,zInic);
170 _model->move(xx-dragDifX,yy-dragDifY,zz);
173 //=========================================================================
174 void vtkGObjectView::setStartDragging(bool param)
176 _isStartDragging=param;
181 //=========================================================================
182 void vtkGObjectView::setState(int state)
187 //=========================================================================
188 int vtkGObjectView::getState()
193 //=========================================================================
194 void vtkGObjectView::setRefreshWaiting()
196 ((vtkInteractorStyleBaseView*)_baseView->GetInteractorStyleBaseView())->SetRefresh_waiting();
199 //=========================================================================
200 void vtkGObjectView::removeFromScene()
206 //=========================================================================
209 } // EO namespace bbtk