Class: Archimate::Svg::Entity::EventEntity
- Inherits:
-
RoundedRectEntity
- Object
- BaseEntity
- RoundedRectEntity
- Archimate::Svg::Entity::EventEntity
- Defined in:
- lib/archimate/svg/entity/event_entity.rb
Direct Known Subclasses
ApplicationEvent, BusinessEvent, ImplementationEvent, TechnologyEvent
Instance Attribute Summary
Attributes inherited from BaseEntity
#background_class, #badge, #badge_bounds, #bounds_offset, #child, #entity, #text_bounds
Instance Method Summary collapse
- #calc_event_text_bounds(notch_x) ⇒ Object
- #entity_shape(xml, bounds) ⇒ Object
- #event_path(xml, bounds) ⇒ Object
-
#initialize(child, bounds_offset) ⇒ EventEntity
constructor
A new instance of EventEntity.
Methods inherited from BaseEntity
#entity_badge, #entity_label, #group_attrs, #optional_link, #shape_style, #text_lines, #text_style, #to_svg
Constructor Details
#initialize(child, bounds_offset) ⇒ EventEntity
Returns a new instance of EventEntity.
7 8 9 10 |
# File 'lib/archimate/svg/entity/event_entity.rb', line 7 def initialize(child, bounds_offset) super @badge = "#archimate-event-badge" end |
Instance Method Details
#calc_event_text_bounds(notch_x) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/archimate/svg/entity/event_entity.rb', line 41 def calc_event_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
12 13 14 15 16 17 18 19 20 |
# File 'lib/archimate/svg/entity/event_entity.rb', line 12 def entity_shape(xml, bounds) case child.child_type when "1" @badge = nil event_path(xml, bounds) else super end end |
#event_path(xml, bounds) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/archimate/svg/entity/event_entity.rb', line 22 def event_path(xml, bounds) notch_x = 18 notch_height = bounds.height / 2.0 event_width = bounds.width * 0.85 rx = 17 calc_event_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 |