X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk%2Fsrc%2FbbmaracasvisuShowNPoints.cxx;h=25debba998835ec2288161ba90eb76b10d9a49d3;hb=c68f4e0d9298fe538f87a974947cce470148c60b;hp=fd778dca7de22406fda0fdc829ff5681e93ea336;hpb=9d859a4bbe2433d2489e7c91f64ef32bef816462;p=creaMaracasVisu.git diff --git a/bbtk/src/bbmaracasvisuShowNPoints.cxx b/bbtk/src/bbmaracasvisuShowNPoints.cxx index fd778dc..25debba 100644 --- a/bbtk/src/bbmaracasvisuShowNPoints.cxx +++ b/bbtk/src/bbmaracasvisuShowNPoints.cxx @@ -6,6 +6,7 @@ #include "vtkPolyDataMapper.h" #include "vtkRenderWindow.h" #include "vtkTextActor3D.h" +#include namespace bbcreaMaracasVisu { @@ -79,7 +80,7 @@ namespace bbcreaMaracasVisu // Widget interface wxButton *btnSetPositionPoint = new wxButton( panel, -1, _T("Set nearest point")); txtNrPoints = new wxStaticText(panel,-1, _T(" ")); - + //NTU: Sliders for opacity and radio change wxStaticText* txOpacity = new wxStaticText(this, -1, wxString(_T(" Points Opacity "))); sdrOpacity = new wxSlider(this, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS); @@ -89,7 +90,7 @@ namespace bbcreaMaracasVisu Connect(btnSetPositionPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint); Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints); Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints); - + sizer1->Add(btnSetPositionPoint); sizer1->Add(txtNrPoints); sizer1->Add(txOpacity); @@ -98,7 +99,33 @@ namespace bbcreaMaracasVisu sizer1->Add(sdrRadio,1,wxGROW ); sizer = sizer1; } - + + if (mbbShowNPoints->bbGetInputType() == 2) { + askPointLabel = new wxStaticText(panel, -1, _T("\nPOINT CONTROLS:")); // JPR + + wxButton *btnAddPoint = new wxButton(panel, -1, _T(" Add Point ")); + wxButton *btnDeleteAllPoints = new wxButton(panel, -1, _T(" Delete All ")); + wxStaticText* spacer = new wxStaticText(panel, -1, _T("\n")); // JPR + textCtrl = new wxTextCtrl(panel, -1); + + wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1); + + Connect(btnAddPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnAddPoint); + Connect(btnDeleteAllPoints->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteAllPoints); + + sizer1->Add(askPointLabel); + sizer1->Add(btnAddPoint); + sizer1->Add(btnDeleteAllPoints); + sizer1->Add(spacer); + sizer1->Add(textCtrl); + + sdrOpacity = new wxSlider(); + sdrRadio = new wxSlider(); + + txtNrPoints = new wxStaticText(panel, -1, _T("\n\n\n")); + + sizer = sizer1; + } if (sizer!=NULL) { panel->SetSizer(sizer); @@ -233,8 +260,7 @@ void WidgetShowNPoints::AddPoint(int x, int y, int z, std::string label) vtkActor *sphereActor = vtkActor::New(); sphereActor->SetMapper(sphereMapper); sphereActor->SetOrigin(0, 0, 0); - - + /*EED Borrame double spc[3]; if(mimage==NULL){ @@ -247,7 +273,7 @@ void WidgetShowNPoints::AddPoint(int x, int y, int z, std::string label) sphereActor->GetProperty()->SetColor( mcolour[0] , mcolour[1] , mcolour[2] ); sphereActor->GetProperty()->SetOpacity( mopacity ); */ - + lstActorsSphere.push_back(sphereActor); if(renderer==NULL){ wxMessageDialog dialog(this, _T("Renderer Not Set"),_T("Renderer Not Set"),wxICON_ERROR); @@ -319,7 +345,8 @@ void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event) //EED int result_FD = FD->ShowModal(); - + std::string tmpLabel; + // This line is need it by windows //EED FD->SetReturnCode( result_FD ); @@ -341,7 +368,13 @@ void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event) y=lstPointsY[i]; z=lstPointsZ[i]; value= mimage->GetScalarComponentAsDouble(x,y,z,0); - fprintf(ff,"%d\t%d\t%d\t%f\t%s\n", x , y , z , value , lstLabels[i].c_str()); + 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 fclose(ff); } else { // else ff @@ -384,6 +417,7 @@ void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event) for (i=0; i")==0) { strcpy(chartmp,""); } AddPoint(x,y,z, chartmp ); } fclose(ff); @@ -485,7 +519,6 @@ void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event) } } - //------------------------------------------------------------------------ void WidgetShowNPoints::OnRenamePoint(wxCommandEvent& event) { @@ -567,6 +600,7 @@ void WidgetShowNPoints::UpdatePoints(wxCommandEvent &event) { this->lstSourceSphere[i]->SetRadius(mradio); this->lstActorsSphere[i]->GetProperty()->SetOpacity(mopacity); + this->lstActorsText[i]->GetTextProperty()->SetOpacity(mopacity); this->lstActorsText[i]->SetPosition(this->lstActorsText[i]->GetPosition()[0]+difradio,this->lstActorsText[i]->GetPosition()[1], this->lstActorsText[i]->GetPosition()[2]); } @@ -598,12 +632,12 @@ void ShowNPoints::Process() void ShowNPoints::CreateWidget(wxWindow* parent) { mwxwidget = new WidgetShowNPoints( parent, this); - bbSetOutputWidget( mwxwidget ); + bbSetOutputWidget( mwxwidget ); } void ShowNPoints::bbUserSetDefaultValues() { - mwxwidget = NULL; + mwxwidget = NULL; bbSetInputRadio(1); bbSetInputOpacity(1);