module Graphics.SceneGraph.GraphViz where

import System.IO
import System.Process
import Graphics.SceneGraph.Basic
import Data.Graph.Inductive


exportDot p = do 
          f <- openDot "C:\\temp\\sg.dot"
          exportSG f p
          closeDot f
          ph <- runProcess "C:\\Software\\01_Applications\\GraphViz\\GraphvizNOTUSED\\bin\\dot.exe" ["-Tpng", "-oC:\\temp\\g.png", "C:\\temp\\sg.dot"] Nothing Nothing Nothing Nothing Nothing
          waitForProcess ph


openDot fname = do
	       fh <- openFile fname WriteMode
               return fh

exportSG :: Handle -> (SceneGraph,Node) -> IO ()
exportSG f (p,_) = do
               hPutStrLn f (graphviz' p)

closeDot fh = do
               hClose fh