Class: Lutaml::Ea::Diagram::ElementRenderers::ConnectorRenderer
- Inherits:
-
BaseRenderer
- Object
- BaseRenderer
- Lutaml::Ea::Diagram::ElementRenderers::ConnectorRenderer
- Defined in:
- lib/lutaml/ea/diagram/element_renderers/connector_renderer.rb
Overview
Renderer for connector elements (relationships)
Instance Attribute Summary collapse
-
#source_element ⇒ Object
readonly
Returns the value of attribute source_element.
-
#target_element ⇒ Object
readonly
Returns the value of attribute target_element.
Attributes inherited from BaseRenderer
Instance Method Summary collapse
-
#initialize(connector, style_parser, source_element = nil, target_element = nil) ⇒ ConnectorRenderer
constructor
rubocop:disable Lint/MissingSuper.
-
#render ⇒ String
Render the connector as SVG path.
Constructor Details
#initialize(connector, style_parser, source_element = nil, target_element = nil) ⇒ ConnectorRenderer
rubocop:disable Lint/MissingSuper
13 14 15 16 17 18 19 20 21 |
# File 'lib/lutaml/ea/diagram/element_renderers/connector_renderer.rb', line 13 def initialize( # rubocop:disable Lint/MissingSuper connector, style_parser, source_element = nil, target_element = nil ) @element = connector @style_parser = style_parser @source_element = source_element @target_element = target_element end |
Instance Attribute Details
#source_element ⇒ Object (readonly)
Returns the value of attribute source_element.
11 12 13 |
# File 'lib/lutaml/ea/diagram/element_renderers/connector_renderer.rb', line 11 def source_element @source_element end |
#target_element ⇒ Object (readonly)
Returns the value of attribute target_element.
11 12 13 |
# File 'lib/lutaml/ea/diagram/element_renderers/connector_renderer.rb', line 11 def target_element @target_element end |
Instance Method Details
#render ⇒ String
Render the connector as SVG path
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/lutaml/ea/diagram/element_renderers/connector_renderer.rb', line 25 def render path_builder = PathBuilder.new(@element, source_element, target_element) path_data = path_builder.build_path style = style_parser.parse_connector_style(@element) # Add connector type class css_classes = ["lutaml-diagram-connector", "lutaml-diagram-connector-#{@element[:type]}"] <<~SVG <path d="#{path_data}" class="#{css_classes.join(' ')}" style="#{style_to_css(style)}" data-connector-id="#{@element[:id]}" data-connector-type="#{@element[:type]}" marker-end="url(#arrowhead)" /> SVG end |