]> Creatis software - creaMaracasVisu.git/commitdiff
Clean Code
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Fri, 2 Jun 2023 09:00:02 +0000 (11:00 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Fri, 2 Jun 2023 09:00:02 +0000 (11:00 +0200)
bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/comboBox.cxx

index 384629726ce3cc05068454c53e0009b679221e22..edb3954c075ca4bd254993fe1f7dafeb84fbbdfc 100644 (file)
@@ -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<double> range = bbGetInputlstRangeForColorBar();
-                   clivp->GetColorLayerImageViewManager()->SetRangeForColorBar( range );
-                   std::vector<int> colorbarposition = bbGetInputColorBarPosition();
-                   clivp->GetColorLayerImageViewManager()->SetColorBarPosition( colorbarposition );
-                   std::vector<double> base_color = bbGetInputlstBaseColor();
-                   clivp->GetColorLayerImageViewManager()->SetBaseColors( base_color );
-                   std::vector<double> grey_level_boundaries = bbGetInputlstGreyLevelBoundaries();
-                   clivp->GetColorLayerImageViewManager()->SetGreyLevelBoundaries( grey_level_boundaries );
-                   std::vector<double> 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<double> range = bbGetInputlstRangeForColorBar();
+                clivp->GetColorLayerImageViewManager()->SetRangeForColorBar( range );
+                std::vector<int> colorbarposition = bbGetInputColorBarPosition();
+                clivp->GetColorLayerImageViewManager()->SetColorBarPosition( colorbarposition );
+                std::vector<double> base_color = bbGetInputlstBaseColor();
+                clivp->GetColorLayerImageViewManager()->SetBaseColors( base_color );
+                std::vector<double> grey_level_boundaries = bbGetInputlstGreyLevelBoundaries();
+                clivp->GetColorLayerImageViewManager()->SetGreyLevelBoundaries( grey_level_boundaries );
+                std::vector<double> 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..
index aa305641d8d80314d3263d9a68f682acca109ba5..a07d5222ab88b9b4074d23a40e426754d5177771 100644 (file)
@@ -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