Class: Archimate::Svg::Entity::EventEntity

Inherits:
BaseEntity
  • Object
show all
Defined in:
lib/archimate/svg/entity/event_entity.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, #layer_background_class, #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(notch_x) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/archimate/svg/entity/event_entity.rb', line 26

def calc_text_bounds(notch_x)
  bounds = @text_bounds
  @text_bounds = DataModel::Bounds.new(bounds.to_h.merge(
    x: bounds.left + notch_x * 0.80,
    width: bounds.width - notch_x
  ))
end

#entity_shape(xml, bounds) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/archimate/svg/entity/event_entity.rb', line 7

def entity_shape(xml, bounds)
  notch_x = 18
  notch_height = bounds.height / 2.0
  event_width = bounds.width * 0.85
  rx = 17
  calc_text_bounds(notch_x)
  xml.path(
    d: [
      "M", bounds.left, bounds.top,
      "l", notch_x, notch_height,
      "l", -notch_x, notch_height,
      "h", event_width,
      "a", rx, notch_height, 0, 0, 0, 0, -bounds.height,
      "z"
    ].flatten.join(" "),
    class: background_class, style: shape_style
  )
end