]> Creatis software - creaMaracasVisu.git/blobdiff - bbtk/src/bbcreaMaracasVisuwxPopupMenu.cxx
#3481 wxVtkBaseView_Info add events mouse observer
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuwxPopupMenu.cxx
index 4e844ff41cdd7dd2950aca251901218f2984e679..6a0792c6b76f0cf55f6f2b3feedbd4b9e4fee049 100644 (file)
@@ -7,6 +7,7 @@
 #include <wx/menu.h>
 #include "InteractorStyleMaracas.h"
 #include <vtkInteractorStyleBaseView.h>
+#include "wxVtk2DBaseView.h"
 
 namespace bbcreaMaracasVisu
 {
@@ -14,7 +15,7 @@ namespace bbcreaMaracasVisu
 class PopupMenuInteractor : public InteractorStyleMaracas , wxEvtHandler
 {
     public:
-        PopupMenuInteractor( );
+//        PopupMenuInteractor( );
         PopupMenuInteractor( wxPopupMenu *box, wxVtkBaseView *wxvtkbaseview );
         ~PopupMenuInteractor();
 //      virtual bool    OnLeftButtonDown();
@@ -26,20 +27,22 @@ class PopupMenuInteractor : public InteractorStyleMaracas , wxEvtHandler
 //      virtual bool    OnRightDClick();
                 void    OnPopupClick(wxCommandEvent &evt);
     private:
-        wxVtkBaseView   *_wxvtkbaseview;
-        wxPopupMenu     *_box;
+        wxVtkBaseView       *_wxvtkbaseview;
+        wxPopupMenu         *_box;
+        std::vector<double> lstPoint;
 };
 
+/*
 PopupMenuInteractor::PopupMenuInteractor(  )
 {
-    _wxvtkbaseview = NULL;
-    _box           = NULL;
+    _wxvtkbaseview  = NULL;
+    _box            = NULL;
 }
-
+*/
 PopupMenuInteractor::PopupMenuInteractor( wxPopupMenu *box , wxVtkBaseView *wxvtkbaseview )
 {
-    _wxvtkbaseview = wxvtkbaseview;
-    _box           = box;
+    _wxvtkbaseview  = wxvtkbaseview;
+    _box            = box;
 }
 
 PopupMenuInteractor::~PopupMenuInteractor()
@@ -65,6 +68,7 @@ void PopupMenuInteractor::OnPopupClick(wxCommandEvent &evt)
     } else {
         _box->bbSetOutputSimpleText( "void" );
     }
+    _box->bbSetOutputPoint( lstPoint );
     _box->bbSignalOutputModification();
 }
 
@@ -80,6 +84,28 @@ bool PopupMenuInteractor::OnRightButtonUp()
         int                         size        = lstItems.size();
         int                         i;
         wxMenu                      menu;
+
+        /*
+        int X,Y,Z;
+        crea::wxVTKRenderWindowInteractor *wxVTKiren;
+        wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
+        wxVTKiren->GetEventPosition(X,Y);
+        Z = (int)((wxVtk2DBaseView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()))->GetVtkBaseData()->GetZ();
+        double dxx     = X;
+        double dyy     = Y;
+        double dzz     = Z;
+        _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->TransFromCoordScreenToWorld(dxx,dyy,dzz,true);
+        _px    = (int)(dxx+0.5);
+        _py    = (int)(dyy+0.5);
+        _pz    = (int)(dzz+0.0);
+        */
+        int x,y,z;
+        ((wxVtk2DBaseView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()))->GetVtkBaseData()->GetPointMouse(x,y,z);
+        lstPoint.clear();
+        lstPoint.push_back(x);
+        lstPoint.push_back(y);
+        lstPoint.push_back(z);
+
         for (i=0;i<size;i++)
         {
             wxString itemString( lstItems[i].c_str() , wxConvUTF8 );
@@ -97,7 +123,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(wxPopupMenu,bbtk::AtomicBlackBox);
 //===== 
 void wxPopupMenu::Process()
 {
-
 // THE MAIN PROCESSING METHOD BODY
 //   Here we simply set the input 'In' value to the output 'Out'
 //   And print out the output value
@@ -116,8 +141,8 @@ void wxPopupMenu::Process()
         firsttime=false;
         if (bbGetInputwxVtkBaseView()!=NULL)
         {
-            PopupMenuInteractor* popupmenuinteractor = new PopupMenuInteractor( this, bbGetInputwxVtkBaseView()  );
-            vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView()->GetInteractorStyleBaseView() );
+            PopupMenuInteractor* popupmenuinteractor                = new PopupMenuInteractor( this, bbGetInputwxVtkBaseView()  );
+            vtkInteractorStyleBaseView *vtkinteractorstylebaseview  = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView()->GetInteractorStyleBaseView() );
             vtkinteractorstylebaseview->AddInteractorStyleMaracas( popupmenuinteractor );
         } // if wxVtkBaseView
     } // if firsttime
@@ -140,27 +165,23 @@ void wxPopupMenu::bbUserSetDefaultValues()
 //===== 
 void wxPopupMenu::bbUserInitializeProcessing()
 {
-
 //  THE INITIALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should allocate the internal/output pointers 
-//    if any 
-
-  
+//    if any
 }
+
 //===== 
 // 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)
 //===== 
 void wxPopupMenu::bbUserFinalizeProcessing()
 {
-
 //  THE FINALIZATION METHOD BODY :
 //    Here does nothing 
 //    but this is where you should desallocate the internal/output pointers 
 //    if any
-  
 }
-}
-// EO namespace bbcreaMaracasVisu
+
+}// EO namespace bbcreaMaracasVisu