]> Creatis software - creaVtk.git/blobdiff - bbtk_creaVtk_PKG/src/bbcreaVtkGetCameraInfo.cxx
#3233 creaVtk Feature New Normal - GetCameraInfo SetCameraInfo ScreenShot
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkGetCameraInfo.cxx
diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkGetCameraInfo.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkGetCameraInfo.cxx
new file mode 100644 (file)
index 0000000..38a982e
--- /dev/null
@@ -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<double> 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<double> 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<double> 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
+
+