Module: Rubyvis::Layout::NodeLink

Included in:
Cluster, Partition
Defined in:
lib/rubyvis/layout/hierarchy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_hObject

Returns the value of attribute _h.



63
64
65
# File 'lib/rubyvis/layout/hierarchy.rb', line 63

def _h
  @_h
end

#_irObject

Returns the value of attribute _ir.



63
64
65
# File 'lib/rubyvis/layout/hierarchy.rb', line 63

def _ir
  @_ir
end

#_orObject

Returns the value of attribute _or.



63
64
65
# File 'lib/rubyvis/layout/hierarchy.rb', line 63

def _or
  @_or
end

#_orientObject

Returns the value of attribute _orient.



63
64
65
# File 'lib/rubyvis/layout/hierarchy.rb', line 63

def _orient
  @_orient
end

#_wObject

Returns the value of attribute _w.



63
64
65
# File 'lib/rubyvis/layout/hierarchy.rb', line 63

def _w
  @_w
end

Instance Method Details



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/rubyvis/layout/hierarchy.rb', line 64

def node_link_build_implied(s)
  nodes = s.nodes
  @_orient= s.orient
  horizontal= case @_orient
    when /^(top|bottom)$/
      true
    else
      false
    end
  @_w = s.width
  @_h = s.height
  
  # /* Compute default inner and outer radius. */
  if (@_orient == "radial") 
    @_ir = s.inner_radius
    @_or = s.outer_radius
    @_ir||=0
    @_or||=[@_w,@_h].min / 2.0
  end
  nodes.each_with_index{|n,i|
    n.mid_angle = (@_orient == "radial") ? mid_angle(n) : (horizontal ? Math::PI / 2.0 : 0)
    n.x = node_link_x(n)
    n.y = node_link_y(n)
    n.mid_angle+=Math::PI if (n.first_child)
  }
  false
end