Class: Archimate::Svg::Entity::ApplicationComponent
- Inherits:
-
BaseEntity
- Object
- BaseEntity
- Archimate::Svg::Entity::ApplicationComponent
- Defined in:
- lib/archimate/svg/entity/application_component.rb
Overview
TODO: support alternate appearance
Instance Attribute Summary
Attributes inherited from BaseEntity
#background_class, #badge, #badge_bounds, #bounds_offset, #child, #entity, #text_bounds
Instance Method Summary collapse
- #component_decoration(xml, left, top) ⇒ Object
- #component_path(xml, bounds) ⇒ Object
- #entity_shape(xml, bounds) ⇒ Object
-
#initialize(child, bounds_offset) ⇒ ApplicationComponent
constructor
A new instance of ApplicationComponent.
- #set_text_bounds(bounds, main_box_x) ⇒ Object
Methods inherited from BaseEntity
#entity_badge, #entity_label, #group_attrs, #layer_background_class, #optional_link, #shape_style, #text_lines, #text_style, #to_svg
Constructor Details
#initialize(child, bounds_offset) ⇒ ApplicationComponent
Returns a new instance of ApplicationComponent.
8 9 10 |
# File 'lib/archimate/svg/entity/application_component.rb', line 8 def initialize(child, bounds_offset) super end |
Instance Method Details
#component_decoration(xml, left, top) ⇒ Object
25 26 27 28 |
# File 'lib/archimate/svg/entity/application_component.rb', line 25 def component_decoration(xml, left, top) xml.rect(x: left, y: top, width: "21", height: "13", class: background_class, style: shape_style) xml.rect(x: left, y: top, width: "21", height: "13", class: "archimate-decoration") end |
#component_path(xml, bounds) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/archimate/svg/entity/application_component.rb', line 16 def component_path(xml, bounds) main_box_x = bounds.left + 21.0 / 2 main_box_width = bounds.width - 21 / 2 set_text_bounds(bounds, main_box_x) xml.rect(x: main_box_x, y: bounds.top, width: main_box_width, height: bounds.height, class: background_class, style: shape_style) component_decoration(xml, bounds.left, bounds.top + 10) component_decoration(xml, bounds.left, bounds.top + 30) end |
#entity_shape(xml, bounds) ⇒ Object
12 13 14 |
# File 'lib/archimate/svg/entity/application_component.rb', line 12 def entity_shape(xml, bounds) component_path(xml, bounds) end |
#set_text_bounds(bounds, main_box_x) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/archimate/svg/entity/application_component.rb', line 30 def set_text_bounds(bounds, main_box_x) @text_bounds = DataModel::Bounds.new( x: main_box_x + 21 / 2, y: bounds.top + 1, width: bounds.width - 22, height: bounds.height - 2 ) end |