Module: Treemap
- Defined in:
- lib/treemap.rb,
lib/treemap/node.rb,
lib/treemap/rectangle.rb,
lib/treemap/color_base.rb,
lib/treemap/layout_base.rb,
lib/treemap/output_base.rb
Overview
– layout_base.rb - RubyTreemap
Copyright © 2006 by Andrew Bruno <[email protected]>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
++
Defined Under Namespace
Classes: ColorBase, GradientColor, HtmlOutput, ImageOutput, LayoutBase, Node, OutputBase, Rectangle, SliceLayout, SquarifiedLayout, SvgOutput
Constant Summary collapse
- VERSION =
"0.0.3"
Class Method Summary collapse
Class Method Details
.dump_tree(node) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/treemap.rb', line 30 def Treemap::dump_tree(node) puts "#{node.label}: #{node.bounds.to_s}" node.children.each do |c| dump_tree(c) end end |
.node_from_xml(xmlnode) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/treemap.rb', line 42 def Treemap::node_from_xml(xmlnode) node = Treemap::Node.new node.label = xmlnode.attributes["label"] id = xmlnode.attributes["id"] if(!id.nil?) node.id = id.to_s end node.size = xmlnode.attributes["size"] node.size = node.size.to_f unless node.size.nil? node.color = xmlnode.attributes["change"] node.color = node.color.to_f unless node.color.nil? xmlnode.elements.each do |c| child = node_from_xml(c) node.add_child(child) if !child.nil? end return nil if node.size < 5 node end |
.tree_from_xml(file) ⇒ Object
37 38 39 40 |
# File 'lib/treemap.rb', line 37 def Treemap::tree_from_xml(file) doc = REXML::Document.new(file) node_from_xml(doc.root) end |