Module: Roby::GUI::GraphvizPlanObject

Included in:
GraphvizTask, GraphvizTaskEventGenerator, PlanObject
Defined in:
lib/roby/gui/plan_dot_layout.rb

Instance Method Summary collapse

Instance Method Details

#apply_layout(bounding_rects, positions, display) ⇒ Object

Applys the layout in positions to this particular object



143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/roby/gui/plan_dot_layout.rb', line 143

def apply_layout(bounding_rects, positions, display)
    return unless display.displayed?(self)
    if p = positions[dot_id]
        raise "no graphics for #{self}" unless graphics_item = display[self]
        graphics_item.pos = p
    elsif b = bounding_rects[dot_id]
        raise "no graphics for #{self}" unless graphics_item = display[self]
        graphics_item.rect = b
    else
        STDERR.puts "WARN: #{self} has not been layouted (#{dot_id.inspect})"
    end
end

#dot_label(display) ⇒ Object



128
# File 'lib/roby/gui/plan_dot_layout.rb', line 128

def dot_label(display); display_name(display) end

#to_dot(display, io) ⇒ Object

Adds the dot definition for this object in io



131
132
133
134
135
136
137
138
139
140
# File 'lib/roby/gui/plan_dot_layout.rb', line 131

def to_dot(display, io)
    return unless display.displayed?(self)
    graphics = display.graphics[self]
    bounding_rect = graphics.bounding_rect
    if graphics.respond_to?(:text)
        bounding_rect |= graphics.text.bounding_rect
    end

    io << "  #{dot_id}[label=\"#{dot_label(display).split("\n").join('\n')}\",width=#{bounding_rect.width},height=#{bounding_rect.height},fixedsize=true];\n"
end