From ad8836772a7c59508722d10fea96563651b747c2 Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Tue, 3 Mar 2015 18:50:43 +0100
Subject: [PATCH] Add GraphicalInterface::writeNodeFile

---
 idl/gepetto/viewer/graphical-interface.idl |  2 ++
 src/graphical-interface.impl.cpp           | 17 +++++++++++++++++
 src/graphical-interface.impl.hh            |  1 +
 3 files changed, 20 insertions(+)

diff --git a/idl/gepetto/viewer/graphical-interface.idl b/idl/gepetto/viewer/graphical-interface.idl
index 99a71d4..1e5de67 100644
--- a/idl/gepetto/viewer/graphical-interface.idl
+++ b/idl/gepetto/viewer/graphical-interface.idl
@@ -225,6 +225,8 @@ typedef double Color [4];
 
     /// Stop the running capture of a window.
     boolean stopCapture (in unsigned long windowId) raises (Error);
+
+    boolean writeNodeFile (in unsigned long windowId, in string filename) raises (Error);
   };
 };
 };
diff --git a/src/graphical-interface.impl.cpp b/src/graphical-interface.impl.cpp
index 1506a3b..4b42c2e 100644
--- a/src/graphical-interface.impl.cpp
+++ b/src/graphical-interface.impl.cpp
@@ -844,6 +844,23 @@ namespace graphics {
 	  throw Error (exc.what ());
 	}
       }
+
+      bool GraphicalInterface::writeNodeFile (const WindowID windowId, const char* filename)
+        throw (Error)
+      {
+	try {
+	  if (windowId >= 0 || windowId < windowManagers_.size ()) {
+	    return windowManagers_[windowId]->writeNodeFile (std::string (filename));
+	  }
+	  else {
+	    std::cout << "Window ID " << windowId
+		      << " doesn't exist." << std::endl;
+	    return false;
+	  }
+	} catch (const std::exception& exc) {
+	  throw Error (exc.what ());
+	}
+      }
     } //end namespace impl
   } //end namespace corbaServer
 } //end namespace graphics
diff --git a/src/graphical-interface.impl.hh b/src/graphical-interface.impl.hh
index 32cbe26..628b1e0 100644
--- a/src/graphical-interface.impl.hh
+++ b/src/graphical-interface.impl.hh
@@ -136,6 +136,7 @@ public:
   virtual bool startCapture (const WindowID windowId, const char* filename,
       const char* extension) throw (Error);
   virtual bool stopCapture (const WindowID windowId) throw (Error);
+  virtual bool writeNodeFile (const WindowID windowId, const char* filename) throw (Error);
 }; // end of class
 
 } /* namespace impl */
-- 
GitLab