From 7a8611eb139f26a1f937d23ad7e2df63599692c1 Mon Sep 17 00:00:00 2001 From: Shingo Kitagawa Date: Thu, 14 Jul 2022 17:35:47 +0900 Subject: [PATCH 1/2] add write-to-png in irtgraph --- irteus/irtgraph.l | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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) From c4c9dbbfbceb2f602a7e49ba8ce77142877adfe6 Mon Sep 17 00:00:00 2001 From: Shingo Kitagawa Date: Thu, 14 Jul 2022 17:42:37 +0900 Subject: [PATCH 2/2] add test for write-to-png --- irteus/test/graph.l | 4 ++++ 1 file changed, 4 insertions(+) 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)