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.
35 36 37 38 39 |
# File 'lib/lutaml/ea/diagram.rb', line 35 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.
33 34 35 |
# File 'lib/lutaml/ea/diagram.rb', line 33 def diagram_data @diagram_data end |
#layout_engine ⇒ Object (readonly)
Returns the value of attribute layout_engine.
33 34 35 |
# File 'lib/lutaml/ea/diagram.rb', line 33 def layout_engine @layout_engine end |
#style_parser ⇒ Object (readonly)
Returns the value of attribute style_parser.
33 34 35 |
# File 'lib/lutaml/ea/diagram.rb', line 33 def style_parser @style_parser end |
Instance Method Details
#bounds ⇒ Hash
Get diagram bounds for viewport calculation
50 51 52 |
# File 'lib/lutaml/ea/diagram.rb', line 50 def bounds layout_engine.calculate_bounds(diagram_data) end |
#connectors ⇒ Array
Get all connectors in the diagram
62 63 64 |
# File 'lib/lutaml/ea/diagram.rb', line 62 def connectors diagram_data[:connectors] || [] end |
#elements ⇒ Array
Get all elements in the diagram
56 57 58 |
# File 'lib/lutaml/ea/diagram.rb', line 56 def elements diagram_data[:elements] || [] end |
#render_svg(options = {}) ⇒ String
Render the complete diagram as SVG
43 44 45 46 |
# File 'lib/lutaml/ea/diagram.rb', line 43 def render_svg( = {}) svg_renderer = SvgRenderer.new(self, ) svg_renderer.render end |