Class: Ea::Svg::EaEmitter::Markers

Inherits:
Object
  • Object
show all
Defined in:
lib/ea/svg/ea_emitter/markers.rb

Overview

Emits arrow / diamond markers per connector, matching EA's convention:

- Association (navigable): filled triangle at target
- Generalization: open triangle at target
- Realization: open triangle at target (path dashed)
- Dependency: open arrow at target (path dashed)
- Aggregation (source): open diamond at source
- Composition (source): filled diamond at source

Constant Summary collapse

ARROW_SIZE =
10

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(diagram, model_index:) ⇒ Markers

Returns a new instance of Markers.



19
20
21
22
# File 'lib/ea/svg/ea_emitter/markers.rb', line 19

def initialize(diagram, model_index:)
  @diagram = diagram
  @model_index = model_index
end

Instance Attribute Details

#diagramObject (readonly)

Returns the value of attribute diagram.



17
18
19
# File 'lib/ea/svg/ea_emitter/markers.rb', line 17

def diagram
  @diagram
end

#model_indexObject (readonly)

Returns the value of attribute model_index.



17
18
19
# File 'lib/ea/svg/ea_emitter/markers.rb', line 17

def model_index
  @model_index
end

Instance Method Details

#renderObject



24
25
26
27
28
29
# File 'lib/ea/svg/ea_emitter/markers.rb', line 24

def render
  polys = visible_connectors.filter_map { |c| polygon_for(c) }
  return "" if polys.empty?

  polys.join("\n")
end