]> Creatis software - creaMaracasVisu.git/commitdiff
#3564 Refresh viewer with no box reactivity
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Mon, 4 Nov 2024 12:24:42 +0000 (13:24 +0100)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Mon, 4 Nov 2024 12:24:42 +0000 (13:24 +0100)
bbtk/src/bbcreaMaracasVisuSetPosition.cxx
bbtk/src/bbcreaMaracasVisuSetPosition.h
bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.cxx
bbtk/src/bbcreaMaracasVisuwxVtkBaseView_Info.h
bbtk/src/bbmaracasvisuViewerNV.cxx
bbtk/src/bbmaracasvisuViewerNV.h

index 6e7bd99b4cbe95d76d981b4dba5f1108aa1346d0..897818f89c46fd116b55a1b812dc94279b735328 100644 (file)
@@ -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 = " <<bbGetOutputOut() << std::endl;
-
        if (bbGetInputActive()==true)
        {
                if (bbGetInputwxVtkBaseView()!=NULL)
@@ -43,7 +39,16 @@ void SetPosition::Process()
                                vtkmprbasedata->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 ) ;
 }
index 2e632af04784b40847153f5853c0f6e224f5887a..57f2c68156c68dee85fa1596504df44ff1dd1758 100644 (file)
@@ -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<int>);
   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<int>,"");
   BBTK_INPUT(SetPosition,wxVtkBaseView,"wxVtkBaseView",wxVtkBaseView*,"");
   BBTK_INPUT(SetPosition,FixAxis2D,"(default false) true/false",bool,"");
index eb580f879fe89d13d7e82cd2a2f6eacb92c6e716..50e9f720e270146f3f751b8b3b8efa081ffdf915 100644 (file)
@@ -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);
index 071840010b1bbac3084a373067b29e13c60d503c..7c760c2278ebf7d02f530425cbfd73b9df4c70aa 100644 (file)
@@ -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*,"");
index 86542adb76a34e395a2574cc9b83efba0b1eaa53..0c63bec7d77caa32a2eb99ea1709fc5dae502a08 100644 (file)
@@ -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
 }
index 83248794703f8d329ae972d8980ab9e004fff15d..6d932fa3dc075029510c2a21150bde971ea9a327 100644 (file)
@@ -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;