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