Class: LinkView
- Inherits:
-
Object
- Object
- LinkView
- Defined in:
- lib/gui/link_view.rb
Instance Method Summary collapse
- #color(cl) ⇒ Object
- #display ⇒ Object
- #hide ⇒ Object
-
#initialize(map, lnk, status) ⇒ LinkView
constructor
A new instance of LinkView.
- #remove_link ⇒ Object
- #show ⇒ Object
- #update_status(st) ⇒ Object
Constructor Details
#initialize(map, lnk, status) ⇒ LinkView
Returns a new instance of LinkView.
3 4 5 6 7 8 9 10 |
# File 'lib/gui/link_view.rb', line 3 def initialize (map, lnk, status) @visible=true @link=lnk @group = Goo::CanvasGroup.new($network[map].map_view,{:x => 0.0,:y => 0.0, :can_focus => true}) @group.lower(nil) @color = $status_color[$status_value.index(status)] display() end |
Instance Method Details
#color(cl) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/gui/link_view.rb', line 35 def color(cl) @color = cl Gtk.thread_protect do @lign.stroke_color_rgba = @color end end |
#display ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/gui/link_view.rb', line 12 def display() self.show() @lign=Goo::CanvasPolyline.new(@group, false, [[@link.node1.x+@link.node1.node_view.get_node_size()/2,@link.node1.y+@link.node1.node_view.get_node_size()/2], [@link.node2.x+@link.node2.node_view.get_node_size()/2,@link.node2.y+@link.node2.node_view.get_node_size()/2]], :stroke_color_rgba => @color, :line_width => 2.0) end |
#hide ⇒ Object
26 27 28 29 |
# File 'lib/gui/link_view.rb', line 26 def hide() @visible=false @group.visibility = Goo::CanvasItem::HIDDEN end |
#remove_link ⇒ Object
31 32 33 |
# File 'lib/gui/link_view.rb', line 31 def remove_link() @group.remove_child(@lign) end |
#show ⇒ Object
21 22 23 24 |
# File 'lib/gui/link_view.rb', line 21 def show() @visible=true @group.visibility = Goo::CanvasItem::VISIBLE end |
#update_status(st) ⇒ Object
42 43 44 |
# File 'lib/gui/link_view.rb', line 42 def update_status(st) color($status_color[$status_value.index(st)]) end |