archimate 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f7cec778a203f45d8559a57bebf5ad29fbecfaad296d3c4a0b9fdc47d746baa
4
- data.tar.gz: 304983b0c9afd59fdd6f703a0866fc29f716da49681970d3fa3b2736d9f0b8f1
3
+ metadata.gz: 96bba8c44a533b1b6ab3fd4ed2a9119459fb3a8d3a86e48a49ff7d98b90a981a
4
+ data.tar.gz: 38360fca023b3984dc031644966353eaa050d60bb0dd7aaec574f46d434c3259
5
5
  SHA512:
6
- metadata.gz: 5229b50c9b1af5e15e505f331ff197d3cbaf8519b0f93c3f7b636c852b282fcf8c15a9a05311ef7c2e8979c386deed3601be48d201e598e2523b854ec25c6bd6
7
- data.tar.gz: 1cbb2a88d904e7a08e756c7ea51ba745a5c0da6dd4deb382359f3638fcdd593da18f1c007db24108e500a86529b6bc7cac4cb8cab791e02848ec09d1db4e3e8e
6
+ metadata.gz: 361db052df11cad6194370134a755d3f96df232ff40704ea263d2497df0ecdbf4d00e64310eea2021602a0202a56cd4c1901295265a7be69a90509c627d8b224
7
+ data.tar.gz: 948f1932a4d21f4ef5e61528d08a5bf83287fe81196e088403beb6f61eecf56ba1a30ab621b0d1cc63735fac68027e9fa7b4e5309b7f6ed533e06f8574f0d2f0
@@ -11,7 +11,6 @@ module Archimate
11
11
  include Ruby::Enum
12
12
 
13
13
  define :AndJunction, "AndJunction"
14
- define :Junction, "Junction"
15
14
  define :OrJunction, "OrJunction"
16
15
 
17
16
  # Returns true if {other} is a +ConnectorType+
@@ -713,17 +713,6 @@ module Archimate
713
713
  end
714
714
  end
715
715
 
716
- class Junction < Element
717
- NAME = "Junction"
718
- DESCRIPTION = "A junction is used to connect relationships of the same type."
719
- CLASSIFICATION = :active_structure
720
- LAYER = Layers::Connectors
721
-
722
- def initialize(args)
723
- super
724
- end
725
- end
726
-
727
716
  class OrJunction < Element
728
717
  NAME = "Or Junction"
729
718
  DESCRIPTION = "A junction is used to connect relationships of the same type."
@@ -163,21 +163,6 @@ module Archimate
163
163
  end
164
164
  end
165
165
 
166
- # Junction is a relationship connector
167
- # * All relationships connected with relationship connectors must be of the same type
168
- class Junction < Relationship
169
- NAME = "Junction"
170
- DESCRIPTION = "A junction is used to connect relationships of the same type."
171
- WEIGHT = 0
172
- CLASSIFICATION = :other
173
- VERB = "junction to"
174
- OBJECT_VERB = "junction from"
175
-
176
- def initialize(args)
177
- super
178
- end
179
- end
180
-
181
166
  # Junction is a relationship connector
182
167
  # * All relationships connected with relationship connectors must be of the same type
183
168
  class AndJunction < Relationship
@@ -277,7 +277,7 @@ module Archimate
277
277
  allowed_relationship_types: [
278
278
  Relationships::AndJunction, Relationships::Association,
279
279
  Relationships::Composition, Relationships::Flow,
280
- Relationships::Junction, Relationships::OrJunction,
280
+ Relationships::AndJunction, Relationships::OrJunction,
281
281
  Relationships::Triggering
282
282
  ]
283
283
  )
@@ -14,7 +14,7 @@ module Archimate
14
14
  when "element"
15
15
  element_type = Hash[attrs]["xsi:type"].sub(/archimate:/, '')
16
16
  case element_type
17
- when DataModel::Elements
17
+ when DataModel::Elements, "Junction"
18
18
  Element
19
19
  when DataModel::DiagramType
20
20
  Diagram
@@ -26,11 +26,20 @@ module Archimate
26
26
  @element ||= DataModel::Elements.create(
27
27
  id: @attrs["id"],
28
28
  name: DataModel::LangString.string(process_text(@attrs["name"])),
29
- type: element_type,
29
+ type: mapped_element_type,
30
30
  documentation: documentation,
31
31
  properties: properties
32
32
  )
33
33
  end
34
+
35
+ def mapped_element_type
36
+ case element_type
37
+ when "Junction"
38
+ @attrs["type"] == "or" ? "OrJunction" : "AndJunction"
39
+ else
40
+ element_type
41
+ end
42
+ end
34
43
  end
35
44
  end
36
45
  end
@@ -6,17 +6,29 @@ module Archimate
6
6
  module Archi
7
7
  module Element
8
8
  def serialize_element(xml, element)
9
- xml.element(
10
- {
11
- "xsi:type" => "archimate:#{element.type}",
12
- "id" => element.id,
13
- "name" => element.name
14
- }.compact
15
- ) do
9
+ xml.element(element_attrs(element)) do
16
10
  serialize_documentation(xml, element.documentation)
17
11
  serialize(xml, element.properties)
18
12
  end
19
13
  end
14
+
15
+ def element_attrs(element)
16
+ {
17
+ "xsi:type" => "archimate:#{mapped_element_name(element)}",
18
+ "id" => element.id,
19
+ "name" => element.name,
20
+ "type" => element.is_a?(DataModel::Elements::OrJunction) ? "or" : nil
21
+ }.compact
22
+ end
23
+
24
+ def mapped_element_name(element)
25
+ case element
26
+ when DataModel::Elements::AndJunction, DataModel::Elements::OrJunction
27
+ "Junction"
28
+ else
29
+ element.type
30
+ end
31
+ end
20
32
  end
