1 #include "manualContour3VControler.h"
3 // ----------------------------------------------------------------------------
4 // ----------------------------------------------------------------------------
5 // ----------------------------------------------------------------------------
12 manualContour3VControler::manualContour3VControler(int type)
17 // _manViewBaseCont1 = NULL;
18 // _manViewBaseCont2 = NULL;
19 // _manViewBaseCont3 = NULL;
21 //----------------------------------------------------------------------------
22 manualContour3VControler::~manualContour3VControler()
26 // ----------------------------------------------------------------------------
27 manualContour3VControler * manualContour3VControler :: Clone() // virtual
29 manualContour3VControler * clone = new manualContour3VControler( this->GetType() );
30 CopyAttributesTo(clone);
34 // ---------------------------------------------------------------------------
35 void manualContour3VControler::CopyAttributesTo( manualContour3VControler * cloneObject)
38 manualContourControler::CopyAttributesTo(cloneObject);
40 cloneObject->SetVtkMPRBaseData( this->GetVtkMPRBaseData() );
42 // Remember to add ManualViewBaseContour with "AddManualViewBaseContour"
45 // ----------------------------------------------------------------------------
46 int manualContour3VControler::GetType()
51 // ----------------------------------------------------------------------------
52 void manualContour3VControler::AddPoint_Others()
54 manualViewBaseContour *mvbc;
55 int i,size=this->_lstManualViewBaseContour.size();
56 for ( i = 0 ; i < size ; i++ )
58 mvbc = _lstManualViewBaseContour[i];
63 // if (_manViewBaseCont1!=NULL){
64 // _manViewBaseCont1->AddPoint();
65 // _manViewBaseCont2->AddPoint();
66 // _manViewBaseCont3->AddPoint();
67 // this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
70 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
72 // ----------------------------------------------------------------------------
73 void manualContour3VControler::AddPoint( int x, int y, int z ) // virtual
76 z=(int)_vtkmprbasedata->GetZ();
77 if (GetManualContourModel()!=NULL){
81 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
85 xx=_vtkmprbasedata->GetX();
90 yy=_vtkmprbasedata->GetY();
94 /*int id = */ GetManualContourModel()->AddPoint(xx,yy,zz); // JPRx
95 GetManualViewBaseContour()->AddPoint();
101 // ----------------------------------------------------------------------------
102 void manualContour3VControler::InsertPoint_Others(int id)
105 manualViewBaseContour *mvbc;
106 int i,size=this->_lstManualViewBaseContour.size();
107 for ( i = 0 ; i < size ; i++ )
109 mvbc = _lstManualViewBaseContour[i];
110 mvbc->InsertPoint(id);
114 if (_manViewBaseCont1!=NULL){
115 _manViewBaseCont1->InsertPoint(id);
116 _manViewBaseCont2->InsertPoint(id);
117 _manViewBaseCont3->InsertPoint(id);
118 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
122 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
125 // ----------------------------------------------------------------------------
126 void manualContour3VControler::InsertPoint(int x, int y, int z)
129 if (GetManualContourModel()!=NULL){
130 if (GetManualContourModel()->GetSizeLstPoints()>1){
131 z=(int)_vtkmprbasedata->GetZ();
135 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
138 xx=_vtkmprbasedata->GetX();
143 yy=_vtkmprbasedata->GetY();
146 id = GetManualContourModel()->InsertPoint(xx,yy,zz);
148 GetManualViewBaseContour()->InsertPoint(id);
149 InsertPoint_Others(0);
156 // ----------------------------------------------------------------------------
160 void manualContour3VControler::SetModelView ( manualContourModel *manContModel,
161 manualViewBaseContour *manViewBaseCont0,
162 manualViewBaseContour *manViewBaseCont1,
163 manualViewBaseContour *manViewBaseCont2,
164 manualViewBaseContour *manViewBaseCont3)
166 manualContourControler::SetModelView(manContModel,manViewBaseCont0);
167 _manViewBaseCont1 = manViewBaseCont1;
168 _manViewBaseCont2 = manViewBaseCont2;
169 _manViewBaseCont3 = manViewBaseCont3;
173 // ----------------------------------------------------------------------------
174 void manualContour3VControler::AddManualViewBaseContour( manualViewBaseContour *manViewBaseCont )
176 _lstManualViewBaseContour.push_back( manViewBaseCont );
179 // ----------------------------------------------------------------------------
180 void manualContour3VControler::SetVtkMPRBaseData (vtkMPRBaseData *vtkmprbasedata )
182 _vtkmprbasedata=vtkmprbasedata;
184 // ----------------------------------------------------------------------------
185 vtkMPRBaseData *manualContour3VControler::GetVtkMPRBaseData()
187 return _vtkmprbasedata;
189 // ----------------------------------------------------------------------------
190 void manualContour3VControler::SetPoint( int id ,int x ,int y ,int z ) // virtual
192 z=(int)_vtkmprbasedata->GetZ();
193 if ((GetManualViewBaseContour()!=NULL) && (id>=0)){
197 GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz,_type);
201 xx=_vtkmprbasedata->GetX();
205 yy=_vtkmprbasedata->GetY();
208 manualPoint *mp = GetManualContourModel()->GetManualPoint(id);
209 mp->SetPoint(xx,yy,zz);
213 // ----------------------------------------------------------------------------
214 void manualContour3VControler::DeleteActualMousePoint_Others(int id)
216 manualViewBaseContour *mvbc;
217 int i,size=this->_lstManualViewBaseContour.size();
218 for ( i = 0 ; i < size ; i++ )
220 mvbc = _lstManualViewBaseContour[i];
221 mvbc->DeletePoint(id);
226 if (_manViewBaseCont1!=NULL){
227 _manViewBaseCont1->DeletePoint(id);
228 _manViewBaseCont2->DeletePoint(id);
229 _manViewBaseCont3->DeletePoint(id);
231 _manViewBaseCont1->Refresh();
232 _manViewBaseCont2->Refresh();
233 _manViewBaseCont3->Refresh();
235 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
238 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
240 // ----------------------------------------------------------------------------
241 void manualContour3VControler::DeleteActualMousePoint(int x, int y)// virtual
243 int id=GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
245 manualContourBaseControler::DeleteActualMousePoint( x , y );
246 DeleteActualMousePoint_Others( id );
249 // ----------------------------------------------------------------------------
250 void manualContour3VControler::MouseMove_Others(int id) // virtual
252 manualViewBaseContour *mvbc;
253 int i,size=this->_lstManualViewBaseContour.size();
254 for ( i = 0 ; i < size ; i++ )
256 mvbc = _lstManualViewBaseContour[i];
257 mvbc->SelectAllPossibleSelected(false);
260 mvbc->SetPointPosibleSelected(id,true);
262 mvbc->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
268 if (_manViewBaseCont1!=NULL){
269 _manViewBaseCont1->SelectAllPossibleSelected(false);
270 _manViewBaseCont2->SelectAllPossibleSelected(false);
271 _manViewBaseCont3->SelectAllPossibleSelected(false);
273 _manViewBaseCont1->SetPointPosibleSelected(id,true);
274 _manViewBaseCont2->SetPointPosibleSelected(id,true);
275 _manViewBaseCont3->SetPointPosibleSelected(id,true);
277 _manViewBaseCont1->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
278 _manViewBaseCont2->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
279 _manViewBaseCont3->SetPosibleSelected ( GetManualViewBaseContour()->GetPosibleSelected() );
281 _manViewBaseCont1->Refresh();
282 _manViewBaseCont2->Refresh();
283 _manViewBaseCont3->Refresh();
285 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
288 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
292 // ----------------------------------------------------------------------------
293 void manualContour3VControler::MouseMove(int x, int y) // virtual
295 manualContourControler::MouseMove( x , y );
296 int id=GetManualViewBaseContour()->GetIdPoint(x,y,GetZ());
297 MouseMove_Others( id );
300 // ----------------------------------------------------------------------------
301 void manualContour3VControler::OnChar_Others()
303 manualViewBaseContour *mvbc;
304 int i,size=this->_lstManualViewBaseContour.size();
305 for ( i = 0 ; i < size ; i++ )
307 mvbc = _lstManualViewBaseContour[i];
312 _manViewBaseCont1->Refresh();
313 _manViewBaseCont2->Refresh();
314 _manViewBaseCont3->Refresh();
316 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
318 // ----------------------------------------------------------------------------
319 bool manualContour3VControler::OnChar()
321 manualContourControler::OnChar();
325 // ----------------------------------------------------------------------------
326 void manualContour3VControler::ResetContour() // virtual
328 manualContourControler::ResetContour();
329 ResetContour_Others();
332 // ----------------------------------------------------------------------------
333 void manualContour3VControler::ResetContour_Others()
335 manualViewBaseContour *mvbc;
336 int i,size=this->_lstManualViewBaseContour.size();
337 for ( i = 0 ; i < size ; i++ )
339 mvbc = _lstManualViewBaseContour[i];
340 mvbc->DeleteContour();
341 mvbc->CreateNewContour();
346 _manViewBaseCont1->DeleteContour();
347 _manViewBaseCont2->DeleteContour();
348 _manViewBaseCont3->DeleteContour();
349 _manViewBaseCont1->CreateNewContour();
350 _manViewBaseCont2->CreateNewContour();
351 _manViewBaseCont3->CreateNewContour();