Class: ElementSvg
- Inherits:
-
Object
show all
- Defined in:
- lib/render_svg3.rb
Overview
Instance Method Summary
collapse
Constructor Details
this initialize method should be overridden with a class_eval from the calling RSF job
29
30
31
32
33
|
# File 'lib/render_svg3.rb', line 29
def initialize()
initialize_variables()
end
|
Instance Method Details
#get_style_properties(properties_string) ⇒ Object
75
76
77
78
79
|
# File 'lib/render_svg3.rb', line 75
def get_style_properties(properties_string)
properties_string.split(/;/).map do |a|
a.match(/^(.[^:]+):([^$]+$)/).captures.map {|x| x.strip}
end
end
|
#initialize_variables ⇒ Object
35
36
37
38
|
# File 'lib/render_svg3.rb', line 35
def initialize_variables()
@property = {'style' => ''}
@style_property = {}
end
|
#load_properties(attributes) ⇒ Object
81
82
83
84
85
86
|
# File 'lib/render_svg3.rb', line 81
def load_properties(attributes)
attributes.each_attribute do |attribute|
@property[attribute.name] = attribute.value if @property.has_key? attribute.name
end
parse_style()
end
|
#load_renderer(renderer) ⇒ Object
88
89
90
|
# File 'lib/render_svg3.rb', line 88
def load_renderer(renderer)
@@shape = renderer
end
|
#parse_style ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/render_svg3.rb', line 63
def parse_style()
if @property['style'] then
properties = get_style_properties(@property['style'])
properties.each do |name, value|
@style_property[name] = value if @style_property.has_key? name
end
end
end
|
#render_element ⇒ Object
57
58
59
60
61
|
# File 'lib/render_svg3.rb', line 57
def render_element()
properties = yield
@@shape.draw @type, properties
end
|
#scale ⇒ Object
49
|
# File 'lib/render_svg3.rb', line 49
def scale() @@scale end
|
#scale=(val) ⇒ Object
48
|
# File 'lib/render_svg3.rb', line 48
def scale=(val); @@scale = val; end
|
#text ⇒ Object
44
45
46
|
# File 'lib/render_svg3.rb', line 44
def text()
@text
end
|
#text=(val) ⇒ Object
40
41
42
|
# File 'lib/render_svg3.rb', line 40
def text=(val)
@text = val
end
|
#x_offset ⇒ Object
52
|
# File 'lib/render_svg3.rb', line 52
def x_offset(); @@x_offset; end
|
#x_offset=(val) ⇒ Object
51
|
# File 'lib/render_svg3.rb', line 51
def x_offset=(val); @@x_offset = val; end
|
#y_offset ⇒ Object
55
|
# File 'lib/render_svg3.rb', line 55
def y_offset(); @@y_offset; end
|
#y_offset=(val) ⇒ Object
54
|
# File 'lib/render_svg3.rb', line 54
def y_offset=(val); @@y_offset = val; end
|