From: Eduardo DAVILA Date: Thu, 19 May 2022 12:57:59 +0000 (+0200) Subject: #3485 ShowNPionts for Multiple Groups X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=bc8269a3beb87bd4c12f50ec644092e5537cb74c;p=creaMaracasVisu.git #3485 ShowNPionts for Multiple Groups --- diff --git a/bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx b/bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx index bae9e27..02d0f4a 100644 --- a/bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx +++ b/bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx @@ -73,14 +73,14 @@ void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis) int lstpointsXsize =bbGetInputlstPointX().size(); if( lstpointsXsize>0 ) { - vtkPoints *allPoints = vtkPoints::New( ); - vtkPolyLine *polyline = vtkPolyLine::New(); - vtkCellArray* allTopology = vtkCellArray::New( ); + vtkPoints *allPoints = vtkPoints::New( ); + vtkPolyLine *polyline = vtkPolyLine::New(); + vtkCellArray *allTopology = vtkCellArray::New( ); // allTopology->InsertNextCell( numPoints ); size=iGeneral+numPoints; - std::vector lstX =bbGetInputlstPointX(); - std::vector lstY =bbGetInputlstPointY(); - std::vector lstZ =bbGetInputlstPointZ(); + std::vector lstX = bbGetInputlstPointX(); + std::vector lstY = bbGetInputlstPointY(); + std::vector lstZ = bbGetInputlstPointZ(); for (i=iGeneral;iSetColour( bbGetInputColour() ); mwxwidget->SetOpacity( bbGetInputOpacity() ); mwxwidget->SetRadio( bbGetInputRadio() ); - if ( mwxwidget->GetModelShowNPoints()->GetFirstTime()==true ) { mwxwidget->GetModelShowNPoints()->SetFirstTime(false); mwxwidget->SetInitLstPoints( bbGetInputInitLstPointsX() , bbGetInputInitLstPointsY() , bbGetInputInitLstPointsZ() , bbGetInputInitLstLabels() ); } - bbSetOutputlstPointsX( mwxwidget->GetModelShowNPoints()->GetLstPointsX() ); bbSetOutputlstPointsY( mwxwidget->GetModelShowNPoints()->GetLstPointsY() ); bbSetOutputlstPointsZ( mwxwidget->GetModelShowNPoints()->GetLstPointsZ() ); diff --git a/bbtk/src/bbmaracasvisuViewerNV.cxx b/bbtk/src/bbmaracasvisuViewerNV.cxx index e467635..2dcd989 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.cxx +++ b/bbtk/src/bbmaracasvisuViewerNV.cxx @@ -76,11 +76,8 @@ void bbwxMaracas_N_ViewersWidget::OnRefreshView(wxCommandEvent & event) //------------------------------------------------------------- void bbwxMaracas_N_ViewersWidget::OnDClickLeft(wxCommandEvent & event) { - printf("EED bbwxMaracas_N_ViewersWidget::OnDClickLeft 1\n"); wxMaracas_N_ViewersWidget::OnDClickLeft(event); - printf("EED bbwxMaracas_N_ViewersWidget::OnDClickLeft 2\n"); mbbViewerNV->bbSignalOutputModification(std::string("Point")); - printf("EED bbwxMaracas_N_ViewersWidget::OnDClickLeft 3\n"); } //------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx new file mode 100644 index 0000000..ac81dd7 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.cxx @@ -0,0 +1,138 @@ + + +#include "ViewShowNPoints.h" + + +//---------------------------------------------------------------------- +ViewShowNPoints::ViewShowNPoints(ModelShowNPoints* modelShowNPoints) +{ + renderer = NULL; + mmodelShowNPoints=modelShowNPoints; +} +//---------------------------------------------------------------------- + +ViewShowNPoints::~ViewShowNPoints() +{ +} + + +//------------------------------------------------------------------------ + +void ViewShowNPoints::RefreshPoint(int id) +{ + double spc[3]; + int x,y,z; + GetModelShowNPoints()->GetIdPoint(id,&x,&y,&z); + GetModelShowNPoints()->GetImage()->GetSpacing(spc); + std::string label = GetModelShowNPoints()->GetIdLabel(id); + double radio = GetModelShowNPoints()->GetRadio(); + lstActorsSphere[id]->SetPosition( spc[0]*x , spc[1]*y , spc[2]*z ); + lstActorsSphere[id]->GetProperty()->SetColor( mcolour[0] , mcolour[1] , mcolour[2] ); + lstActorsSphere[id]->GetProperty()->SetOpacity( mopacity ); + lstSourceSphere[id]->SetRadius( radio ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + // .. +#else + lstSourceSphere[id]->Update(); +#endif + lstActorsText[id]->SetInput( label.c_str() ); + lstActorsText[id]->SetPosition( radio+spc[0]*x , spc[1]*y , spc[2]*z ); +} + +//------------------------------------------------------------------------ +void ViewShowNPoints::RefreshPoints() +{ + int id,size=lstActorsSphere.size(); + for (id=0;idGetRenderWindow()->Render(); +} + +//------------------------------------------------------------------------ +void ViewShowNPoints::AddVtkPoint() +{ + // Sphere + vtkSphereSource *vtksphere = vtkSphereSource::New(); + vtksphere->SetThetaResolution (20); + vtksphere->SetPhiResolution (20); + vtksphere->SetRadius( 1 ); + //NTU: For updating points + lstSourceSphere.push_back(vtksphere); + vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + sphereMapper->SetInput( vtksphere->GetOutput() ); +#else + vtksphere->Update(); + sphereMapper->SetInputData( vtksphere->GetOutput() ); +#endif + + vtkActor *sphereActor = vtkActor::New(); + sphereActor->SetMapper(sphereMapper); + sphereActor->SetOrigin(0, 0, 0); + + lstActorsSphere.push_back(sphereActor); + + if(renderer==NULL){ + // EED 2022-05-19 + // wxMessageDialog dialog(this, _T("Renderer Not Set"),_T("Renderer Not Set"),wxICON_ERROR); + // dialog.ShowModal(); + printf("EED ShowNPoints Warning: Renderer Not Set\n"); + return; + } + + renderer->AddActor( sphereActor ); + // Actor + vtkTextActor3D *textActor = vtkTextActor3D::New(); +// textActor->SetInput( strLabel.c_str() ); + renderer->AddActor( textActor ); + lstActorsText.push_back(textActor); +} + +//------------------------------------------------------------------------ +void ViewShowNPoints::AddPoint() +{ + AddVtkPoint(); + RefreshPoint(lstActorsSphere.size()-1); +} + +//------------------------------------------------------------------------ +void ViewShowNPoints::Render() +{ + renderer->GetRenderWindow()->Render(); +} + +//------------------------------------------------------------------------ +void ViewShowNPoints::ErasePoint(int id) +{ + if (this->renderer!=NULL) + { + if (id>=0) + { + renderer->RemoveActor( lstActorsSphere[id] ); + renderer->RemoveActor( lstActorsText[id] ); + lstActorsSphere[id]->Delete(); + lstActorsText[id]->Delete(); + lstSourceSphere[id]->Delete(); + lstActorsSphere.erase( lstActorsSphere.begin()+id ); + lstActorsText.erase( lstActorsText.begin()+id ); + lstSourceSphere.erase( lstSourceSphere.begin()+id ); + } // if id + } // if renderer +} + +//------------------------------------------------------------------------ +ModelShowNPoints* ViewShowNPoints::GetModelShowNPoints() +{ + return mmodelShowNPoints; +} + +//------------------------------------------------------------------------ +void ViewShowNPoints::SetModelShowNPoints( ModelShowNPoints* modelShowNPoints) +{ + mmodelShowNPoints=modelShowNPoints; +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.h new file mode 100644 index 0000000..168d86a --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ViewShowNPoints.h @@ -0,0 +1,43 @@ + +#ifndef __ViewShowNPoints_h_INCLUDED__ +#define __ViewShowNPoints_h_INCLUDED__ + + +#include "vtkActor.h" +#include +#include +#include +#include "vtkProperty.h" +#include "vtkPolyDataMapper.h" +#include "vtkRenderWindow.h" +#include + +#include "ModelShowNPoints.h" + +class ViewShowNPoints + { + public: + ViewShowNPoints(ModelShowNPoints* modelShowNPoints); + ~ViewShowNPoints(); + ModelShowNPoints* GetModelShowNPoints(); + void SetModelShowNPoints(ModelShowNPoints* modelShowNPoints); + void RefreshPoint(int id); + void RefreshPoints(); + void AddVtkPoint(); + void AddPoint(); + void Render(); + void ErasePoint(int id); + + std::vector lstActorsSphere;//NTU changed from prop3D to Actor + std::vector lstActorsText; + std::vector lstSourceSphere; + std::vector mcolour; + double mopacity; + vtkRenderer* renderer; + private: + ModelShowNPoints* mmodelShowNPoints; + }; + +#endif // __ViewShowNPoints_h_INCLUDED__ + + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx index 1a5a8dc..f7fa68f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.cxx @@ -1,15 +1,10 @@ -#include "vtkActor.h" #include "vtkSphereSource.h" #include "vtkRenderer.h" #include "vtkTextActor3D.h" -#include "vtkProperty.h" -#include "vtkPolyDataMapper.h" -#include "vtkRenderWindow.h" -#include #include #include @@ -27,10 +22,16 @@ WidgetShowNPoints::WidgetShowNPoints(wxWindow *parent, int type) : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL) { - mmodelShowNPoints = new ModelShowNPoints(); + // EED 2022-05-19 + // mmodelShowNPoints = new ModelShowNPoints(); + mActualLstPoints=0; + ModelShowNPoints* modelShowNPoints = new ModelShowNPoints(); + lstModelShowNPoints.push_back( modelShowNPoints ); + lstViewShowNPoints.push_back( new ViewShowNPoints( modelShowNPoints ) ); + + mtype = type; SetType(mtype); - this->renderer = NULL; wxPanel *panel = this; wxSizer *sizer = NULL; @@ -142,8 +143,8 @@ sizer1->Add(btnDeleteAllPoints); sizer1->Add(spacer); sizer1->Add(textCtrl); - sdrOpacity = new wxSlider(); - sdrRadio = new wxSlider(); + sdrOpacity = new wxSlider(); + sdrRadio = new wxSlider(); txtNrPoints = new wxStaticText(panel, -1, _T("\n\n\n")); sizer = sizer1; } // bbGetInputType 2 @@ -164,14 +165,29 @@ WidgetShowNPoints::~WidgetShowNPoints() //------------------------------------------------------------------------ ModelShowNPoints* WidgetShowNPoints::GetModelShowNPoints() { - return mmodelShowNPoints; + // EED 2022-05-19 + // return mmodelShowNPoints; + return lstModelShowNPoints[ mActualLstPoints ]; +} + +// EED 2022-05-19 +//------------------------------------------------------------------------ +ViewShowNPoints* WidgetShowNPoints::GetViewShowNPoints() +{ + return lstViewShowNPoints[ mActualLstPoints ]; } //------------------------------------------------------------------------ void WidgetShowNPoints::SetRadio(double radio) { - GetModelShowNPoints()->SetRadio(radio); + // EED 2022-05-19 + // GetModelShowNPoints()->SetRadio(radio); + int i,size = lstModelShowNPoints.size(); + for (i=0;iSetRadio( radio ); + } // for i //NTU: For Slider sdrRadio->SetValue(radio); } @@ -179,61 +195,77 @@ void WidgetShowNPoints::SetRadio(double radio) //------------------------------------------------------------------------ void WidgetShowNPoints::SetColour(std::vector colour) { - this->mcolour = colour; + // EED 2022-05-19 + //this->mcolour = colour; + int i,size = lstViewShowNPoints.size(); + for (i=0 ; imcolour = colour; + } // for i } //------------------------------------------------------------------------ void WidgetShowNPoints::SetImage(vtkImageData* image) { - GetModelShowNPoints()->SetImage(image); + // EED 2022-05-19 + //GetModelShowNPoints()->SetImage(image); + int i,size = lstModelShowNPoints.size(); + for (i=0 ; iSetImage(image); + } // for i } //------------------------------------------------------------------------ void WidgetShowNPoints::SetOpacity(double opacity) { - this->mopacity=opacity; + // EED 2022-05-19 + //this->mopacity=opacity; + int i,size = lstViewShowNPoints.size(); + for (i=0 ; imopacity = opacity; + } // for i //NTU: For Slider - sdrOpacity->SetValue(this->mopacity*100.0); + sdrOpacity->SetValue( opacity*100.0 ); } //------------------------------------------------------------------------ void WidgetShowNPoints::SetRenderer(vtkRenderer *renderer) { - this->renderer = renderer; + // EED 2022-05-19 + //this->renderer = renderer; + int i,size = lstViewShowNPoints.size(); + for (i=0 ; irenderer = renderer; + } // for i } - + +/* EED 2022-05-19 //------------------------------------------------------------------------ void WidgetShowNPoints::RefreshPoint(int id) { double spc[3]; - -//EED 2016/06/17 -// mimage->GetSpacing(spc); -// int x = lstPointsX[id]; -// int y = lstPointsY[id]; -// int z = lstPointsZ[id]; int x,y,z; GetModelShowNPoints()->GetIdPoint(id,&x,&y,&z); GetModelShowNPoints()->GetImage()->GetSpacing(spc); std::string label = GetModelShowNPoints()->GetIdLabel(id); double radio = GetModelShowNPoints()->GetRadio(); - - lstActorsSphere[id]->SetPosition( spc[0]*x , spc[1]*y , spc[2]*z ); - lstActorsSphere[id]->GetProperty()->SetColor( mcolour[0] , mcolour[1] , mcolour[2] ); - lstActorsSphere[id]->GetProperty()->SetOpacity( mopacity ); - lstSourceSphere[id]->SetRadius( radio ); - + lstActorsSphere[id]->SetPosition( spc[0]*x , spc[1]*y , spc[2]*z ); + lstActorsSphere[id]->GetProperty()->SetColor( mcolour[0] , mcolour[1] , mcolour[2] ); + lstActorsSphere[id]->GetProperty()->SetOpacity( mopacity ); + lstSourceSphere[id]->SetRadius( radio ); //EED 2017-01-01 Migration VTK7 #if VTK_MAJOR_VERSION <= 5 // .. #else - lstSourceSphere[id]->Update(); + lstSourceSphere[id]->Update(); #endif - - lstActorsText[id]->SetInput( label.c_str() ); - lstActorsText[id]->SetPosition( radio+spc[0]*x , spc[1]*y , spc[2]*z ); + lstActorsText[id]->SetInput( label.c_str() ); + lstActorsText[id]->SetPosition( radio+spc[0]*x , spc[1]*y , spc[2]*z ); } //------------------------------------------------------------------------ @@ -284,39 +316,47 @@ void WidgetShowNPoints::AddVtkPoint() renderer->AddActor( textActor ); lstActorsText.push_back(textActor); } + */ //------------------------------------------------------------------------ void WidgetShowNPoints::AddPoint(int x, int y, int z, std::string label) { GetModelShowNPoints()->AddPoint(x,y,z, label ); - AddVtkPoint(); - RefreshPoint(lstActorsSphere.size()-1); + // EED 2022-05-19 + //AddVtkPoint(); + //RefreshPoint(lstActorsSphere.size()-1); + GetViewShowNPoints()->AddPoint(); } - - //------------------------------------------------------------------------ void WidgetShowNPoints::InsertPoint(int x, int y, int z, std::string label)//CFT { + // EED 2022-05-19 + //if ( GetModelShowNPoints()->InsertPoint(x,y,z,label) != -1 ) + //{ + // AddVtkPoint(); + //} else { + // AddPoint(x,y,z,label); + //} + //RefreshPoints(); + if ( GetModelShowNPoints()->InsertPoint(x,y,z,label) != -1 ) + { + GetViewShowNPoints()->AddVtkPoint(); + } else { + AddPoint(x,y,z,label); + } + GetViewShowNPoints()->RefreshPoints(); -//-- - if ( GetModelShowNPoints()->InsertPoint(x,y,z,label) != -1 ) - { - AddVtkPoint(); - } else { - AddPoint(x,y,z,label); - } - RefreshPoints(); - //end if } - //------------------------------------------------------------------------ void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event) { - if (this->renderer==NULL) - { + // EED 2022-05-19 + //if (this->renderer==NULL) + if (GetViewShowNPoints()->renderer==NULL) + { return; } @@ -325,7 +365,9 @@ void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event) { AddPoint(point[0],point[1],point[2], (const char*) ( textCtrl->GetValue().mb_str() ) ); SetOutputBox(); - renderer->GetRenderWindow()->Render(); + // EED 2022-05-19 + //renderer->GetRenderWindow()->Render(); + GetViewShowNPoints()->Render(); } else {//mpoint.size printf("creaMaracasVisu::ShowNPoints (not match point) \n"); } @@ -334,8 +376,10 @@ void WidgetShowNPoints::OnAddPoint (wxCommandEvent& event) //------------------------------------------------------------------------ void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT { - if (this->renderer==NULL) - { + // EED 2022-05-19 + //if (this->renderer==NULL) + if (GetViewShowNPoints()->renderer==NULL) + { return; } @@ -356,7 +400,7 @@ void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT //EED renderer->GetRenderWindow()->Render(); wxString strTmp; strTmp.Printf(_T("Nbr of points: %d"), GetModelShowNPoints()->GetLstPointsSize() ); - txtNrPoints->SetLabel( strTmp ); + txtNrPoints->SetLabel( strTmp ); //--BBTK //EED 2017-06-03 @@ -391,13 +435,9 @@ void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT 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() ); @@ -440,12 +480,15 @@ void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT int numberPointsRead = GetModelShowNPoints()->ReadPoints( filename ); for (i=0;iAddVtkPoint(); }// for SetOutputBox(); - RefreshPoints(); + // EED 2022-05-19 + //RefreshPoints(); + GetViewShowNPoints()->RefreshPoints(); } // dialog box - } //------------------------------------------------------------------------ @@ -462,8 +505,11 @@ void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT if (id>=0) { GetModelShowNPoints()->SetPointId_mReferencePoint(id); - RefreshPoint(id); - renderer->GetRenderWindow()->Render(); + // EED 2022-05-19 + //RefreshPoint(id); + //renderer->GetRenderWindow()->Render(); + GetViewShowNPoints()->RefreshPoint(id); + GetViewShowNPoints()->Render(); } // if id SetOutputBox(); } @@ -474,27 +520,34 @@ void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT int id = GetModelShowNPoints()->RenamePoint( (const char*) ( textCtrl->GetValue().mb_str() ) ); if (id>=0) { - lstActorsText[id]->SetInput( (const char*) ( textCtrl->GetValue().mb_str() ) ); - SetOutputBox(); - renderer->GetRenderWindow()->Render(); + // EED 2022-05-19 + //lstActorsText[id]->SetInput( (const char*) ( textCtrl->GetValue().mb_str() ) ); + //renderer->GetRenderWindow()->Render(); + GetViewShowNPoints()->lstActorsText[id]->SetInput( (const char*) ( textCtrl->GetValue().mb_str() ) ); + GetViewShowNPoints()->Render(); + SetOutputBox(); } } //------------------------------------------------------------------------ void WidgetShowNPoints::ErasePoint(int id) { - if (this->renderer!=NULL) + // EED 2022-05-19 + //if (this->renderer!=NULL) + if (GetViewShowNPoints()->renderer!=NULL) { if (id>=0) { - renderer->RemoveActor( lstActorsSphere[id] ); - renderer->RemoveActor( lstActorsText[id] ); - lstActorsSphere[id]->Delete(); - lstActorsText[id]->Delete(); - lstSourceSphere[id]->Delete(); - lstActorsSphere.erase( lstActorsSphere.begin()+id ); - lstActorsText.erase( lstActorsText.begin()+id ); - lstSourceSphere.erase( lstSourceSphere.begin()+id ); + // EED 2022-05-19 + //renderer->RemoveActor( lstActorsSphere[id] ); + //renderer->RemoveActor( lstActorsText[id] ); + //lstActorsSphere[id]->Delete(); + //lstActorsText[id]->Delete(); + //lstSourceSphere[id]->Delete(); + //lstActorsSphere.erase( lstActorsSphere.begin()+id ); + //lstActorsText.erase( lstActorsText.begin()+id ); + //lstSourceSphere.erase( lstSourceSphere.begin()+id ); + GetViewShowNPoints()->ErasePoint(id); GetModelShowNPoints()->ErasePoint(id); } // if id } // if renderer @@ -505,27 +558,37 @@ void WidgetShowNPoints::OnInsertPoint (wxCommandEvent& event)//CFT { ErasePoint( GetModelShowNPoints()->IdInsidePoint() ); SetOutputBox(); - renderer->GetRenderWindow()->Render(); + // EED 2022-05-19 + //renderer->GetRenderWindow()->Render(); + GetViewShowNPoints()->Render(); } //------------------------------------------------------------------------ void WidgetShowNPoints::OnEraseLastPoint(wxCommandEvent& event) { - ErasePoint(lstActorsSphere.size()-1); - SetOutputBox(); - renderer->GetRenderWindow()->Render(); + // EED 2022-05-19 + //ErasePoint( lstActorsSphere.size()-1 ); + //renderer->GetRenderWindow()->Render(); + int id = GetViewShowNPoints()->lstActorsSphere.size()-1; + ErasePoint( id ); + GetViewShowNPoints()->Render(); + SetOutputBox(); } //------------------------------------------------------------------------ void WidgetShowNPoints::DeleteAllPoints() { - int id,size=lstActorsSphere.size(); + // EED 2022-05-19 + //int id,size=lstActorsSphere.size(); + int id,size=GetViewShowNPoints()->lstActorsSphere.size(); for (id=size-1;id>=0;id--) { ErasePoint(id); } SetOutputBox(); - renderer->GetRenderWindow()->Render(); + // EED 2022-05-19 + //renderer->GetRenderWindow()->Render(); + GetViewShowNPoints()->Render(); } //------------------------------------------------------------------------ @@ -539,18 +602,20 @@ void WidgetShowNPoints::OnDeleteAllPoints(wxCommandEvent& event) //------------------------------------------------------------------------ void WidgetShowNPoints::UpdatePoints(wxCommandEvent &event) { - //Difference in Radio for text placement -// double radio=GetModelShowNPoints()->GetRadio(); - this->mopacity = sdrOpacity->GetValue()/100.0; - GetModelShowNPoints()->SetRadio( sdrRadio->GetValue() ) ; -// radio = sdrRadio->GetValue(); - //NTU refresh the inputs - -//EED 2017-06-03 -// mbbShowNPoints->bbSetInputOpacity(this->mopacity); -// mbbShowNPoints->bbSetInputRadio( radio ); - // EED - RefreshPoints(); + // EED 2022-05-19 + //this->mopacity = sdrOpacity->GetValue()/100.0; + //GetModelShowNPoints()->SetRadio( sdrRadio->GetValue() ) ; + //RefreshPoints(); + + double opacity = sdrOpacity->GetValue()/100.0; + double radio = sdrRadio->GetValue(); + int i,size = lstViewShowNPoints.size(); + for (i=0 ; imopacity = opacity; + lstModelShowNPoints[i]->SetRadio( radio ) ; + } // for i + GetViewShowNPoints()->RefreshPoints(); } //------------------------------------------------------------------------ @@ -562,23 +627,21 @@ void WidgetShowNPoints::SetReferencePoint(std::vector point) //------------------------------------------------------------------------ void WidgetShowNPoints::SetInitLstPoints( std::vector initLstPointsX, std::vector initLstPointsY, std::vector initLstPointsZ, std::vector initLstLabels ) { - if (this->renderer==NULL) - { + // EED 2022-05-19 + //if (this->renderer==NULL) + if (GetViewShowNPoints()->renderer==NULL) + { return; } - int i,sizeX,sizeY,sizeZ,sizeLabels; sizeX=(int)initLstPointsX.size(); sizeY=(int)initLstPointsY.size(); sizeZ=(int)initLstPointsZ.size(); sizeLabels=(int)initLstLabels.size(); - int x,y,z; std::string label; - if ( (sizeX==sizeY) && (sizeX==sizeZ) ) { - for (i=0;i initLstPointsX, std } // for i // SetOutputBox(); // renderer->GetRenderWindow()->Render(); - } // if size } + //------------------------------------------------------------------------ void WidgetShowNPoints::SetType(int type) { @@ -615,11 +678,8 @@ double WidgetShowNPoints::GetRadio() { return sdrRadio->GetValue(); } - //------------------------------------------------------------------------ double WidgetShowNPoints::GetOpacity() { - return mopacity; + return sdrOpacity->GetValue()/100; } - - diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h index 05fa5f1..e1308c3 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/WidgetShowNPoints.h @@ -7,14 +7,12 @@ #include "ModelShowNPoints.h" +#include "ViewShowNPoints.h" #include #include #include #include -#include -#include -#include class WidgetShowNPoints : public wxPanel @@ -34,8 +32,11 @@ class WidgetShowNPoints : public wxPanel virtual void UpdatePoints(wxCommandEvent &event); - void RefreshPoint(int id); - + // EED 2022-05-19 + //void RefreshPoint(int id); + //void RefreshPoints(); + //void AddVtkPoint(); + void SetColour(std::vector colour); void SetOpacity(double opacity); void SetRadio(double radio); @@ -48,8 +49,7 @@ class WidgetShowNPoints : public wxPanel void DeleteAllPoints(); ModelShowNPoints* GetModelShowNPoints(); - void RefreshPoints(); - void AddVtkPoint(); + ViewShowNPoints* GetViewShowNPoints(); void SetInitLstPoints( std::vector initLstPointsX, std::vector initLstPointsY, std::vector initLstPointsZ, std::vector initLstLabels ); void SetType(int type); @@ -62,21 +62,29 @@ class WidgetShowNPoints : public wxPanel virtual void SetOutputBox(); private: - void ErasePoint(int id); - vtkRenderer *renderer; - std::vector lstActorsSphere;//NTU changed from prop3D to Actor - std::vector lstActorsText; + void ErasePoint(int id); + + // EED 2022-05-19 + //vtkRenderer *renderer; + //std::vector lstActorsSphere;//NTU changed from prop3D to Actor + //std::vector lstActorsText; + //std::vector lstSourceSphere; + //std::vector mcolour; + //ModelShowNPoints *mmodelShowNPoints; + //double mopacity; + std::vector lstViewShowNPoints; + //NTU: For updating points - std::vector lstSourceSphere; - std::vector mcolour; - wxStaticText *askPointLabel; - wxTextCtrl *textCtrl; - wxStaticText *txtNrPoints; - wxSlider *sdrOpacity; - wxSlider *sdrRadio; - ModelShowNPoints *mmodelShowNPoints; - int mtype; - double mopacity; + wxStaticText *askPointLabel; + wxTextCtrl *textCtrl; + wxStaticText *txtNrPoints; + wxSlider *sdrOpacity; + wxSlider *sdrRadio; + + std::vector lstModelShowNPoints; + int mActualLstPoints; + + int mtype; };