Class: Phenomenal::Viewer::Graphical
- Inherits:
-
Object
- Object
- Phenomenal::Viewer::Graphical
- Defined in:
- lib/phenomenal/viewer/graphical.rb
Overview
Define the way to generate a representation of the system using the graphical library graphviz
Instance Attribute Summary collapse
-
#context_nodes ⇒ Object
Returns the value of attribute context_nodes.
-
#destination_file ⇒ Object
Returns the value of attribute destination_file.
-
#feature_nodes ⇒ Object
Returns the value of attribute feature_nodes.
-
#main_graph ⇒ Object
Returns the value of attribute main_graph.
-
#manager ⇒ Object
readonly
Returns the value of attribute manager.
-
#r_feature_nodes ⇒ Object
Returns the value of attribute r_feature_nodes.
-
#rmanager ⇒ Object
readonly
Returns the value of attribute rmanager.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(destination_file) ⇒ Graphical
constructor
A new instance of Graphical.
Constructor Details
#initialize(destination_file) ⇒ Graphical
Returns a new instance of Graphical.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/phenomenal/viewer/graphical.rb', line 14 def initialize(destination_file) if !@@graphviz raise(Phenomenal::Error, "The 'ruby-graphviz' gem isn't available. Please install it to generate graphic visualisations\n"+ " Otherwise use the text version: phen_textual_view" ) end @manager=Phenomenal::Manager.instance @rmanager=Phenomenal::RelationshipManager.instance @destination_file=destination_file @main_graph=nil @feature_nodes={} @r_feature_nodes={} @context_nodes={} end |
Instance Attribute Details
#context_nodes ⇒ Object
Returns the value of attribute context_nodes.
12 13 14 |
# File 'lib/phenomenal/viewer/graphical.rb', line 12 def context_nodes @context_nodes end |
#destination_file ⇒ Object
Returns the value of attribute destination_file.
12 13 14 |
# File 'lib/phenomenal/viewer/graphical.rb', line 12 def destination_file @destination_file end |
#feature_nodes ⇒ Object
Returns the value of attribute feature_nodes.
12 13 14 |
# File 'lib/phenomenal/viewer/graphical.rb', line 12 def feature_nodes @feature_nodes end |
#main_graph ⇒ Object
Returns the value of attribute main_graph.
12 13 14 |
# File 'lib/phenomenal/viewer/graphical.rb', line 12 def main_graph @main_graph end |
#manager ⇒ Object (readonly)
Returns the value of attribute manager.
11 12 13 |
# File 'lib/phenomenal/viewer/graphical.rb', line 11 def manager @manager end |
#r_feature_nodes ⇒ Object
Returns the value of attribute r_feature_nodes.
12 13 14 |
# File 'lib/phenomenal/viewer/graphical.rb', line 12 def r_feature_nodes @r_feature_nodes end |
#rmanager ⇒ Object (readonly)
Returns the value of attribute rmanager.
11 12 13 |
# File 'lib/phenomenal/viewer/graphical.rb', line 11 def rmanager @rmanager end |
Instance Method Details
#generate ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/phenomenal/viewer/graphical.rb', line 31 def generate() () # Add nodes to the graph self.manager.contexts.each do |key,context| if !feature_nodes.include?(context) && !context_nodes.include?(context) add_node_for(context) end end # Create a relationship links self.manager.contexts.each do |key,context| add_edges_for(context) end self.main_graph.output(:png => destination_file) nil end |