Module: Roby::GUI::RelationsCanvasEventGenerator

Includes:
RelationsCanvasPlanObject
Included in:
EventGenerator, RelationsCanvasTaskEventGenerator
Defined in:
lib/roby/gui/relations_view/relations_canvas.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from RelationsCanvasPlanObject

#display_events, #display_parent

Class Method Details

.prioritiesObject



43
44
45
# File 'lib/roby/gui/relations_view/relations_canvas.rb', line 43

def self.priorities
    @@priorities ||= Hash.new
end

.style(object, flags) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/roby/gui/relations_view/relations_canvas.rb', line 22

def self.style(object, flags)
    flags |= (object.controlable? ? EVENT_CONTROLABLE : EVENT_CONTINGENT)

    if (flags & EVENT_CALLED) == EVENT_CALLED
        if (flags & EVENT_CONTROLABLE) != EVENT_CONTROLABLE
            STDERR.puts "WARN: inconsistency in replayed logs. Found event call on #{object} #{object.object_id} which is marked as contingent (#{object.controlable?}"
        end
        flags |= EVENT_CONTROLABLE
    end

    if !styles.has_key?(flags)
        raise ArgumentError, "event #{object} has flags #{flags}, which has no defined style (controlable=#{object.controlable?})"
    end

    styles[flags]
end

.stylesObject



39
40
41
# File 'lib/roby/gui/relations_view/relations_canvas.rb', line 39

def self.styles
    return EVENT_STYLES
end

Instance Method Details

#display(display, graphics_item) ⇒ Object



81
82
83
# File 'lib/roby/gui/relations_view/relations_canvas.rb', line 81

def display(display, graphics_item)
    graphics_item.text.plain_text = display_name(display).to_s
end

#display_create(display) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/roby/gui/relations_view/relations_canvas.rb', line 47

def display_create(display)
    scene = display.scene
    circle = scene.add_ellipse(-EVENT_CIRCLE_RADIUS, -EVENT_CIRCLE_RADIUS, EVENT_CIRCLE_RADIUS * 2, EVENT_CIRCLE_RADIUS * 2)
    text   = scene.add_text(display_name(display))
    circle.singleton_class.class_eval { attr_accessor :text }
    circle.z_value = EVENT_LAYER

    text.parent_item = circle
    text_width   = text.bounding_rect.width
    text.set_pos(-text_width / 2, 0)
    circle.text = text
    circle
end

#display_name(display) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/roby/gui/relations_view/relations_canvas.rb', line 64

def display_name(display)
    name = if model.ancestors[0].name != 'Roby::EventGenerator'
               [display.filter_prefixes(model.ancestors[0].name.dup)]
           else
               []
           end

    if display.show_ownership
        owners = self.owners.dup
        owners.delete_if { |o| o.remote_name == "log_replay" }
        if !owners.empty?
            name << "[#{owners.map(&:name).join(", ")}]"
        end
    end
    name.join("\n")
end

#display_time_end(circle, pos) ⇒ Object



62
# File 'lib/roby/gui/relations_view/relations_canvas.rb', line 62

def display_time_end(circle, pos); end

#display_time_start(circle, pos) ⇒ Object



61
# File 'lib/roby/gui/relations_view/relations_canvas.rb', line 61

def display_time_start(circle, pos); circle.translate(pos) end