Class: Archimate::Svg::Entity::Device
- Inherits:
-
BaseEntity
- Object
- BaseEntity
- Archimate::Svg::Entity::Device
- Includes:
- NodeShape
- Defined in:
- lib/archimate/svg/entity/device.rb
Instance Attribute Summary
Attributes inherited from BaseEntity
#background_class, #badge, #badge_bounds, #bounds_offset, #child, #entity, #text_bounds
Instance Method Summary collapse
- #device_path(xml, bounds) ⇒ Object
- #entity_shape(xml, bounds) ⇒ Object
-
#initialize(child, bounds_offset) ⇒ Device
constructor
A new instance of Device.
Methods included from NodeShape
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) ⇒ Device
Returns a new instance of Device.
9 10 11 |
# File 'lib/archimate/svg/entity/device.rb', line 9 def initialize(child, bounds_offset) super end |
Instance Method Details
#device_path(xml, bounds) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/archimate/svg/entity/device.rb', line 23 def device_path(xml, bounds) margin = 10 xml.rect( x: bounds.left, y: bounds.top, width: bounds.width, height: bounds.height - margin, rx: "6", ry: "6", class: background_class, style: shape_style ) decoration_path = [ "M", bounds.left + margin, bounds.bottom - margin, "l", -margin, margin, "h", bounds.width, "l", -margin, -margin, "z" ].flatten.join(" ") xml.path(d: decoration_path, class: background_class, style: shape_style) xml.path(d: decoration_path, class: "archimate-decoration", style: shape_style) end |
#entity_shape(xml, bounds) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/archimate/svg/entity/device.rb', line 13 def entity_shape(xml, bounds) case child.child_type when "1" @badge = "#archimate-device-badge" node_path(xml, bounds) else device_path(xml, bounds) end end |