--- /dev/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)
+//=====
+#include "bbcreaMaracasVisuTransformWidget2.h"
+#include "bbcreaMaracasVisuPackage.h"
+namespace bbcreaMaracasVisu
+{
+
+
+// The widget created by the box
+class TransformWidgetPanel : public wxPanel
+{
+public:
+ TransformWidgetPanel(TransformWidget2* box, wxWindow *parent);
+ ~TransformWidgetPanel();
+ void OnSliderTrackX(wxScrollEvent& event);
+ void OnSliderTrackY(wxScrollEvent& event);
+ void OnSliderTrackZ(wxScrollEvent& event);
+ void OnSliderReleaseX(wxScrollEvent& event);
+ void OnSliderReleaseY(wxScrollEvent& event);
+ void OnSliderReleaseZ(wxScrollEvent& event);
+ void Release( wxSlider * slider );
+ void Track( wxSlider * slider ,int idVector);
+
+private:
+ TransformWidget2 *mBox;
+ wxSlider *mSliderRotationX;
+ wxSlider *mSliderRotationY;
+ wxSlider *mSliderRotationZ;
+ vtkTransform *t;
+ vtkTransform *tt;
+};
+//------------------------------------------------------------------------
+//------------------------------------------------------------------------
+//------------------------------------------------------------------------
+
+TransformWidgetPanel::TransformWidgetPanel(TransformWidget2* box, wxWindow *parent)
+ : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
+ mBox(box)
+{
+ t = vtkTransform::New();
+ tt = NULL;
+ wxSize sizeSliderWidget(25,25);
+ mSliderRotationX = new wxSlider( this, -1, 0 , -180, 180 , wxDefaultPosition,sizeSliderWidget, wxSL_HORIZONTAL, wxDefaultValidator);
+ mSliderRotationY = new wxSlider( this, -1, 0 , -180, 180 , wxDefaultPosition,sizeSliderWidget, wxSL_HORIZONTAL, wxDefaultValidator);
+ mSliderRotationZ = new wxSlider( this, -1, 0 , -180, 180 , wxDefaultPosition,sizeSliderWidget, wxSL_HORIZONTAL, wxDefaultValidator);
+// mSliderRotationX = new wxSlider( this, -1, 0 , -180, 180 , wxDefaultPosition,sizeSliderWidget, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+// mSliderRotationY = new wxSlider( this, -1, 0 , -180, 180 , wxDefaultPosition,sizeSliderWidget, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+// mSliderRotationZ = new wxSlider( this, -1, 0 , -180, 180 , wxDefaultPosition,sizeSliderWidget, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+
+ Connect( mSliderRotationX->GetId(),wxEVT_SCROLL_THUMBRELEASE,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnSliderReleaseX );
+ Connect( mSliderRotationX->GetId(),wxEVT_SCROLL_THUMBTRACK ,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnSliderTrackX );
+ Connect( mSliderRotationX->GetId(),wxEVT_SCROLL_CHANGED ,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnSliderTrackX );
+ Connect( mSliderRotationY->GetId(),wxEVT_SCROLL_THUMBRELEASE,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnSliderReleaseY );
+ Connect( mSliderRotationY->GetId(),wxEVT_SCROLL_THUMBTRACK ,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnSliderTrackY );
+ Connect( mSliderRotationY->GetId(),wxEVT_SCROLL_CHANGED ,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnSliderTrackY );
+ Connect( mSliderRotationZ->GetId(),wxEVT_SCROLL_THUMBRELEASE,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnSliderReleaseZ );
+ Connect( mSliderRotationZ->GetId(),wxEVT_SCROLL_THUMBTRACK ,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnSliderTrackZ );
+ Connect( mSliderRotationZ->GetId(),wxEVT_SCROLL_CHANGED ,(wxObjectEventFunction)(void (wxPanel::*)(wxScrollEvent&)) &TransformWidgetPanel::OnSliderTrackZ );
+ wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
+ sizer->Add( mSliderRotationX,1 );
+ sizer->Add( mSliderRotationY,1 );
+ sizer->Add( mSliderRotationZ,1 );
+ SetSizer(sizer);
+}
+
+TransformWidgetPanel::~TransformWidgetPanel()
+{
+}
+
+void TransformWidgetPanel::Release( wxSlider * slider )
+{
+ slider->SetValue(0);
+ // t = t*tt
+ t->PostMultiply();
+ t->Concatenate ( tt->GetMatrix() ); t->Update();
+ tt->GetMatrix()->Identity(); tt->Update();
+ mBox->bbSetOutputOut( t );
+ mBox->bbSignalOutputModification(std::string("Out"));
+}
+
+void TransformWidgetPanel::OnSliderReleaseX(wxScrollEvent& event)
+{
+ Release( mSliderRotationX );
+}
+
+void TransformWidgetPanel::OnSliderReleaseY(wxScrollEvent& event)
+{
+ Release( mSliderRotationY );
+}
+
+void TransformWidgetPanel::OnSliderReleaseZ(wxScrollEvent& event)
+{
+ Release( mSliderRotationZ );
+}
+
+void TransformWidgetPanel::Track( wxSlider *slider, int idVector)
+{
+ // out = t*tt
+ if (tt!=NULL)
+ {
+ tt->Delete();
+ }
+ vtkMatrix4x4 *tm = t->GetMatrix();
+ double tvx = tm->GetElement(0,idVector);
+ double tvy = tm->GetElement(1,idVector);
+ double tvz = tm->GetElement(2,idVector);
+ tt = vtkTransform::New();
+ tt->PostMultiply();
+
+ double angle = slider->GetValue()/2;
+ tt->RotateWXYZ( angle , tvx,tvy,tvz); tt->Update();
+ vtkTransform *result=vtkTransform::New();
+ result->PostMultiply();
+ result->Concatenate ( t->GetMatrix() ); result->Update();
+ result->Concatenate ( tt->GetMatrix() ); result->Update();
+ mBox->bbSetOutputOut( result );
+ mBox->bbSignalOutputModification(std::string("Out"));
+}
+
+void TransformWidgetPanel::OnSliderTrackX(wxScrollEvent& event)
+{
+ Track(mSliderRotationX ,0);
+}
+
+void TransformWidgetPanel::OnSliderTrackY(wxScrollEvent& event)
+{
+ Track(mSliderRotationY ,1);
+}
+
+void TransformWidgetPanel::OnSliderTrackZ(wxScrollEvent& event)
+{
+ Track(mSliderRotationZ ,2);
+}
+
+
+//------------------------------------------------------------------------
+//------------------------------------------------------------------------
+//------------------------------------------------------------------------
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,TransformWidget2)
+BBTK_BLACK_BOX_IMPLEMENTATION(TransformWidget2,bbtk::WxBlackBox);
+//=====
+// 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 TransformWidget2::Process()
+{
+
+}
+
+//=====
+// 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 TransformWidget2::CreateWidget(wxWindow* parent)
+{
+ TransformWidgetPanel *w = new TransformWidgetPanel(this,parent);
+ bbSetOutputWidget( w );
+}
+
+//=====
+// 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 TransformWidget2::bbUserSetDefaultValues()
+{
+ bbSetInputType(0);
+}
+
+//=====
+// 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 TransformWidget2::bbUserInitializeProcessing()
+{
+}
+
+//=====
+// 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 TransformWidget2::bbUserFinalizeProcessing()
+{
+}
+
+}// EO namespace bbcreaMaracasVisu
+
+
--- /dev/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)
+//=====
+#ifdef _USE_WXWIDGETS_
+#ifndef __bbcreaMaracasVisuTransformWidget2_h_INCLUDED__
+#define __bbcreaMaracasVisuTransformWidget2_h_INCLUDED__
+
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkWxBlackBox.h"
+
+#include "vtkTransform.h"
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT TransformWidget2
+ :
+ public bbtk::WxBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(TransformWidget2,bbtk::WxBlackBox);
+//=====
+// 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(Type,int);
+ BBTK_DECLARE_INPUT(Point,std::vector< double >);
+ BBTK_DECLARE_OUTPUT(Out,vtkLinearTransform *);
+ BBTK_PROCESS(Process);
+ void Process();
+ BBTK_CREATE_WIDGET(CreateWidget);
+ void CreateWidget(wxWindow*);
+//=====
+// 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_BEGIN_DESCRIBE_BLACK_BOX(TransformWidget2,bbtk::WxBlackBox);
+ BBTK_NAME("TransformWidget2");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("__CategoryBlackBox__");
+ BBTK_INPUT(TransformWidget2,Type,"(default 0)",int,"");
+ BBTK_INPUT(TransformWidget2,Point,"Potential Point [x y z]",std::vector<double>,"");
+ BBTK_OUTPUT(TransformWidget2,Out,"vtkTransform result",vtkLinearTransform *,"");
+BBTK_END_DESCRIBE_BLACK_BOX(TransformWidget2);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuTransformWidget2_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+