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,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
class ProcessEntity < RoundedRectEntity
|
7
|
+
def initialize(child, bounds_offset)
|
8
|
+
super
|
9
|
+
@badge = "#archimate-process-badge"
|
10
|
+
end
|
11
|
+
|
12
|
+
def entity_shape(xml, bounds)
|
13
|
+
case child.child_type
|
14
|
+
when 1
|
15
|
+
@badge = nil
|
16
|
+
process_path(xml, bounds)
|
17
|
+
else
|
18
|
+
super
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def process_path(xml, bounds)
|
23
|
+
top = bounds.top
|
24
|
+
shaft_top = bounds.top + bounds.height * 0.15
|
25
|
+
middle = bounds.top + bounds.height * 0.5
|
26
|
+
shaft_bottom = bounds.bottom - bounds.height * 0.15
|
27
|
+
bottom = bounds.bottom
|
28
|
+
|
29
|
+
left = bounds.left
|
30
|
+
arrow_back = bounds.right - bounds.height * 0.5
|
31
|
+
right = bounds.right
|
32
|
+
|
33
|
+
calc_text_bounds(
|
34
|
+
DataModel::Bounds.new(
|
35
|
+
x: left,
|
36
|
+
y: shaft_top,
|
37
|
+
width: bounds.width - bounds.height * 0.25,
|
38
|
+
height: shaft_bottom - shaft_top
|
39
|
+
)
|
40
|
+
)
|
41
|
+
xml.path(
|
42
|
+
d: [
|
43
|
+
"M", left, shaft_top,
|
44
|
+
"L", arrow_back, shaft_top,
|
45
|
+
"L", arrow_back, top,
|
46
|
+
"L", right, middle,
|
47
|
+
"L", arrow_back, bottom,
|
48
|
+
"L", arrow_back, shaft_bottom,
|
49
|
+
"L", left, shaft_bottom,
|
50
|
+
"z"
|
51
|
+
].flatten.join(" "),
|
52
|
+
class: background_class,
|
53
|
+
style: shape_style
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
def calc_text_bounds(bounds)
|
58
|
+
@text_bounds = bounds.reduced_by(2)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
class Product < BaseEntity
|
7
|
+
def entity_shape(xml, bounds)
|
8
|
+
product_path(xml, bounds)
|
9
|
+
end
|
10
|
+
|
11
|
+
def product_path(xml, bounds)
|
12
|
+
xml.g(class: background_class) do
|
13
|
+
xml.rect(x: bounds.left, y: bounds.top, width: bounds.width, height: bounds.height, class: background_class, style: shape_style)
|
14
|
+
xml.rect(x: bounds.left, y: bounds.top, width: bounds.width / 2.0, height: "8", class: "archimate-decoration")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
module Rect
|
7
|
+
def rect_path(xml, bounds)
|
8
|
+
xml.rect(x: bounds.left, y: bounds.top, width: bounds.width, height: bounds.height, class: background_class, style: shape_style)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
class RectEntity < BaseEntity
|
7
|
+
include Rect
|
8
|
+
|
9
|
+
def initialize(child, bounds_offset)
|
10
|
+
super
|
11
|
+
@badge_bounds = child.bounds.with(
|
12
|
+
x: child.bounds.right - 25,
|
13
|
+
y: child.bounds.top + 5,
|
14
|
+
width: 20,
|
15
|
+
height: 20
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
def entity_shape(xml, bounds)
|
20
|
+
rect_path(xml, bounds)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
class Representation < BaseEntity
|
7
|
+
def entity_shape(xml, bounds)
|
8
|
+
representation_path(xml, bounds)
|
9
|
+
end
|
10
|
+
|
11
|
+
def representation_path(xml, bounds)
|
12
|
+
xml.path(
|
13
|
+
d: [
|
14
|
+
["M", bounds.left, bounds.top],
|
15
|
+
["v", bounds.height - 8],
|
16
|
+
["c", 0.167 * bounds.width, 0.133 * bounds.height,
|
17
|
+
0.336 * bounds.width, 0.133 * bounds.height,
|
18
|
+
bounds.width * 0.508, 0],
|
19
|
+
["c", 0.0161 * bounds.width, -0.0778 * bounds.height,
|
20
|
+
0.322 * bounds.width, -0.0778 * bounds.height,
|
21
|
+
bounds.width * 0.475, 0],
|
22
|
+
["v", -(bounds.height - 8)],
|
23
|
+
"z"
|
24
|
+
].flatten.join(" "),
|
25
|
+
class: background_class, style: shape_style
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
class Requirement < MotivationEntity
|
7
|
+
def initialize(child, bounds_offset)
|
8
|
+
super
|
9
|
+
@background_class = "archimate-motivation2-background"
|
10
|
+
@badge = "#archimate-requirement-badge"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
class RoundedRectEntity < BaseEntity
|
7
|
+
def initialize(child, bounds_offset)
|
8
|
+
super
|
9
|
+
@badge_bounds = child.bounds.with(
|
10
|
+
x: child.bounds.right - 25,
|
11
|
+
y: child.bounds.top + 5,
|
12
|
+
width: 20,
|
13
|
+
height: 20
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
def entity_shape(xml, bounds)
|
18
|
+
xml.rect(x: bounds.left, y: bounds.top, width: bounds.width, height: bounds.height, rx: "5", ry: "5", class: background_class)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
class ServiceEntity < BaseEntity
|
7
|
+
include Rect
|
8
|
+
|
9
|
+
def initialize(child, bounds_offset)
|
10
|
+
super
|
11
|
+
bounds = child.bounds
|
12
|
+
@text_bounds = bounds.with(
|
13
|
+
x: bounds.left + 7,
|
14
|
+
y: bounds.top + 5,
|
15
|
+
width: bounds.width - 14,
|
16
|
+
height: bounds.height - 10
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
def entity_shape(xml, bounds)
|
21
|
+
case child.child_type
|
22
|
+
when 1
|
23
|
+
@badge_bounds = bounds.with(
|
24
|
+
x: bounds.right - 25,
|
25
|
+
y: bounds.top + 5,
|
26
|
+
width: 20,
|
27
|
+
height: 20
|
28
|
+
)
|
29
|
+
@badge = "#archimate-service-badge"
|
30
|
+
rect_path(xml, bounds)
|
31
|
+
else
|
32
|
+
service_path(xml, bounds)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def service_path(xml, bounds)
|
37
|
+
xml.rect(
|
38
|
+
x: bounds.left,
|
39
|
+
y: bounds.top,
|
40
|
+
width: bounds.width,
|
41
|
+
height: bounds.height,
|
42
|
+
rx: bounds.height / 2.0,
|
43
|
+
ry: bounds.height / 2.0,
|
44
|
+
class: background_class,
|
45
|
+
style: shape_style
|
46
|
+
)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
class Value < BaseEntity
|
7
|
+
def entity_shape(xml, bounds)
|
8
|
+
calc_text_bounds(bounds)
|
9
|
+
cx = bounds.left + bounds.width / 2.0
|
10
|
+
rx = bounds.width / 2.0 - 1
|
11
|
+
cy = bounds.top + bounds.height / 2.0
|
12
|
+
ry = bounds.height / 2.0 - 1
|
13
|
+
xml.ellipse(cx: cx, cy: cy, rx: rx, ry: ry, class: background_class, style: shape_style)
|
14
|
+
end
|
15
|
+
|
16
|
+
def calc_text_bounds(_bounds)
|
17
|
+
@text_bounds = @text_bounds.with(
|
18
|
+
x: @text_bounds.left + 10,
|
19
|
+
y: @text_bounds.top + 10,
|
20
|
+
width: @text_bounds.width - 20,
|
21
|
+
height: @text_bounds.height - 20
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module Entity
|
6
|
+
autoload :AndJunction, 'archimate/svg/entity/and_junction'
|
7
|
+
autoload :ApplicationCollaboration, 'archimate/svg/entity/application_collaboration'
|
8
|
+
autoload :ApplicationComponent, 'archimate/svg/entity/application_component'
|
9
|
+
autoload :ApplicationEvent, 'archimate/svg/entity/application_event'
|
10
|
+
autoload :ApplicationFunction, 'archimate/svg/entity/application_function'
|
11
|
+
autoload :ApplicationInteraction, 'archimate/svg/entity/application_interaction'
|
12
|
+
autoload :ApplicationInterface, 'archimate/svg/entity/application_interface'
|
13
|
+
autoload :ApplicationProcess, 'archimate/svg/entity/application_process'
|
14
|
+
autoload :ApplicationService, 'archimate/svg/entity/application_service'
|
15
|
+
autoload :Artifact, 'archimate/svg/entity/artifact'
|
16
|
+
autoload :Assessment, 'archimate/svg/entity/assessment'
|
17
|
+
autoload :BaseEntity, 'archimate/svg/entity/base_entity'
|
18
|
+
autoload :BusinessActor, 'archimate/svg/entity/business_actor'
|
19
|
+
autoload :BusinessCollaboration, 'archimate/svg/entity/business_collaboration'
|
20
|
+
autoload :BusinessEvent, 'archimate/svg/entity/business_event'
|
21
|
+
autoload :BusinessFunction, 'archimate/svg/entity/business_function'
|
22
|
+
autoload :BusinessInteraction, 'archimate/svg/entity/business_interaction'
|
23
|
+
autoload :BusinessInterface, 'archimate/svg/entity/business_interface'
|
24
|
+
autoload :BusinessObject, 'archimate/svg/entity/business_object'
|
25
|
+
autoload :BusinessProcess, 'archimate/svg/entity/business_process'
|
26
|
+
autoload :BusinessRole, 'archimate/svg/entity/business_role'
|
27
|
+
autoload :BusinessService, 'archimate/svg/entity/business_service'
|
28
|
+
autoload :Capability, 'archimate/svg/entity/capability'
|
29
|
+
autoload :CommunicationNetwork, 'archimate/svg/entity/communication_network'
|
30
|
+
autoload :CommunicationPath, 'archimate/svg/entity/communication_path'
|
31
|
+
autoload :Constraint, 'archimate/svg/entity/constraint'
|
32
|
+
autoload :Contract, 'archimate/svg/entity/contract'
|
33
|
+
autoload :CourseOfAction, 'archimate/svg/entity/course_of_action'
|
34
|
+
autoload :DataEntity, 'archimate/svg/entity/data_entity'
|
35
|
+
autoload :DataObject, 'archimate/svg/entity/data_object'
|
36
|
+
autoload :Deliverable, 'archimate/svg/entity/deliverable'
|
37
|
+
autoload :Device, 'archimate/svg/entity/device'
|
38
|
+
autoload :DiagramModelReference, 'archimate/svg/entity/diagram_model_reference'
|
39
|
+
autoload :DiagramObject, 'archimate/svg/entity/diagram_object'
|
40
|
+
autoload :DistributionNetwork, 'archimate/svg/entity/distribution_network'
|
41
|
+
autoload :Driver, 'archimate/svg/entity/driver'
|
42
|
+
autoload :Equipment, 'archimate/svg/entity/equipment'
|
43
|
+
autoload :EventEntity, 'archimate/svg/entity/event_entity'
|
44
|
+
autoload :Facility, 'archimate/svg/entity/facility'
|
45
|
+
autoload :FunctionEntity, 'archimate/svg/entity/function_entity'
|
46
|
+
autoload :Gap, 'archimate/svg/entity/gap'
|
47
|
+
autoload :Goal, 'archimate/svg/entity/goal'
|
48
|
+
autoload :Group, 'archimate/svg/entity/group'
|
49
|
+
autoload :ImplementationEvent, 'archimate/svg/entity/implementation_event'
|
50
|
+
autoload :InfrastructureEvent, 'archimate/svg/entity/infrastructure_event'
|
51
|
+
autoload :InfrastructureFunction, 'archimate/svg/entity/infrastructure_function'
|
52
|
+
autoload :InfrastructureInterface, 'archimate/svg/entity/infrastructure_interface'
|
53
|
+
autoload :InfrastructureService, 'archimate/svg/entity/infrastructure_service'
|
54
|
+
autoload :InteractionEntity, 'archimate/svg/entity/interaction_entity'
|
55
|
+
autoload :InterfaceEntity, 'archimate/svg/entity/interface_entity'
|
56
|
+
autoload :Junction, 'archimate/svg/entity/junction'
|
57
|
+
autoload :Location, 'archimate/svg/entity/location'
|
58
|
+
autoload :Material, 'archimate/svg/entity/material'
|
59
|
+
autoload :Meaning, 'archimate/svg/entity/meaning'
|
60
|
+
autoload :MotivationEntity, 'archimate/svg/entity/motivation_entity'
|
61
|
+
autoload :Network, 'archimate/svg/entity/network'
|
62
|
+
autoload :Node, 'archimate/svg/entity/node'
|
63
|
+
autoload :NodeShape, 'archimate/svg/entity/node_shape'
|
64
|
+
autoload :Note, 'archimate/svg/entity/note'
|
65
|
+
autoload :OrJunction, 'archimate/svg/entity/or_junction'
|
66
|
+
autoload :Outcome, 'archimate/svg/entity/outcome'
|
67
|
+
autoload :Path, 'archimate/svg/entity/path'
|
68
|
+
autoload :Plateau, 'archimate/svg/entity/plateau'
|
69
|
+
autoload :Principle, 'archimate/svg/entity/principle'
|
70
|
+
autoload :ProcessEntity, 'archimate/svg/entity/process_entity'
|
71
|
+
autoload :Product, 'archimate/svg/entity/product'
|
72
|
+
autoload :Rect, 'archimate/svg/entity/rect'
|
73
|
+
autoload :RectEntity, 'archimate/svg/entity/rect_entity'
|
74
|
+
autoload :Representation, 'archimate/svg/entity/representation'
|
75
|
+
autoload :Requirement, 'archimate/svg/entity/requirement'
|
76
|
+
autoload :Resource, 'archimate/svg/entity/resource'
|
77
|
+
autoload :RoundedRectEntity, 'archimate/svg/entity/rounded_rect_entity'
|
78
|
+
autoload :ServiceEntity, 'archimate/svg/entity/service_entity'
|
79
|
+
autoload :SketchModelSticky, 'archimate/svg/entity/sketch_model_sticky'
|
80
|
+
autoload :Stakeholder, 'archimate/svg/entity/stakeholder'
|
81
|
+
autoload :SystemSoftware, 'archimate/svg/entity/system_software'
|
82
|
+
autoload :TechnologyCollaboration, 'archimate/svg/entity/technology_collaboration'
|
83
|
+
autoload :TechnologyEvent, 'archimate/svg/entity/technology_event'
|
84
|
+
autoload :TechnologyFunction, 'archimate/svg/entity/technology_function'
|
85
|
+
autoload :TechnologyInteraction, 'archimate/svg/entity/technology_interaction'
|
86
|
+
autoload :TechnologyInterface, 'archimate/svg/entity/technology_interface'
|
87
|
+
autoload :TechnologyProcess, 'archimate/svg/entity/technology_process'
|
88
|
+
autoload :TechnologyService, 'archimate/svg/entity/technology_service'
|
89
|
+
autoload :Value, 'archimate/svg/entity/value'
|
90
|
+
autoload :WorkPackage, 'archimate/svg/entity/work_package'
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
module EntityFactory
|
6
|
+
def make_entity(child, bounds_offset)
|
7
|
+
entity = child.element || child
|
8
|
+
klass_name = "Archimate::Svg::Entity::#{entity.type.sub('archimate:', '')}"
|
9
|
+
klass = Object.const_get(klass_name)
|
10
|
+
klass.new(child, bounds_offset)
|
11
|
+
rescue
|
12
|
+
puts "Unsupported entity type #{klass_name}"
|
13
|
+
end
|
14
|
+
module_function :make_entity
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Archimate
|
4
|
+
module Svg
|
5
|
+
Extents = Struct.new(:min_x, :max_x, :min_y, :max_y) do
|
6
|
+
def expand(byval)
|
7
|
+
self.min_x ||= 0
|
8
|
+
self.max_x ||= 0
|
9
|
+
self.min_y ||= 0
|
10
|
+
self.max_y ||= 0
|
11
|
+
self.min_x -= byval
|
12
|
+
self.max_x += byval
|
13
|
+
self.min_y -= byval
|
14
|
+
self.max_y += byval
|
15
|
+
self
|
16
|
+
end
|
17
|
+
|
18
|
+
def width
|
19
|
+
max_x - min_x
|
20
|
+
end
|
21
|
+
|
22
|
+
def height
|
23
|
+
max_y - min_y
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "erb"
|
4
|
+
|
5
|
+
module Archimate
|
6
|
+
module Svg
|
7
|
+
class SvgTemplate
|
8
|
+
attr_reader :stylesheet
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@stylesheet = css_content
|
12
|
+
end
|
13
|
+
|
14
|
+
def css_content
|
15
|
+
@css_content ||= File.read(File.join(File.dirname(__FILE__), "archimate.css"))
|
16
|
+
end
|
17
|
+
|
18
|
+
def svg_erb
|
19
|
+
@svg_erb ||= File.read(File.join(File.dirname(__FILE__), "svg_template.svg.erb"))
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_s
|
23
|
+
@template_xml ||= ERB.new(svg_erb).result(binding)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|