From: Eduardo DAVILA Date: Thu, 13 Jan 2022 10:20:52 +0000 (+0100) Subject: #3478 PointPickerNearest X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=980386fede464fc81969cefaa099b2994d1d6ea0;p=creaVtk.git #3478 PointPickerNearest --- diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx index 869a8f7..3204378 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx @@ -10,12 +10,45 @@ namespace bbcreaVtk 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 center = _box->_boxcreavtkplanewidget.GetCenter(); + std::vector 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(); + + } } //---------------------------------------------------------------------------------------------- @@ -30,7 +63,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(PlaneWidget,bbtk::AtomicBlackBox); //===== 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 @@ -42,8 +74,6 @@ void PlaneWidget::Process() // (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 ); @@ -59,57 +89,76 @@ void PlaneWidget::Process() _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 diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.h b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.h index e32806b..b54d4e8 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.h @@ -22,8 +22,15 @@ class PlaneWidget; 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; }; @@ -36,18 +43,20 @@ class bbcreaVtk_EXPORT PlaneWidget //===== // 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); - BBTK_DECLARE_INPUT(NormalIn,std::vector); - BBTK_DECLARE_OUTPUT(Out,vtkDataSet*); - BBTK_DECLARE_OUTPUT(Center,std::vector); - BBTK_DECLARE_OUTPUT(Normal,std::vector); - 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); + BBTK_DECLARE_INPUT(NormalIn,std::vector); + BBTK_DECLARE_INPUT(ReactiveType,int); + + BBTK_DECLARE_OUTPUT(Out,vtkDataSet*); + BBTK_DECLARE_OUTPUT(Center,std::vector); + BBTK_DECLARE_OUTPUT(Normal,std::vector); + BBTK_PROCESS(Process); + void Process(); boxcreaVtkPlaneWidget _boxcreavtkplanewidget; @@ -71,6 +80,7 @@ BBTK_CATEGORY("empty"); BBTK_INPUT(PlaneWidget,Representation,"(default 1) 0:OutLine 1:Wireframe 2:Surface",int,""); BBTK_INPUT(PlaneWidget,Origin,"Origin [x,y,z]",std::vector,""); BBTK_INPUT(PlaneWidget,NormalIn,"Normal [x,y,z]",std::vector,""); + 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,""); diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPointPicker.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkPointPicker.cxx index df5424a..71fbe7e 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkPointPicker.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPointPicker.cxx @@ -28,6 +28,7 @@ void creaVtkCallbackPointPicker::setBox(PointPicker *box) void creaVtkCallbackPointPicker::Execute(vtkObject *caller, unsigned long, void*) { + printf("EED creaVtkCallbackPointPicker::Execute Start\n"); if (boxPointPicker!=NULL) { if (boxPointPicker->bbGetInputActive()==true) @@ -53,6 +54,8 @@ void creaVtkCallbackPointPicker::Execute(vtkObject *caller, unsigned long, void* 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) @@ -85,6 +88,9 @@ void creaVtkCallbackPointPicker::Execute(vtkObject *caller, unsigned long, void* } // if Active } // if boxPoiintPicker + printf("EED creaVtkCallbackPointPicker::Execute End\n"); + + /* { @@ -145,8 +151,6 @@ void creaVtkCallbackPointPicker::Execute(vtkObject *caller, unsigned long, void* } */ - - } @@ -162,7 +166,7 @@ BBTK_BLACK_BOX_IMPLEMENTATION(PointPicker,bbtk::AtomicBlackBox); //===== 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 @@ -196,10 +200,8 @@ void PointPicker::Process() picker->AddObserver( vtkCommand::MouseMoveEvent , callPicker ); bbGetInputRenderer()->GetRenderWindow()->GetInteractor()->SetPicker(picker); */ - callPicker = creaVtkCallbackPointPicker::New(); callPicker->setBox( this ); - } // if firsttime @@ -229,9 +231,23 @@ void PointPicker::Process() } // if bbGetInputRenderer() - +// std::vector 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) //===== @@ -242,6 +258,7 @@ void PointPicker::bbUserSetDefaultValues() // bbSetInputIn(0); bbSetInputActive(true); bbSetInputTypeEvent(0); + bbSetInputDefaultPointId( -1 ); bbSetOutputMesh(NULL); bbSetOutputPointId(-1); bbSetOutputCellId(-1); @@ -254,32 +271,29 @@ void PointPicker::bbUserSetDefaultValues() 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 diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPointPicker.h b/bbtk_creaVtk_PKG/src/bbcreaVtkPointPicker.h index 09fd1fa..d82c23d 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkPointPicker.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPointPicker.h @@ -49,20 +49,22 @@ class bbcreaVtk_EXPORT PointPicker //===== // 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); - BBTK_DECLARE_OUTPUT(Mesh,vtkProp3D*); - BBTK_DECLARE_OUTPUT(PointId,longInt); - BBTK_DECLARE_OUTPUT(CellId,longInt); - BBTK_DECLARE_OUTPUT(Normal,std::vector); - 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); + BBTK_DECLARE_OUTPUT(Point,std::vector); + BBTK_DECLARE_OUTPUT(Mesh,vtkProp3D*); + BBTK_DECLARE_OUTPUT(PointId,longInt); + BBTK_DECLARE_OUTPUT(CellId,longInt); + BBTK_DECLARE_OUTPUT(Normal,std::vector); + 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) @@ -70,21 +72,23 @@ class bbcreaVtk_EXPORT PointPicker }; 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,""); - 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,""); + 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,""); + + BBTK_OUTPUT(PointPicker,Point,"Point [x,y,z])",std::vector,""); + 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,""); BBTK_END_DESCRIBE_BLACK_BOX(PointPicker); //===== diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPointPickerNearest.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkPointPickerNearest.cxx index e7534a0..fc2442a 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkPointPickerNearest.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPointPickerNearest.cxx @@ -31,10 +31,13 @@ void PointPickerNearest::Process() // * 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 lstNormal; std::vector refPoint = bbGetInputPoint(); + printf ("EED PointPickerNearest::Process 1\n"); + if ((bbGetInputActive()==true) && ( bbGetInputMesh()!=NULL) && (refPoint.size()==3) ) { double p[3]; @@ -45,6 +48,7 @@ void PointPickerNearest::Process() vtkPoints *points = bbGetInputMesh()->GetPoints(); long size = points->GetNumberOfPoints(); double border = bbGetInputBorder() * bbGetInputBorder(); + printf ("EED PointPickerNearest::Process 2\n"); for ( i=0 ; iGetPoint(i,p); @@ -61,6 +65,7 @@ void PointPickerNearest::Process() } // if distMax } // for i + printf ("EED PointPickerNearest::Process 3\n"); if (iBack>=0) { vtkPointData *pointdata = bbGetInputMesh()->GetPointData(); @@ -74,10 +79,12 @@ void PointPickerNearest::Process() 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]); @@ -85,10 +92,27 @@ void PointPickerNearest::Process() } // if iBack bbSetOutputPointId( iBack ); bbSetOutputNormal( lstNormal ); + printf ("EED PointPickerNearest::Process 6 %ld\n", iBack); + std::vector 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) @@ -100,7 +124,7 @@ void PointPickerNearest::bbUserSetDefaultValues() // 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) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPointPickerNearest.h b/bbtk_creaVtk_PKG/src/bbcreaVtkPointPickerNearest.h index 988829e..33f34b1 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkPointPickerNearest.h +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPointPickerNearest.h @@ -29,6 +29,7 @@ class bbcreaVtk_EXPORT PointPickerNearest BBTK_DECLARE_INPUT(Mesh,vtkPolyData*); BBTK_DECLARE_INPUT(Border,double); BBTK_DECLARE_OUTPUT(PointId,longInt); + BBTK_DECLARE_OUTPUT(PointOut,std::vector); BBTK_DECLARE_OUTPUT(Normal,std::vector); BBTK_PROCESS(Process); void Process(); @@ -45,8 +46,9 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(PointPickerNearest,bbtk::AtomicBlackBox); BBTK_INPUT(PointPickerNearest,Active,"(default false) true/false",bool,""); BBTK_INPUT(PointPickerNearest,Point,"Point [x,y,z]",std::vector,""); 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,""); BBTK_OUTPUT(PointPickerNearest,Normal,"Normal [nx,ny,nz]",std::vector,""); BBTK_END_DESCRIBE_BLACK_BOX(PointPickerNearest); //===== diff --git a/lib/creaVtk/creaVtkPlaneWidget.cpp b/lib/creaVtk/creaVtkPlaneWidget.cpp index 3750454..865343c 100644 --- a/lib/creaVtk/creaVtkPlaneWidget.cpp +++ b/lib/creaVtk/creaVtkPlaneWidget.cpp @@ -166,9 +166,21 @@ void creaVtkPlaneWidget::SetNormalIn(std::vector normalin) //------------------------------------------------------------------------ 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 @@ -184,9 +196,9 @@ void creaVtkPlaneWidget::Process() 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] ); @@ -204,6 +216,11 @@ void creaVtkPlaneWidget::Process() _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 {