Module: Roby::LoggedTask
- Includes:
- LoggedPlanObject
- Included in:
- Task::DRoby, Transaction::Proxy::DRoby
- Defined in:
- lib/roby/log/relations.rb,
lib/roby/log/dot.rb
Instance Attribute Summary
Attributes included from LoggedPlanObject
Instance Method Summary collapse
- #display_create(display) ⇒ Object
- #display_time_end(rect, pos) ⇒ Object
- #display_time_start(rect, pos) ⇒ Object
- #dot_label(display) ⇒ Object
- #layout_events(display) ⇒ Object
Methods included from LoggedPlanObject
Instance Method Details
#display_create(display) ⇒ Object
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/roby/log/relations.rb', line 149 def display_create(display) scene = display.scene rect = scene.add_rect Qt::RectF.new(0, 0, 0, 0) text = scene.add_text display_name(display) rect.brush = Qt::Brush.new(Log::TASK_BRUSH_COLORS[:pending]) rect.pen = Qt::Pen.new(Log::TASK_PEN_COLORS[:pending]) @displayed_state = :pending text.parent_item = rect rect.singleton_class.class_eval { attr_accessor :text } rect.text = text rect.z_value = Log::TASK_LAYER rect.set_data(0, Qt::Variant.new(self.object_id.to_s)) rect end |
#display_time_end(rect, pos) ⇒ Object
166 |
# File 'lib/roby/log/relations.rb', line 166 def display_time_end(rect, pos); rect.right = pos end |
#display_time_start(rect, pos) ⇒ Object
165 |
# File 'lib/roby/log/relations.rb', line 165 def display_time_start(rect, pos); rect.left = pos end |
#dot_label(display) ⇒ Object
156 157 158 159 160 161 162 163 164 165 |
# File 'lib/roby/log/dot.rb', line 156 def dot_label(display) event_names = events.values.find_all { |ev| display.displayed?(ev) }. map { |ev| ev.dot_label(display) }. join(" ") own = super if own.size > event_names.size then own else event_names end end |
#layout_events(display) ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/roby/log/relations.rb', line 108 def layout_events(display) graphics_item = display[self] width, height = 0, 0 events = self.events.map do |_, e| next unless display.displayed?(e) next unless circle = display[e] br = (circle.bounding_rect | circle.children_bounding_rect) [e, circle, br] end events.compact! events = events.sort_by { |ev, _| EventGeneratorDisplay.priorities[ev] } events.each do |_, circle, br| w, h = br.width, br.height height = h if h > height width += w end width += Log::TASK_EVENT_SPACING * (events.size + 1) height += Log::TASK_EVENT_SPACING x = -width / 2 + Log::TASK_EVENT_SPACING events.each do |e, circle, br| w = br.width circle.set_pos(x + w / 2, -br.height / 2 + Log::EVENT_CIRCLE_RADIUS + Log::TASK_EVENT_SPACING) x += w + Log::TASK_EVENT_SPACING end width = Log::DEFAULT_TASK_WIDTH unless width > Log::DEFAULT_TASK_WIDTH height = Log::DEFAULT_TASK_HEIGHT unless height > Log::DEFAULT_TASK_HEIGHT if @width != width || @height != height @width, @height = width, height coords = Qt::RectF.new -(width / 2), -(height / 2), width, height graphics_item.rect = coords end text = graphics_item.text text.set_pos(- text.bounding_rect.width / 2, height / 2 + Log::TASK_EVENT_SPACING) end |