lib/y_petri/net/visualization.rb in y_petri-2.1.3 vs lib/y_petri/net/visualization.rb in y_petri-2.1.6
- old
+ new
@@ -1,10 +1,10 @@
#encoding: utf-8
# Own visualization capabilities of a Petri net.
#
-class YPetri::Net
+module YPetri::Net::Visualization
# Visualizes the net with Graphviz.
#
def visualize
require 'graphviz'
γ = GraphViz.new :G
@@ -49,10 +49,11 @@
γ.add_edges tr_node, place_nodes[pl], color: 'grey', arrowhead: 'none'
}
end
}
# Generate output image.
+ puts File.expand_path "~/y_petri_graph.png"
γ.output png: File.expand_path( "~/y_petri_graph.png" )
# require 'y_support/kde'
YSupport::KDE.show_file_with_kioclient File.expand_path( "~/y_petri_graph.png" )
end
@@ -62,6 +63,6 @@
#
def show_file_with_kioclient( file_name )
system "sleep 0.2; kioclient exec 'file:%s'" %
File.expand_path( '.', file_name )
end
-end # class YPetri::Net
+end # module YPetri::Net::Visualization