From 5b84c13156375cf1b850e1f107eb2f542b4dd4f0 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Fri, 2 Jun 2023 11:00:02 +0200 Subject: [PATCH] Clean Code --- .../bbcreaMaracasVisuColorLayerImageView.cxx | 81 ++++++++++--------- .../creaButtonContainer/view/comboBox.cxx | 41 +++------- 2 files changed, 53 insertions(+), 69 deletions(-) diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx index 3846297..edb3954 100644 --- a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx @@ -75,45 +75,48 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ColorLayerImageView,bbtk::WxBlackBox); //===== void ColorLayerImageView::Process() { - if ( !( (bbGetInputWxVtkBaseView()==NULL) && (bbGetInputWxVtkBaseView1()==NULL) && (bbGetInputWxVtkBaseView2()==NULL)) ) - { - ColorLayerImageViewPanel_widgetBox *clivp = (ColorLayerImageViewPanel_widgetBox*)bbGetOutputWidget(); - if (clivp!=NULL) { - - if (firsttime==true) - { - // firsttime=false; - clivp->SetActive( bbGetInputActive() ); - } - clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 0 , bbGetInputWxVtkBaseView() ); - clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 1 , bbGetInputWxVtkBaseView1() ); - clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 2 , bbGetInputWxVtkBaseView2() ); - std::vector range = bbGetInputlstRangeForColorBar(); - clivp->GetColorLayerImageViewManager()->SetRangeForColorBar( range ); - std::vector colorbarposition = bbGetInputColorBarPosition(); - clivp->GetColorLayerImageViewManager()->SetColorBarPosition( colorbarposition ); - std::vector base_color = bbGetInputlstBaseColor(); - clivp->GetColorLayerImageViewManager()->SetBaseColors( base_color ); - std::vector grey_level_boundaries = bbGetInputlstGreyLevelBoundaries(); - clivp->GetColorLayerImageViewManager()->SetGreyLevelBoundaries( grey_level_boundaries ); - std::vector transparence_level_boundaries = bbGetInputlstTransparenceBoundaries(); - clivp->GetColorLayerImageViewManager()->SetBaseTransparence( transparence_level_boundaries ); - clivp->GetColorLayerImageViewManager()->SetPlainOrGradientColor( bbGetInputPlainOrGradientColor() ); - clivp->SetFittingMode( bbGetInputFittingMode() ); - clivp->SetImage( bbGetInputIn() ); - bbSetOutputNewImage( clivp->GetColorLayerImageViewManager()->GetImageChangeInformation(0) ); - bbSetOutputLookupTable( clivp->GetColorLayerImageViewManager()->GetLookupTable(0) ); - bbSetOutputOutOpacity( clivp->GetOpacity() ); - if (firsttime==true) - { - firsttime=false; - clivp->ChangeOpacity(); - clivp->SetBox(this); - } - } // if clivp - } else { - printf("EED Error!!! ColorLayerImageView::Process (%s) Missing Inputs: WxVtkBaseView , WxVtkBaseView1 , WxVtkBaseView2 \n", bbGetFullName().c_str() ); - }// if xxVtkBaseView + if (bbGetInputIn()!=NULL) { + if ( !( (bbGetInputWxVtkBaseView()==NULL) && (bbGetInputWxVtkBaseView1()==NULL) && (bbGetInputWxVtkBaseView2()==NULL)) ) + { + ColorLayerImageViewPanel_widgetBox *clivp = (ColorLayerImageViewPanel_widgetBox*)bbGetOutputWidget(); + if (clivp!=NULL) { + + if (firsttime==true) + { + // firsttime=false; + clivp->SetActive( bbGetInputActive() ); + } + clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 0 , bbGetInputWxVtkBaseView() ); + clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 1 , bbGetInputWxVtkBaseView1() ); + clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 2 , bbGetInputWxVtkBaseView2() ); + std::vector range = bbGetInputlstRangeForColorBar(); + clivp->GetColorLayerImageViewManager()->SetRangeForColorBar( range ); + std::vector colorbarposition = bbGetInputColorBarPosition(); + clivp->GetColorLayerImageViewManager()->SetColorBarPosition( colorbarposition ); + std::vector base_color = bbGetInputlstBaseColor(); + clivp->GetColorLayerImageViewManager()->SetBaseColors( base_color ); + std::vector grey_level_boundaries = bbGetInputlstGreyLevelBoundaries(); + clivp->GetColorLayerImageViewManager()->SetGreyLevelBoundaries( grey_level_boundaries ); + std::vector transparence_level_boundaries = bbGetInputlstTransparenceBoundaries(); + clivp->GetColorLayerImageViewManager()->SetBaseTransparence( transparence_level_boundaries ); + clivp->GetColorLayerImageViewManager()->SetPlainOrGradientColor( bbGetInputPlainOrGradientColor() ); + clivp->SetFittingMode( bbGetInputFittingMode() ); + clivp->SetImage( bbGetInputIn() ); + bbSetOutputNewImage( clivp->GetColorLayerImageViewManager()->GetImageChangeInformation(0) ); + bbSetOutputLookupTable( clivp->GetColorLayerImageViewManager()->GetLookupTable(0) ); + bbSetOutputOutOpacity( clivp->GetOpacity() ); + if (firsttime==true) + { + firsttime=false; + clivp->ChangeOpacity(); + clivp->SetBox(this); + } + } // if clivp + } else { + printf("EED Error!!! ColorLayerImageView::Process (%s) Missing Inputs: WxVtkBaseView , WxVtkBaseView1 , WxVtkBaseView2 \n", bbGetFullName().c_str() ); + }// if xxVtkBaseView + + } // if In } //===== // Don't edit this file. This file is generated from xml description.. diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/comboBox.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/comboBox.cxx index aa30564..a07d522 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/comboBox.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/comboBox.cxx @@ -29,25 +29,20 @@ namespace creaButtonContainer { namespace view { - // ---------------------------------------------------------------------------------- - + +// ---------------------------------------------------------------------------------- ComboBox::ComboBox(wxWindow* parent, wxWindowID id, ItemsVector iVector, TFunctor* functor) : wxPanel(parent, id) { this->m_Functor = functor; - wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL); - this->SetSizer(sizer); - this->m_ComboBox = new wxComboBox(this, -1); this->m_FunctorEnabled = true; - this->Connect(wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler(ComboBox::OnComboBoxEvent)); - if (!iVector.empty()) { for (ItemsVector::iterator it = iVector.begin(); it != iVector.end(); @@ -55,41 +50,31 @@ namespace creaButtonContainer { std::string key = it->first; this->m_ComboBox->Append(wxString(key.c_str(), wxConvUTF8)); - } - } - + } // for + } // if sizer->Add(this->m_ComboBox, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL); - } - // ---------------------------------------------------------------------------------- - + +// ---------------------------------------------------------------------------------- ComboBox::ComboBox(wxWindow* parent, wxWindowID id, TFunctor* functor) : wxPanel(parent, id) { this->m_Functor = functor; - wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL); - this->SetSizer(sizer); - this->m_ComboBox = new wxComboBox(this, -1); this->m_FunctorEnabled = true; - this->Connect(wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler(ComboBox::OnComboBoxEvent)); - sizer->Add(this->m_ComboBox, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL); - } - // ---------------------------------------------------------------------------------- - - ComboBox::~ComboBox() + +// ---------------------------------------------------------------------------------- + ComboBox::~ComboBox() { - } // ---------------------------------------------------------------------------------- - void ComboBox::OnComboBoxEvent(wxCommandEvent& event) { if (!this->IsFunctorEnabled()) @@ -100,15 +85,11 @@ namespace creaButtonContainer { std::cout << "MLER | ComboBox::OnComboBoxEvent( wxCommandEvent& event )" << std::endl; - int iSelection; iSelection = this->m_ComboBox->GetSelection(); - wxString itemNom = this->m_ComboBox->GetString(iSelection); std::string itemNomC = std::string(itemNom.mb_str()); - this->m_Functor->Call(itemNomC); - } //yrt catch (const std::exception& e) { @@ -124,19 +105,19 @@ namespace creaButtonContainer { this->m_FunctorEnabled = enabled; } + // ---------------------------------------------------------------------------------- bool ComboBox::IsFunctorEnabled() const { return this->m_FunctorEnabled; } - + // ---------------------------------------------------------------------------------- wxComboBox* ComboBox::GetComboBox() const { return this->m_ComboBox; } - } //ecapseman } //ecapseman -- 2.45.1