]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx
#3485 ShowNPionts for Multiple Groups
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / WidgetShowNPoints.cxx
1
2
3 #include "vtkSphereSource.h"
4 #include "vtkRenderer.h"
5 #include "vtkTextActor3D.h"
6
7
8
9 #include <wx/button.h>
10 #include <wx/sizer.h>
11 #include <wx/filedlg.h>
12 #include <wx/msgdlg.h>
13 #include <wx/notebook.h>
14
15 #include "WidgetShowNPoints.h"
16
17
18 //----------------------------------------------------------------------
19 //----------------------------------------------------------------------
20 //----------------------------------------------------------------------
21 //----------------------------------------------------------------------
22 //----------------------------------------------------------------------
23   WidgetShowNPoints::WidgetShowNPoints(wxWindow *parent, int type)
24     : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
25   {
26     printf("EED WidgetShowNPoints::WidgetShowNPoints Start \n");
27         // EED 2022-05-19
28     //  mmodelShowNPoints                                = new ModelShowNPoints();
29                         mActualCollection= 0;
30     ModelShowNPoints*   modelShowNPoints = new ModelShowNPoints();
31     lstModelShowNPoints.push_back( modelShowNPoints );
32     lstViewShowNPoints.push_back( new  ViewShowNPoints( modelShowNPoints ) );
33       
34     mtype                                                       = type;
35     SetType(mtype);
36     wxPanel*    panelParent         = this;
37     wxSizer*    sizer                           = NULL;
38     wxSizer*    MNPsizer            = NULL;
39
40     wxNotebook* bookSetPoints       = NULL;
41     wxNotebook* bookGroupManager    = NULL;
42     wxPanel*    panel               = NULL;
43     wxPanel*    panel2              = NULL;
44                 txtNrCollections    = NULL;
45
46       bookSetPoints     = new wxNotebook(panelParent,
47                           -1,
48                           wxDefaultPosition,
49                           wxDefaultSize,
50                           wxNB_TOP );
51       panel  = new wxPanel(bookSetPoints);
52       txtNrCollections = NULL;
53
54     // Group Manager
55     if (mtype==4)
56     {
57           bookGroupManager   = new wxNotebook(panelParent, //bbGetWxParent(),
58                               -1,
59                               wxDefaultPosition,
60                               wxDefaultSize,
61                               wxNB_TOP );
62           panel2  = new wxPanel(bookGroupManager);
63           txtNrCollections                      = new wxStaticText(panel2,-1, _T("1   /  1 "));
64           wxButton *btnBackCollection           = new wxButton( panel2, -1, _T("<"));
65           wxButton *btnNextCollection           = new wxButton( panel2, -1, _T(">"));
66           wxButton *btnInsertCollectionBefore   = new wxButton( panel2, -1, _T("Insert Group Before"));
67           wxButton *btnInsertCollectionAfter    = new wxButton( panel2, -1, _T("Insert Group After"));
68           wxButton *btnDeleteCollection         = new wxButton( panel2, -1, _T("Delete Group "));
69           wxButton *btnSaveCollection           = new wxButton( panel2, -1, _T("Save Groups"));
70           wxButton *btnLoadCollection           = new wxButton( panel2, -1, _T("Load Groups"));
71
72           wxFlexGridSizer *sizer1               = new wxFlexGridSizer(1);
73           wxFlexGridSizer *sizer2               = new wxFlexGridSizer(2);
74           wxStaticText* txOpacity               = new wxStaticText(panel2, -1, wxString(_T("  Points Opacity  ")));
75           sdrOpacity                            = new wxSlider(panel2, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
76           wxStaticText* txRadio                 = new wxStaticText(panel2, -1, wxString(_T("  Points Radius  ")));
77           sdrRadio                              = new wxSlider(panel2, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
78
79           Connect(btnBackCollection->GetId()        , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnBackCollection           );
80           Connect(btnNextCollection->GetId()        , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnNextCollection           );
81           Connect(btnInsertCollectionBefore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionBefore   );
82           Connect(btnInsertCollectionAfter->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionAfter    );
83           Connect(btnDeleteCollection->GetId()      , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteCollection         );
84           Connect(sdrOpacity->GetId()               , wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints                );
85           Connect(sdrRadio->GetId()                 , wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints                );
86           Connect(btnSaveCollection->GetId()        , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnSaveCollections          );
87           Connect(btnLoadCollection->GetId()        , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnLoadCollections          );
88
89         
90           sizer2->Add( btnBackCollection );
91           sizer2->Add( btnNextCollection );
92
93           sizer1->Add( txtNrCollections );
94           sizer1->Add( sizer2 );
95           sizer1->Add( btnInsertCollectionBefore );
96           sizer1->Add( btnInsertCollectionAfter );
97           sizer1->Add( btnDeleteCollection );
98         
99           sizer1->Add( txOpacity );
100           sizer1->Add( sdrOpacity );
101           sizer1->Add( txRadio );
102           sizer1->Add( sdrRadio );
103
104           sizer1->Add( btnSaveCollection );
105           sizer1->Add( btnLoadCollection );
106           MNPsizer                        = sizer1;
107           panel2->SetSizer( MNPsizer );
108           panel2->SetAutoLayout(true);
109           panel2->Layout();
110           bookGroupManager->AddPage(panel2 , _T("Groupts") );
111     } // if mtype 4
112
113         if ( (mtype==0) || (mtype==3) || (mtype==4) )
114         {
115                 // Widget interface
116                 askPointLabel                                   = new wxStaticText(panel, -1, _T("Point label :")); // JPR
117                 textCtrl                                                = new wxTextCtrl(panel, -1);
118                 wxButton    *btnAddPoint                = new wxButton( panel, -1, _T("Add Point"));
119                 wxButton    *btnInsertPoint             = new wxButton( panel, -1, _T("Insert Point"));//CFT
120                 wxButton    *btnSetPositionPoint= new wxButton( panel, -1, _T("Set nearest point"));
121                      cbTrackPoint       = new wxCheckBox(panel,-1, _T("Track Point") );
122         wxButton    *btnRenamePoint             = new wxButton( panel, -1, _T("Rename point"));
123                 wxButton    *btnEraseLastPoint  = new wxButton( panel, -1, _T("Erase Last point"));
124                 wxButton    *btnErasePoint              = new wxButton( panel, -1, _T("Erase point"));
125                 wxButton    *btnDeleteAllPoints = new wxButton( panel, -1, _T("Delete all points"));
126                 wxButton    *btnSavePoints              = NULL;
127                 wxButton    *btnLoadPoints              = NULL;
128                 if ( mtype==0 )
129                 {
130                         btnSavePoints                           = new wxButton( panel, -1, _T("Save points"));
131                         btnLoadPoints                           = new wxButton( panel, -1, _T("Load points"));
132             Connect(btnSavePoints->GetId()    , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints);
133             Connect(btnLoadPoints->GetId()    , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints);
134                 } // if mtype
135                 txtNrPoints                                             = new wxStaticText(panel,-1, _T(" "));
136
137         wxStaticText* txOpacity;
138         wxStaticText* txRadio;
139         if ( (mtype==0) || (mtype==3) )
140         {
141             //NTU: Sliders for opacity and radio change
142             txOpacity         = new wxStaticText(panel, -1, wxString(_T("  Points Opacity  ")));
143             sdrOpacity        = new wxSlider(panel, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
144             txRadio           = new wxStaticText(panel, -1, wxString(_T("  Points Radius  ")));
145             sdrRadio          = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
146             //NTU: Slider events
147             Connect(sdrOpacity->GetId()            , wxEVT_COMMAND_SLIDER_UPDATED    , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
148             Connect(sdrRadio->GetId()            , wxEVT_COMMAND_SLIDER_UPDATED    , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
149         } // if mtype 0 3
150
151                 Connect(btnAddPoint->GetId()            , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnAddPoint);
152                 Connect(btnInsertPoint->GetId()         , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnInsertPoint);//CFT
153                 Connect(btnSetPositionPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint);
154                 Connect(btnRenamePoint->GetId()         , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnRenamePoint);
155                 Connect(btnEraseLastPoint->GetId()      , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnEraseLastPoint);
156                 Connect(btnErasePoint->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnErasePoint);
157                 Connect(btnDeleteAllPoints->GetId()     , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnDeleteAllPoints);
158         Connect(cbTrackPoint->GetId()       , wxEVT_CHECKBOX  , (wxObjectEventFunction) &WidgetShowNPoints::OnTrackPoint);
159
160
161         wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
162                 sizer1->Add(askPointLabel); // JPR
163                 sizer1->Add(textCtrl);
164                 sizer1->Add(btnAddPoint);
165                 sizer1->Add(btnInsertPoint);//CFT
166         sizer1->Add(cbTrackPoint);
167                 sizer1->Add(btnSetPositionPoint);
168                 sizer1->Add(btnRenamePoint);
169                 sizer1->Add(btnErasePoint);
170                 sizer1->Add(btnEraseLastPoint);
171                 sizer1->Add(btnDeleteAllPoints);
172                 sizer1->Add(txtNrPoints);
173         
174         if ( (mtype==0) || (mtype==3) )
175         {
176             sizer1->Add(txOpacity);
177             sizer1->Add(sdrOpacity,1,wxGROW );
178             sizer1->Add(txRadio);
179             sizer1->Add(sdrRadio,1,wxGROW );
180         }  // if mtype 0 3
181         if ( mtype==0 )
182                 {
183                         sizer1->Add(btnSavePoints);
184                         sizer1->Add(btnLoadPoints);
185                 } // if mtype 0
186                 sizer = sizer1;
187         }
188
189           if (mtype==1)
190           {
191                   // Widget interface
192                   wxButton *btnSetPositionPoint         = new wxButton( panel, -1, _T("Set nearest point"));
193                   txtNrPoints                                           = new wxStaticText(panel,-1, _T(" "));
194
195                   //NTU: Sliders for opacity and radio change
196                   wxStaticText* txOpacity                       = new wxStaticText(panel, -1, wxString(_T("  Points Opacity  ")));
197                   sdrOpacity                                            = new wxSlider(panel, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
198                   wxStaticText* txRadio                         = new wxStaticText(panel, -1, wxString(_T("  Points Radio  ")));
199                   sdrRadio                                                      = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
200                   Connect(btnSetPositionPoint->GetId()  , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint);
201                   Connect(sdrOpacity->GetId()   , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
202                   Connect(sdrRadio->GetId()     , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
203
204           wxFlexGridSizer *sizer1            = new wxFlexGridSizer(1);
205                   sizer1->Add(btnSetPositionPoint);
206                   sizer1->Add(txtNrPoints);
207                   sizer1->Add(txOpacity);
208                   sizer1->Add(sdrOpacity,1,wxGROW );
209                   sizer1->Add(txRadio);
210                   sizer1->Add(sdrRadio,1,wxGROW );
211                   sizer = sizer1;
212           }
213     
214     if (mtype == 2) 
215         {
216                 askPointLabel                                           = new wxStaticText(panel, -1, _T("\nPOINT CONTROLS:")); // JPR
217         wxButton                *btnAddPoint            = new wxButton(panel, -1,        _T("      Add  Point      "));
218         wxButton                *btnDeleteAllPoints = new wxButton(panel, -1, _T("      Delete All      "));
219         wxStaticText    *spacer                         = new wxStaticText(panel, -1, _T("\n")); // JPR
220                                          textCtrl                       = new wxTextCtrl(panel, -1);
221         Connect(btnAddPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnAddPoint);
222         Connect(btnDeleteAllPoints->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteAllPoints);    
223         wxFlexGridSizer *sizer1             = new wxFlexGridSizer(1);
224         sizer1->Add(askPointLabel);
225         sizer1->Add(btnAddPoint);
226         sizer1->Add(btnDeleteAllPoints);
227         sizer1->Add(spacer);
228         sizer1->Add(textCtrl);
229       //  sdrOpacity                          = new wxSlider();
230       //  sdrRadio                            = new wxSlider();
231         txtNrPoints                         = new wxStaticText(panel, -1, _T("\n\n\n"));
232         sizer                               = sizer1;
233         } // bbGetInputType 2
234
235             
236       panel->SetSizer(sizer);
237       panel->SetAutoLayout(true);
238       panel->Layout();
239       bookSetPoints->AddPage(panel , _T("Points") );
240
241     if ((mtype >= 0) && (mtype <= 3) )
242     {
243         if (sizer!=NULL)
244         {
245             wxFlexGridSizer *sizerParent             = new wxFlexGridSizer(1);
246             sizerParent->Add( bookSetPoints );
247             panelParent->SetSizer( sizerParent );
248             panelParent->SetAutoLayout(true);
249             panelParent->Layout();
250         } // if sizer
251     } // if  mtype 0 1 2 3
252       
253     if (mtype == 4)
254     {
255         if ((sizer!=NULL) && (MNPsizer!=NULL))
256         {
257             wxFlexGridSizer *sizerG             = new wxFlexGridSizer(2);
258             sizerG->Add(bookGroupManager);
259             sizerG->Add(bookSetPoints);
260             panelParent->SetSizer(sizerG);
261             panelParent->SetAutoLayout(true);
262             panelParent->Layout();
263         } // if sizer
264     } // if mtype 4
265 }
266
267 //------------------------------------------------------------------------
268 WidgetShowNPoints::~WidgetShowNPoints()
269 {
270 }
271
272 //------------------------------------------------------------------------
273 ModelShowNPoints* WidgetShowNPoints::GetModelShowNPoints()
274 {
275     // EED 2022-05-19
276     // return mmodelShowNPoints;
277     return lstModelShowNPoints[ mActualCollection ];
278 }
279
280 // EED 2022-05-19
281 //------------------------------------------------------------------------
282 ViewShowNPoints* WidgetShowNPoints::GetViewShowNPoints()
283 {
284     return lstViewShowNPoints[ mActualCollection ];
285 }
286
287
288 //------------------------------------------------------------------------
289 void WidgetShowNPoints::SetRadio(double radio)
290 {
291     // EED 2022-05-19
292     // GetModelShowNPoints()->SetRadio(radio);
293     int i,size = lstModelShowNPoints.size();
294     for (i=0;i<size;i++)
295     {
296         lstModelShowNPoints[i]->SetRadio( radio );
297     } // for i
298         //NTU: For Slider
299         sdrRadio->SetValue(radio);
300 }
301
302 //------------------------------------------------------------------------
303 void WidgetShowNPoints::SetColour(std::vector<double> colour)
304 {
305     // EED 2022-05-19
306     //this->mcolour = colour;
307     int i,size = lstViewShowNPoints.size();
308     for (i=0 ; i<size ; i++)
309     {
310         lstViewShowNPoints[i]->mcolour = colour;
311     } // for i
312 }
313
314 //------------------------------------------------------------------------
315 void WidgetShowNPoints::SetImage(vtkImageData* image)
316 {
317     // EED 2022-05-19
318         //GetModelShowNPoints()->SetImage(image);
319     int i,size = lstModelShowNPoints.size();
320     for (i=0 ; i<size ; i++)
321     {
322         lstModelShowNPoints[i]->SetImage(image);
323     } // for i
324 }
325
326 //------------------------------------------------------------------------
327 void WidgetShowNPoints::SetOpacity(double opacity)
328 {
329     // EED 2022-05-19
330         //this->mopacity=opacity;
331     int i,size = lstViewShowNPoints.size();
332     for (i=0 ; i<size ; i++)
333     {
334         lstViewShowNPoints[i]->mopacity = opacity;
335     } // for i
336         //NTU: For Slider
337         sdrOpacity->SetValue( opacity*100.0 );
338 }
339
340
341 //------------------------------------------------------------------------
342 void  WidgetShowNPoints::SetRenderer(vtkRenderer *renderer)
343 {
344     // EED 2022-05-19
345         //this->renderer        = renderer;
346     int i,size = lstViewShowNPoints.size();
347     for (i=0 ; i<size ; i++)
348     {
349         lstViewShowNPoints[i]->renderer = renderer;
350     } // for i
351 }
352
353 /* EED 2022-05-19
354 //------------------------------------------------------------------------
355         
356 void WidgetShowNPoints::RefreshPoint(int id)
357 {
358         double spc[3];
359         int x,y,z;
360         GetModelShowNPoints()->GetIdPoint(id,&x,&y,&z);
361         GetModelShowNPoints()->GetImage()->GetSpacing(spc);
362         std::string label       = GetModelShowNPoints()->GetIdLabel(id);
363         double radio            = GetModelShowNPoints()->GetRadio();
364     lstActorsSphere[id]->SetPosition( spc[0]*x , spc[1]*y , spc[2]*z );
365     lstActorsSphere[id]->GetProperty()->SetColor( mcolour[0] , mcolour[1] , mcolour[2] );
366     lstActorsSphere[id]->GetProperty()->SetOpacity( mopacity );
367     lstSourceSphere[id]->SetRadius( radio );
368 //EED 2017-01-01 Migration VTK7
369 #if VTK_MAJOR_VERSION <= 5
370         // ..
371 #else
372     lstSourceSphere[id]->Update();
373 #endif
374     lstActorsText[id]->SetInput( label.c_str()  );
375     lstActorsText[id]->SetPosition(  radio+spc[0]*x , spc[1]*y , spc[2]*z );
376 }
377
378 //------------------------------------------------------------------------
379 void WidgetShowNPoints::RefreshPoints()
380 {
381         int id,size=lstActorsSphere.size();
382         for (id=0;id<size;id++)
383         {
384                 RefreshPoint(id);
385         } // for
386         renderer->GetRenderWindow()->Render();
387 }
388
389 //------------------------------------------------------------------------
390 void WidgetShowNPoints::AddVtkPoint()
391 {
392         // Sphere
393         vtkSphereSource *vtksphere = vtkSphereSource::New();
394         vtksphere->SetThetaResolution (20);
395         vtksphere->SetPhiResolution (20);
396         vtksphere->SetRadius( 1 );
397         //NTU: For updating points
398         lstSourceSphere.push_back(vtksphere);
399         vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
400
401 //EED 2017-01-01 Migration VTK7
402 #if VTK_MAJOR_VERSION <= 5
403         sphereMapper->SetInput( vtksphere->GetOutput() );
404 #else
405         vtksphere->Update();
406         sphereMapper->SetInputData( vtksphere->GetOutput() );
407 #endif
408
409         vtkActor *sphereActor   = vtkActor::New();
410         sphereActor->SetMapper(sphereMapper);
411         sphereActor->SetOrigin(0, 0, 0);
412
413         lstActorsSphere.push_back(sphereActor);
414         if(renderer==NULL){
415                 wxMessageDialog dialog(this, _T("Renderer Not Set"),_T("Renderer Not Set"),wxICON_ERROR);
416                 dialog.ShowModal();             
417                 return;
418         }
419         renderer->AddActor( sphereActor );
420         // Actor
421         vtkTextActor3D *textActor = vtkTextActor3D::New();
422 //      textActor->SetInput( strLabel.c_str()  );
423         renderer->AddActor( textActor );
424         lstActorsText.push_back(textActor);
425 }
426  */
427
428
429 //------------------------------------------------------------------------
430 void WidgetShowNPoints::AddPoint(int x, int y, int z, std::string label)
431 {
432         GetModelShowNPoints()->AddPoint(x,y,z, label );
433     // EED 2022-05-19
434     //AddVtkPoint();
435     //RefreshPoint(lstActorsSphere.size()-1);
436     GetViewShowNPoints()->AddPoint();
437 }
438
439 //------------------------------------------------------------------------
440 void WidgetShowNPoints::InsertPoint(int x, int y, int z, std::string label)//CFT
441 {
442     // EED 2022-05-19
443         //if ( GetModelShowNPoints()->InsertPoint(x,y,z,label) != -1 )
444         //{
445     //    AddVtkPoint();
446         //} else {
447         //      AddPoint(x,y,z,label);
448         //}
449         //RefreshPoints();
450     if ( GetModelShowNPoints()->InsertPoint(x,y,z,label) != -1 )
451     {
452         GetViewShowNPoints()->AddVtkPoint();
453     } else {
454         AddPoint(x,y,z,label);
455     }
456     GetViewShowNPoints()->RefreshPoints();
457 }
458
459 //------------------------------------------------------------------------
460 void WidgetShowNPoints::OnInsertPoint_()
461 {
462     // EED 2022-05-19
463     //if (this->renderer==NULL)
464     if (GetViewShowNPoints()->renderer==NULL)
465     {
466         return;
467     }
468
469     std::vector<int> point = GetModelShowNPoints()->GetReferencePoint();
470     if (point.size()==3)
471     {
472         InsertPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
473         SetOutputBox();
474     } else {//mpoint.size
475         printf("creaMaracasVisu::ShowNPoints (not match point) \n");
476     }
477 }
478
479
480
481 //------------------------------------------------------------------------
482 void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event)
483 {       
484     // EED 2022-05-19
485         //if (this->renderer==NULL)
486     if (GetViewShowNPoints()->renderer==NULL)
487         {
488                 return;
489         }
490
491         std::vector<int> point = GetModelShowNPoints()->GetReferencePoint();
492         if (point.size()==3)
493         {
494                 AddPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
495                 SetOutputBox();
496         // EED 2022-05-19
497         //renderer->GetRenderWindow()->Render();
498         GetViewShowNPoints()->Render();
499         } else {//mpoint.size
500                 printf("creaMaracasVisu::ShowNPoints (not match point) \n");
501         }
502 }
503
504 //------------------------------------------------------------------------
505 void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT
506 {
507     OnInsertPoint_();
508 }
509
510
511 //------------------------------------------------------------------------
512         void WidgetShowNPoints::SetOutputBox()
513         {
514 //EED           renderer->GetRenderWindow()->Render();
515                 wxString strTmp;
516                 strTmp.Printf(_T("Nbr of points: %d"), GetModelShowNPoints()->GetLstPointsSize() );
517                 txtNrPoints->SetLabel( strTmp );
518                 //--BBTK
519
520 //EED 2017-06-03
521 //              mbbShowNPoints->bbSetOutputlstPointsX( GetModelShowNPoints()->GetLstPointsX() );
522 //              mbbShowNPoints->bbSetOutputlstPointsY( GetModelShowNPoints()->GetLstPointsY() );
523 //              mbbShowNPoints->bbSetOutputlstPointsZ( GetModelShowNPoints()->GetLstPointsZ() );
524 //              mbbShowNPoints->bbSetOutputlstLabels( GetModelShowNPoints()->GetLstLabels() );
525 //              mbbShowNPoints->bbSignalOutputModification();
526         }
527
528
529 //------------------------------------------------------------------------
530         void WidgetShowNPoints::OnSavePoints(wxCommandEvent& event)
531         {
532
533 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
534 #if wxMAJOR_VERSION <= 2
535                 wxFileDialog* FD = new wxFileDialog( 0,
536                                             _T("Save points .."),
537                                             _T(""),
538                                             _T(""),
539                                             _T("(*.xls)|*.xls"),
540                                             wxSAVE | wxOVERWRITE_PROMPT,
541                                             wxDefaultPosition);
542 #else
543                 wxFileDialog* FD = new wxFileDialog( 0,
544                                             _T("Save points .."),
545                                             _T(""),
546                                             _T(""),
547                                             _T("(*.xls)|*.xls"),
548                                             wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
549                                             wxDefaultPosition);
550 #endif
551
552                 int result_FD = FD->ShowModal();
553                 // This line is need it by windows //EED
554                 FD->SetReturnCode( result_FD );
555                 if (FD->GetReturnCode()==wxID_OK)
556                 {
557                         std::string filename= (const char*) ( FD->GetPath().mb_str() ); 
558                         GetModelShowNPoints()->SavePoints( filename );
559                 }       // dialog box
560         }
561
562
563 //------------------------------------------------------------------------
564         void WidgetShowNPoints::OnLoadPoints(wxCommandEvent& event)
565         {
566
567 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
568 #if wxMAJOR_VERSION <= 2
569                 wxFileDialog* FD = new wxFileDialog( 0,
570                                              _T("Load points .."),
571                                              _T(""),
572                                              _T(""),
573                                              _T("(*.xls)|*.xls"),
574                                              wxOPEN | wxFILE_MUST_EXIST,
575                                              wxDefaultPosition);
576 #else
577                 wxFileDialog* FD = new wxFileDialog( 0,
578                                              _T("Load points .."),
579                                              _T(""),
580                                              _T(""),
581                                              _T("(*.xls)|*.xls"),
582                                              wxFD_OPEN | wxFD_FILE_MUST_EXIST,
583                                              wxDefaultPosition);
584 #endif
585                 int i;
586                 //EED
587                 int result_FD = FD->ShowModal();
588                 // This line is need it by windows //EED
589                 FD->SetReturnCode( result_FD );
590                 if (FD->GetReturnCode()==wxID_OK)
591                 {
592
593                         std::string filename= (const char*) ( FD->GetPath().mb_str() ); 
594                         int numberPointsRead = GetModelShowNPoints()->ReadPoints( filename );
595                         for (i=0;i<numberPointsRead;i++)
596                         {
597                 // EED 2022-05-19
598                 //AddVtkPoint();
599                 GetViewShowNPoints()->AddVtkPoint();
600                         }// for
601                         SetOutputBox();
602             // EED 2022-05-19
603                         //RefreshPoints();
604             GetViewShowNPoints()->RefreshPoints();
605                 }       // dialog box
606         }
607
608 //------------------------------------------------------------------------
609 void WidgetShowNPoints::OnSetPoint_()
610 {
611     int id=GetModelShowNPoints()->GetNearestPoint();
612     if((id==-1) && (mtype==1))
613     {
614         id=0;
615         AddPoint(0,0,0,"");
616         SetOutputBox();
617     }
618     if (id>=0)
619     {
620         GetModelShowNPoints()->SetPointId_mReferencePoint(id);
621         // EED 2022-05-19
622         //RefreshPoint(id);
623         //renderer->GetRenderWindow()->Render();
624         GetViewShowNPoints()->RefreshPoint(id);
625         GetViewShowNPoints()->Render();
626     } // if id
627     SetOutputBox();
628 }
629
630 //------------------------------------------------------------------------
631 void WidgetShowNPoints::OnSetPoint(wxCommandEvent& event)
632 {
633     OnSetPoint_();
634 }
635
636 //------------------------------------------------------------------------
637 void WidgetShowNPoints::TrackingPoint( )
638 {
639     if ( cbTrackPoint->GetValue() == true )
640     {
641         int id = GetModelShowNPoints()->IdInsidePoint();
642         if (id>=0)
643         {
644             idTrack=id;
645         }
646         
647         if (idTrack>=0)
648         {
649             GetModelShowNPoints()->SetPointId_mReferencePoint(idTrack);
650             GetViewShowNPoints()->RefreshPoint(idTrack);
651             GetViewShowNPoints()->Render();
652         } // if id
653     } // if trackPointFlag
654 }
655
656 //------------------------------------------------------------------------
657 void WidgetShowNPoints::OnTrackPoint_tool()
658 {
659     cbTrackPoint->SetValue( !cbTrackPoint->GetValue() );
660     OnTrackPoint_();
661 }
662
663 //------------------------------------------------------------------------
664 void WidgetShowNPoints::OnTrackPoint_()
665 {
666     idTrack         =   -1;
667     if ( cbTrackPoint->GetValue() == true )
668     {
669         idTrack = GetModelShowNPoints()->IdInsidePoint();
670     } // if trackPointFlag
671 }
672
673 //------------------------------------------------------------------------
674 void WidgetShowNPoints::OnTrackPoint(wxCommandEvent& event)
675 {
676     OnTrackPoint_();
677 }
678
679 //------------------------------------------------------------------------
680 void WidgetShowNPoints::StopTrackPoint( )
681 {
682     cbTrackPoint->SetValue(false);
683     idTrack=-1;
684 }
685
686 //------------------------------------------------------------------------
687         void WidgetShowNPoints::OnRenamePoint(wxCommandEvent& event)
688         {
689                 int id = GetModelShowNPoints()->RenamePoint( (const char*) ( textCtrl->GetValue().mb_str() ) );
690                 if (id>=0)
691                 {
692             // EED 2022-05-19
693                         //lstActorsText[id]->SetInput(  (const char*) ( textCtrl->GetValue().mb_str() ) );
694                         //renderer->GetRenderWindow()->Render();
695             GetViewShowNPoints()->lstActorsText[id]->SetInput(  (const char*) ( textCtrl->GetValue().mb_str() ) );
696             GetViewShowNPoints()->Render();
697             SetOutputBox();
698                 }
699         }
700
701 //------------------------------------------------------------------------
702         void WidgetShowNPoints::ErasePoint(int id)
703         {
704         // EED 2022-05-19
705                 //if (this->renderer!=NULL)
706         if (GetViewShowNPoints()->renderer!=NULL)
707                 {
708                         if (id>=0)
709                         {
710                 // EED 2022-05-19
711                                 //renderer->RemoveActor( lstActorsSphere[id] );
712                                 //renderer->RemoveActor( lstActorsText[id] );
713                                 //lstActorsSphere[id]->Delete();
714                                 //lstActorsText[id]->Delete();
715                                 //lstSourceSphere[id]->Delete();
716                                 //lstActorsSphere.erase( lstActorsSphere.begin()+id );
717                                 //lstActorsText.erase( lstActorsText.begin()+id );
718                                 //lstSourceSphere.erase( lstSourceSphere.begin()+id );
719                 GetViewShowNPoints()->ErasePoint(id);
720                                 GetModelShowNPoints()->ErasePoint(id);
721                         } // if id
722                 } // if renderer
723         }
724
725 //------------------------------------------------------------------------
726     void WidgetShowNPoints::OnErasePoint_()
727     {
728         ErasePoint( GetModelShowNPoints()->IdInsidePoint() );
729         SetOutputBox();
730         // EED 2022-05-19
731         //renderer->GetRenderWindow()->Render();
732         GetViewShowNPoints()->Render();
733         StopTrackPoint();
734     }
735
736 //------------------------------------------------------------------------
737         void WidgetShowNPoints::OnErasePoint(wxCommandEvent& event)
738         {
739                 OnErasePoint_();
740         }
741
742 //------------------------------------------------------------------------
743         void WidgetShowNPoints::OnEraseLastPoint(wxCommandEvent& event)
744         {
745         // EED 2022-05-19
746         //ErasePoint( lstActorsSphere.size()-1 );
747         //renderer->GetRenderWindow()->Render();
748         int id = GetViewShowNPoints()->lstActorsSphere.size()-1;
749         ErasePoint( id );
750         GetViewShowNPoints()->Render();
751         SetOutputBox();
752         StopTrackPoint();
753         }
754
755 //------------------------------------------------------------------------
756 void WidgetShowNPoints::DeleteAllPoints()
757 {
758     // EED 2022-05-19
759     //int id,size=lstActorsSphere.size();
760     int id,size=GetViewShowNPoints()->lstActorsSphere.size();
761     for (id=size-1;id>=0;id--)
762     {
763         ErasePoint(id);
764     }
765     SetOutputBox();
766     // EED 2022-05-19
767     //renderer->GetRenderWindow()->Render();
768     GetViewShowNPoints()->Render();
769 }
770
771
772 //------------------------------------------------------------------------
773 void WidgetShowNPoints::OnDeleteAllPoints(wxCommandEvent& event)
774 {
775         DeleteAllPoints();
776 }
777
778 //NTU: Method for updating points opacity and Radio
779
780 //------------------------------------------------------------------------
781 void WidgetShowNPoints::UpdatePoints_()
782 {
783     // EED 2022-05-19
784     //this->mopacity = sdrOpacity->GetValue()/100.0;
785     //GetModelShowNPoints()->SetRadio( sdrRadio->GetValue() ) ;
786     //RefreshPoints();
787
788     double opacity  = sdrOpacity->GetValue()/100.0;
789     double radio    = sdrRadio->GetValue();
790     int i,size      = lstViewShowNPoints.size();
791     for (i=0 ; i<size ; i++)
792     {
793         lstViewShowNPoints[i]->mopacity = opacity;
794         lstModelShowNPoints[i]->SetRadio( radio ) ;
795     } // for i
796 //    GetViewShowNPoints()->RefreshPoints();
797 }
798
799 //------------------------------------------------------------------------
800 void WidgetShowNPoints::UpdatePoints(wxCommandEvent &event)
801 {
802     RefreshColourCollection();
803 }
804
805 //------------------------------------------------------------------------
806 void  WidgetShowNPoints::SetReferencePoint(std::vector<int> point)
807 {
808         GetModelShowNPoints()->SetReferencePoint(point);
809     int i,size=lstModelShowNPoints.size();
810     for (i=0;i<size;i++)
811     {
812         lstModelShowNPoints[i]->SetReferencePoint(point);    // All collection
813     } // for i
814 }
815
816 //------------------------------------------------------------------------
817 void  WidgetShowNPoints::SetInitLstPoints( std::vector<int> initLstPointsX,  std::vector<int> initLstPointsY, std::vector<int> initLstPointsZ, std::vector<std::string> initLstLabels )
818 {
819     // EED 2022-05-19
820         //if (this->renderer==NULL)
821     if (GetViewShowNPoints()->renderer==NULL)
822         {
823                 return;
824         }
825         int i,sizeX,sizeY,sizeZ,sizeLabels;
826         sizeX = (int)initLstPointsX.size();
827         sizeY = (int)initLstPointsY.size();
828         sizeZ = (int)initLstPointsZ.size();
829         sizeLabels = (int)initLstLabels.size();
830         int x,y,z;
831         std::string label;
832         if ( (sizeX==sizeY) && (sizeX==sizeZ) )
833         {
834                 for (i=0;i<sizeX;i++)
835                 {
836                         x               = initLstPointsX[i];
837                         y               = initLstPointsY[i];
838                         z               = initLstPointsZ[i];
839                         if (i<sizeLabels) 
840                         {
841                                 label   = initLstLabels[i];
842                         } else {
843                                 label="";
844                         }
845                         AddPoint( x,y,z,label );
846                 } // for i
847                 //      SetOutputBox(); 
848                 //      renderer->GetRenderWindow()->Render();
849         } // if size
850 }
851
852 //------------------------------------------------------------------------
853 void WidgetShowNPoints::SetType(int type)
854 {
855         mtype=type;
856 }
857
858 //------------------------------------------------------------------------
859 int WidgetShowNPoints::GetType()
860 {
861         return mtype;
862 }
863
864
865 //------------------------------------------------------------------------
866 double WidgetShowNPoints::GetRadio()
867 {
868         return sdrRadio->GetValue();
869 }
870 //------------------------------------------------------------------------
871 double WidgetShowNPoints::GetOpacity()
872 {
873         return sdrOpacity->GetValue()/100;
874 }
875
876 //------------------------------------------------------------------------
877 void WidgetShowNPoints::InsertCollection()
878 {
879     ModelShowNPoints*   model   = new ModelShowNPoints();
880     ViewShowNPoints*    view    = new ViewShowNPoints( model );
881     model->SetImage( lstModelShowNPoints[0]->GetImage() );
882     view->mopacity = lstViewShowNPoints[0]->mopacity;
883     view->renderer = lstViewShowNPoints[0]->renderer;
884     lstModelShowNPoints.insert( lstModelShowNPoints.begin()+mActualCollection , model );
885     lstViewShowNPoints.insert( lstViewShowNPoints.begin()+mActualCollection , view );
886     RefreshCollectionText();
887 }
888
889 //------------------------------------------------------------------------
890 void WidgetShowNPoints::OnInsertCollectionBefore(wxCommandEvent &event)
891 {
892     InsertCollection();
893     RefreshColourCollection();
894     StopTrackPoint();
895 }
896
897 //------------------------------------------------------------------------
898 void WidgetShowNPoints::OnInsertCollectionAfter_()
899 {
900     mActualCollection++;
901     InsertCollection();
902     RefreshColourCollection();
903     StopTrackPoint();
904 }
905
906 //------------------------------------------------------------------------
907 void WidgetShowNPoints::OnInsertCollectionAfter(wxCommandEvent &event)
908 {
909     OnInsertCollectionAfter_();
910 }
911
912 //------------------------------------------------------------------------
913 void WidgetShowNPoints::DeleteCollection_()
914 {
915     if ( lstModelShowNPoints.size()>1 )
916     {
917         DeleteAllPoints();  // Actual Collection
918         lstModelShowNPoints.erase( lstModelShowNPoints.begin()+mActualCollection );
919         lstViewShowNPoints.erase( lstViewShowNPoints.begin()+mActualCollection );
920         if ( mActualCollection>=lstModelShowNPoints.size() )
921         {
922             mActualCollection--;
923         } // if
924     } else {
925         DeleteAllPoints();  // Actual Collection
926     } // if
927 }
928
929 //------------------------------------------------------------------------
930 void WidgetShowNPoints::OnDeleteCollection_()
931 {
932     DeleteCollection_();
933     RefreshCollectionText();
934     RefreshColourCollection();
935     StopTrackPoint();
936 }
937
938 //------------------------------------------------------------------------
939 void WidgetShowNPoints::OnDeleteCollection(wxCommandEvent &event)
940 {
941     OnDeleteCollection_();
942 }
943
944 //------------------------------------------------------------------------
945 void WidgetShowNPoints::OnBackCollection(wxCommandEvent &event)
946 {
947     mActualCollection--;
948     if ( mActualCollection <0  )
949     {
950         mActualCollection=0;
951     } //if <=0
952     RefreshCollectionText();
953     RefreshColourCollection();
954     StopTrackPoint();
955 }
956
957 //------------------------------------------------------------------------
958 void WidgetShowNPoints::OnNextCollection(wxCommandEvent &event)
959 {
960     mActualCollection++;
961     if ( mActualCollection >=lstModelShowNPoints.size() )
962     {
963         mActualCollection = lstModelShowNPoints.size()-1;
964     } //if <=0
965     RefreshCollectionText();
966     RefreshColourCollection();
967     StopTrackPoint();
968 }
969
970 //------------------------------------------------------------------------
971 void WidgetShowNPoints::DetectCollectionActive()
972 {
973     int id;
974     int i,size=lstModelShowNPoints.size();
975     for (i=0;i<size;i++)
976     {
977         id = lstModelShowNPoints[i]->IdInsidePoint();
978         if (id>=0)
979         {
980             mActualCollection=i;
981         } // if id>=0
982     } // for i
983     RefreshCollectionText();
984     RefreshColourCollection();
985 }
986
987 //------------------------------------------------------------------------
988 void WidgetShowNPoints::RefreshColourCollection()
989 {
990     UpdatePoints_();
991     std::vector<double> colourAll;
992     colourAll.push_back(1);
993     colourAll.push_back(0);
994     colourAll.push_back(0);
995     std::vector<double> colourActual;
996     colourActual.push_back(1);
997     colourActual.push_back(1);
998     colourActual.push_back(0);
999     SetColour( colourAll );                                             // For all collections
1000     int i,size=lstViewShowNPoints.size();
1001     for (i=0;i<size;i++)
1002     {
1003         lstViewShowNPoints[i] -> mcolour = colourAll;    // All collection
1004         lstViewShowNPoints[i]->RefreshEachPoint();
1005     } // for i
1006     lstViewShowNPoints[mActualCollection] -> mcolour = colourActual;    // Actual collection
1007     lstViewShowNPoints[mActualCollection] -> RefreshEachPoint();
1008     lstViewShowNPoints[mActualCollection] -> renderer->GetRenderWindow()->Render();
1009 }
1010
1011 //------------------------------------------------------------------------
1012 void WidgetShowNPoints::RefreshCollectionText()
1013 {
1014     if ((mtype==4) && (txtNrCollections!=NULL))  // Just for Collection interface
1015     {
1016         wxString strTmp;
1017         strTmp.Printf(_T("%d   /  %d "),  (int)mActualCollection+1, (int)lstModelShowNPoints.size() );
1018         txtNrCollections->SetLabel( strTmp );
1019         SetOutputBox();
1020     } // if mtype 4
1021 }
1022
1023 //------------------------------------------------------------------------
1024 void WidgetShowNPoints::OnSaveCollections(wxCommandEvent &event)
1025 {
1026     //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
1027     #if wxMAJOR_VERSION <= 2
1028             wxFileDialog* FD = new wxFileDialog( 0,
1029                                                 _T("Save groups of points .."),
1030                                                 _T(""),
1031                                                 _T(""),
1032                                                 _T("(*.xls)|*.xls"),
1033                                                 wxSAVE | wxOVERWRITE_PROMPT,
1034                                                 wxDefaultPosition);
1035     #else
1036             wxFileDialog* FD = new wxFileDialog( 0,
1037                                                 _T("Save groups of points .."),
1038                                                 _T(""),
1039                                                 _T(""),
1040                                                 _T("(*.xls)|*.xls"),
1041                                                 wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
1042                                                 wxDefaultPosition);
1043     #endif
1044
1045             int result_FD = FD->ShowModal();
1046             // This line is need it by windows //EED
1047             FD->SetReturnCode( result_FD );
1048             if (FD->GetReturnCode()==wxID_OK)
1049             {
1050                 std::string filename= (const char*) ( FD->GetPath().mb_str() );
1051
1052                 FILE *ff;
1053                 ff = fopen( filename.c_str() , "w+" );
1054                 if (ff!=NULL)
1055                 {
1056                     int i,size=lstModelShowNPoints.size();
1057                     fprintf(ff,"NumberOfGroups %d \n",size);
1058
1059                     for (i=0;i<size;i++)
1060                     {
1061                         lstModelShowNPoints[i]->SavePoints_(ff);
1062                     } // for i
1063
1064                     fclose(ff);
1065                 } else {   // else ff
1066                     printf("WidgetShowNPoints::Save Groups Points  ...Error... creating file \n");
1067                 } //ff
1068
1069                 
1070             }     // dialog box
1071     StopTrackPoint();
1072
1073 }
1074
1075 //------------------------------------------------------------------------
1076 void WidgetShowNPoints::OnLoadCollections(wxCommandEvent &event)
1077 {
1078     //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
1079     #if wxMAJOR_VERSION <= 2
1080             wxFileDialog* FD = new wxFileDialog( 0,
1081                                                  _T("Load groups of points .."),
1082                                                  _T(""),
1083                                                  _T(""),
1084                                                  _T("(*.xls)|*.xls"),
1085                                                  wxOPEN | wxFILE_MUST_EXIST,
1086                                                  wxDefaultPosition);
1087     #else
1088             wxFileDialog* FD = new wxFileDialog( 0,
1089                                                  _T("Load groups of points .."),
1090                                                  _T(""),
1091                                                  _T(""),
1092                                                  _T("(*.xls)|*.xls"),
1093                                                  wxFD_OPEN | wxFD_FILE_MUST_EXIST,
1094                                                  wxDefaultPosition);
1095     #endif
1096             bool okEraseFirstGrout=false;
1097
1098             int result_FD = FD->ShowModal();
1099             // This line is need it by windows //EED
1100             FD->SetReturnCode( result_FD );
1101             if (FD->GetReturnCode()==wxID_OK)
1102             {
1103                 if (lstModelShowNPoints.size()==1)
1104                 {
1105                     if (GetModelShowNPoints()->GetLstPointsSize()==0) { okEraseFirstGrout=true; }
1106                 }
1107                 std::string filename= (const char*) ( FD->GetPath().mb_str() );
1108                 FILE *ff = fopen( filename.c_str() , "r+" );
1109                 if (ff!=NULL)
1110                 {
1111                     int i;
1112                     int iGroup,sizeGroups;
1113                     int iPoint,numberPointsRead;
1114                     char chartmp[256];
1115                     fscanf(ff," %s %d",chartmp,&sizeGroups);
1116                     for (iGroup=0;iGroup<sizeGroups;iGroup++)
1117                     {
1118                         mActualCollection = lstModelShowNPoints.size();
1119                         InsertCollection();
1120
1121                         int numberPointsRead= lstModelShowNPoints[mActualCollection]->ReadPoints_(ff);
1122                         for (i=0;i<numberPointsRead;i++)
1123                         {
1124                             // EED 2022-05-19
1125                             //AddVtkPoint();
1126                             GetViewShowNPoints()->AddVtkPoint();
1127                         }// for
1128                     } // for i
1129
1130                     fclose(ff);
1131                 } else {   // else ff
1132                     printf("WidgetShowNPoints::Load Group of Points  ...Error... reading file");
1133                 } //ff
1134                 if (okEraseFirstGrout==true)
1135                 {
1136                     mActualCollection=0;
1137                     DeleteCollection_();
1138                     mActualCollection = lstModelShowNPoints.size()-1;
1139                 }
1140                 RefreshCollectionText();
1141                 RefreshColourCollection();
1142             }     // dialog box
1143     StopTrackPoint();
1144 }
1145
1146
1147 //------------------------------------------------------------------------
1148 std::vector<int> WidgetShowNPoints::GetLstPointsX()
1149 {
1150     if (mtype!=4)
1151     {
1152         return GetModelShowNPoints()->GetLstPointsX();
1153     } else {
1154         std::vector<int> lst;
1155         int iP,s;
1156         int iG,sG=lstModelShowNPoints.size();
1157         for (iG=0 ; iG<sG ; iG++)
1158         {
1159             std::vector<int> lstTmp = lstModelShowNPoints[iG]->GetLstPointsX();
1160             s = lstTmp.size();
1161             for (iP=0 ; iP<s ; iP++)
1162             {
1163                 lst.push_back( lstTmp[iP] );
1164             } // for iP
1165         } // for iG
1166         return lst;
1167     } // if 4
1168 }
1169
1170 //------------------------------------------------------------------------
1171 std::vector<int> WidgetShowNPoints::GetLstPointsY()
1172 {
1173     if (mtype!=4)
1174     {
1175         return GetModelShowNPoints()->GetLstPointsY();
1176     } else {
1177         std::vector<int> lst;
1178         int iP,s;
1179         int iG,sG=lstModelShowNPoints.size();
1180         for (iG=0 ; iG<sG ; iG++)
1181         {
1182             std::vector<int> lstTmp = lstModelShowNPoints[iG]->GetLstPointsY();
1183             s = lstTmp.size();
1184             for (iP=0 ; iP<s ; iP++)
1185             {
1186                 lst.push_back( lstTmp[iP] );
1187             } // for iP
1188         } // for iG
1189         return lst;
1190     }
1191 }
1192
1193 //------------------------------------------------------------------------
1194 std::vector<int> WidgetShowNPoints::GetLstPointsZ()
1195 {
1196     if (mtype!=4)
1197     {
1198         return GetModelShowNPoints()->GetLstPointsZ();
1199     } else {
1200         std::vector<int> lst;
1201         int iP,s;
1202         int iG,sG=lstModelShowNPoints.size();
1203         for (iG=0 ; iG<sG ; iG++)
1204         {
1205             std::vector<int> lstTmp = lstModelShowNPoints[iG]->GetLstPointsZ();
1206             s = lstTmp.size();
1207             for (iP=0 ; iP<s ; iP++)
1208             {
1209                 lst.push_back( lstTmp[iP] );
1210             } // for iP
1211         } // for iG
1212         return lst;
1213
1214     }
1215 }
1216
1217 //------------------------------------------------------------------------
1218 std::vector<std::string> WidgetShowNPoints::GetLstLabels()
1219 {
1220     if (mtype!=4)
1221     {
1222         return GetModelShowNPoints()->GetLstLabels();
1223     } else {
1224         std::vector< std::string > lst;
1225         int iP,s;
1226         int iG,sG=lstModelShowNPoints.size();
1227         for (iG=0 ; iG<sG ; iG++)
1228         {
1229             std::vector< std::string > lstTmp = lstModelShowNPoints[iG]->GetLstLabels();
1230             s = lstTmp.size();
1231             for (iP=0 ; iP<s ; iP++)
1232             {
1233                 lst.push_back( lstTmp[iP] );
1234             } // for iP
1235         } // for iG
1236         return lst;
1237     }
1238 }
1239
1240 //------------------------------------------------------------------------
1241 std::vector<int> WidgetShowNPoints::GetLstIndexs()
1242 {
1243     std::vector<int> lstIndexs;
1244     if (mtype!=4)
1245     {
1246         lstIndexs.push_back( GetModelShowNPoints()->GetLstPointsSize() );
1247     } else {
1248         int iG,sG=lstModelShowNPoints.size();
1249         for (iG=0 ; iG<sG ; iG++)
1250         {
1251             lstIndexs.push_back( lstModelShowNPoints[iG]->GetLstPointsSize() );
1252         } // for iG
1253     }
1254     return lstIndexs;
1255 }
1256
1257 //------------------------------------------------------------------------
1258 int WidgetShowNPoints::GetLstModelShowNPointsSize()
1259 {
1260     return lstModelShowNPoints.size();
1261 }