Class: Lutaml::Xsd::Spa::Svg::Connectors::ReferenceConnector

Inherits:
Lutaml::Xsd::Spa::Svg::ConnectorRenderer show all
Defined in:
lib/lutaml/xsd/spa/svg/connectors/reference_connector.rb

Overview

Renders reference relationship with dashed line and hollow arrow (e.g., Element references another Element)

Instance Attribute Summary

Attributes inherited from Lutaml::Xsd::Spa::Svg::ConnectorRenderer

#config, #style

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ ReferenceConnector

Returns a new instance of ReferenceConnector.



13
14
15
# File 'lib/lutaml/xsd/spa/svg/connectors/reference_connector.rb', line 13

def initialize(config)
  super(config, "reference")
end

Instance Method Details

#render(from_point, to_point) ⇒ Object

Renders a reference connector Dashed line with hollow arrow indicates reference



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/lutaml/xsd/spa/svg/connectors/reference_connector.rb', line 19

def render(from_point, to_point)
  parts = []

  # Draw dashed line
  parts << create_line(
    from_point,
    to_point,
    dash_pattern: style.dash_pattern,
  )

  # Draw hollow triangle
  parts << create_hollow_triangle_at(to_point, from_point)

  parts.join("\n")
end