namespace bbcreaMaracasVisu
{
-
-class PopupMenuInteractor : public InteractorStyleMaracas
+class PopupMenuInteractor : public InteractorStyleMaracas , wxEvtHandler
{
-public:
- PopupMenuInteractor( wxPopupMenu *box, wxVtkBaseView *wxvtkbaseview );
- ~PopupMenuInteractor();
-// virtual bool OnLeftButtonDown();
-// virtual bool OnLeftButtonUp();
-// virtual bool OnMouseMove();
-// virtual bool OnRightButtonDown();
- virtual bool OnRightButtonUp();
-// virtual bool OnLeftDClick();
- void OnPopupClick(wxCommandEvent &evt);
-
-private:
- wxVtkBaseView *_wxvtkbaseview;
- wxPopupMenu *_box;
+ public:
+ PopupMenuInteractor( );
+ PopupMenuInteractor( wxPopupMenu *box, wxVtkBaseView *wxvtkbaseview );
+ ~PopupMenuInteractor();
+// virtual bool OnLeftButtonDown();
+// virtual bool OnLeftButtonUp();
+// virtual bool OnMouseMove();
+// virtual bool OnRightButtonDown();
+ virtual bool OnRightButtonUp();
+// virtual bool OnLeftDClick();
+// virtual bool OnRightDClick();
+ void OnPopupClick(wxCommandEvent &evt);
+ private:
+ wxVtkBaseView *_wxvtkbaseview;
+ wxPopupMenu *_box;
};
+PopupMenuInteractor::PopupMenuInteractor( )
+{
+ _wxvtkbaseview = NULL;
+ _box = NULL;
+}
+
PopupMenuInteractor::PopupMenuInteractor( wxPopupMenu *box , wxVtkBaseView *wxvtkbaseview )
{
_wxvtkbaseview = wxvtkbaseview;
// case ID_SOMETHING_ELSE:
// break;
// }
-
- printf("EED PopupMenuInteractor::OnPopupClick %d\n", evt.GetId() );
-
+ int id=evt.GetId()-1000;
+ _box->bbSetOutputOut( id );
+ std::vector<std::string> lstItems = _box->bbGetInputIn();
+ int size = lstItems.size();
+ if ((id>=0) && (id<size))
+ {
+ _box->bbSetOutputSimpleText( lstItems[id] );
+ } else {
+ _box->bbSetOutputSimpleText( "void" );
+ }
+ _box->bbSignalOutputModification();
}
bool PopupMenuInteractor::OnRightButtonUp()
{
if (_wxvtkbaseview!=NULL)
{
- wxWindow* window = _wxvtkbaseview->GetWxVTKRenderWindowInteractor();
- const wxPoint pt = wxGetMousePosition();
- int x = pt.x - window->GetScreenPosition().x;
- int y = pt.y - window->GetScreenPosition().y;
- wxMenu menu;
- std::vector<std::string> lstItems = _box->bbGetInputIn();
- int i,size = lstItems.size();
+ wxWindow *window = _wxvtkbaseview->GetWxVTKRenderWindowInteractor();
+ const wxPoint pt = wxGetMousePosition();
+ int xWindow = pt.x - window->GetScreenPosition().x;
+ int yWindow = pt.y - window->GetScreenPosition().y;
+ std::vector<std::string> lstItems = _box->bbGetInputIn();
+ int size = lstItems.size();
+ int i;
+ wxMenu menu;
for (i=0;i<size;i++)
{
- menu.Append(i+1000, lstItems[i] );
+ wxString itemString( lstItems[i].c_str() , wxConvUTF8 );
+ wxMenuItem *item = menu.Append(i+1000, itemString );
} // for
-// menu.Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenuInteractor::OnPopupClick), NULL, this);
-// Connect( mwxCommandButton->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&)) &CommandButtonWidget::OnCommandButton );
- menu.Connect( wxEVT_COMMAND_MENU_SELECTED , (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&)) &PopupMenuInteractor::OnPopupClick );
-
-
- window->PopupMenu(&menu,x,y);
+ menu.Connect( wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction) (wxCommandEventFunction) &PopupMenuInteractor::OnPopupClick,NULL,this );
+ window->PopupMenu(&menu,xWindow,yWindow);
} // if _vtkbaseview
}
-
-
-
BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,wxPopupMenu)
BBTK_BLACK_BOX_IMPLEMENTATION(wxPopupMenu,bbtk::AtomicBlackBox);
//=====
// (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 (firsttime==true)
{
firsttime=false;
-
if (bbGetInputwxVtkBaseView()!=NULL)
{
PopupMenuInteractor* popupmenuinteractor = new PopupMenuInteractor( this, bbGetInputwxVtkBaseView() );
vtkinteractorstylebaseview->AddInteractorStyleMaracas( popupmenuinteractor );
} // if wxVtkBaseView
} // if firsttime
-
}
+
//=====
// 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::bbUserSetDefaultValues()
{
-
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
-
firsttime=true;
bbSetInputwxVtkBaseView(NULL);
-
+ bbSetOutputOut(-1);
}
+
//=====
// 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)
//=====
//=====
#include "bbcreaMaracasVisuwxVtkBaseView_Info.h"
#include "bbcreaMaracasVisuPackage.h"
+#include "InteractorStyleMaracas.h"
+#include <vtkInteractorStyleBaseView.h>
+
namespace bbcreaMaracasVisu
{
+
+class InteractorwxVtkBaseView : public InteractorStyleMaracas
+{
+ public:
+ InteractorwxVtkBaseView( );
+ InteractorwxVtkBaseView( wxVtkBaseView_Info *box, wxVtkBaseView *wxvtkbaseview );
+ ~InteractorwxVtkBaseView();
+ virtual bool OnLeftButtonDown();
+ virtual bool OnLeftButtonUp();
+ virtual bool OnMouseMove();
+ virtual bool OnRightButtonDown();
+ virtual bool OnRightButtonUp();
+ virtual bool OnLeftDClick();
+ virtual bool OnRightDClick();
+
+private:
+ wxVtkBaseView *_wxvtkbaseview;
+ wxVtkBaseView_Info *_box;
+ bool flagDrag;
+};
+
+InteractorwxVtkBaseView::InteractorwxVtkBaseView( )
+{
+ _wxvtkbaseview = NULL;
+ _box = NULL;
+ flagDrag = false;
+}
+
+InteractorwxVtkBaseView::InteractorwxVtkBaseView( wxVtkBaseView_Info *box , wxVtkBaseView *wxvtkbaseview )
+{
+ _box = box;
+ flagDrag = false;
+ _wxvtkbaseview = wxvtkbaseview;
+}
+
+InteractorwxVtkBaseView::~InteractorwxVtkBaseView()
+{
+}
+
+bool InteractorwxVtkBaseView::OnLeftButtonDown()
+{
+ printf("EED InteractorwxVtkBaseView::OnLeftButtonDown \n");
+ if ( _box->bbGetInputInteractionType()==8 )
+ {
+ printf("EED InteractorwxVtkBaseView::OnLeftButtonDown 1\n");
+ flagDrag=true;
+ }
+ if ( (_box->bbGetInputInteractionType()==1 ) && (_wxvtkbaseview!=NULL) )
+ {
+ _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
+ _box->bbSignalOutputModification();
+ return false;
+ } // if _vtkbaseview
+ return true;
+}
+
+bool InteractorwxVtkBaseView::OnLeftButtonUp()
+{
+ printf("EED InteractorwxVtkBaseView::OnLeftButtonUp \n");
+ if ( _box->bbGetInputInteractionType()==8 )
+ {
+ printf("EED InteractorwxVtkBaseView::OnLeftButtonUp 1\n");
+ flagDrag=false;
+ }
+ if ( (_box->bbGetInputInteractionType()==2 ) && (_wxvtkbaseview!=NULL) )
+ {
+ _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
+ _box->bbSignalOutputModification();
+ return false;
+ } // if _vtkbaseview
+ return true;
+}
+
+bool InteractorwxVtkBaseView::OnMouseMove()
+{
+ int intFlag;
+ if (flagDrag==true) intFlag=1; else intFlag=0;
+ printf("EED InteractorwxVtkBaseView::OnMouseMove Start this=%p type=%d flag=%d\n", this, _box->bbGetInputInteractionType() ,intFlag);
+ bool ok=false;
+ if ( (_box->bbGetInputInteractionType()==3 ) && (_wxvtkbaseview!=NULL) )
+ {
+ ok=true;
+ } // if InteractionType 3
+ if (( _box->bbGetInputInteractionType()==8 ) && (flagDrag==true) )
+ {
+ ok=true;
+ } // if InteractionType 8
+ if (( _box->bbGetInputInteractionType()==9 ) && (flagDrag==true) )
+ {
+ ok=true;
+ } // if InteractionType 9
+ if (ok==true)
+ {
+ printf("EED InteractorwxVtkBaseView::OnMouseMove 1\n");
+ _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
+ _box->bbSignalOutputModification();
+ return false;
+ } // if ok
+ printf("EED InteractorwxVtkBaseView::OnMouseMove End\n");
+ return true;
+}
+
+bool InteractorwxVtkBaseView::OnRightButtonDown()
+{
+ if ( _box->bbGetInputInteractionType()==9 )
+ {
+ flagDrag=true;
+ }
+ if ( (_box->bbGetInputInteractionType()==4 ) && (_wxvtkbaseview!=NULL) )
+ {
+ _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
+ _box->bbSignalOutputModification();
+ return false;
+ } // if _vtkbaseview
+ return true;
+}
+
+bool InteractorwxVtkBaseView::OnRightButtonUp()
+{
+ if ( _box->bbGetInputInteractionType()==9 )
+ {
+ flagDrag=false;
+ }
+ if ( (_box->bbGetInputInteractionType()==5 ) && (_wxvtkbaseview!=NULL) )
+ {
+ _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
+ _box->bbSignalOutputModification();
+ return false;
+ } // if _vtkbaseview
+ return true;
+}
+
+
+bool InteractorwxVtkBaseView::OnLeftDClick()
+{
+ printf("EED InteractorwxVtkBaseView::OnLeftDClick Start this=%p\n", this);
+ if ( (_box->bbGetInputInteractionType()==6 ) && (_wxvtkbaseview!=NULL) )
+ {
+ printf("EED InteractorwxVtkBaseView::OnLeftDClick 1\n");
+ _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
+ _box->bbSignalOutputModification();
+ return false;
+ } // if _vtkbaseview
+ return true;
+}
+
+bool InteractorwxVtkBaseView::OnRightDClick()
+{
+ printf("EED InteractorwxVtkBaseView::OnRightDClick Start\n");
+ if ( (_box->bbGetInputInteractionType()==7 ) && (_wxvtkbaseview!=NULL) )
+ {
+ printf("EED InteractorwxVtkBaseView::OnRightDClick 1\n");
+ _box->SetwxVtkBaseViewOutputs( _wxvtkbaseview );
+ _box->bbSignalOutputModification();
+ return false;
+ } // if _vtkbaseview
+ return true;
+}
+
+
BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,wxVtkBaseView_Info)
BBTK_BLACK_BOX_IMPLEMENTATION(wxVtkBaseView_Info,bbtk::AtomicBlackBox);
+
+
+void wxVtkBaseView_Info::SetwxVtkBaseViewOutputs(wxVtkBaseView *wxvtkbaseview )
+{
+ if (wxvtkbaseview!=NULL)
+ {
+ printf("EED wxVtkBaseView_Info::SetwxVtkBaseViewOutputs this=%p\n",this);
+ printf("EED wxVtkBaseView_Info::SetwxVtkBaseViewOutputs %s \n", bbGetFullName().c_str() );
+ bbSetOutputvtkRenderer( wxvtkbaseview->GetRenderer() );
+ bbSetOutputDirection( wxvtkbaseview->GetDirection() );
+ vtkBaseData *vtkbasedata = wxvtkbaseview->GetVtkBaseData();
+ if (vtkbasedata!=NULL)
+ {
+ marImageData *marimagedata = vtkbasedata->GetMarImageData();
+ if (marimagedata!=NULL)
+ {
+ bbSetOutputImage( marimagedata->GetImageData() );
+ } // MarImageData
+ std::vector<double> LstWindowColorLevel;
+ LstWindowColorLevel.push_back( vtkbasedata->GetColorWindow() );
+ LstWindowColorLevel.push_back( vtkbasedata->GetColorLevel() );
+ bbSetOutputWindowColorLevel( LstWindowColorLevel );
+
+ std::vector<double> lstPoint;
+ lstPoint.push_back( vtkbasedata->GetX() );
+ lstPoint.push_back( vtkbasedata->GetY() );
+ lstPoint.push_back( vtkbasedata->GetZ() );
+ bbSetOutputPoint( lstPoint );
+ printf("EED wxVtkBaseView_Info::SetwxVtkBaseViewOutputs point = %f %f %f\n",lstPoint[0],lstPoint[1],lstPoint[2] );
+
+ double normal[3];
+ std::vector<double> lstNormal;
+ wxvtkbaseview->GetNormal( normal );
+ lstNormal.push_back( normal[0] );
+ lstNormal.push_back( normal[1] );
+ lstNormal.push_back( normal[2] );
+ bbSetOutputNormal( lstNormal );
+
+ bbSetOutputInterpolation( vtkbasedata->GetInterpolate() );
+ } // BaseData
+ } // if wxvtkbaseview
+}
+
//=====
// 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 wxVtkBaseView_Info::Process()
{
-
// THE MAIN PROCESSING METHOD BODY
// Here we simply set the input 'In' value to the output 'Out'
// And print out the output value
// (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')
+
+
+
+ printf("EED wxVtkBaseView_Info::Process Start\n");
+
+ if (bbGetInputInteractionType()==0)
+ {
+ SetwxVtkBaseViewOutputs( bbGetInputwxVtkBaseView() );
+ }
+
+ if (firsttime==true)
+ {
+ firsttime=false;
+ if (bbGetInputInteractionType()!=0)
+ {
+ SetwxVtkBaseViewOutputs( bbGetInputwxVtkBaseView() );
+
+ if (bbGetInputwxVtkBaseView()!=NULL)
+ {
+ InteractorwxVtkBaseView *interactorwxvtkbaseview = new InteractorwxVtkBaseView( this, bbGetInputwxVtkBaseView() );
+ vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView()->GetInteractorStyleBaseView() );
+ vtkinteractorstylebaseview->AddInteractorStyleMaracas( interactorwxvtkbaseview );
+ } // if wxVtkBaseView
+ if (bbGetInputwxVtkBaseView2()!=NULL)
+ {
+ InteractorwxVtkBaseView *interactorwxvtkbaseview = new InteractorwxVtkBaseView( this, bbGetInputwxVtkBaseView2() );
+ vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView2()->GetInteractorStyleBaseView() );
+ vtkinteractorstylebaseview->AddInteractorStyleMaracas( interactorwxvtkbaseview );
+ } // if wxVtkBaseView2
+ if (bbGetInputwxVtkBaseView3()!=NULL)
+ {
+ InteractorwxVtkBaseView *interactorwxvtkbaseview = new InteractorwxVtkBaseView( this, bbGetInputwxVtkBaseView3() );
+ vtkInteractorStyleBaseView *vtkinteractorstylebaseview = (vtkInteractorStyleBaseView*) (bbGetInputwxVtkBaseView3()->GetInteractorStyleBaseView() );
+ vtkinteractorstylebaseview->AddInteractorStyleMaracas( interactorwxvtkbaseview );
+ } // if wxVtkBaseView3
+ } // if InteractionType !=0
+ } // if firsttime
+
+ printf("EED wxVtkBaseView_Info::Process end\n");
-// bbSetOutputOut( bbGetInputIn() );
-// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
-
- if (bbGetInputwxVtkBaseView()!=NULL)
- {
- bbSetOutputvtkRenderer( bbGetInputwxVtkBaseView()->GetRenderer() );
- bbSetOutputDirection( bbGetInputwxVtkBaseView()->GetDirection() );
- vtkBaseData *vtkbasedata = bbGetInputwxVtkBaseView()->GetVtkBaseData();
- if (vtkbasedata!=NULL)
- {
- marImageData *marimagedata = vtkbasedata->GetMarImageData();
- if (marimagedata!=NULL)
- {
- bbSetOutputImage( marimagedata->GetImageData() );
- } // MarImageData
- std::vector<double> LstWindowColorLevel;
- LstWindowColorLevel.push_back( vtkbasedata->GetColorWindow() );
- LstWindowColorLevel.push_back( vtkbasedata->GetColorLevel() );
- bbSetOutputWindowColorLevel( LstWindowColorLevel );
-
- std::vector<double> lstPoint;
- lstPoint.push_back( vtkbasedata->GetX() );
- lstPoint.push_back( vtkbasedata->GetY() );
- lstPoint.push_back( vtkbasedata->GetZ() );
- bbSetOutputPoint( lstPoint );
-
- double normal[3];
- std::vector<double> lstNormal;
- bbGetInputwxVtkBaseView()->GetNormal( normal );
- lstNormal.push_back( normal[0] );
- lstNormal.push_back( normal[1] );
- lstNormal.push_back( normal[2] );
- bbSetOutputNormal( lstNormal );
-
- bbSetOutputInterpolation( vtkbasedata->GetInterpolate() );
- } // BaseData
- }
}
+
//=====
// 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)
//=====
{
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
+ firsttime=true;
std::vector<double> LstWindowColorLevel;
LstWindowColorLevel.push_back( 1000 );
LstWindowColorLevel.push_back( 500 );
- bbSetOutputWindowColorLevel( LstWindowColorLevel );
+ bbSetInputwxVtkBaseView( NULL );
+ bbSetInputwxVtkBaseView2( NULL );
+ bbSetInputwxVtkBaseView3( NULL );
+ bbSetInputInteractionType(0);
+ bbSetOutputWindowColorLevel( LstWindowColorLevel );
bbSetOutputDirection(2);
bbSetOutputInterpolation(true);
bbSetOutputvtkRenderer(NULL);
}
+
//=====
// 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 wxVtkBaseView_Info::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 wxVtkBaseView_Info::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
//=====
// 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(wxVtkBaseView,wxVtkBaseView*);
- BBTK_DECLARE_OUTPUT(vtkRenderer,vtkRenderer*);
- BBTK_DECLARE_OUTPUT(Direction,int);
- BBTK_DECLARE_OUTPUT(Image,vtkImageData*);
- BBTK_DECLARE_OUTPUT(WindowColorLevel,std::vector<double>);
- BBTK_DECLARE_OUTPUT(Interpolation,bool);
- BBTK_DECLARE_OUTPUT(Point,std::vector<double>);
- BBTK_DECLARE_OUTPUT(Normal,std::vector<double>);
+ BBTK_DECLARE_INPUT(wxVtkBaseView,wxVtkBaseView*);
+ BBTK_DECLARE_INPUT(wxVtkBaseView2,wxVtkBaseView*);
+ BBTK_DECLARE_INPUT(wxVtkBaseView3,wxVtkBaseView*);
+ BBTK_DECLARE_INPUT(InteractionType,int);
+ BBTK_DECLARE_OUTPUT(vtkRenderer,vtkRenderer*);
+ BBTK_DECLARE_OUTPUT(Direction,int);
+ BBTK_DECLARE_OUTPUT(Image,vtkImageData*);
+ BBTK_DECLARE_OUTPUT(WindowColorLevel,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Interpolation,bool);
+ BBTK_DECLARE_OUTPUT(Point,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Normal,std::vector<double>);
- BBTK_PROCESS(Process);
- void Process();
+ BBTK_PROCESS(Process);
+ void Process();
+ bool firsttime;
+ void SetwxVtkBaseViewOutputs(wxVtkBaseView *wxvtkbaseview );
+
//=====
// 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_DESCRIPTION("No Description.");
BBTK_CATEGORY("empty");
- BBTK_INPUT(wxVtkBaseView_Info,wxVtkBaseView,"wxVtkBaseView",wxVtkBaseView*,"");
+ BBTK_INPUT(wxVtkBaseView_Info,wxVtkBaseView,"wxVtkBaseView Used for the principal output. Used in case of InteractionType!=0",wxVtkBaseView*,"");
+ 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",int,"");
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*,"");