Class: Archimate::Svg::Entity::Value

Inherits:
BaseEntity show all
Defined in:
lib/archimate/svg/entity/value.rb

Instance Attribute Summary

Attributes inherited from BaseEntity

#background_class, #badge, #badge_bounds, #bounds_offset, #child, #entity, #text_bounds

Instance Method Summary collapse

Methods inherited from BaseEntity

#entity_badge, #entity_label, #group_attrs, #initialize, #optional_link, #shape_style, #text_lines, #text_style, #to_svg

Constructor Details

This class inherits a constructor from Archimate::Svg::Entity::BaseEntity

Instance Method Details

#calc_text_bounds(_bounds) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/archimate/svg/entity/value.rb', line 16

def calc_text_bounds(_bounds)
  @text_bounds = DataModel::Bounds.new(@text_bounds.to_h.merge(
    x: @text_bounds.left + 10,
    y: @text_bounds.top + 10,
    width: @text_bounds.width - 20,
    height: @text_bounds.height - 20
  ))
end

#entity_shape(xml, bounds) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/archimate/svg/entity/value.rb', line 7

def entity_shape(xml, bounds)
  calc_text_bounds(bounds)
  cx = bounds.left + bounds.width / 2.0
  rx = bounds.width / 2.0 - 1
  cy = bounds.top + bounds.height / 2.0
  ry = bounds.height / 2.0 - 1
  xml.ellipse(cx: cx, cy: cy, rx: rx, ry: ry, class: background_class, style: shape_style)
end