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



57
58
59
# File 'lib/roby/gui/relations_view/relations_canvas.rb', line 57

def self.priorities
    @@priorities ||= {}
end

.style(object, flags) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/roby/gui/relations_view/relations_canvas.rb', line 31

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

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

    styles[flags]
end

.stylesObject



53
54
55
# File 'lib/roby/gui/relations_view/relations_canvas.rb', line 53

def self.styles
    EVENT_STYLES
end

Instance Method Details

#display(display, graphics_item) ⇒ Object



98
99
100
# File 'lib/roby/gui/relations_view/relations_canvas.rb', line 98

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

#display_create(display) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/roby/gui/relations_view/relations_canvas.rb', line 61

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



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/roby/gui/relations_view/relations_canvas.rb', line 81

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" }
        unless owners.empty?
            name << "[#{owners.map(&:name).join(', ')}]"
        end
    end
    name.join("\n")
end

#display_time_end(circle, pos) ⇒ Object



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

def display_time_end(circle, pos); end

#display_time_start(circle, pos) ⇒ Object



75
76
77
# File 'lib/roby/gui/relations_view/relations_canvas.rb', line 75

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