+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+#include "bbcreaMaracasVisuManualPaint.h"
+#include "bbcreaMaracasVisuPackage.h"
+
+#include "wxVtk2DBaseView.h"
+#include "wxVTKRenderWindowInteractor.h"
+
+namespace bbcreaMaracasVisu
+{
+
+
+
+vtkInteractorManualPaint::vtkInteractorManualPaint()
+{
+ _state = false;
+ _image = NULL;
+ _auxZ = 0;
+}
+
+//---------------------------------------------------------------------------
+vtkInteractorManualPaint::~vtkInteractorManualPaint()
+{
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorManualPaint::OnLeftButtonDown()
+{
+ vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
+ if ((interactor->GetControlKey()==1) || (interactor->GetShiftKey()==1) ){
+ _state = true;
+ wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+ _Z = wxvtk2Dbaseview->GetActualSlice();
+// _sliceZ = ((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->GetActualSlice();
+ }
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorManualPaint::OnLeftButtonUp()
+{
+ _state = false;
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorManualPaint::OnMouseMove ()
+{
+ printf("EED vtkInteractorManualPaint::OnMouseMove \n");
+ if (_state==true)
+ {
+ int px,py;
+ wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+ wxVTKRenderWindowInteractor *wxVTKiren = wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor();
+
+ wxVTKiren->GetEventPosition(px,py);
+
+ double X = (double)px;
+ double Y = (double)py;
+ double Z = _Z;
+ int typeView = 2;
+ wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z,false, typeView);
+
+// int px = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
+// int py = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+ printf("EED vtkInteractorManualPaint::OnMouseMove ----------------- %f %f %f\n", X,Y,Z);
+
+ PaintImage((int)X,(int)Y,(int)Z);
+
+ wxvtk2Dbaseview->Refresh();
+ wxvtk2Dbaseview->RefreshView();
+// wxvtk2Dbaseview->SetActualSlice(_Z+_auxZ);
+ _auxZ=(_auxZ+1)%2;
+ wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->Render();
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+// wxvtk2Dbaseview->SetActualSlice(Z);
+ }// if _state
+ return true;
+}
+
+//---------------------------------------------------------------------------
+void vtkInteractorManualPaint::SetImage(vtkImageData *image)
+{
+ _image = image;
+}
+
+
+void vtkInteractorManualPaint::PaintImage(int px,int py, int pz)
+{
+ if (_image!=NULL)
+ {
+ float value=0;
+ printf("EED vtkInteractorManualPaint::PaintImage %d %d %d\n", px,py,pz);
+ _image->SetScalarComponentFromFloat (px,py,pz, 0, value );
+ _image->Modified();
+ } else {
+ printf("ERROR : bbcreaMaracasvisu::vtkInteractorManualPaint::PaintImage : Image not set. \n");
+ }
+}
+
+
+
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+
+
+
+
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ManualPaint)
+BBTK_BLACK_BOX_IMPLEMENTATION(ManualPaint,bbtk::WxBlackBox);
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void ManualPaint::Process()
+{
+
+/*
+ std::string msg;
+ if (bbGetInputTitle()!="")
+ {
+ msg = bbGetInputTitle()+": " + bbGetInputIn();
+ }
+ else
+ {
+ msg = bbGetInputIn();
+ }
+ ((wxStaticText*)bbGetOutputWidget())->SetLabel( bbtk::std2wx( msg ) );
+ */
+
+ if (bbGetInputWxVtkBaseView()==NULL)
+ {
+ printf("WARNING : package creaMaracasVisu box ManualPaint : input WxVtkBaseView have to be defferent of NULL\n");
+ }
+
+ if (bbGetInputIn()==NULL)
+ {
+ printf("WARNING : package creaMaracasVisu box ManualPaint : input In (vtkImageData*) have to be defferent of NULL\n");
+ }
+
+
+ if (imp==NULL)
+ {
+ imp=new vtkInteractorManualPaint();
+ imp->SetImage( bbGetInputIn() );
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)(bbGetInputWxVtkBaseView()->GetInteractorStyleBaseView());
+ isbv->AddInteractorStyleMaracas(imp);
+ }
+
+}
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void ManualPaint::CreateWidget(wxWindow* parent)
+{
+
+ bbSetOutputWidget( new wxStaticText ( parent , -1 , _T("UPS") ) );
+
+}
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void ManualPaint::bbUserSetDefaultValues()
+{
+ imp=NULL;
+ bbSetInputIn(NULL);
+}
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void ManualPaint::bbUserInitializeProcessing()
+{
+
+}
+//=====
+// Don't edit this file. This file is generated from xml description..
+//=====
+void ManualPaint::bbUserFinalizeProcessing()
+{
+
+}
+
+} // EO namespace bbcreaMaracasVisu
+
+