diff --git a/irteus/irtgraph.l b/irteus/irtgraph.l index 756dc7c8..9ebd900d 100644 --- a/irteus/irtgraph.l +++ b/irteus/irtgraph.l @@ -351,7 +351,22 @@ Args: ;; fname finished with '.pdf', remove it (setq fname (subseq str 0 (1- (length str)))) ))) - (send self :write-to-file fname result-path title)) + (send self :write-to-file fname result-path title "pdf")) + (:write-to-png (fname &optional result-path + (title (string-right-trim ".png" fname))) + "write graph structure to png +Args: + fname: filename for output + result-path: list of solver-node, it's result of (send solver :solve graph) + title: title of graph +" + (when (substringp ".png" fname) + (let ((str (string-right-trim "png" fname))) + (when (= (elt str (1- (length str))) #\.) + ;; fname finished with '.png', remove it + (setq fname (subseq str 0 (1- (length str)))) + ))) + (send self :write-to-file fname result-path title "png")) (:original-draw-mode () "change draw-mode to original mode" (send self :draw-both-arc nil) diff --git a/irteus/test/graph.l b/irteus/test/graph.l index 12e50ebf..25a4c56e 100644 --- a/irteus/test/graph.l +++ b/irteus/test/graph.l @@ -267,6 +267,10 @@ ;; write graph to pdf file (warning-message 2 "write to /tmp/robots_in_jsk.pdf~%") (send g :write-to-pdf "/tmp/robots_in_jsk.pdf" nil "robots_in_jsk") + + ;; write graph to png file + (warning-message 2 "write to /tmp/robots_in_jsk.png~%") + (send g :write-to-png "/tmp/robots_in_jsk.png" nil "robots_in_jsk") g)) (eval-when (load eval)