Class: Ea::Svg::EaEmitter::Elements
- Inherits:
-
Object
- Object
- Ea::Svg::EaEmitter::Elements
- Defined in:
- lib/ea/svg/ea_emitter/elements.rb
Overview
Emits the elements layer. Orchestrates per-element rendering by delegating to specialized compartment renderers (shape, header, divider, attribute). Frame-element filtering and stereotype-color fallback also live in dedicated collaborators.
Defined Under Namespace
Classes: PackageContentRow
Constant Summary collapse
- DEFAULT_FILL =
"#FFFFFF"- DEFAULT_STROKE =
"#000000"- DEFAULT_STROKE_WIDTH =
2- DEFAULT_TEXT_COLOR =
"#000000"
Instance Attribute Summary collapse
-
#canvas ⇒ Object
readonly
Returns the value of attribute canvas.
-
#diagram ⇒ Object
readonly
Returns the value of attribute diagram.
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#model_index ⇒ Object
readonly
Returns the value of attribute model_index.
Instance Method Summary collapse
-
#groups ⇒ Object
Returns an Array of per-entity
<g>...</g>strings. -
#initialize(diagram, model_index:, canvas: nil, document: nil) ⇒ Elements
constructor
A new instance of Elements.
- #render ⇒ Object
Constructor Details
#initialize(diagram, model_index:, canvas: nil, document: nil) ⇒ Elements
Returns a new instance of Elements.
19 20 21 22 23 24 |
# File 'lib/ea/svg/ea_emitter/elements.rb', line 19 def initialize(diagram, model_index:, canvas: nil, document: nil) @diagram = diagram @model_index = model_index @canvas = canvas @document = document end |
Instance Attribute Details
#canvas ⇒ Object (readonly)
Returns the value of attribute canvas.
17 18 19 |
# File 'lib/ea/svg/ea_emitter/elements.rb', line 17 def canvas @canvas end |
#diagram ⇒ Object (readonly)
Returns the value of attribute diagram.
17 18 19 |
# File 'lib/ea/svg/ea_emitter/elements.rb', line 17 def diagram @diagram end |
#document ⇒ Object (readonly)
Returns the value of attribute document.
17 18 19 |
# File 'lib/ea/svg/ea_emitter/elements.rb', line 17 def document @document end |
#model_index ⇒ Object (readonly)
Returns the value of attribute model_index.
17 18 19 |
# File 'lib/ea/svg/ea_emitter/elements.rb', line 17 def model_index @model_index end |
Instance Method Details
#groups ⇒ Object
Returns an Array of per-entity <g>...</g> strings.
Each element contributes up to 4 groups (shape, header,
divider, attrs) in EA's per-entity layer order.
33 34 35 |
# File 'lib/ea/svg/ea_emitter/elements.rb', line 33 def groups ordered_elements.flat_map { |e| groups_for(e) } end |
#render ⇒ Object
26 27 28 |
# File 'lib/ea/svg/ea_emitter/elements.rb', line 26 def render groups.join("\n") end |