Skip to content

Commit

Permalink
Merge pull request #623 from knorth55/write-to-png
Browse files Browse the repository at this point in the history
add write-to-png in irtgraph
  • Loading branch information
k-okada authored Jul 22, 2022
2 parents 1d16d77 + c4c9dbb commit 3040a1a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
17 changes: 16 additions & 1 deletion irteus/irtgraph.l
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions irteus/test/graph.l
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

1 comment on commit 3040a1a

@k-okada
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing jskeus documentation

Please check latest documents before merging

PDF version of Japanese jmanual: jmanual.pdf
HTML version of Japanese manual: jmanual.html
Sphinx (ReST) version of Japanese manual: jmanual.rst

Please sign in to comment.