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)
32 printf("WidgetShowNPoints::WidgetShowNPoints Start\n");
34 aux_mesh_spc.push_back(1);
35 aux_mesh_spc.push_back(1);
36 aux_mesh_spc.push_back(1);
37 aux_mesh_type = 0; // 0:Patch 1:CloseSpline1 2:CloseSpline2
40 // mmodelShowNPoints = new ModelShowNPoints();
44 char * val = getenv( "TEMP" );
47 UndoRedoDir = std::string("");
49 UndoRedoDir = std::string(val)+"\\creatools";
50 std::string cmd1 = "mkdir "+ UndoRedoDir;
51 system( cmd1.c_str() );
52 // Erasing files of more than 1 day old ( -1 )
53 std::string cmd2 = "ForFiles /p \"" + UndoRedoDir + "\" /s /d -1 /c \"cmd /c del @file \"";
54 system( cmd2.c_str() );
56 #elif defined(__GNUC__)
60 UndoRedoDir = "/tmp/creatools";
62 UndoRedoDir = "/tmp/creatools";
65 std::string cmd1 = "mkdir "+ UndoRedoDir;
66 system( cmd1.c_str() );
67 // Erasing files of more than 1 day old ( +1 )
68 std::string cmd= "find "+UndoRedoDir+" -name \"UndoRedo_collection_*.undoredo\" -type f -mtime +1 -delete";
69 system( cmd.c_str() );
76 mActualCollection = 0;
77 ModelShowNPoints* modelShowNPoints = new ModelShowNPoints();
78 lstModelShowNPoints.push_back( modelShowNPoints );
79 lstViewShowNPoints.push_back( new ViewShowNPoints( modelShowNPoints ) );
83 wxPanel* panelParent = this;
84 wxSizer* sizer = NULL;
85 wxSizer* MNPsizer = NULL;
86 wxNotebook* bookSetPoints = NULL;
87 wxNotebook* bookGroupManager = NULL;
88 wxPanel* panel = NULL;
89 wxPanel* panel2 = NULL;
90 txtNrCollections = NULL;
92 bookSetPoints = new wxNotebook(panelParent,
97 panel = new wxPanel(bookSetPoints);
99 wxSize sizeButton( 50 , -1 );
100 wxSize sizeSlider( 90 , -1 );
105 bookGroupManager = new wxNotebook(panelParent, //bbGetWxParent(),
110 panel2 = new wxPanel(bookGroupManager);
111 cbVisuActualCollection = new wxCheckBox ( panel2,-1, _T("A.V.") , wxDefaultPosition, sizeButton );
112 txtNrCollections = new wxStaticText ( panel2,-1, _T(" 1/1 "));
113 wxButton *btnBackCollection = new wxButton ( panel2, -1, _T("<") , wxDefaultPosition, sizeButton );
114 wxButton *btnNextCollection = new wxButton ( panel2, -1, _T(">") , wxDefaultPosition, sizeButton );
115 wxButton *btnInsertCollectionBefore = new wxButton ( panel2, -1, _T("+<") , wxDefaultPosition, sizeButton );
116 wxButton *btnInsertCollectionAfter = new wxButton ( panel2, -1, _T("+>") , wxDefaultPosition, sizeButton );
117 wxButton *btnDeleteCollection = new wxButton ( panel2, -1, _T("-") , wxDefaultPosition, sizeButton );
118 wxButton *btnResetCollection = new wxButton ( panel2, -1, _T("--") , wxDefaultPosition, sizeButton );
119 wxButton *btnSaveCollection = new wxButton ( panel2, -1, _T("Save") , wxDefaultPosition, sizeButton );
120 wxButton *btnLoadCollection = new wxButton ( panel2, -1, _T("Load") , wxDefaultPosition, sizeButton );
121 wxButton *btnUndo = new wxButton ( panel2, -1, _T("Undo") , wxDefaultPosition, sizeButton );
122 wxButton *btnRedo = new wxButton ( panel2, -1, _T("Redo") , wxDefaultPosition, sizeButton );
124 sCtrlRadio = new wxSpinCtrl( panel2, -1 , wxEmptyString, wxDefaultPosition, sizeButton );
125 sCtrlRadio->SetRange(1,10);
126 sCtrlRadio->SetValue( 2 );
127 sCtrlOpacity= new wxSpinCtrl( panel2, -1 , wxEmptyString, wxDefaultPosition, sizeButton );
128 sCtrlOpacity->SetRange(0,10);
129 sCtrlOpacity->SetValue( 10 );
131 wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
132 wxFlexGridSizer *sizer2 = new wxFlexGridSizer(2);
133 wxFlexGridSizer *sizer3 = new wxFlexGridSizer(3);
134 wxFlexGridSizer *sizer4 = new wxFlexGridSizer(3);
135 wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2);
136 wxFlexGridSizer *sizer5a = new wxFlexGridSizer(2);
137 wxFlexGridSizer *sizer6 = new wxFlexGridSizer(2);
138 wxFlexGridSizer *sizer7 = new wxFlexGridSizer(2);
139 wxFlexGridSizer *sizer8 = new wxFlexGridSizer(2);
141 cbVisuActualCollection -> SetToolTip( _T("Visu actual collection") );
142 btnInsertCollectionBefore -> SetToolTip( _T("+ Add group before") );
143 btnInsertCollectionAfter -> SetToolTip( _T("+> Add group after") );
144 btnDeleteCollection -> SetToolTip( _T("- Erase group") );
145 btnResetCollection -> SetToolTip( _T("-- Reset : Erase all groups") );
146 sCtrlRadio -> SetToolTip( _T("Radio") );
147 sCtrlOpacity -> SetToolTip( _T("Opacity") );
149 // sdrOpacity = new wxSlider(panel2, -1, 0, 0, 100, wxDefaultPosition, sizeSlider, wxSL_LABELS);
150 // sdrRadio = new wxSlider(panel2, -1, 0, 1, 50, wxDefaultPosition, sizeSlider, wxSL_LABELS);
151 // sdrRadio -> SetToolTip( _T("Radio") );
152 // sdrOpacity -> SetToolTip( _T("Opacity") );
154 Connect(cbVisuActualCollection->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnVisuActualCollection );
155 Connect(btnBackCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) & WidgetShowNPoints::OnBackCollection );
156 Connect(btnNextCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) & WidgetShowNPoints::OnNextCollection );
157 Connect(btnInsertCollectionBefore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionBefore );
158 Connect(btnInsertCollectionAfter->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionAfter );
159 Connect(btnDeleteCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteCollection );
161 // Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) & WidgetShowNPoints::UpdatePoints );
162 // Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) & WidgetShowNPoints::UpdatePoints );
163 Connect( sCtrlRadio->GetId() ,wxEVT_COMMAND_SPINCTRL_UPDATED ,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
164 Connect( sCtrlOpacity->GetId() ,wxEVT_COMMAND_SPINCTRL_UPDATED ,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
166 Connect(btnSaveCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) & WidgetShowNPoints::OnSaveCollections );
167 Connect(btnLoadCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) & WidgetShowNPoints::OnLoadCollections );
168 Connect(btnResetCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) & WidgetShowNPoints::OnResetCollections );
169 Connect(btnUndo->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnUndo );
170 Connect(btnRedo->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnRedo );
172 sizer2->Add( btnBackCollection );
173 sizer2->Add( btnNextCollection );
174 sizer3->Add( btnInsertCollectionBefore );
175 sizer3->Add( btnInsertCollectionAfter );
176 sizer4->Add( btnLoadCollection );
177 sizer4->Add( btnSaveCollection );
178 // sizer5->Add( txRadio ,wxGROW );
179 // sizer5->Add( sdrRadio ,wxGROW );
180 // sizer5->Add( txOpacity ,wxGROW );
181 // sizer5->Add( sdrOpacity ,wxGROW );
183 sizer5->Add( sCtrlRadio );
184 sizer5->Add( sCtrlOpacity );
186 sizer6->Add( btnDeleteCollection );
187 sizer6->Add( btnResetCollection );
189 sizer7->Add( cbVisuActualCollection );
190 sizer7->Add( txtNrCollections );
192 sizer8->Add( btnUndo );
193 sizer8->Add( btnRedo );
195 sizer1->Add( sizer7 );
196 sizer1->Add( sizer2 );
197 sizer1->Add( sizer3 );
198 sizer1->Add( sizer6 );
199 sizer1->Add( sizer4 );
200 sizer1->Add( sizer5 );
201 sizer1->Add( sizer8 );
203 // sizer1->Add( sizer5 ,wxGROW );
206 panel2->SetSizer( MNPsizer );
207 panel2->SetAutoLayout(true);
209 bookGroupManager->AddPage(panel2 , _T("Groups") );
212 if ( (mtype==0) || (mtype==3) || (mtype==4) )
215 // askPointLabel = new wxStaticText(panel, -1, _T("Label:")); // JPR
216 textCtrl = new wxTextCtrl(panel, -1, wxEmptyString , wxDefaultPosition, sizeButton);
217 wxButton *btnBackPoint = new wxButton( panel, -1, _T("<") , wxDefaultPosition, sizeButton );
218 wxButton *btnNextPoint = new wxButton( panel, -1, _T(">") , wxDefaultPosition, sizeButton );
219 wxButton *btnAddPoint = new wxButton( panel, -1, _T("+") , wxDefaultPosition, sizeButton );
220 wxButton *btnInsertPoint = new wxButton( panel, -1, _T("(+)") , wxDefaultPosition, sizeButton );
221 cbAutoAddPoints = new wxCheckBox(panel,-1, _T("Auto") , wxDefaultPosition, sizeButton );
222 wxButton *btnMovePointUp = new wxButton( panel, -1, _T("<-") , wxDefaultPosition, sizeButton );
223 wxButton *btnMovePointDown = new wxButton( panel, -1, _T("->") , wxDefaultPosition, sizeButton );
225 wxButton *btnSetPositionPoint = new wxButton( panel, -1, _T("Set") , wxDefaultPosition, sizeButton );
226 cbTrackPoint = new wxCheckBox(panel,-1, _T("Tra.") , wxDefaultPosition, sizeButton );
227 wxButton *btnRenamePoint = new wxButton( panel, -1, _T("Ren.") , wxDefaultPosition, sizeButton );
228 wxButton *btnErasePoint = new wxButton( panel, -1, _T("-") , wxDefaultPosition, sizeButton );
229 // wxButton *btnEraseLastPoint = new wxButton( panel, -1, _T("- lst") , wxDefaultPosition, sizeButton );
230 wxButton *btnDeleteAllPoints = new wxButton( panel, -1, _T("--") , wxDefaultPosition, sizeButton );
232 wxButton *btnUndo = NULL;
233 wxButton *btnRedo = NULL;
235 wxButton *btnSavePoints = NULL;
236 wxButton *btnLoadPoints = NULL;
239 btnBackPoint -> SetToolTip( _T("Select befor point") );
240 btnNextPoint -> SetToolTip( _T("Select next point") );
241 cbAutoAddPoints -> SetToolTip( _T("Auto Add point") );
242 btnAddPoint -> SetToolTip( _T("+ Add point") );
243 btnInsertPoint -> SetToolTip( _T("(+) Insert point") );
244 btnMovePointUp -> SetToolTip( _T("Move point Up in the normal direction") );
245 btnMovePointDown -> SetToolTip( _T("Move point Down in the normal direction") );
246 btnRenamePoint -> SetToolTip( _T("Rename label for each point") );
247 textCtrl -> SetToolTip( _T("Point label") );
250 btnErasePoint -> SetToolTip( _T("- Erase point") );
251 // btnEraseLastPoint -> SetToolTip( _T("- lst Erase last point") );
252 btnDeleteAllPoints -> SetToolTip( _T("-- Erase all points") );
256 btnUndo = new wxButton( panel, -1, _T("Undo") , wxDefaultPosition, sizeButton );
257 btnRedo = new wxButton( panel, -1, _T("Redo") , wxDefaultPosition, sizeButton );
258 btnSavePoints = new wxButton( panel, -1, _T("Save") , wxDefaultPosition, sizeButton );
259 btnLoadPoints = new wxButton( panel, -1, _T("Load") , wxDefaultPosition, sizeButton );
260 Connect(btnSavePoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints );
261 Connect(btnLoadPoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints );
262 Connect(btnUndo->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnUndo );
263 Connect(btnRedo->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnRedo );
265 txtNrPoints = new wxStaticText(panel,-1, _T(" -/-"));
267 wxStaticText* txOpacity;
268 wxStaticText* txRadio;
269 if ( (mtype==0) || (mtype==3) )
271 //NTU: Sliders for opacity and radio change
272 // txOpacity = new wxStaticText(panel, -1, wxString(_T(" Points Opacity ")));
273 // sdrOpacity = new wxSlider(panel, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
274 // txRadio = new wxStaticText(panel, -1, wxString(_T(" Points Radius ")));
275 // sdrRadio = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
276 // //NTU: Slider events
277 // Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
278 // Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
280 sCtrlRadio = new wxSpinCtrl( panel, -1 , wxEmptyString, wxDefaultPosition, sizeButton );
281 sCtrlRadio->SetRange(1,10);
282 sCtrlRadio->SetValue( 2 );
283 sCtrlOpacity= new wxSpinCtrl( panel, -1 , wxEmptyString, wxDefaultPosition, sizeButton );
284 sCtrlOpacity->SetRange(0,10);
285 sCtrlOpacity->SetValue( 10 );
286 Connect( sCtrlRadio->GetId() ,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
287 Connect( sCtrlOpacity->GetId() ,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
291 Connect(cbAutoAddPoints->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WidgetShowNPoints::OnAutoAddPoints );
292 Connect(btnBackPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnBackPoint );
293 Connect(btnNextPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnNextPoint );
294 Connect(btnAddPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnAddPoint );
295 Connect(btnInsertPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnInsertPoint );
296 Connect(btnMovePointUp->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnMovePointUp );
297 Connect(btnMovePointDown->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnMovePointDown );
298 Connect(btnSetPositionPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint );
299 Connect(btnRenamePoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnRenamePoint );
300 // Connect(btnEraseLastPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnEraseLastPoint );
301 Connect(btnErasePoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnErasePoint );
302 Connect(btnDeleteAllPoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnDeleteAllPoints );
303 Connect(cbTrackPoint->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WidgetShowNPoints::OnTrackPoint );
304 wxFlexGridSizer *sizer0 = new wxFlexGridSizer(1);
305 wxFlexGridSizer *sizer1 = new wxFlexGridSizer(2);
306 wxFlexGridSizer *sizer2 = new wxFlexGridSizer(3);
307 wxFlexGridSizer *sizer3 = new wxFlexGridSizer(2);
308 wxFlexGridSizer *sizer4 = new wxFlexGridSizer(3);
309 // wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2);
310 wxFlexGridSizer *sizer6 = new wxFlexGridSizer(2);
311 wxFlexGridSizer *sizer7 = new wxFlexGridSizer(2);
312 wxFlexGridSizer *sizer8 = new wxFlexGridSizer(2);
313 sizer1->Add( textCtrl );
314 sizer1->Add( btnRenamePoint );
315 sizer2->Add( btnAddPoint );
316 sizer2->Add( btnInsertPoint );
317 // sizer2->Add( cbAutoAddPoints );
318 sizer3->Add( btnSetPositionPoint );
319 sizer3->Add( cbTrackPoint );
320 sizer4->Add( btnErasePoint );
321 // sizer4->Add( btnEraseLastPoint );
322 sizer4->Add( btnDeleteAllPoints );
323 // sizer5->Add( btnUndo );
324 // sizer5->Add( btnRedo );
325 sizer6->Add( btnBackPoint );
326 sizer6->Add( btnNextPoint );
327 sizer7->Add( btnMovePointUp );
328 sizer7->Add( btnMovePointDown );
329 sizer8->Add( cbAutoAddPoints );
330 sizer8->Add( txtNrPoints );
332 // sizer0->Add(askPointLabel); // JPR
340 // sizer0->Add(sizer5);
341 if ( (mtype==0) || (mtype==3) )
343 wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2);
344 // sizer5->Add(txRadio);
345 // sizer5->Add(sdrRadio,1,wxGROW );
346 // sizer5->Add(txOpacity);
347 // sizer5->Add(sdrOpacity,1,wxGROW );
349 sizer5->Add( sCtrlRadio );
350 sizer5->Add( sCtrlOpacity );
358 wxFlexGridSizer *sizer5 = new wxFlexGridSizer(2);
359 wxFlexGridSizer *sizer6 = new wxFlexGridSizer(2);
360 sizer6->Add( btnSavePoints );
361 sizer6->Add( btnLoadPoints );
362 sizer5->Add( btnUndo );
363 sizer5->Add( btnRedo );
364 sizer0->Add( sizer6 );
365 sizer0->Add( sizer5 );
373 wxButton *btnSetPositionPoint = new wxButton( panel, -1, _T("Set nearest point"));
374 txtNrPoints = new wxStaticText(panel,-1, _T("-/-"));
376 //NTU: Sliders for opacity and radio change
377 // sdrRadio = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
378 // sdrOpacity = new wxSlider(panel, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
379 // Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
380 // Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
381 wxStaticText* txOpacity = new wxStaticText(panel, -1, wxString(_T(" Points Opacity ")));
382 wxStaticText* txRadio = new wxStaticText(panel, -1, wxString(_T(" Points Radio ")));
384 sCtrlRadio = new wxSpinCtrl( panel, -1 , wxEmptyString, wxDefaultPosition, sizeButton );
385 sCtrlRadio->SetRange(1,10);
386 sCtrlRadio->SetValue( 2 );
387 sCtrlOpacity= new wxSpinCtrl( panel, -1 , wxEmptyString, wxDefaultPosition, sizeButton );
388 sCtrlOpacity->SetRange(0,10);
389 sCtrlOpacity->SetValue( 10 );
390 Connect( sCtrlRadio->GetId() ,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
391 Connect( sCtrlOpacity->GetId() ,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &WidgetShowNPoints::UpdatePoints);
394 Connect(btnSetPositionPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint);
396 wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
397 sizer1->Add(btnSetPositionPoint);
398 sizer1->Add(txtNrPoints);
399 sizer1->Add(txRadio);
400 //sizer1->Add(sdrRadio,1,wxGROW );
401 //sizer1->Add(sdrOpacity,1,wxGROW );
402 sizer1->Add(sCtrlRadio );
403 sizer1->Add(sCtrlOpacity);
409 askPointLabel = new wxStaticText(panel, -1, _T("\nPOINT CONTROLS:")); // JPR
410 wxButton *btnAddPoint = new wxButton(panel , -1, _T(" Add Point "));
411 wxButton *btnDeleteAllPoints = new wxButton(panel , -1, _T(" Delete All "));
412 wxStaticText *spacer = new wxStaticText(panel, -1, _T("\n")); // JPR
413 textCtrl = new wxTextCtrl(panel, -1);
414 Connect(btnAddPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnAddPoint);
415 Connect(btnDeleteAllPoints->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteAllPoints);
416 wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
417 sizer1->Add(askPointLabel);
418 sizer1->Add(btnAddPoint);
419 sizer1->Add(btnDeleteAllPoints);
421 sizer1->Add(textCtrl);
422 // sdrOpacity = new wxSlider();
423 // sdrRadio = new wxSlider();
424 txtNrPoints = new wxStaticText(panel, -1, _T("\n\n\n"));
426 } // bbGetInputType 2
428 panel->SetSizer(sizer);
429 panel->SetAutoLayout(true);
431 bookSetPoints->AddPage(panel , _T("Points") );
433 if ((mtype >= 0) && (mtype <= 3) )
437 wxFlexGridSizer *sizerParent = new wxFlexGridSizer(1);
438 sizerParent->Add( bookSetPoints );
439 panelParent->SetSizer( sizerParent );
440 panelParent->SetAutoLayout(true);
441 panelParent->Layout();
443 } // if mtype 0 1 2 3
447 if ((sizer!=NULL) && (MNPsizer!=NULL))
449 wxFlexGridSizer *sizerG = new wxFlexGridSizer(2);
450 sizerG->Add(bookGroupManager);
451 sizerG->Add(bookSetPoints);
452 panelParent->SetSizer(sizerG);
453 panelParent->SetAutoLayout(true);
454 panelParent->Layout();
458 printf("WidgetShowNPoints::WidgetShowNPoints End\n");
462 //------------------------------------------------------------------------
463 WidgetShowNPoints::~WidgetShowNPoints()
467 //------------------------------------------------------------------------
468 ModelShowNPoints* WidgetShowNPoints::GetModelShowNPoints()
471 // return mmodelShowNPoints;
472 return lstModelShowNPoints[ mActualCollection ];
475 //------------------------------------------------------------------------
476 ModelShowNPoints* WidgetShowNPoints::GetModelShowNPoints(int id)
478 if(id >= 0 && id < lstModelShowNPoints.size())
480 return lstModelShowNPoints[ id ];
485 //------------------------------------------------------------------------
486 ViewShowNPoints* WidgetShowNPoints::GetViewShowNPoints()
488 return lstViewShowNPoints[ mActualCollection ];
492 //------------------------------------------------------------------------
493 void WidgetShowNPoints::SetRadio(double radio)
496 // GetModelShowNPoints()->SetRadio(radio);
497 int i,size = lstModelShowNPoints.size();
500 lstModelShowNPoints[i]->SetRadio( radio );
503 // sdrRadio->SetValue(radio);
504 sCtrlRadio->SetValue(radio);
507 //------------------------------------------------------------------------
508 void WidgetShowNPoints::SetColour(std::vector<double> colour)
511 //this->mcolour = colour;
512 int i,size = lstViewShowNPoints.size();
513 for (i=0 ; i<size ; i++)
515 lstViewShowNPoints[i]->mcolour = colour;
519 //------------------------------------------------------------------------
520 void WidgetShowNPoints::SetImage(vtkImageData* image)
523 //GetModelShowNPoints()->SetImage(image);
524 int i,size = lstModelShowNPoints.size();
525 for (i=0 ; i<size ; i++)
527 lstModelShowNPoints[i]->SetImage(image);
531 //------------------------------------------------------------------------
532 void WidgetShowNPoints::SetOpacity(double opacity)
535 //this->mopacity=opacity;
536 int i,size = lstViewShowNPoints.size();
537 for (i=0 ; i<size ; i++)
539 lstViewShowNPoints[i]->mopacity = opacity;
542 // sdrOpacity->SetValue( opacity*100.0 );
543 sCtrlOpacity->SetValue( opacity*10.0 );
548 //------------------------------------------------------------------------
549 void WidgetShowNPoints::SetRenderer(vtkRenderer *renderer)
552 //this->renderer = renderer;
553 int i,size = lstViewShowNPoints.size();
554 for (i=0 ; i<size ; i++)
556 lstViewShowNPoints[i]->renderer = renderer;
561 //------------------------------------------------------------------------
563 void WidgetShowNPoints::RefreshPoint(int id)
567 GetModelShowNPoints()->GetIdPoint(id,&x,&y,&z);
568 GetModelShowNPoints()->GetImage()->GetSpacing(spc);
569 std::string label = GetModelShowNPoints()->GetIdLabel(id);
570 double radio = GetModelShowNPoints()->GetRadio();
571 lstActorsSphere[id]->SetPosition( spc[0]*x , spc[1]*y , spc[2]*z );
572 lstActorsSphere[id]->GetProperty()->SetColor( mcolour[0] , mcolour[1] , mcolour[2] );
573 lstActorsSphere[id]->GetProperty()->SetOpacity( mopacity );
574 lstSourceSphere[id]->SetRadius( radio );
575 //EED 2017-01-01 Migration VTK7
576 #if VTK_MAJOR_VERSION <= 5
579 lstSourceSphere[id]->Update();
581 lstActorsText[id]->SetInput( label.c_str() );
582 lstActorsText[id]->SetPosition( radio+spc[0]*x , spc[1]*y , spc[2]*z );
585 //------------------------------------------------------------------------
586 void WidgetShowNPoints::RefreshPoints()
588 int id,size=lstActorsSphere.size();
589 for (id=0;id<size;id++)
593 renderer->GetRenderWindow()->Render();
596 //------------------------------------------------------------------------
597 void WidgetShowNPoints::AddVtkPoint()
600 vtkSphereSource *vtksphere = vtkSphereSource::New();
601 vtksphere->SetThetaResolution (20);
602 vtksphere->SetPhiResolution (20);
603 vtksphere->SetRadius( 1 );
604 //NTU: For updating points
605 lstSourceSphere.push_back(vtksphere);
606 vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
608 //EED 2017-01-01 Migration VTK7
609 #if VTK_MAJOR_VERSION <= 5
610 sphereMapper->SetInput( vtksphere->GetOutput() );
613 sphereMapper->SetInputData( vtksphere->GetOutput() );
616 vtkActor *sphereActor = vtkActor::New();
617 sphereActor->SetMapper(sphereMapper);
618 sphereActor->SetOrigin(0, 0, 0);
620 lstActorsSphere.push_back(sphereActor);
622 wxMessageDialog dialog(this, _T("Renderer Not Set"),_T("Renderer Not Set"),wxICON_ERROR);
626 renderer->AddActor( sphereActor );
628 vtkTextActor3D *textActor = vtkTextActor3D::New();
629 // textActor->SetInput( strLabel.c_str() );
630 renderer->AddActor( textActor );
631 lstActorsText.push_back(textActor);
636 void WidgetShowNPoints::SetCurrentPoint(int idCurrentPoint )
638 int size = GetModelShowNPoints()->GetLstPointsSize();
639 if (idCurrentPoint<0) { idCurrentPoint = size-1; }
640 if (idCurrentPoint>=size ) { idCurrentPoint = 0; }
641 GetModelShowNPoints()->SetIdCurrentPoint( idCurrentPoint );
642 RefreshCollectionText();
643 RefreshColourCollection();
646 void WidgetShowNPoints::OnBackPoint(wxCommandEvent &event)
648 SetCurrentPoint( GetModelShowNPoints()->GetIdCurrentPoint() - 1 );
651 void WidgetShowNPoints::OnNextPoint(wxCommandEvent &event)
653 SetCurrentPoint( GetModelShowNPoints()->GetIdCurrentPoint() + 1 );
657 //------------------------------------------------------------------------
658 void WidgetShowNPoints::AddPoint(double x, double y, double z, std::string label)
660 GetModelShowNPoints()->AddPoint(x,y,z, label );
663 //RefreshPoint(lstActorsSphere.size()-1);
664 GetViewShowNPoints()->AddPoint();
667 //------------------------------------------------------------------------
668 void WidgetShowNPoints::InsertPoint(double x, double y, double z, std::string label)//CFT
671 //if ( GetModelShowNPoints()->InsertPoint(x,y,z,label) != -1 )
675 // AddPoint(x,y,z,label);
678 if ( GetModelShowNPoints()->InsertPoint(x,y,z,label) != -1 )
680 GetViewShowNPoints()->AddVtkPoint();
682 AddPoint(x,y,z,label);
684 GetViewShowNPoints()->RefreshPoints();
687 //------------------------------------------------------------------------
688 void WidgetShowNPoints::OnInsertPoint_()
691 //if (this->renderer==NULL)
695 if (GetViewShowNPoints()->renderer==NULL)
699 std::vector<double> point = GetModelShowNPoints()->GetReferencePoint();
702 InsertPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
704 } else {//mpoint.size
705 printf("creaMaracasVisu::ShowNPoints (not match point) \n");
707 RefreshCollectionText();
708 RefreshColourCollection();
710 UndoRedo_SaveCollection();
713 //------------------------------------------------------------------------
714 void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT
719 //------------------------------------------------------------------------
720 void WidgetShowNPoints::OnAddPoint__()
723 //if (this->renderer==NULL)
724 if (GetViewShowNPoints()->renderer==NULL)
728 std::vector<double> point = GetModelShowNPoints()->GetReferencePoint();
731 AddPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
734 //renderer->GetRenderWindow()->Render();
735 GetViewShowNPoints()->Render();
736 UndoRedo_SaveCollection();
737 } else {//mpoint.size
738 printf("creaMaracasVisu::ShowNPoints (not match point) \n");
742 void WidgetShowNPoints::OnAddPoint_()
749 //------------------------------------------------------------------------
750 void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event)
755 //------------------------------------------------------------------------
756 void WidgetShowNPoints::AutoAddPoints()
758 if ( cbAutoAddPoints->GetValue() == true )
761 RefreshCollectionText();
762 RefreshColourCollection();
763 } // if cbAutoAddPoints
766 //------------------------------------------------------------------------
767 void WidgetShowNPoints::OnAutoAddPoints_tool()
770 cbAutoAddPoints->SetValue( !cbAutoAddPoints->GetValue() );
773 //------------------------------------------------------------------------
774 void WidgetShowNPoints::OnAutoAddPoints_()
779 //------------------------------------------------------------------------
780 void WidgetShowNPoints::OnAutoAddPoints(wxCommandEvent& event)
785 //------------------------------------------------------------------------
786 void WidgetShowNPoints::StopAutoAddPoints( )
788 cbAutoAddPoints->SetValue(false);
791 //------------------------------------------------------------------------
792 void WidgetShowNPoints::SetOutputBox()
795 if (GetModelShowNPoints()->GetIdCurrentPoint()<0)
797 strTmp.Printf(_T(" -/%d") , GetModelShowNPoints()->GetLstPointsSize() );
799 strTmp.Printf(_T(" %d/%d"), GetModelShowNPoints()->GetIdCurrentPoint()+1 , GetModelShowNPoints()->GetLstPointsSize() );
801 txtNrPoints->SetLabel( strTmp );
805 // mbbShowNPoints->bbSetOutputlstPointsX( GetModelShowNPoints()->GetLstPointsX() );
806 // mbbShowNPoints->bbSetOutputlstPointsY( GetModelShowNPoints()->GetLstPointsY() );
807 // mbbShowNPoints->bbSetOutputlstPointsZ( GetModelShowNPoints()->GetLstPointsZ() );
808 // mbbShowNPoints->bbSetOutputlstLabels( GetModelShowNPoints()->GetLstLabels() );
809 // mbbShowNPoints->bbSignalOutputModification();
813 //------------------------------------------------------------------------
814 void WidgetShowNPoints::OnSavePoints(wxCommandEvent& event)
817 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
818 #if wxMAJOR_VERSION <= 2
819 wxFileDialog* FD = new wxFileDialog( 0,
820 _T("Save points .."),
824 wxSAVE | wxOVERWRITE_PROMPT,
827 wxFileDialog* FD = new wxFileDialog( 0,
828 _T("Save points .."),
832 wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
836 int result_FD = FD->ShowModal();
837 // This line is need it by windows //EED
838 FD->SetReturnCode( result_FD );
839 if (FD->GetReturnCode()==wxID_OK)
841 std::string filename= (const char*) ( FD->GetPath().mb_str() );
842 GetModelShowNPoints()->SavePoints( filename );
847 //------------------------------------------------------------------------
848 void WidgetShowNPoints::OnLoadPoints(wxCommandEvent& event)
851 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
852 #if wxMAJOR_VERSION <= 2
853 wxFileDialog* FD = new wxFileDialog( 0,
854 _T("Load points .."),
858 wxOPEN | wxFILE_MUST_EXIST,
861 wxFileDialog* FD = new wxFileDialog( 0,
862 _T("Load points .."),
866 wxFD_OPEN | wxFD_FILE_MUST_EXIST,
871 int result_FD = FD->ShowModal();
872 // This line is need it by windows //EED
873 FD->SetReturnCode( result_FD );
874 if (FD->GetReturnCode()==wxID_OK)
877 std::string filename= (const char*) ( FD->GetPath().mb_str() );
878 int numberPointsRead = GetModelShowNPoints()->ReadPoints( filename );
879 for (i=0;i<numberPointsRead;i++)
883 GetViewShowNPoints()->AddVtkPoint();
888 GetViewShowNPoints()->RefreshPoints();
892 //------------------------------------------------------------------------
893 void WidgetShowNPoints::OnSetPoint_()
898 //int id=GetModelShowNPoints()->GetNearestPoint();
899 int id=GetModelShowNPoints()->GetIdCurrentPoint();
901 if((id==-1) && (mtype==1))
909 GetModelShowNPoints()->SetPointId_mReferencePoint(id);
912 //renderer->GetRenderWindow()->Render();
913 GetViewShowNPoints()->RefreshPoint(id);
914 GetViewShowNPoints()->Render();
916 RefreshCollectionText();
917 RefreshColourCollection();
919 UndoRedo_SaveCollection();
922 //------------------------------------------------------------------------
923 void WidgetShowNPoints::OnSetPoint(wxCommandEvent& event)
928 //------------------------------------------------------------------------
929 void WidgetShowNPoints::MovePoint_(double step)
934 int id=GetModelShowNPoints()->GetIdCurrentPoint();
937 if((GetLstModelShowNPointsSize()>=2) //Check condition
938 && (GetModelShowNPoints()->GetLstPointsSize()>0)
939 && (aux_mesh != NULL)
940 && (aux_mesh_spc.size() == 3))
944 double normal[3]; // point to modify and normal
945 std::vector<double> pN(3); // new point
946 vtkStaticPointLocator *pointLocator = vtkStaticPointLocator::New();
947 pointLocator->SetDataSet( aux_mesh );
948 pointLocator->BuildLocator();
950 // int idControlPoint = wsp->GetModelShowNPoints()->GetNearestPoint();
951 int idControlPoint = GetModelShowNPoints()->GetIdCurrentPoint();
952 if(idControlPoint >= 0)
954 GetModelShowNPoints()->GetIdPoint(idControlPoint, &x, &y, &z);
955 p[0] = x * aux_mesh_spc[0];
956 p[1] = y * aux_mesh_spc[1];
957 p[2] = z * aux_mesh_spc[2];
958 long int idMeshPoint = pointLocator->FindClosestPoint(p);
959 vtkDataArray *dataArrayNormals = aux_mesh->GetPointData()->GetNormals();
960 if (dataArrayNormals!=NULL)
962 dataArrayNormals->GetTuple(idMeshPoint, normal);
964 int direction = step;
965 // pN[0] = p[0] / spc[0] + direction*normal[0];
966 // pN[1] = p[1] / spc[1] + direction*normal[1];
967 // pN[2] = p[2] / spc[2] + direction*normal[2];
968 pN[0] = x + (direction * normal[0]);
969 pN[1] = y + (direction * normal[1]);
970 pN[2] = z + (direction * normal[2]);
971 GetModelShowNPoints()->SetPointById(idControlPoint, pN);
972 // GetViewShowNPoints()->RefreshPoint(idControlPoint);
973 // RefreshCollectionText();
974 // RefreshColourCollection();
976 UndoRedo_SaveCollection();
978 printf("Error! WidgetShowNPoints::MovePoint_ Missing normals in aux_mesh \n");
980 } // if idControlPoint
981 } // if wsp->GetLstModelShowNPointsSiz->size()>=2
986 double minX=max,minY=max,minZ=max;
987 double maxX=-max,maxY=-max,maxZ=-max;
988 sizeG = lstModelShowNPoints.size();
989 for (i=0; i<sizeG; i++)
991 std::vector<double> lstX = lstModelShowNPoints[i]->GetLstPointsX();
992 std::vector<double> lstY = lstModelShowNPoints[i]->GetLstPointsY();
993 std::vector<double> lstZ = lstModelShowNPoints[i]->GetLstPointsZ();
995 for (j=0; j<sizeP; j++)
997 if ( lstX[j]<minX ) { minX=lstX[j]; }
998 if ( lstY[j]<minY ) { minY=lstY[j]; }
999 if ( lstZ[j]<minZ ) { minZ=lstZ[j]; }
1000 if ( lstX[j]>maxX ) { maxX=lstX[j]; }
1001 if ( lstY[j]>maxY ) { maxY=lstY[j]; }
1002 if ( lstZ[j]>maxZ ) { maxZ=lstZ[j]; }
1006 pc[0]=(minX+maxX) /2 ; pc[1]=(minY+maxY) /2 ; pc[2]=(minZ+maxZ) /2 ;
1008 p[0]=GetModelShowNPoints()->GetLstPointsX()[id];
1009 p[1]=GetModelShowNPoints()->GetLstPointsY()[id];
1010 p[2]=GetModelShowNPoints()->GetLstPointsZ()[id];
1015 double mag=sqrt ( v[0]*v[0] + v[1]*v[1] + v[2]*v[2] );
1016 std::vector<double> point;
1027 point.push_back( p[0] + step*v[0] );
1028 point.push_back( p[1] + step*v[1] );
1029 point.push_back( p[2] + step*v[2] );
1030 GetModelShowNPoints()->SetPointById(id,point);
1031 UndoRedo_SaveCollection();
1034 RefreshCollectionText();
1035 RefreshColourCollection();
1038 //------------------------------------------------------------------------
1039 void WidgetShowNPoints::OnMovePointUp(wxCommandEvent& event)
1044 //------------------------------------------------------------------------
1045 void WidgetShowNPoints::OnMovePointDown(wxCommandEvent& event)
1050 //------------------------------------------------------------------------
1051 void WidgetShowNPoints::TrackingPoint( )
1053 if ( cbTrackPoint->GetValue() == true )
1055 int id = GetModelShowNPoints()->IdInsidePoint();
1063 GetModelShowNPoints()->SetPointId_mReferencePoint(idTrack);
1065 RefreshCollectionText();
1066 RefreshColourCollection();
1068 // GetViewShowNPoints()->RefreshPoint(idTrack);
1069 // GetViewShowNPoints()->Render();
1070 UndoRedo_SaveCollection();
1072 } // if trackPointFlag
1075 //------------------------------------------------------------------------
1076 void WidgetShowNPoints::OnTrackPoint_tool()
1078 cbTrackPoint->SetValue( !cbTrackPoint->GetValue() );
1082 //------------------------------------------------------------------------
1083 void WidgetShowNPoints::OnTrackPoint_()
1085 StopAutoAddPoints();
1088 if ( cbTrackPoint->GetValue() == true )
1091 // idTrack = GetModelShowNPoints()->IdInsidePoint();
1092 idTrack = GetModelShowNPoints()->GetIdCurrentPoint();
1093 } // if trackPointFlag
1096 //------------------------------------------------------------------------
1097 void WidgetShowNPoints::OnTrackPoint(wxCommandEvent& event)
1102 //------------------------------------------------------------------------
1103 void WidgetShowNPoints::StopTrackPoint( )
1105 cbTrackPoint->SetValue(false);
1109 //------------------------------------------------------------------------
1110 void WidgetShowNPoints::OnRenamePoint(wxCommandEvent& event)
1112 int id = GetModelShowNPoints()->RenamePoint( (const char*) ( textCtrl->GetValue().mb_str() ) );
1116 //lstActorsText[id]->SetInput( (const char*) ( textCtrl->GetValue().mb_str() ) );
1117 //renderer->GetRenderWindow()->Render();
1118 GetViewShowNPoints()->lstActorsText[id]->SetInput( (const char*) ( textCtrl->GetValue().mb_str() ) );
1119 GetViewShowNPoints()->Render();
1121 UndoRedo_SaveCollection();
1125 //------------------------------------------------------------------------
1126 bool WidgetShowNPoints::ErasePoint(int id)
1129 //if (this->renderer!=NULL)
1131 if (GetViewShowNPoints()->renderer!=NULL)
1136 //renderer->RemoveActor( lstActorsSphere[id] );
1137 //renderer->RemoveActor( lstActorsText[id] );
1138 //lstActorsSphere[id]->Delete();
1139 //lstActorsText[id]->Delete();
1140 //lstSourceSphere[id]->Delete();
1141 //lstActorsSphere.erase( lstActorsSphere.begin()+id );
1142 //lstActorsText.erase( lstActorsText.begin()+id );
1143 //lstSourceSphere.erase( lstSourceSphere.begin()+id );
1144 GetViewShowNPoints()->ErasePoint(id);
1145 GetModelShowNPoints()->ErasePoint(id);
1152 //------------------------------------------------------------------------
1153 void WidgetShowNPoints::OnErasePoint_()
1155 StopAutoAddPoints();
1158 //ErasePoint( GetModelShowNPoints()->IdInsidePoint() );
1159 if (ErasePoint( GetModelShowNPoints()->GetIdCurrentPoint() ) == true)
1163 //renderer->GetRenderWindow()->Render();
1164 // GetViewShowNPoints()->Render();
1165 RefreshCollectionText();
1166 RefreshColourCollection();
1168 UndoRedo_SaveCollection();
1172 //------------------------------------------------------------------------
1173 void WidgetShowNPoints::OnErasePoint(wxCommandEvent& event)
1178 //------------------------------------------------------------------------
1179 void WidgetShowNPoints::OnEraseLastPoint(wxCommandEvent& event)
1182 //ErasePoint( lstActorsSphere.size()-1 );
1183 //renderer->GetRenderWindow()->Render();
1184 StopAutoAddPoints();
1187 int id = GetViewShowNPoints()->lstActorsSphere.size()-1;
1190 RefreshCollectionText();
1191 RefreshColourCollection();
1193 UndoRedo_SaveCollection();
1194 GetViewShowNPoints()->Render();
1199 //------------------------------------------------------------------------
1200 void WidgetShowNPoints::DeleteAllPoints_()
1203 //int id,size=lstActorsSphere.size();
1204 int id,size=GetViewShowNPoints()->lstActorsSphere.size();
1205 for (id=size-1;id>=0;id--)
1211 void WidgetShowNPoints::OnDeleteAllPoints_()
1213 StopAutoAddPoints();
1217 UndoRedo_SaveCollection();
1220 //------------------------------------------------------------------------
1221 void WidgetShowNPoints::OnDeleteAllPoints(wxCommandEvent& event)
1223 OnDeleteAllPoints_();
1225 GetViewShowNPoints()->Render();
1228 //NTU: Method for updating points opacity and Radio
1230 //------------------------------------------------------------------------
1231 void WidgetShowNPoints::UpdatePoints_()
1234 //this->mopacity = sdrOpacity->GetValue()/100.0;
1235 //GetModelShowNPoints()->SetRadio( sdrRadio->GetValue() ) ;
1238 // double opacity = sdrOpacity->GetValue()/100.0;
1239 // double radio = sdrRadio->GetValue();
1240 double opacity = (sCtrlOpacity->GetValue()*10)/100.0;
1241 double radio = sCtrlRadio->GetValue();
1243 int i,size = lstViewShowNPoints.size();
1244 for (i=0 ; i<size ; i++)
1246 lstViewShowNPoints[i]->mopacity = opacity;
1247 lstModelShowNPoints[i]->SetRadio( radio ) ;
1249 // GetViewShowNPoints()->RefreshPoints();
1252 //------------------------------------------------------------------------
1253 void WidgetShowNPoints::UpdatePoints(wxCommandEvent &event)
1255 RefreshColourCollection();
1258 //------------------------------------------------------------------------
1259 void WidgetShowNPoints::SetReferencePoint(std::vector<double> point)
1261 GetModelShowNPoints()->SetReferencePoint(point);
1262 int i,size=lstModelShowNPoints.size();
1263 for (i=0;i<size;i++)
1265 lstModelShowNPoints[i]->SetReferencePoint(point); // All collection
1269 //------------------------------------------------------------------------
1270 void WidgetShowNPoints::SetActualCollection( int actual )
1277 if (actual>lstModelShowNPoints.size()-1 )
1279 actual=lstModelShowNPoints.size()-1;
1282 mActualCollection=actual;
1286 //------------------------------------------------------------------------
1287 void WidgetShowNPoints::SetInitLstPoints( std::vector<double> initLstPointsX, std::vector<double> initLstPointsY, std::vector<double> initLstPointsZ, std::vector<std::string> initLstLabels, std::vector<int> initLstIndexs )
1289 if (GetViewShowNPoints()->renderer==NULL)
1295 int i,sizeX,sizeY,sizeZ,sizeTmp,sizeLabels;
1296 int ii,iIndexs,sizeIndexs;
1298 sizeX = (int)initLstPointsX.size();
1299 sizeY = (int)initLstPointsY.size();
1300 sizeZ = (int)initLstPointsZ.size();
1301 sizeLabels = (int)initLstLabels.size();
1302 sizeIndexs = (int)initLstIndexs.size();
1306 initLstIndexs.push_back(sizeX);
1307 sizeIndexs = (int)initLstIndexs.size();
1310 if ( (sizeX==sizeY) && (sizeX==sizeZ) )
1313 for (iIndexs=0;iIndexs<sizeIndexs;iIndexs++ )
1317 InsertCollectionAfter_();
1319 sizeTmp = initLstIndexs[iIndexs];
1320 for (ii=0;ii<sizeTmp;ii++)
1322 x = initLstPointsX[i];
1323 y = initLstPointsY[i];
1324 z = initLstPointsZ[i];
1327 label = initLstLabels[i];
1331 AddPoint( x,y,z,label );
1338 // renderer->GetRenderWindow()->Render();
1347 //if (this->renderer==NULL)
1348 if (GetViewShowNPoints()->renderer==NULL)
1352 int i,sizeX,sizeY,sizeZ,sizeLabels;
1353 sizeX = (int)initLstPointsX.size();
1354 sizeY = (int)initLstPointsY.size();
1355 sizeZ = (int)initLstPointsZ.size();
1356 sizeLabels = (int)initLstLabels.size();
1359 if ( (sizeX==sizeY) && (sizeX==sizeZ) )
1361 for (i=0;i<sizeX;i++)
1363 x = initLstPointsX[i];
1364 y = initLstPointsY[i];
1365 z = initLstPointsZ[i];
1368 label = initLstLabels[i];
1372 AddPoint( x,y,z,label );
1375 // renderer->GetRenderWindow()->Render();
1381 //------------------------------------------------------------------------
1382 void WidgetShowNPoints::SetType(int type)
1387 //------------------------------------------------------------------------
1388 int WidgetShowNPoints::GetType()
1394 //------------------------------------------------------------------------
1395 double WidgetShowNPoints::GetRadio()
1397 // return sdrRadio->GetValue();
1398 return sCtrlRadio->GetValue();
1400 //------------------------------------------------------------------------
1401 double WidgetShowNPoints::GetOpacity()
1403 // return sdrOpacity->GetValue()/100;
1404 return (sCtrlOpacity->GetValue()*10)/100.0;
1407 //------------------------------------------------------------------------
1408 void WidgetShowNPoints::InsertCollection()
1410 ModelShowNPoints* model = new ModelShowNPoints();
1411 ViewShowNPoints* view = new ViewShowNPoints( model );
1412 view->mopacity = lstViewShowNPoints[0]->mopacity;
1413 view->renderer = lstViewShowNPoints[0]->renderer;
1414 model->SetImage( lstModelShowNPoints[0]->GetImage() );
1415 lstModelShowNPoints.insert( lstModelShowNPoints.begin()+mActualCollection , model );
1416 lstViewShowNPoints.insert( lstViewShowNPoints.begin()+mActualCollection , view );
1419 //------------------------------------------------------------------------
1420 void WidgetShowNPoints::InsertCollectionBefore_()
1423 RefreshCollectionText();
1424 RefreshColourCollection();
1428 //------------------------------------------------------------------------
1429 void WidgetShowNPoints::OnInsertCollectionBefore_()
1431 InsertCollectionBefore_();
1432 CreatePointsIntoNewCollection();
1433 UndoRedo_SaveCollection();
1437 //------------------------------------------------------------------------
1438 void WidgetShowNPoints::OnInsertCollectionBefore(wxCommandEvent &event)
1440 OnInsertCollectionBefore_();
1444 //------------------------------------------------------------------------
1445 void WidgetShowNPoints::InsertCollectionAfter_()
1447 mActualCollection++;
1449 RefreshCollectionText();
1450 RefreshColourCollection();
1455 //------------------------------------------------------------------------
1456 void WidgetShowNPoints::OnInsertCollectionAfter_()
1458 InsertCollectionAfter_();
1459 CreatePointsIntoNewCollection();
1460 UndoRedo_SaveCollection();
1463 //------------------------------------------------------------------------
1464 void WidgetShowNPoints::OnInsertCollectionAfter(wxCommandEvent &event)
1466 OnInsertCollectionAfter_();
1469 //------------------------------------------------------------------------
1470 void WidgetShowNPoints::CreatePointsIntoNewCollection()
1472 int c1 = mActualCollection-1;
1473 int c2 = mActualCollection+1;
1474 int modelSize = lstModelShowNPoints.size();
1475 if (aux_mesh_type==2) // SplineClose2
1477 if (c1==-1) { c1=modelSize-1; }
1478 if (c2==modelSize) { c2=0; }
1479 } // if aux_mesh_type
1481 if ( (c1!=c2) && (c1>=0) && (c1<modelSize) && (c2>=0) && (c2<modelSize) )
1483 std::vector<double> c1LstX = lstModelShowNPoints[c1]->GetLstPointsX();
1484 std::vector<double> c1LstY = lstModelShowNPoints[c1]->GetLstPointsY();
1485 std::vector<double> c1LstZ = lstModelShowNPoints[c1]->GetLstPointsZ();
1486 std::vector<double> c2LstX = lstModelShowNPoints[c2]->GetLstPointsX();
1487 std::vector<double> c2LstY = lstModelShowNPoints[c2]->GetLstPointsY();
1488 std::vector<double> c2LstZ = lstModelShowNPoints[c2]->GetLstPointsZ();
1489 std::vector<double> c1LstXX;
1490 std::vector<double> c1LstYY;
1491 std::vector<double> c1LstZZ;
1492 std::vector<double> c2LstXX;
1493 std::vector<double> c2LstYY;
1494 std::vector<double> c2LstZZ;
1495 creaContoursFactory f;
1496 manualContourModel *m;
1499 int sc; // sizeContour
1501 if ( (c1LstX.size()!=0) && (c2LstX.size()!=0) )
1503 // ----------------- Spline 1 --------------------
1505 size = c1LstX.size();
1506 m = (manualContourModel*)f.getContourModel( 1 ); // Spline
1507 // m->SetNumberOfPointsSpline( bbGetInputNbPoints() );
1508 m->SetNumberOfPointsSpline( sc );
1509 m->SetCloseContour( false );
1510 for (i=0;i<size;i++)
1512 m->AddPoint( c1LstX[i] , c1LstY[i] , c1LstZ[i] );
1517 m->GetSpline_i_Point(i,&x,&y,&z);
1518 c1LstXX.push_back(x);
1519 c1LstYY.push_back(y);
1520 c1LstZZ.push_back(z);
1523 // ----------------- Spline 2 --------------------
1524 size = c2LstX.size();
1525 m = (manualContourModel*)f.getContourModel( 1 ); // Spline
1526 // m->SetNumberOfPointsSpline( bbGetInputNbPoints() );
1527 m->SetNumberOfPointsSpline( sc );
1528 m->SetCloseContour( false );
1529 for (i=0;i<size;i++)
1531 m->AddPoint( c2LstX[i] , c2LstY[i] , c2LstZ[i] );
1536 m->GetSpline_i_Point(i,&x,&y,&z);
1537 c2LstXX.push_back(x);
1538 c2LstYY.push_back(y);
1539 c2LstZZ.push_back(z);
1542 // ----------------- Add new Points --------------------
1543 vtkPoints *points = NULL;
1544 vtkStaticPointLocator *pointLocator = NULL;
1547 points = aux_mesh->GetPoints();
1548 pointLocator = vtkStaticPointLocator::New();
1549 pointLocator->SetDataSet( aux_mesh );
1550 pointLocator->BuildLocator();
1554 if ( c1LstX.size()<c2LstX.size() ) { size=c2LstX.size(); } else { size=c1LstX.size(); }
1555 for (ii=0;ii<size;ii++)
1557 i = (int) ((double)ii/((double)size-1)*(sc-1));
1558 x = (c1LstXX[i]+c2LstXX[i])/2;
1559 y = (c1LstYY[i]+c2LstYY[i])/2;
1560 z = (c1LstZZ[i]+c2LstZZ[i])/2;
1563 p[0] = x * aux_mesh_spc[0];
1564 p[1] = y * aux_mesh_spc[1];
1565 p[2] = z * aux_mesh_spc[2];
1566 points->GetPoint( pointLocator->FindClosestPoint(p) , pM );
1567 x = pM[0] / aux_mesh_spc[0];
1568 y = pM[1] / aux_mesh_spc[1];
1569 z = pM[2] / aux_mesh_spc[2];
1573 if (pointLocator!=NULL) { pointLocator->Delete(); }
1574 RefreshCollectionText();
1575 RefreshColourCollection();
1576 } // if size of c1LstX c2LstX
1580 //------------------------------------------------------------------------
1581 void WidgetShowNPoints::DeleteCollection_()
1583 if ( lstModelShowNPoints.size()>1 )
1585 DeleteAllPoints_(); // Actual Collection
1586 lstModelShowNPoints.erase( lstModelShowNPoints.begin()+mActualCollection );
1587 lstViewShowNPoints.erase( lstViewShowNPoints.begin()+mActualCollection );
1588 if ( mActualCollection>=lstModelShowNPoints.size() )
1590 mActualCollection--;
1593 DeleteAllPoints_(); // Actual Collection
1597 //------------------------------------------------------------------------
1598 void WidgetShowNPoints::OnDeleteCollection_()
1600 DeleteCollection_();
1602 GetViewShowNPoints()->Render();
1603 RefreshCollectionText();
1604 RefreshColourCollection();
1606 UndoRedo_SaveCollection();
1609 //------------------------------------------------------------------------
1610 void WidgetShowNPoints::OnDeleteCollection(wxCommandEvent &event)
1612 OnDeleteCollection_();
1615 //------------------------------------------------------------------------
1616 void WidgetShowNPoints::ResetCollections_()
1618 int i,size=lstModelShowNPoints.size();
1619 for (i=0;i<size;i++)
1621 DeleteCollection_();
1623 GetViewShowNPoints()->Render();
1624 RefreshCollectionText();
1625 RefreshColourCollection();
1630 //------------------------------------------------------------------------
1631 void WidgetShowNPoints::OnResetCollections_()
1633 ResetCollections_();
1634 UndoRedo_SaveCollection();
1638 //------------------------------------------------------------------------
1639 void WidgetShowNPoints::OnResetCollections(wxCommandEvent &event)
1641 OnResetCollections_();
1644 //------------------------------------------------------------------------
1645 void WidgetShowNPoints::OnBackCollection(wxCommandEvent &event)
1647 mActualCollection--;
1648 if ( mActualCollection <0 )
1650 // mActualCollection=0;
1651 mActualCollection = lstModelShowNPoints.size()-1;
1653 RefreshCollectionText();
1654 RefreshColourCollection();
1656 UndoRedo_SaveCollection();
1659 //------------------------------------------------------------------------
1660 void WidgetShowNPoints::OnNextCollection(wxCommandEvent &event)
1662 mActualCollection++;
1663 if ( mActualCollection >=lstModelShowNPoints.size() )
1665 // mActualCollection = lstModelShowNPoints.size()-1;
1666 mActualCollection = 0;
1667 } //if mActualCollection >= size
1668 RefreshCollectionText();
1669 RefreshColourCollection();
1671 UndoRedo_SaveCollection();
1674 //------------------------------------------------------------------------
1675 void WidgetShowNPoints::DetectCollectionActive()
1678 int i,size=lstModelShowNPoints.size();
1679 for (i=0;i<size;i++)
1681 id = lstModelShowNPoints[i]->IdInsidePoint();
1684 mActualCollection=i;
1687 RefreshCollectionText();
1688 RefreshColourCollection();
1691 //------------------------------------------------------------------------
1692 void WidgetShowNPoints::RefreshColourCollection()
1695 std::vector<double> colourAll;
1696 colourAll.push_back(1);
1697 colourAll.push_back(0);
1698 colourAll.push_back(0);
1699 std::vector<double> colourActualGroup;
1700 colourActualGroup.push_back(1);
1701 colourActualGroup.push_back(1);
1702 colourActualGroup.push_back(0);
1704 // For all collections
1705 SetColour( colourAll );
1706 int i,size=lstViewShowNPoints.size();
1707 for (i=0;i<size;i++)
1709 lstViewShowNPoints[i] -> mcolour = colourAll;
1710 lstViewShowNPoints[i] -> ratioRadio = 1;
1711 if (cbVisuActualCollection->GetValue()==true)
1713 lstViewShowNPoints[i] -> mopacity = 0.0;
1715 lstViewShowNPoints[i] -> mopacity = sCtrlOpacity->GetValue()*10.0/100.0;
1717 lstViewShowNPoints[i]->RefreshEachPoint();
1720 // Actual collection
1721 lstViewShowNPoints[mActualCollection] -> mcolour = colourActualGroup;
1722 lstViewShowNPoints[mActualCollection] -> mopacity = sCtrlOpacity->GetValue()*10.0/100.0;
1723 lstViewShowNPoints[mActualCollection] -> ratioRadio = 1.1;
1724 lstViewShowNPoints[mActualCollection] -> RefreshEachPoint();
1727 int curPnt = lstModelShowNPoints[mActualCollection] -> GetIdCurrentPoint();
1728 size=lstModelShowNPoints[mActualCollection]->GetLstPointsSize();
1729 if ((curPnt>=0) && (curPnt<size ) )
1731 std::vector<double> colourActualPoint;
1732 colourActualPoint.push_back(0);
1733 colourActualPoint.push_back(0);
1734 colourActualPoint.push_back(1);
1735 double radio = GetModelShowNPoints()->GetRadio();
1736 lstViewShowNPoints[mActualCollection] -> mcolour = colourActualPoint;
1737 lstViewShowNPoints[mActualCollection]->RefreshPoint( curPnt );
1738 lstViewShowNPoints[mActualCollection] -> mcolour = colourActualGroup;
1740 lstViewShowNPoints[mActualCollection] -> renderer->GetRenderWindow()->Render();
1743 //------------------------------------------------------------------------
1744 void WidgetShowNPoints::RefreshCollectionText()
1746 if ((mtype==4) && (txtNrCollections!=NULL)) // Just for Collection interface
1749 strTmp.Printf(_T(" %d/%d"), (int)mActualCollection+1, (int)lstModelShowNPoints.size() );
1750 txtNrCollections->SetLabel( strTmp );
1756 //------------------------------------------------------------------------
1757 void WidgetShowNPoints::OnSaveCollections_( std::string filename )
1760 ff = fopen( filename.c_str() , "w+" );
1763 int i,size = lstModelShowNPoints.size();
1764 fprintf(ff,"NumberOfGroups %d \n",size);
1765 for (i=0 ; i<size ; i++)
1767 lstModelShowNPoints[i]->SavePoints_(ff);
1771 printf("WidgetShowNPoints::Save Groups Points ...Error... creating file \n");
1777 //------------------------------------------------------------------------
1778 void WidgetShowNPoints::OnSaveCollections(wxCommandEvent &event)
1780 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
1781 #if wxMAJOR_VERSION <= 2
1782 wxFileDialog* FD = new wxFileDialog( 0,
1783 _T("Save groups of points .."),
1786 _T("(*.xls)|*.xls"),
1787 wxSAVE | wxOVERWRITE_PROMPT,
1790 wxFileDialog* FD = new wxFileDialog( 0,
1791 _T("Save groups of points .."),
1794 _T("(*.xls)|*.xls"),
1795 wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
1799 int result_FD = FD->ShowModal();
1800 // This line is need it by windows //EED
1801 FD->SetReturnCode( result_FD );
1802 if (FD->GetReturnCode()==wxID_OK)
1804 std::string filename= (const char*) ( FD->GetPath().mb_str() );
1805 OnSaveCollections_( filename );
1810 //------------------------------------------------------------------------
1811 void WidgetShowNPoints::OnLoadCollections_( std::string filename )
1813 bool okEraseFirstGroup=false;
1814 if (lstModelShowNPoints.size()==1)
1816 if (GetModelShowNPoints()->GetLstPointsSize()==0) { okEraseFirstGroup=true; }
1818 FILE *ff = fopen( filename.c_str() , "r+" );
1822 int iGroup,sizeGroups;
1823 int iPoint,numberPointsRead;
1825 fscanf(ff," %s %d",chartmp,&sizeGroups);
1826 for (iGroup=0;iGroup<sizeGroups;iGroup++)
1828 mActualCollection = lstModelShowNPoints.size();
1830 int numberPointsRead= lstModelShowNPoints[mActualCollection]->ReadPoints_(ff);
1831 for (i=0;i<numberPointsRead;i++)
1835 GetViewShowNPoints()->AddVtkPoint();
1841 printf("WidgetShowNPoints::Load Group of Points ...Error... reading file");
1843 if (okEraseFirstGroup==true)
1845 mActualCollection=0;
1846 DeleteCollection_();
1847 mActualCollection = lstModelShowNPoints.size()-1;
1849 GetViewShowNPoints()->Render();
1850 RefreshCollectionText();
1851 RefreshColourCollection();
1855 //------------------------------------------------------------------------
1856 void WidgetShowNPoints::OnLoadCollections(wxCommandEvent &event)
1858 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
1859 #if wxMAJOR_VERSION <= 2
1860 wxFileDialog* FD = new wxFileDialog( 0,
1861 _T("Load groups of points .."),
1864 _T("(*.xls)|*.xls"),
1865 wxOPEN | wxFILE_MUST_EXIST,
1868 wxFileDialog* FD = new wxFileDialog( 0,
1869 _T("Load groups of points .."),
1872 _T("(*.xls)|*.xls"),
1873 wxFD_OPEN | wxFD_FILE_MUST_EXIST,
1876 int result_FD = FD->ShowModal();
1877 // This line is need it by windows //EED
1878 FD->SetReturnCode( result_FD );
1879 if (FD->GetReturnCode()==wxID_OK)
1881 std::string filename= (const char*) ( FD->GetPath().mb_str() );
1882 OnLoadCollections_( filename );
1883 UndoRedo_SaveCollection();
1887 //------------------------------------------------------------------------
1888 void WidgetShowNPoints::GetCollectionPoint(int idCol,int idPoint, double *pPoint)
1891 lstModelShowNPoints[idCol]->GetIdPoint(idPoint,&x,&y,&z);
1896 //------------------------------------------------------------------------
1897 void WidgetShowNPoints::SetCollectionPoint(int idCol, int idPoint, std::vector<double> modPoint)
1899 if(idCol >= 0 && idCol < lstModelShowNPoints.size())
1901 lstModelShowNPoints[idCol]->SetPointById(idPoint, modPoint);
1902 lstViewShowNPoints[idCol]->RefreshPoint(idPoint);
1905 printf("WidgetShowNPoints::SetCollectionPoint ...Error... Invalid collection, out of range");
1908 //------------------------------------------------------------------------
1909 std::vector<double> WidgetShowNPoints::GetLstPointsX()
1913 return GetModelShowNPoints()->GetLstPointsX();
1915 std::vector<double> lst;
1917 int iG,sG=lstModelShowNPoints.size();
1918 for (iG=0 ; iG<sG ; iG++)
1920 std::vector<double> lstTmp = lstModelShowNPoints[iG]->GetLstPointsX();
1922 for (iP=0 ; iP<s ; iP++)
1924 lst.push_back( lstTmp[iP] );
1931 //------------------------------------------------------------------------
1932 std::vector<double> WidgetShowNPoints::GetLstPointsY()
1936 return GetModelShowNPoints()->GetLstPointsY();
1938 std::vector<double> lst;
1940 int iG,sG=lstModelShowNPoints.size();
1941 for (iG=0 ; iG<sG ; iG++)
1943 std::vector<double> lstTmp = lstModelShowNPoints[iG]->GetLstPointsY();
1945 for (iP=0 ; iP<s ; iP++)
1947 lst.push_back( lstTmp[iP] );
1954 //------------------------------------------------------------------------
1955 std::vector<double> WidgetShowNPoints::GetLstPointsZ()
1959 return GetModelShowNPoints()->GetLstPointsZ();
1961 std::vector<double> lst;
1963 int iG,sG=lstModelShowNPoints.size();
1964 for (iG=0 ; iG<sG ; iG++)
1966 std::vector<double> lstTmp = lstModelShowNPoints[iG]->GetLstPointsZ();
1968 for (iP=0 ; iP<s ; iP++)
1970 lst.push_back( lstTmp[iP] );
1978 //------------------------------------------------------------------------
1979 std::vector<std::string> WidgetShowNPoints::GetLstLabels()
1983 return GetModelShowNPoints()->GetLstLabels();
1985 std::vector< std::string > lst;
1987 int iG,sG=lstModelShowNPoints.size();
1988 for (iG=0 ; iG<sG ; iG++)
1990 std::vector< std::string > lstTmp = lstModelShowNPoints[iG]->GetLstLabels();
1992 for (iP=0 ; iP<s ; iP++)
1994 lst.push_back( lstTmp[iP] );
2001 //------------------------------------------------------------------------
2002 std::vector<int> WidgetShowNPoints::GetLstIndexs()
2004 std::vector<int> lstIndexs;
2007 lstIndexs.push_back( GetModelShowNPoints()->GetLstPointsSize() );
2009 int iG,sG=lstModelShowNPoints.size();
2010 for (iG=0 ; iG<sG ; iG++)
2012 lstIndexs.push_back( lstModelShowNPoints[iG]->GetLstPointsSize() );
2017 //------------------------------------------------------------------------
2018 int WidgetShowNPoints::GetLstModelShowNPointsSize()
2020 return lstModelShowNPoints.size();
2023 //------------------------------------------------------------------------
2024 void WidgetShowNPoints::InvertLstPoints_()
2026 int i,size=lstModelShowNPoints.size();
2028 for (i=0 ; i < size ; i++)
2030 lstModelShowNPoints[i]->InversLstPoints();
2034 ModelShowNPoints* tmpModel;
2036 for (i=0 ; i < size2 ; i++)
2038 tmpModel = lstModelShowNPoints[i];
2039 lstModelShowNPoints[i] = lstModelShowNPoints[size-1-i];
2040 lstModelShowNPoints[size-1-i] = tmpModel;
2045 //------------------------------------------------------------------------
2046 void WidgetShowNPoints::OnInvertLstPoints_()
2048 StopAutoAddPoints();
2052 UndoRedo_SaveCollection();
2056 //------------------------------------------------------------------------
2057 std::string WidgetShowNPoints::GetUndoRedoFileName()
2060 sprintf(buff,"%p_%d",this, idUndoRedo);
2061 return UndoRedoDir+"/"+"UndoRedo_collection_" + std::string(buff) + ".undoredo";
2065 //------------------------------------------------------------------------
2066 void WidgetShowNPoints::OnUndo(wxCommandEvent &event)
2068 ResetCollections_();
2069 // if (idUndoRedo==maxUndoRedo+1)
2072 // } // if idUndoRedo+1
2079 OnLoadCollections_( GetUndoRedoFileName() );
2085 //------------------------------------------------------------------------
2086 void WidgetShowNPoints::OnRedo(wxCommandEvent &event)
2088 if (idUndoRedo>maxUndoRedo)
2090 idUndoRedo=maxUndoRedo+1;
2092 ResetCollections_();
2093 OnLoadCollections_( GetUndoRedoFileName() );
2098 //------------------------------------------------------------------------
2099 void WidgetShowNPoints::UndoRedo_SaveCollection()
2101 OnSaveCollections_( GetUndoRedoFileName() );
2102 maxUndoRedo = idUndoRedo;
2106 //------------------------------------------------------------------------
2107 void WidgetShowNPoints::SetAuxMesh(vtkPolyData* mesh, std::vector<double> spc, std::vector<double> params)
2111 if (params.size()==1)
2113 aux_mesh_type = params[0];
2119 //------------------------------------------------------------------------
2120 void WidgetShowNPoints::OnVisuActualCollection(wxCommandEvent &event)
2122 printf("EED WidgetShowNPoints::OnVisuActualCollection \n");
2123 RefreshCollectionText();
2124 RefreshColourCollection();