void boxcreaVtkPlaneWidget::Execute() // virutal
{
- box->bbSetOutputOut( box->_boxcreavtkplanewidget.GetPlaneSource()->GetOutput() );
- box->bbSignalOutputModification(std::string("Out"));
- box->bbSetOutputCenter( box->_boxcreavtkplanewidget.GetCenter() );
- box->bbSignalOutputModification(std::string("Center"));
- box->bbSetOutputNormal( box->_boxcreavtkplanewidget.GetNormal() );
- box->bbSignalOutputModification(std::string("Normal"));
+ std::vector<double> center = _box->_boxcreavtkplanewidget.GetCenter();
+ std::vector<double> normal = _box->_boxcreavtkplanewidget.GetNormal();
+ double delta = 0.00000001;
+ bool ok = false;
+
+ // 0 Center and Normal change
+ // 1 Center change
+ // 2 Normal change
+ if ( (_ReactiveType==0) || (_ReactiveType==1) )
+ {
+ if (abs(_cxBack-center[0])>delta ) ok=true;
+ if (abs(_cyBack-center[1])>delta ) ok=true;
+ if (abs(_czBack-center[2])>delta ) ok=true;
+ }// if ReacitivityType 1 3
+ if ( (_ReactiveType==0) || (_ReactiveType==2) )
+ {
+ if (abs(_nxBack-normal[0])>delta ) ok=true;
+ if (abs(_nyBack-normal[1])>delta ) ok=true;
+ if (abs(_nzBack-normal[2])>delta ) ok=true;
+ }// if ReacitivityType 2 3
+
+ if ( ok==true )
+ {
+ _cxBack = center[0];
+ _cyBack = center[1];
+ _czBack = center[2];
+ _nxBack = normal[0];
+ _nyBack = normal[1];
+ _nzBack = normal[2];
+ _box->bbSetOutputOut( _box->_boxcreavtkplanewidget.GetPlaneSource()->GetOutput() );
+ _box->bbSetOutputCenter( center );
+ _box->bbSetOutputNormal( normal );
+//EED 2022-01-08
+// _box->bbSignalOutputModification(std::string("Out"));
+// _box->bbSignalOutputModification(std::string("Center"));
+// _box->bbSignalOutputModification(std::string("Normal"));
+ _box->bbSignalOutputModification();
+
+ }
}
//----------------------------------------------------------------------------------------------
//=====
void PlaneWidget::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')
-
-
if ((bbGetInputIn()==NULL) || (bbGetInputRenderer()==NULL))
{
bbSetOutputOut( NULL );
_boxcreavtkplanewidget.SetRepresentation( bbGetInputRepresentation() );
_boxcreavtkplanewidget.SetOrigin( bbGetInputOrigin() );
_boxcreavtkplanewidget.SetNormalIn( bbGetInputNormalIn() );
+ _boxcreavtkplanewidget._ReactiveType=bbGetInputReactiveType();
_boxcreavtkplanewidget.Process();
bbSetOutputOut( _boxcreavtkplanewidget.GetPlaneSource()->GetOutput() );
bbSetOutputCenter( _boxcreavtkplanewidget.GetCenter() );
bbSetOutputNormal( _boxcreavtkplanewidget.GetNormal() );
+ int sizeN=bbGetInputOrigin().size();
+ int sizeC=_boxcreavtkplanewidget.GetCenter().size();
+ printf("EED PlaneWidget::Process OriginIn.size=%d CenterOut.size=%d \n", sizeN, sizeC);
+ if (sizeN==3)
+ {
+ double nx = bbGetInputOrigin()[0];
+ double ny = bbGetInputOrigin()[1];
+ double nz = bbGetInputOrigin()[2];
+ printf("EED PlaneWidget::Process OriginIn=%f %f %f \n", nx,ny,nz);
+ }
+ if (sizeC==3)
+ {
+ double cx =_boxcreavtkplanewidget.GetCenter()[0];
+ double cy =_boxcreavtkplanewidget.GetCenter()[1];
+ double cz =_boxcreavtkplanewidget.GetCenter()[2];
+ printf("EED PlaneWidget::Process CenterOut=%f %f %f \n", cx,cy,cz);
+ }
}
-
}
+
//=====
// 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 PlaneWidget::bbUserSetDefaultValues()
{
-
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
-
- bbSetInputActive(false);
- bbSetInputIn(NULL);
- bbSetInputResolution(60);
- bbSetInputRepresentation(1);
- bbSetInputRenderer(NULL);
- bbSetOutputOut(NULL);
- _boxcreavtkplanewidget.box = this;
+ _boxcreavtkplanewidget._box = this;
+ _boxcreavtkplanewidget._cxBack = -10000000;
+ _boxcreavtkplanewidget._cyBack = -10000000;
+ _boxcreavtkplanewidget._czBack = -10000000;
+ _boxcreavtkplanewidget._ReactiveType = 0;
+
+ bbSetInputActive(false);
+ bbSetInputIn(NULL);
+ bbSetInputResolution(60);
+ bbSetInputRepresentation(1);
+ bbSetInputRenderer(NULL);
+ bbSetInputReactiveType( _boxcreavtkplanewidget._ReactiveType );
+ bbSetOutputOut(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 PlaneWidget::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 PlaneWidget::bbUserFinalizeProcessing()
{
-
// THE FINALIZATION METHOD BODY :
// Here does nothing
// but this is where you should desallocate the internal/output pointers
// if any
-
}
-}// EO namespace bbcreaVtk
+} // EO namespace bbcreaVtk
class boxcreaVtkPlaneWidget : public creaVtkPlaneWidget
{
public:
- virtual void Execute();
- PlaneWidget *box;
+ virtual void Execute();
+ PlaneWidget *_box;
+ int _ReactiveType;
+ double _cxBack; // center
+ double _cyBack;
+ double _czBack;
+ double _nxBack; // normal
+ double _nyBack;
+ double _nzBack;
};
//=====
// 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(Active,bool);
- BBTK_DECLARE_INPUT(In,vtkImageData*);
- BBTK_DECLARE_INPUT(Resolution,int);
- BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
- BBTK_DECLARE_INPUT(Representation,int);
- BBTK_DECLARE_INPUT(Origin,std::vector<double>);
- BBTK_DECLARE_INPUT(NormalIn,std::vector<double>);
- BBTK_DECLARE_OUTPUT(Out,vtkDataSet*);
- BBTK_DECLARE_OUTPUT(Center,std::vector<double>);
- BBTK_DECLARE_OUTPUT(Normal,std::vector<double>);
- BBTK_PROCESS(Process);
- void Process();
+ BBTK_DECLARE_INPUT(Active,bool);
+ BBTK_DECLARE_INPUT(In,vtkImageData*);
+ BBTK_DECLARE_INPUT(Resolution,int);
+ BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
+ BBTK_DECLARE_INPUT(Representation,int);
+ BBTK_DECLARE_INPUT(Origin,std::vector<double>);
+ BBTK_DECLARE_INPUT(NormalIn,std::vector<double>);
+ BBTK_DECLARE_INPUT(ReactiveType,int);
+
+ BBTK_DECLARE_OUTPUT(Out,vtkDataSet*);
+ BBTK_DECLARE_OUTPUT(Center,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Normal,std::vector<double>);
+ BBTK_PROCESS(Process);
+ void Process();
boxcreaVtkPlaneWidget _boxcreavtkplanewidget;
BBTK_INPUT(PlaneWidget,Representation,"(default 1) 0:OutLine 1:Wireframe 2:Surface",int,"");
BBTK_INPUT(PlaneWidget,Origin,"Origin [x,y,z]",std::vector<double>,"");
BBTK_INPUT(PlaneWidget,NormalIn,"Normal [x,y,z]",std::vector<double>,"");
+ BBTK_INPUT(PlaneWidget,ReactiveType,"(default 0) 0=Centar and Normal change 1=Center change 2=Normal change",int,"");
BBTK_OUTPUT(PlaneWidget,Out,"Dynamic plane result from vtkPlaneSource",vtkDataSet*,"");
BBTK_OUTPUT(PlaneWidget,Center,"Center of the plane",std::vector<double>,"");
void creaVtkCallbackPointPicker::Execute(vtkObject *caller, unsigned long, void*)
{
+ printf("EED creaVtkCallbackPointPicker::Execute Start\n");
if (boxPointPicker!=NULL)
{
if (boxPointPicker->bbGetInputActive()==true)
boxPointPicker->bbSetOutputPoint( vecPoint );
boxPointPicker->bbSetOutputMesh( picker->GetProp3D() );
boxPointPicker->bbSetOutputPointId( picker->GetPointId() );
+ printf("EED creaVtkCallbackPointPicker::Execute PointId %ld\n", picker->GetPointId() );
+
boxPointPicker->bbSetOutputCellId( picker->GetCellId() );
vtkDataSet *dataset = picker->GetDataSet();
if (strcmp(dataset->GetClassName(),"vtkPolyData")==0)
} // if Active
} // if boxPoiintPicker
+ printf("EED creaVtkCallbackPointPicker::Execute End\n");
+
+
/*
{
}
*/
-
-
}
//=====
void PointPicker::Process()
{
-
+ printf("EED PointPicker::Process Start \n");
// THE MAIN PROCESSING METHOD BODY
// Here we simply set the input 'In' value to the output 'Out'
// And print out the output value
picker->AddObserver( vtkCommand::MouseMoveEvent , callPicker );
bbGetInputRenderer()->GetRenderWindow()->GetInteractor()->SetPicker(picker);
*/
-
callPicker = creaVtkCallbackPointPicker::New();
callPicker->setBox( this );
-
} // if firsttime
} // if bbGetInputRenderer()
-
+// std::vector<double> lstPoint;
+// lstPoint.push_back(0);
+// lstPoint.push_back(0);
+// lstPoint.push_back(1);
+// bbSetOutputPoint( lstPoint );
+
+// BORRAME bbSetOutputPoint( bbGetInputDefaultPoint() );
+
+// bbSetOutputMesh( NULL );
+// Borrame bbSetOutputPointId( bbGetInputDefaultPointId() );
+// bbSetOutputCellId( -1 );
+// bbSetOutputNormal( lstPoint );
+
+ printf("EED PointPicker::Process End \n");
}
+
//=====
// 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)
//=====
// bbSetInputIn(0);
bbSetInputActive(true);
bbSetInputTypeEvent(0);
+ bbSetInputDefaultPointId( -1 );
bbSetOutputMesh(NULL);
bbSetOutputPointId(-1);
bbSetOutputCellId(-1);
lstNormal.push_back(1);
bbSetOutputNormal( lstNormal );
}
+
//=====
// 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 PointPicker::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 PointPicker::bbUserFinalizeProcessing()
{
-
// THE FINALIZATION METHOD BODY :
// Here does nothing
// but this is where you should desallocate the internal/output pointers
// if any
-
}
-}
-// EO namespace bbcreaVtk
+
+}// EO namespace bbcreaVtk
//=====
// 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(Active,bool);
- BBTK_DECLARE_INPUT(TypeEvent,int );
- BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
- BBTK_DECLARE_INPUT(Prop3D,vtkProp3D*);
- BBTK_DECLARE_OUTPUT(Point,std::vector<double>);
- BBTK_DECLARE_OUTPUT(Mesh,vtkProp3D*);
- BBTK_DECLARE_OUTPUT(PointId,longInt);
- BBTK_DECLARE_OUTPUT(CellId,longInt);
- BBTK_DECLARE_OUTPUT(Normal,std::vector<double>);
- BBTK_PROCESS(Process);
- void Process();
-
- bool firsttime;
- creaVtkCallbackPointPicker *callPicker;
+ BBTK_DECLARE_INPUT(Active,bool);
+ BBTK_DECLARE_INPUT(TypeEvent,int );
+ BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
+ BBTK_DECLARE_INPUT(Prop3D,vtkProp3D*);
+ BBTK_DECLARE_INPUT(DefaultPointId,longInt);
+ BBTK_DECLARE_INPUT(DefaultPoint,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Point,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Mesh,vtkProp3D*);
+ BBTK_DECLARE_OUTPUT(PointId,longInt);
+ BBTK_DECLARE_OUTPUT(CellId,longInt);
+ BBTK_DECLARE_OUTPUT(Normal,std::vector<double>);
+ BBTK_PROCESS(Process);
+ void Process();
+
+ bool firsttime;
+ creaVtkCallbackPointPicker *callPicker;
//=====
// 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(PointPicker,bbtk::AtomicBlackBox);
- BBTK_NAME("PointPicker");
- BBTK_AUTHOR("InfoDev");
- BBTK_DESCRIPTION("No Description.");
- BBTK_CATEGORY("empty");
-
- BBTK_INPUT(PointPicker,Active,"(true default) true/false",bool,"");
- BBTK_INPUT(PointPicker,TypeEvent,"(0 default) 0:NOTHING, 1:MouseMoveEvent 2:LeftButtonPressEvent 3:LeftButtonDoubleClickEvent",int,"");
- BBTK_INPUT(PointPicker,Renderer,"vtk Renderer",vtkRenderer*,"");
- BBTK_INPUT(PointPicker,Prop3D,"vtkProp3D de reference. If this parameter is empty all actors in the render are used",vtkProp3D*,"");
-
- BBTK_OUTPUT(PointPicker,Point,"Point [x,y,z])",std::vector<double>,"");
- BBTK_OUTPUT(PointPicker,Mesh,"Mesh",vtkProp3D*,"");
- BBTK_OUTPUT(PointPicker,PointId,"Mesh point Id",longInt,"");
- BBTK_OUTPUT(PointPicker,CellId,"Mesh cell Id",longInt,"");
- BBTK_OUTPUT(PointPicker,Normal,"Normal [nx,ny,nz]",std::vector<double>,"");
+ BBTK_NAME("PointPicker");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(PointPicker,Active,"(true default) true/false",bool,"");
+ BBTK_INPUT(PointPicker,TypeEvent,"(0 default) 0:NOTHING, 1:MouseMoveEvent 2:LeftButtonPressEvent 3:LeftButtonDoubleClickEvent",int,"");
+ BBTK_INPUT(PointPicker,Renderer,"vtk Renderer",vtkRenderer*,"");
+ BBTK_INPUT(PointPicker,Prop3D,"vtkProp3D de reference. If this parameter is empty all actors in the render are used",vtkProp3D*,"");
+ BBTK_INPUT(PointPicker,DefaultPointId,"Default Point Id",longInt,"");
+ BBTK_INPUT(PointPicker,DefaultPoint,"Default Point",std::vector<double>,"");
+
+ BBTK_OUTPUT(PointPicker,Point,"Point [x,y,z])",std::vector<double>,"");
+ BBTK_OUTPUT(PointPicker,Mesh,"Mesh",vtkProp3D*,"");
+ BBTK_OUTPUT(PointPicker,PointId,"Mesh point Id",longInt,"");
+ BBTK_OUTPUT(PointPicker,CellId,"Mesh cell Id",longInt,"");
+ BBTK_OUTPUT(PointPicker,Normal,"Normal [nx,ny,nz]",std::vector<double>,"");
BBTK_END_DESCRIBE_BLACK_BOX(PointPicker);
//=====
// * TYPE is the C++ type of the input/output
// (the one provided in the attribute 'type' of the tag 'input')
+ printf ("EED PointPickerNearest::Process Start\n");
std::vector<double> lstNormal;
std::vector<double> refPoint = bbGetInputPoint();
+ printf ("EED PointPickerNearest::Process 1\n");
+
if ((bbGetInputActive()==true) && ( bbGetInputMesh()!=NULL) && (refPoint.size()==3) )
{
double p[3];
vtkPoints *points = bbGetInputMesh()->GetPoints();
long size = points->GetNumberOfPoints();
double border = bbGetInputBorder() * bbGetInputBorder();
+ printf ("EED PointPickerNearest::Process 2\n");
for ( i=0 ; i<size ; i++)
{
points->GetPoint(i,p);
} // if distMax
} // for i
+ printf ("EED PointPickerNearest::Process 3\n");
if (iBack>=0)
{
vtkPointData *pointdata = bbGetInputMesh()->GetPointData();
printf("EED creaVtkCallbackPointPicker::Execute dataarray=%s n=%ld p=%ld\n", dataarray->GetName(),dataarray->GetNumberOfValues() ,polydata->GetNumberOfPoints() );
} // for i
*/
+ printf ("EED PointPickerNearest::Process 4\n");
dataarray = pointdata->GetNormals();
if (dataarray!=NULL)
{
pValue = dataarray->GetTuple3( iBack );
+ printf ("EED PointPickerNearest::Process 5\n");
lstNormal.push_back(pValue[0]);
lstNormal.push_back(pValue[1]);
lstNormal.push_back(pValue[2]);
} // if iBack
bbSetOutputPointId( iBack );
bbSetOutputNormal( lstNormal );
+ printf ("EED PointPickerNearest::Process 6 %ld\n", iBack);
+ std::vector<double> lstPointOut;
+ if (iBack>=0){
+ points->GetPoint(iBack,p);
+ lstPointOut.push_back(p[0]);
+ lstPointOut.push_back(p[1]);
+ lstPointOut.push_back(p[2]);
+ printf ("EED PointPickerNearest::Process 7 pointOut=%f %f %f\n", lstPointOut[0],lstPointOut[1],lstPointOut[2]);
+ }// if iBack
+ bbSetOutputPointOut( lstPointOut );
} else {
bbSetOutputPointId( -1 );
+ lstNormal.push_back(0);
+ lstNormal.push_back(1);
+ lstNormal.push_back(2);
bbSetOutputNormal( lstNormal );
+ bbSetOutputPointOut( bbGetInputPoint() );
}
+
+ printf ("EED PointPickerNearest::Process END\n");
+
}
//=====
// 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)
// Here we initialize the input 'In' to 0
bbSetInputActive(false);
bbSetInputMesh(NULL);
- bbSetInputBorder(10);
+ bbSetInputBorder(5);
}
//=====
// 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(Mesh,vtkPolyData*);
BBTK_DECLARE_INPUT(Border,double);
BBTK_DECLARE_OUTPUT(PointId,longInt);
+ BBTK_DECLARE_OUTPUT(PointOut,std::vector<double>);
BBTK_DECLARE_OUTPUT(Normal,std::vector<double>);
BBTK_PROCESS(Process);
void Process();
BBTK_INPUT(PointPickerNearest,Active,"(default false) true/false",bool,"");
BBTK_INPUT(PointPickerNearest,Point,"Point [x,y,z]",std::vector<double>,"");
BBTK_INPUT(PointPickerNearest,Mesh,"Mesh polyData",vtkPolyData*,"");
- BBTK_INPUT(PointPickerNearest,Border,"(default 10) Distance max to be acvive",double,"");
+ BBTK_INPUT(PointPickerNearest,Border,"(default 5) Distance max to be acvive",double,"");
BBTK_OUTPUT(PointPickerNearest,PointId,"Mesh point Id ",longInt,"");
+ BBTK_OUTPUT(PointPickerNearest,PointOut,"Out Point [x,y,z]",std::vector<double>,"");
BBTK_OUTPUT(PointPickerNearest,Normal,"Normal [nx,ny,nz]",std::vector<double>,"");
BBTK_END_DESCRIBE_BLACK_BOX(PointPickerNearest);
//=====
//------------------------------------------------------------------------
void creaVtkPlaneWidget::Process()
-{
- if ((GetActive()==true) && (GetRenderer()!=NULL))
- {
+{
+ if ((GetActive()==true) && (GetRenderer()!=NULL))
+ {
+ if (_origin.size()==0)
+ {
+ _origin.push_back(0);
+ _origin.push_back(0);
+ _origin.push_back(0);
+ }
+ if (_origin.size()==0)
+ {
+ _normalin.push_back(0);
+ _normalin.push_back(0);
+ _normalin.push_back(1);
+ }
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
if (_representation==1){ _vPlaneWidget->SetRepresentationToWireframe(); }
if (_representation==2){ _vPlaneWidget->SetRepresentationToSurface(); }
_vPlaneWidget->SetPlaceFactor(1); //defini zoom initial
- _vPlaneWidget->SetHandleSize(0.01);
+ _vPlaneWidget->SetHandleSize(0.001);
_vPlaneWidget->On();
- _vPlaneWidget->Print(std::cout);
+// _vPlaneWidget->Print(std::cout);
if (_origin.size()==3)
{
_vPlaneWidget->SetCenter( _origin[0] , _origin[1] , _origin[2] );
_vPlaneWidget->AddObserver( vtkCommand::InteractionEvent , creavtkcallbackplanewidget );
_vPlaneWidget->AddObserver( vtkCommand::StartInteractionEvent , creavtkcallbackplanewidget );
_vPlaneWidget->AddObserver( vtkCommand::EnableEvent , creavtkcallbackplanewidget );
+
+ _vPlaneWidget->SetOrigin( _origin[0] , _origin[1] , _origin[2] );
+ _vPlaneWidget->SetPoint1( _origin[0]+20 , _origin[1] , _origin[2] );
+ _vPlaneWidget->SetPoint2( _origin[0] , _origin[1]+20 , _origin[2] );
+
}
UpdatePlane();
} else {