4 #include <wx/filedlg.h>
6 #include <wx/notebook.h>
9 #include <vtkStaticPointLocator.h>
10 #include <vtkPointData.h>
11 #include <vtkDataArray.h>
13 #include <vtkStaticPointLocator.h>
14 #include <vtkPoints.h>
16 #include "vtkSphereSource.h"
17 #include "vtkRenderer.h"
18 #include "vtkTextActor3D.h"
20 #include "WidgetShowNPoints.h"
21 #include <creaContoursFactory.h>
24 //----------------------------------------------------------------------
25 //----------------------------------------------------------------------
26 //----------------------------------------------------------------------
27 //----------------------------------------------------------------------
28 //----------------------------------------------------------------------
29 WidgetShowNPoints::WidgetShowNPoints(wxWindow *parent, int type)
30 : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
33 aux_mesh_spc.push_back(1);
34 aux_mesh_spc.push_back(1);
35 aux_mesh_spc.push_back(1);
36 aux_mesh_type = 0; // 0:Patch 1:CloseSpline1 2:CloseSpline2
39 // mmodelShowNPoints = new ModelShowNPoints();
43 char * val = getenv( "TEMP" );
46 UndoRedoDir = std::string("");
48 UndoRedoDir = std::string(val)+"\\creatools";
49 std::string cmd1 = "mkdir "+ UndoRedoDir;
50 system( cmd1.c_str() );
51 // Erasing files of more than 1 day old ( -1 )
52 std::string cmd2 = "ForFiles /p \"" + UndoRedoDir + "\" /s /d -1 /c \"cmd /c del @file \"";
53 system( cmd2.c_str() );
55 #elif defined(__GNUC__)
59 UndoRedoDir = "/tmp/creatools";
61 UndoRedoDir = "/tmp/creatools";
64 std::string cmd1 = "mkdir "+ UndoRedoDir;
65 system( cmd1.c_str() );
66 // Erasing files of more than 1 day old ( +1 )
67 std::string cmd= "find "+UndoRedoDir+" -name \"UndoRedo_collection_*.undoredo\" -type f -mtime +1 -delete";
68 system( cmd.c_str() );
75 mActualCollection = 0;
76 ModelShowNPoints* modelShowNPoints = new ModelShowNPoints();
77 lstModelShowNPoints.push_back( modelShowNPoints );
78 lstViewShowNPoints.push_back( new ViewShowNPoints( modelShowNPoints ) );
82 wxPanel* panelParent = this;
83 wxSizer* sizer = NULL;
84 wxSizer* MNPsizer = NULL;
85 wxNotebook* bookSetPoints = NULL;
86 wxNotebook* bookGroupManager = NULL;
87 wxPanel* panel = NULL;
88 wxPanel* panel2 = NULL;
89 txtNrCollections = NULL;
91 cbVisuActualCollection = NULL;
92 bookSetPoints = new wxNotebook(panelParent, -1, wxDefaultPosition, wxDefaultSize, wxNB_TOP );
93 panel = new wxPanel(bookSetPoints);
95 wxSize sizeButton( 50 , -1 );
96 wxSize sizeSlider( 90 , -1 );
101 bookGroupManager = new wxNotebook(panelParent, //bbGetWxParent(),
106 panel2 = new wxPanel(bookGroupManager);
107 cbVisuActualCollection = new wxCheckBox ( panel2,-1, _T("A.V.") , wxDefaultPosition, sizeButton );
108 txtNrCollections = new wxStaticText ( panel2,-1, _T(" 1/1 "));
109 wxButton *btnBackCollection = new wxButton ( panel2, -1, _T("<") , wxDefaultPosition, sizeButton );
110 wxButton *btnNextCollection = new wxButton ( panel2, -1, _T(">") , wxDefaultPosition, sizeButton );
111 wxButton *btnInsertCollectionBefore = new wxButton ( panel2, -1, _T("+<") , wxDefaultPosition, sizeButton );
112 wxButton *btnInsertCollectionAfter = new wxButton ( panel2, -1, _T("+>") , wxDefaultPosition, sizeButton );
113 wxButton *btnDeleteCollection = new wxButton ( panel2, -1, _T("-") , wxDefaultPosition, sizeButton );
114 wxButton *btnResetCollection = new wxButton ( panel2, -1, _T("--") , wxDefaultPosition, sizeButton );
115 wxButton *btnSaveCollection = new wxButton ( panel2, -1, _T("Save") , wxDefaultPosition, sizeButton );
116 wxButton *btnLoadCollection = new wxButton ( panel2, -1, _T("Load") , wxDefaultPosition, sizeButton );
117 wxButton *btnUndo = new wxButton ( panel2, -1, _T("Undo") , wxDefaultPosition, sizeButton );
118 wxButton *btnRedo = new wxButton ( panel2, -1, _T("Redo") , wxDefaultPosition, sizeButton );
120 sCtrlRadio = new wxSpinCtrl( panel2, -1 , wxEmptyString, wxDefaultPosition, sizeButton );
121 sCtrlRadio->SetRange(1,10);
122 sCtrlRadio->SetValue( 2 );
123 sCtrlOpacity= new wxSpinCtrl( panel2, -1 , wxEmptyString, wxDefaultPosition, sizeButton );
124 sCtrlOpacity->SetRange(0,10);
125 sCtrlOpacity->SetValue( 10 );
127 wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
128 wxFlexGridSizer *sizer2 = new wxFlexGridSizer(2);
129 wxFlexGridSizer *sizer3 = new wxFlexGridSizer(3);
130 wxFlexGridSizer *sizer4 = new wxFlexGridSizer(3);
131 wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2);
132 wxFlexGridSizer *sizer5a = new wxFlexGridSizer(2);
133 wxFlexGridSizer *sizer6 = new wxFlexGridSizer(2);
134 wxFlexGridSizer *sizer7 = new wxFlexGridSizer(2);
135 wxFlexGridSizer *sizer8 = new wxFlexGridSizer(2);
137 cbVisuActualCollection -> SetToolTip( _T("Visu actual collection") );
138 btnInsertCollectionBefore -> SetToolTip( _T("+ Add group before") );
139 btnInsertCollectionAfter -> SetToolTip( _T("+> Add group after") );
140 btnDeleteCollection -> SetToolTip( _T("- Erase group") );
141 btnResetCollection -> SetToolTip( _T("-- Reset : Erase all groups") );
142 sCtrlRadio -> SetToolTip( _T("Radio") );
143 sCtrlOpacity -> SetToolTip( _T("Opacity") );
145 // sdrOpacity = new wxSlider(panel2, -1, 0, 0, 100, wxDefaultPosition, sizeSlider, wxSL_LABELS);
146 // sdrRadio = new wxSlider(panel2, -1, 0, 1, 50, wxDefaultPosition, sizeSlider, wxSL_LABELS);
147 // sdrRadio -> SetToolTip( _T("Radio") );
148 // sdrOpacity -> SetToolTip( _T("Opacity") );
150 Connect(cbVisuActualCollection->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnVisuActualCollection );
151 Connect(btnBackCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) & WidgetShowNPoints::OnBackCollection );
152 Connect(btnNextCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) & WidgetShowNPoints::OnNextCollection );
153 Connect(btnInsertCollectionBefore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionBefore );
154 Connect(btnInsertCollectionAfter->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionAfter );
155 Connect(btnDeleteCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteCollection );
157 // Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) & WidgetShowNPoints::UpdatePoints );
158 // Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) & WidgetShowNPoints::UpdatePoints );
159 Connect( sCtrlRadio->GetId() ,wxEVT_COMMAND_SPINCTRL_UPDATED ,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
160 Connect( sCtrlOpacity->GetId() ,wxEVT_COMMAND_SPINCTRL_UPDATED ,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
162 Connect(btnSaveCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) & WidgetShowNPoints::OnSaveCollections );
163 Connect(btnLoadCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) & WidgetShowNPoints::OnLoadCollections );
164 Connect(btnResetCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) & WidgetShowNPoints::OnResetCollections );
165 Connect(btnUndo->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnUndo );
166 Connect(btnRedo->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnRedo );
168 sizer2->Add( btnBackCollection );
169 sizer2->Add( btnNextCollection );
170 sizer3->Add( btnInsertCollectionBefore );
171 sizer3->Add( btnInsertCollectionAfter );
172 sizer4->Add( btnLoadCollection );
173 sizer4->Add( btnSaveCollection );
174 // sizer5->Add( txRadio ,wxGROW );
175 // sizer5->Add( sdrRadio ,wxGROW );
176 // sizer5->Add( txOpacity ,wxGROW );
177 // sizer5->Add( sdrOpacity ,wxGROW );
179 sizer5->Add( sCtrlRadio );
180 sizer5->Add( sCtrlOpacity );
182 sizer6->Add( btnDeleteCollection );
183 sizer6->Add( btnResetCollection );
185 sizer7->Add( cbVisuActualCollection );
186 sizer7->Add( txtNrCollections );
188 sizer8->Add( btnUndo );
189 sizer8->Add( btnRedo );
191 sizer1->Add( sizer7 );
192 sizer1->Add( sizer2 );
193 sizer1->Add( sizer3 );
194 sizer1->Add( sizer6 );
195 sizer1->Add( sizer4 );
196 sizer1->Add( sizer5 );
197 sizer1->Add( sizer8 );
199 // sizer1->Add( sizer5 ,wxGROW );
202 panel2->SetSizer( MNPsizer );
203 panel2->SetAutoLayout(true);
205 bookGroupManager->AddPage(panel2 , _T("Groups") );
208 if ( (mtype==0) || (mtype==3) || (mtype==4) )
211 // askPointLabel = new wxStaticText(panel, -1, _T("Label:")); // JPR
212 textCtrl = new wxTextCtrl(panel, -1, wxEmptyString , wxDefaultPosition, sizeButton);
213 wxButton *btnBackPoint = new wxButton( panel, -1, _T("<") , wxDefaultPosition, sizeButton );
214 wxButton *btnNextPoint = new wxButton( panel, -1, _T(">") , wxDefaultPosition, sizeButton );
215 wxButton *btnAddPoint = new wxButton( panel, -1, _T("+") , wxDefaultPosition, sizeButton );
216 wxButton *btnInsertPoint = new wxButton( panel, -1, _T("(+)") , wxDefaultPosition, sizeButton );
217 cbAutoAddPoints = new wxCheckBox(panel,-1, _T("Auto") , wxDefaultPosition, sizeButton );
218 wxButton *btnMovePointUp = new wxButton( panel, -1, _T("<-") , wxDefaultPosition, sizeButton );
219 wxButton *btnMovePointDown = new wxButton( panel, -1, _T("->") , wxDefaultPosition, sizeButton );
221 wxButton *btnSetPositionPoint = new wxButton( panel, -1, _T("Set") , wxDefaultPosition, sizeButton );
222 cbTrackPoint = new wxCheckBox(panel,-1, _T("Tra.") , wxDefaultPosition, sizeButton );
223 wxButton *btnRenamePoint = new wxButton( panel, -1, _T("Ren.") , wxDefaultPosition, sizeButton );
224 wxButton *btnErasePoint = new wxButton( panel, -1, _T("-") , wxDefaultPosition, sizeButton );
225 // wxButton *btnEraseLastPoint = new wxButton( panel, -1, _T("- lst") , wxDefaultPosition, sizeButton );
226 wxButton *btnDeleteAllPoints = new wxButton( panel, -1, _T("--") , wxDefaultPosition, sizeButton );
228 wxButton *btnUndo = NULL;
229 wxButton *btnRedo = NULL;
231 wxButton *btnSavePoints = NULL;
232 wxButton *btnLoadPoints = NULL;
235 btnBackPoint -> SetToolTip( _T("Select befor point") );
236 btnNextPoint -> SetToolTip( _T("Select next point") );
237 cbAutoAddPoints -> SetToolTip( _T("Auto Add point") );
238 btnAddPoint -> SetToolTip( _T("+ Add point") );
239 btnInsertPoint -> SetToolTip( _T("(+) Insert point") );
240 btnMovePointUp -> SetToolTip( _T("Move point Up in the normal direction") );
241 btnMovePointDown -> SetToolTip( _T("Move point Down in the normal direction") );
242 btnRenamePoint -> SetToolTip( _T("Rename label for each point") );
243 textCtrl -> SetToolTip( _T("Point label") );
246 btnErasePoint -> SetToolTip( _T("- Erase point") );
247 // btnEraseLastPoint -> SetToolTip( _T("- lst Erase last point") );
248 btnDeleteAllPoints -> SetToolTip( _T("-- Erase all points") );
252 btnUndo = new wxButton( panel, -1, _T("Undo") , wxDefaultPosition, sizeButton );
253 btnRedo = new wxButton( panel, -1, _T("Redo") , wxDefaultPosition, sizeButton );
254 btnSavePoints = new wxButton( panel, -1, _T("Save") , wxDefaultPosition, sizeButton );
255 btnLoadPoints = new wxButton( panel, -1, _T("Load") , wxDefaultPosition, sizeButton );
256 Connect(btnSavePoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints );
257 Connect(btnLoadPoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints );
258 Connect(btnUndo->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnUndo );
259 Connect(btnRedo->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnRedo );
261 txtNrPoints = new wxStaticText(panel,-1, _T(" -/-"));
263 wxStaticText* txOpacity;
264 wxStaticText* txRadio;
265 if ( (mtype==0) || (mtype==3) )
267 //NTU: Sliders for opacity and radio change
268 // txOpacity = new wxStaticText(panel, -1, wxString(_T(" Points Opacity ")));
269 // sdrOpacity = new wxSlider(panel, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
270 // txRadio = new wxStaticText(panel, -1, wxString(_T(" Points Radius ")));
271 // sdrRadio = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
272 // //NTU: Slider events
273 // Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
274 // Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
276 sCtrlRadio = new wxSpinCtrl( panel, -1 , wxEmptyString, wxDefaultPosition, sizeButton );
277 sCtrlRadio->SetRange(1,10);
278 sCtrlRadio->SetValue( 2 );
279 sCtrlOpacity= new wxSpinCtrl( panel, -1 , wxEmptyString, wxDefaultPosition, sizeButton );
280 sCtrlOpacity->SetRange(0,10);
281 sCtrlOpacity->SetValue( 10 );
282 Connect( sCtrlRadio->GetId() ,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
283 Connect( sCtrlOpacity->GetId() ,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
287 Connect(cbAutoAddPoints->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WidgetShowNPoints::OnAutoAddPoints );
288 Connect(btnBackPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnBackPoint );
289 Connect(btnNextPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnNextPoint );
290 Connect(btnAddPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnAddPoint );
291 Connect(btnInsertPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnInsertPoint );
292 Connect(btnMovePointUp->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnMovePointUp );
293 Connect(btnMovePointDown->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnMovePointDown );
294 Connect(btnSetPositionPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint );
295 Connect(btnRenamePoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnRenamePoint );
296 // Connect(btnEraseLastPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnEraseLastPoint );
297 Connect(btnErasePoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnErasePoint );
298 Connect(btnDeleteAllPoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnDeleteAllPoints );
299 Connect(cbTrackPoint->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WidgetShowNPoints::OnTrackPoint );
300 wxFlexGridSizer *sizer0 = new wxFlexGridSizer(1);
301 wxFlexGridSizer *sizer1 = new wxFlexGridSizer(2);
302 wxFlexGridSizer *sizer2 = new wxFlexGridSizer(3);
303 wxFlexGridSizer *sizer3 = new wxFlexGridSizer(2);
304 wxFlexGridSizer *sizer4 = new wxFlexGridSizer(3);
305 // wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2);
306 wxFlexGridSizer *sizer6 = new wxFlexGridSizer(2);
307 wxFlexGridSizer *sizer7 = new wxFlexGridSizer(2);
308 wxFlexGridSizer *sizer8 = new wxFlexGridSizer(2);
309 sizer1->Add( textCtrl );
310 sizer1->Add( btnRenamePoint );
311 sizer2->Add( btnAddPoint );
312 sizer2->Add( btnInsertPoint );
313 // sizer2->Add( cbAutoAddPoints );
314 sizer3->Add( btnSetPositionPoint );
315 sizer3->Add( cbTrackPoint );
316 sizer4->Add( btnErasePoint );
317 // sizer4->Add( btnEraseLastPoint );
318 sizer4->Add( btnDeleteAllPoints );
319 // sizer5->Add( btnUndo );
320 // sizer5->Add( btnRedo );
321 sizer6->Add( btnBackPoint );
322 sizer6->Add( btnNextPoint );
323 sizer7->Add( btnMovePointUp );
324 sizer7->Add( btnMovePointDown );
325 sizer8->Add( cbAutoAddPoints );
326 sizer8->Add( txtNrPoints );
328 // sizer0->Add(askPointLabel); // JPR
336 // sizer0->Add(sizer5);
337 if ( (mtype==0) || (mtype==3) )
339 wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2);
340 // sizer5->Add(txRadio);
341 // sizer5->Add(sdrRadio,1,wxGROW );
342 // sizer5->Add(txOpacity);
343 // sizer5->Add(sdrOpacity,1,wxGROW );
345 sizer5->Add( sCtrlRadio );
346 sizer5->Add( sCtrlOpacity );
354 wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2);
355 wxFlexGridSizer *sizer6 = new wxFlexGridSizer(2);
356 sizer6->Add( btnSavePoints );
357 sizer6->Add( btnLoadPoints );
358 sizer5->Add( btnUndo );
359 sizer5->Add( btnRedo );
360 sizer0->Add( sizer6 );
361 sizer0->Add( sizer5 );
369 wxButton *btnSetPositionPoint = new wxButton( panel, -1, _T("Set nearest point"));
370 txtNrPoints = new wxStaticText(panel,-1, _T("-/-"));
372 //NTU: Sliders for opacity and radio change
373 // sdrRadio = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
374 // sdrOpacity = new wxSlider(panel, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
375 // Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
376 // Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
377 wxStaticText* txOpacity = new wxStaticText(panel, -1, wxString(_T(" Points Opacity ")));
378 wxStaticText* txRadio = new wxStaticText(panel, -1, wxString(_T(" Points Radio ")));
380 sCtrlRadio = new wxSpinCtrl( panel, -1 , wxEmptyString, wxDefaultPosition, sizeButton );
381 sCtrlRadio->SetRange(1,10);
382 sCtrlRadio->SetValue( 2 );
383 sCtrlOpacity= new wxSpinCtrl( panel, -1 , wxEmptyString, wxDefaultPosition, sizeButton );
384 sCtrlOpacity->SetRange(0,10);
385 sCtrlOpacity->SetValue( 10 );
386 Connect( sCtrlRadio->GetId() ,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
387 Connect( sCtrlOpacity->GetId() ,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
390 Connect(btnSetPositionPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint);
392 wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
393 sizer1->Add(btnSetPositionPoint);
394 sizer1->Add(txtNrPoints);
395 sizer1->Add(txRadio);
396 //sizer1->Add(sdrRadio,1,wxGROW );
397 //sizer1->Add(sdrOpacity,1,wxGROW );
398 sizer1->Add(sCtrlRadio );
399 sizer1->Add(sCtrlOpacity);
405 askPointLabel = new wxStaticText(panel, -1, _T("\nPOINT CONTROLS:")); // JPR
406 wxButton *btnAddPoint = new wxButton(panel , -1, _T(" Add Point "));
407 wxButton *btnDeleteAllPoints = new wxButton(panel , -1, _T(" Delete All "));
408 wxStaticText *spacer = new wxStaticText(panel, -1, _T("\n")); // JPR
409 textCtrl = new wxTextCtrl(panel, -1);
410 Connect(btnAddPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnAddPoint);
411 Connect(btnDeleteAllPoints->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteAllPoints);
412 wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
413 sizer1->Add(askPointLabel);
414 sizer1->Add(btnAddPoint);
415 sizer1->Add(btnDeleteAllPoints);
417 sizer1->Add(textCtrl);
418 // sdrOpacity = new wxSlider();
419 // sdrRadio = new wxSlider();
420 txtNrPoints = new wxStaticText(panel, -1, _T("\n\n\n"));
422 } // bbGetInputType 2
424 panel->SetSizer(sizer);
425 panel->SetAutoLayout(true);
427 bookSetPoints->AddPage(panel , _T("Points") );
429 if ((mtype >= 0) && (mtype <= 3) )
433 wxFlexGridSizer *sizerParent = new wxFlexGridSizer(1);
434 sizerParent->Add( bookSetPoints );
435 panelParent->SetSizer( sizerParent );
436 panelParent->SetAutoLayout(true);
437 panelParent->Layout();
439 } // if mtype 0 1 2 3
443 if ((sizer!=NULL) && (MNPsizer!=NULL))
445 wxFlexGridSizer *sizerG = new wxFlexGridSizer(2);
446 sizerG->Add(bookGroupManager);
447 sizerG->Add(bookSetPoints);
448 panelParent->SetSizer(sizerG);
449 panelParent->SetAutoLayout(true);
450 panelParent->Layout();
455 //------------------------------------------------------------------------
456 WidgetShowNPoints::~WidgetShowNPoints()
460 //------------------------------------------------------------------------
461 ModelShowNPoints* WidgetShowNPoints::GetModelShowNPoints()
464 // return mmodelShowNPoints;
465 return lstModelShowNPoints[ mActualCollection ];
468 //------------------------------------------------------------------------
469 ModelShowNPoints* WidgetShowNPoints::GetModelShowNPoints(int id)
471 if(id >= 0 && id < lstModelShowNPoints.size())
473 return lstModelShowNPoints[ id ];
478 //------------------------------------------------------------------------
479 ViewShowNPoints* WidgetShowNPoints::GetViewShowNPoints()
481 return lstViewShowNPoints[ mActualCollection ];
485 //------------------------------------------------------------------------
486 void WidgetShowNPoints::SetRadio(double radio)
489 // GetModelShowNPoints()->SetRadio(radio);
490 int i,size = lstModelShowNPoints.size();
493 lstModelShowNPoints[i]->SetRadio( radio );
496 // sdrRadio->SetValue(radio);
497 sCtrlRadio->SetValue(radio);
500 //------------------------------------------------------------------------
501 void WidgetShowNPoints::SetColour(std::vector<double> colour)
504 //this->mcolour = colour;
505 int i,size = lstViewShowNPoints.size();
506 for (i=0 ; i<size ; i++)
508 lstViewShowNPoints[i]->mcolour = colour;
512 //------------------------------------------------------------------------
513 void WidgetShowNPoints::SetImage(vtkImageData* image)
516 //GetModelShowNPoints()->SetImage(image);
517 int i,size = lstModelShowNPoints.size();
518 for (i=0 ; i<size ; i++)
520 lstModelShowNPoints[i]->SetImage(image);
524 //------------------------------------------------------------------------
525 void WidgetShowNPoints::SetOpacity(double opacity)
528 //this->mopacity=opacity;
529 int i,size = lstViewShowNPoints.size();
530 for (i=0 ; i<size ; i++)
532 lstViewShowNPoints[i]->mopacity = opacity;
535 // sdrOpacity->SetValue( opacity*100.0 );
536 sCtrlOpacity->SetValue( opacity*10.0 );
541 //------------------------------------------------------------------------
542 void WidgetShowNPoints::SetRenderer(vtkRenderer *renderer)
545 //this->renderer = renderer;
546 int i,size = lstViewShowNPoints.size();
547 for (i=0 ; i<size ; i++)
549 lstViewShowNPoints[i]->renderer = renderer;
554 //------------------------------------------------------------------------
556 void WidgetShowNPoints::RefreshPoint(int id)
560 GetModelShowNPoints()->GetIdPoint(id,&x,&y,&z);
561 GetModelShowNPoints()->GetImage()->GetSpacing(spc);
562 std::string label = GetModelShowNPoints()->GetIdLabel(id);
563 double radio = GetModelShowNPoints()->GetRadio();
564 lstActorsSphere[id]->SetPosition( spc[0]*x , spc[1]*y , spc[2]*z );
565 lstActorsSphere[id]->GetProperty()->SetColor( mcolour[0] , mcolour[1] , mcolour[2] );
566 lstActorsSphere[id]->GetProperty()->SetOpacity( mopacity );
567 lstSourceSphere[id]->SetRadius( radio );
568 //EED 2017-01-01 Migration VTK7
569 #if VTK_MAJOR_VERSION <= 5
572 lstSourceSphere[id]->Update();
574 lstActorsText[id]->SetInput( label.c_str() );
575 lstActorsText[id]->SetPosition( radio+spc[0]*x , spc[1]*y , spc[2]*z );
578 //------------------------------------------------------------------------
579 void WidgetShowNPoints::RefreshPoints()
581 int id,size=lstActorsSphere.size();
582 for (id=0;id<size;id++)
586 renderer->GetRenderWindow()->Render();
589 //------------------------------------------------------------------------
590 void WidgetShowNPoints::AddVtkPoint()
593 vtkSphereSource *vtksphere = vtkSphereSource::New();
594 vtksphere->SetThetaResolution (20);
595 vtksphere->SetPhiResolution (20);
596 vtksphere->SetRadius( 1 );
597 //NTU: For updating points
598 lstSourceSphere.push_back(vtksphere);
599 vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
601 //EED 2017-01-01 Migration VTK7
602 #if VTK_MAJOR_VERSION <= 5
603 sphereMapper->SetInput( vtksphere->GetOutput() );
606 sphereMapper->SetInputData( vtksphere->GetOutput() );
609 vtkActor *sphereActor = vtkActor::New();
610 sphereActor->SetMapper(sphereMapper);
611 sphereActor->SetOrigin(0, 0, 0);
613 lstActorsSphere.push_back(sphereActor);
615 wxMessageDialog dialog(this, _T("Renderer Not Set"),_T("Renderer Not Set"),wxICON_ERROR);
619 renderer->AddActor( sphereActor );
621 vtkTextActor3D *textActor = vtkTextActor3D::New();
622 // textActor->SetInput( strLabel.c_str() );
623 renderer->AddActor( textActor );
624 lstActorsText.push_back(textActor);
629 void WidgetShowNPoints::SetCurrentPoint(int idCurrentPoint )
631 int size = GetModelShowNPoints()->GetLstPointsSize();
632 if (idCurrentPoint<0) { idCurrentPoint = size-1; }
633 if (idCurrentPoint>=size ) { idCurrentPoint = 0; }
634 GetModelShowNPoints()->SetIdCurrentPoint( idCurrentPoint );
635 RefreshCollectionText();
636 RefreshColourCollection();
639 void WidgetShowNPoints::OnBackPoint(wxCommandEvent &event)
641 SetCurrentPoint( GetModelShowNPoints()->GetIdCurrentPoint() - 1 );
644 void WidgetShowNPoints::OnNextPoint(wxCommandEvent &event)
646 SetCurrentPoint( GetModelShowNPoints()->GetIdCurrentPoint() + 1 );
650 //------------------------------------------------------------------------
651 void WidgetShowNPoints::AddPoint(double x, double y, double z, std::string label)
653 GetModelShowNPoints()->AddPoint(x,y,z, label );
656 //RefreshPoint(lstActorsSphere.size()-1);
657 GetViewShowNPoints()->AddPoint();
660 //------------------------------------------------------------------------
661 void WidgetShowNPoints::InsertPoint(double x, double y, double z, std::string label)//CFT
664 //if ( GetModelShowNPoints()->InsertPoint(x,y,z,label) != -1 )
668 // AddPoint(x,y,z,label);
671 if ( GetModelShowNPoints()->InsertPoint(x,y,z,label) != -1 )
673 GetViewShowNPoints()->AddVtkPoint();
675 AddPoint(x,y,z,label);
677 GetViewShowNPoints()->RefreshPoints();
680 //------------------------------------------------------------------------
681 void WidgetShowNPoints::OnInsertPoint_()
684 //if (this->renderer==NULL)
688 if (GetViewShowNPoints()->renderer==NULL)
692 std::vector<double> point = GetModelShowNPoints()->GetReferencePoint();
695 InsertPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
697 } else {//mpoint.size
698 printf("creaMaracasVisu::ShowNPoints (not match point) \n");
700 RefreshCollectionText();
701 RefreshColourCollection();
703 UndoRedo_SaveCollection();
706 //------------------------------------------------------------------------
707 void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT
712 //------------------------------------------------------------------------
713 void WidgetShowNPoints::OnAddPoint__()
716 //if (this->renderer==NULL)
717 if (GetViewShowNPoints()->renderer==NULL)
721 std::vector<double> point = GetModelShowNPoints()->GetReferencePoint();
724 AddPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
727 //renderer->GetRenderWindow()->Render();
728 GetViewShowNPoints()->Render();
729 UndoRedo_SaveCollection();
730 } else {//mpoint.size
731 printf("creaMaracasVisu::ShowNPoints (not match point) \n");
735 void WidgetShowNPoints::OnAddPoint_()
742 //------------------------------------------------------------------------
743 void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event)
748 //------------------------------------------------------------------------
749 void WidgetShowNPoints::AutoAddPoints()
751 if ( cbAutoAddPoints->GetValue() == true )
754 RefreshCollectionText();
755 RefreshColourCollection();
756 } // if cbAutoAddPoints
759 //------------------------------------------------------------------------
760 void WidgetShowNPoints::OnAutoAddPoints_tool()
763 cbAutoAddPoints->SetValue( !cbAutoAddPoints->GetValue() );
766 //------------------------------------------------------------------------
767 void WidgetShowNPoints::OnAutoAddPoints_()
772 //------------------------------------------------------------------------
773 void WidgetShowNPoints::OnAutoAddPoints(wxCommandEvent& event)
778 //------------------------------------------------------------------------
779 void WidgetShowNPoints::StopAutoAddPoints( )
781 cbAutoAddPoints->SetValue(false);
784 //------------------------------------------------------------------------
785 void WidgetShowNPoints::SetOutputBox()
788 if (GetModelShowNPoints()->GetIdCurrentPoint()<0)
790 strTmp.Printf(_T(" -/%d") , GetModelShowNPoints()->GetLstPointsSize() );
792 strTmp.Printf(_T(" %d/%d"), GetModelShowNPoints()->GetIdCurrentPoint()+1 , GetModelShowNPoints()->GetLstPointsSize() );
794 txtNrPoints->SetLabel( strTmp );
798 // mbbShowNPoints->bbSetOutputlstPointsX( GetModelShowNPoints()->GetLstPointsX() );
799 // mbbShowNPoints->bbSetOutputlstPointsY( GetModelShowNPoints()->GetLstPointsY() );
800 // mbbShowNPoints->bbSetOutputlstPointsZ( GetModelShowNPoints()->GetLstPointsZ() );
801 // mbbShowNPoints->bbSetOutputlstLabels( GetModelShowNPoints()->GetLstLabels() );
802 // mbbShowNPoints->bbSignalOutputModification();
806 //------------------------------------------------------------------------
807 void WidgetShowNPoints::OnSavePoints(wxCommandEvent& event)
810 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
811 #if wxMAJOR_VERSION <= 2
812 wxFileDialog* FD = new wxFileDialog( 0,
813 _T("Save points .."),
817 wxSAVE | wxOVERWRITE_PROMPT,
820 wxFileDialog* FD = new wxFileDialog( 0,
821 _T("Save points .."),
825 wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
829 int result_FD = FD->ShowModal();
830 // This line is need it by windows //EED
831 FD->SetReturnCode( result_FD );
832 if (FD->GetReturnCode()==wxID_OK)
834 std::string filename= (const char*) ( FD->GetPath().mb_str() );
835 GetModelShowNPoints()->SavePoints( filename );
840 //------------------------------------------------------------------------
841 void WidgetShowNPoints::OnLoadPoints(wxCommandEvent& event)
844 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
845 #if wxMAJOR_VERSION <= 2
846 wxFileDialog* FD = new wxFileDialog( 0,
847 _T("Load points .."),
851 wxOPEN | wxFILE_MUST_EXIST,
854 wxFileDialog* FD = new wxFileDialog( 0,
855 _T("Load points .."),
859 wxFD_OPEN | wxFD_FILE_MUST_EXIST,
864 int result_FD = FD->ShowModal();
865 // This line is need it by windows //EED
866 FD->SetReturnCode( result_FD );
867 if (FD->GetReturnCode()==wxID_OK)
870 std::string filename= (const char*) ( FD->GetPath().mb_str() );
871 int numberPointsRead = GetModelShowNPoints()->ReadPoints( filename );
872 for (i=0;i<numberPointsRead;i++)
876 GetViewShowNPoints()->AddVtkPoint();
881 GetViewShowNPoints()->RefreshPoints();
885 //------------------------------------------------------------------------
886 void WidgetShowNPoints::OnSetPoint_()
891 //int id=GetModelShowNPoints()->GetNearestPoint();
892 int id=GetModelShowNPoints()->GetIdCurrentPoint();
894 if((id==-1) && (mtype==1))
902 GetModelShowNPoints()->SetPointId_mReferencePoint(id);
905 //renderer->GetRenderWindow()->Render();
906 GetViewShowNPoints()->RefreshPoint(id);
907 GetViewShowNPoints()->Render();
909 RefreshCollectionText();
910 RefreshColourCollection();
912 UndoRedo_SaveCollection();
915 //------------------------------------------------------------------------
916 void WidgetShowNPoints::OnSetPoint(wxCommandEvent& event)
921 //------------------------------------------------------------------------
922 void WidgetShowNPoints::MovePoint_(double step)
927 int id=GetModelShowNPoints()->GetIdCurrentPoint();
930 if((GetLstModelShowNPointsSize()>=2) //Check condition
931 && (GetModelShowNPoints()->GetLstPointsSize()>0)
932 && (aux_mesh != NULL)
933 && (aux_mesh_spc.size() == 3))
937 double normal[3]; // point to modify and normal
938 std::vector<double> pN(3); // new point
939 vtkStaticPointLocator *pointLocator = vtkStaticPointLocator::New();
940 pointLocator->SetDataSet( aux_mesh );
941 pointLocator->BuildLocator();
943 // int idControlPoint = wsp->GetModelShowNPoints()->GetNearestPoint();
944 int idControlPoint = GetModelShowNPoints()->GetIdCurrentPoint();
945 if(idControlPoint >= 0)
947 GetModelShowNPoints()->GetIdPoint(idControlPoint, &x, &y, &z);
948 p[0] = x * aux_mesh_spc[0];
949 p[1] = y * aux_mesh_spc[1];
950 p[2] = z * aux_mesh_spc[2];
951 long int idMeshPoint = pointLocator->FindClosestPoint(p);
952 vtkDataArray *dataArrayNormals = aux_mesh->GetPointData()->GetNormals();
953 if (dataArrayNormals!=NULL)
955 dataArrayNormals->GetTuple(idMeshPoint, normal);
957 int direction = step;
958 // pN[0] = p[0] / spc[0] + direction*normal[0];
959 // pN[1] = p[1] / spc[1] + direction*normal[1];
960 // pN[2] = p[2] / spc[2] + direction*normal[2];
961 pN[0] = x + (direction * normal[0]);
962 pN[1] = y + (direction * normal[1]);
963 pN[2] = z + (direction * normal[2]);
964 GetModelShowNPoints()->SetPointById(idControlPoint, pN);
965 // GetViewShowNPoints()->RefreshPoint(idControlPoint);
966 // RefreshCollectionText();
967 // RefreshColourCollection();
969 UndoRedo_SaveCollection();
971 printf("Error! WidgetShowNPoints::MovePoint_ Missing normals in aux_mesh \n");
973 } // if idControlPoint
974 } // if wsp->GetLstModelShowNPointsSiz->size()>=2
979 double minX=max,minY=max,minZ=max;
980 double maxX=-max,maxY=-max,maxZ=-max;
981 sizeG = lstModelShowNPoints.size();
982 for (i=0; i<sizeG; i++)
984 std::vector<double> lstX = lstModelShowNPoints[i]->GetLstPointsX();
985 std::vector<double> lstY = lstModelShowNPoints[i]->GetLstPointsY();
986 std::vector<double> lstZ = lstModelShowNPoints[i]->GetLstPointsZ();
988 for (j=0; j<sizeP; j++)
990 if ( lstX[j]<minX ) { minX=lstX[j]; }
991 if ( lstY[j]<minY ) { minY=lstY[j]; }
992 if ( lstZ[j]<minZ ) { minZ=lstZ[j]; }
993 if ( lstX[j]>maxX ) { maxX=lstX[j]; }
994 if ( lstY[j]>maxY ) { maxY=lstY[j]; }
995 if ( lstZ[j]>maxZ ) { maxZ=lstZ[j]; }
999 pc[0]=(minX+maxX) /2 ; pc[1]=(minY+maxY) /2 ; pc[2]=(minZ+maxZ) /2 ;
1001 p[0]=GetModelShowNPoints()->GetLstPointsX()[id];
1002 p[1]=GetModelShowNPoints()->GetLstPointsY()[id];
1003 p[2]=GetModelShowNPoints()->GetLstPointsZ()[id];
1008 double mag=sqrt ( v[0]*v[0] + v[1]*v[1] + v[2]*v[2] );
1009 std::vector<double> point;
1020 point.push_back( p[0] + step*v[0] );
1021 point.push_back( p[1] + step*v[1] );
1022 point.push_back( p[2] + step*v[2] );
1023 GetModelShowNPoints()->SetPointById(id,point);
1024 UndoRedo_SaveCollection();
1027 RefreshCollectionText();
1028 RefreshColourCollection();
1031 //------------------------------------------------------------------------
1032 void WidgetShowNPoints::OnMovePointUp(wxCommandEvent& event)
1037 //------------------------------------------------------------------------
1038 void WidgetShowNPoints::OnMovePointDown(wxCommandEvent& event)
1043 //------------------------------------------------------------------------
1044 void WidgetShowNPoints::TrackingPoint( )
1046 if ( cbTrackPoint->GetValue() == true )
1048 int id = GetModelShowNPoints()->IdInsidePoint();
1056 GetModelShowNPoints()->SetPointId_mReferencePoint(idTrack);
1058 RefreshCollectionText();
1059 RefreshColourCollection();
1061 // GetViewShowNPoints()->RefreshPoint(idTrack);
1062 // GetViewShowNPoints()->Render();
1063 UndoRedo_SaveCollection();
1065 } // if trackPointFlag
1068 //------------------------------------------------------------------------
1069 void WidgetShowNPoints::OnTrackPoint_tool()
1071 cbTrackPoint->SetValue( !cbTrackPoint->GetValue() );
1075 //------------------------------------------------------------------------
1076 void WidgetShowNPoints::OnTrackPoint_()
1078 StopAutoAddPoints();
1081 if ( cbTrackPoint->GetValue() == true )
1084 // idTrack = GetModelShowNPoints()->IdInsidePoint();
1085 idTrack = GetModelShowNPoints()->GetIdCurrentPoint();
1086 } // if trackPointFlag
1089 //------------------------------------------------------------------------
1090 void WidgetShowNPoints::OnTrackPoint(wxCommandEvent& event)
1095 //------------------------------------------------------------------------
1096 void WidgetShowNPoints::StopTrackPoint( )
1098 cbTrackPoint->SetValue(false);
1102 //------------------------------------------------------------------------
1103 void WidgetShowNPoints::OnRenamePoint(wxCommandEvent& event)
1105 int id = GetModelShowNPoints()->RenamePoint( (const char*) ( textCtrl->GetValue().mb_str() ) );
1109 //lstActorsText[id]->SetInput( (const char*) ( textCtrl->GetValue().mb_str() ) );
1110 //renderer->GetRenderWindow()->Render();
1111 GetViewShowNPoints()->lstActorsText[id]->SetInput( (const char*) ( textCtrl->GetValue().mb_str() ) );
1112 GetViewShowNPoints()->Render();
1114 UndoRedo_SaveCollection();
1118 //------------------------------------------------------------------------
1119 bool WidgetShowNPoints::ErasePoint(int id)
1122 //if (this->renderer!=NULL)
1124 if (GetViewShowNPoints()->renderer!=NULL)
1129 //renderer->RemoveActor( lstActorsSphere[id] );
1130 //renderer->RemoveActor( lstActorsText[id] );
1131 //lstActorsSphere[id]->Delete();
1132 //lstActorsText[id]->Delete();
1133 //lstSourceSphere[id]->Delete();
1134 //lstActorsSphere.erase( lstActorsSphere.begin()+id );
1135 //lstActorsText.erase( lstActorsText.begin()+id );
1136 //lstSourceSphere.erase( lstSourceSphere.begin()+id );
1137 GetViewShowNPoints()->ErasePoint(id);
1138 GetModelShowNPoints()->ErasePoint(id);
1145 //------------------------------------------------------------------------
1146 void WidgetShowNPoints::OnErasePoint_()
1148 StopAutoAddPoints();
1151 //ErasePoint( GetModelShowNPoints()->IdInsidePoint() );
1152 if (ErasePoint( GetModelShowNPoints()->GetIdCurrentPoint() ) == true)
1156 //renderer->GetRenderWindow()->Render();
1157 // GetViewShowNPoints()->Render();
1158 RefreshCollectionText();
1159 RefreshColourCollection();
1161 UndoRedo_SaveCollection();
1165 //------------------------------------------------------------------------
1166 void WidgetShowNPoints::OnErasePoint(wxCommandEvent& event)
1171 //------------------------------------------------------------------------
1172 void WidgetShowNPoints::OnEraseLastPoint(wxCommandEvent& event)
1175 //ErasePoint( lstActorsSphere.size()-1 );
1176 //renderer->GetRenderWindow()->Render();
1177 StopAutoAddPoints();
1180 int id = GetViewShowNPoints()->lstActorsSphere.size()-1;
1183 RefreshCollectionText();
1184 RefreshColourCollection();
1186 UndoRedo_SaveCollection();
1187 GetViewShowNPoints()->Render();
1192 //------------------------------------------------------------------------
1193 void WidgetShowNPoints::DeleteAllPoints_()
1196 //int id,size=lstActorsSphere.size();
1197 int id,size=GetViewShowNPoints()->lstActorsSphere.size();
1198 for (id=size-1;id>=0;id--)
1204 void WidgetShowNPoints::OnDeleteAllPoints_()
1206 StopAutoAddPoints();
1210 UndoRedo_SaveCollection();
1213 //------------------------------------------------------------------------
1214 void WidgetShowNPoints::OnDeleteAllPoints(wxCommandEvent& event)
1216 OnDeleteAllPoints_();
1218 GetViewShowNPoints()->Render();
1221 //NTU: Method for updating points opacity and Radio
1223 //------------------------------------------------------------------------
1224 void WidgetShowNPoints::UpdatePoints_()
1227 //this->mopacity = sdrOpacity->GetValue()/100.0;
1228 //GetModelShowNPoints()->SetRadio( sdrRadio->GetValue() ) ;
1231 // double opacity = sdrOpacity->GetValue()/100.0;
1232 // double radio = sdrRadio->GetValue();
1233 double opacity = (sCtrlOpacity->GetValue()*10)/100.0;
1234 double radio = sCtrlRadio->GetValue();
1236 int i,size = lstViewShowNPoints.size();
1237 for (i=0 ; i<size ; i++)
1239 lstViewShowNPoints[i]->mopacity = opacity;
1240 lstModelShowNPoints[i]->SetRadio( radio ) ;
1242 // GetViewShowNPoints()->RefreshPoints();
1245 //------------------------------------------------------------------------
1246 void WidgetShowNPoints::UpdatePoints(wxCommandEvent &event)
1248 RefreshColourCollection();
1251 //------------------------------------------------------------------------
1252 void WidgetShowNPoints::SetReferencePoint(std::vector<double> point)
1254 GetModelShowNPoints()->SetReferencePoint(point);
1255 int i,size=lstModelShowNPoints.size();
1256 for (i=0;i<size;i++)
1258 lstModelShowNPoints[i]->SetReferencePoint(point); // All collection
1262 //------------------------------------------------------------------------
1263 void WidgetShowNPoints::SetActualCollection( int actual )
1270 if (actual>lstModelShowNPoints.size()-1 )
1272 actual=lstModelShowNPoints.size()-1;
1275 mActualCollection=actual;
1279 //------------------------------------------------------------------------
1280 void WidgetShowNPoints::SetInitLstPoints( std::vector<double> initLstPointsX, std::vector<double> initLstPointsY, std::vector<double> initLstPointsZ, std::vector<std::string> initLstLabels, std::vector<int> initLstIndexs )
1282 if (GetViewShowNPoints()->renderer==NULL)
1288 int i,sizeX,sizeY,sizeZ,sizeTmp,sizeLabels;
1289 int ii,iIndexs,sizeIndexs;
1291 sizeX = (int)initLstPointsX.size();
1292 sizeY = (int)initLstPointsY.size();
1293 sizeZ = (int)initLstPointsZ.size();
1294 sizeLabels = (int)initLstLabels.size();
1295 sizeIndexs = (int)initLstIndexs.size();
1299 initLstIndexs.push_back(sizeX);
1300 sizeIndexs = (int)initLstIndexs.size();
1303 if ( (sizeX==sizeY) && (sizeX==sizeZ) )
1306 for (iIndexs=0;iIndexs<sizeIndexs;iIndexs++ )
1310 InsertCollectionAfter_();
1312 sizeTmp = initLstIndexs[iIndexs];
1313 for (ii=0;ii<sizeTmp;ii++)
1315 x = initLstPointsX[i];
1316 y = initLstPointsY[i];
1317 z = initLstPointsZ[i];
1320 label = initLstLabels[i];
1324 AddPoint( x,y,z,label );
1331 // renderer->GetRenderWindow()->Render();
1340 //if (this->renderer==NULL)
1341 if (GetViewShowNPoints()->renderer==NULL)
1345 int i,sizeX,sizeY,sizeZ,sizeLabels;
1346 sizeX = (int)initLstPointsX.size();
1347 sizeY = (int)initLstPointsY.size();
1348 sizeZ = (int)initLstPointsZ.size();
1349 sizeLabels = (int)initLstLabels.size();
1352 if ( (sizeX==sizeY) && (sizeX==sizeZ) )
1354 for (i=0;i<sizeX;i++)
1356 x = initLstPointsX[i];
1357 y = initLstPointsY[i];
1358 z = initLstPointsZ[i];
1361 label = initLstLabels[i];
1365 AddPoint( x,y,z,label );
1368 // renderer->GetRenderWindow()->Render();
1374 //------------------------------------------------------------------------
1375 void WidgetShowNPoints::SetType(int type)
1380 //------------------------------------------------------------------------
1381 int WidgetShowNPoints::GetType()
1387 //------------------------------------------------------------------------
1388 double WidgetShowNPoints::GetRadio()
1390 // return sdrRadio->GetValue();
1391 return sCtrlRadio->GetValue();
1393 //------------------------------------------------------------------------
1394 double WidgetShowNPoints::GetOpacity()
1396 // return sdrOpacity->GetValue()/100;
1397 return (sCtrlOpacity->GetValue()*10)/100.0;
1400 //------------------------------------------------------------------------
1401 void WidgetShowNPoints::InsertCollection()
1403 ModelShowNPoints* model = new ModelShowNPoints();
1404 ViewShowNPoints* view = new ViewShowNPoints( model );
1405 view->mopacity = lstViewShowNPoints[0]->mopacity;
1406 view->renderer = lstViewShowNPoints[0]->renderer;
1407 model->SetImage( lstModelShowNPoints[0]->GetImage() );
1408 lstModelShowNPoints.insert( lstModelShowNPoints.begin()+mActualCollection , model );
1409 lstViewShowNPoints.insert( lstViewShowNPoints.begin()+mActualCollection , view );
1412 //------------------------------------------------------------------------
1413 void WidgetShowNPoints::InsertCollectionBefore_()
1416 RefreshCollectionText();
1417 RefreshColourCollection();
1421 //------------------------------------------------------------------------
1422 void WidgetShowNPoints::OnInsertCollectionBefore_()
1424 InsertCollectionBefore_();
1425 CreatePointsIntoNewCollection();
1426 UndoRedo_SaveCollection();
1430 //------------------------------------------------------------------------
1431 void WidgetShowNPoints::OnInsertCollectionBefore(wxCommandEvent &event)
1433 OnInsertCollectionBefore_();
1437 //------------------------------------------------------------------------
1438 void WidgetShowNPoints::InsertCollectionAfter_()
1440 mActualCollection++;
1442 RefreshCollectionText();
1443 RefreshColourCollection();
1448 //------------------------------------------------------------------------
1449 void WidgetShowNPoints::OnInsertCollectionAfter_()
1451 InsertCollectionAfter_();
1452 CreatePointsIntoNewCollection();
1453 UndoRedo_SaveCollection();
1456 //------------------------------------------------------------------------
1457 void WidgetShowNPoints::OnInsertCollectionAfter(wxCommandEvent &event)
1459 OnInsertCollectionAfter_();
1462 //------------------------------------------------------------------------
1463 void WidgetShowNPoints::CreatePointsIntoNewCollection()
1465 int c1 = mActualCollection-1;
1466 int c2 = mActualCollection+1;
1467 int modelSize = lstModelShowNPoints.size();
1468 if (aux_mesh_type==2) // SplineClose2
1470 if (c1==-1) { c1=modelSize-1; }
1471 if (c2==modelSize) { c2=0; }
1472 } // if aux_mesh_type
1474 if ( (c1!=c2) && (c1>=0) && (c1<modelSize) && (c2>=0) && (c2<modelSize) )
1476 std::vector<double> c1LstX = lstModelShowNPoints[c1]->GetLstPointsX();
1477 std::vector<double> c1LstY = lstModelShowNPoints[c1]->GetLstPointsY();
1478 std::vector<double> c1LstZ = lstModelShowNPoints[c1]->GetLstPointsZ();
1479 std::vector<double> c2LstX = lstModelShowNPoints[c2]->GetLstPointsX();
1480 std::vector<double> c2LstY = lstModelShowNPoints[c2]->GetLstPointsY();
1481 std::vector<double> c2LstZ = lstModelShowNPoints[c2]->GetLstPointsZ();
1482 std::vector<double> c1LstXX;
1483 std::vector<double> c1LstYY;
1484 std::vector<double> c1LstZZ;
1485 std::vector<double> c2LstXX;
1486 std::vector<double> c2LstYY;
1487 std::vector<double> c2LstZZ;
1488 creaContoursFactory f;
1489 manualContourModel *m;
1492 int sc; // sizeContour
1494 if ( (c1LstX.size()!=0) && (c2LstX.size()!=0) )
1496 // ----------------- Spline 1 --------------------
1498 size = c1LstX.size();
1499 m = (manualContourModel*)f.getContourModel( 1 ); // Spline
1500 // m->SetNumberOfPointsSpline( bbGetInputNbPoints() );
1501 m->SetNumberOfPointsSpline( sc );
1502 m->SetCloseContour( false );
1503 for (i=0;i<size;i++)
1505 m->AddPoint( c1LstX[i] , c1LstY[i] , c1LstZ[i] );
1510 m->GetSpline_i_Point(i,&x,&y,&z);
1511 c1LstXX.push_back(x);
1512 c1LstYY.push_back(y);
1513 c1LstZZ.push_back(z);
1516 // ----------------- Spline 2 --------------------
1517 size = c2LstX.size();
1518 m = (manualContourModel*)f.getContourModel( 1 ); // Spline
1519 // m->SetNumberOfPointsSpline( bbGetInputNbPoints() );
1520 m->SetNumberOfPointsSpline( sc );
1521 m->SetCloseContour( false );
1522 for (i=0;i<size;i++)
1524 m->AddPoint( c2LstX[i] , c2LstY[i] , c2LstZ[i] );
1529 m->GetSpline_i_Point(i,&x,&y,&z);
1530 c2LstXX.push_back(x);
1531 c2LstYY.push_back(y);
1532 c2LstZZ.push_back(z);
1535 // ----------------- Add new Points --------------------
1536 vtkPoints *points = NULL;
1537 vtkStaticPointLocator *pointLocator = NULL;
1540 points = aux_mesh->GetPoints();
1541 pointLocator = vtkStaticPointLocator::New();
1542 pointLocator->SetDataSet( aux_mesh );
1543 pointLocator->BuildLocator();
1547 if ( c1LstX.size()<c2LstX.size() ) { size=c2LstX.size(); } else { size=c1LstX.size(); }
1548 for (ii=0;ii<size;ii++)
1550 i = (int) ((double)ii/((double)size-1)*(sc-1));
1551 x = (c1LstXX[i]+c2LstXX[i])/2;
1552 y = (c1LstYY[i]+c2LstYY[i])/2;
1553 z = (c1LstZZ[i]+c2LstZZ[i])/2;
1556 p[0] = x * aux_mesh_spc[0];
1557 p[1] = y * aux_mesh_spc[1];
1558 p[2] = z * aux_mesh_spc[2];
1559 points->GetPoint( pointLocator->FindClosestPoint(p) , pM );
1560 x = pM[0] / aux_mesh_spc[0];
1561 y = pM[1] / aux_mesh_spc[1];
1562 z = pM[2] / aux_mesh_spc[2];
1566 if (pointLocator!=NULL) { pointLocator->Delete(); }
1567 RefreshCollectionText();
1568 RefreshColourCollection();
1569 } // if size of c1LstX c2LstX
1573 //------------------------------------------------------------------------
1574 void WidgetShowNPoints::DeleteCollection_()
1576 if ( lstModelShowNPoints.size()>1 )
1578 DeleteAllPoints_(); // Actual Collection
1579 lstModelShowNPoints.erase( lstModelShowNPoints.begin()+mActualCollection );
1580 lstViewShowNPoints.erase( lstViewShowNPoints.begin()+mActualCollection );
1581 if ( mActualCollection>=lstModelShowNPoints.size() )
1583 mActualCollection--;
1586 DeleteAllPoints_(); // Actual Collection
1590 //------------------------------------------------------------------------
1591 void WidgetShowNPoints::OnDeleteCollection_()
1593 DeleteCollection_();
1595 GetViewShowNPoints()->Render();
1596 RefreshCollectionText();
1597 RefreshColourCollection();
1599 UndoRedo_SaveCollection();
1602 //------------------------------------------------------------------------
1603 void WidgetShowNPoints::OnDeleteCollection(wxCommandEvent &event)
1605 OnDeleteCollection_();
1608 //------------------------------------------------------------------------
1609 void WidgetShowNPoints::ResetCollections_()
1611 int i,size=lstModelShowNPoints.size();
1612 for (i=0;i<size;i++)
1614 DeleteCollection_();
1616 GetViewShowNPoints()->Render();
1617 RefreshCollectionText();
1618 RefreshColourCollection();
1623 //------------------------------------------------------------------------
1624 void WidgetShowNPoints::OnResetCollections_()
1626 ResetCollections_();
1627 UndoRedo_SaveCollection();
1631 //------------------------------------------------------------------------
1632 void WidgetShowNPoints::OnResetCollections(wxCommandEvent &event)
1634 OnResetCollections_();
1637 //------------------------------------------------------------------------
1638 void WidgetShowNPoints::OnBackCollection(wxCommandEvent &event)
1640 mActualCollection--;
1641 if ( mActualCollection <0 )
1643 // mActualCollection=0;
1644 mActualCollection = lstModelShowNPoints.size()-1;
1646 RefreshCollectionText();
1647 RefreshColourCollection();
1649 UndoRedo_SaveCollection();
1652 //------------------------------------------------------------------------
1653 void WidgetShowNPoints::OnNextCollection(wxCommandEvent &event)
1655 mActualCollection++;
1656 if ( mActualCollection >=lstModelShowNPoints.size() )
1658 // mActualCollection = lstModelShowNPoints.size()-1;
1659 mActualCollection = 0;
1660 } //if mActualCollection >= size
1661 RefreshCollectionText();
1662 RefreshColourCollection();
1664 UndoRedo_SaveCollection();
1667 //------------------------------------------------------------------------
1668 void WidgetShowNPoints::DetectCollectionActive()
1671 int i,size=lstModelShowNPoints.size();
1672 for (i=0;i<size;i++)
1674 id = lstModelShowNPoints[i]->IdInsidePoint();
1677 mActualCollection=i;
1680 RefreshCollectionText();
1681 RefreshColourCollection();
1684 //------------------------------------------------------------------------
1685 void WidgetShowNPoints::RefreshColourCollection()
1688 std::vector<double> colourAll;
1689 colourAll.push_back(1);
1690 colourAll.push_back(0);
1691 colourAll.push_back(0);
1692 std::vector<double> colourActualGroup;
1693 colourActualGroup.push_back(1);
1694 colourActualGroup.push_back(1);
1695 colourActualGroup.push_back(0);
1697 // For all collections
1698 SetColour( colourAll );
1699 int i,size=lstViewShowNPoints.size();
1700 for (i=0;i<size;i++)
1702 lstViewShowNPoints[i] -> mcolour = colourAll;
1703 lstViewShowNPoints[i] -> ratioRadio = 1;
1704 if ((cbVisuActualCollection!=NULL) && (cbVisuActualCollection->GetValue()==true))
1706 lstViewShowNPoints[i] -> mopacity = 0.0;
1708 lstViewShowNPoints[i] -> mopacity = sCtrlOpacity->GetValue()*10.0/100.0;
1710 lstViewShowNPoints[i]->RefreshEachPoint();
1713 // Actual collection
1714 lstViewShowNPoints[mActualCollection] -> mcolour = colourActualGroup;
1715 lstViewShowNPoints[mActualCollection] -> mopacity = sCtrlOpacity->GetValue()*10.0/100.0;
1716 lstViewShowNPoints[mActualCollection] -> ratioRadio = 1.1;
1717 lstViewShowNPoints[mActualCollection] -> RefreshEachPoint();
1720 int curPnt = lstModelShowNPoints[mActualCollection] -> GetIdCurrentPoint();
1721 size=lstModelShowNPoints[mActualCollection]->GetLstPointsSize();
1722 if ((curPnt>=0) && (curPnt<size ) )
1724 std::vector<double> colourActualPoint;
1725 colourActualPoint.push_back(0);
1726 colourActualPoint.push_back(0);
1727 colourActualPoint.push_back(1);
1728 double radio = GetModelShowNPoints()->GetRadio();
1729 lstViewShowNPoints[mActualCollection] -> mcolour = colourActualPoint;
1730 lstViewShowNPoints[mActualCollection]->RefreshPoint( curPnt );
1731 lstViewShowNPoints[mActualCollection] -> mcolour = colourActualGroup;
1733 lstViewShowNPoints[mActualCollection] -> renderer->GetRenderWindow()->Render();
1736 //------------------------------------------------------------------------
1737 void WidgetShowNPoints::RefreshCollectionText()
1739 if ((mtype==4) && (txtNrCollections!=NULL)) // Just for Collection interface
1742 strTmp.Printf(_T(" %d/%d"), (int)mActualCollection+1, (int)lstModelShowNPoints.size() );
1743 txtNrCollections->SetLabel( strTmp );
1749 //------------------------------------------------------------------------
1750 void WidgetShowNPoints::OnSaveCollections_( std::string filename )
1753 ff = fopen( filename.c_str() , "w+" );
1756 int i,size = lstModelShowNPoints.size();
1757 fprintf(ff,"NumberOfGroups %d \n",size);
1758 for (i=0 ; i<size ; i++)
1760 lstModelShowNPoints[i]->SavePoints_(ff);
1764 printf("WidgetShowNPoints::Save Groups Points ...Error... creating file \n");
1770 //------------------------------------------------------------------------
1771 void WidgetShowNPoints::OnSaveCollections(wxCommandEvent &event)
1773 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
1774 #if wxMAJOR_VERSION <= 2
1775 wxFileDialog* FD = new wxFileDialog( 0,
1776 _T("Save groups of points .."),
1779 _T("(*.xls)|*.xls"),
1780 wxSAVE | wxOVERWRITE_PROMPT,
1783 wxFileDialog* FD = new wxFileDialog( 0,
1784 _T("Save groups of points .."),
1787 _T("(*.xls)|*.xls"),
1788 wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
1792 int result_FD = FD->ShowModal();
1793 // This line is need it by windows //EED
1794 FD->SetReturnCode( result_FD );
1795 if (FD->GetReturnCode()==wxID_OK)
1797 std::string filename= (const char*) ( FD->GetPath().mb_str() );
1798 OnSaveCollections_( filename );
1803 //------------------------------------------------------------------------
1804 void WidgetShowNPoints::OnLoadCollections_( std::string filename )
1806 bool okEraseFirstGroup=false;
1807 if (lstModelShowNPoints.size()==1)
1809 if (GetModelShowNPoints()->GetLstPointsSize()==0) { okEraseFirstGroup=true; }
1811 FILE *ff = fopen( filename.c_str() , "r+" );
1815 int iGroup,sizeGroups;
1816 int iPoint,numberPointsRead;
1818 fscanf(ff," %s %d",chartmp,&sizeGroups);
1819 for (iGroup=0;iGroup<sizeGroups;iGroup++)
1821 mActualCollection = lstModelShowNPoints.size();
1823 int numberPointsRead= lstModelShowNPoints[mActualCollection]->ReadPoints_(ff);
1824 for (i=0;i<numberPointsRead;i++)
1828 GetViewShowNPoints()->AddVtkPoint();
1834 printf("WidgetShowNPoints::Load Group of Points ...Error... reading file");
1836 if (okEraseFirstGroup==true)
1838 mActualCollection=0;
1839 DeleteCollection_();
1840 mActualCollection = lstModelShowNPoints.size()-1;
1842 GetViewShowNPoints()->Render();
1843 RefreshCollectionText();
1844 RefreshColourCollection();
1848 //------------------------------------------------------------------------
1849 void WidgetShowNPoints::OnLoadCollections(wxCommandEvent &event)
1851 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
1852 #if wxMAJOR_VERSION <= 2
1853 wxFileDialog* FD = new wxFileDialog( 0,
1854 _T("Load groups of points .."),
1857 _T("(*.xls)|*.xls"),
1858 wxOPEN | wxFILE_MUST_EXIST,
1861 wxFileDialog* FD = new wxFileDialog( 0,
1862 _T("Load groups of points .."),
1865 _T("(*.xls)|*.xls"),
1866 wxFD_OPEN | wxFD_FILE_MUST_EXIST,
1869 int result_FD = FD->ShowModal();
1870 // This line is need it by windows //EED
1871 FD->SetReturnCode( result_FD );
1872 if (FD->GetReturnCode()==wxID_OK)
1874 std::string filename= (const char*) ( FD->GetPath().mb_str() );
1875 OnLoadCollections_( filename );
1876 UndoRedo_SaveCollection();
1880 //------------------------------------------------------------------------
1881 void WidgetShowNPoints::GetCollectionPoint(int idCol,int idPoint, double *pPoint)
1884 lstModelShowNPoints[idCol]->GetIdPoint(idPoint,&x,&y,&z);
1889 //------------------------------------------------------------------------
1890 void WidgetShowNPoints::SetCollectionPoint(int idCol, int idPoint, std::vector<double> modPoint)
1892 if(idCol >= 0 && idCol < lstModelShowNPoints.size())
1894 lstModelShowNPoints[idCol]->SetPointById(idPoint, modPoint);
1895 lstViewShowNPoints[idCol]->RefreshPoint(idPoint);
1898 printf("WidgetShowNPoints::SetCollectionPoint ...Error... Invalid collection, out of range");
1901 //------------------------------------------------------------------------
1902 std::vector<double> WidgetShowNPoints::GetLstPointsX()
1906 return GetModelShowNPoints()->GetLstPointsX();
1908 std::vector<double> lst;
1910 int iG,sG=lstModelShowNPoints.size();
1911 for (iG=0 ; iG<sG ; iG++)
1913 std::vector<double> lstTmp = lstModelShowNPoints[iG]->GetLstPointsX();
1915 for (iP=0 ; iP<s ; iP++)
1917 lst.push_back( lstTmp[iP] );
1924 //------------------------------------------------------------------------
1925 std::vector<double> WidgetShowNPoints::GetLstPointsY()
1929 return GetModelShowNPoints()->GetLstPointsY();
1931 std::vector<double> lst;
1933 int iG,sG=lstModelShowNPoints.size();
1934 for (iG=0 ; iG<sG ; iG++)
1936 std::vector<double> lstTmp = lstModelShowNPoints[iG]->GetLstPointsY();
1938 for (iP=0 ; iP<s ; iP++)
1940 lst.push_back( lstTmp[iP] );
1947 //------------------------------------------------------------------------
1948 std::vector<double> WidgetShowNPoints::GetLstPointsZ()
1952 return GetModelShowNPoints()->GetLstPointsZ();
1954 std::vector<double> lst;
1956 int iG,sG=lstModelShowNPoints.size();
1957 for (iG=0 ; iG<sG ; iG++)
1959 std::vector<double> lstTmp = lstModelShowNPoints[iG]->GetLstPointsZ();
1961 for (iP=0 ; iP<s ; iP++)
1963 lst.push_back( lstTmp[iP] );
1971 //------------------------------------------------------------------------
1972 std::vector<std::string> WidgetShowNPoints::GetLstLabels()
1976 return GetModelShowNPoints()->GetLstLabels();
1978 std::vector< std::string > lst;
1980 int iG,sG=lstModelShowNPoints.size();
1981 for (iG=0 ; iG<sG ; iG++)
1983 std::vector< std::string > lstTmp = lstModelShowNPoints[iG]->GetLstLabels();
1985 for (iP=0 ; iP<s ; iP++)
1987 lst.push_back( lstTmp[iP] );
1994 //------------------------------------------------------------------------
1995 std::vector<int> WidgetShowNPoints::GetLstIndexs()
1997 std::vector<int> lstIndexs;
2000 lstIndexs.push_back( GetModelShowNPoints()->GetLstPointsSize() );
2002 int iG,sG=lstModelShowNPoints.size();
2003 for (iG=0 ; iG<sG ; iG++)
2005 lstIndexs.push_back( lstModelShowNPoints[iG]->GetLstPointsSize() );
2010 //------------------------------------------------------------------------
2011 int WidgetShowNPoints::GetLstModelShowNPointsSize()
2013 return lstModelShowNPoints.size();
2016 //------------------------------------------------------------------------
2017 void WidgetShowNPoints::InvertLstPoints_()
2019 int i,size=lstModelShowNPoints.size();
2021 for (i=0 ; i < size ; i++)
2023 lstModelShowNPoints[i]->InversLstPoints();
2027 ModelShowNPoints* tmpModel;
2029 for (i=0 ; i < size2 ; i++)
2031 tmpModel = lstModelShowNPoints[i];
2032 lstModelShowNPoints[i] = lstModelShowNPoints[size-1-i];
2033 lstModelShowNPoints[size-1-i] = tmpModel;
2038 //------------------------------------------------------------------------
2039 void WidgetShowNPoints::OnInvertLstPoints_()
2041 StopAutoAddPoints();
2045 UndoRedo_SaveCollection();
2049 //------------------------------------------------------------------------
2050 std::string WidgetShowNPoints::GetUndoRedoFileName()
2053 sprintf(buff,"%p_%d",this, idUndoRedo);
2054 return UndoRedoDir+"/"+"UndoRedo_collection_" + std::string(buff) + ".undoredo";
2058 //------------------------------------------------------------------------
2059 void WidgetShowNPoints::OnUndo(wxCommandEvent &event)
2061 ResetCollections_();
2062 // if (idUndoRedo==maxUndoRedo+1)
2065 // } // if idUndoRedo+1
2072 OnLoadCollections_( GetUndoRedoFileName() );
2078 //------------------------------------------------------------------------
2079 void WidgetShowNPoints::OnRedo(wxCommandEvent &event)
2081 if (idUndoRedo>maxUndoRedo)
2083 idUndoRedo=maxUndoRedo+1;
2085 ResetCollections_();
2086 OnLoadCollections_( GetUndoRedoFileName() );
2091 //------------------------------------------------------------------------
2092 void WidgetShowNPoints::UndoRedo_SaveCollection()
2094 OnSaveCollections_( GetUndoRedoFileName() );
2095 maxUndoRedo = idUndoRedo;
2099 //------------------------------------------------------------------------
2100 void WidgetShowNPoints::SetAuxMesh(vtkPolyData* mesh, std::vector<double> spc, std::vector<double> params)
2104 if (params.size()==1)
2106 aux_mesh_type = params[0];
2112 //------------------------------------------------------------------------
2113 void WidgetShowNPoints::OnVisuActualCollection(wxCommandEvent &event)
2115 printf("EED WidgetShowNPoints::OnVisuActualCollection \n");
2116 RefreshCollectionText();
2117 RefreshColourCollection();