]> Creatis software - creaVtk.git/commitdiff
#3478 PointPickerNearest
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Thu, 13 Jan 2022 10:20:52 +0000 (11:20 +0100)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Thu, 13 Jan 2022 10:20:52 +0000 (11:20 +0100)
bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.h
bbtk_creaVtk_PKG/src/bbcreaVtkPointPicker.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkPointPicker.h
bbtk_creaVtk_PKG/src/bbcreaVtkPointPickerNearest.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkPointPickerNearest.h
lib/creaVtk/creaVtkPlaneWidget.cpp

index 869a8f7e58c20346ef43798a1568d4b0db629ec0..32043789232fbf01d68a5fe662e559e62019a8c7 100644 (file)
@@ -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<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();
+
+    }
 }
 
 //----------------------------------------------------------------------------------------------
@@ -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
 
 
index e32806bb23a31e2d021fc93d257e00ba0b9c3ab2..b54d4e869c352a9102ca0f398063a981748464f1 100644 (file)
@@ -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<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;
 
@@ -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<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>,"");
index df5424ab152ed95d99f140e8ea13792b1efb7d06..71fbe7ef000a4d14d5dc437c0d6a932bcadf4594 100644 (file)
@@ -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<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)
 //===== 
@@ -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
 
 
index 09fd1fa99ce01f46110ccfc72e10868d84c1c9d3..d82c23d796f646054aa0534db37dddcc5bb46263 100644 (file)
@@ -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<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)
@@ -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<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);
 //===== 
index e7534a069ab55cb9b223f1a665fa9e9c9556a7f5..fc2442a9977d9e9066fa24d9500a06ab067498d8 100644 (file)
@@ -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<double> lstNormal;
     std::vector<double> 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 ; i<size ; i++)
         {
             points->GetPoint(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<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)
@@ -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)
index 988829e659bf2597a15377b61a6607ede47f8388..33f34b16b7083007fcd1f30cd4233fe5d928875c 100644 (file)
@@ -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<double>);
     BBTK_DECLARE_OUTPUT(Normal,std::vector<double>);
     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<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);
 //===== 
index 3750454dce5ba29f57bbcf7c60af09d0ed4334d0..865343ca552614f7654a96497f92dc51f009754b 100644 (file)
@@ -166,9 +166,21 @@ void creaVtkPlaneWidget::SetNormalIn(std::vector<double> 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 {