21
33
  end
22
34
  end
@@ -50,7 +50,7 @@ module Archimate
50
50
  @dupes = nil
51
51
  @count = nil
52
52
  @word_count = {}
53
- @ignored_entity_types = %w[Junction AndJunction OrJunction]
53
+ @ignored_entity_types = %w[AndJunction OrJunction]
54
54
  dupe_list
55
55
  end
56
56
 
@@ -8,6 +8,10 @@ module Archimate
8
8
  super
9
9
  @background_class = "archimate-junction-background"
10
10
  end
11
+
12
+ def entity_shape(xml, bounds)
13
+ xml.circle(cx: bounds.left + bounds.width / 2.0, cy: bounds.top + bounds.height / 2.0, r: bounds.width / 2.0, class: background_class, style: shape_style)
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -8,6 +8,10 @@ module Archimate
8
8
  super
9
9
  @background_class = "archimate-or-junction-background"
10
10
  end
11
+
12
+ def entity_shape(xml, bounds)
13
+ xml.circle(cx: bounds.left + bounds.width / 2.0, cy: bounds.top + bounds.height / 2.0, r: bounds.width / 2.0, class: background_class, style: shape_style)
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -85,24 +85,25 @@ module Archimate
85
85
  if klass.superclass == DataModel::Element
86
86
  element_example(x, y, klass, klass_name, xml)
87
87
  elsif klass.superclass == DataModel::Relationship
88
- relationship_example(x, y, klass_name, xml)
88
+ relationship_example(x, y, klass, klass_name, xml)
89
89
  end
90
90
  element_type_description(klass::DESCRIPTION, text_bounds(x, y), xml)
91
91
  end
92
92
 
93
93
  def element_example(x, y, klass, klass_name, xml)
94
94
  case klass_name
95
- when "Junction"
95
+ when "OrJunction"
96
96
  r = (element_height - 10) / 4
97
-
98
- xml.circle(cx: x + r, cy: y + r, r: r, style: "fill:#000;stroke:#000")
99
- xml.text_(x: x + r * 2 + text_indent, y: y + r + line_height / 2, class: "archimate-legend-title") do
100
- xml.text("And Junction")
101
- end
102
- xml.circle(cx: x + r, cy: y + row_height / 2 + r, r: r, style: "fill:#fff;stroke:#000")
103
- xml.text_(x: x + r * 2 + text_indent, y: y + row_height / 2 + r + line_height / 2, class: "archimate-legend-title") do
97
+ xml.circle(cx: x + r, cy: y + row_height / 2 - r, r: r, style: "fill:#fff;stroke:#000")
98
+ xml.text_(x: x + r * 2 + text_indent, y: y + row_height / 2 - line_height / 2, class: "archimate-legend-title") do
104
99
  xml.text("Or Junction")
105
100
  end
101
+ when "AndJunction"
102
+ r = (element_height - 10) / 4
103
+ xml.circle(cx: x + r, cy: y + row_height / 2 - r, r: r, style: "fill:#000;stroke:#000")
104
+ xml.text_(x: x + r * 2 + text_indent, y: y + row_height / 2 - line_height / 2, class: "archimate-legend-title") do
105
+ xml.text("And Junction")
106
+ end
106
107
  else
107
108
  element = DataModel::Elements.const_get(klass_name).new(id: "legend-element-#{klass_name}", name: klass::NAME)
108
109
  view_node = DataModel::ViewNode.new(
@@ -117,7 +118,10 @@ module Archimate
117
118
  end
118
119
  end
119
120
 
120
- def relationship_example(x, y, klass_name, xml)
121
+ def relationship_example(x, y, klass, klass_name, xml)
122
+ xml.text_(x: x + text_indent, y: y + line_height, class: "archimate-legend-title") do
123
+ xml.text(klass::NAME)
124
+ end
121
125
  css_class = "archimate-#{klass_name.downcase} archimate-relationship"
122
126
  xml.path(d: "M#{x} #{y + row_height / 2} h #{element_width}", class: css_class)
123
127
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Archimate
4
- VERSION = "2.1.0"
4
+ VERSION = "2.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: archimate
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Morga
@@ -618,7 +618,6 @@ files:
618
618
  - lib/archimate/svg/entity/infrastructure_service.rb
619
619
  - lib/archimate/svg/entity/interaction_entity.rb
620
620
  - lib/archimate/svg/entity/interface_entity.rb
621
- - lib/archimate/svg/entity/junction.rb
622
621
  - lib/archimate/svg/entity/location.rb
623
622
  - lib/archimate/svg/entity/material.rb
624
623
  - lib/archimate/svg/entity/meaning.rb
@@ -1,19 +0,0 @@
1
-
2
- # frozen_string_literal: true
3
-
4
- module Archimate
5
- module Svg
6
- module Entity
7
- class Junction < RectEntity
8
- def initialize(child, bounds_offset)
9
- super
10
- @background_class = "archimate-junction-background"
11
- end
12
-
13
- def entity_shape(xml, bounds)
14
- xml.circle(cx: bounds.left + bounds.width / 2.0, cy: bounds.top + bounds.height / 2.0, r: bounds.width / 2.0, class: background_class, style: shape_style)
15
- end
16
- end
17
- end
18
- end
19
- end