Class: Archimate::Svg::Entity::DataEntity
- Inherits:
-
BaseEntity
- Object
- BaseEntity
- Archimate::Svg::Entity::DataEntity
- Defined in:
- lib/archimate/svg/entity/data_entity.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BaseEntity
#background_class, #badge, #badge_bounds, #bounds_offset, #child, #entity, #text_bounds
Instance Method Summary collapse
- #calc_text_bounds(_bounds) ⇒ Object
- #entity_shape(xml, bounds) ⇒ Object
-
#initialize(child, bounds_offset) ⇒ DataEntity
constructor
A new instance of DataEntity.
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) ⇒ DataEntity
Returns a new instance of DataEntity.
7 8 9 10 |
# File 'lib/archimate/svg/entity/data_entity.rb', line 7 def initialize(child, bounds_offset) super @margin = 8 end |
Instance Method Details
#calc_text_bounds(_bounds) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/archimate/svg/entity/data_entity.rb', line 12 def calc_text_bounds(_bounds) @text_bounds = DataModel::Bounds.new(@text_bounds.to_h.merge( y: @text_bounds.top + @margin, height: @text_bounds.height - @margin )) end |
#entity_shape(xml, bounds) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/archimate/svg/entity/data_entity.rb', line 19 def entity_shape(xml, bounds) calc_text_bounds(bounds) xml.g(class: background_class) do xml.rect(x: bounds.left, y: bounds.top, width: bounds.width, height: bounds.height, class: background_class, style: shape_style) xml.rect(x: bounds.left, y: bounds.top, width: bounds.width, height: @margin, class: "archimate-decoration") end end |