Skip to content

Commit

Permalink
fix issue #118
Browse files Browse the repository at this point in the history
  • Loading branch information
dehann committed Aug 8, 2018
1 parent d36e00c commit f3a4106
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/FactorGraph01.jl
Original file line number Diff line number Diff line change
Expand Up @@ -832,14 +832,22 @@ function drawCopyFG(fgl::FactorGraph)
return fgd
end

function writeGraphPdf(fgl::FactorGraph, evince::Bool=true)
function writeGraphPdf(fgl::FactorGraph;
pdfreader::Union{Void, String}="evince",
filename::AS="/tmp/fg.pdf" ) where {AS <: AbstractString}
#
fgd = drawCopyFG(fgl)
println("Writing factor graph file")
fid = open("/tmp/fg.dot","w+")
write(fid,Graphs.to_dot(fgd.g))
close(fid)
run(`dot /tmp/fg.dot -Tpdf -o /tmp/fg.pdf`)
evince ? (@async run(`evince /tmp/fg.pdf`)) : nothing
dotfile = split(filename, ".pdf")[1]*".dot"
run(`dot $(dotfile) -Tpdf -o $(filename)`)
try
pdfreader != nothing ? (@async run(`$(pdfreader) $(filename)`)) : nothing
catch e
warn("not able to show $(filename) with pdfreader=$(pdfreader).")
end
nothing
end

Expand Down

0 comments on commit f3a4106

Please sign in to comment.