lib/rsyntaxtree/svg_graph.rb
# Draw a triangle between child/parent elements
Draw a triangle between child/parent elements
Draw a triangle between child / parent elements
def triangle_to_parent(fromX, fromY, fromW, textW, symmetrize = true)
    if (fromY == 0)
      return
    end
    toX = fromX
    fromCenter = (fromX + fromW / 2 + @m[:b_side])
    fromTop  = row2px(fromY).ceil
    fromLeft1 = (fromCenter + textW / 2).ceil
    fromLeft2 = (fromCenter - textW / 2).ceil
    toBot    = (row2px(fromY - 1) + @e_height)
    if symmetrize
      toLeft   = (toX + textW / 2 + @m[:b_side])
    else
      toLeft   = (toX + textW / 2 + @m[:b_side] * 3)
    end
    polygon_data = @polygon_styles.sub(/X1/, fromLeft1.ceil.to_s)
    polygon_data = polygon_data.sub(/Y1/, fromTop.ceil.to_s)
    polygon_data = polygon_data.sub(/X2/, fromLeft2.ceil.to_s)
    polygon_data = polygon_data.sub(/Y2/, fromTop.ceil.to_s)
    polygon_data = polygon_data.sub(/X3/, toLeft.ceil.to_s)
    @tree_data  += polygon_data.sub(/Y3/, toBot.ceil.to_s)
  end
def triangle_to_parent ( fromX , fromY , fromW , textW , symmetrize = true ) if ( fromY == 0 ) return end toX = fromX fromCenter = ( fromX + fromW / 2 + @m [ :b_side ] ) fromTop = row2px ( fromY ) . ceil fromLeft1 = ( fromCenter + textW / 2 ) . ceil fromLeft2 = ( fromCenter - textW / 2 ) . ceil toBot = ( row2px ( fromY - 1 ) + @e_height ) if symmetrize toLeft = ( toX + textW / 2 + @m [ :b_side ] ) else toLeft = ( toX + textW / 2 + @m [ :b_side ] * 3 ) end polygon_data = @polygon_styles . sub ( / X1 / , fromLeft1 . ceil . to_s ) polygon_data = polygon_data . sub ( / Y1 / , fromTop . ceil . to_s ) polygon_data = polygon_data . sub ( / X2 / , fromLeft2 . ceil . to_s ) polygon_data = polygon_data . sub ( / Y2 / , fromTop . ceil . to_s ) polygon_data = polygon_data . sub ( / X3 / , toLeft . ceil . to_s ) @tree_data += polygon_data . sub ( / Y3 / , toBot . ceil . to_s ) end
Draw a triangle between child/parent elements
Draw a triangle between child / parent elements
fromX
<not_specific>
fromY
<not_specific>
fromW
<not_specific>
textW
<not_specific>
symmetrize
<not_specific>