Class: Archimate::Svg::Entity::Representation

Inherits:
BaseEntity
  • Object
show all
Defined in:
lib/archimate/svg/entity/representation.rb

Direct Known Subclasses

Deliverable, Gap

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

#entity_shape(xml, bounds) ⇒ Object



7
8
9
# File 'lib/archimate/svg/entity/representation.rb', line 7

def entity_shape(xml, bounds)
  representation_path(xml, bounds)
end

#representation_path(xml, bounds) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/archimate/svg/entity/representation.rb', line 11

def representation_path(xml, bounds)
  xml.path(
    d: [
      ["M", bounds.left, bounds.top],
      ["v", bounds.height - 8],
      ["c", 0.167 * bounds.width, 0.133 * bounds.height,
       0.336 * bounds.width, 0.133 * bounds.height,
       bounds.width * 0.508, 0],
      ["c", 0.0161 * bounds.width, -0.0778 * bounds.height,
       0.322 * bounds.width, -0.0778 * bounds.height,
       bounds.width * 0.475, 0],
      ["v", -(bounds.height - 8)],
      "z"
    ].flatten.join(" "),
    class: background_class, style: shape_style
  )
end