From: eduardo.davila@creatis.insa-lyon.fr Date: Thu, 12 Oct 2023 10:42:16 +0000 (+0200) Subject: #3519 Render_Tool box X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=04f142810003e7e5b286c5a75ed26e25e55dfcc5;p=creaVtk.git #3519 Render_Tool box --- diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleRender_Tools-ResetCamera.bbg b/bbtk_creaVtk_PKG/bbs/appli/exampleRender_Tools-ResetCamera.bbg new file mode 100644 index 0000000..172e8fc --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleRender_Tools-ResetCamera.bbg @@ -0,0 +1,116 @@ +# ---------------------------------- +# - BBTKGEditor v 1.5 BBG BlackBox Diagram file +# - /Users/davila/Creatis/C23/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleRender_Tools-ResetCamera.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:10 +BOX +creaMaracasVisu:ViewerNV:Box00 +ISEXEC:FALSE +-47.910685:19.378299:-900.000000 +-7.550685:16.878299:-900.000000 +PORT +nTypeView:"7" +FIN_BOX +BOX +vtk:LoadHola:Box01 +ISEXEC:FALSE +-42.643637:29.563153:-900.000000 +-21.093637:27.063153:-900.000000 +FIN_BOX +BOX +vtk:SphereSource:Box02 +ISEXEC:FALSE +-83.290038:4.850602:-900.000000 +-61.305038:2.350602:-900.000000 +FIN_BOX +BOX +vtk:PolyDataToActor:Box03 +ISEXEC:FALSE +-82.533037:-2.284284:-900.000000 +-54.493037:-4.784284:-900.000000 +FIN_BOX +BOX +wx:LayoutSplit:Box04 +ISEXEC:TRUE +-28.782985:-53.368279:-900.000000 +-6.022985:-55.868279:-900.000000 +PORT +Orientation:"H" +PORT +Proportion:"10" +FIN_BOX +BOX +wx:LayoutLine:Box05 +ISEXEC:FALSE +-74.267056:-39.314205:-900.000000 +-40.947056:-41.814205:-900.000000 +FIN_BOX +BOX +vtk:UpdateRender:Box07 +ISEXEC:FALSE +-57.413577:-20.418605:-900.000000 +-35.388577:-22.918605:-900.000000 +PORT +Active:"true" +FIN_BOX +BOX +std:MultipleInputs:Box10 +ISEXEC:TRUE +4.853964:-53.312289:-900.000000 +26.823964:-55.812289:-900.000000 +FIN_BOX +BOX +creaVtk:Render_Tools:Box11 +ISEXEC:FALSE +-56.437150:-13.826782:-900.000000 +-34.537150:-16.326782:-900.000000 +PORT +Type:"20" +FIN_BOX +BOX +wx:OutputText:Box13 +ISEXEC:FALSE +-69.575005:-33.593609:-900.000000 +-47.905005:-36.093609:-900.000000 +PORT +In:"Test" +FIN_BOX +CONNECTIONS:10 +CONNECTION +Box01:Out:Box00:In +NumberOfControlPoints:0 +CONNECTION +Box02:Out:Box03:In +NumberOfControlPoints:0 +CONNECTION +Box00:Renderer1:Box03:Renderer +NumberOfControlPoints:0 +CONNECTION +Box00:Widget:Box04:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box05:Widget:Box04:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box03:BoxChange:Box11:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box00:Renderer1:Box11:Renderer +NumberOfControlPoints:0 +CONNECTION +Box11:BoxChange:Box07:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box07:BoxChange:Box10:In1 +NumberOfControlPoints:0 +CONNECTION +Box13:Widget:Box05:Widget1 +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleRender_Tools-ResetCamera.bbs b/bbtk_creaVtk_PKG/bbs/appli/exampleRender_Tools-ResetCamera.bbs new file mode 100644 index 0000000..0fb112c --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleRender_Tools-ResetCamera.bbs @@ -0,0 +1,72 @@ +# ---------------------------------- +# - BBTKGEditor v 1.5 BBS BlackBox Script +# - /Users/davila/Creatis/C23/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleRender_Tools-ResetCamera.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include creaMaracasVisu +include vtk +include wx +include std +include creaVtk + +author "Author ??" +description "Description ??" +category "" + +new creaMaracasVisu:ViewerNV Box00 + set Box00.nTypeView "7" + +new vtk:LoadHola Box01 + +new vtk:SphereSource Box02 + +new vtk:PolyDataToActor Box03 + +new wx:LayoutSplit Box04 + set Box04.Orientation "H" + set Box04.Proportion "10" + +new wx:LayoutLine Box05 + +new vtk:UpdateRender Box07 + set Box07.Active "true" + +new std:MultipleInputs Box10 + +new creaVtk:Render_Tools Box11 + set Box11.Type "20" + +new wx:OutputText Box13 + set Box13.In "Test" + + +connect Box01.Out Box00.In + +connect Box02.Out Box03.In + +connect Box00.Renderer1 Box03.Renderer + +connect Box00.Widget Box04.Widget2 + +connect Box05.Widget Box04.Widget1 + +connect Box03.BoxChange Box11.BoxExecute + +connect Box00.Renderer1 Box11.Renderer + +connect Box11.BoxChange Box07.BoxExecute + +connect Box07.BoxChange Box10.In1 + +connect Box13.Widget Box05.Widget1 + + + +# Complex input ports +exec Box04 +exec Box10 diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkRender_Tools.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkRender_Tools.cxx new file mode 100644 index 0000000..faf8249 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkRender_Tools.cxx @@ -0,0 +1,90 @@ +//===== +// 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) +//===== +#include "bbcreaVtkRender_Tools.h" +#include "bbcreaVtkPackage.h" + +#include "vtkRenderWindow.h" + +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,Render_Tools) +BBTK_BLACK_BOX_IMPLEMENTATION(Render_Tools,bbtk::AtomicBlackBox); +//===== +// 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 Render_Tools::Process() +{ + +// THE MAIN PROCESSING METHOD BODY +// Here we simply set the input 'In' value to the output 'Out' +// And print out the output value +// INPUT/OUTPUT ACCESSORS ARE OF THE FORM : +// void bbSet{Input|Output}NAME(const TYPE&) +// const TYPE& bbGet{Input|Output}NAME() const +// Where : +// * NAME is the name of the input/output +// (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') +// bbSetOutputOut( bbGetInputIn() ); +// std::cout << "Output value = " <ResetCamera(); + bbGetInputRenderer()->GetRenderWindow()->Render(); + } // if Renderer + } // if type + if ( bbGetInputType()==20 ) + { + if ( bbGetInputRenderer()!=NULL) + { + bbGetInputRenderer()->ResetCamera(); + } // if Renderer + } // if type +} +//===== +// 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 Render_Tools::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputType(0); + bbSetInputRenderer(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 Render_Tools::bbUserInitializeProcessing() +{ + +// THE INITIALIZATION METHOD BODY : +// Here does nothing +// but this is where you should allocate the internal/output pointers +// 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 Render_Tools::bbUserFinalizeProcessing() +{ + +// THE FINALIZATION METHOD BODY : +// Here does nothing +// but this is where you should desallocate the internal/output pointers +// if any + +} +} +// EO namespace bbcreaVtk + + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkRender_Tools.h b/bbtk_creaVtk_PKG/src/bbcreaVtkRender_Tools.h new file mode 100644 index 0000000..ecb241b --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkRender_Tools.h @@ -0,0 +1,50 @@ +//===== +// 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) +//===== +#ifndef __bbcreaVtkRender_Tools_h_INCLUDED__ +#define __bbcreaVtkRender_Tools_h_INCLUDED__ + +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include "vtkRenderer.h" + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT Render_Tools + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(Render_Tools,bbtk::AtomicBlackBox); +//===== +// 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(Type,int); + BBTK_DECLARE_INPUT(Renderer,vtkRenderer*); +// BBTK_DECLARE_OUTPUT(Out,double); + BBTK_PROCESS(Process); + void Process(); +//===== +// 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(Render_Tools,bbtk::AtomicBlackBox); + BBTK_NAME("Render_Tools"); + BBTK_AUTHOR("Info-Dev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + BBTK_INPUT(Render_Tools,Type,"(defaulot 0) Type 0:Nothing 10:ResetCamera and Reder 20:ResetCamera",int,""); + BBTK_INPUT(Render_Tools,Renderer,"vtk Renderer",vtkRenderer*,""); +// BBTK_OUTPUT(Render_Tools,Out,"First output",double,""); +BBTK_END_DESCRIBE_BLACK_BOX(Render_Tools); +//===== +// 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) +//===== +} +// EO namespace bbcreaVtk + +#endif // __bbcreaVtkRender_Tools_h_INCLUDED__ +