Class: RenderSvg

Inherits:
Object
  • Object
show all
Defined in:
lib/render_svg3.rb

Instance Method Summary collapse

Constructor Details

#initializeRenderSvg

Returns a new instance of RenderSvg.



226
227
228
229
230
231
232
233
# File 'lib/render_svg3.rb', line 226

def initialize()
  @dom = {}
  @svg_procs = []
  puts 'render ...'

  load_elements
  #@dom = render_document(doc.root)    
end

Instance Method Details

#load_elementsObject



235
236
237
238
239
240
241
242
243
# File 'lib/render_svg3.rb', line 235

def load_elements()
  @h = {}
  @h['ellipse'] = ElementEllipse.new
  @h['line'] = ElementLine.new
  @h['rect'] = ElementRect.new
  @h['text'] = ElementText.new
  @h['tspan'] = ElementText.new

end

#render(doc) ⇒ Object



245
246
247
248
# File 'lib/render_svg3.rb', line 245

def render(doc)
  @svg_procs = []
  render_all doc        
end

#render_all(doc) ⇒ Object



250
251
252
253
254
255
256
257
258
# File 'lib/render_svg3.rb', line 250

def render_all( doc)
  if @h.has_key? doc.name then
    doc.ui_element = @h[doc.name] 
    doc.load_ui_element
    @svg_procs << doc.ui_element.invoke
  end

  doc.elements.each { |node|  render_all node}
end

#svg_procsObject



260
261
262
# File 'lib/render_svg3.rb', line 260

def svg_procs()
  @svg_procs
end