]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx
#3128 creaMaracasVisu Feature New Normal - branch changeWx28to30 compilation with...
[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         lstActorsText[id]->SetInput( label.c_str()  );
219         lstActorsText[id]->SetPosition(  radio+spc[0]*x , spc[1]*y , spc[2]*z );
220 }
221
222 //------------------------------------------------------------------------
223 void WidgetShowNPoints::RefreshPoints()
224 {
225         int id,size=lstActorsSphere.size();
226         for (id=0;id<size;id++)
227         {
228                 RefreshPoint(id);
229         } // for
230         renderer->GetRenderWindow()->Render();
231 }
232
233 //------------------------------------------------------------------------
234 void WidgetShowNPoints::AddVtkPoint()
235 {
236         // Sphere
237         vtkSphereSource *vtksphere = vtkSphereSource::New();
238         vtksphere->SetThetaResolution (20);
239         vtksphere->SetPhiResolution (20);
240         vtksphere->SetRadius( 1 );
241         //NTU: For updating points
242         lstSourceSphere.push_back(vtksphere);
243         vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
244         sphereMapper->SetInput( vtksphere->GetOutput() );
245         vtkActor *sphereActor   = vtkActor::New();
246         sphereActor->SetMapper(sphereMapper);
247         sphereActor->SetOrigin(0, 0, 0);
248
249         lstActorsSphere.push_back(sphereActor);
250         if(renderer==NULL){
251                 wxMessageDialog dialog(this, _T("Renderer Not Set"),_T("Renderer Not Set"),wxICON_ERROR);
252                 dialog.ShowModal();             
253                 return;
254         }
255         renderer->AddActor( sphereActor );
256         // Actor
257         vtkTextActor3D *textActor = vtkTextActor3D::New();
258 //      textActor->SetInput( strLabel.c_str()  );
259         renderer->AddActor( textActor );
260         lstActorsText.push_back(textActor);
261 }
262
263
264 //------------------------------------------------------------------------
265 void WidgetShowNPoints::AddPoint(int x, int y, int z, std::string label)
266 {
267         GetModelShowNPoints()->AddPoint(x,y,z, label );
268         AddVtkPoint();
269         RefreshPoint(lstActorsSphere.size()-1);
270 }
271
272
273
274 //------------------------------------------------------------------------
275 void WidgetShowNPoints::InsertPoint(int x, int y, int z, std::string label)//CFT
276 {
277
278 //--
279         if ( GetModelShowNPoints()->InsertPoint(x,y,z,label) != -1 )
280         {
281                 AddVtkPoint();
282         } else {
283                 AddPoint(x,y,z,label);
284         }
285         RefreshPoints();
286         //end if
287 }
288
289
290 //------------------------------------------------------------------------
291 void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event)
292 {       
293         if (this->renderer==NULL)
294         { 
295                 return;
296         }
297
298         std::vector<int> point = GetModelShowNPoints()->GetReferencePoint();
299         if (point.size()==3)
300         {
301                 AddPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
302                 SetOutputBox();
303                 renderer->GetRenderWindow()->Render();
304         } else {//mpoint.size
305                 printf("creaMaracasVisu::ShowNPoints (not match point) \n");
306         }
307 }
308
309 //------------------------------------------------------------------------
310 void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT
311 {       
312         if (this->renderer==NULL)
313         { 
314                 return;
315         }
316
317         std::vector<int> point = GetModelShowNPoints()->GetReferencePoint();
318         if (point.size()==3)
319         {
320                 InsertPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
321                 SetOutputBox();
322         } else {//mpoint.size
323                 printf("creaMaracasVisu::ShowNPoints (not match point) \n");
324         }
325 }
326
327
328 //------------------------------------------------------------------------
329         void WidgetShowNPoints::SetOutputBox()
330         {
331 //EED           renderer->GetRenderWindow()->Render();
332                 wxString strTmp;
333                 strTmp.Printf(_T("Nbr of points: %d"), GetModelShowNPoints()->GetLstPointsSize() );
334                 txtNrPoints->SetLabel(  strTmp );
335                 //--BBTK
336
337 //EED 2017-06-03
338 //              mbbShowNPoints->bbSetOutputlstPointsX( GetModelShowNPoints()->GetLstPointsX() );
339 //              mbbShowNPoints->bbSetOutputlstPointsY( GetModelShowNPoints()->GetLstPointsY() );
340 //              mbbShowNPoints->bbSetOutputlstPointsZ( GetModelShowNPoints()->GetLstPointsZ() );
341 //              mbbShowNPoints->bbSetOutputlstLabels( GetModelShowNPoints()->GetLstLabels() );
342 //              mbbShowNPoints->bbSignalOutputModification();
343         }
344
345
346 //------------------------------------------------------------------------
347         void WidgetShowNPoints::OnSavePoints(wxCommandEvent& event)
348         {
349
350 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
351 #if wxMAJOR_VERSION <= 2
352                 wxFileDialog* FD = new wxFileDialog( 0,
353                                             _T("Save points .."),
354                                             _T(""),
355                                             _T(""),
356                                             _T("(*.xls)|*.xls"),
357                                             wxSAVE | wxOVERWRITE_PROMPT,
358                                             wxDefaultPosition);
359 #else
360                 wxFileDialog* FD = new wxFileDialog( 0,
361                                             _T("Save points .."),
362                                             _T(""),
363                                             _T(""),
364                                             _T("(*.xls)|*.xls"),
365                                             wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
366                                             wxDefaultPosition);
367 #endif
368
369
370
371                 int result_FD = FD->ShowModal();
372                 
373                 // This line is need it by windows //EED
374                 FD->SetReturnCode( result_FD );
375
376                 if (FD->GetReturnCode()==wxID_OK)
377                 {
378                         std::string filename= (const char*) ( FD->GetPath().mb_str() ); 
379                         GetModelShowNPoints()->SavePoints( filename );
380                 }       // dialog box
381         }
382
383
384 //------------------------------------------------------------------------
385         void WidgetShowNPoints::OnLoadPoints(wxCommandEvent& event)
386         {
387
388 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
389 #if wxMAJOR_VERSION <= 2
390                 wxFileDialog* FD = new wxFileDialog( 0,
391                                              _T("Load points .."),
392                                              _T(""),
393                                              _T(""),
394                                              _T("(*.xls)|*.xls"),
395                                              wxOPEN | wxFILE_MUST_EXIST,
396                                              wxDefaultPosition);
397 #else
398                 wxFileDialog* FD = new wxFileDialog( 0,
399                                              _T("Load points .."),
400                                              _T(""),
401                                              _T(""),
402                                              _T("(*.xls)|*.xls"),
403                                              wxFD_OPEN | wxFD_FILE_MUST_EXIST,
404                                              wxDefaultPosition);
405 #endif
406                 int i;
407                 //EED
408                 int result_FD = FD->ShowModal();
409                 // This line is need it by windows //EED
410                 FD->SetReturnCode( result_FD );
411                 if (FD->GetReturnCode()==wxID_OK)
412                 {
413
414                         std::string filename= (const char*) ( FD->GetPath().mb_str() ); 
415                         int numberPointsRead = GetModelShowNPoints()->ReadPoints( filename );
416                         for (i=0;i<numberPointsRead;i++)
417                         {
418                                 AddVtkPoint();
419                         }// for
420                         SetOutputBox();
421                         RefreshPoints();
422                 }       // dialog box
423
424         }
425
426         //------------------------------------------------------------------------
427         void WidgetShowNPoints::OnSetPoint(wxCommandEvent& event)
428         {
429                 int id=GetModelShowNPoints()->GetNearestPoint();
430                 if((id==-1) && (mtype==1))
431                 {
432                         id=0;
433                         AddPoint(0,0,0,"");
434                         SetOutputBox();
435                 }
436         
437                 if (id>=0)
438                 {
439                         GetModelShowNPoints()->SetPointId_mReferencePoint(id);
440                         RefreshPoint(id);
441                         renderer->GetRenderWindow()->Render();
442                 } // if id
443                 SetOutputBox();
444         }
445         
446 //------------------------------------------------------------------------
447         void WidgetShowNPoints::OnRenamePoint(wxCommandEvent& event)
448         {
449                 int id = GetModelShowNPoints()->RenamePoint( (const char*) ( textCtrl->GetValue().mb_str() ) );
450                 if (id>=0)
451                 {
452                         lstActorsText[id]->SetInput(  (const char*) ( textCtrl->GetValue().mb_str() ) );
453                         SetOutputBox();
454                         renderer->GetRenderWindow()->Render();
455                 }
456         }
457
458 //------------------------------------------------------------------------
459         void WidgetShowNPoints::ErasePoint(int id)
460         {
461                 if (this->renderer!=NULL)
462                 {
463                         if (id>=0)
464                         {
465                                 renderer->RemoveActor( lstActorsSphere[id] );
466                                 renderer->RemoveActor( lstActorsText[id] );
467                                 lstActorsSphere[id]->Delete();
468                                 lstActorsText[id]->Delete();
469                                 lstSourceSphere[id]->Delete();
470                                 lstActorsSphere.erase( lstActorsSphere.begin()+id );
471                                 lstActorsText.erase( lstActorsText.begin()+id );
472                                 lstSourceSphere.erase( lstSourceSphere.begin()+id );
473                                 GetModelShowNPoints()->ErasePoint(id);
474                         } // if id
475                 } // if renderer
476         }
477
478 //------------------------------------------------------------------------
479         void WidgetShowNPoints::OnErasePoint(wxCommandEvent& event)
480         {
481                 ErasePoint( GetModelShowNPoints()->IdInsidePoint() );
482                 SetOutputBox();
483                 renderer->GetRenderWindow()->Render();
484         }
485
486 //------------------------------------------------------------------------
487         void WidgetShowNPoints::OnEraseLastPoint(wxCommandEvent& event)
488         {
489                 ErasePoint(lstActorsSphere.size()-1);
490                 SetOutputBox();
491                 renderer->GetRenderWindow()->Render();
492         }
493
494 //------------------------------------------------------------------------
495 void WidgetShowNPoints::DeleteAllPoints()
496 {
497         int id,size=lstActorsSphere.size();
498         for (id=size-1;id>=0;id--)
499         {
500                 ErasePoint(id);
501         }
502         SetOutputBox();
503         renderer->GetRenderWindow()->Render();
504 }
505
506 //------------------------------------------------------------------------
507 void WidgetShowNPoints::OnDeleteAllPoints(wxCommandEvent& event)
508 {
509         DeleteAllPoints();
510 }
511
512 //NTU: Method for updating points opacity and Radio
513
514 //------------------------------------------------------------------------
515 void WidgetShowNPoints::UpdatePoints(wxCommandEvent &event)
516 {
517         //Difference in Radio for text placement
518 //      double radio=GetModelShowNPoints()->GetRadio();
519         this->mopacity = sdrOpacity->GetValue()/100.0;
520         GetModelShowNPoints()->SetRadio( sdrRadio->GetValue() ) ;
521 //      radio = sdrRadio->GetValue();
522         //NTU refresh the inputs
523
524 //EED 2017-06-03
525 //      mbbShowNPoints->bbSetInputOpacity(this->mopacity);
526 //      mbbShowNPoints->bbSetInputRadio( radio );
527         // EED 
528         RefreshPoints();
529 }
530
531 //------------------------------------------------------------------------
532 void  WidgetShowNPoints::SetReferencePoint(std::vector<int> point)
533 {
534         GetModelShowNPoints()->SetReferencePoint(point);
535 }
536
537 //------------------------------------------------------------------------
538 void  WidgetShowNPoints::SetInitLstPoints( std::vector<int> initLstPointsX,  std::vector<int> initLstPointsY, std::vector<int> initLstPointsZ, std::vector<std::string> initLstLabels )
539 {
540         if (this->renderer==NULL)
541         { 
542                 return;
543         }
544
545         int i,sizeX,sizeY,sizeZ,sizeLabels;
546         sizeX=(int)initLstPointsX.size();
547         sizeY=(int)initLstPointsY.size();
548         sizeZ=(int)initLstPointsZ.size();
549         sizeLabels=(int)initLstLabels.size();
550
551         int x,y,z;
552         std::string label;
553
554         if ( (sizeX==sizeY) && (sizeX==sizeZ) )
555         {
556
557                 for (i=0;i<sizeX;i++)
558                 {
559                         x               = initLstPointsX[i];
560                         y               = initLstPointsY[i];
561                         z               = initLstPointsZ[i];
562                         if (i<sizeLabels) 
563                         {
564                                 label   = initLstLabels[i];
565                         } else {
566                                 label="";
567                         }
568                         AddPoint( x,y,z,label );
569                 } // for i
570                 //      SetOutputBox(); 
571                 //      renderer->GetRenderWindow()->Render();
572
573         } // if size
574 }
575 //------------------------------------------------------------------------
576 void WidgetShowNPoints::SetType(int type)
577 {
578         mtype=type;
579 }
580
581 //------------------------------------------------------------------------
582 int WidgetShowNPoints::GetType()
583 {
584         return mtype;
585 }
586
587
588 //------------------------------------------------------------------------
589 double WidgetShowNPoints::GetRadio()
590 {
591         return sdrRadio->GetValue();
592 }
593
594 //------------------------------------------------------------------------
595 double WidgetShowNPoints::GetOpacity()
596 {
597         return mopacity;
598 }
599
600