2 // 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)
4 #include "bbcreaVtkBoxWidget.h"
5 #include "bbcreaVtkPackage.h"
7 #include "vtkRenderWindow.h"
8 #include "vtkCommand.h"
14 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,BoxWidget)
15 BBTK_BLACK_BOX_IMPLEMENTATION(BoxWidget,bbtk::AtomicBlackBox);
17 // 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)
20 class bbBoxWidgetCallback : public vtkCommand
24 static bbBoxWidgetCallback *New()
26 return new bbBoxWidgetCallback;
28 void SetBox( BoxWidget* box )
33 void Execute(vtkObject *caller, unsigned long, void*) override
35 vtkBoxWidget *vtkwidget = reinterpret_cast<vtkBoxWidget*>(caller);
36 vtkwidget->GetPlanes( _box->planes );
37 _box->bbSignalOutputModification(std::string("ImplicitFunction"));
43 void BoxWidget::Process()
46 // THE MAIN PROCESSING METHOD BODY
47 // Here we simply set the input 'In' value to the output 'Out'
48 // And print out the output value
49 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
50 // void bbSet{Input|Output}NAME(const TYPE&)
51 // const TYPE& bbGet{Input|Output}NAME() const
53 // * NAME is the name of the input/output
54 // (the one provided in the attribute 'name' of the tag 'input')
55 // * TYPE is the C++ type of the input/output
56 // (the one provided in the attribute 'type' of the tag 'input')
57 // bbSetOutputOut( bbGetInputIn() );
58 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
61 if ( bbGetInputRenderer()!=NULL )
66 boxWidget = vtkBoxWidget::New();
67 planes = vtkPlanes::New();
68 boxWidget->SetInteractor( bbGetInputRenderer()->GetRenderWindow()->GetInteractor() );
69 boxWidget->SetPlaceFactor(1.25);
70 if (bbGetInputImageInitSize()!=NULL)
73 bbGetInputImageInitSize()->GetExtent( ext );
75 bbGetInputImageInitSize()->GetSpacing( spc );
76 boxWidget->PlaceWidget( ext[0]*spc[0] , ext[1]*spc[0] , ext[2]*spc[1] , ext[3]*spc[1] , ext[4]*spc[2] , ext[5]*spc[2] );
78 boxWidget->PlaceWidget(0,500,0,500,0,500);
80 boxWidget->GetPlanes( planes );
83 // boxWidget->SetProp3D(coneActor);
84 bbBoxWidgetCallback *callback = bbBoxWidgetCallback::New();
85 callback->SetBox( this );
86 boxWidget->AddObserver(vtkCommand::InteractionEvent, callback);
88 if (bbGetInputActive()==true)
94 bbSetOutputImplicitFunction( planes );
96 printf("EED Warnning! BoxWidget::Process vtkRenderer not set.\n");
97 }// vtkRenderer != NULL
101 // 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)
103 void BoxWidget::bbUserSetDefaultValues()
106 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
107 // Here we initialize the input 'In' to 0
109 bbSetInputRenderer(NULL);
110 bbSetInputActive( false );
111 bbSetInputImageInitSize(NULL);
114 // 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)
116 void BoxWidget::bbUserInitializeProcessing()
119 // THE INITIALIZATION METHOD BODY :
121 // but this is where you should allocate the internal/output pointers
127 // 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)
129 void BoxWidget::bbUserFinalizeProcessing()
132 // THE FINALIZATION METHOD BODY :
134 // but this is where you should desallocate the internal/output pointers
139 // EO namespace bbcreaVtk