From 3d95096f97588894dd9a5ffbb8b2c8e6c111cd29 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Fri, 30 Nov 2018 12:28:40 +0100 Subject: [PATCH] #3233 creaVtk Feature New Normal - GetCameraInfo SetCameraInfo ScreenShot --- .../bbs/appli/exampleGetCameraInfo.bbg | 123 ++++++++++++++++ .../bbs/appli/exampleGetCameraInfo.bbs | 77 ++++++++++ .../bbs/appli/exampleScreenShot.bbg | 65 +++++++++ .../bbs/appli/exampleScreenShot.bbs | 47 ++++++ .../bbs/appli/exampleSetCameraInfo.bbg | 134 ++++++++++++++++++ .../bbs/appli/exampleSetCameraInfo.bbs | 82 +++++++++++ .../src/bbcreaVtkGetCameraInfo.cxx | 98 +++++++++++++ bbtk_creaVtk_PKG/src/bbcreaVtkGetCameraInfo.h | 51 +++++++ bbtk_creaVtk_PKG/src/bbcreaVtkScreenShot.cxx | 108 ++++++++++++++ bbtk_creaVtk_PKG/src/bbcreaVtkScreenShot.h | 51 +++++++ .../src/bbcreaVtkSetCameraInfo.cxx | 91 ++++++++++++ bbtk_creaVtk_PKG/src/bbcreaVtkSetCameraInfo.h | 52 +++++++ 12 files changed, 979 insertions(+) create mode 100644 bbtk_creaVtk_PKG/bbs/appli/exampleGetCameraInfo.bbg create mode 100644 bbtk_creaVtk_PKG/bbs/appli/exampleGetCameraInfo.bbs create mode 100644 bbtk_creaVtk_PKG/bbs/appli/exampleScreenShot.bbg create mode 100644 bbtk_creaVtk_PKG/bbs/appli/exampleScreenShot.bbs create mode 100644 bbtk_creaVtk_PKG/bbs/appli/exampleSetCameraInfo.bbg create mode 100644 bbtk_creaVtk_PKG/bbs/appli/exampleSetCameraInfo.bbs create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkGetCameraInfo.cxx create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkGetCameraInfo.h create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkScreenShot.cxx create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkScreenShot.h create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkSetCameraInfo.cxx create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkSetCameraInfo.h diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleGetCameraInfo.bbg b/bbtk_creaVtk_PKG/bbs/appli/exampleGetCameraInfo.bbg new file mode 100644 index 0000000..89e2534 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleGetCameraInfo.bbg @@ -0,0 +1,123 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /tmpEED/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleGetCameraInfo.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:9 +BOX +creaMaracasVisu:ViewerNV:Box00 +ISEXEC:FALSE +-0.450871:79.052673:-900.000000 +63.269129:69.052673:-900.000000 +FIN_BOX +BOX +wx:LayoutSplit:Box01 +ISEXEC:TRUE +8.265964:-80.254995:-900.000000 +53.840964:-90.254995:-900.000000 +PORT +Orientation:"H" +FIN_BOX +BOX +wx:LayoutLine:Box02 +ISEXEC:FALSE +-75.295416:-45.087076:-900.000000 +-17.735416:-55.087076:-900.000000 +FIN_BOX +BOX +wx:OutputText:Box03 +ISEXEC:FALSE +-87.919797:29.456889:-900.000000 +-42.344797:19.456889:-900.000000 +PORT +Title:"FocalPoint" +FIN_BOX +BOX +creaVtk:GetCameraInfo:Box04 +ISEXEC:FALSE +-49.144912:58.913779:-900.000000 +-3.569912:48.913779:-900.000000 +FIN_BOX +BOX +wx:OutputText:Box05 +ISEXEC:FALSE +-67.018056:11.583746:-900.000000 +-21.443056:1.583746:-900.000000 +PORT +Title:"Position" +FIN_BOX +BOX +wx:OutputText:Box06 +ISEXEC:FALSE +-40.405285:-7.191139:-900.000000 +5.169715:-17.191139:-900.000000 +PORT +Title:"ViewUp" +FIN_BOX +BOX +vtk:LoadHola:Box07 +ISEXEC:FALSE +-26.901955:98.590405:-900.000000 +18.673045:88.590405:-900.000000 +FIN_BOX +BOX +wx:CommandButton:Box08 +ISEXEC:FALSE +-118.579009:79.353253:-900.000000 +-73.004009:69.353253:-900.000000 +PORT +In:"Refresh" +FIN_BOX +CONNECTIONS:15 +CONNECTION +Box00:Widget:Box01:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box02:Widget:Box01:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box06:Widget:Box02:Widget3 +NumberOfControlPoints:0 +CONNECTION +Box05:Widget:Box02:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box03:Widget:Box02:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box00:Renderer1:Box04:vtkRenderer +NumberOfControlPoints:0 +CONNECTION +Box04:FocalPoint:Box03:In +NumberOfControlPoints:0 +CONNECTION +Box04:Position:Box05:In +NumberOfControlPoints:0 +CONNECTION +Box04:ViewUp:Box06:In +NumberOfControlPoints:0 +CONNECTION +Box07:Out:Box00:In +NumberOfControlPoints:0 +CONNECTION +Box08:Widget:Box02:Widget4 +NumberOfControlPoints:0 +CONNECTION +Box08:BoxChange:Box03:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box08:BoxChange:Box05:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box08:BoxChange:Box06:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box08:BoxChange:Box04:BoxExecute +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleGetCameraInfo.bbs b/bbtk_creaVtk_PKG/bbs/appli/exampleGetCameraInfo.bbs new file mode 100644 index 0000000..a9d2ba5 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleGetCameraInfo.bbs @@ -0,0 +1,77 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script +# - /tmpEED/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleGetCameraInfo.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include creaMaracasVisu +include wx +include creaVtk +include vtk + +author "Author ??" +description "Description ??" +category "" + +new creaMaracasVisu:ViewerNV Box00 + +new wx:LayoutSplit Box01 + set Box01.Orientation "H" + +new wx:LayoutLine Box02 + +new wx:OutputText Box03 + set Box03.Title "FocalPoint" + +new creaVtk:GetCameraInfo Box04 + +new wx:OutputText Box05 + set Box05.Title "Position" + +new wx:OutputText Box06 + set Box06.Title "ViewUp" + +new vtk:LoadHola Box07 + +new wx:CommandButton Box08 + set Box08.In "Refresh" + + +connect Box00.Widget Box01.Widget2 + +connect Box02.Widget Box01.Widget1 + +connect Box06.Widget Box02.Widget3 + +connect Box05.Widget Box02.Widget2 + +connect Box03.Widget Box02.Widget1 + +connect Box00.Renderer1 Box04.vtkRenderer + +connect Box04.FocalPoint Box03.In + +connect Box04.Position Box05.In + +connect Box04.ViewUp Box06.In + +connect Box07.Out Box00.In + +connect Box08.Widget Box02.Widget4 + +connect Box08.BoxChange Box03.BoxExecute + +connect Box08.BoxChange Box05.BoxExecute + +connect Box08.BoxChange Box06.BoxExecute + +connect Box08.BoxChange Box04.BoxExecute + + + +# Complex input ports +exec Box01 diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleScreenShot.bbg b/bbtk_creaVtk_PKG/bbs/appli/exampleScreenShot.bbg new file mode 100644 index 0000000..90ba0a5 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleScreenShot.bbg @@ -0,0 +1,65 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /tmpEED/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleScreenShot.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:5 +BOX +creaVtk:ScreenShot:Box00 +ISEXEC:FALSE +-38.417136:17.257698:-900.000000 +7.157864:7.257698:-900.000000 +PORT +FileName:"ScreenShot.png" +FIN_BOX +BOX +vtk:LoadHola:Box01 +ISEXEC:FALSE +15.306828:70.981662:-900.000000 +60.881828:60.981662:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ViewerNV:Box02 +ISEXEC:FALSE +6.302811:43.969613:-900.000000 +70.022811:33.969613:-900.000000 +FIN_BOX +BOX +wx:LayoutSplit:Box03 +ISEXEC:TRUE +-32.414459:-30.763722:-900.000000 +13.160541:-40.763722:-900.000000 +PORT +Orientation:"H" +FIN_BOX +BOX +wx:CommandButton:Box04 +ISEXEC:FALSE +-99.044179:44.569881:-900.000000 +-53.469179:34.569881:-900.000000 +PORT +Label:"ScreenShot" +FIN_BOX +CONNECTIONS:5 +CONNECTION +Box01:Out:Box02:In +NumberOfControlPoints:0 +CONNECTION +Box02:Renderer1:Box00:vtkRenderer +NumberOfControlPoints:0 +CONNECTION +Box02:Widget:Box03:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box04:Widget:Box03:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box04:BoxChange:Box00:BoxExecute +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleScreenShot.bbs b/bbtk_creaVtk_PKG/bbs/appli/exampleScreenShot.bbs new file mode 100644 index 0000000..34ea539 --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleScreenShot.bbs @@ -0,0 +1,47 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script +# - /tmpEED/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleScreenShot.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include creaVtk +include vtk +include creaMaracasVisu +include wx + +author "Author ??" +description "Description ??" +category "" + +new creaVtk:ScreenShot Box00 + set Box00.FileName "ScreenShot.png" + +new vtk:LoadHola Box01 + +new creaMaracasVisu:ViewerNV Box02 + +new wx:LayoutSplit Box03 + set Box03.Orientation "H" + +new wx:CommandButton Box04 + set Box04.Label "ScreenShot" + + +connect Box01.Out Box02.In + +connect Box02.Renderer1 Box00.vtkRenderer + +connect Box02.Widget Box03.Widget2 + +connect Box04.Widget Box03.Widget1 + +connect Box04.BoxChange Box00.BoxExecute + + + +# Complex input ports +exec Box03 diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleSetCameraInfo.bbg b/bbtk_creaVtk_PKG/bbs/appli/exampleSetCameraInfo.bbg new file mode 100644 index 0000000..06f0cfd --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleSetCameraInfo.bbg @@ -0,0 +1,134 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /tmpEED/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleSetCameraInfo.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:10 +BOX +vtk:LoadHola:Box00 +ISEXEC:FALSE +-21.909773:76.684205:-900.000000 +23.665227:66.684205:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ViewerNV:Box01 +ISEXEC:FALSE +-61.227311:54.474299:-900.000000 +2.492689:44.474299:-900.000000 +PORT +nTypeView:"5" +FIN_BOX +BOX +creaMaracasVisu:ViewerNV:Box02 +ISEXEC:FALSE +20.000000:54.365329:-900.000000 +83.720000:44.365329:-900.000000 +PORT +nTypeView:"5" +FIN_BOX +BOX +wx:LayoutLine:Box03 +ISEXEC:FALSE +24.010710:-20.859304:-900.000000 +81.570710:-30.859304:-900.000000 +PORT +Orientation:"H" +FIN_BOX +BOX +wx:LayoutSplit:Box04 +ISEXEC:TRUE +-62.427846:-61.977645:-900.000000 +-16.852846:-71.977645:-900.000000 +PORT +Orientation:"H" +FIN_BOX +BOX +wx:LayoutLine:Box05 +ISEXEC:FALSE +-112.250070:-27.162116:-900.000000 +-54.690070:-37.162116:-900.000000 +FIN_BOX +BOX +wx:CommandButton:Box06 +ISEXEC:FALSE +-125.155826:53.273763:-900.000000 +-79.580826:43.273763:-900.000000 +PORT +Label:"Refresh" +FIN_BOX +BOX +creaVtk:GetCameraInfo:Box07 +ISEXEC:FALSE +-86.138423:36.466266:-900.000000 +-40.563423:26.466266:-900.000000 +FIN_BOX +BOX +creaVtk:SetCameraInfo:Box09 +ISEXEC:FALSE +-77.734674:16.057162:-900.000000 +-32.159674:6.057162:-900.000000 +FIN_BOX +BOX +vtk:UpdateRender:Box10 +ISEXEC:FALSE +-68.430524:-2.851272:-900.000000 +-22.855524:-12.851272:-900.000000 +PORT +Active:"true" +FIN_BOX +CONNECTIONS:16 +CONNECTION +Box00:Out:Box01:In +NumberOfControlPoints:0 +CONNECTION +Box00:Out:Box02:In +NumberOfControlPoints:0 +CONNECTION +Box01:Widget:Box03:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box02:Widget:Box03:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box03:Widget:Box04:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box05:Widget:Box04:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box06:Widget:Box05:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box01:Renderer1:Box07:vtkRenderer +NumberOfControlPoints:0 +CONNECTION +Box02:Renderer1:Box09:vtkRenderer +NumberOfControlPoints:0 +CONNECTION +Box07:ViewUp:Box09:ViewUp +NumberOfControlPoints:0 +CONNECTION +Box07:Position:Box09:Position +NumberOfControlPoints:0 +CONNECTION +Box07:FocalPoint:Box09:FocalPoint +NumberOfControlPoints:0 +CONNECTION +Box06:BoxChange:Box07:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box02:Renderer1:Box10:Renderer +NumberOfControlPoints:0 +CONNECTION +Box07:BoxChange:Box09:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box09:BoxChange:Box10:BoxExecute +NumberOfControlPoints:0 +APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/exampleSetCameraInfo.bbs b/bbtk_creaVtk_PKG/bbs/appli/exampleSetCameraInfo.bbs new file mode 100644 index 0000000..cf7b31a --- /dev/null +++ b/bbtk_creaVtk_PKG/bbs/appli/exampleSetCameraInfo.bbs @@ -0,0 +1,82 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script +# - /tmpEED/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/exampleSetCameraInfo.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include vtk +include creaMaracasVisu +include wx +include creaVtk + +author "Author ??" +description "Description ??" +category "" + +new vtk:LoadHola Box00 + +new creaMaracasVisu:ViewerNV Box01 + set Box01.nTypeView "5" + +new creaMaracasVisu:ViewerNV Box02 + set Box02.nTypeView "5" + +new wx:LayoutLine Box03 + set Box03.Orientation "H" + +new wx:LayoutSplit Box04 + set Box04.Orientation "H" + +new wx:LayoutLine Box05 + +new wx:CommandButton Box06 + set Box06.Label "Refresh" + +new creaVtk:GetCameraInfo Box07 + +new creaVtk:SetCameraInfo Box09 + +new vtk:UpdateRender Box10 + set Box10.Active "true" + + +connect Box00.Out Box01.In + +connect Box00.Out Box02.In + +connect Box01.Widget Box03.Widget1 + +connect Box02.Widget Box03.Widget2 + +connect Box03.Widget Box04.Widget2 + +connect Box05.Widget Box04.Widget1 + +connect Box06.Widget Box05.Widget1 + +connect Box01.Renderer1 Box07.vtkRenderer + +connect Box02.Renderer1 Box09.vtkRenderer + +connect Box07.ViewUp Box09.ViewUp + +connect Box07.Position Box09.Position + +connect Box07.FocalPoint Box09.FocalPoint + +connect Box06.BoxChange Box07.BoxExecute + +connect Box02.Renderer1 Box10.Renderer + +connect Box07.BoxChange Box09.BoxExecute + +connect Box09.BoxChange Box10.BoxExecute + + + +# Complex input ports +exec Box04 diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkGetCameraInfo.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkGetCameraInfo.cxx new file mode 100644 index 0000000..38a982e --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkGetCameraInfo.cxx @@ -0,0 +1,98 @@ +//===== +// 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 "bbcreaVtkGetCameraInfo.h" +#include "bbcreaVtkPackage.h" + +#include "vtkCamera.h" + +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,GetCameraInfo) +BBTK_BLACK_BOX_IMPLEMENTATION(GetCameraInfo,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 GetCameraInfo::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') + + if (bbGetInputvtkRenderer()!=NULL) + { + double px,py,pz; + bbGetInputvtkRenderer()->GetActiveCamera()->GetPosition(px,py,pz); + std::vector position; + position.push_back(px); + position.push_back(py); + position.push_back(pz); + bbSetOutputPosition(position); + + double vx,vy,vz; + bbGetInputvtkRenderer()->GetActiveCamera()->GetViewUp(vx,vy,vz); + std::vector viewup; + viewup.push_back(vx); + viewup.push_back(vy); + viewup.push_back(vz); + bbSetOutputViewUp(viewup); + + double fx,fy,fz; + bbGetInputvtkRenderer()->GetActiveCamera()->GetFocalPoint(fx,fy,fz); + std::vector focalpoint; + focalpoint.push_back(fx); + focalpoint.push_back(fy); + focalpoint.push_back(fz); + bbSetOutputFocalPoint(focalpoint); + } +} +//===== +// 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 GetCameraInfo::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputvtkRenderer(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 GetCameraInfo::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 GetCameraInfo::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/bbcreaVtkGetCameraInfo.h b/bbtk_creaVtk_PKG/src/bbcreaVtkGetCameraInfo.h new file mode 100644 index 0000000..6a8b865 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkGetCameraInfo.h @@ -0,0 +1,51 @@ +//===== +// 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 __bbcreaVtkGetCameraInfo_h_INCLUDED__ +#define __bbcreaVtkGetCameraInfo_h_INCLUDED__ +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include "vtkRenderer.h" + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT GetCameraInfo + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(GetCameraInfo,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(vtkRenderer,vtkRenderer*); + BBTK_DECLARE_OUTPUT( ViewUp, std::vector ); + BBTK_DECLARE_OUTPUT( FocalPoint, std::vector ); + BBTK_DECLARE_OUTPUT( Position, std::vector ); + 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(GetCameraInfo,bbtk::AtomicBlackBox); + BBTK_NAME("GetCameraInfo"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + BBTK_INPUT(GetCameraInfo,vtkRenderer,"vtkRenderer default NULL", vtkRenderer* ,""); + BBTK_OUTPUT(GetCameraInfo,ViewUp,"ViewUp[x,y,z]",std::vector,""); + BBTK_OUTPUT(GetCameraInfo,FocalPoint,"FocalPoint[x,y,z]",std::vector,""); + BBTK_OUTPUT(GetCameraInfo,Position,"Position[x,y,z]",std::vector,""); +BBTK_END_DESCRIBE_BLACK_BOX(GetCameraInfo); +//===== +// 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 // __bbcreaVtkGetCameraInfo_h_INCLUDED__ + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkScreenShot.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkScreenShot.cxx new file mode 100644 index 0000000..35a5998 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkScreenShot.cxx @@ -0,0 +1,108 @@ +//===== +// 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 "bbcreaVtkScreenShot.h" +#include "bbcreaVtkPackage.h" + +#include "vtkWindowToImageFilter.h" +#include "vtkPNGWriter.h" +#include "vtkWindow.h" + +// #include "vtkFFMPEGWriter.h" + + +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ScreenShot) +BBTK_BLACK_BOX_IMPLEMENTATION(ScreenShot,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 ScreenShot::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 = " <SetInput( bbGetInputvtkRenderer()->GetVTKWindow() ); + wif->SetMagnification( bbGetInputScale()[0] ); +// wif->SetScale( bbGetInputScale()[0], bbGetInputScale()[1] ); + wif->SetInputBufferTypeToRGB(); + wif->ReadFrontBufferOff(); + wif->Update(); + vtkPNGWriter *writer = vtkPNGWriter::New(); + writer->SetFileName( bbGetInputFileName().c_str() ); + writer->SetInput(wif->GetOutput()); + writer->Write(); + +/* + vtkFFMPEGWriter *writer2 = vtkFFMPEGWriter::New(); + writer2->SetInput(wif->GetOutput()); + for (int i=0; i<10; i++) + { + // update + writer2->Write(); + } // for + writer2->End; +*/ +} +//===== +// 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 ScreenShot::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputvtkRenderer(NULL); + bbSetInputFileName("ScreenShot-BBTK.png"); + + std::vector scale; + scale.push_back(1); + scale.push_back(1); + bbSetInputScale(scale); + +} +//===== +// 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 ScreenShot::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 ScreenShot::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/bbcreaVtkScreenShot.h b/bbtk_creaVtk_PKG/src/bbcreaVtkScreenShot.h new file mode 100644 index 0000000..307d8f7 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkScreenShot.h @@ -0,0 +1,51 @@ +//===== +// 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 __bbcreaVtkScreenShot_h_INCLUDED__ +#define __bbcreaVtkScreenShot_h_INCLUDED__ +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include "vtkRenderer.h" + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT ScreenShot + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(ScreenShot,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(FileName,std::string); + BBTK_DECLARE_INPUT(Scale,std::vector); + BBTK_DECLARE_INPUT(vtkRenderer,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(ScreenShot,bbtk::AtomicBlackBox); + BBTK_NAME("ScreenShot"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + BBTK_INPUT(ScreenShot,Scale,"[scaleX,scaleY] default [1,1]",std::vector,""); + BBTK_INPUT(ScreenShot,FileName,"File Name Default:ScreenShot-BBTK.png",std::string,""); + BBTK_INPUT(ScreenShot,vtkRenderer,"First input",vtkRenderer*,""); +// BBTK_OUTPUT(ScreenShot,Out,"First output",double,""); +BBTK_END_DESCRIBE_BLACK_BOX(ScreenShot); +//===== +// 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 // __bbcreaVtkScreenShot_h_INCLUDED__ + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkSetCameraInfo.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkSetCameraInfo.cxx new file mode 100644 index 0000000..f2cb534 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkSetCameraInfo.cxx @@ -0,0 +1,91 @@ +//===== +// 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 "bbcreaVtkSetCameraInfo.h" +#include "bbcreaVtkPackage.h" + +#include "vtkCamera.h" + +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,SetCameraInfo) +BBTK_BLACK_BOX_IMPLEMENTATION(SetCameraInfo,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 SetCameraInfo::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') + + if (bbGetInputvtkRenderer()!=NULL) + { + double px,py,pz; + px=bbGetInputPosition()[0]; + py=bbGetInputPosition()[1]; + pz=bbGetInputPosition()[2]; + bbGetInputvtkRenderer()->GetActiveCamera()->SetPosition(px,py,pz); + double fx,fy,fz; + fx=bbGetInputFocalPoint()[0]; + fy=bbGetInputFocalPoint()[1]; + fz=bbGetInputFocalPoint()[2]; + bbGetInputvtkRenderer()->GetActiveCamera()->SetFocalPoint(fx,fy,fz); + double vx,vy,vz; + vx=bbGetInputViewUp()[0]; + vy=bbGetInputViewUp()[1]; + vz=bbGetInputViewUp()[2]; + bbGetInputvtkRenderer()->GetActiveCamera()->SetViewUp(vx,vy,vz); + } // if + +} +//===== +// 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 SetCameraInfo::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputvtkRenderer( 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 SetCameraInfo::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 SetCameraInfo::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/bbcreaVtkSetCameraInfo.h b/bbtk_creaVtk_PKG/src/bbcreaVtkSetCameraInfo.h new file mode 100644 index 0000000..1f34c57 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkSetCameraInfo.h @@ -0,0 +1,52 @@ +//===== +// 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 __bbcreaVtkSetCameraInfo_h_INCLUDED__ +#define __bbcreaVtkSetCameraInfo_h_INCLUDED__ +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include "vtkRenderer.h" + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT SetCameraInfo + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(SetCameraInfo,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(vtkRenderer,vtkRenderer*); + BBTK_DECLARE_INPUT(ViewUp,std::vector); + BBTK_DECLARE_INPUT(FocalPoint,std::vector); + BBTK_DECLARE_INPUT(Position,std::vector); +// 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(SetCameraInfo,bbtk::AtomicBlackBox); + BBTK_NAME("SetCameraInfo"); + BBTK_AUTHOR("InfoDev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + BBTK_INPUT(SetCameraInfo,vtkRenderer,"vtkRenderer",vtkRenderer*,""); + BBTK_INPUT(SetCameraInfo,ViewUp,"ViewUp[x,y,z]",std::vector,""); + BBTK_INPUT(SetCameraInfo,FocalPoint,"FocalPoint[x,y,z]",std::vector,""); + BBTK_INPUT(SetCameraInfo,Position,"Position[x,y,z]",std::vector,""); +BBTK_END_DESCRIBE_BLACK_BOX(SetCameraInfo); +//===== +// 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 // __bbcreaVtkSetCameraInfo_h_INCLUDED__ + -- 2.45.0