module Roby::GUI::GraphvizPlan
Attributes
depth[R]
The distance from the root plan
layout_level[RW]
Public Instance Methods
all_events(display)
click to toggle source
# File lib/roby/gui/plan_dot_layout.rb, line 9 def all_events(display) tasks.inject(free_events.dup) do |events, task| if display.displayed?(task) events.merge(task.events.values.to_set) else events end end end
apply_layout(bounding_rects, positions, display, max_depth = nil)
click to toggle source
# File lib/roby/gui/plan_dot_layout.rb, line 102 def apply_layout(bounding_rects, positions, display, max_depth = nil) max_depth ||= compute_depth(0) if rect = bounding_rects[dot_id] item = display[self] item.z_value = PLAN_LAYER + depth - max_depth item.rect = rect else DRoby::Logfile.warn "no bounding rectangle for #{self} (#{dot_id})" end (tasks | finalized_tasks | free_events | finalized_events). each do |obj| next if !display.displayed?(obj) obj.apply_layout(bounding_rects, positions, display) end transactions.each do |trsc| trsc.apply_layout(bounding_rects, positions, display, max_depth) end layout_relations(positions, display, each_task_relation_graph.to_a, tasks) end
compute_depth(depth)
click to toggle source
Computes the plan depths and max_depth for this plan and all its children. depth
is this plan depth
Returns max_depth
# File lib/roby/gui/plan_dot_layout.rb, line 94 def compute_depth(depth) @depth = depth child_depth = transactions. map { |trsc| trsc.compute_depth(depth + 1) }. max child_depth || depth end
each_displayed_relation(display, graphs, objects, &block)
click to toggle source
# File lib/roby/gui/plan_dot_layout.rb, line 63 def each_displayed_relation(display, graphs, objects, &block) graphs.each do |g| next unless display.relation_enabled?(g.class) each_edge(g, display, objects, &block) end end
each_edge(graph, display, objects) { |graph, from, to| ... }
click to toggle source
# File lib/roby/gui/plan_dot_layout.rb, line 36 def each_edge(graph, display, objects) objects.each do |from| next unless display.displayed?(from) unless display[from] DRoby::Logfile.warn "no display item for #{from} in #each_displayed_relation" next end graph.each_out_neighbour(from) do |to| next unless display.displayed?(to) unless display[to] DRoby::Logfile.warn "no display item for child in #{from} <#{rel}> #{to} in #each_displayed_relation" next end yield(graph, from, to) end end end
each_layout_relation(display, graphs, objects, &block)
click to toggle source
# File lib/roby/gui/plan_dot_layout.rb, line 56 def each_layout_relation(display, graphs, objects, &block) graphs.each do |g| next unless display.layout_relation?(g.class) each_edge(g, display, objects, &block) end end
layout_relations(positions, display, graphs, objects)
click to toggle source
# File lib/roby/gui/plan_dot_layout.rb, line 81 def layout_relations(positions, display, graphs, objects) each_displayed_relation(display, graphs, objects) do |graph, from, to| display.task_relation(from, to, graph.class, graph.edge_info(from, to)) end end
relations_to_dot(display, io, graphs, objects)
click to toggle source
# File lib/roby/gui/plan_dot_layout.rb, line 70 def relations_to_dot(display, io, graphs, objects) each_layout_relation(display, graphs, objects) do |graph, from, to| from_id, to_id = from.dot_id, to.dot_id if from_id && to_id io << " #{from_id} -> #{to_id}\n" else DRoby::Logfile.warn "ignoring #{from}(#{from.object_id} #{from_id}) -> #{to}(#{to.object_id} #{to_id}) in #{graph.class} in #{caller(1).join("\n ")}" end end end
to_dot(display, io, level)
click to toggle source
# File lib/roby/gui/plan_dot_layout.rb, line 19 def to_dot(display, io, level) @layout_level = level io << "subgraph cluster_#{dot_id} {\n" (tasks | finalized_tasks | free_events | finalized_events). each do |obj| obj.to_dot(display, io) if display.displayed?(obj) end io << "};\n" transactions.each do |trsc| trsc.to_dot(display, io, level + 1) end relations_to_dot(display, io, each_task_relation_graph, tasks) end