Class: Xsdvi::SVG::Symbols::Loop

Inherits:
Xsdvi::SVG::Symbol show all
Defined in:
lib/xsdvi/svg/symbols/loop.rb

Overview

Symbol for recursive loop references

Constant Summary

Constants inherited from Xsdvi::SVG::Symbol

Xsdvi::SVG::Symbol::MAX_HEIGHT, Xsdvi::SVG::Symbol::MID_HEIGHT, Xsdvi::SVG::Symbol::MIN_HEIGHT, Xsdvi::SVG::Symbol::MIN_WIDTH, Xsdvi::SVG::Symbol::PC_LAX, Xsdvi::SVG::Symbol::PC_SKIP, Xsdvi::SVG::Symbol::PC_STRICT, Xsdvi::SVG::Symbol::X_INDENT, Xsdvi::SVG::Symbol::Y_INDENT

Instance Attribute Summary

Attributes inherited from Xsdvi::SVG::Symbol

#additional_height, #description, #description_string_array, #height, #start_y_position, #svg, #width, #x_position, #y_position, #y_shift

Attributes inherited from Tree::Element

#children, #parent

Instance Method Summary collapse

Methods inherited from Xsdvi::SVG::Symbol

#initialize, #prepare_box, reset_class_variables, #x_end, #y_end

Methods inherited from Tree::Element

#add_child, #children?, #code, #first_child?, #index, #initialize, #last_child, #last_child?, #parent?

Constructor Details

This class inherits a constructor from Xsdvi::SVG::Symbol

Instance Method Details

#calculate_heightObject



29
30
31
# File 'lib/xsdvi/svg/symbols/loop.rb', line 29

def calculate_height
  MIN_HEIGHT
end

#calculate_widthObject



23
24
25
26
27
# File 'lib/xsdvi/svg/symbols/loop.rb', line 23

def calculate_width
  calc = Utils::WidthCalculator.new(MIN_WIDTH)
  calc.new_width(25, 4)
  calc.width
end

#drawObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/xsdvi/svg/symbols/loop.rb', line 10

def draw
  draw_g_start
  print("<rect class='boxloop' x='0' y='12' width='#{width}' " \
        "height='#{height}' rx='9'/>")
  print("<polygon class='filled' points='#{(width / 2) + 3},8 " \
        "#{(width / 2) - 2},12 #{(width / 2) + 3},17'/>")
  print("<polygon class='filled' points='#{width - 5},24 " \
        "#{width},19 #{width + 5},24'/>")
  print("<text x='10' y='27'>LOOP</text>")
  draw_connection
  draw_g_end
end