From 85574c45069833acf7f4fc8fc9c241413225dd8e Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 15 Jun 2022 16:53:26 +0200 Subject: [PATCH] #3485 ShowNPionts for Multiple Groups --- bbtk/src/bbmaracasvisuShowNPoints.cxx | 2 +- .../wxWindows/widgets/ModelShowNPoints.cxx | 92 ++++--- .../wxWindows/widgets/ModelShowNPoints.h | 4 +- .../wxWindows/widgets/ViewShowNPoints.cxx | 16 +- .../wxWindows/widgets/ViewShowNPoints.h | 1 + .../wxWindows/widgets/WidgetShowNPoints.cxx | 244 +++++++++++++++--- .../wxWindows/widgets/WidgetShowNPoints.h | 7 +- 7 files changed, 281 insertions(+), 85 deletions(-) diff --git a/bbtk/src/bbmaracasvisuShowNPoints.cxx b/bbtk/src/bbmaracasvisuShowNPoints.cxx index 661b677..561f35f 100644 --- a/bbtk/src/bbmaracasvisuShowNPoints.cxx +++ b/bbtk/src/bbmaracasvisuShowNPoints.cxx @@ -133,7 +133,7 @@ void ShowNPoints::bbUserSetDefaultValues() bbSetInputOpacity(1); std::vector colour; colour.push_back(1.0); - colour.push_back(0.0); + colour.push_back(1.0); colour.push_back(0.0); bbSetInputColour(colour); bbSetInputImage(NULL); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx index 7468bfd..422c299 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.cxx @@ -181,59 +181,71 @@ int ModelShowNPoints::InsertPoint(int x, int y, int z, std::string label) } +//------------------------------------------------------------------------ +void ModelShowNPoints::SavePoints_(FILE* ff) +{ + std::string tmpLabel; + int i , size = (int) (lstPointsX.size()); + fprintf(ff,"NumberOfPoints %d \n",size); + fprintf(ff," X\tY\tZ\tvalue\tLabel\n"); + int x, y, z; + double value; + for (i=0; iGetScalarComponentAsDouble(x,y,z,0); + if (lstLabels[i]!="") + { + tmpLabel=lstLabels[i]; + } else{ + tmpLabel="<_VOID_>"; + } + fprintf(ff,"%d\t%d\t%d\t%f\t%s\n", x , y , z , value , tmpLabel.c_str()); + } // for +} + //------------------------------------------------------------------------ void ModelShowNPoints::SavePoints(std::string filename) { - std::string tmpLabel; - FILE *ff; - ff = fopen( filename.c_str() , "w+" ); - if (ff!=NULL) - { - int i , size = (int) (lstPointsX.size()); - fprintf(ff,"NumberOfPoints %d \n",size); - fprintf(ff," X\tY\tZ\tvalue\tLabel\n"); - int x, y, z; - double value; - for (i=0; iGetScalarComponentAsDouble(x,y,z,0); - if (lstLabels[i]!="") - { - tmpLabel=lstLabels[i]; - } else{ - tmpLabel="<_VOID_>"; - } - fprintf(ff,"%d\t%d\t%d\t%f\t%s\n", x , y , z , value , tmpLabel.c_str()); - } // for + FILE* ff = fopen( filename.c_str() , "w+" ); + if (ff!=NULL) + { + SavePoints_(ff); fclose(ff); } else { // else ff - printf("ModelShowNPoints::SavePoints ...Error... creating file"); + printf("ModelShowNPoints::SavePoints ...Error... creating file\n"); } //ff } +//------------------------------------------------------------------------ +int ModelShowNPoints::ReadPoints_(FILE* ff) +{ + int i,size; + char chartmp[256]; + fscanf(ff," %s %d",chartmp,&size); + fscanf(ff," %s %s %s %s %s",chartmp, chartmp,chartmp,chartmp,chartmp ); + + float value; + int x,y,z; + for (i=0; i")==0) { strcpy(chartmp,""); } + AddPoint(x,y,z, chartmp ); + } + return size; +} + //------------------------------------------------------------------------ int ModelShowNPoints::ReadPoints(std::string filename) { - int i,size; - char chartmp[256]; - FILE *ff; - ff = fopen( filename.c_str() , "r+" ); + int size=0; + FILE *ff = fopen( filename.c_str() , "r+" ); if (ff!=NULL) { - fscanf(ff," %s %d",chartmp,&size); - fscanf(ff," %s %s %s %s %s",chartmp, chartmp,chartmp,chartmp,chartmp ); - - float value; - int x,y,z; - for (i=0; i")==0) { strcpy(chartmp,""); } - AddPoint(x,y,z, chartmp ); - } + size = ReadPoints_(ff); fclose(ff); } else { // else ff printf("ModelShowNPoints::LoadPoints ...Error... reading file"); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.h index cee7495..b56348c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ModelShowNPoints.h @@ -23,7 +23,9 @@ class ModelShowNPoints double Distance(double dX0, double dY0, double dZ0, double dX1, double dY1, double dZ1); int InsertPoint(int x, int y, int z, std::string label); void SavePoints(std::string filename); - int ReadPoints(std::string filename); + void SavePoints_(FILE* ff); + + int ReadPoints(std::string filename); int GetNearestPoint(); int GetLstPointsSize(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx index ac81dd7..0af0e45 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx @@ -7,7 +7,7 @@ ViewShowNPoints::ViewShowNPoints(ModelShowNPoints* modelShowNPoints) { renderer = NULL; - mmodelShowNPoints=modelShowNPoints; + mmodelShowNPoints = modelShowNPoints; } //---------------------------------------------------------------------- @@ -41,13 +41,19 @@ void ViewShowNPoints::RefreshPoint(int id) } //------------------------------------------------------------------------ -void ViewShowNPoints::RefreshPoints() +void ViewShowNPoints::RefreshEachPoint() { int id,size=lstActorsSphere.size(); for (id=0;idGetRenderWindow()->Render(); } @@ -56,8 +62,8 @@ void ViewShowNPoints::AddVtkPoint() { // Sphere vtkSphereSource *vtksphere = vtkSphereSource::New(); - vtksphere->SetThetaResolution (20); - vtksphere->SetPhiResolution (20); + vtksphere->SetThetaResolution (10); + vtksphere->SetPhiResolution (10); vtksphere->SetRadius( 1 ); //NTU: For updating points lstSourceSphere.push_back(vtksphere); @@ -134,5 +140,5 @@ ModelShowNPoints* ViewShowNPoints::GetModelShowNPoints() //------------------------------------------------------------------------ void ViewShowNPoints::SetModelShowNPoints( ModelShowNPoints* modelShowNPoints) { - mmodelShowNPoints=modelShowNPoints; + mmodelShowNPoints = modelShowNPoints; } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.h index 168d86a..d70292c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.h @@ -22,6 +22,7 @@ class ViewShowNPoints ModelShowNPoints* GetModelShowNPoints(); void SetModelShowNPoints(ModelShowNPoints* modelShowNPoints); void RefreshPoint(int id); + void RefreshEachPoint(); void RefreshPoints(); void AddVtkPoint(); void AddPoint(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx index f97d8cd..eb35406 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx @@ -42,9 +42,6 @@ wxPanel* panel = NULL; wxPanel* panel2 = NULL; - - - bookSetPoints = new wxNotebook(panelParent, -1, wxDefaultPosition, @@ -65,15 +62,27 @@ txtNrCollections = new wxStaticText(panel2,-1, _T("1 / 1 ")); wxButton *btnBackCollection = new wxButton( panel2, -1, _T("<")); wxButton *btnNextCollection = new wxButton( panel2, -1, _T(">")); - wxButton *btnInsertCollectionBefore = new wxButton( panel2, -1, _T("Insert Before")); - wxButton *btnInsertCollectionAfter = new wxButton( panel2, -1, _T("Insert After")); - wxButton *btnDeleteCollection = new wxButton( panel2, -1, _T("Delete")); - - Connect(btnInsertCollectionBefore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionBefore); - Connect(btnInsertCollectionAfter->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionAfter); - Connect(btnDeleteCollection->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteCollection); - Connect(btnBackCollection->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnBackCollection); - Connect(btnNextCollection->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnNextCollection); + wxButton *btnInsertCollectionBefore = new wxButton( panel2, -1, _T("Insert Group Before")); + wxButton *btnInsertCollectionAfter = new wxButton( panel2, -1, _T("Insert Group After")); + wxButton *btnDeleteCollection = new wxButton( panel2, -1, _T("Delete Group ")); + wxButton *btnSaveCollection = new wxButton( panel2, -1, _T("Save Groups")); + wxButton *btnLoadCollection = new wxButton( panel2, -1, _T("Load Groups")); + + //NTU: Sliders for opacity and radio change + wxStaticText* txOpacity = new wxStaticText(panel2, -1, wxString(_T(" Points Opacity "))); + sdrOpacity = new wxSlider(panel2, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS); + wxStaticText* txRadio = new wxStaticText(panel2, -1, wxString(_T(" Points Radius "))); + sdrRadio = new wxSlider(panel2, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS); + //NTU: Slider events + Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints); + Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints); + + Connect(btnInsertCollectionBefore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionBefore ); + Connect(btnInsertCollectionAfter->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionAfter ); + Connect(btnDeleteCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteCollection ); + Connect(btnBackCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnBackCollection ); + Connect(btnSaveCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnSaveCollections ); + Connect(btnLoadCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnLoadCollections ); wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1); wxFlexGridSizer *sizer2 = new wxFlexGridSizer(2); @@ -86,11 +95,19 @@ sizer1->Add( btnInsertCollectionBefore ); sizer1->Add( btnInsertCollectionAfter ); sizer1->Add( btnDeleteCollection ); + + sizer1->Add( txOpacity ); + sizer1->Add( sdrOpacity ); + sizer1->Add( txRadio ); + sizer1->Add( sdrRadio ); + + sizer1->Add( btnSaveCollection ); + sizer1->Add( btnLoadCollection ); MNPsizer = sizer1; panel2->SetSizer( MNPsizer ); panel2->SetAutoLayout(true); panel2->Layout(); - bookGroupManager->AddPage(panel2 , _T("Collection") ); + bookGroupManager->AddPage(panel2 , _T("Groupts") ); } // if mtype 4 if ( (mtype==0) || (mtype==3) || (mtype==4) ) @@ -107,18 +124,28 @@ wxButton *btnDeleteAllPoints = new wxButton( panel, -1, _T("Delete all points")); wxButton *btnSavePoints = NULL; wxButton *btnLoadPoints = NULL; - if ( (mtype==0) || (mtype==4) ) + if ( mtype==0 ) { btnSavePoints = new wxButton( panel, -1, _T("Save points")); btnLoadPoints = new wxButton( panel, -1, _T("Load points")); + Connect(btnSavePoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints); + Connect(btnLoadPoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints); } // if mtype txtNrPoints = new wxStaticText(panel,-1, _T(" ")); - //NTU: Sliders for opacity and radio change - wxStaticText* txOpacity = new wxStaticText(panel, -1, wxString(_T(" Points Opacity "))); - sdrOpacity = new wxSlider(panel, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS); - wxStaticText* txRadio = new wxStaticText(panel, -1, wxString(_T(" Points Radius "))); - sdrRadio = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS); + wxStaticText* txOpacity; + wxStaticText* txRadio; + if ( (mtype==0) || (mtype==3) ) + { + //NTU: Sliders for opacity and radio change + txOpacity = new wxStaticText(panel, -1, wxString(_T(" Points Opacity "))); + sdrOpacity = new wxSlider(panel, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS); + txRadio = new wxStaticText(panel, -1, wxString(_T(" Points Radius "))); + sdrRadio = new wxSlider(panel, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS); + //NTU: Slider events + Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints); + Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints); + } // if mtype 0 3 Connect(btnAddPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnAddPoint); Connect(btnInsertPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnInsertPoint);//CFT @@ -127,14 +154,7 @@ Connect(btnEraseLastPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnEraseLastPoint); Connect(btnErasePoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnErasePoint); Connect(btnDeleteAllPoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnDeleteAllPoints); - if ((mtype==0) || (mtype==4) ) - { - Connect(btnSavePoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints); - Connect(btnLoadPoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints); - } - //NTU: Slider events - Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints); - Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints); + wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1); sizer1->Add(askPointLabel); // JPR @@ -147,15 +167,19 @@ sizer1->Add(btnEraseLastPoint); sizer1->Add(btnDeleteAllPoints); sizer1->Add(txtNrPoints); - sizer1->Add(txOpacity); - sizer1->Add(sdrOpacity,1,wxGROW ); - sizer1->Add(txRadio); - sizer1->Add(sdrRadio,1,wxGROW ); - if ((mtype==0) || (mtype==4) ) + + if ( (mtype==0) || (mtype==3) ) + { + sizer1->Add(txOpacity); + sizer1->Add(sdrOpacity,1,wxGROW ); + sizer1->Add(txRadio); + sizer1->Add(sdrRadio,1,wxGROW ); + } // if mtype 0 3 + if ( mtype==0 ) { sizer1->Add(btnSavePoints); sizer1->Add(btnLoadPoints); - } + } // if mtype 0 sizer = sizer1; } @@ -209,7 +233,7 @@ panel->SetSizer(sizer); panel->SetAutoLayout(true); panel->Layout(); - bookSetPoints->AddPage(panel , _T("Set Points") ); + bookSetPoints->AddPage(panel , _T("Points") ); if ((mtype >= 0) && (mtype <= 3) ) { @@ -695,7 +719,8 @@ void WidgetShowNPoints::UpdatePoints(wxCommandEvent &event) lstViewShowNPoints[i]->mopacity = opacity; lstModelShowNPoints[i]->SetRadio( radio ) ; } // for i - GetViewShowNPoints()->RefreshPoints(); +// GetViewShowNPoints()->RefreshPoints(); + RefreshColourCollection(); } //------------------------------------------------------------------------ @@ -781,6 +806,7 @@ void WidgetShowNPoints::InsertCollection() void WidgetShowNPoints::OnInsertCollectionBefore(wxCommandEvent &event) { InsertCollection(); + RefreshColourCollection(); } //------------------------------------------------------------------------ @@ -788,6 +814,7 @@ void WidgetShowNPoints::OnInsertCollectionAfter(wxCommandEvent &event) { mActualCollection++; InsertCollection(); + RefreshColourCollection(); } //------------------------------------------------------------------------ @@ -802,8 +829,12 @@ void WidgetShowNPoints::OnDeleteCollection(wxCommandEvent &event) { mActualCollection--; } // if - } + } else { + DeleteAllPoints(); // Actual Collection + } // if + RefreshCollectionText(); + RefreshColourCollection(); } //------------------------------------------------------------------------ @@ -815,6 +846,7 @@ void WidgetShowNPoints::OnBackCollection(wxCommandEvent &event) mActualCollection=0; } //if <=0 RefreshCollectionText(); + RefreshColourCollection(); } //------------------------------------------------------------------------ @@ -826,6 +858,31 @@ void WidgetShowNPoints::OnNextCollection(wxCommandEvent &event) mActualCollection = lstModelShowNPoints.size()-1; } //if <=0 RefreshCollectionText(); + RefreshColourCollection(); +} + +//------------------------------------------------------------------------ +void WidgetShowNPoints::RefreshColourCollection() +{ + std::vector colourAll; + colourAll.push_back(1); + colourAll.push_back(0); + colourAll.push_back(0); + std::vector colourActual; + colourActual.push_back(1); + colourActual.push_back(1); + colourActual.push_back(0); + SetColour( colourAll ); // For all collections + + int i,size=lstViewShowNPoints.size(); + for (i=0;i mcolour = colourAll; // All collection + lstViewShowNPoints[i]->RefreshEachPoint(); + } // for i + lstViewShowNPoints[mActualCollection] -> mcolour = colourActual; // Actual collection + lstViewShowNPoints[mActualCollection] -> RefreshEachPoint(); + lstViewShowNPoints[mActualCollection] -> renderer->GetRenderWindow()->Render(); } //------------------------------------------------------------------------ @@ -836,3 +893,118 @@ void WidgetShowNPoints::RefreshCollectionText() txtNrCollections->SetLabel( strTmp ); SetOutputBox(); } + +//------------------------------------------------------------------------ +void WidgetShowNPoints::OnSaveCollections(wxCommandEvent &event) +{ + //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 + #if wxMAJOR_VERSION <= 2 + wxFileDialog* FD = new wxFileDialog( 0, + _T("Save groups of points .."), + _T(""), + _T(""), + _T("(*.xls)|*.xls"), + wxSAVE | wxOVERWRITE_PROMPT, + wxDefaultPosition); + #else + wxFileDialog* FD = new wxFileDialog( 0, + _T("Save groups of points .."), + _T(""), + _T(""), + _T("(*.xls)|*.xls"), + wxFD_SAVE | wxFD_OVERWRITE_PROMPT, + wxDefaultPosition); + #endif + + int result_FD = FD->ShowModal(); + // This line is need it by windows //EED + FD->SetReturnCode( result_FD ); + if (FD->GetReturnCode()==wxID_OK) + { + std::string filename= (const char*) ( FD->GetPath().mb_str() ); + + FILE *ff; + ff = fopen( filename.c_str() , "w+" ); + if (ff!=NULL) + { + int i,size=lstModelShowNPoints.size(); + fprintf(ff,"NumberOfGroups %d \n",size); + + for (i=0;iSavePoints_(ff); + } // for i + + fclose(ff); + } else { // else ff + printf("WidgetShowNPoints::Save Groups Points ...Error... creating file \n"); + } //ff + + + } // dialog box + +} + +//------------------------------------------------------------------------ +void WidgetShowNPoints::OnLoadCollections(wxCommandEvent &event) +{ + //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 + #if wxMAJOR_VERSION <= 2 + wxFileDialog* FD = new wxFileDialog( 0, + _T("Load groups of points .."), + _T(""), + _T(""), + _T("(*.xls)|*.xls"), + wxOPEN | wxFILE_MUST_EXIST, + wxDefaultPosition); + #else + wxFileDialog* FD = new wxFileDialog( 0, + _T("Load groups of points .."), + _T(""), + _T(""), + _T("(*.xls)|*.xls"), + wxFD_OPEN | wxFD_FILE_MUST_EXIST, + wxDefaultPosition); + #endif + int i; + //EED + int result_FD = FD->ShowModal(); + // This line is need it by windows //EED + FD->SetReturnCode( result_FD ); + if (FD->GetReturnCode()==wxID_OK) + { + + FILE *ff = fopen( filename.c_str() , "r+" ); + if (ff!=NULL) + { + int iGroup,sizeGroups; + int iPoint,numberPointsRead + char chartmp[256]; + fscanf(ff," %s %d",chartmp,&sizeGroups); + + /// InsertCollection(); + + for (iGroup=0;iReadPoints_(ff); + for (i=0;iAddVtkPoint(); + }// for + } // for i + + fclose(ff); + } else { // else ff + printf("WidgetShowNPoints::Load Group of Points ...Error... reading file"); + } //ff + + RefreshCollectionText(); + RefreshColourCollection(); + + } // dialog box + +/// + +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h index a0b664a..b701fac 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h @@ -16,7 +16,7 @@ class WidgetShowNPoints : public wxPanel WidgetShowNPoints( wxWindow *parent , int type ); ~WidgetShowNPoints(); void OnAddPoint(wxCommandEvent &event); - void OnInsertPoint (wxCommandEvent& event);//CFT + void OnInsertPoint(wxCommandEvent& event);//CFT void OnSetPoint(wxCommandEvent& event); void OnRenamePoint(wxCommandEvent& event); void OnErasePoint(wxCommandEvent& event); @@ -33,11 +33,14 @@ class WidgetShowNPoints : public wxPanel void OnDeleteCollection(wxCommandEvent &event); void OnBackCollection(wxCommandEvent &event); void OnNextCollection(wxCommandEvent &event); + void OnSaveCollections(wxCommandEvent &event); + void OnLoadCollections(wxCommandEvent &event); void RefreshCollectionText(); + void RefreshColourCollection(); - // EED 2022-05-19 + // EED 2022-05-19 //void RefreshPoint(int id); //void RefreshPoints(); //void AddVtkPoint(); -- 2.47.1