Class: Ea::Svg::EaEmitter::Elements

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

Overview

Emits the elements layer: for each DiagramElement on the diagram, emits the EA-shape group (filled rect) plus the EA-text group (stereotype + name + attributes + operations).

Each element is rendered in z_order (ascending). Output follows EA's pattern of layered groups per element:

<g style="fill:COLOR;..."><rect x y w h/></g>
<g style="fill:#000000;..."><text>...</text></g>
<g style="..."><path d="M x y L x2 y2"/></g>   (divider)
<g style="..."><text>attr1</text>...</g>

Constant Summary collapse

DEFAULT_FILL =
"#FFFFFF"
DEFAULT_STROKE =
"#000000"
DEFAULT_FONT_FAMILY =
"Calibri"
DEFAULT_FONT_SIZE =
13

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(diagram, model_index:) ⇒ Elements

Returns a new instance of Elements.



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

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

Instance Attribute Details

#diagramObject (readonly)

Returns the value of attribute diagram.



23
24
25
# File 'lib/ea/svg/ea_emitter/elements.rb', line 23

def diagram
  @diagram
end

#model_indexObject (readonly)

Returns the value of attribute model_index.



23
24
25
# File 'lib/ea/svg/ea_emitter/elements.rb', line 23

def model_index
  @model_index
end

Instance Method Details

#renderObject



30
31
32
# File 'lib/ea/svg/ea_emitter/elements.rb', line 30

def render
  ordered_elements.map { |e| render_one(e) }.join("\n")
end