archimate 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.projectile +18 -0
- data/.rubocop.yml +13 -0
- data/.travis.yml +4 -0
- data/.yardocs +15 -0
- data/Gemfile +5 -0
- data/Guardfile +27 -0
- data/LICENSE +201 -0
- data/README.md +94 -0
- data/Rakefile +29 -0
- data/TODOs.org +286 -0
- data/archimate.gemspec +51 -0
- data/bin/archimate +17 -0
- data/bin/console +13 -0
- data/bin/setup +8 -0
- data/exe/archidiff +7 -0
- data/exe/archidiff-summary +7 -0
- data/exe/archimate +7 -0
- data/exe/archimerge +7 -0
- data/exe/fmtxml +7 -0
- data/lib/archimate/cli/archi.rb +189 -0
- data/lib/archimate/cli/cleanup.rb +54 -0
- data/lib/archimate/cli/conflict_resolver.rb +39 -0
- data/lib/archimate/cli/convert.rb +39 -0
- data/lib/archimate/cli/diff.rb +31 -0
- data/lib/archimate/cli/diff_summary.rb +101 -0
- data/lib/archimate/cli/duper.rb +85 -0
- data/lib/archimate/cli/lint.rb +16 -0
- data/lib/archimate/cli/mapper.rb +82 -0
- data/lib/archimate/cli/merge.rb +49 -0
- data/lib/archimate/cli/merger.rb +109 -0
- data/lib/archimate/cli/stats.rb +42 -0
- data/lib/archimate/cli/svger.rb +40 -0
- data/lib/archimate/color.rb +53 -0
- data/lib/archimate/config.rb +35 -0
- data/lib/archimate/data_model/any_attribute.rb +13 -0
- data/lib/archimate/data_model/any_element.rb +15 -0
- data/lib/archimate/data_model/archimate_node.rb +181 -0
- data/lib/archimate/data_model/bounds.rb +72 -0
- data/lib/archimate/data_model/color.rb +47 -0
- data/lib/archimate/data_model/concept.rb +14 -0
- data/lib/archimate/data_model/concern.rb +17 -0
- data/lib/archimate/data_model/connection.rb +107 -0
- data/lib/archimate/data_model/constants.rb +82 -0
- data/lib/archimate/data_model/container.rb +17 -0
- data/lib/archimate/data_model/diagram.rb +40 -0
- data/lib/archimate/data_model/diffable_array.rb +213 -0
- data/lib/archimate/data_model/diffable_primitive.rb +83 -0
- data/lib/archimate/data_model/documentation.rb +14 -0
- data/lib/archimate/data_model/element.rb +87 -0
- data/lib/archimate/data_model/font.rb +54 -0
- data/lib/archimate/data_model/label.rb +19 -0
- data/lib/archimate/data_model/lang_string.rb +41 -0
- data/lib/archimate/data_model/location.rb +31 -0
- data/lib/archimate/data_model/metadata.rb +14 -0
- data/lib/archimate/data_model/model.rb +217 -0
- data/lib/archimate/data_model/modeling_note.rb +13 -0
- data/lib/archimate/data_model/named_referenceable.rb +14 -0
- data/lib/archimate/data_model/organization.rb +40 -0
- data/lib/archimate/data_model/property.rb +25 -0
- data/lib/archimate/data_model/property_definition.rb +16 -0
- data/lib/archimate/data_model/referenceable.rb +29 -0
- data/lib/archimate/data_model/relationship.rb +85 -0
- data/lib/archimate/data_model/schema_info.rb +18 -0
- data/lib/archimate/data_model/style.rb +32 -0
- data/lib/archimate/data_model/view.rb +12 -0
- data/lib/archimate/data_model/view_concept.rb +18 -0
- data/lib/archimate/data_model/view_node.rb +114 -0
- data/lib/archimate/data_model/viewpoint.rb +87 -0
- data/lib/archimate/data_model.rb +54 -0
- data/lib/archimate/diff/archimate_array_reference.rb +113 -0
- data/lib/archimate/diff/archimate_identified_node_reference.rb +41 -0
- data/lib/archimate/diff/archimate_node_attribute_reference.rb +70 -0
- data/lib/archimate/diff/archimate_node_reference.rb +80 -0
- data/lib/archimate/diff/change.rb +49 -0
- data/lib/archimate/diff/conflict.rb +31 -0
- data/lib/archimate/diff/conflicts/base_conflict.rb +53 -0
- data/lib/archimate/diff/conflicts/deleted_items_child_updated_conflict.rb +30 -0
- data/lib/archimate/diff/conflicts/deleted_items_referenced_conflict.rb +63 -0
- data/lib/archimate/diff/conflicts/path_conflict.rb +51 -0
- data/lib/archimate/diff/conflicts.rb +89 -0
- data/lib/archimate/diff/delete.rb +41 -0
- data/lib/archimate/diff/difference.rb +113 -0
- data/lib/archimate/diff/insert.rb +43 -0
- data/lib/archimate/diff/merge.rb +70 -0
- data/lib/archimate/diff/move.rb +51 -0
- data/lib/archimate/diff.rb +17 -0
- data/lib/archimate/export/csv_export.rb +32 -0
- data/lib/archimate/export/cypher.rb +171 -0
- data/lib/archimate/export/graph_ml.rb +131 -0
- data/lib/archimate/export/n_quads.rb +142 -0
- data/lib/archimate/file_format.rb +30 -0
- data/lib/archimate/file_formats/archi_file_format.rb +151 -0
- data/lib/archimate/file_formats/archi_file_reader.rb +252 -0
- data/lib/archimate/file_formats/archi_file_writer.rb +230 -0
- data/lib/archimate/file_formats/archimate_v2.rb +461 -0
- data/lib/archimate/file_formats/model_exchange_file/xml_lang_string.rb +35 -0
- data/lib/archimate/file_formats/model_exchange_file/xml_metadata.rb +115 -0
- data/lib/archimate/file_formats/model_exchange_file/xml_property_definitions.rb +28 -0
- data/lib/archimate/file_formats/model_exchange_file/xml_property_defs.rb +27 -0
- data/lib/archimate/file_formats/model_exchange_file_reader.rb +237 -0
- data/lib/archimate/file_formats/model_exchange_file_reader_21.rb +73 -0
- data/lib/archimate/file_formats/model_exchange_file_reader_30.rb +134 -0
- data/lib/archimate/file_formats/model_exchange_file_writer.rb +157 -0
- data/lib/archimate/file_formats/model_exchange_file_writer_21.rb +143 -0
- data/lib/archimate/file_formats/model_exchange_file_writer_30.rb +153 -0
- data/lib/archimate/file_formats/writer.rb +56 -0
- data/lib/archimate/lint/duplicate_entities.rb +121 -0
- data/lib/archimate/lint/linter.rb +146 -0
- data/lib/archimate/logging.rb +55 -0
- data/lib/archimate/maybe_io.rb +34 -0
- data/lib/archimate/progress_indicator.rb +29 -0
- data/lib/archimate/svg/archimate.css +232 -0
- data/lib/archimate/svg/child.rb +29 -0
- data/lib/archimate/svg/connection.rb +184 -0
- data/lib/archimate/svg/css_style.rb +31 -0
- data/lib/archimate/svg/diagram.rb +87 -0
- data/lib/archimate/svg/entity/and_junction.rb +14 -0
- data/lib/archimate/svg/entity/application_collaboration.rb +14 -0
- data/lib/archimate/svg/entity/application_component.rb +41 -0
- data/lib/archimate/svg/entity/application_event.rb +13 -0
- data/lib/archimate/svg/entity/application_function.rb +13 -0
- data/lib/archimate/svg/entity/application_interaction.rb +13 -0
- data/lib/archimate/svg/entity/application_interface.rb +13 -0
- data/lib/archimate/svg/entity/application_process.rb +13 -0
- data/lib/archimate/svg/entity/application_service.rb +13 -0
- data/lib/archimate/svg/entity/artifact.rb +39 -0
- data/lib/archimate/svg/entity/assessment.rb +14 -0
- data/lib/archimate/svg/entity/base_entity.rb +128 -0
- data/lib/archimate/svg/entity/business_actor.rb +14 -0
- data/lib/archimate/svg/entity/business_collaboration.rb +14 -0
- data/lib/archimate/svg/entity/business_event.rb +10 -0
- data/lib/archimate/svg/entity/business_function.rb +13 -0
- data/lib/archimate/svg/entity/business_interaction.rb +13 -0
- data/lib/archimate/svg/entity/business_interface.rb +13 -0
- data/lib/archimate/svg/entity/business_object.rb +13 -0
- data/lib/archimate/svg/entity/business_process.rb +13 -0
- data/lib/archimate/svg/entity/business_role.rb +14 -0
- data/lib/archimate/svg/entity/business_service.rb +13 -0
- data/lib/archimate/svg/entity/capability.rb +14 -0
- data/lib/archimate/svg/entity/communication_network.rb +14 -0
- data/lib/archimate/svg/entity/communication_path.rb +14 -0
- data/lib/archimate/svg/entity/constraint.rb +15 -0
- data/lib/archimate/svg/entity/contract.rb +13 -0
- data/lib/archimate/svg/entity/course_of_action.rb +14 -0
- data/lib/archimate/svg/entity/data_entity.rb +29 -0
- data/lib/archimate/svg/entity/data_object.rb +13 -0
- data/lib/archimate/svg/entity/deliverable.rb +13 -0
- data/lib/archimate/svg/entity/device.rb +48 -0
- data/lib/archimate/svg/entity/diagram_model_reference.rb +22 -0
- data/lib/archimate/svg/entity/diagram_object.rb +30 -0
- data/lib/archimate/svg/entity/distribution_network.rb +14 -0
- data/lib/archimate/svg/entity/driver.rb +14 -0
- data/lib/archimate/svg/entity/equipment.rb +16 -0
- data/lib/archimate/svg/entity/event_entity.rb +36 -0
- data/lib/archimate/svg/entity/facility.rb +16 -0
- data/lib/archimate/svg/entity/function_entity.rb +14 -0
- data/lib/archimate/svg/entity/gap.rb +21 -0
- data/lib/archimate/svg/entity/goal.rb +14 -0
- data/lib/archimate/svg/entity/group.rb +24 -0
- data/lib/archimate/svg/entity/implementation_event.rb +13 -0
- data/lib/archimate/svg/entity/infrastructure_function.rb +13 -0
- data/lib/archimate/svg/entity/infrastructure_interface.rb +13 -0
- data/lib/archimate/svg/entity/infrastructure_service.rb +13 -0
- data/lib/archimate/svg/entity/interaction_entity.rb +14 -0
- data/lib/archimate/svg/entity/interface_entity.rb +35 -0
- data/lib/archimate/svg/entity/junction.rb +19 -0
- data/lib/archimate/svg/entity/location.rb +14 -0
- data/lib/archimate/svg/entity/material.rb +14 -0
- data/lib/archimate/svg/entity/meaning.rb +40 -0
- data/lib/archimate/svg/entity/motivation_entity.rb +40 -0
- data/lib/archimate/svg/entity/network.rb +14 -0
- data/lib/archimate/svg/entity/node.rb +33 -0
- data/lib/archimate/svg/entity/node_shape.rb +64 -0
- data/lib/archimate/svg/entity/note.rb +30 -0
- data/lib/archimate/svg/entity/or_junction.rb +14 -0
- data/lib/archimate/svg/entity/outcome.rb +15 -0
- data/lib/archimate/svg/entity/path.rb +14 -0
- data/lib/archimate/svg/entity/plateau.rb +15 -0
- data/lib/archimate/svg/entity/principle.rb +15 -0
- data/lib/archimate/svg/entity/process_entity.rb +63 -0
- data/lib/archimate/svg/entity/product.rb +20 -0
- data/lib/archimate/svg/entity/rect.rb +13 -0
- data/lib/archimate/svg/entity/rect_entity.rb +25 -0
- data/lib/archimate/svg/entity/representation.rb +31 -0
- data/lib/archimate/svg/entity/requirement.rb +15 -0
- data/lib/archimate/svg/entity/resource.rb +14 -0
- data/lib/archimate/svg/entity/rounded_rect_entity.rb +23 -0
- data/lib/archimate/svg/entity/service_entity.rb +51 -0
- data/lib/archimate/svg/entity/sketch_model_sticky.rb +14 -0
- data/lib/archimate/svg/entity/stakeholder.rb +15 -0
- data/lib/archimate/svg/entity/system_software.rb +14 -0
- data/lib/archimate/svg/entity/technology_collaboration.rb +14 -0
- data/lib/archimate/svg/entity/technology_event.rb +13 -0
- data/lib/archimate/svg/entity/technology_function.rb +13 -0
- data/lib/archimate/svg/entity/technology_interaction.rb +13 -0
- data/lib/archimate/svg/entity/technology_interface.rb +13 -0
- data/lib/archimate/svg/entity/technology_process.rb +13 -0
- data/lib/archimate/svg/entity/technology_service.rb +13 -0
- data/lib/archimate/svg/entity/value.rb +27 -0
- data/lib/archimate/svg/entity/work_package.rb +14 -0
- data/lib/archimate/svg/entity.rb +93 -0
- data/lib/archimate/svg/entity_factory.rb +17 -0
- data/lib/archimate/svg/extents.rb +27 -0
- data/lib/archimate/svg/point.rb +7 -0
- data/lib/archimate/svg/svg_template.rb +27 -0
- data/lib/archimate/svg/svg_template.svg.erb +169 -0
- data/lib/archimate/version.rb +4 -0
- data/lib/archimate.rb +114 -0
- metadata +623 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
class Artifact < BaseEntity
|
7
|
+
def initialize(child, bounds_offset)
|
8
|
+
super
|
9
|
+
@badge = "archimate-artifact-badge"
|
10
|
+
end
|
11
|
+
|
12
|
+
def entity_shape(xml, bounds)
|
13
|
+
margin = 18
|
14
|
+
xml.g(class: background_class, style: shape_style) do
|
15
|
+
xml.path(
|
16
|
+
d: [
|
17
|
+
["M", bounds.left, bounds.top],
|
18
|
+
["h", bounds.width - margin],
|
19
|
+
["l", margin, margin],
|
20
|
+
["v", bounds.height - margin],
|
21
|
+
["h", -bounds.width],
|
22
|
+
"z"
|
23
|
+
].flatten.join(" ")
|
24
|
+
)
|
25
|
+
xml.path(
|
26
|
+
d: [
|
27
|
+
["M", bounds.right - margin, bounds.top],
|
28
|
+
["v", margin],
|
29
|
+
["h", margin],
|
30
|
+
"z"
|
31
|
+
].flatten.join(" "),
|
32
|
+
class: "archimate-decoration"
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
class BaseEntity
|
7
|
+
attr_reader :child
|
8
|
+
attr_reader :entity
|
9
|
+
attr_reader :bounds_offset
|
10
|
+
attr_reader :text_bounds
|
11
|
+
attr_reader :badge_bounds
|
12
|
+
attr_reader :badge
|
13
|
+
attr_reader :background_class
|
14
|
+
|
15
|
+
def initialize(child, bounds_offset)
|
16
|
+
@child = child
|
17
|
+
@text_bounds = child.bounds.reduced_by(2)
|
18
|
+
@bounds_offset = bounds_offset
|
19
|
+
@entity = @child.element || @child
|
20
|
+
@background_class = layer_background_class
|
21
|
+
@text_align = nil
|
22
|
+
@badge = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def layer_background_class
|
26
|
+
case child.element&.layer
|
27
|
+
when "Strategy"
|
28
|
+
"archimate-strategy-background"
|
29
|
+
when "Business"
|
30
|
+
"archimate-business-background"
|
31
|
+
when "Application"
|
32
|
+
"archimate-application-background"
|
33
|
+
when "Technology"
|
34
|
+
"archimate-infrastructure-background"
|
35
|
+
when "Physical"
|
36
|
+
"archimate-physical-background"
|
37
|
+
when "Motivation"
|
38
|
+
"archimate-motivation-background"
|
39
|
+
when "Implementation and Migration"
|
40
|
+
"archimate-implementation-background"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_svg(xml)
|
45
|
+
optional_link(xml) {
|
46
|
+
xml.g(group_attrs) do
|
47
|
+
xml.title { xml.text @entity.name } unless @entity.name.nil? || @entity.name.empty?
|
48
|
+
xml.desc { xml.text(@entity.documentation.map(&:text).join("\n\n")) } unless @entity.documentation.empty?
|
49
|
+
entity_shape(xml, child.bounds)
|
50
|
+
entity_badge(xml)
|
51
|
+
entity_label(xml)
|
52
|
+
child.nodes.each { |c| Svg::EntityFactory.make_entity(c, child.bounds).to_svg(xml) }
|
53
|
+
end
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
def optional_link(xml, &block)
|
58
|
+
block.call
|
59
|
+
end
|
60
|
+
|
61
|
+
def entity_label(xml)
|
62
|
+
return if (entity.nil? || entity.name.nil? || entity.name.strip.empty?) && (child.content.nil? || child.content.strip.empty?)
|
63
|
+
xml.foreignObject(text_bounds.to_h) do
|
64
|
+
xml.table(xmlns: "http://www.w3.org/1999/xhtml", style: "height:#{text_bounds.height}px;width:#{text_bounds.width}px;") do
|
65
|
+
xml.tr(style: "height:#{text_bounds.height}px;") do
|
66
|
+
xml.td(class: "entity-name") do
|
67
|
+
xml.div(class: "archimate-badge-spacer") unless badge.nil?
|
68
|
+
xml.p(class: "entity-name", style: text_style) do
|
69
|
+
text_lines(entity.name || child.content).each do |line|
|
70
|
+
xml.text(line)
|
71
|
+
xml.br
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def text_lines(text)
|
81
|
+
text.tr("\r\n", "\n").split(/[\r\n]/)
|
82
|
+
end
|
83
|
+
|
84
|
+
def entity_badge(xml)
|
85
|
+
return if badge.nil?
|
86
|
+
xml.use(
|
87
|
+
badge_bounds
|
88
|
+
.to_h
|
89
|
+
.merge("xlink:href" => badge)
|
90
|
+
)
|
91
|
+
end
|
92
|
+
|
93
|
+
def shape_style
|
94
|
+
style = child.style
|
95
|
+
return "" if style.nil?
|
96
|
+
{
|
97
|
+
"fill": style.fill_color&.to_rgba,
|
98
|
+
"stroke": style.line_color&.to_rgba,
|
99
|
+
"stroke-width": style.line_width
|
100
|
+
}.delete_if { |_key, value| value.nil? }
|
101
|
+
.map { |key, value| "#{key}:#{value};" }
|
102
|
+
.join("")
|
103
|
+
end
|
104
|
+
|
105
|
+
def text_style
|
106
|
+
style = child.style || DataModel::Style.new
|
107
|
+
{
|
108
|
+
"fill": style.font_color&.to_rgba,
|
109
|
+
"color": style.font_color&.to_rgba,
|
110
|
+
"font-family": style.font&.name,
|
111
|
+
"font-size": style.font&.size,
|
112
|
+
"text-align": style.text_align || @text_align
|
113
|
+
}.delete_if { |_key, value| value.nil? }
|
114
|
+
.map { |key, value| "#{key}:#{value};" }
|
115
|
+
.join("")
|
116
|
+
end
|
117
|
+
|
118
|
+
def group_attrs
|
119
|
+
attrs = { id: @entity.id }
|
120
|
+
# TODO: Transform only needed only for Archi file types
|
121
|
+
attrs[:transform] = "translate(#{@bounds_offset.x || 0}, #{@bounds_offset.y || 0})" unless @bounds_offset.nil?
|
122
|
+
attrs[:class] = "archimate-#{@entity.type}" if @entity.type || !@entity.type.empty?
|
123
|
+
attrs
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
class Constraint < MotivationEntity
|
7
|
+
def initialize(child, bounds_offset)
|
8
|
+
super
|
9
|
+
@background_class = "archimate-motivation2-background"
|
10
|
+
@badge = "#archimate-constraint-badge"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
class DataEntity < BaseEntity
|
7
|
+
def initialize(child, bounds_offset)
|
8
|
+
super
|
9
|
+
@margin = 10
|
10
|
+
end
|
11
|
+
|
12
|
+
def calc_text_bounds(_bounds)
|
13
|
+
@text_bounds = @text_bounds.with(
|
14
|
+
y: @text_bounds.top + @margin,
|
15
|
+
height: @text_bounds.height - @margin
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
def entity_shape(xml, bounds)
|
20
|
+
calc_text_bounds(bounds)
|
21
|
+
xml.g(class: background_class) do
|
22
|
+
xml.rect(x: bounds.left, y: bounds.top, width: bounds.width, height: bounds.height, class: background_class, style: shape_style)
|
23
|
+
xml.rect(x: bounds.left, y: bounds.top, width: bounds.width, height: @margin, class: "archimate-decoration")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
class Device < BaseEntity
|
7
|
+
include NodeShape
|
8
|
+
|
9
|
+
def initialize(child, bounds_offset)
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
def entity_shape(xml, bounds)
|
14
|
+
case child.child_type
|
15
|
+
when 1
|
16
|
+
@badge = "#archimate-device-badge"
|
17
|
+
node_path(xml, bounds)
|
18
|
+
else
|
19
|
+
device_path(xml, bounds)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def device_path(xml, bounds)
|
24
|
+
margin = 10
|
25
|
+
xml.rect(
|
26
|
+
x: bounds.left,
|
27
|
+
y: bounds.top,
|
28
|
+
width: bounds.width,
|
29
|
+
height: bounds.height - margin,
|
30
|
+
rx: "6",
|
31
|
+
ry: "6",
|
32
|
+
class: background_class,
|
33
|
+
style: shape_style
|
34
|
+
)
|
35
|
+
decoration_path = [
|
36
|
+
"M", bounds.left + margin, bounds.bottom - margin,
|
37
|
+
"l", -margin, margin,
|
38
|
+
"h", bounds.width,
|
39
|
+
"l", -margin, -margin,
|
40
|
+
"z"
|
41
|
+
].flatten.join(" ")
|
42
|
+
xml.path(d: decoration_path, class: background_class, style: shape_style)
|
43
|
+
xml.path(d: decoration_path, class: "archimate-decoration", style: shape_style)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
class DiagramModelReference < RectEntity
|
7
|
+
def initialize(child, bounds_offset)
|
8
|
+
super
|
9
|
+
@badge = "#archimate-diagram-model-reference-badge"
|
10
|
+
@background_class = "archimate-diagram-model-reference-background"
|
11
|
+
@entity = child.model_element
|
12
|
+
end
|
13
|
+
|
14
|
+
def optional_link(xml, &block)
|
15
|
+
xml.a(href: "#{@entity.id}.svg") do
|
16
|
+
block.call
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
class DiagramObject < BaseEntity
|
7
|
+
def initialize(child, bounds_offset)
|
8
|
+
super
|
9
|
+
@background_class = "archimate-note-background"
|
10
|
+
@text_align = "left"
|
11
|
+
end
|
12
|
+
|
13
|
+
def entity_shape(xml, bounds)
|
14
|
+
xml.path(
|
15
|
+
d: [
|
16
|
+
["m", bounds.left, bounds.top],
|
17
|
+
["h", bounds.width],
|
18
|
+
["v", bounds.height - 8],
|
19
|
+
["l", -8, 8],
|
20
|
+
["h", -(bounds.width - 8)],
|
21
|
+
"z"
|
22
|
+
].flatten.join(" "),
|
23
|
+
class: background_class,
|
24
|
+
style: shape_style
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
class DistributionNetwork < RectEntity
|
7
|
+
def initialize(child, bounds_offset)
|
8
|
+
super
|
9
|
+
@badge = "#archimate-distribution-network-badge"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|