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