Class: Archimate::DataModel::Connection
Overview
Graphical connection type.
If the ‘relationshipRef’ attribute is present, the connection should reference an existing ArchiMate relationship.
If the connection is an ArchiMate relationship type, the connection’s label, documentation and properties may be determined (i.e inherited) from those in the referenced ArchiMate relationship. Otherwise the connection’s label, documentation and properties can be provided and will be additional to (or over-ride) those contained in the referenced ArchiMate relationship.
Instance Attribute Summary collapse
-
#bendpoints ⇒ Array<Location>
readonly
-
#diagram ⇒ Diagram, NilClass
readonly
-
#documentation ⇒ PreservedLangString, NilClass
readonly
-
#id ⇒ String
readonly
-
#name ⇒ LangString, NilClass
readonly
-
#properties ⇒ Array<Property>
readonly
-
#relationship ⇒ Relationship, NilClass
-
#source ⇒ ViewNode, NilClass
-
#source_attachment ⇒ Location, NilClass
readonly
-
#style ⇒ Style, NilClass
readonly
-
#target ⇒ ViewNode, NilClass
-
#target_attachment ⇒ Location, NilClass
readonly
-
#type ⇒ String, NilClass
readonly
Instance Method Summary
collapse
#add_reference, #destroy, #model, #references, #remove_reference, #replace_with
Methods included from Comparison
#==, #[], #dig, #each, #hash, included, #initialize, #inspect, #pretty_print, #to_h
Instance Attribute Details
#bendpoints ⇒ Array<Location>
44
|
# File 'lib/archimate/data_model/connection.rb', line 44
model_attr :bendpoints, default: []
|
#diagram ⇒ Diagram, NilClass
66
|
# File 'lib/archimate/data_model/connection.rb', line 66
model_attr :diagram, comparison_attr: :no_compare
|
28
|
# File 'lib/archimate/data_model/connection.rb', line 28
model_attr :documentation, default: nil
|
#id ⇒ String
22
|
# File 'lib/archimate/data_model/connection.rb', line 22
model_attr :id
|
25
|
# File 'lib/archimate/data_model/connection.rb', line 25
model_attr :name, default: nil
|
#properties ⇒ Array<Property>
62
|
# File 'lib/archimate/data_model/connection.rb', line 62
model_attr :properties, default: []
|
#relationship ⇒ Relationship, NilClass
56
|
# File 'lib/archimate/data_model/connection.rb', line 56
model_attr :relationship, comparison_attr: :id, writable: true, default: nil, also_reference: [:diagram]
|
#source ⇒ ViewNode, NilClass
50
|
# File 'lib/archimate/data_model/connection.rb', line 50
model_attr :source, comparison_attr: :id, writable: true, default: nil
|
#source_attachment ⇒ Location, NilClass
41
|
# File 'lib/archimate/data_model/connection.rb', line 41
model_attr :source_attachment, default: nil
|
#style ⇒ Style, NilClass
59
|
# File 'lib/archimate/data_model/connection.rb', line 59
model_attr :style, default: nil
|
#target ⇒ ViewNode, NilClass
53
|
# File 'lib/archimate/data_model/connection.rb', line 53
model_attr :target, comparison_attr: :id, writable: true, default: nil
|
#target_attachment ⇒ Location, NilClass
47
|
# File 'lib/archimate/data_model/connection.rb', line 47
model_attr :target_attachment, default: nil
|
#type ⇒ String, NilClass
Note:
type here was used for the Element/Relationship/Diagram type
38
|
# File 'lib/archimate/data_model/connection.rb', line 38
model_attr :type, default: nil
|
Instance Method Details
#absolute_position ⇒ Object
116
117
118
119
|
# File 'lib/archimate/data_model/connection.rb', line 116
def absolute_position
pt = Svg::Path.new(self).midpoint
Bounds.new(x: pt.x, y: pt.y, width: 0, height: 0)
end
|
#description ⇒ Object
86
87
88
89
90
91
92
93
|
# File 'lib/archimate/data_model/connection.rb', line 86
def description
[
name.nil? ? nil : "#{name}: ",
source&.description,
relationship&.description,
target&.description
].compact.join(" ")
end
|
#element ⇒ Object
78
79
80
|
# File 'lib/archimate/data_model/connection.rb', line 78
def element
relationship
end
|
#end_location ⇒ Object
99
100
101
|
# File 'lib/archimate/data_model/connection.rb', line 99
def end_location
target_attachment || target_bounds.center
end
|
#nodes ⇒ Object
This is used when rendering a connection to connection relationship.
112
113
114
|
# File 'lib/archimate/data_model/connection.rb', line 112
def nodes
[]
end
|
#other_attributes ⇒ Array<AnyAttribute>
# @!attribute [r] other_attributes
34
|
# File 'lib/archimate/data_model/connection.rb', line 34
model_attr :other_attributes, default: []
|
#other_elements ⇒ Array<AnyElement>
# @!attribute [r] other_elements
31
|
# File 'lib/archimate/data_model/connection.rb', line 31
model_attr :other_elements, default: []
|
#replace(entity, with_entity) ⇒ Object
68
69
70
71
72
|
# File 'lib/archimate/data_model/connection.rb', line 68
def replace(entity, with_entity)
@relationship = with_entity.id if relationship == entity.id
@source = with_entity.id if source == entity.id
@target = with_entity.id if target == entity.id
end
|
#replace_item_with(item, replacement) ⇒ Object
121
122
123
124
125
126
127
128
129
130
|
# File 'lib/archimate/data_model/connection.rb', line 121
def replace_item_with(item, replacement)
super
item.remove_reference(self)
case item
when relationship
@relationship = replacement
else
raise "Trying to replace #{item} that I don't reference"
end
end
|
#source_bounds ⇒ Object
103
104
105
|
# File 'lib/archimate/data_model/connection.rb', line 103
def source_bounds
source.absolute_position
end
|
#start_location ⇒ Object
95
96
97
|
# File 'lib/archimate/data_model/connection.rb', line 95
def start_location
source_attachment || source_bounds.center
end
|
#target_bounds ⇒ Object
107
108
109
|
# File 'lib/archimate/data_model/connection.rb', line 107
def target_bounds
target.absolute_position
end
|
#to_s ⇒ Object
82
83
84
|
# File 'lib/archimate/data_model/connection.rb', line 82
def to_s
"#{type_name} #{source.nil? ? 'nothing' : source} -> #{target.nil? ? 'nothing' : target}"
end
|