X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk_creaVtk_PKG%2Fsrc%2FbbcreaVtkPlaneWidget.cxx;h=f45306d2d509adad819bbbe7ddb3797cae84c913;hb=464deff51f697881cd76b3cfb934859cd7c31df7;hp=59b6821714f9a7f0f98551f6f70108c86221b4ca;hpb=c8eb318ae1cd9de7827e1d44fbcbb2b18a85fad9;p=creaVtk.git diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx index 59b6821..f45306d 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkPlaneWidget.cxx @@ -10,13 +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(); + + } } //---------------------------------------------------------------------------------------------- @@ -31,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 @@ -43,58 +74,90 @@ 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') - - _boxcreavtkplanewidget.SetActive( bbGetInputActive() ); - _boxcreavtkplanewidget.SetImage( bbGetInputIn() ); - _boxcreavtkplanewidget.SetResolution( bbGetInputResolution() ); - _boxcreavtkplanewidget.SetRenderer( bbGetInputRenderer() ); - _boxcreavtkplanewidget.Process(); - bbSetOutputOut( _boxcreavtkplanewidget.GetPlaneSource()->GetOutput() ); - bbSetOutputCenter( _boxcreavtkplanewidget.GetCenter() ); - bbSetOutputNormal( _boxcreavtkplanewidget.GetNormal() ); + if ((bbGetInputIn()==NULL) || (bbGetInputRenderer()==NULL)) + { + bbSetOutputOut( NULL ); + std::vector center; + std::vector normal; + bbSetOutputCenter( center ); + bbSetOutputNormal( normal ); + } else { + _boxcreavtkplanewidget.SetActive( bbGetInputActive() ); + _boxcreavtkplanewidget.SetImage( bbGetInputIn() ); + _boxcreavtkplanewidget.SetResolution( bbGetInputResolution() ); + _boxcreavtkplanewidget.SetRenderer( bbGetInputRenderer() ); + _boxcreavtkplanewidget.SetRepresentation( bbGetInputRepresentation() ); + _boxcreavtkplanewidget.SetOrigin( bbGetInputOrigin() ); + _boxcreavtkplanewidget.SetNormalIn( bbGetInputNormalIn() ); + _boxcreavtkplanewidget._ReactiveType=bbGetInputReactiveType(); + _boxcreavtkplanewidget.Process(); + + bbSetOutputOut( _boxcreavtkplanewidget.GetPlaneSource()->GetOutput() ); + bbSetOutputCenter( _boxcreavtkplanewidget.GetCenter() ); + bbSetOutputNormal( _boxcreavtkplanewidget.GetNormal() ); + bbSetOutputBase( &_boxcreavtkplanewidget ); + int sizeN = bbGetInputOrigin().size(); + int sizeC = _boxcreavtkplanewidget.GetCenter().size(); + if (sizeN==3) + { + double nx = bbGetInputOrigin()[0]; + double ny = bbGetInputOrigin()[1]; + double nz = bbGetInputOrigin()[2]; + } // if sizeN + if (sizeC==3) + { + double cx =_boxcreavtkplanewidget.GetCenter()[0]; + double cy =_boxcreavtkplanewidget.GetCenter()[1]; + double cz =_boxcreavtkplanewidget.GetCenter()[2]; + } // if sizeC + } // If In Renderer } + //===== // 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); - 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); + bbSetOutputBase(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