From 391b96aeef6ba2f07c33917bcc91c548306b7d6e Mon Sep 17 00:00:00 2001 From: "eduardo.davila@creatis.insa-lyon.fr" Date: Mon, 4 Nov 2024 13:24:42 +0100 Subject: [PATCH] #3564 Refresh viewer with no box reactivity --- bbtk/src/bbcreaMaracasVisuSetPosition.cxx | 17 +++++++++------ bbtk/src/bbcreaMaracasVisuSetPosition.h | 2 ++ .../bbcreaMaracasVisuwxVtkBaseView_Info.cxx | 20 +++++++++--------- .../src/bbcreaMaracasVisuwxVtkBaseView_Info.h | 8 +++---- bbtk/src/bbmaracasvisuViewerNV.cxx | 21 +++++++++++++------ bbtk/src/bbmaracasvisuViewerNV.h | 1 + 6 files changed, 43 insertions(+), 26 deletions(-) diff --git a/bbtk/src/bbcreaMaracasVisuSetPosition.cxx b/bbtk/src/bbcreaMaracasVisuSetPosition.cxx index 6e7bd99..897818f 100644 --- a/bbtk/src/bbcreaMaracasVisuSetPosition.cxx +++ b/bbtk/src/bbcreaMaracasVisuSetPosition.cxx @@ -28,10 +28,6 @@ void SetPosition::Process() // (the one provided in the attribute 'name' of the tag 'input') // * TYPE is the C++ type of the input/output // (the one provided in the attribute 'type' of the tag 'input') - -// bbSetOutputOut( bbGetInputIn() ); -// std::cout << "Output value = " <SetY( bbGetInputPoint()[1] ); vtkmprbasedata->SetZ( bbGetInputPoint()[2] ); vtkmprbasedata->SetFixAxis2D( bbGetInputFixAxis2D() ); - wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh + int codeEvent; + if (bbGetInputType()==0) + { + codeEvent = 12121; // Refresh with box reactivity + } + if (bbGetInputType()==1) + { + codeEvent = 22222; // Refresh without box reactivity + } + wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,codeEvent); //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 #if wxMAJOR_VERSION <= 2 bbGetInputwxVtkBaseView()->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessEvent( newevent ); @@ -53,7 +58,6 @@ void SetPosition::Process() } // if bbGetInputPosition } // bbGetInputwxVtkBaseView } // Active - } //===== @@ -64,6 +68,7 @@ void SetPosition::bbUserSetDefaultValues() // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 bbSetInputActive(true); + bbSetInputType(0); bbSetInputwxVtkBaseView( NULL ) ; bbSetInputFixAxis2D( false ) ; } diff --git a/bbtk/src/bbcreaMaracasVisuSetPosition.h b/bbtk/src/bbcreaMaracasVisuSetPosition.h index 2e632af..57f2c68 100644 --- a/bbtk/src/bbcreaMaracasVisuSetPosition.h +++ b/bbtk/src/bbcreaMaracasVisuSetPosition.h @@ -21,6 +21,7 @@ class bbcreaMaracasVisu_EXPORT SetPosition // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== BBTK_DECLARE_INPUT(Active,bool); + BBTK_DECLARE_INPUT(Type,int); BBTK_DECLARE_INPUT(Point,std::vector); BBTK_DECLARE_INPUT(wxVtkBaseView,wxVtkBaseView*); BBTK_DECLARE_INPUT(FixAxis2D,bool); @@ -39,6 +40,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(SetPosition,bbtk::AtomicBlackBox); BBTK_CATEGORY("empty"); BBTK_INPUT(SetPosition,Active,"(default true) true/false",bool,""); + BBTK_INPUT(SetPosition,Type,"(default 0) 0:bbtk box Reactivity 1: Not box reactivity",int,""); BBTK_INPUT(SetPosition,Point,"vector with point to be set [X Y Z]",std::vector,""); BBTK_INPUT(SetPosition,wxVtkBaseView,"wxVtkBaseView",wxVtkBaseView*,""); BBTK_INPUT(SetPosition,FixAxis2D,"(default false) true/false",bool,""); diff --git a/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx b/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx index eb580f8..50e9f72 100644 --- a/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx +++ b/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx @@ -28,10 +28,6 @@ void InteractorwxVtkBaseView_model::AddThisInteractor() vtkinteractorstylebaseview->AddInteractorStyleMaracas( this ); } - - - - class InteractorwxVtkBaseView : public InteractorwxVtkBaseView_model { public: @@ -140,8 +136,8 @@ bool InteractorwxVtkBaseView::OnMouseMove() { if (_box!=NULL) { - int intFlag; - if (flagDrag==true) intFlag=1; else intFlag=0; +// int intFlag; +// if (flagDrag==true) intFlag=1; else intFlag=0; bool ok=false; if ( (_box->bbGetInputInteractionType()==3 ) && (_wxvtkbaseview!=NULL) ) { @@ -164,8 +160,10 @@ bool InteractorwxVtkBaseView::OnMouseMove() { //EED 2023-08-05 _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview ); - _box->bbSignalOutputModification(); - return false; + _box->bbSignalOutputModification(); +//ED2024-11-01 +// return _box->bbGetInputWithEventPropagation(); + return true; } // if ok } // if _box return true; @@ -183,7 +181,7 @@ bool InteractorwxVtkBaseView::OnRightButtonDown() { _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview ); _box->bbSignalOutputModification(); - return false; + return false;; } // if _vtkbaseview } // if _box return true; @@ -201,7 +199,7 @@ bool InteractorwxVtkBaseView::OnRightButtonUp() { _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview ); _box->bbSignalOutputModification(); - return false; + return false;; } // if _vtkbaseview } // if _box return true; @@ -389,6 +387,8 @@ void wxVtkBaseView_Info::bbUserInitializeProcessing() // Here does nothing // but this is where you should allocate the internal/output pointers // if any + +// bbSetInputWithEventPropagation(false); bbSetOutputInteractorwxVtkBaseView_model(NULL); bbSetOutputInteractorwxVtkBaseView_model1(NULL); bbSetOutputInteractorwxVtkBaseView_model2(NULL); diff --git a/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.h b/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.h index 0718400..7c760c2 100644 --- a/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.h +++ b/bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.h @@ -45,7 +45,8 @@ class bbcreaMaracasVisu_EXPORT wxVtkBaseView_Info BBTK_DECLARE_INPUT(wxVtkBaseView2,wxVtkBaseView*); BBTK_DECLARE_INPUT(wxVtkBaseView3,wxVtkBaseView*); BBTK_DECLARE_INPUT(InteractionType,int); - +// BBTK_DECLARE_INPUT(WithEventPropagation,bool); + BBTK_DECLARE_OUTPUT(vtkRenderer,vtkRenderer*); BBTK_DECLARE_OUTPUT(Direction,int); BBTK_DECLARE_OUTPUT(Image,vtkImageData*); @@ -60,9 +61,7 @@ class bbcreaMaracasVisu_EXPORT wxVtkBaseView_Info BBTK_DECLARE_OUTPUT(InteractorwxVtkBaseView_model3,InteractorwxVtkBaseView_model*); BBTK_DECLARE_OUTPUT(Box_wxVtkBaseView_Info,wxVtkBaseView_Info*); BBTK_DECLARE_OUTPUT(wxVtkBaseView,wxVtkBaseView*); - - - + BBTK_PROCESS(Process); void Process(); bool firsttime; @@ -89,6 +88,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(wxVtkBaseView_Info,bbtk::AtomicBlackBox); BBTK_INPUT(wxVtkBaseView_Info,wxVtkBaseView2,"Used in case of InteractionType!=0",wxVtkBaseView*,""); BBTK_INPUT(wxVtkBaseView_Info,wxVtkBaseView3,"Used in case of InteractionType!=0",wxVtkBaseView*,""); BBTK_INPUT(wxVtkBaseView_Info,InteractionType,"(default 0) 0:Nothing 1:LeftButtonDown 2:LeftButtonUp 3:MouseMove 4:RightButtonDown 5:RightButtonUp 6:LeftDClick 7:RightDClick 8:DragLeft 9:DragRight 10:MiddleButtonDown 11:MiddleButtonUp 12:DragMiddle ",int,""); +// BBTK_INPUT(wxVtkBaseView_Info,WithEventPropagation,"(default false) (In MouseMove envet) false:No Event propagation true:With event propagation",bool,""); BBTK_OUTPUT(wxVtkBaseView_Info,Direction,"Direction -1=3D 0=YZ 1=XZ 2=XY(default)",int,""); BBTK_OUTPUT(wxVtkBaseView_Info,vtkRenderer,"vtkRenderer default=NULL",vtkRenderer*,""); diff --git a/bbtk/src/bbmaracasvisuViewerNV.cxx b/bbtk/src/bbmaracasvisuViewerNV.cxx index 86542ad..0c63bec 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.cxx +++ b/bbtk/src/bbmaracasvisuViewerNV.cxx @@ -30,6 +30,7 @@ namespace bbcreaMaracasVisu BEGIN_EVENT_TABLE( bbwxMaracas_N_ViewersWidget, wxPanel ) EVT_MENU( 12121, bbwxMaracas_N_ViewersWidget::OnRefreshView ) + EVT_MENU( 22222, bbwxMaracas_N_ViewersWidget::OnRefreshView2 ) EVT_MENU( 12122, bbwxMaracas_N_ViewersWidget::OnDClickLeft ) END_EVENT_TABLE( ); @@ -69,12 +70,23 @@ void bbwxMaracas_N_ViewersWidget::OnRefreshView(wxCommandEvent & event) mbbViewerNV->_point.push_back( (int)GetZ() ); mbbViewerNV->bbSetOutputPoint( mbbViewerNV->_point ); bool ok=true; - if (mbbViewerNV->bbGetInputReactivityType()==0) { ok=false; } - mbbViewerNV->bbSignalOutputModification(std::string("Point"),ok); - } // if +//ED2024-11-01 +// if (mbbViewerNV->bbGetInputReactivityType()==0) { ok=false; } +// mbbViewerNV->bbSignalOutputModification(std::string("Point"),ok); + if (mbbViewerNV->bbGetInputReactivityType()==1) + { + mbbViewerNV->bbSignalOutputModification(std::string("Point"),true); + } // if type + } // if X Y Z wxMaracas_N_ViewersWidget::OnRefreshView(event); } +//------------------------------------------------------------- +void bbwxMaracas_N_ViewersWidget::OnRefreshView2(wxCommandEvent & event) +{ + wxMaracas_N_ViewersWidget::OnRefreshView(event); +} + //------------------------------------------------------------- void bbwxMaracas_N_ViewersWidget::OnDClickLeft(wxCommandEvent & event) { @@ -86,8 +98,6 @@ void bbwxMaracas_N_ViewersWidget::OnDClickLeft(wxCommandEvent & event) //------------------------------------------------------------- //------------------------------------------------------------- - - BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ViewerNV) BBTK_BLACK_BOX_IMPLEMENTATION(ViewerNV,bbtk::WxBlackBox); //------------------------------------------------------------- @@ -157,7 +167,6 @@ void ViewerNV::Process() wvbv1->GetWxVTKRenderWindowInteractor ()->GetParent()->ProcessWindowEvent( newevent ); #endif } - */ }// mwxwidget != NULL } diff --git a/bbtk/src/bbmaracasvisuViewerNV.h b/bbtk/src/bbmaracasvisuViewerNV.h index 8324879..6d932fa 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.h +++ b/bbtk/src/bbmaracasvisuViewerNV.h @@ -53,6 +53,7 @@ namespace bbcreaMaracasVisu ~bbwxMaracas_N_ViewersWidget(); //if the MPR had generated the refresh event void OnRefreshView(wxCommandEvent &event); + void OnRefreshView2(wxCommandEvent &event); void OnDClickLeft(wxCommandEvent &event); private: int backX; -- 2.47.1