Class: Xsdvi::SVG::Symbols::All

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

Overview

Symbol for XSD all compositor

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 collapse

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

#prepare_box, reset_class_variables, #x_end, #y_end

Methods inherited from Tree::Element

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

Constructor Details

#initializeAll

Returns a new instance of All.



12
13
14
15
# File 'lib/xsdvi/svg/symbols/all.rb', line 12

def initialize
  super
  @cardinality = nil
end

Instance Attribute Details

#cardinalityObject

Returns the value of attribute cardinality.



10
11
12
# File 'lib/xsdvi/svg/symbols/all.rb', line 10

def cardinality
  @cardinality
end

Instance Method Details

#calculate_heightObject



40
41
42
# File 'lib/xsdvi/svg/symbols/all.rb', line 40

def calculate_height
  MID_HEIGHT
end

#calculate_widthObject



34
35
36
37
38
# File 'lib/xsdvi/svg/symbols/all.rb', line 34

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

#drawObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/xsdvi/svg/symbols/all.rb', line 17

def draw
  process_description
  draw_g_start
  print("<rect class='boxcompositor' x='0' y='8' width='#{width}' " \
        "height='#{height}' rx='9'/>")
  print("<circle cx='#{(width / 2) + 12}' cy='14' r='2'/>")
  print("<circle cx='#{(width / 2) + 12}' cy='23' r='2'/>")
  print("<circle cx='#{(width / 2) + 12}' cy='32' r='2'/>")
  print("<text class='small' x='#{width / 2}' y='17'>∀</text>")
  print("<line x1='#{(width / 2) + 12}' y1='14' x2='#{(width / 2) + 12}' y2='32'/>")
  print("<text x='5' y='52'>#{cardinality}</text>") if cardinality
  draw_description(52)
  draw_connection
  draw_use
  draw_g_end
end