]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx
#3219 creaMaracasVisu Feature New Normal - vtk8itk4wx3-mingw64
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / WidgetShowNPoints.cxx
1
2
3 #include "vtkActor.h"
4 #include "vtkSphereSource.h"
5 #include "vtkRenderer.h"
6 #include "vtkTextActor3D.h"
7
8
9 #include "vtkProperty.h"
10 #include "vtkPolyDataMapper.h"
11 #include "vtkRenderWindow.h"
12 #include <vtkTextProperty.h>
13
14 #include <wx/button.h>
15 #include <wx/sizer.h>
16 #include <wx/filedlg.h>
17 #include <wx/msgdlg.h>
18
19 #include "WidgetShowNPoints.h"
20
21
22 //----------------------------------------------------------------------
23 //----------------------------------------------------------------------
24 //----------------------------------------------------------------------
25 //----------------------------------------------------------------------
26 //----------------------------------------------------------------------
27   WidgetShowNPoints::WidgetShowNPoints(wxWindow *parent, int type)
28     : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
29   {
30         mmodelShowNPoints                               = new ModelShowNPoints();
31     mtype                                                       = type;
32     SetType(mtype);
33     this->renderer                                      = NULL;
34     wxPanel     *panel                                  = this;
35     wxSizer *sizer                                      = NULL;
36
37         if ((mtype==0) || (mtype==3))
38         {
39                 // Widget interface
40                 askPointLabel                                   = new wxStaticText(panel, -1, _T("Point label :")); // JPR
41                 textCtrl                                                = new wxTextCtrl(panel, -1);
42                 wxButton *btnAddPoint                   = new wxButton( panel, -1, _T("Add Point"));
43                 wxButton *btnInsertPoint                = new wxButton( panel, -1, _T("Insert Point"));//CFT
44                 wxButton *btnSetPositionPoint   = new wxButton( panel, -1, _T("Set nearest point"));
45                 wxButton *btnRenamePoint                = new wxButton( panel, -1, _T("Rename point"));
46                 wxButton *btnEraseLastPoint             = new wxButton( panel, -1, _T("Erase Last point"));
47                 wxButton *btnErasePoint                 = new wxButton( panel, -1, _T("Erase point"));
48                 wxButton *btnDeleteAllPoints    = new wxButton( panel, -1, _T("Delete all points"));
49                 wxButton *btnSavePoints                 = NULL;
50                 wxButton *btnLoadPoints                 = NULL;
51                 if (mtype==0)
52                 {
53                         btnSavePoints                           = new wxButton( panel, -1, _T("Save points"));
54                         btnLoadPoints                           = new wxButton( panel, -1, _T("Load points"));
55                 }
56                 txtNrPoints                                             = new wxStaticText(panel,-1, _T(" "));
57
58                 //NTU: Sliders for opacity and radio change
59                 wxStaticText* txOpacity = new wxStaticText(this, -1, wxString(_T("  Points Opacity  ")));
60                 sdrOpacity = new wxSlider(this, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
61                 wxStaticText* txRadio = new wxStaticText(this, -1, wxString(_T("  Points Radio  ")));
62                 sdrRadio = new wxSlider(this, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
63
64                 wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
65                 //    sizer1->Add(new wxStaticText(panel,-1,_T("  ")));
66
67                 Connect(btnAddPoint->GetId()            , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnAddPoint);
68                 Connect(btnInsertPoint->GetId()         , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnInsertPoint);//CFT
69                 Connect(btnSetPositionPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint);
70                 Connect(btnRenamePoint->GetId()         , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnRenamePoint);
71                 Connect(btnEraseLastPoint->GetId()      , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnEraseLastPoint);
72                 Connect(btnErasePoint->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnErasePoint);
73                 Connect(btnDeleteAllPoints->GetId()     , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnDeleteAllPoints);
74                 if (mtype==0)
75                 {
76                         Connect(btnSavePoints->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints);
77                         Connect(btnLoadPoints->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints);
78                 }
79                 //NTU: Slider events
80                 Connect(sdrOpacity->GetId()                     , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
81                 Connect(sdrRadio->GetId()                       , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
82
83                 sizer1->Add(askPointLabel); // JPR
84                 sizer1->Add(textCtrl);
85                 sizer1->Add(btnAddPoint);
86                 sizer1->Add(btnInsertPoint);//CFT
87                 sizer1->Add(btnSetPositionPoint);
88                 sizer1->Add(btnRenamePoint);
89                 sizer1->Add(btnErasePoint);
90                 sizer1->Add(btnEraseLastPoint);
91                 sizer1->Add(btnDeleteAllPoints);
92                 sizer1->Add(txtNrPoints);
93                 sizer1->Add(txOpacity);
94                 sizer1->Add(sdrOpacity,1,wxGROW );
95                 sizer1->Add(txRadio);
96                 sizer1->Add(sdrRadio,1,wxGROW );
97                 if (mtype==0)
98                 {
99                         sizer1->Add(btnSavePoints);
100                         sizer1->Add(btnLoadPoints);
101                 }
102                 sizer = sizer1;
103         }
104
105           if (mtype==1)
106           {
107                   // Widget interface
108                   wxButton *btnSetPositionPoint         = new wxButton( panel, -1, _T("Set nearest point"));
109                   txtNrPoints                                           = new wxStaticText(panel,-1, _T(" "));
110
111                   //NTU: Sliders for opacity and radio change
112                   wxStaticText* txOpacity                       = new wxStaticText(this, -1, wxString(_T("  Points Opacity  ")));
113                   sdrOpacity                                            = new wxSlider(this, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
114                   wxStaticText* txRadio                         = new wxStaticText(this, -1, wxString(_T("  Points Radio  ")));
115                   sdrRadio                                                      = new wxSlider(this, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
116                   wxFlexGridSizer *sizer1                       = new wxFlexGridSizer(1);
117                   Connect(btnSetPositionPoint->GetId()  , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint);
118                   Connect(sdrOpacity->GetId()   , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
119                   Connect(sdrRadio->GetId()     , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
120
121                   sizer1->Add(btnSetPositionPoint);
122                   sizer1->Add(txtNrPoints);
123                   sizer1->Add(txOpacity);
124                   sizer1->Add(sdrOpacity,1,wxGROW );
125                   sizer1->Add(txRadio);
126                   sizer1->Add(sdrRadio,1,wxGROW );
127                   sizer = sizer1;
128           }
129     
130     if (mtype == 2) 
131         {
132                 askPointLabel                                           = new wxStaticText(panel, -1, _T("\nPOINT CONTROLS:")); // JPR
133         wxButton                *btnAddPoint            = new wxButton(panel, -1,        _T("      Add  Point      "));
134         wxButton                *btnDeleteAllPoints = new wxButton(panel, -1, _T("      Delete All      "));
135         wxStaticText    *spacer                         = new wxStaticText(panel, -1, _T("\n")); // JPR
136                                          textCtrl                       = new wxTextCtrl(panel, -1);
137         wxFlexGridSizer *sizer1                         = new wxFlexGridSizer(1);
138         Connect(btnAddPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnAddPoint);
139         Connect(btnDeleteAllPoints->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteAllPoints);    
140         sizer1->Add(askPointLabel); 
141         sizer1->Add(btnAddPoint);
142         sizer1->Add(btnDeleteAllPoints);
143         sizer1->Add(spacer);
144         sizer1->Add(textCtrl);
145         sdrOpacity = new wxSlider();
146         sdrRadio = new wxSlider();
147         txtNrPoints = new wxStaticText(panel, -1, _T("\n\n\n"));
148         sizer = sizer1;
149         } // bbGetInputType 2
150
151         if (sizer!=NULL)
152         {
153                 panel->SetSizer(sizer);
154                 panel->SetAutoLayout(true);
155                 panel->Layout();
156         } // if sizer
157 }
158
159 //------------------------------------------------------------------------
160 WidgetShowNPoints::~WidgetShowNPoints()
161 {
162 }
163
164 //------------------------------------------------------------------------
165 ModelShowNPoints* WidgetShowNPoints::GetModelShowNPoints()
166 {
167         return mmodelShowNPoints;
168 }
169
170
171 //------------------------------------------------------------------------
172 void WidgetShowNPoints::SetRadio(double radio)
173 {
174         GetModelShowNPoints()->SetRadio(radio);
175         //NTU: For Slider
176         sdrRadio->SetValue(radio);
177 }
178
179 //------------------------------------------------------------------------
180 void WidgetShowNPoints::SetColour(std::vector<double> colour)
181 {
182         this->mcolour = colour;
183 }
184
185 //------------------------------------------------------------------------
186 void WidgetShowNPoints::SetImage(vtkImageData* image)
187 {
188         GetModelShowNPoints()->SetImage(image);
189 }
190
191 //------------------------------------------------------------------------
192 void WidgetShowNPoints::SetOpacity(double opacity)
193 {
194         this->mopacity=opacity;
195         //NTU: For Slider
196         sdrOpacity->SetValue(this->mopacity*100.0);
197 }
198
199
200 //------------------------------------------------------------------------
201 void  WidgetShowNPoints::SetRenderer(vtkRenderer *renderer)
202 {
203         this->renderer  = renderer;
204 }
205         
206 //------------------------------------------------------------------------
207         
208 void WidgetShowNPoints::RefreshPoint(int id)
209 {
210         double spc[3];
211
212 //EED 2016/06/17
213 //      mimage->GetSpacing(spc);
214 //      int x = lstPointsX[id];
215 //      int y = lstPointsY[id];
216 //      int z = lstPointsZ[id];
217         int x,y,z;
218         GetModelShowNPoints()->GetIdPoint(id,&x,&y,&z);
219         GetModelShowNPoints()->GetImage()->GetSpacing(spc);
220         std::string label       = GetModelShowNPoints()->GetIdLabel(id);
221         double radio            = GetModelShowNPoints()->GetRadio();
222
223         lstActorsSphere[id]->SetPosition( spc[0]*x , spc[1]*y , spc[2]*z );
224         lstActorsSphere[id]->GetProperty()->SetColor( mcolour[0] , mcolour[1] , mcolour[2] );
225         lstActorsSphere[id]->GetProperty()->SetOpacity( mopacity );
226         lstSourceSphere[id]->SetRadius( radio );
227
228 //EED 2017-01-01 Migration VTK7
229 #if VTK_MAJOR_VERSION <= 5
230         // ..
231 #else
232         lstSourceSphere[id]->Update();
233 #endif
234
235         lstActorsText[id]->SetInput( label.c_str()  );
236         lstActorsText[id]->SetPosition(  radio+spc[0]*x , spc[1]*y , spc[2]*z );
237 }
238
239 //------------------------------------------------------------------------
240 void WidgetShowNPoints::RefreshPoints()
241 {
242         int id,size=lstActorsSphere.size();
243         for (id=0;id<size;id++)
244         {
245                 RefreshPoint(id);
246         } // for
247         renderer->GetRenderWindow()->Render();
248 }
249
250 //------------------------------------------------------------------------
251 void WidgetShowNPoints::AddVtkPoint()
252 {
253         // Sphere
254         vtkSphereSource *vtksphere = vtkSphereSource::New();
255         vtksphere->SetThetaResolution (20);
256         vtksphere->SetPhiResolution (20);
257         vtksphere->SetRadius( 1 );
258         //NTU: For updating points
259         lstSourceSphere.push_back(vtksphere);
260         vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
261
262 //EED 2017-01-01 Migration VTK7
263 #if VTK_MAJOR_VERSION <= 5
264         sphereMapper->SetInput( vtksphere->GetOutput() );
265 #else
266         vtksphere->Update();
267         sphereMapper->SetInputData( vtksphere->GetOutput() );
268 #endif
269
270         vtkActor *sphereActor   = vtkActor::New();
271         sphereActor->SetMapper(sphereMapper);
272         sphereActor->SetOrigin(0, 0, 0);
273
274         lstActorsSphere.push_back(sphereActor);
275         if(renderer==NULL){
276                 wxMessageDialog dialog(this, _T("Renderer Not Set"),_T("Renderer Not Set"),wxICON_ERROR);
277                 dialog.ShowModal();             
278                 return;
279         }
280         renderer->AddActor( sphereActor );
281         // Actor
282         vtkTextActor3D *textActor = vtkTextActor3D::New();
283 //      textActor->SetInput( strLabel.c_str()  );
284         renderer->AddActor( textActor );
285         lstActorsText.push_back(textActor);
286 }
287
288
289 //------------------------------------------------------------------------
290 void WidgetShowNPoints::AddPoint(int x, int y, int z, std::string label)
291 {
292         GetModelShowNPoints()->AddPoint(x,y,z, label );
293         AddVtkPoint();
294         RefreshPoint(lstActorsSphere.size()-1);
295 }
296
297
298
299 //------------------------------------------------------------------------
300 void WidgetShowNPoints::InsertPoint(int x, int y, int z, std::string label)//CFT
301 {
302
303 //--
304         if ( GetModelShowNPoints()->InsertPoint(x,y,z,label) != -1 )
305         {
306                 AddVtkPoint();
307         } else {
308                 AddPoint(x,y,z,label);
309         }
310         RefreshPoints();
311         //end if
312 }
313
314
315 //------------------------------------------------------------------------
316 void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event)
317 {       
318         if (this->renderer==NULL)
319         { 
320                 return;
321         }
322
323         std::vector<int> point = GetModelShowNPoints()->GetReferencePoint();
324         if (point.size()==3)
325         {
326                 AddPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
327                 SetOutputBox();
328                 renderer->GetRenderWindow()->Render();
329         } else {//mpoint.size
330                 printf("creaMaracasVisu::ShowNPoints (not match point) \n");
331         }
332 }
333
334 //------------------------------------------------------------------------
335 void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT
336 {       
337         if (this->renderer==NULL)
338         { 
339                 return;
340         }
341
342         std::vector<int> point = GetModelShowNPoints()->GetReferencePoint();
343         if (point.size()==3)
344         {
345                 InsertPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
346                 SetOutputBox();
347         } else {//mpoint.size
348                 printf("creaMaracasVisu::ShowNPoints (not match point) \n");
349         }
350 }
351
352
353 //------------------------------------------------------------------------
354         void WidgetShowNPoints::SetOutputBox()
355         {
356 //EED           renderer->GetRenderWindow()->Render();
357                 wxString strTmp;
358                 strTmp.Printf(_T("Nbr of points: %d"), GetModelShowNPoints()->GetLstPointsSize() );
359                 txtNrPoints->SetLabel(  strTmp );
360                 //--BBTK
361
362 //EED 2017-06-03
363 //              mbbShowNPoints->bbSetOutputlstPointsX( GetModelShowNPoints()->GetLstPointsX() );
364 //              mbbShowNPoints->bbSetOutputlstPointsY( GetModelShowNPoints()->GetLstPointsY() );
365 //              mbbShowNPoints->bbSetOutputlstPointsZ( GetModelShowNPoints()->GetLstPointsZ() );
366 //              mbbShowNPoints->bbSetOutputlstLabels( GetModelShowNPoints()->GetLstLabels() );
367 //              mbbShowNPoints->bbSignalOutputModification();
368         }
369
370
371 //------------------------------------------------------------------------
372         void WidgetShowNPoints::OnSavePoints(wxCommandEvent& event)
373         {
374
375 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
376 #if wxMAJOR_VERSION <= 2
377                 wxFileDialog* FD = new wxFileDialog( 0,
378                                             _T("Save points .."),
379                                             _T(""),
380                                             _T(""),
381                                             _T("(*.xls)|*.xls"),
382                                             wxSAVE | wxOVERWRITE_PROMPT,
383                                             wxDefaultPosition);
384 #else
385                 wxFileDialog* FD = new wxFileDialog( 0,
386                                             _T("Save points .."),
387                                             _T(""),
388                                             _T(""),
389                                             _T("(*.xls)|*.xls"),
390                                             wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
391                                             wxDefaultPosition);
392 #endif
393
394
395
396                 int result_FD = FD->ShowModal();
397                 
398                 // This line is need it by windows //EED
399                 FD->SetReturnCode( result_FD );
400
401                 if (FD->GetReturnCode()==wxID_OK)
402                 {
403                         std::string filename= (const char*) ( FD->GetPath().mb_str() ); 
404                         GetModelShowNPoints()->SavePoints( filename );
405                 }       // dialog box
406         }
407
408
409 //------------------------------------------------------------------------
410         void WidgetShowNPoints::OnLoadPoints(wxCommandEvent& event)
411         {
412
413 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
414 #if wxMAJOR_VERSION <= 2
415                 wxFileDialog* FD = new wxFileDialog( 0,
416                                              _T("Load points .."),
417                                              _T(""),
418                                              _T(""),
419                                              _T("(*.xls)|*.xls"),
420                                              wxOPEN | wxFILE_MUST_EXIST,
421                                              wxDefaultPosition);
422 #else
423                 wxFileDialog* FD = new wxFileDialog( 0,
424                                              _T("Load points .."),
425                                              _T(""),
426                                              _T(""),
427                                              _T("(*.xls)|*.xls"),
428                                              wxFD_OPEN | wxFD_FILE_MUST_EXIST,
429                                              wxDefaultPosition);
430 #endif
431                 int i;
432                 //EED
433                 int result_FD = FD->ShowModal();
434                 // This line is need it by windows //EED
435                 FD->SetReturnCode( result_FD );
436                 if (FD->GetReturnCode()==wxID_OK)
437                 {
438
439                         std::string filename= (const char*) ( FD->GetPath().mb_str() ); 
440                         int numberPointsRead = GetModelShowNPoints()->ReadPoints( filename );
441                         for (i=0;i<numberPointsRead;i++)
442                         {
443                                 AddVtkPoint();
444                         }// for
445                         SetOutputBox();
446                         RefreshPoints();
447                 }       // dialog box
448
449         }
450
451         //------------------------------------------------------------------------
452         void WidgetShowNPoints::OnSetPoint(wxCommandEvent& event)
453         {
454                 int id=GetModelShowNPoints()->GetNearestPoint();
455                 if((id==-1) && (mtype==1))
456                 {
457                         id=0;
458                         AddPoint(0,0,0,"");
459                         SetOutputBox();
460                 }
461         
462                 if (id>=0)
463                 {
464                         GetModelShowNPoints()->SetPointId_mReferencePoint(id);
465                         RefreshPoint(id);
466                         renderer->GetRenderWindow()->Render();
467                 } // if id
468                 SetOutputBox();
469         }
470         
471 //------------------------------------------------------------------------
472         void WidgetShowNPoints::OnRenamePoint(wxCommandEvent& event)
473         {
474                 int id = GetModelShowNPoints()->RenamePoint( (const char*) ( textCtrl->GetValue().mb_str() ) );
475                 if (id>=0)
476                 {
477                         lstActorsText[id]->SetInput(  (const char*) ( textCtrl->GetValue().mb_str() ) );
478                         SetOutputBox();
479                         renderer->GetRenderWindow()->Render();
480                 }
481         }
482
483 //------------------------------------------------------------------------
484         void WidgetShowNPoints::ErasePoint(int id)
485         {
486                 if (this->renderer!=NULL)
487                 {
488                         if (id>=0)
489                         {
490                                 renderer->RemoveActor( lstActorsSphere[id] );
491                                 renderer->RemoveActor( lstActorsText[id] );
492                                 lstActorsSphere[id]->Delete();
493                                 lstActorsText[id]->Delete();
494                                 lstSourceSphere[id]->Delete();
495                                 lstActorsSphere.erase( lstActorsSphere.begin()+id );
496                                 lstActorsText.erase( lstActorsText.begin()+id );
497                                 lstSourceSphere.erase( lstSourceSphere.begin()+id );
498                                 GetModelShowNPoints()->ErasePoint(id);
499                         } // if id
500                 } // if renderer
501         }
502
503 //------------------------------------------------------------------------
504         void WidgetShowNPoints::OnErasePoint(wxCommandEvent& event)
505         {
506                 ErasePoint( GetModelShowNPoints()->IdInsidePoint() );
507                 SetOutputBox();
508                 renderer->GetRenderWindow()->Render();
509         }
510
511 //------------------------------------------------------------------------
512         void WidgetShowNPoints::OnEraseLastPoint(wxCommandEvent& event)
513         {
514                 ErasePoint(lstActorsSphere.size()-1);
515                 SetOutputBox();
516                 renderer->GetRenderWindow()->Render();
517         }
518
519 //------------------------------------------------------------------------
520 void WidgetShowNPoints::DeleteAllPoints()
521 {
522         int id,size=lstActorsSphere.size();
523         for (id=size-1;id>=0;id--)
524         {
525                 ErasePoint(id);
526         }
527         SetOutputBox();
528         renderer->GetRenderWindow()->Render();
529 }
530
531 //------------------------------------------------------------------------
532 void WidgetShowNPoints::OnDeleteAllPoints(wxCommandEvent& event)
533 {
534         DeleteAllPoints();
535 }
536
537 //NTU: Method for updating points opacity and Radio
538
539 //------------------------------------------------------------------------
540 void WidgetShowNPoints::UpdatePoints(wxCommandEvent &event)
541 {
542         //Difference in Radio for text placement
543 //      double radio=GetModelShowNPoints()->GetRadio();
544         this->mopacity = sdrOpacity->GetValue()/100.0;
545         GetModelShowNPoints()->SetRadio( sdrRadio->GetValue() ) ;
546 //      radio = sdrRadio->GetValue();
547         //NTU refresh the inputs
548
549 //EED 2017-06-03
550 //      mbbShowNPoints->bbSetInputOpacity(this->mopacity);
551 //      mbbShowNPoints->bbSetInputRadio( radio );
552         // EED 
553         RefreshPoints();
554 }
555
556 //------------------------------------------------------------------------
557 void  WidgetShowNPoints::SetReferencePoint(std::vector<int> point)
558 {
559         GetModelShowNPoints()->SetReferencePoint(point);
560 }
561
562 //------------------------------------------------------------------------
563 void  WidgetShowNPoints::SetInitLstPoints( std::vector<int> initLstPointsX,  std::vector<int> initLstPointsY, std::vector<int> initLstPointsZ, std::vector<std::string> initLstLabels )
564 {
565         if (this->renderer==NULL)
566         { 
567                 return;
568         }
569
570         int i,sizeX,sizeY,sizeZ,sizeLabels;
571         sizeX=(int)initLstPointsX.size();
572         sizeY=(int)initLstPointsY.size();
573         sizeZ=(int)initLstPointsZ.size();
574         sizeLabels=(int)initLstLabels.size();
575
576         int x,y,z;
577         std::string label;
578
579         if ( (sizeX==sizeY) && (sizeX==sizeZ) )
580         {
581
582                 for (i=0;i<sizeX;i++)
583                 {
584                         x               = initLstPointsX[i];
585                         y               = initLstPointsY[i];
586                         z               = initLstPointsZ[i];
587                         if (i<sizeLabels) 
588                         {
589                                 label   = initLstLabels[i];
590                         } else {
591                                 label="";
592                         }
593                         AddPoint( x,y,z,label );
594                 } // for i
595                 //      SetOutputBox(); 
596                 //      renderer->GetRenderWindow()->Render();
597
598         } // if size
599 }
600 //------------------------------------------------------------------------
601 void WidgetShowNPoints::SetType(int type)
602 {
603         mtype=type;
604 }
605
606 //------------------------------------------------------------------------
607 int WidgetShowNPoints::GetType()
608 {
609         return mtype;
610 }
611
612
613 //------------------------------------------------------------------------
614 double WidgetShowNPoints::GetRadio()
615 {
616         return sdrRadio->GetValue();
617 }
618
619 //------------------------------------------------------------------------
620 double WidgetShowNPoints::GetOpacity()
621 {
622         return mopacity;
623 }
624
625