Class: Doodl::RandomLayout

Inherits:
Layout
  • Object
show all
Defined in:
lib/layout/layout.rb

Instance Attribute Summary

Attributes inherited from Layout

#graph, #iterations, #locations

Instance Method Summary collapse

Methods inherited from Layout

#center_x, #center_y, #deep_copy, #finished?, #get_nearest_node, #get_nearest_node_within, #init, #initialize, #layout, #move, #rotate, #set_location

Constructor Details

This class inherits a constructor from Doodl::Layout

Instance Method Details

#dolayout(graph) ⇒ Object

def initialize(view)

super(view)

end



116
117
118
119
120
121
122
123
124
# File 'lib/layout/layout.rb', line 116

def dolayout(graph)
  $LOG.info "Started RandomLayout" if $LOG
  width = @view.width * 0.9
  height = @view.height * 0.9
  graph.each_node do |node|
    @locations[node] = Location.new(rand(width), rand(height))
  end
  $LOG.info "Finished RandomLayout" if $LOG
end