Class: Ea::Qea::Models::EaDiagramObject
- Inherits:
-
BaseModel
- Object
- Lutaml::Model::Serializable
- BaseModel
- Ea::Qea::Models::EaDiagramObject
- Defined in:
- lib/ea/qea/models/ea_diagram_object.rb
Overview
Represents a diagram object from the t_diagramobjects table
This model represents the placement of UML elements (classes, packages, etc.) on specific diagrams, including their position and styling.
Constant Summary collapse
- COLUMN_MAP =
{ "Object_ID" => :ea_object_id, }.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#bounding_box ⇒ Hash
Get the bounding box of the diagram object.
-
#center_point ⇒ Hash
Get the center point of the diagram object.
-
#parsed_style ⇒ Hash
Parse ObjectStyle string into a hash.
Methods inherited from BaseModel
from_db_row, #primary_key, #sort_position
Class Method Details
.column_map ⇒ Object
34 35 36 |
# File 'lib/ea/qea/models/ea_diagram_object.rb', line 34 def self.column_map COLUMN_MAP end |
.primary_key_column ⇒ Object
21 22 23 |
# File 'lib/ea/qea/models/ea_diagram_object.rb', line 21 def self.primary_key_column :instance_id end |
.table_name ⇒ Object
25 26 27 |
# File 'lib/ea/qea/models/ea_diagram_object.rb', line 25 def self.table_name "t_diagramobjects" end |
Instance Method Details
#bounding_box ⇒ Hash
Get the bounding box of the diagram object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ea/qea/models/ea_diagram_object.rb', line 40 def bounding_box { top: recttop, left: rectleft, right: rectright, bottom: rectbottom, width: rectright - rectleft, height: rectbottom - recttop, } end |
#center_point ⇒ Hash
Get the center point of the diagram object
53 54 55 56 57 58 |
# File 'lib/ea/qea/models/ea_diagram_object.rb', line 53 def center_point { x: (rectleft + rectright) / 2, y: (recttop + rectbottom) / 2, } end |
#parsed_style ⇒ Hash
Parse ObjectStyle string into a hash
62 63 64 65 66 67 68 69 |
# File 'lib/ea/qea/models/ea_diagram_object.rb', line 62 def parsed_style return {} unless objectstyle objectstyle.split(";").each_with_object({}) do |pair, hash| key, value = pair.split("=", 2) hash[key] = value if key && value end end |