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