From 1981bd6d1d9fae20e24ba93da56bb25eaabed0de Mon Sep 17 00:00:00 2001 From: "eduardo.davila@creatis.insa-lyon.fr" Date: Mon, 13 Jan 2025 17:33:59 +0100 Subject: [PATCH] Clean code --- bbtk/src/bbmaracasvisuShowNPoints.cxx | 119 ++++++++++++++------------ bbtk/src/bbmaracasvisuShowNPoints.h | 3 + bbtk/src/bbmaracasvisuViewerNV.cxx | 5 ++ 3 files changed, 70 insertions(+), 57 deletions(-) diff --git a/bbtk/src/bbmaracasvisuShowNPoints.cxx b/bbtk/src/bbmaracasvisuShowNPoints.cxx index fb51a02..e569415 100644 --- a/bbtk/src/bbmaracasvisuShowNPoints.cxx +++ b/bbtk/src/bbmaracasvisuShowNPoints.cxx @@ -36,9 +36,9 @@ namespace bbcreaMaracasVisu //------------------------------------------------------------------------ //------------------------------------------------------------------------ WidgetShowNPointsBox::WidgetShowNPointsBox(wxWindow *parent, bbcreaMaracasVisu::ShowNPoints *box, int type) - : WidgetShowNPoints( parent, type) +: WidgetShowNPoints( parent, type) { - mbbShowNPoints=box; + mbbShowNPoints=box; } //------------------------------------------------------------------------ @@ -50,30 +50,30 @@ WidgetShowNPointsBox::~WidgetShowNPointsBox() //------------------------------------------------------------------------ void WidgetShowNPointsBox::UpdatePoints(wxCommandEvent &event) { - WidgetShowNPoints::UpdatePoints(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 - mbbShowNPoints->bbSetInputOpacity( GetOpacity() ); - mbbShowNPoints->bbSetInputRadio( GetRadio() ); - // EED -// RefreshPoints(); + WidgetShowNPoints::UpdatePoints(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 + mbbShowNPoints->bbSetInputOpacity( GetOpacity() ); + mbbShowNPoints->bbSetInputRadio( GetRadio() ); + // EED + // RefreshPoints(); } //------------------------------------------------------------------------ void WidgetShowNPointsBox::SetOutputBox() { - WidgetShowNPoints::SetOutputBox(); - -// wxString strTmp; -// strTmp.Printf(_T("Nbr of points: %d"), GetModelShowNPoints()->GetLstPointsSize() ); -// txtNrPoints->SetLabel( strTmp ); - - //--BBTK + WidgetShowNPoints::SetOutputBox(); + + // wxString strTmp; + // strTmp.Printf(_T("Nbr of points: %d"), GetModelShowNPoints()->GetLstPointsSize() ); + // txtNrPoints->SetLabel( strTmp ); + + //--BBTK mbbShowNPoints->bbSetOutputlstPointsX( GetLstPointsX() ); mbbShowNPoints->bbSetOutputlstPointsY( GetLstPointsY() ); mbbShowNPoints->bbSetOutputlstPointsZ( GetLstPointsZ() ); @@ -84,7 +84,7 @@ void WidgetShowNPointsBox::SetOutputBox() // mbbShowNPoints->bbSetOutputlstPointsY( GetModelShowNPoints()->GetLstPointsY() ); // mbbShowNPoints->bbSetOutputlstPointsZ( GetModelShowNPoints()->GetLstPointsZ() ); // mbbShowNPoints->bbSetOutputlstLabels( GetModelShowNPoints()->GetLstLabels() ); - mbbShowNPoints->bbSignalOutputModification(); + mbbShowNPoints->bbSignalOutputModification(); } @@ -100,32 +100,32 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ShowNPoints,bbtk::WxBlackBox); void ShowNPoints::Process() { printf("EED ShowNPoints::Process start \n"); - if (mwxwidget!=NULL) - { + if (mwxwidget!=NULL) + { mwxwidget->SetImage( bbGetInputImage() ); - mwxwidget->SetRenderer( bbGetInputRenderer() ); - mwxwidget->SetReferencePoint( bbGetInputIn() ); - mwxwidget->SetColour( bbGetInputColour() ); -// mwxwidget->SetOpacity( bbGetInputOpacity() ); - mwxwidget->SetRadio( bbGetInputRadio() ); + mwxwidget->SetRenderer( bbGetInputRenderer() ); + mwxwidget->SetReferencePoint( bbGetInputIn() ); + mwxwidget->SetColour( bbGetInputColour() ); + // mwxwidget->SetOpacity( bbGetInputOpacity() ); + mwxwidget->SetRadio( bbGetInputRadio() ); if ( backOpacity!=bbGetInputOpacity() ) { backOpacity = bbGetInputOpacity(); mwxwidget->SetOpacity( bbGetInputOpacity() ); } // if backOpacity -// if (firsttime==true) -// { -// firsttime=false; - if ( mwxwidget->GetModelShowNPoints()->GetFirstTime()==false ) - { - mwxwidget->DetectCollectionActive(); - } - if ( mwxwidget->GetModelShowNPoints()->GetFirstTime()==true ) - { - mwxwidget->GetModelShowNPoints()->SetFirstTime(false); - mwxwidget->SetInitLstPoints( bbGetInputInitLstPointsX() , bbGetInputInitLstPointsY() , bbGetInputInitLstPointsZ() , bbGetInputInitLstLabels() , bbGetInputInitLstIndexs() ); - } -// } // firsttime OJO machete Eduardo pour ANDREAS a verificar + // if (firsttime==true) + // { + // firsttime=false; + if ( mwxwidget->GetModelShowNPoints()->GetFirstTime()==false ) + { + mwxwidget->DetectCollectionActive(); + } + if ( mwxwidget->GetModelShowNPoints()->GetFirstTime()==true ) + { + mwxwidget->GetModelShowNPoints()->SetFirstTime(false); + mwxwidget->SetInitLstPoints( bbGetInputInitLstPointsX() , bbGetInputInitLstPointsY() , bbGetInputInitLstPointsZ() , bbGetInputInitLstLabels() , bbGetInputInitLstIndexs() ); + } + // } // firsttime OJO machete Eduardo pour ANDREAS a verificar mwxwidget->AutoAddPoints(); mwxwidget->TrackingPoint(); bbSetOutputlstPointsX( mwxwidget->GetLstPointsX() ); @@ -135,34 +135,41 @@ void ShowNPoints::Process() bbSetOutputlstIndexs( mwxwidget->GetLstIndexs() ); bbSetOutputlstSelectedIndexs( mwxwidget->GetLstSelectedIndexs() ); bbSetOutputWidgetShowNPoints( (WidgetShowNPoints*)mwxwidget ); - } // mwxwidget + } // mwxwidget printf("EED ShowNPoints::Process end \n"); } //----------------------------------------------------------------- void ShowNPoints::CreateWidget(wxWindow* parent) { - mwxwidget = new WidgetShowNPointsBox( parent, this, bbGetInputType() ); + printf("EED ShowNPoints::CreateWidget\n"); + mwxwidget = new WidgetShowNPointsBox( parent, this, bbGetInputType() ); bbSetOutputWidget( mwxwidget ); } +//----------------------------------------------------------------- +void ShowNPoints::OnShowWidget() +{ +// mwxwidget->SetRenderer( bbGetInputRenderer() ); +} + //----------------------------------------------------------------- void ShowNPoints::bbUserSetDefaultValues() { firsttime = true; backOpacity = -1; - mwxwidget = NULL; - bbSetInputRadio(10); - bbSetInputOpacity(1); - std::vector colour; - colour.push_back(1.0); - colour.push_back(1.0); - colour.push_back(0.0); - bbSetInputColour(colour); - bbSetInputImage(NULL); - bbSetInputType(0); - bbSetInputRenderer(NULL); - bbSetOutputWidgetShowNPoints(NULL); + mwxwidget = NULL; + bbSetInputRadio(10); + bbSetInputOpacity(1); + std::vector colour; + colour.push_back(1.0); + colour.push_back(1.0); + colour.push_back(0.0); + bbSetInputColour(colour); + bbSetInputImage(NULL); + bbSetInputType(0); + bbSetInputRenderer(NULL); + bbSetOutputWidgetShowNPoints(NULL); } //----------------------------------------------------------------- @@ -175,6 +182,4 @@ void ShowNPoints::bbUserFinalizeProcessing() { } -//----------------------------------------------------------------- - } // EO namespace bbcreaMaracasVisu diff --git a/bbtk/src/bbmaracasvisuShowNPoints.h b/bbtk/src/bbmaracasvisuShowNPoints.h index 69a424b..7c709a0 100644 --- a/bbtk/src/bbmaracasvisuShowNPoints.h +++ b/bbtk/src/bbmaracasvisuShowNPoints.h @@ -87,6 +87,9 @@ class /*BBTK_EXPORT*/ ShowNPoints void CreateWidget(wxWindow*); double backOpacity; + BBTK_ON_SHOW_WIDGET(OnShowWidget); + void OnShowWidget(); + private: bool firsttime; WidgetShowNPointsBox *mwxwidget; diff --git a/bbtk/src/bbmaracasvisuViewerNV.cxx b/bbtk/src/bbmaracasvisuViewerNV.cxx index b8f2c62..d106f42 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.cxx +++ b/bbtk/src/bbmaracasvisuViewerNV.cxx @@ -111,6 +111,7 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ViewerNV,bbtk::WxBlackBox); //------------------------------------------------------------- void ViewerNV::Process() { + printf("EED ViewerNV::Process\n"); vtkImageData* img = bbGetInputIn(); std::vector type = bbGetInputnTypeView(); if(img != NULL && _mwxwidget != NULL) @@ -182,6 +183,8 @@ void ViewerNV::Process() //------------------------------------------------------------- void ViewerNV::CreateWidget(wxWindow* parent) { + printf("EED ViewerNV::CreateWidget\n"); + bbtkDebugMessageInc("Core",9,"ViewerNV::CreateWidget()"<Layout(); -- 2.49.0