### Home Classes Methods

### In Files

- lib/graphviz/family_tree/couple.rb

### Parent

Object

### Methods

- #getKids
- #kids

### Files

- AUTHORS
- COPYING
- README.rdoc

### Class/Module Index

Quicksearch

- GraphViz
- GraphViz::Attrs
- GraphViz::Edge
- GraphViz::Elements
- GraphViz::Ext
- GraphViz::FamilyTree
- GraphViz::FamilyTree::Couple
- GraphViz::FamilyTree::Generation
- GraphViz::FamilyTree::Person
- GraphViz::FamilyTree::Sibling
- GraphViz::GraphML
- GraphViz::Math
- GraphViz::Math::CoordinateError
- GraphViz::Math::Matrix
- GraphViz::Math::ValueError
- GraphViz::Node
- GraphViz::Theory
- GraphViz::Types
- GraphViz::Types::Common
- GraphViz::Types::EscString
- GraphViz::Types::GvDouble
- GraphViz::Types::HtmlString
- GraphViz::Types::LblString
- GraphViz::XML
- Constants
- GVUtils
- Hash
- Object
- String

No matching classes.

# GraphViz::FamilyTree::Couple

### Public Instance Methods

getKids() click to toggle source

    # File lib/graphviz/family_tree/couple.rb, line 58
    def getKids
      @kids
    end

kids( *z ) click to toggle source

Add kids to a couple

    # File lib/graphviz/family_tree/couple.rb, line 16
    def kids( *z )
      @kids = GraphViz::FamilyTree::Sibling.new( z, @persons )

      return

      if z.size == 1
        @graph.add_edge( @node, z[0].node, "dir" => "none" )
      else
        cluster = @graph.add_graph( "#{@node.id}Kids" )
        cluster["rank"] = "same"

        last = nil
        count = 0
        add = (z.size-1)%2 * z.size/2 + (z.size-1)%2
        link = (z.size/2)+1

        z.each do |person|
          count = count + 1
          if count == add
            middle = cluster.add_node( "#{@node.id}Kids", "shape" => "point" )
            @graph.add_edge( @node, middle, "dir" => "none" )
            unless last.nil?
              cluster.add_edge( last, middle, "dir" => "none" )
            end
            last = middle
          end

          kid = cluster.add_node( "#{person.node.id}Kid", "shape" => "point" )
          @graph.add_edge( kid, person.node, "dir" => "none" )

          if add == 0 and count == link
            @graph.add_edge( @node, kid, "dir" => "none" )
          end

          unless last.nil?
            cluster.add_edge( last, kid, "dir" => "none" )
          end
          last = kid
        end
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.