ea 0.6.127 → 0.6.129
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ea/fonts/carlito_gdi_widths.json +1 -0
- data/lib/ea/fonts/cjk_fallback_widths.json +1 -0
- data/lib/ea/fonts/metrics.rb +73 -15
- data/lib/ea/fonts/vertical_metrics.json +154 -0
- data/lib/ea/sources/qea/diagram_builder/association_class.rb +52 -0
- data/lib/ea/sources/qea/diagram_builder/auto_routing.rb +26 -4
- data/lib/ea/sources/qea/diagram_builder/routing.rb +90 -4
- data/lib/ea/sources/qea/diagram_builder.rb +29 -5
- data/lib/ea/sources/qea/relationship_builder.rb +6 -6
- data/lib/ea/sources/xmi/relationship_builder.rb +15 -8
- data/lib/ea/svg/ea_emitter/compartment/attributes.rb +1 -1
- data/lib/ea/svg/ea_emitter/compartment/header.rb +10 -1
- data/lib/ea/svg/ea_emitter/compartment/instance_slots.rb +24 -5
- data/lib/ea/svg/ea_emitter/compartment/note_body.rb +56 -20
- data/lib/ea/svg/ea_emitter/compartment/note_html.rb +18 -31
- data/lib/ea/svg/ea_emitter/connector_redock.rb +52 -3
- data/lib/ea/svg/ea_emitter/connectors.rb +1 -0
- data/lib/ea/svg/ea_emitter/element/header_renderer.rb +13 -3
- data/lib/ea/svg/ea_emitter/element/tagged_value_renderer.rb +14 -5
- data/lib/ea/svg/ea_emitter/elements.rb +13 -1
- data/lib/ea/svg/ea_emitter/font_resolver.rb +6 -1
- data/lib/ea/svg/ea_emitter/label/end_label.rb +182 -10
- data/lib/ea/svg/ea_emitter/label/midpoint_label.rb +28 -8
- data/lib/ea/svg/ea_emitter/label/plain_source_seat.rb +29 -0
- data/lib/ea/svg/ea_emitter/label/plain_target_seat.rb +28 -0
- data/lib/ea/svg/ea_emitter/label/source_stair_seat.rb +60 -0
- data/lib/ea/svg/ea_emitter/label/target_bend_seat.rb +45 -0
- data/lib/ea/svg/ea_emitter/label.rb +4 -0
- data/lib/ea/svg/ea_emitter/labels.rb +19 -3
- data/lib/ea/svg/ea_emitter/marker/diamond.rb +29 -5
- data/lib/ea/theme/definition.rb +9 -1
- data/lib/ea/version.rb +1 -1
- metadata +9 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ea
|
|
4
|
+
module Svg
|
|
5
|
+
module EaEmitter
|
|
6
|
+
module Label
|
|
7
|
+
# Moved plain target pairs on saved vertical stairs use the first
|
|
8
|
+
# bend, opposing 8px gutters and a baseline 3px above the saved OY.
|
|
9
|
+
module TargetBendSeat
|
|
10
|
+
def self.reference(points)
|
|
11
|
+
return nil unless points.size == 4
|
|
12
|
+
|
|
13
|
+
first, bend, corner, last = points
|
|
14
|
+
bend if descending_leg?(first, bend) && descending_leg?(corner, last) &&
|
|
15
|
+
bend[1] == corner[1] && bend[0] != corner[0]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.descending_leg?(first, last)
|
|
19
|
+
first[0] == last[0] && first[1] < last[1]
|
|
20
|
+
end
|
|
21
|
+
private_class_method :descending_leg?
|
|
22
|
+
|
|
23
|
+
def self.positions(connector:, bend:, text_box:, mult_box:, width:)
|
|
24
|
+
return nil unless bend && width && connector.connector_type == "Association"
|
|
25
|
+
return nil unless connector.style.to_h.values_at(:mode, :lwidth, :tree) == %w[3 0 V]
|
|
26
|
+
return nil unless moved_box?(text_box, 31) && moved_box?(mult_box, 16)
|
|
27
|
+
|
|
28
|
+
[position(bend, text_box, -width - 8), position(bend, mult_box, 8)]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def self.position(bend, box, inset)
|
|
32
|
+
[bend[0] + box["ox"].to_i + inset, bend[1] + box["oy"].to_i - 3]
|
|
33
|
+
end
|
|
34
|
+
private_class_method :position
|
|
35
|
+
|
|
36
|
+
def self.moved_box?(box, height)
|
|
37
|
+
box["alignment"] == 1 && box["cy"] == height &&
|
|
38
|
+
[box["ox"].to_i, box["oy"].to_i] != [0, 0]
|
|
39
|
+
end
|
|
40
|
+
private_class_method :moved_box?
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -15,6 +15,10 @@ module Ea
|
|
|
15
15
|
# register rather than editing the orchestrator (OCP).
|
|
16
16
|
module Label
|
|
17
17
|
autoload :EndLabel, "ea/svg/ea_emitter/label/end_label"
|
|
18
|
+
autoload :TargetBendSeat, "ea/svg/ea_emitter/label/target_bend_seat"
|
|
19
|
+
autoload :SourceStairSeat, "ea/svg/ea_emitter/label/source_stair_seat"
|
|
20
|
+
autoload :PlainSourceSeat, "ea/svg/ea_emitter/label/plain_source_seat"
|
|
21
|
+
autoload :PlainTargetSeat, "ea/svg/ea_emitter/label/plain_target_seat"
|
|
18
22
|
autoload :MidpointLabel, "ea/svg/ea_emitter/label/midpoint_label"
|
|
19
23
|
autoload :Registry, "ea/svg/ea_emitter/label/registry"
|
|
20
24
|
end
|
|
@@ -92,11 +92,13 @@ module Ea
|
|
|
92
92
|
anchor: source_pt, connector: connector,
|
|
93
93
|
end_kind: :source, tree: tree && tree[:source],
|
|
94
94
|
heading: (stored_src || stored_labels) && source_heading(connector, points),
|
|
95
|
-
stored_labels: stored_labels
|
|
95
|
+
stored_labels: stored_labels,
|
|
96
|
+
source_bounds: source_dock_bounds(connector)).each { |t| texts << t }
|
|
96
97
|
end_renderer.texts(text_box: tgt_tb,
|
|
97
98
|
mult_box: tgt_mb,
|
|
98
99
|
anchor: target_pt, connector: connector,
|
|
99
100
|
end_kind: :target, tree: tree && tree[:target],
|
|
101
|
+
bend: Label::TargetBendSeat.reference(points),
|
|
100
102
|
heading: (stored_tgt || stored_labels) && target_heading(connector, points),
|
|
101
103
|
stored_labels: stored_labels).each { |t| texts << t }
|
|
102
104
|
texts
|
|
@@ -290,7 +292,9 @@ module Ea
|
|
|
290
292
|
theme: theme,
|
|
291
293
|
font_family: label_font_family,
|
|
292
294
|
font_size: label_font_size,
|
|
293
|
-
font_unit: theme.label_font_size_unit
|
|
295
|
+
font_unit: theme.label_font_size_unit,
|
|
296
|
+
font_weight: label_font_weight,
|
|
297
|
+
font_style: label_font_style
|
|
294
298
|
)
|
|
295
299
|
end
|
|
296
300
|
|
|
@@ -300,7 +304,9 @@ module Ea
|
|
|
300
304
|
model_index: model_index,
|
|
301
305
|
font_family: label_font_family,
|
|
302
306
|
font_size: label_font_size,
|
|
303
|
-
font_unit: theme.label_font_size_unit
|
|
307
|
+
font_unit: theme.label_font_size_unit,
|
|
308
|
+
font_weight: label_font_weight,
|
|
309
|
+
font_style: label_font_style
|
|
304
310
|
)
|
|
305
311
|
end
|
|
306
312
|
|
|
@@ -326,9 +332,19 @@ module Ea
|
|
|
326
332
|
end
|
|
327
333
|
|
|
328
334
|
def label_font_family
|
|
335
|
+
return FontResolver::HAND_DRAW_FAMILY if diagram.hand_draw
|
|
336
|
+
|
|
329
337
|
theme.label_font_family || DEFAULT_FAMILY
|
|
330
338
|
end
|
|
331
339
|
|
|
340
|
+
def label_font_weight
|
|
341
|
+
diagram.hand_draw ? FontResolver::HAND_DRAW_LABEL_WEIGHT : 400
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
def label_font_style
|
|
345
|
+
diagram.hand_draw ? "italic" : "normal"
|
|
346
|
+
end
|
|
347
|
+
|
|
332
348
|
def label_font_size
|
|
333
349
|
theme.label_font_size || DEFAULT_SIZE
|
|
334
350
|
end
|
|
@@ -17,10 +17,11 @@ module Ea
|
|
|
17
17
|
whole_anchor = whole_at_target ? target : source
|
|
18
18
|
whole_base = whole_at_target ? before_target : after_source
|
|
19
19
|
specs = [Registry::Spec.new(shape: diamond_shape(connector, relationship, whole_at_target),
|
|
20
|
-
anchor: whole_anchor,
|
|
21
|
-
base: whole_base)]
|
|
20
|
+
anchor: whole_anchor, base: whole_base)]
|
|
22
21
|
return specs unless whole_at_target
|
|
23
|
-
|
|
22
|
+
|
|
23
|
+
target, before_target = target_arrow_points(connector, relationship, target, before_target)
|
|
24
|
+
return specs unless target
|
|
24
25
|
|
|
25
26
|
specs.concat(direction_specs(connector, source, target,
|
|
26
27
|
before_target, after_source))
|
|
@@ -68,14 +69,27 @@ module Ea
|
|
|
68
69
|
!whole_end_at_source?(connector)
|
|
69
70
|
end
|
|
70
71
|
|
|
71
|
-
#
|
|
72
|
-
#
|
|
72
|
+
# Navigable target-owned aggregations put the arrow at the
|
|
73
|
+
# diamond's inner vertex; nonnavigable targets omit it.
|
|
73
74
|
def self.arrow_on_target_diamond?(connector, relationship)
|
|
74
75
|
connector.direction == "Source -> Destination" &&
|
|
75
76
|
dest_flagged?(relationship)
|
|
76
77
|
end
|
|
77
78
|
private_class_method :arrow_on_target_diamond?
|
|
78
79
|
|
|
80
|
+
def self.inner_vertex(tip, base)
|
|
81
|
+
tx, ty = tip
|
|
82
|
+
bx, by = base
|
|
83
|
+
dx = bx - tx
|
|
84
|
+
dy = by - ty
|
|
85
|
+
length = Math.hypot(dx, dy)
|
|
86
|
+
return tip if length.zero?
|
|
87
|
+
|
|
88
|
+
depth = Markers::DIAMOND_HALF_H * 2
|
|
89
|
+
[(tx + dx / length * depth).round, (ty + dy / length * depth).round]
|
|
90
|
+
end
|
|
91
|
+
private_class_method :inner_vertex
|
|
92
|
+
|
|
79
93
|
def self.dest_flagged?(relationship)
|
|
80
94
|
relationship &&
|
|
81
95
|
%w[shared composite].include?(relationship.target_aggregation.to_s)
|
|
@@ -97,6 +111,16 @@ module Ea
|
|
|
97
111
|
base: before_target)]
|
|
98
112
|
end
|
|
99
113
|
private_class_method :direction_specs
|
|
114
|
+
|
|
115
|
+
def self.target_arrow_points(connector, relationship, target, before_target)
|
|
116
|
+
return [target, before_target] unless arrow_on_target_diamond?(connector, relationship)
|
|
117
|
+
return [] unless relationship.target_navigable
|
|
118
|
+
|
|
119
|
+
anchor = inner_vertex(target, before_target)
|
|
120
|
+
base = anchor.zip(before_target, target).map { |inner, before, tip| inner + before - tip }
|
|
121
|
+
[anchor, base]
|
|
122
|
+
end
|
|
123
|
+
private_class_method :target_arrow_points
|
|
100
124
|
end
|
|
101
125
|
end
|
|
102
126
|
end
|
data/lib/ea/theme/definition.rb
CHANGED
|
@@ -108,6 +108,7 @@ module Ea
|
|
|
108
108
|
@geometry = geometry || DEFAULT_GEOMETRY.dup
|
|
109
109
|
@frame = frame || DEFAULT_FRAME.dup
|
|
110
110
|
@compartments = compartments || DEFAULT_COMPARTMENTS.dup
|
|
111
|
+
@attribute_spec_override = attribute_spec
|
|
111
112
|
@attribute_spec = attribute_spec || DEFAULT_ATTR.dup
|
|
112
113
|
@markers = markers || DEFAULT_MARKERS.dup
|
|
113
114
|
@package = package || DEFAULT_PACKAGE.dup
|
|
@@ -137,6 +138,12 @@ module Ea
|
|
|
137
138
|
@label_font_size_unit || font_size_unit
|
|
138
139
|
end
|
|
139
140
|
|
|
141
|
+
# Attribute cells have a different inherited seat from enum literals,
|
|
142
|
+
# which continue to consume the legacy attribute_spec default.
|
|
143
|
+
def attribute_content_x_offset
|
|
144
|
+
@attribute_spec_override ? attribute_spec.content_x_offset : 22
|
|
145
|
+
end
|
|
146
|
+
|
|
140
147
|
def with(**overrides)
|
|
141
148
|
clear_label_override(overrides, :font_family, :label_font_family)
|
|
142
149
|
clear_label_override(overrides, :font_family, :element_font_family)
|
|
@@ -193,7 +200,8 @@ module Ea
|
|
|
193
200
|
marker_stroke_width: marker_stroke_width,
|
|
194
201
|
text_width_factor: text_width_factor,
|
|
195
202
|
geometry: geometry, frame: frame, compartments: compartments,
|
|
196
|
-
|
|
203
|
+
# Preserve omission so reconstruction retains the attribute-cell default.
|
|
204
|
+
attribute_spec: @attribute_spec_override, markers: markers,
|
|
197
205
|
package: package, note: note, fills: fills
|
|
198
206
|
}
|
|
199
207
|
end
|
data/lib/ea/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ea
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.129
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -618,8 +618,11 @@ files:
|
|
|
618
618
|
- lib/ea/fonts.rb
|
|
619
619
|
- lib/ea/fonts/cambria_7_regular_widths.json
|
|
620
620
|
- lib/ea/fonts/cambria_7_styled_widths.json
|
|
621
|
+
- lib/ea/fonts/carlito_gdi_widths.json
|
|
621
622
|
- lib/ea/fonts/carlito_metrics.json
|
|
623
|
+
- lib/ea/fonts/cjk_fallback_widths.json
|
|
622
624
|
- lib/ea/fonts/metrics.rb
|
|
625
|
+
- lib/ea/fonts/vertical_metrics.json
|
|
623
626
|
- lib/ea/guid_format.rb
|
|
624
627
|
- lib/ea/image.rb
|
|
625
628
|
- lib/ea/image/emf_renderer.rb
|
|
@@ -818,6 +821,7 @@ files:
|
|
|
818
821
|
- lib/ea/sources/qea/connector_relationship_map.rb
|
|
819
822
|
- lib/ea/sources/qea/context_diagram_support.rb
|
|
820
823
|
- lib/ea/sources/qea/diagram_builder.rb
|
|
824
|
+
- lib/ea/sources/qea/diagram_builder/association_class.rb
|
|
821
825
|
- lib/ea/sources/qea/diagram_builder/auto_routing.rb
|
|
822
826
|
- lib/ea/sources/qea/diagram_builder/font_settings.rb
|
|
823
827
|
- lib/ea/sources/qea/diagram_builder/routing.rb
|
|
@@ -940,7 +944,11 @@ files:
|
|
|
940
944
|
- lib/ea/svg/ea_emitter/label.rb
|
|
941
945
|
- lib/ea/svg/ea_emitter/label/end_label.rb
|
|
942
946
|
- lib/ea/svg/ea_emitter/label/midpoint_label.rb
|
|
947
|
+
- lib/ea/svg/ea_emitter/label/plain_source_seat.rb
|
|
948
|
+
- lib/ea/svg/ea_emitter/label/plain_target_seat.rb
|
|
943
949
|
- lib/ea/svg/ea_emitter/label/registry.rb
|
|
950
|
+
- lib/ea/svg/ea_emitter/label/source_stair_seat.rb
|
|
951
|
+
- lib/ea/svg/ea_emitter/label/target_bend_seat.rb
|
|
944
952
|
- lib/ea/svg/ea_emitter/labels.rb
|
|
945
953
|
- lib/ea/svg/ea_emitter/layer.rb
|
|
946
954
|
- lib/ea/svg/ea_emitter/layer_sequencer.rb
|