From 9d1a5ada62580910e85686718445543da6badaf8 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Thu, 9 Mar 2023 16:58:30 +0100 Subject: [PATCH] #3500 Bug ColorLayerImageView --- .../bbcreaMaracasVisuColorLayerImageView.cxx | 68 ++++++++++--------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx index 46cf052..3846297 100644 --- a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx @@ -50,7 +50,7 @@ class ColorLayerImageViewPanel_widgetBox : public ColorLayerImageViewPanel ColorLayerImageViewPanel_widgetBox::ColorLayerImageViewPanel_widgetBox( wxWindow * parent, int min, int max,int opacity, int type ) : ColorLayerImageViewPanel( parent, min, max, opacity, type ) { - mBox=NULL; + mBox = NULL; } void ColorLayerImageViewPanel_widgetBox::ChangeOpacity() @@ -65,7 +65,7 @@ void ColorLayerImageViewPanel_widgetBox::ChangeOpacity() void ColorLayerImageViewPanel_widgetBox::SetBox(ColorLayerImageView* box) { - mBox=box; + mBox = box; } BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ColorLayerImageView) @@ -78,36 +78,39 @@ void ColorLayerImageView::Process() if ( !( (bbGetInputWxVtkBaseView()==NULL) && (bbGetInputWxVtkBaseView1()==NULL) && (bbGetInputWxVtkBaseView2()==NULL)) ) { ColorLayerImageViewPanel_widgetBox *clivp = (ColorLayerImageViewPanel_widgetBox*)bbGetOutputWidget(); - 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!=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 @@ -139,6 +142,7 @@ void ColorLayerImageView::bbUserSetDefaultValues() lstColorBarPosition.push_back(10); lstColorBarPosition.push_back(105); bbSetInputColorBarPosition(lstColorBarPosition); + bbSetOutputWidget(NULL); } //===== -- 2.47.1