]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx
058136452cd1a1c5918b2193c1a412ac7d563723
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / WidgetShowNPoints.cxx
1
2 #include <wx/button.h>
3 #include <wx/sizer.h>
4 #include <wx/filedlg.h>
5 #include <wx/msgdlg.h>
6 #include <wx/notebook.h>
7
8
9 #include <vtkStaticPointLocator.h>
10 #include <vtkPointData.h>
11 #include <vtkDataArray.h>
12 #include <vtkMath.h>
13 #include <vtkStaticPointLocator.h>
14 #include <vtkPoints.h>
15
16 #include "vtkSphereSource.h"
17 #include "vtkRenderer.h"
18 #include "vtkTextActor3D.h"
19
20 #include "WidgetShowNPoints.h"
21 #include <creaContoursFactory.h>
22
23
24 //----------------------------------------------------------------------
25 //----------------------------------------------------------------------
26 //----------------------------------------------------------------------
27 //----------------------------------------------------------------------
28 //----------------------------------------------------------------------
29   WidgetShowNPoints::WidgetShowNPoints(wxWindow *parent, int type)
30     : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
31   {
32       aux_mesh      =   NULL;
33       aux_mesh_spc.push_back(1);
34       aux_mesh_spc.push_back(1);
35       aux_mesh_spc.push_back(1);
36       aux_mesh_type = 0;   // 0:Patch  1:CloseSpline1  2:CloseSpline2
37       
38         // EED 2022-05-19
39     //  mmodelShowNPoints                                   = new ModelShowNPoints();
40                         idUndoRedo          = 0;
41                         maxUndoRedo         = 0;        
42 #if defined(_WIN32)
43                                                 char * val = getenv( "TEMP" );
44                                                 if (val == NULL) 
45                                                 { 
46                                                         UndoRedoDir = std::string("");  
47                                                 } else { 
48                                                         UndoRedoDir = std::string(val)+"\\creatools"; 
49                                                         std::string cmd1 = "mkdir "+ UndoRedoDir;
50                                                         system( cmd1.c_str() );
51                                                         // Erasing files of more than 1 day old  ( -1 )
52                                                         std::string cmd2 = "ForFiles /p \"" + UndoRedoDir + "\" /s /d -1 /c \"cmd /c del @file \"";
53                                                         system( cmd2.c_str() );
54                                                 }
55 #elif defined(__GNUC__)
56
57
58     #if defined(MACOSX)
59                                                 UndoRedoDir         = "/tmp/creatools";
60     #else  // Linux
61                                                 UndoRedoDir         = "/tmp/creatools";
62     #endif
63         
64     std::string cmd1 = "mkdir "+ UndoRedoDir;
65     system( cmd1.c_str() );
66         // Erasing files of more than 1 day old  ( +1 )
67         std::string cmd= "find "+UndoRedoDir+" -name \"UndoRedo_collection_*.undoredo\" -type f -mtime +1 -delete";
68         system( cmd.c_str() );
69
70 #else
71                                                 UndoRedoDir         = "./";
72 #endif
73    
74    
75                         mActualCollection   = 0;
76     ModelShowNPoints*   modelShowNPoints    = new ModelShowNPoints();
77     lstModelShowNPoints.push_back( modelShowNPoints );
78     lstViewShowNPoints.push_back( new  ViewShowNPoints( modelShowNPoints ) );
79       
80     mtype                                                       = type;
81     SetType(mtype);
82     wxPanel*        panelParent         = this;
83     wxSizer*        sizer                               = NULL;
84     wxSizer*        MNPsizer            = NULL;
85     wxNotebook*     bookSetPoints       = NULL;
86     wxNotebook*     bookGroupManager    = NULL;
87     wxPanel*        panel               = NULL;
88     wxPanel*        panel2              = NULL;
89                     txtNrCollections    = NULL;
90                     txtNrPoints         = NULL;
91                 cbVisuActualCollection  = NULL;
92                     bookSetPoints       = new wxNotebook(panelParent, -1, wxDefaultPosition, wxDefaultSize, wxNB_TOP );
93                     panel               = new wxPanel(bookSetPoints);
94
95       wxSize sizeButton( 50  ,  -1 );
96       wxSize sizeSlider( 90  ,  -1 );
97
98     // Group Manager
99     if (mtype==4)
100     {
101           bookGroupManager   = new wxNotebook(panelParent, //bbGetWxParent(),
102                               -1,
103                               wxDefaultPosition,
104                               wxDefaultSize,
105                               wxNB_TOP );
106           panel2  = new wxPanel(bookGroupManager);
107           cbVisuActualCollection                = new wxCheckBox    ( panel2,-1, _T("Cur.")   ,   wxDefaultPosition, sizeButton );
108           txtNrCollections                      = new wxStaticText  ( panel2,-1, _T("    1/1    "));
109           wxButton *btnBackCollection           = new wxButton      ( panel2, -1, _T("<")     ,   wxDefaultPosition, sizeButton );
110           wxButton *btnNextCollection           = new wxButton      ( panel2, -1, _T(">")     ,   wxDefaultPosition, sizeButton );
111           wxButton *btnInsertCollectionBefore   = new wxButton      ( panel2, -1, _T("+<")    ,   wxDefaultPosition, sizeButton );
112           wxButton *btnInsertCollectionAfter    = new wxButton      ( panel2, -1, _T("+>")    ,   wxDefaultPosition, sizeButton );
113           wxButton *btnDeleteCollection         = new wxButton      ( panel2, -1, _T("-")     ,   wxDefaultPosition, sizeButton );
114           wxButton *btnResetCollection          = new wxButton      ( panel2, -1, _T("--")    ,   wxDefaultPosition, sizeButton );
115           wxButton *btnSaveCollection           = new wxButton      ( panel2, -1, _T("Save")  ,   wxDefaultPosition, sizeButton );
116           wxButton *btnLoadCollection           = new wxButton      ( panel2, -1, _T("Load")  ,   wxDefaultPosition, sizeButton );
117           wxButton *btnUndo                     = new wxButton      ( panel2, -1, _T("Undo")  ,   wxDefaultPosition, sizeButton );
118           wxButton *btnRedo                     = new wxButton      ( panel2, -1, _T("Redo")  ,   wxDefaultPosition, sizeButton );
119
120          sCtrlRadio = new wxSpinCtrl( panel2, -1  , wxEmptyString, wxDefaultPosition, sizeButton );
121          sCtrlRadio->SetRange(1,10);
122          sCtrlRadio->SetValue( 2 );
123          sCtrlOpacity= new wxSpinCtrl( panel2, -1  , wxEmptyString, wxDefaultPosition, sizeButton );
124          sCtrlOpacity->SetRange(0,10);
125          sCtrlOpacity->SetValue( 10 );
126         
127           wxFlexGridSizer *sizer1               = new wxFlexGridSizer(1);
128           wxFlexGridSizer *sizer2               = new wxFlexGridSizer(2);
129           wxFlexGridSizer *sizer3               = new wxFlexGridSizer(3);
130           wxFlexGridSizer *sizer4               = new wxFlexGridSizer(3);
131           wxFlexGridSizer *sizer5               = new wxFlexGridSizer(2);
132           wxFlexGridSizer *sizer5a              = new wxFlexGridSizer(2);
133           wxFlexGridSizer *sizer6               = new wxFlexGridSizer(2);
134           wxFlexGridSizer *sizer7               = new wxFlexGridSizer(2);
135           wxFlexGridSizer *sizer8               = new wxFlexGridSizer(2);
136         
137           cbVisuActualCollection      -> SetToolTip( _T("Current group") );
138           btnInsertCollectionBefore   -> SetToolTip( _T("+  Add group before") );
139           btnInsertCollectionAfter    -> SetToolTip( _T("+>  Add group after") );
140           btnDeleteCollection         -> SetToolTip( _T("-  Erase group") );
141           btnResetCollection          -> SetToolTip( _T("-- Reset : Erase all groups") );
142           sCtrlRadio                  -> SetToolTip( _T("Radio")   );
143           sCtrlOpacity                -> SetToolTip( _T("Opacity") );
144
145 //          sdrOpacity                            = new wxSlider(panel2, -1, 0, 0, 100, wxDefaultPosition, sizeSlider, wxSL_LABELS);
146 //          sdrRadio                              = new wxSlider(panel2, -1, 0, 1, 50, wxDefaultPosition, sizeSlider, wxSL_LABELS);
147 //          sdrRadio                    -> SetToolTip( _T("Radio")   );
148 //          sdrOpacity                  -> SetToolTip( _T("Opacity") );
149         
150           Connect(cbVisuActualCollection->GetId()   , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnVisuActualCollection     );
151           Connect(btnBackCollection->GetId()        , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) & WidgetShowNPoints::OnBackCollection           );
152           Connect(btnNextCollection->GetId()        , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) & WidgetShowNPoints::OnNextCollection           );
153           Connect(btnInsertCollectionBefore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionBefore   );
154           Connect(btnInsertCollectionAfter->GetId() , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionAfter    );
155           Connect(btnDeleteCollection->GetId()      , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteCollection         );
156         
157 //        Connect(sdrOpacity->GetId()               , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) & WidgetShowNPoints::UpdatePoints               );
158 //        Connect(sdrRadio->GetId()                 , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) & WidgetShowNPoints::UpdatePoints               );
159           Connect( sCtrlRadio->GetId()              ,wxEVT_COMMAND_SPINCTRL_UPDATED ,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
160           Connect( sCtrlOpacity->GetId()            ,wxEVT_COMMAND_SPINCTRL_UPDATED ,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
161         
162           Connect(btnSaveCollection->GetId()        , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) & WidgetShowNPoints::OnSaveCollections          );
163           Connect(btnLoadCollection->GetId()        , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) & WidgetShowNPoints::OnLoadCollections          );
164           Connect(btnResetCollection->GetId()       , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) & WidgetShowNPoints::OnResetCollections         );
165           Connect(btnUndo->GetId()                  , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnUndo                      );
166           Connect(btnRedo->GetId()                  , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnRedo                      );
167
168           sizer2->Add( btnBackCollection );
169           sizer2->Add( btnNextCollection );
170           sizer3->Add( btnInsertCollectionBefore );
171           sizer3->Add( btnInsertCollectionAfter );
172           sizer4->Add( btnLoadCollection );
173           sizer4->Add( btnSaveCollection );
174 //          sizer5->Add( txRadio ,wxGROW );
175 //          sizer5->Add( sdrRadio ,wxGROW );
176 //          sizer5->Add( txOpacity ,wxGROW );
177 //          sizer5->Add( sdrOpacity ,wxGROW );
178         
179           sizer5->Add( sCtrlRadio );
180           sizer5->Add( sCtrlOpacity );
181
182           sizer6->Add( btnDeleteCollection );
183           sizer6->Add( btnResetCollection );
184         
185          sizer7->Add( cbVisuActualCollection );
186          sizer7->Add( txtNrCollections );
187
188          sizer8->Add( btnUndo        );
189          sizer8->Add( btnRedo        );
190
191           sizer1->Add( sizer7 );
192           sizer1->Add( sizer2 );
193           sizer1->Add( sizer3 );
194           sizer1->Add( sizer6 );
195           sizer1->Add( sizer4 );
196           sizer1->Add( sizer5 );
197           sizer1->Add( sizer8 );
198
199 //          sizer1->Add( sizer5 ,wxGROW );
200
201           MNPsizer                        = sizer1;
202           panel2->SetSizer( MNPsizer );
203           panel2->SetAutoLayout(true);
204           panel2->Layout();
205           bookGroupManager->AddPage(panel2 , _T("Groups") );
206     } // if mtype 4
207
208         if ( (mtype==0) || (mtype==3) || (mtype==4) )
209         {
210                 // Widget interface
211 //              askPointLabel                                       = new wxStaticText(panel, -1, _T("Label:")); // JPR
212                 textCtrl                                                    = new wxTextCtrl(panel, -1, wxEmptyString   ,   wxDefaultPosition, sizeButton);
213                 wxButton    *btnBackPoint                   = new wxButton( panel, -1, _T("<")          ,   wxDefaultPosition, sizeButton );
214                 wxButton    *btnNextPoint                   = new wxButton( panel, -1, _T(">")          ,   wxDefaultPosition, sizeButton );
215         wxButton    *btnAddPoint            = new wxButton( panel, -1, _T("+")          ,   wxDefaultPosition, sizeButton );
216         wxButton    *btnInsertPoint         = new wxButton( panel, -1, _T("(+)")        ,   wxDefaultPosition, sizeButton );
217                     cbAutoAddPoints         = new wxCheckBox(panel,-1, _T("Auto")       ,   wxDefaultPosition, sizeButton );
218         wxButton    *btnMovePointUp         = new wxButton( panel, -1, _T("<-")         ,   wxDefaultPosition, sizeButton );
219         wxButton    *btnMovePointDown       = new wxButton( panel, -1, _T("->")         ,   wxDefaultPosition, sizeButton );
220         wxButton    *btnSetPositionPoint    = new wxButton( panel, -1, _T("Set")        ,   wxDefaultPosition, sizeButton );
221                      cbTrackPoint           = new wxCheckBox(panel,-1, _T("Tra.")       ,   wxDefaultPosition, sizeButton );
222         wxButton    *btnRenamePoint                 = new wxButton( panel, -1, _T("Ren.")       ,   wxDefaultPosition, sizeButton );
223         wxButton    *btnErasePoint          = new wxButton( panel, -1, _T("-")          ,   wxDefaultPosition, sizeButton );
224 //              wxButton    *btnEraseLastPoint      = new wxButton( panel, -1, _T("- lst")      ,   wxDefaultPosition, sizeButton );
225                 wxButton    *btnDeleteAllPoints     = new wxButton( panel, -1, _T("--")         ,   wxDefaultPosition, sizeButton );
226         wxButton    *btnUndo                = NULL;
227         wxButton    *btnRedo                = NULL;
228                 wxButton    *btnSavePoints                  = NULL;
229                 wxButton    *btnLoadPoints                  = NULL;
230         btnBackPoint        -> SetToolTip( _T("Select befor point")                         );
231         btnNextPoint        -> SetToolTip( _T("Select next point")                          );
232         cbAutoAddPoints     -> SetToolTip( _T("Auto Add point")                             );
233         btnAddPoint         -> SetToolTip( _T("+  Add point")                               );
234         btnInsertPoint      -> SetToolTip( _T("(+)  Insert point")                          );
235         btnMovePointUp      -> SetToolTip( _T("Move point Up in the normal direction")      );
236         btnMovePointDown    -> SetToolTip( _T("Move point Down in the normal direction")    );
237         btnRenamePoint      -> SetToolTip( _T("Rename label for each point")                );
238         textCtrl            -> SetToolTip( _T("Point label")                                );
239         btnErasePoint       -> SetToolTip( _T("-  Erase point")                             );
240 //        btnEraseLastPoint   -> SetToolTip( _T("- lst  Erase last point")                  );
241         btnDeleteAllPoints  -> SetToolTip( _T("-- Erase all points")                        );
242                 if ( mtype==0 )
243                 {
244             btnUndo             = new wxButton( panel, -1, _T("Undo")       ,   wxDefaultPosition, sizeButton   );
245             btnRedo             = new wxButton( panel, -1, _T("Redo")       ,   wxDefaultPosition, sizeButton   );
246                         btnSavePoints           = new wxButton( panel, -1, _T("Save")       ,   wxDefaultPosition, sizeButton   );
247                         btnLoadPoints       = new wxButton( panel, -1, _T("Load")       ,   wxDefaultPosition, sizeButton   );
248             Connect(btnSavePoints->GetId()    , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints    );
249             Connect(btnLoadPoints->GetId()    , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints    );
250             Connect(btnUndo->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnUndo          );
251             Connect(btnRedo->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnRedo          );
252                 } // if mtype
253                 txtNrPoints                                             = new wxStaticText(panel,-1, _T("   -/-"));
254         wxStaticText* txOpacity;
255         wxStaticText* txRadio;
256         if ( (mtype==0) || (mtype==3) )
257         {
258             //NTU: Sliders for opacity and radio change
259 //            txOpacity         = new wxStaticText(panel, -1, wxString(_T("  Points Opacity  ")));
260 //            sdrOpacity        = new wxSlider(panel, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
261 //            txRadio           = new wxStaticText(panel, -1, wxString(_T("  Points Radius  ")));
262 //            sdrRadio          = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
263 //            //NTU: Slider events
264 //            Connect(sdrOpacity->GetId()          , wxEVT_COMMAND_SLIDER_UPDATED    , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
265 //            Connect(sdrRadio->GetId()            , wxEVT_COMMAND_SLIDER_UPDATED    , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
266             
267             sCtrlRadio = new wxSpinCtrl( panel, -1  , wxEmptyString, wxDefaultPosition, sizeButton );
268             sCtrlRadio->SetRange(1,10);
269             sCtrlRadio->SetValue( 2 );
270             sCtrlOpacity= new wxSpinCtrl( panel, -1  , wxEmptyString, wxDefaultPosition, sizeButton );
271             sCtrlOpacity->SetRange(0,10);
272             sCtrlOpacity->SetValue( 10 );
273             Connect( sCtrlRadio->GetId()              ,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
274             Connect( sCtrlOpacity->GetId()            ,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
275
276             
277         } // if mtype 0 3
278         Connect(cbAutoAddPoints->GetId()    , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WidgetShowNPoints::OnAutoAddPoints       );
279         Connect(btnBackPoint->GetId()       , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnBackPoint           );
280         Connect(btnNextPoint->GetId()       , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnNextPoint           );
281                 Connect(btnAddPoint->GetId()            , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnAddPoint            );
282                 Connect(btnInsertPoint->GetId()         , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnInsertPoint         );
283         Connect(btnMovePointUp->GetId()     , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnMovePointUp         );
284         Connect(btnMovePointDown->GetId()   , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnMovePointDown       );
285                 Connect(btnSetPositionPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint            );
286                 Connect(btnRenamePoint->GetId()         , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnRenamePoint         );
287 //              Connect(btnEraseLastPoint->GetId()      , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnEraseLastPoint      );
288                 Connect(btnErasePoint->GetId()          , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnErasePoint          );
289                 Connect(btnDeleteAllPoints->GetId()     , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnDeleteAllPoints     );
290         Connect(cbTrackPoint->GetId()       , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WidgetShowNPoints::OnTrackPoint          );
291         wxFlexGridSizer *sizer0 = new wxFlexGridSizer(1);
292         wxFlexGridSizer *sizer1 = new wxFlexGridSizer(2);
293         wxFlexGridSizer *sizer2 = new wxFlexGridSizer(3);
294         wxFlexGridSizer *sizer3 = new wxFlexGridSizer(2);
295         wxFlexGridSizer *sizer4 = new wxFlexGridSizer(3);
296 //        wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2);
297         wxFlexGridSizer *sizer6 = new wxFlexGridSizer(2);
298         wxFlexGridSizer *sizer7 = new wxFlexGridSizer(2);
299         wxFlexGridSizer *sizer8 = new wxFlexGridSizer(2);
300         sizer1->Add( textCtrl               );
301         sizer1->Add( btnRenamePoint         );
302         sizer2->Add( btnAddPoint            );
303         sizer2->Add( btnInsertPoint         );
304 //        sizer2->Add( cbAutoAddPoints      );
305         sizer3->Add( btnSetPositionPoint    );
306         sizer3->Add( cbTrackPoint           );
307         sizer4->Add( btnErasePoint          );
308 //        sizer4->Add( btnEraseLastPoint    );
309         sizer4->Add( btnDeleteAllPoints     );
310 //        sizer5->Add( btnUndo                );
311 //        sizer5->Add( btnRedo                );
312         sizer6->Add( btnBackPoint           );
313         sizer6->Add( btnNextPoint           );
314         sizer7->Add( btnMovePointUp         );
315         sizer7->Add( btnMovePointDown       );
316         sizer8->Add( cbAutoAddPoints        );
317         sizer8->Add( txtNrPoints            );
318         //              sizer0->Add(askPointLabel); // JPR
319         sizer0->Add(sizer8);
320         sizer0->Add(sizer6);
321         sizer0->Add(sizer2);
322         sizer0->Add(sizer7);
323                 sizer0->Add(sizer3);
324         sizer0->Add(sizer4);
325         sizer0->Add(sizer1);
326   //      sizer0->Add(sizer5);
327         if ( (mtype==0) || (mtype==3) )
328         {
329             wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2);
330 //            sizer5->Add(txRadio);
331 //            sizer5->Add(sdrRadio,1,wxGROW );
332 //            sizer5->Add(txOpacity);
333 //            sizer5->Add(sdrOpacity,1,wxGROW );
334             sizer5->Add( sCtrlRadio      );
335             sizer5->Add( sCtrlOpacity    );
336             sizer0->Add(sizer5);
337         }  // if mtype 0 3
338         if ( mtype==0 )
339                 {
340             wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2);
341             wxFlexGridSizer *sizer6 = new wxFlexGridSizer(2);
342                         sizer6->Add( btnSavePoints  );
343                         sizer6->Add( btnLoadPoints  );
344             sizer5->Add( btnUndo        );
345             sizer5->Add( btnRedo        );
346             sizer0->Add( sizer6         );
347             sizer0->Add( sizer5         );
348                 } // if mtype 0
349                 sizer = sizer0;
350         }
351
352           if (mtype==1)
353           {
354                   // Widget interface
355                   wxButton *btnSetPositionPoint         = new wxButton( panel, -1, _T("Set nearest point"));
356                   txtNrPoints                                           = new wxStaticText(panel,-1, _T("-/-"));
357
358                   //NTU: Sliders for opacity and radio change
359 //          sdrRadio                            = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
360 //          sdrOpacity                        = new wxSlider(panel, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
361 //          Connect(sdrOpacity->GetId()           , wxEVT_COMMAND_SLIDER_UPDATED    , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
362 //          Connect(sdrRadio->GetId()             , wxEVT_COMMAND_SLIDER_UPDATED    , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
363                   wxStaticText* txOpacity                       = new wxStaticText(panel, -1, wxString(_T("  Points Opacity  ")));
364                   wxStaticText* txRadio                         = new wxStaticText(panel, -1, wxString(_T("  Points Radio  ")));
365           
366           sCtrlRadio = new wxSpinCtrl( panel, -1  , wxEmptyString, wxDefaultPosition, sizeButton );
367           sCtrlRadio->SetRange(1,10);
368           sCtrlRadio->SetValue( 2 );
369           sCtrlOpacity= new wxSpinCtrl( panel, -1  , wxEmptyString, wxDefaultPosition, sizeButton );
370           sCtrlOpacity->SetRange(0,10);
371           sCtrlOpacity->SetValue( 10 );
372           Connect( sCtrlRadio->GetId()              ,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
373           Connect( sCtrlOpacity->GetId()            ,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
374                   Connect(btnSetPositionPoint->GetId()  , wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint);
375           wxFlexGridSizer *sizer1           = new wxFlexGridSizer(1);
376                   sizer1->Add(btnSetPositionPoint);
377                   sizer1->Add(txtNrPoints);
378                   sizer1->Add(txRadio);
379                   //sizer1->Add(sdrRadio,1,wxGROW );
380           //sizer1->Add(sdrOpacity,1,wxGROW );
381           sizer1->Add(sCtrlRadio );
382           sizer1->Add(sCtrlOpacity);
383                   sizer = sizer1;
384           }
385     
386     if (mtype == 2) 
387         {
388                 askPointLabel                                           = new wxStaticText(panel, -1, _T("\nPOINT CONTROLS:")); // JPR
389         wxButton                *btnAddPoint            = new wxButton(panel    , -1, _T("      Add  Point      "));
390         wxButton                *btnDeleteAllPoints = new wxButton(panel    , -1, _T("      Delete All      "));
391         wxStaticText    *spacer                         = new wxStaticText(panel, -1, _T("\n")); // JPR
392                                          textCtrl                       = new wxTextCtrl(panel, -1);
393         Connect(btnAddPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnAddPoint);
394         Connect(btnDeleteAllPoints->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteAllPoints);    
395         wxFlexGridSizer *sizer1             = new wxFlexGridSizer(1);
396         sizer1->Add(askPointLabel);
397         sizer1->Add(btnAddPoint);
398         sizer1->Add(btnDeleteAllPoints);
399         sizer1->Add(spacer);
400         sizer1->Add(textCtrl);
401       //  sdrOpacity                          = new wxSlider();
402       //  sdrRadio                            = new wxSlider();
403         txtNrPoints                         = new wxStaticText(panel, -1, _T("\n\n\n"));
404         sizer                               = sizer1;
405         } // bbGetInputType 2
406
407     panel->SetSizer(sizer);
408     panel->SetAutoLayout(true);
409     panel->Layout();
410     bookSetPoints->AddPage(panel , _T("Points") );
411
412     if ((mtype >= 0) && (mtype <= 3) )
413     {
414         if (sizer!=NULL)
415         {
416             wxFlexGridSizer *sizerParent             = new wxFlexGridSizer(1);
417             sizerParent->Add( bookSetPoints );
418             panelParent->SetSizer( sizerParent );
419             panelParent->SetAutoLayout(true);
420             panelParent->Layout();
421         } // if sizer
422     } // if  mtype 0 1 2 3
423       
424     if (mtype == 4)
425     {
426         if ((sizer!=NULL) && (MNPsizer!=NULL))
427         {
428             wxFlexGridSizer *sizerG             = new wxFlexGridSizer(2);
429             sizerG->Add(bookGroupManager);
430             sizerG->Add(bookSetPoints);
431             panelParent->SetSizer(sizerG);
432             panelParent->SetAutoLayout(true);
433             panelParent->Layout();
434         } // if sizer
435     } // if mtype 4
436 }
437
438 //------------------------------------------------------------------------
439 WidgetShowNPoints::~WidgetShowNPoints()
440 {
441 }
442
443 //------------------------------------------------------------------------
444 ModelShowNPoints* WidgetShowNPoints::GetModelShowNPoints()
445 {
446     // EED 2022-05-19
447     // return mmodelShowNPoints;
448     return lstModelShowNPoints[ mActualCollection ];
449 }
450
451 //------------------------------------------------------------------------
452 ModelShowNPoints* WidgetShowNPoints::GetModelShowNPoints(int id)
453 {
454         if(id >= 0 && id < lstModelShowNPoints.size())
455         {
456                 return lstModelShowNPoints[ id ];       
457         }
458 }
459
460 // EED 2022-05-19
461 //------------------------------------------------------------------------
462 ViewShowNPoints* WidgetShowNPoints::GetViewShowNPoints()
463 {
464     return lstViewShowNPoints[ mActualCollection ];
465 }
466
467
468 //------------------------------------------------------------------------
469 void WidgetShowNPoints::SetRadio(double radio)
470 {
471     // EED 2022-05-19
472     // GetModelShowNPoints()->SetRadio(radio);
473     int i,size = lstModelShowNPoints.size();
474     for (i=0;i<size;i++)
475     {
476         lstModelShowNPoints[i]->SetRadio( radio );
477     } // for i
478         //NTU: For Slider
479 //      sdrRadio->SetValue(radio);
480     sCtrlRadio->SetValue(radio);
481 }
482
483 //------------------------------------------------------------------------
484 void WidgetShowNPoints::SetColour(std::vector<double> colour)
485 {
486     // EED 2022-05-19
487     //this->mcolour = colour;
488     int i,size = lstViewShowNPoints.size();
489     for (i=0 ; i<size ; i++)
490     {
491         lstViewShowNPoints[i]->mcolour = colour;
492     } // for i
493 }
494
495 //------------------------------------------------------------------------
496 void WidgetShowNPoints::SetImage(vtkImageData* image)
497 {
498     // EED 2022-05-19
499         //GetModelShowNPoints()->SetImage(image);
500     int i,size = lstModelShowNPoints.size();
501     for (i=0 ; i<size ; i++)
502     {
503         lstModelShowNPoints[i]->SetImage(image);
504     } // for i
505 }
506
507 //------------------------------------------------------------------------
508 void WidgetShowNPoints::SetOpacity(double opacity)
509 {
510     // EED 2022-05-19
511         //this->mopacity=opacity;
512     int i,size = lstViewShowNPoints.size();
513     for (i=0 ; i<size ; i++)
514     {
515         lstViewShowNPoints[i]->mopacity = opacity;
516     } // for i
517         //NTU: For Slider
518 //      sdrOpacity->SetValue( opacity*100.0 );
519     sCtrlOpacity->SetValue( opacity*10.0 );
520
521 }
522
523
524 //------------------------------------------------------------------------
525 void  WidgetShowNPoints::SetRenderer(vtkRenderer *renderer)
526 {
527     // EED 2022-05-19
528         //this->renderer        = renderer;
529     int i,size = lstViewShowNPoints.size();
530     for (i=0 ; i<size ; i++)
531     {
532         lstViewShowNPoints[i]->renderer = renderer;
533     } // for i
534 }
535
536 /* EED 2022-05-19
537 //------------------------------------------------------------------------
538         
539 void WidgetShowNPoints::RefreshPoint(int id)
540 {
541         double spc[3];
542         int x,y,z;
543         GetModelShowNPoints()->GetIdPoint(id,&x,&y,&z);
544         GetModelShowNPoints()->GetImage()->GetSpacing(spc);
545         std::string label       = GetModelShowNPoints()->GetIdLabel(id);
546         double radio            = GetModelShowNPoints()->GetRadio();
547     lstActorsSphere[id]->SetPosition( spc[0]*x , spc[1]*y , spc[2]*z );
548     lstActorsSphere[id]->GetProperty()->SetColor( mcolour[0] , mcolour[1] , mcolour[2] );
549     lstActorsSphere[id]->GetProperty()->SetOpacity( mopacity );
550     lstSourceSphere[id]->SetRadius( radio );
551 //EED 2017-01-01 Migration VTK7
552 #if VTK_MAJOR_VERSION <= 5
553         // ..
554 #else
555     lstSourceSphere[id]->Update();
556 #endif
557     lstActorsText[id]->SetInput( label.c_str()  );
558     lstActorsText[id]->SetPosition(  radio+spc[0]*x , spc[1]*y , spc[2]*z );
559 }
560
561 //------------------------------------------------------------------------
562 void WidgetShowNPoints::RefreshPoints()
563 {
564         int id,size=lstActorsSphere.size();
565         for (id=0;id<size;id++)
566         {
567                 RefreshPoint(id);
568         } // for
569         renderer->GetRenderWindow()->Render();
570 }
571
572 //------------------------------------------------------------------------
573 void WidgetShowNPoints::AddVtkPoint()
574 {
575         // Sphere
576         vtkSphereSource *vtksphere = vtkSphereSource::New();
577         vtksphere->SetThetaResolution (20);
578         vtksphere->SetPhiResolution (20);
579         vtksphere->SetRadius( 1 );
580         //NTU: For updating points
581         lstSourceSphere.push_back(vtksphere);
582         vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
583
584 //EED 2017-01-01 Migration VTK7
585 #if VTK_MAJOR_VERSION <= 5
586         sphereMapper->SetInput( vtksphere->GetOutput() );
587 #else
588         vtksphere->Update();
589         sphereMapper->SetInputData( vtksphere->GetOutput() );
590 #endif
591
592         vtkActor *sphereActor   = vtkActor::New();
593         sphereActor->SetMapper(sphereMapper);
594         sphereActor->SetOrigin(0, 0, 0);
595
596         lstActorsSphere.push_back(sphereActor);
597         if(renderer==NULL){
598                 wxMessageDialog dialog(this, _T("Renderer Not Set"),_T("Renderer Not Set"),wxICON_ERROR);
599                 dialog.ShowModal();             
600                 return;
601         }
602         renderer->AddActor( sphereActor );
603         // Actor
604         vtkTextActor3D *textActor = vtkTextActor3D::New();
605 //      textActor->SetInput( strLabel.c_str()  );
606         renderer->AddActor( textActor );
607         lstActorsText.push_back(textActor);
608 }
609  */
610
611
612 void WidgetShowNPoints::SetCurrentPoint(int idCurrentPoint )
613 {
614     int size = GetModelShowNPoints()->GetLstPointsSize();
615     if (idCurrentPoint<0)       { idCurrentPoint = size-1;  }
616     if (idCurrentPoint>=size )  { idCurrentPoint = 0;       }
617     GetModelShowNPoints()->SetIdCurrentPoint( idCurrentPoint );
618     RefreshCollectionText();
619     RefreshColourCollection();
620 }
621
622 void WidgetShowNPoints::OnBackPoint(wxCommandEvent &event)
623 {
624     SetCurrentPoint(  GetModelShowNPoints()->GetIdCurrentPoint() - 1 );
625 }
626
627 void WidgetShowNPoints::OnNextPoint(wxCommandEvent &event)
628 {
629     SetCurrentPoint(  GetModelShowNPoints()->GetIdCurrentPoint() + 1 );
630 }
631
632
633 //------------------------------------------------------------------------
634 void WidgetShowNPoints::AddPoint(double x, double y, double z, std::string label)
635 {
636         GetModelShowNPoints()->AddPoint(x,y,z, label );
637     // EED 2022-05-19
638     //AddVtkPoint();
639     //RefreshPoint(lstActorsSphere.size()-1);
640     GetViewShowNPoints()->AddPoint();
641 }
642
643 //------------------------------------------------------------------------
644 void WidgetShowNPoints::InsertPoint(double x, double y, double z, std::string label)//CFT
645 {
646     // EED 2022-05-19
647         //if ( GetModelShowNPoints()->InsertPoint(x,y,z,label) != -1 )
648         //{
649     //    AddVtkPoint();
650         //} else {
651         //      AddPoint(x,y,z,label);
652         //}
653         //RefreshPoints();
654     if ( GetModelShowNPoints()->InsertPoint(x,y,z,label) != -1 )
655     {
656         GetViewShowNPoints()->AddVtkPoint();
657     } else {
658         AddPoint(x,y,z,label);
659     }
660     GetViewShowNPoints()->RefreshPoints();
661 }
662
663 //------------------------------------------------------------------------
664 void WidgetShowNPoints::OnInsertPoint_()
665 {
666     // EED 2022-05-19
667     //if (this->renderer==NULL)
668     
669     StopAutoAddPoints();
670     StopTrackPoint();
671
672     if (GetViewShowNPoints()->renderer==NULL)
673     {
674         return;
675     }
676     UndoRedo_SaveCollection(); //A
677     std::vector<double> point = GetModelShowNPoints()->GetReferencePoint();
678     if (point.size()==3)
679     {
680         InsertPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
681         SetOutputBox();
682     } else {//mpoint.size
683         printf("creaMaracasVisu::ShowNPoints (not match point) \n");
684     }
685     RefreshCollectionText();
686     RefreshColourCollection();
687     UndoRedo_SaveCollection(); //B
688 }
689
690 //------------------------------------------------------------------------
691 void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT
692 {
693     OnInsertPoint_();
694 }
695
696 //------------------------------------------------------------------------
697 void WidgetShowNPoints::OnAddPoint__()
698 {       
699     // EED 2022-05-19
700         //if (this->renderer==NULL)
701     if (GetViewShowNPoints()->renderer==NULL)
702         {
703                 return;
704         }
705         std::vector<double> point = GetModelShowNPoints()->GetReferencePoint();
706         if (point.size()==3)
707         {
708         UndoRedo_SaveCollection(); //A
709                 AddPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
710         SetOutputBox();
711         // EED 2022-05-19
712         //renderer->GetRenderWindow()->Render();
713         GetViewShowNPoints()->Render();
714         UndoRedo_SaveCollection(); //B
715         } else {//mpoint.size
716                 printf("creaMaracasVisu::ShowNPoints (not match point) \n");
717         }
718 }
719
720 void WidgetShowNPoints::OnAddPoint_()
721 {
722     StopAutoAddPoints();
723     StopTrackPoint();
724     OnAddPoint__();
725 }
726
727 //------------------------------------------------------------------------
728 void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event)
729 {
730     OnAddPoint_();
731 }
732
733 //------------------------------------------------------------------------
734 void WidgetShowNPoints::AutoAddPoints()
735 {
736     if ( cbAutoAddPoints->GetValue() == true )
737     {
738         OnAddPoint__();
739         RefreshCollectionText();
740         RefreshColourCollection();
741     } // if cbAutoAddPoints
742 }
743
744 //------------------------------------------------------------------------
745 void WidgetShowNPoints::OnAutoAddPoints_tool()
746 {
747     StopTrackPoint();
748     cbAutoAddPoints->SetValue( !cbAutoAddPoints->GetValue() );
749 }
750
751 //------------------------------------------------------------------------
752 void WidgetShowNPoints::OnAutoAddPoints_()
753 {
754     StopTrackPoint();
755 }
756
757 //------------------------------------------------------------------------
758 void WidgetShowNPoints::OnAutoAddPoints(wxCommandEvent& event)
759 {
760     StopTrackPoint();
761 }
762
763 //------------------------------------------------------------------------
764 void WidgetShowNPoints::StopAutoAddPoints( )
765 {
766     cbAutoAddPoints->SetValue(false);
767 }
768
769 //------------------------------------------------------------------------
770         void WidgetShowNPoints::SetOutputBox()
771         {
772                 wxString strTmp;
773         if (GetModelShowNPoints()->GetIdCurrentPoint()<0)
774         {
775             strTmp.Printf(_T("   -/%d") , GetModelShowNPoints()->GetLstPointsSize() );
776         } else {
777             strTmp.Printf(_T("   %d/%d"), GetModelShowNPoints()->GetIdCurrentPoint()+1 , GetModelShowNPoints()->GetLstPointsSize() );
778         }// if IdCurrent<0
779                 txtNrPoints->SetLabel( strTmp );
780                 //--BBTK
781
782 //EED 2017-06-03
783 //              mbbShowNPoints->bbSetOutputlstPointsX( GetModelShowNPoints()->GetLstPointsX() );
784 //              mbbShowNPoints->bbSetOutputlstPointsY( GetModelShowNPoints()->GetLstPointsY() );
785 //              mbbShowNPoints->bbSetOutputlstPointsZ( GetModelShowNPoints()->GetLstPointsZ() );
786 //              mbbShowNPoints->bbSetOutputlstLabels( GetModelShowNPoints()->GetLstLabels() );
787 //              mbbShowNPoints->bbSignalOutputModification();
788         }
789
790
791 //------------------------------------------------------------------------
792         void WidgetShowNPoints::OnSavePoints(wxCommandEvent& event)
793         {
794
795 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
796 #if wxMAJOR_VERSION <= 2
797                 wxFileDialog* FD = new wxFileDialog( 0,
798                                             _T("Save points .."),
799                                             _T(""),
800                                             _T(""),
801                                             _T("(*.xls)|*.xls"),
802                                             wxSAVE | wxOVERWRITE_PROMPT,
803                                             wxDefaultPosition);
804 #else
805                 wxFileDialog* FD = new wxFileDialog( 0,
806                                             _T("Save points .."),
807                                             _T(""),
808                                             _T(""),
809                                             _T("(*.xls)|*.xls"),
810                                             wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
811                                             wxDefaultPosition);
812 #endif
813
814                 int result_FD = FD->ShowModal();
815                 // This line is need it by windows //EED
816                 FD->SetReturnCode( result_FD );
817                 if (FD->GetReturnCode()==wxID_OK)
818                 {
819                         std::string filename= (const char*) ( FD->GetPath().mb_str() ); 
820                         GetModelShowNPoints()->SavePoints( filename );
821                 }       // dialog box
822         }
823
824
825 //------------------------------------------------------------------------
826         void WidgetShowNPoints::OnLoadPoints(wxCommandEvent& event)
827         {
828
829 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
830 #if wxMAJOR_VERSION <= 2
831                 wxFileDialog* FD = new wxFileDialog( 0,
832                                              _T("Load points .."),
833                                              _T(""),
834                                              _T(""),
835                                              _T("(*.xls)|*.xls"),
836                                              wxOPEN | wxFILE_MUST_EXIST,
837                                              wxDefaultPosition);
838 #else
839                 wxFileDialog* FD = new wxFileDialog( 0,
840                                              _T("Load points .."),
841                                              _T(""),
842                                              _T(""),
843                                              _T("(*.xls)|*.xls"),
844                                              wxFD_OPEN | wxFD_FILE_MUST_EXIST,
845                                              wxDefaultPosition);
846 #endif
847                 int i;
848                 //EED
849                 int result_FD = FD->ShowModal();
850                 // This line is need it by windows //EED
851                 FD->SetReturnCode( result_FD );
852                 if (FD->GetReturnCode()==wxID_OK)
853                 {
854
855                         std::string filename= (const char*) ( FD->GetPath().mb_str() ); 
856                         int numberPointsRead = GetModelShowNPoints()->ReadPoints( filename );
857                         for (i=0;i<numberPointsRead;i++)
858                         {
859                 // EED 2022-05-19
860                 //AddVtkPoint();
861                 GetViewShowNPoints()->AddVtkPoint();
862                         }// for
863                         SetOutputBox();
864             // EED 2022-05-19
865                         //RefreshPoints();
866             GetViewShowNPoints()->RefreshPoints();
867                 }       // dialog box
868         }
869
870 //------------------------------------------------------------------------
871 void WidgetShowNPoints::OnSetPoint_()
872 {
873     UndoRedo_SaveCollection(); //A
874
875     StopAutoAddPoints();
876     StopTrackPoint();
877
878     //int id=GetModelShowNPoints()->GetNearestPoint();
879     int id=GetModelShowNPoints()->GetIdCurrentPoint();
880
881     if((id==-1) && (mtype==1))
882     {
883         id=0;
884         AddPoint(0,0,0,"");
885         SetOutputBox();
886     }
887     if (id>=0)
888     {
889         GetModelShowNPoints()->SetPointId_mReferencePoint(id);
890         // EED 2022-05-19
891         //RefreshPoint(id);
892         //renderer->GetRenderWindow()->Render();
893         GetViewShowNPoints()->RefreshPoint(id);
894         GetViewShowNPoints()->Render();
895     } // if id
896     RefreshCollectionText();
897     RefreshColourCollection();
898     SetOutputBox();
899     UndoRedo_SaveCollection(); //B
900 }
901
902 //------------------------------------------------------------------------
903 void WidgetShowNPoints::OnSetPoint(wxCommandEvent& event)
904 {
905     OnSetPoint_();
906 }
907
908 //------------------------------------------------------------------------
909 void WidgetShowNPoints::MovePoint_(double step)
910 {
911     step=step;
912     StopAutoAddPoints();
913     StopTrackPoint();
914     int id=GetModelShowNPoints()->GetIdCurrentPoint();
915     if (aux_mesh!=NULL)
916     {
917         if((GetLstModelShowNPointsSize()>=2)  //Check condition
918             && (GetModelShowNPoints()->GetLstPointsSize()>0)
919             && (aux_mesh != NULL)
920             && (aux_mesh_spc.size() == 3))
921         {
922             double              x,y,z;
923             double              p[3];
924             double              normal[3];      // point to modify and normal
925             std::vector<double> pN(3);          // new point
926             vtkStaticPointLocator   *pointLocator   = vtkStaticPointLocator::New();
927             pointLocator->SetDataSet( aux_mesh );
928             pointLocator->BuildLocator();
929             
930     //        int idControlPoint = wsp->GetModelShowNPoints()->GetNearestPoint();
931             int idControlPoint = GetModelShowNPoints()->GetIdCurrentPoint();
932             if(idControlPoint >= 0)
933             {
934                 GetModelShowNPoints()->GetIdPoint(idControlPoint, &x, &y, &z);
935                 p[0] = x * aux_mesh_spc[0];
936                 p[1] = y * aux_mesh_spc[1];
937                 p[2] = z * aux_mesh_spc[2];
938                 long int idMeshPoint = pointLocator->FindClosestPoint(p);
939                 vtkDataArray *dataArrayNormals = aux_mesh->GetPointData()->GetNormals();
940                 if (dataArrayNormals!=NULL)
941                 {
942                     dataArrayNormals->GetTuple(idMeshPoint, normal);
943                     int direction = step;
944     //                pN[0] = p[0] / spc[0] + direction*normal[0];
945     //                pN[1] = p[1] / spc[1] + direction*normal[1];
946     //                pN[2] = p[2] / spc[2] + direction*normal[2];
947                     pN[0] = x + (direction * normal[0]);
948                     pN[1] = y + (direction * normal[1]);
949                     pN[2] = z + (direction * normal[2]);
950                     UndoRedo_SaveCollection(); //A
951                     GetModelShowNPoints()->SetPointById(idControlPoint, pN);
952         //          GetViewShowNPoints()->RefreshPoint(idControlPoint);
953     //                RefreshCollectionText();
954     //                RefreshColourCollection();
955     //                SetOutputBox();
956                     UndoRedo_SaveCollection(); //B
957                 } else {
958                     printf("Error!  WidgetShowNPoints::MovePoint_  Missing normals in aux_mesh  \n");
959                 }
960             } // if idControlPoint
961         } // if wsp->GetLstModelShowNPointsSiz->size()>=2
962     } else {
963         if (id>=0) {
964             int i,j,sizeG,sizeP;
965             double max=100000;
966             double minX=max,minY=max,minZ=max;
967             double maxX=-max,maxY=-max,maxZ=-max;
968             sizeG = lstModelShowNPoints.size();
969             for (i=0; i<sizeG; i++)
970             {
971                 std::vector<double> lstX = lstModelShowNPoints[i]->GetLstPointsX();
972                 std::vector<double> lstY = lstModelShowNPoints[i]->GetLstPointsY();
973                 std::vector<double> lstZ = lstModelShowNPoints[i]->GetLstPointsZ();
974                 sizeP=lstX.size();
975                 for (j=0; j<sizeP; j++)
976                 {
977                     if ( lstX[j]<minX ) { minX=lstX[j]; }
978                     if ( lstY[j]<minY ) { minY=lstY[j]; }
979                     if ( lstZ[j]<minZ ) { minZ=lstZ[j]; }
980                     if ( lstX[j]>maxX ) { maxX=lstX[j]; }
981                     if ( lstY[j]>maxY ) { maxY=lstY[j]; }
982                     if ( lstZ[j]>maxZ ) { maxZ=lstZ[j]; }
983                 } // for j
984             } // for i
985             double pc[3];
986             pc[0]=(minX+maxX) /2 ;  pc[1]=(minY+maxY) /2 ;  pc[2]=(minZ+maxZ) /2 ;
987             double p[3];
988             p[0]=GetModelShowNPoints()->GetLstPointsX()[id];
989             p[1]=GetModelShowNPoints()->GetLstPointsY()[id];
990             p[2]=GetModelShowNPoints()->GetLstPointsZ()[id];
991             double v[3];
992             v[0] = p[0]-pc[0];
993             v[1] = p[1]-pc[1];
994             v[2] = p[2]-pc[2];
995             double mag=sqrt ( v[0]*v[0] + v[1]*v[1] + v[2]*v[2] );
996             std::vector<double> point;
997             if (mag!=0)
998             {
999                 v[0] = v[0]/mag;
1000                 v[1] = v[1]/mag;
1001                 v[2] = v[2]/mag;
1002             } else {
1003                 v[0] = 0;
1004                 v[1] = 0;
1005                 v[2] = 0;
1006             }// if mag
1007             UndoRedo_SaveCollection(); //A
1008             point.push_back( p[0] + step*v[0] );
1009             point.push_back( p[1] + step*v[1] );
1010             point.push_back( p[2] + step*v[2] );
1011             GetModelShowNPoints()->SetPointById(id,point);
1012             UndoRedo_SaveCollection(); //B
1013      } // if id
1014     } // if aux_mesh
1015  RefreshCollectionText();
1016  RefreshColourCollection();
1017 }
1018
1019 //------------------------------------------------------------------------
1020 void WidgetShowNPoints::OnMovePointUp(wxCommandEvent& event)
1021 {
1022     MovePoint_(-1);
1023 }
1024
1025 //------------------------------------------------------------------------
1026 void WidgetShowNPoints::OnMovePointDown(wxCommandEvent& event)
1027 {
1028     MovePoint_(+1);
1029 }
1030
1031 //------------------------------------------------------------------------
1032 void WidgetShowNPoints::TrackingPoint( )
1033 {
1034     if ( cbTrackPoint->GetValue() == true )
1035     {
1036 //        int id = GetModelShowNPoints()->IdInsidePoint();
1037 //        if (id>=0)
1038 //        {
1039 //            idTrack=id;
1040 //        }
1041         
1042 //       int idTrack = GetModelShowNPoints()->GetIdCurrentPoint();
1043         int idTrack = GetModelShowNPoints()->GetNearestPoint();
1044
1045         
1046         if (idTrack>=0)
1047         {
1048             UndoRedo_SaveCollection(); //A
1049             GetModelShowNPoints()->SetIdCurrentPoint(idTrack);
1050             GetModelShowNPoints()->SetPointId_mReferencePoint(idTrack);
1051             
1052             RefreshCollectionText();
1053             RefreshColourCollection();
1054
1055 //            GetViewShowNPoints()->RefreshPoint(idTrack);
1056 //            GetViewShowNPoints()->Render();
1057             UndoRedo_SaveCollection(); //B
1058         } // if id
1059     } // if trackPointFlag
1060 }
1061
1062 //------------------------------------------------------------------------
1063 void WidgetShowNPoints::OnTrackPoint_tool()
1064 {
1065     cbTrackPoint->SetValue( !cbTrackPoint->GetValue() );
1066     OnTrackPoint_();
1067 }
1068
1069 //------------------------------------------------------------------------
1070 void WidgetShowNPoints::OnTrackPoint_()
1071 {
1072     StopAutoAddPoints();
1073
1074 //    idTrack         =   -1;
1075     if ( cbTrackPoint->GetValue() == true )
1076     {
1077         // EED 2023-06-23
1078 //        idTrack = GetModelShowNPoints()->IdInsidePoint();
1079 //        idTrack = GetModelShowNPoints()->GetIdCurrentPoint();
1080     } // if trackPointFlag
1081 }
1082
1083 //------------------------------------------------------------------------
1084 void WidgetShowNPoints::OnTrackPoint(wxCommandEvent& event)
1085 {
1086     OnTrackPoint_();
1087 }
1088
1089 //------------------------------------------------------------------------
1090 void WidgetShowNPoints::StopTrackPoint( )
1091 {
1092     cbTrackPoint->SetValue(false);
1093 //    idTrack=-1;
1094 }
1095
1096 //------------------------------------------------------------------------
1097         void WidgetShowNPoints::OnRenamePoint(wxCommandEvent& event)
1098         {
1099                 int id = GetModelShowNPoints()->RenamePoint( (const char*) ( textCtrl->GetValue().mb_str() ) );
1100                 if (id>=0)
1101                 {
1102             // EED 2022-05-19
1103                         //lstActorsText[id]->SetInput(  (const char*) ( textCtrl->GetValue().mb_str() ) );
1104                         //renderer->GetRenderWindow()->Render();
1105             UndoRedo_SaveCollection(); //A
1106             GetViewShowNPoints()->lstActorsText[id]->SetInput(  (const char*) ( textCtrl->GetValue().mb_str() ) );
1107             GetViewShowNPoints()->Render();
1108             SetOutputBox();
1109             UndoRedo_SaveCollection(); //B
1110                 } // if id
1111         }
1112
1113 //------------------------------------------------------------------------
1114         bool WidgetShowNPoints::ErasePoint(int id)
1115         {
1116         // EED 2022-05-19
1117                 //if (this->renderer!=NULL)
1118         bool ok=false;
1119         if (GetViewShowNPoints()->renderer!=NULL)
1120                 {
1121                         if (id>=0)
1122                         {
1123                 // EED 2022-05-19
1124                                 //renderer->RemoveActor( lstActorsSphere[id] );
1125                                 //renderer->RemoveActor( lstActorsText[id] );
1126                                 //lstActorsSphere[id]->Delete();
1127                                 //lstActorsText[id]->Delete();
1128                                 //lstSourceSphere[id]->Delete();
1129                                 //lstActorsSphere.erase( lstActorsSphere.begin()+id );
1130                                 //lstActorsText.erase( lstActorsText.begin()+id );
1131                                 //lstSourceSphere.erase( lstSourceSphere.begin()+id );
1132                 GetViewShowNPoints()->ErasePoint(id);
1133                                 GetModelShowNPoints()->ErasePoint(id);
1134                 ok=true;
1135                         } // if id
1136                 } // if renderer
1137         return ok;
1138         }
1139
1140 //------------------------------------------------------------------------
1141     void WidgetShowNPoints::OnErasePoint_()
1142     {
1143         StopAutoAddPoints();
1144         StopTrackPoint();
1145
1146         //ErasePoint( GetModelShowNPoints()->IdInsidePoint() );
1147         UndoRedo_SaveCollection(); //A
1148         if (ErasePoint( GetModelShowNPoints()->GetIdCurrentPoint() ) == true)
1149         {
1150             SetOutputBox();
1151             // EED 2022-05-19
1152             //renderer->GetRenderWindow()->Render();
1153             //        GetViewShowNPoints()->Render();
1154             RefreshCollectionText();
1155             RefreshColourCollection();
1156             StopTrackPoint();
1157             UndoRedo_SaveCollection(); //B
1158         }
1159     }
1160
1161 //------------------------------------------------------------------------
1162         void WidgetShowNPoints::OnErasePoint(wxCommandEvent& event)
1163         {
1164                 OnErasePoint_();
1165         }
1166
1167 //------------------------------------------------------------------------
1168         void WidgetShowNPoints::OnEraseLastPoint(wxCommandEvent& event)
1169         {
1170         // EED 2022-05-19
1171         //ErasePoint( lstActorsSphere.size()-1 );
1172         //renderer->GetRenderWindow()->Render();
1173         StopAutoAddPoints();
1174         StopTrackPoint();
1175
1176         UndoRedo_SaveCollection(); //A
1177         int id = GetViewShowNPoints()->lstActorsSphere.size()-1;
1178         ErasePoint( id );
1179         
1180         RefreshCollectionText();
1181         RefreshColourCollection();
1182         
1183         UndoRedo_SaveCollection(); //B
1184         GetViewShowNPoints()->Render();
1185         SetOutputBox();
1186         StopTrackPoint();
1187         }
1188
1189 //------------------------------------------------------------------------
1190 void WidgetShowNPoints::DeleteAllPoints_()
1191 {
1192     // EED 2022-05-19
1193     //int id,size=lstActorsSphere.size();
1194     int id,size=GetViewShowNPoints()->lstActorsSphere.size();
1195     for (id=size-1;id>=0;id--)
1196     {
1197         ErasePoint(id);
1198     }// for id
1199 }
1200
1201 void WidgetShowNPoints::OnDeleteAllPoints_()
1202 {
1203     StopAutoAddPoints();
1204     StopTrackPoint();
1205
1206     UndoRedo_SaveCollection(); //A
1207     DeleteAllPoints_();
1208     UndoRedo_SaveCollection(); //B
1209 }
1210
1211 //------------------------------------------------------------------------
1212 void WidgetShowNPoints::OnDeleteAllPoints(wxCommandEvent& event)
1213 {
1214         OnDeleteAllPoints_();
1215     SetOutputBox();
1216     GetViewShowNPoints()->Render();
1217 }
1218
1219 //NTU: Method for updating points opacity and Radio
1220
1221 //------------------------------------------------------------------------
1222 void WidgetShowNPoints::UpdatePoints_()
1223 {
1224     // EED 2022-05-19
1225     //this->mopacity = sdrOpacity->GetValue()/100.0;
1226     //GetModelShowNPoints()->SetRadio( sdrRadio->GetValue() ) ;
1227     //RefreshPoints();
1228
1229 //    double opacity  = sdrOpacity->GetValue()/100.0;
1230 //    double radio    = sdrRadio->GetValue();
1231     double opacity  = (sCtrlOpacity->GetValue()*10)/100.0;
1232      double radio    = sCtrlRadio->GetValue();
1233       
1234     int i,size      = lstViewShowNPoints.size();
1235     for (i=0 ; i<size ; i++)
1236     {
1237         lstViewShowNPoints[i]->mopacity = opacity;
1238         lstModelShowNPoints[i]->SetRadio( radio ) ;
1239     } // for i
1240 //    GetViewShowNPoints()->RefreshPoints();
1241 }
1242
1243 //------------------------------------------------------------------------
1244 void WidgetShowNPoints::UpdatePoints(wxCommandEvent &event)
1245 {
1246     RefreshColourCollection();
1247 }
1248
1249 //------------------------------------------------------------------------
1250 void  WidgetShowNPoints::SetReferencePoint(std::vector<double> point)
1251 {
1252         GetModelShowNPoints()->SetReferencePoint(point);
1253     int i,size=lstModelShowNPoints.size();
1254     for (i=0;i<size;i++)
1255     {
1256         lstModelShowNPoints[i]->SetReferencePoint(point);    // All collection
1257     } // for i
1258 }
1259
1260 //------------------------------------------------------------------------
1261 void WidgetShowNPoints::SetActualCollection( int actual )
1262 {
1263     if (actual<0)
1264     {
1265         actual=0;
1266     } // if actual<0
1267     
1268     if (actual>lstModelShowNPoints.size()-1 )
1269     {
1270         actual=lstModelShowNPoints.size()-1;
1271     } // if actual<0
1272
1273     mActualCollection=actual;
1274 }
1275
1276
1277 //------------------------------------------------------------------------
1278 void  WidgetShowNPoints::SetInitLstPoints( std::vector<double> initLstPointsX,  std::vector<double> initLstPointsY, std::vector<double> initLstPointsZ, std::vector<std::string> initLstLabels,   std::vector<int> initLstIndexs )
1279 {
1280     if (GetViewShowNPoints()->renderer==NULL)
1281     {
1282         return;
1283     }
1284     double x,y,z;
1285     std::string label;
1286     int i,sizeX,sizeY,sizeZ,sizeTmp,sizeLabels;
1287     int ii,iIndexs,sizeIndexs;
1288     
1289     sizeX       = (int)initLstPointsX.size();
1290     sizeY       = (int)initLstPointsY.size();
1291     sizeZ       = (int)initLstPointsZ.size();
1292     sizeLabels  = (int)initLstLabels.size();
1293     sizeIndexs  = (int)initLstIndexs.size();
1294     
1295     if (sizeIndexs==0)
1296     {
1297         initLstIndexs.push_back(sizeX);
1298         sizeIndexs  = (int)initLstIndexs.size();
1299     }
1300     
1301     if ( (sizeX==sizeY) && (sizeX==sizeZ) )
1302     {
1303         i=0;
1304         for (iIndexs=0;iIndexs<sizeIndexs;iIndexs++ )
1305         {
1306             if (iIndexs!=0)
1307             {
1308                 InsertCollectionAfter_();
1309             }// if last iIndexs
1310             sizeTmp = initLstIndexs[iIndexs];
1311             for (ii=0;ii<sizeTmp;ii++)
1312             {
1313                 x        = initLstPointsX[i];
1314                 y        = initLstPointsY[i];
1315                 z        = initLstPointsZ[i];
1316                 if (i<sizeLabels)
1317                 {
1318                     label    = initLstLabels[i];
1319                 } else {
1320                     label="";
1321                 }
1322                 AddPoint( x,y,z,label );
1323                 i++;
1324             } // for i
1325
1326             
1327         }// for ii
1328         //    SetOutputBox();
1329         //    renderer->GetRenderWindow()->Render();
1330     } // if size
1331
1332     
1333
1334     
1335     /*
1336     
1337     // EED 2022-05-19
1338         //if (this->renderer==NULL)
1339     if (GetViewShowNPoints()->renderer==NULL)
1340         {
1341                 return;
1342         }
1343         int i,sizeX,sizeY,sizeZ,sizeLabels;
1344         sizeX = (int)initLstPointsX.size();
1345         sizeY = (int)initLstPointsY.size();
1346         sizeZ = (int)initLstPointsZ.size();
1347         sizeLabels = (int)initLstLabels.size();
1348         double x,y,z;
1349         std::string label;
1350         if ( (sizeX==sizeY) && (sizeX==sizeZ) )
1351         {
1352                 for (i=0;i<sizeX;i++)
1353                 {
1354                         x               = initLstPointsX[i];
1355                         y               = initLstPointsY[i];
1356                         z               = initLstPointsZ[i];
1357                         if (i<sizeLabels) 
1358                         {
1359                                 label   = initLstLabels[i];
1360                         } else {
1361                                 label="";
1362                         }
1363                         AddPoint( x,y,z,label );
1364                 } // for i
1365                 //      SetOutputBox(); 
1366                 //      renderer->GetRenderWindow()->Render();
1367         } // if size
1368      
1369    */
1370 }
1371
1372 //------------------------------------------------------------------------
1373 void WidgetShowNPoints::SetType(int type)
1374 {
1375         mtype=type;
1376 }
1377
1378 //------------------------------------------------------------------------
1379 int WidgetShowNPoints::GetType()
1380 {
1381         return mtype;
1382 }
1383
1384
1385 //------------------------------------------------------------------------
1386 double WidgetShowNPoints::GetRadio()
1387 {
1388 //      return sdrRadio->GetValue();
1389     return sCtrlRadio->GetValue();
1390 }
1391 //------------------------------------------------------------------------
1392 double WidgetShowNPoints::GetOpacity()
1393 {
1394 //    return sdrOpacity->GetValue()/100;
1395     return (sCtrlOpacity->GetValue()*10)/100.0;
1396 }
1397
1398 //------------------------------------------------------------------------
1399 void WidgetShowNPoints::InsertCollection()
1400 {
1401     ModelShowNPoints*   model   = new ModelShowNPoints();
1402     ViewShowNPoints*    view    = new ViewShowNPoints( model );
1403     view->mopacity              = lstViewShowNPoints[0]->mopacity;
1404     view->renderer              = lstViewShowNPoints[0]->renderer;
1405     model->SetImage( lstModelShowNPoints[0]->GetImage() );
1406     lstModelShowNPoints.insert( lstModelShowNPoints.begin()+mActualCollection , model );
1407     lstViewShowNPoints.insert( lstViewShowNPoints.begin()+mActualCollection , view );
1408 }
1409
1410 //------------------------------------------------------------------------
1411 void WidgetShowNPoints::InsertCollectionBefore_()  
1412 {
1413     InsertCollection();
1414     RefreshCollectionText();
1415     RefreshColourCollection();
1416     StopTrackPoint();
1417 }
1418
1419 //------------------------------------------------------------------------
1420 void WidgetShowNPoints::OnInsertCollectionBefore_()
1421 {
1422     UndoRedo_SaveCollection(); //A
1423     InsertCollectionBefore_();
1424     CreatePointsIntoNewCollection();
1425     UndoRedo_SaveCollection(); //B
1426 }
1427
1428
1429 //------------------------------------------------------------------------
1430 void WidgetShowNPoints::OnInsertCollectionBefore(wxCommandEvent &event)
1431 {
1432     OnInsertCollectionBefore_();
1433 }
1434
1435
1436 //------------------------------------------------------------------------
1437 void WidgetShowNPoints::InsertCollectionAfter_()
1438 {
1439     mActualCollection++;
1440     InsertCollection();
1441     RefreshCollectionText();
1442     RefreshColourCollection();
1443     StopTrackPoint();
1444 }
1445
1446
1447 //------------------------------------------------------------------------
1448 void WidgetShowNPoints::OnInsertCollectionAfter_()
1449 {
1450     UndoRedo_SaveCollection(); //A
1451     InsertCollectionAfter_();
1452     CreatePointsIntoNewCollection();
1453     UndoRedo_SaveCollection(); //B
1454 }
1455
1456 //------------------------------------------------------------------------
1457 void WidgetShowNPoints::OnInsertCollectionAfter(wxCommandEvent &event)
1458 {
1459     OnInsertCollectionAfter_();
1460 }
1461
1462 //------------------------------------------------------------------------
1463 void WidgetShowNPoints::CreatePointsIntoNewCollection()
1464 {
1465     int c1          = mActualCollection-1;
1466     int c2          = mActualCollection+1;
1467     int modelSize   = lstModelShowNPoints.size();
1468     if (aux_mesh_type==2)  // SplineClose2
1469     {
1470         if (c1==-1)         { c1=modelSize-1;   }
1471         if (c2==modelSize)  { c2=0;             }
1472     } // if aux_mesh_type
1473     
1474     if ( (c1!=c2) && (c1>=0) && (c1<modelSize) && (c2>=0) && (c2<modelSize) )
1475     {
1476         std::vector<double> c1LstX = lstModelShowNPoints[c1]->GetLstPointsX();
1477         std::vector<double> c1LstY = lstModelShowNPoints[c1]->GetLstPointsY();
1478         std::vector<double> c1LstZ = lstModelShowNPoints[c1]->GetLstPointsZ();
1479         std::vector<double> c2LstX = lstModelShowNPoints[c2]->GetLstPointsX();
1480         std::vector<double> c2LstY = lstModelShowNPoints[c2]->GetLstPointsY();
1481         std::vector<double> c2LstZ = lstModelShowNPoints[c2]->GetLstPointsZ();
1482         std::vector<double> c1LstXX;
1483         std::vector<double> c1LstYY;
1484         std::vector<double> c1LstZZ;
1485         std::vector<double> c2LstXX;
1486         std::vector<double> c2LstYY;
1487         std::vector<double> c2LstZZ;
1488         creaContoursFactory     f;
1489         manualContourModel      *m;
1490         double                  x,y,z;
1491         int                     i,ii,size;
1492         int                     sc; // sizeContour
1493         
1494         if ( (c1LstX.size()!=0) && (c2LstX.size()!=0) )
1495         {
1496             // ----------------- Spline 1 --------------------
1497             sc          = 100;
1498             size        = c1LstX.size();
1499             m           = (manualContourModel*)f.getContourModel( 1 );  // Spline
1500             //        m->SetNumberOfPointsSpline( bbGetInputNbPoints() );
1501             m->SetNumberOfPointsSpline( sc );
1502             m->SetCloseContour( false );
1503             for (i=0;i<size;i++)
1504             {
1505                 m->AddPoint( c1LstX[i] , c1LstY[i] , c1LstZ[i] );
1506             } // for
1507             m->UpdateSpline();
1508             for (i=0;i<sc;i++)
1509             {
1510                 m->GetSpline_i_Point(i,&x,&y,&z);
1511                 c1LstXX.push_back(x);
1512                 c1LstYY.push_back(y);
1513                 c1LstZZ.push_back(z);
1514             } // for
1515             delete m;
1516             // ----------------- Spline 2 --------------------
1517             size        = c2LstX.size();
1518             m           = (manualContourModel*)f.getContourModel( 1 );  // Spline
1519             //        m->SetNumberOfPointsSpline( bbGetInputNbPoints() );
1520             m->SetNumberOfPointsSpline( sc );
1521             m->SetCloseContour( false );
1522             for (i=0;i<size;i++)
1523             {
1524                 m->AddPoint( c2LstX[i] , c2LstY[i] , c2LstZ[i] );
1525             } // for
1526             m->UpdateSpline();
1527             for (i=0;i<sc;i++)
1528             {
1529                 m->GetSpline_i_Point(i,&x,&y,&z);
1530                 c2LstXX.push_back(x);
1531                 c2LstYY.push_back(y);
1532                 c2LstZZ.push_back(z);
1533             } // for
1534             delete m;
1535             // ----------------- Add new Points --------------------
1536             vtkPoints               *points         = NULL;
1537             vtkStaticPointLocator   *pointLocator   = NULL;
1538             if (aux_mesh!=NULL)
1539             {
1540                 points         = aux_mesh->GetPoints();
1541                 pointLocator   = vtkStaticPointLocator::New();
1542                 pointLocator->SetDataSet( aux_mesh );
1543                 pointLocator->BuildLocator();
1544             } // if aux_mesh
1545             
1546             double p[3], pM[3];
1547             if ( c1LstX.size()<c2LstX.size() ) { size=c2LstX.size(); } else { size=c1LstX.size(); }
1548             for (ii=0;ii<size;ii++)
1549             {
1550                 i = (int) ((double)ii/((double)size-1)*(sc-1));
1551                 x = (c1LstXX[i]+c2LstXX[i])/2;
1552                 y = (c1LstYY[i]+c2LstYY[i])/2;
1553                 z = (c1LstZZ[i]+c2LstZZ[i])/2;
1554                 if (aux_mesh!=NULL)
1555                 {
1556                     p[0]  = x * aux_mesh_spc[0];
1557                     p[1]  = y * aux_mesh_spc[1];
1558                     p[2]  = z * aux_mesh_spc[2];
1559                     points->GetPoint( pointLocator->FindClosestPoint(p) , pM );
1560                     x = pM[0] / aux_mesh_spc[0];
1561                     y = pM[1] / aux_mesh_spc[1];
1562                     z = pM[2] / aux_mesh_spc[2];
1563                 } // aux_mesh
1564                 AddPoint(x,y,z,"");
1565             }
1566             if (pointLocator!=NULL) { pointLocator->Delete(); }
1567             RefreshCollectionText();
1568             RefreshColourCollection();
1569         } // if size of c1LstX c2LstX
1570     }  // if c1 && c2
1571 }
1572
1573 //------------------------------------------------------------------------
1574 void WidgetShowNPoints::DeleteCollection_()
1575 {
1576     if ( lstModelShowNPoints.size()>1 )
1577     {
1578         DeleteAllPoints_();  // Actual Collection
1579         lstModelShowNPoints.erase( lstModelShowNPoints.begin()+mActualCollection );
1580         lstViewShowNPoints.erase( lstViewShowNPoints.begin()+mActualCollection );
1581         if ( mActualCollection>=lstModelShowNPoints.size() )
1582         {
1583             mActualCollection--;
1584         } // if
1585     } else {
1586         DeleteAllPoints_();  // Actual Collection
1587     } // if
1588 }
1589
1590 //------------------------------------------------------------------------
1591 void WidgetShowNPoints::OnDeleteCollection_()
1592 {
1593     UndoRedo_SaveCollection(); //A
1594     DeleteCollection_();
1595     SetOutputBox();
1596     GetViewShowNPoints()->Render();
1597     RefreshCollectionText();
1598     RefreshColourCollection();
1599     StopTrackPoint();
1600     UndoRedo_SaveCollection(); //B
1601 }
1602
1603 //------------------------------------------------------------------------
1604 void WidgetShowNPoints::OnDeleteCollection(wxCommandEvent &event)
1605 {
1606     OnDeleteCollection_();
1607 }
1608
1609 //------------------------------------------------------------------------
1610 void WidgetShowNPoints::ResetCollections_()
1611 {
1612     int i,size=lstModelShowNPoints.size();
1613     for (i=0;i<size;i++)
1614     {
1615         DeleteCollection_();
1616     }
1617     GetViewShowNPoints()->Render();
1618     RefreshCollectionText();
1619     RefreshColourCollection();
1620     StopTrackPoint();
1621 }
1622
1623
1624 //------------------------------------------------------------------------
1625 void WidgetShowNPoints::OnResetCollections_()
1626 {
1627     UndoRedo_SaveCollection(); //A
1628     ResetCollections_();
1629     UndoRedo_SaveCollection(); //B
1630 }
1631
1632
1633 //------------------------------------------------------------------------
1634 void WidgetShowNPoints::OnResetCollections(wxCommandEvent &event)
1635 {
1636     OnResetCollections_();
1637 }
1638
1639 //------------------------------------------------------------------------
1640 void WidgetShowNPoints::OnBackCollection(wxCommandEvent &event)
1641 {
1642     mActualCollection--;
1643     if ( mActualCollection <0  )
1644     {
1645 //        mActualCollection=0;
1646          mActualCollection = lstModelShowNPoints.size()-1;
1647     } //if <=0
1648     RefreshCollectionText();
1649     RefreshColourCollection();
1650     StopTrackPoint();
1651 //    UndoRedo_SaveCollection();
1652 }
1653
1654 //------------------------------------------------------------------------
1655 void WidgetShowNPoints::OnNextCollection(wxCommandEvent &event)
1656 {
1657     mActualCollection++;
1658     if ( mActualCollection >=lstModelShowNPoints.size() )
1659     {
1660 //        mActualCollection = lstModelShowNPoints.size()-1;
1661          mActualCollection = 0;
1662     } //if mActualCollection >= size
1663     RefreshCollectionText();
1664     RefreshColourCollection();
1665     StopTrackPoint();
1666 //    UndoRedo_SaveCollection();
1667 }
1668
1669 //------------------------------------------------------------------------
1670 void WidgetShowNPoints::DetectCollectionActive()
1671 {
1672     int id;
1673     int i,size=lstModelShowNPoints.size();
1674     for (i=0;i<size;i++)
1675     {
1676         id = lstModelShowNPoints[i]->IdInsidePoint();
1677         if (id>=0)
1678         {
1679             mActualCollection=i;
1680         } // if id>=0
1681     } // for i
1682     RefreshCollectionText();
1683     RefreshColourCollection();
1684 }
1685
1686
1687
1688
1689 //------------------------------------------------------------------------
1690 void WidgetShowNPoints::RefreshColourCollection()
1691 {
1692     UpdatePoints_();
1693     std::vector<double> colourAll;
1694     colourAll.push_back(0);
1695     colourAll.push_back(1);
1696     colourAll.push_back(1);
1697     std::vector<double> colourActualGroup;
1698     colourActualGroup.push_back(1);
1699     colourActualGroup.push_back(0);
1700     colourActualGroup.push_back(0);
1701     // For all collections
1702     SetColour( colourAll );
1703     int sizeLstPoints;
1704     int iCollection,sizeLstCollection=lstViewShowNPoints.size();
1705     for ( iCollection=0 ; iCollection<sizeLstCollection ; iCollection++ )
1706     {
1707         if (iCollection==mActualCollection)
1708         {
1709             // Actual collection
1710             lstViewShowNPoints[mActualCollection] -> mcolour = colourActualGroup;
1711             lstViewShowNPoints[mActualCollection] -> mopacity   = sCtrlOpacity->GetValue()*10.0/100.0;
1712             lstViewShowNPoints[mActualCollection] -> ratioRadio = 1.2;
1713             lstViewShowNPoints[mActualCollection] -> RefreshEachPoint();
1714             
1715             //Actual Point
1716             int curPnt      = lstModelShowNPoints[mActualCollection]->GetIdCurrentPoint();
1717             sizeLstPoints   = lstModelShowNPoints[mActualCollection]->GetLstPointsSize();
1718             if ((curPnt>=0)  && (curPnt<sizeLstPoints  ) )
1719             {
1720                 std::vector<double> colourActualPoint;
1721                 colourActualPoint.push_back(1);
1722                 colourActualPoint.push_back(1);
1723                 colourActualPoint.push_back(0);
1724                 double radio          = GetModelShowNPoints()->GetRadio();
1725                 lstViewShowNPoints[mActualCollection] -> mcolour  = colourActualPoint;
1726                 lstViewShowNPoints[mActualCollection]->RefreshPoint( curPnt   );
1727                 lstViewShowNPoints[mActualCollection] -> mcolour = colourActualGroup;
1728             } // if
1729             lstViewShowNPoints[mActualCollection]->TryToShowActorsInRender(true);
1730         } else {
1731             lstViewShowNPoints[iCollection] -> mcolour    = colourAll;
1732             lstViewShowNPoints[iCollection] -> ratioRadio = 1;
1733             if ((cbVisuActualCollection!=NULL) && (cbVisuActualCollection->GetValue()==true))
1734             {
1735                 lstViewShowNPoints[iCollection]->TryToShowActorsInRender(false);
1736       //          lstViewShowNPoints[i] -> mopacity   = 0.0;
1737             } else {
1738                 lstViewShowNPoints[iCollection]->TryToShowActorsInRender(true);
1739       //          lstViewShowNPoints[i] -> mopacity   = sCtrlOpacity->GetValue()*10.0/100.0;
1740             }
1741             lstViewShowNPoints[iCollection]->RefreshEachPoint();
1742         }// if mActualCollection
1743     } // for i
1744     lstViewShowNPoints[mActualCollection] -> renderer->GetRenderWindow()->Render();
1745 }
1746
1747 //------------------------------------------------------------------------
1748 void WidgetShowNPoints::RefreshCollectionText()
1749 {
1750     if ((mtype==4) && (txtNrCollections!=NULL))  // Just for Collection interface
1751     {
1752         wxString strTmp;
1753         strTmp.Printf(_T("   %d/%d"),  (int)mActualCollection+1, (int)lstModelShowNPoints.size() );
1754         txtNrCollections->SetLabel( strTmp );
1755     } // if mtype 4
1756     SetOutputBox();
1757 }
1758
1759
1760 //------------------------------------------------------------------------
1761 void WidgetShowNPoints::OnSaveCollections_( std::string filename )
1762 {
1763     FILE *ff;
1764     ff = fopen( filename.c_str() , "w+" );
1765     if (ff!=NULL)
1766     {
1767         int i,size = lstModelShowNPoints.size();
1768         fprintf(ff,"NumberOfGroups %d \n",size);
1769         for (i=0 ; i<size ; i++)
1770         {
1771             lstModelShowNPoints[i]->SavePoints_(ff);
1772         } // for i
1773         fclose(ff);
1774     } else {   // else ff
1775         printf("WidgetShowNPoints::Save Groups Points  ...Error... creating file \n");
1776     } //ff
1777
1778 }
1779
1780 //------------------------------------------------------------------------
1781 void WidgetShowNPoints::OnSaveCollectionsIdsCurrent_( std::string filename )
1782 {
1783     FILE *ff;
1784     ff = fopen( filename.c_str() , "w+" );
1785     if (ff!=NULL)
1786     {
1787         int i,size = lstModelShowNPoints.size();
1788         fprintf(ff,"ActualCollection %d \n",mActualCollection);
1789         fprintf(ff,"NumberOfGroups %d \n",size);
1790         for (i=0 ; i<size ; i++)
1791         {
1792             fprintf(ff,"CurrentIdPoint %d \n",lstModelShowNPoints[i]->GetIdCurrentPoint());
1793         } // for i
1794         fclose(ff);
1795     } else {   // else ff
1796         printf("WidgetShowNPoints::Save Groups Points  ...Error... creating file \n");
1797     } //ff
1798 }
1799
1800 //------------------------------------------------------------------------
1801 void WidgetShowNPoints::OnSaveCollections(wxCommandEvent &event)
1802 {
1803     //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
1804     #if wxMAJOR_VERSION <= 2
1805             wxFileDialog* FD = new wxFileDialog( 0,
1806                                                 _T("Save groups of points .."),
1807                                                 _T(""),
1808                                                 _T(""),
1809                                                 _T("(*.xls)|*.xls"),
1810                                                 wxSAVE | wxOVERWRITE_PROMPT,
1811                                                 wxDefaultPosition);
1812     #else
1813             wxFileDialog* FD = new wxFileDialog( 0,
1814                                                 _T("Save groups of points .."),
1815                                                 _T(""),
1816                                                 _T(""),
1817                                                 _T("(*.xls)|*.xls"),
1818                                                 wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
1819                                                 wxDefaultPosition);
1820     #endif
1821
1822             int result_FD = FD->ShowModal();
1823             // This line is need it by windows //EED
1824             FD->SetReturnCode( result_FD );
1825             if (FD->GetReturnCode()==wxID_OK)
1826             {
1827                 std::string filename= (const char*) ( FD->GetPath().mb_str() );
1828                 OnSaveCollections_( filename );
1829             }     // dialog box
1830     StopTrackPoint();
1831 }
1832
1833 //------------------------------------------------------------------------
1834 void WidgetShowNPoints::OnLoadCollections_( std::string filename )
1835 {
1836     bool okEraseFirstGroup=false;
1837     if (lstModelShowNPoints.size()==1)
1838     {
1839         if (GetModelShowNPoints()->GetLstPointsSize()==0) { okEraseFirstGroup=true; }
1840     }
1841     FILE *ff = fopen( filename.c_str() , "r+" );
1842     if (ff!=NULL)
1843     {
1844         int i;
1845         int iGroup,sizeGroups;
1846         int iPoint,numberPointsRead;
1847         char chartmp[256];
1848         fscanf(ff," %s %d",chartmp,&sizeGroups);
1849         for (iGroup=0;iGroup<sizeGroups;iGroup++)
1850         {
1851             mActualCollection = lstModelShowNPoints.size();
1852             InsertCollection();
1853             int numberPointsRead= lstModelShowNPoints[mActualCollection]->ReadPoints_(ff);
1854             for (i=0;i<numberPointsRead;i++)
1855             {
1856                 // EED 2022-05-19
1857                 //AddVtkPoint();
1858                 GetViewShowNPoints()->AddVtkPoint();
1859             }// for
1860         } // for i
1861
1862         fclose(ff);
1863     } else {   // else ff
1864         printf("WidgetShowNPoints::Load Group of Points  ...Error... reading file");
1865     } //ff
1866     if (okEraseFirstGroup==true)
1867     {
1868         mActualCollection=0;
1869         DeleteCollection_();
1870         mActualCollection = lstModelShowNPoints.size()-1;
1871     }
1872     GetViewShowNPoints()->Render();
1873     RefreshCollectionText();
1874     RefreshColourCollection();
1875     StopTrackPoint();
1876 }
1877
1878
1879 //------------------------------------------------------------------------
1880 void WidgetShowNPoints::OnLoadCollectionsIdsCurrent_( std::string filename )
1881 {
1882     FILE *ff = fopen( filename.c_str() , "r+" );
1883     int iGroup,sizeGroups;
1884     int IdCurrentPoint;
1885     char chartmp[256];
1886     fscanf(ff," %s %d",chartmp,&mActualCollection);     // ActualCollection
1887     fscanf(ff," %s %d",chartmp,&sizeGroups);            // NumberOfGroups
1888     for (iGroup=0;iGroup<sizeGroups;iGroup++)
1889     {
1890         fscanf(ff," %s %d",chartmp,&IdCurrentPoint);  // CurrentPointId
1891         lstModelShowNPoints[iGroup]->SetIdCurrentPoint( IdCurrentPoint );
1892     } // for iGroup
1893     
1894     GetViewShowNPoints()->Render();
1895     RefreshCollectionText();
1896     RefreshColourCollection();
1897
1898 }
1899
1900
1901
1902
1903 //------------------------------------------------------------------------
1904 void WidgetShowNPoints::OnLoadCollections(wxCommandEvent &event)
1905 {
1906     //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
1907     #if wxMAJOR_VERSION <= 2
1908             wxFileDialog* FD = new wxFileDialog( 0,
1909                                                  _T("Load groups of points .."),
1910                                                  _T(""),
1911                                                  _T(""),
1912                                                  _T("(*.xls)|*.xls"),
1913                                                  wxOPEN | wxFILE_MUST_EXIST,
1914                                                  wxDefaultPosition);
1915     #else
1916             wxFileDialog* FD = new wxFileDialog( 0,
1917                                                  _T("Load groups of points .."),
1918                                                  _T(""),
1919                                                  _T(""),
1920                                                  _T("(*.xls)|*.xls"),
1921                                                  wxFD_OPEN | wxFD_FILE_MUST_EXIST,
1922                                                  wxDefaultPosition);
1923     #endif
1924             int result_FD = FD->ShowModal();
1925             // This line is need it by windows //EED
1926             FD->SetReturnCode( result_FD );
1927             if (FD->GetReturnCode()==wxID_OK)
1928             {
1929                 std::string filename= (const char*) ( FD->GetPath().mb_str() );
1930                 UndoRedo_SaveCollection(); // A
1931                 OnLoadCollections_( filename );
1932                 UndoRedo_SaveCollection(); // B
1933             }     // dialog box
1934 }
1935
1936 //------------------------------------------------------------------------
1937 void WidgetShowNPoints::GetCollectionPoint(int idCol,int idPoint, double *pPoint)
1938 {
1939     double x,y,z;
1940     lstModelShowNPoints[idCol]->GetIdPoint(idPoint,&x,&y,&z);
1941     pPoint[0] = x;
1942     pPoint[1] = y;
1943     pPoint[2] = z;
1944 }
1945 //------------------------------------------------------------------------
1946 void WidgetShowNPoints::SetCollectionPoint(int idCol, int idPoint, std::vector<double> modPoint)
1947 {
1948         if(idCol >= 0 && idCol < lstModelShowNPoints.size())
1949         {
1950                 lstModelShowNPoints[idCol]->SetPointById(idPoint, modPoint);
1951                 lstViewShowNPoints[idCol]->RefreshPoint(idPoint);
1952         }
1953         else{
1954                 printf("WidgetShowNPoints::SetCollectionPoint  ...Error... Invalid collection, out of range");
1955         }
1956 }
1957 //------------------------------------------------------------------------
1958 std::vector<double> WidgetShowNPoints::GetLstPointsX()
1959 {
1960     if (mtype!=4)
1961     {
1962         return GetModelShowNPoints()->GetLstPointsX();
1963     } else {
1964         std::vector<double> lst;
1965         int iP,s;
1966         int iG,sG=lstModelShowNPoints.size();
1967         for (iG=0 ; iG<sG ; iG++)
1968         {
1969             std::vector<double> lstTmp = lstModelShowNPoints[iG]->GetLstPointsX();
1970             s = lstTmp.size();
1971             for (iP=0 ; iP<s ; iP++)
1972             {
1973                 lst.push_back( lstTmp[iP] );
1974             } // for iP
1975         } // for iG
1976         return lst;
1977     } // if 4
1978 }
1979
1980 //------------------------------------------------------------------------
1981 std::vector<double> WidgetShowNPoints::GetLstPointsY()
1982 {
1983     if (mtype!=4)
1984     {
1985         return GetModelShowNPoints()->GetLstPointsY();
1986     } else {
1987         std::vector<double> lst;
1988         int iP,s;
1989         int iG,sG=lstModelShowNPoints.size();
1990         for (iG=0 ; iG<sG ; iG++)
1991         {
1992             std::vector<double> lstTmp = lstModelShowNPoints[iG]->GetLstPointsY();
1993             s = lstTmp.size();
1994             for (iP=0 ; iP<s ; iP++)
1995             {
1996                 lst.push_back( lstTmp[iP] );
1997             } // for iP
1998         } // for iG
1999         return lst;
2000     }
2001 }
2002
2003 //------------------------------------------------------------------------
2004 std::vector<double> WidgetShowNPoints::GetLstPointsZ()
2005 {
2006     if (mtype!=4)
2007     {
2008         return GetModelShowNPoints()->GetLstPointsZ();
2009     } else {
2010         std::vector<double> lst;
2011         int iP,s;
2012         int iG,sG=lstModelShowNPoints.size();
2013         for (iG=0 ; iG<sG ; iG++)
2014         {
2015             std::vector<double> lstTmp = lstModelShowNPoints[iG]->GetLstPointsZ();
2016             s = lstTmp.size();
2017             for (iP=0 ; iP<s ; iP++)
2018             {
2019                 lst.push_back( lstTmp[iP] );
2020             } // for iP
2021         } // for iG
2022         return lst;
2023
2024     }
2025 }
2026
2027 //------------------------------------------------------------------------
2028 std::vector<std::string> WidgetShowNPoints::GetLstLabels()
2029 {
2030     if (mtype!=4)
2031     {
2032         return GetModelShowNPoints()->GetLstLabels();
2033     } else {
2034         std::vector< std::string > lst;
2035         int iP,s;
2036         int iG,sG=lstModelShowNPoints.size();
2037         for (iG=0 ; iG<sG ; iG++)
2038         {
2039             std::vector< std::string > lstTmp = lstModelShowNPoints[iG]->GetLstLabels();
2040             s = lstTmp.size();
2041             for (iP=0 ; iP<s ; iP++)
2042             {
2043                 lst.push_back( lstTmp[iP] );
2044             } // for iP
2045         } // for iG
2046         return lst;
2047     }
2048 }
2049
2050 //------------------------------------------------------------------------
2051 std::vector<int> WidgetShowNPoints::GetLstIndexs()
2052 {
2053     std::vector<int> lstIndexs;
2054     if (mtype!=4)
2055     {
2056         lstIndexs.push_back( GetModelShowNPoints()->GetLstPointsSize() );
2057     } else {
2058         int iG,sG=lstModelShowNPoints.size();
2059         for (iG=0 ; iG<sG ; iG++)
2060         {
2061             lstIndexs.push_back( lstModelShowNPoints[iG]->GetLstPointsSize() );
2062         } // for iG
2063     }
2064     return lstIndexs;
2065 }
2066
2067 //------------------------------------------------------------------------
2068 std::vector<int> WidgetShowNPoints::GetLstSelectedIndexs()
2069 {
2070     std::vector<int> lstSelectedIndexs;
2071     if ( (cbVisuActualCollection!=NULL) && (cbVisuActualCollection->GetValue()==true) )
2072     {
2073         lstSelectedIndexs.push_back( mActualCollection );
2074     }
2075     return lstSelectedIndexs;
2076 }
2077
2078 //------------------------------------------------------------------------
2079 int WidgetShowNPoints::GetLstModelShowNPointsSize()
2080 {
2081     return lstModelShowNPoints.size();
2082 }
2083
2084 //------------------------------------------------------------------------
2085 void WidgetShowNPoints::InvertLstPoints_()
2086 {
2087     int i,size=lstModelShowNPoints.size();
2088     
2089     for (i=0 ;  i < size ; i++)
2090     {
2091         lstModelShowNPoints[i]->InversLstPoints();
2092     } // for iM
2093      
2094     /*
2095     ModelShowNPoints* tmpModel;
2096     int size2=size/2;
2097     for (i=0 ;  i < size2 ; i++)
2098     {
2099         tmpModel                        = lstModelShowNPoints[i];
2100         lstModelShowNPoints[i]          = lstModelShowNPoints[size-1-i];
2101         lstModelShowNPoints[size-1-i]   = tmpModel;
2102     } // for iM
2103      */
2104 }
2105
2106 //------------------------------------------------------------------------
2107 void WidgetShowNPoints::OnInvertLstPoints_()
2108 {
2109     UndoRedo_SaveCollection(); // A
2110     StopAutoAddPoints();
2111     StopTrackPoint();
2112     InvertLstPoints_();
2113     SetOutputBox();
2114     UndoRedo_SaveCollection(); // B
2115 }
2116
2117
2118 //------------------------------------------------------------------------
2119 std::string WidgetShowNPoints::GetUndoRedoFileName()
2120 {
2121     char buff[20];
2122     sprintf(buff,"%p_%d",this, idUndoRedo);
2123     return  UndoRedoDir+"/"+"UndoRedo_collection_" + std::string(buff) + ".undoredo";
2124 }
2125
2126
2127 //------------------------------------------------------------------------
2128 void WidgetShowNPoints::OnUndo(wxCommandEvent &event)
2129 {
2130     ResetCollections_();
2131 //    if (idUndoRedo==maxUndoRedo+1)
2132 //    {
2133 //       idUndoRedo--;
2134 //    } // if idUndoRedo+1
2135     idUndoRedo--;
2136     idUndoRedo--;
2137     if (idUndoRedo<0)
2138     {
2139         idUndoRedo=-1;
2140     } else {
2141         OnLoadCollections_( GetUndoRedoFileName() );
2142         OnLoadCollectionsIdsCurrent_( GetUndoRedoFileName()+".current" );
2143     }// if idUndoRedo
2144     idUndoRedo++;
2145
2146 }
2147
2148 //------------------------------------------------------------------------
2149 void WidgetShowNPoints::OnRedo(wxCommandEvent &event)
2150 {
2151     if (idUndoRedo>maxUndoRedo)
2152     {
2153         idUndoRedo=maxUndoRedo+1;
2154     } else {
2155         ResetCollections_();
2156         OnLoadCollections_( GetUndoRedoFileName() );
2157         OnLoadCollectionsIdsCurrent_( GetUndoRedoFileName()+".current" );
2158         idUndoRedo++;
2159     }// if idUndoRedo
2160 }
2161
2162 //------------------------------------------------------------------------
2163 void WidgetShowNPoints::UndoRedo_SaveCollection()
2164 {
2165     OnSaveCollections_( GetUndoRedoFileName() );
2166     OnSaveCollectionsIdsCurrent_( GetUndoRedoFileName()+".current" );
2167     maxUndoRedo = idUndoRedo;
2168     idUndoRedo++;
2169 }
2170
2171 //------------------------------------------------------------------------
2172 void WidgetShowNPoints::SetAuxMesh(vtkPolyData* mesh, std::vector<double> spc, std::vector<double> params)
2173 {
2174     aux_mesh        = mesh;
2175     aux_mesh_spc    = spc;
2176     if (params.size()==1)
2177     {
2178         aux_mesh_type   = params[0];
2179     } else {
2180         aux_mesh_type   = 0;
2181     }// if params size
2182 }
2183
2184 //------------------------------------------------------------------------
2185 void WidgetShowNPoints::OnVisuActualCollection(wxCommandEvent &event)
2186 {
2187     printf("EED WidgetShowNPoints::OnVisuActualCollection  \n");
2188     RefreshCollectionText();
2189     RefreshColourCollection();
2190 }