Class: Lutaml::Ea::Diagram::DiagramRenderer
- Inherits:
-
Object
- Object
- Lutaml::Ea::Diagram::DiagramRenderer
- Defined in:
- lib/lutaml/ea/diagram.rb
Overview
Main entry point for diagram rendering
Instance Attribute Summary collapse
-
#diagram_data ⇒ Object
readonly
Returns the value of attribute diagram_data.
-
#layout_engine ⇒ Object
readonly
Returns the value of attribute layout_engine.
-
#style_parser ⇒ Object
readonly
Returns the value of attribute style_parser.
Instance Method Summary collapse
-
#bounds ⇒ Hash
Get diagram bounds for viewport calculation.
-
#connectors ⇒ Array
Get all connectors in the diagram.
-
#elements ⇒ Array
Get all elements in the diagram.
-
#initialize(diagram_data) ⇒ DiagramRenderer
constructor
A new instance of DiagramRenderer.
-
#render_svg(options = {}) ⇒ String
Render the complete diagram as SVG.
Constructor Details
#initialize(diagram_data) ⇒ DiagramRenderer
Returns a new instance of DiagramRenderer.
20 21 22 23 24 |
# File 'lib/lutaml/ea/diagram.rb', line 20 def initialize(diagram_data) @diagram_data = diagram_data @layout_engine = LayoutEngine.new @style_parser = StyleParser.new end |
Instance Attribute Details
#diagram_data ⇒ Object (readonly)
Returns the value of attribute diagram_data.
18 19 20 |
# File 'lib/lutaml/ea/diagram.rb', line 18 def diagram_data @diagram_data end |
#layout_engine ⇒ Object (readonly)
Returns the value of attribute layout_engine.
18 19 20 |
# File 'lib/lutaml/ea/diagram.rb', line 18 def layout_engine @layout_engine end |
#style_parser ⇒ Object (readonly)
Returns the value of attribute style_parser.
18 19 20 |
# File 'lib/lutaml/ea/diagram.rb', line 18 def style_parser @style_parser end |
Instance Method Details
#bounds ⇒ Hash
Get diagram bounds for viewport calculation
35 36 37 |
# File 'lib/lutaml/ea/diagram.rb', line 35 def bounds layout_engine.calculate_bounds(diagram_data) end |
#connectors ⇒ Array
Get all connectors in the diagram
47 48 49 |
# File 'lib/lutaml/ea/diagram.rb', line 47 def connectors diagram_data[:connectors] || [] end |
#elements ⇒ Array
Get all elements in the diagram
41 42 43 |
# File 'lib/lutaml/ea/diagram.rb', line 41 def elements diagram_data[:elements] || [] end |
#render_svg(options = {}) ⇒ String
Render the complete diagram as SVG
28 29 30 31 |
# File 'lib/lutaml/ea/diagram.rb', line 28 def render_svg( = {}) svg_renderer = SvgRenderer.new(self, ) svg_renderer.render end |