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



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/roby/gui/plan_dot_layout.rb', line 159

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



139
140
141
# File 'lib/roby/gui/plan_dot_layout.rb', line 139

def dot_label(display)
    display_name(display)
end

#to_dot(display, io) ⇒ Object

Adds the dot definition for this object in io



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

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

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