Class: Lutaml::Xsd::Spa::Svg::Connectors::ContainmentConnector

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

Overview

Renders containment relationship with solid triangle arrow (e.g., Element has Type)

Instance Attribute Summary

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

#config, #style

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ ContainmentConnector

Returns a new instance of ContainmentConnector.



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

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

Instance Method Details

#render(from_point, to_point) ⇒ Object

Renders a containment connector Solid triangle indicates “has-a” relationship



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

def render(from_point, to_point)
  parts = []

  # Draw line
  parts << create_line(from_point, to_point)

  # Draw solid triangle at target
  parts << create_solid_triangle_at(to_point, from_point)

  parts.join("\n")
end