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