ea 0.6.131 → 0.6.133
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/metrics.rb +13 -4
- data/lib/ea/fonts/source_sans_pro_advances.json +1 -0
- data/lib/ea/model/diagram_connector.rb +7 -0
- data/lib/ea/sources/qea/diagram_builder/routing.rb +45 -3
- data/lib/ea/sources/qea/diagram_builder.rb +26 -0
- data/lib/ea/sources/xmi/diagram_builder/umldi_edges.rb +48 -0
- data/lib/ea/sources/xmi/diagram_builder.rb +63 -8
- data/lib/ea/sources/xmi/extension_geometry_parser.rb +7 -5
- data/lib/ea/sources/xmi/relationship_builder.rb +1 -1
- data/lib/ea/sources/xmi/stored_route.rb +146 -0
- data/lib/ea/sources/xmi.rb +1 -0
- data/lib/ea/svg/ea_emitter/connector_bridges.rb +140 -0
- data/lib/ea/svg/ea_emitter/connector_redock.rb +36 -2
- data/lib/ea/svg/ea_emitter/connectors.rb +17 -36
- data/lib/ea/svg/ea_emitter/label/end_label.rb +58 -6
- data/lib/ea/svg/ea_emitter/labels.rb +24 -0
- data/lib/ea/svg/ea_emitter.rb +2 -0
- data/lib/ea/version.rb +1 -1
- metadata +5 -1
|
@@ -54,12 +54,14 @@ module Ea
|
|
|
54
54
|
# end_kind - :source or :target
|
|
55
55
|
# heading - [dx, dy] of the first leg leaving the anchor
|
|
56
56
|
# source_bounds - effective drawn source outline, in anchor coordinates
|
|
57
|
+
# target_face - exact drawn target dock face when it leads the emitted leg
|
|
57
58
|
# bend - first bend of a saved descending vertical stair
|
|
58
59
|
# stored_labels - the connector has stored label boxes at
|
|
59
60
|
# either end; false keeps the opposite-end
|
|
60
61
|
# fallback
|
|
61
62
|
def texts(text_box:, mult_box:, anchor:, connector:, end_kind:,
|
|
62
|
-
tree: false, heading: nil, stored_labels: false, bend: nil, source_bounds: nil
|
|
63
|
+
tree: false, heading: nil, stored_labels: false, bend: nil, source_bounds: nil,
|
|
64
|
+
target_face: nil)
|
|
63
65
|
from_property, role, mult = role_and_multiplicity(connector, end_kind)
|
|
64
66
|
if role_empty?(role) && mult_empty?(mult)
|
|
65
67
|
other_from_prop, other_role, other_mult = role_and_multiplicity(connector,
|
|
@@ -114,13 +116,23 @@ module Ea
|
|
|
114
116
|
target_diagonal_property_role(connector, heading, anchor, text_box, role) ||
|
|
115
117
|
target_vertical_role(connector, heading, anchor, text_box, role) ||
|
|
116
118
|
target_rightward_role(heading, anchor, text_box, role) || text_pos
|
|
119
|
+
if horizontal_aligned_target_baseline?(connector, heading, text_box, role)
|
|
120
|
+
text_pos = [text_pos[0], seat_corner(anchor, text_box)[1] - 7]
|
|
121
|
+
end
|
|
122
|
+
face_multiplicity = if target_left_face_multiplicity?(connector, heading, mult_box, mult,
|
|
123
|
+
target_face)
|
|
124
|
+
directional_multiplicity(:left, anchor, mult_box, mult)
|
|
125
|
+
end
|
|
117
126
|
mult_pos = target_multiplicity_seat(connector, heading, anchor, mult_box) ||
|
|
118
|
-
target_horizontal_multiplicity(heading, anchor, mult_box, mult) ||
|
|
127
|
+
face_multiplicity || target_horizontal_multiplicity(heading, anchor, mult_box, mult) ||
|
|
128
|
+
mult_pos
|
|
119
129
|
end
|
|
120
130
|
|
|
121
131
|
if end_kind == :source
|
|
122
132
|
text_pos = source_top_property_role(connector, heading, anchor, text_box, role) ||
|
|
123
133
|
source_bottom_property_role(connector, heading, anchor, text_box, role) || text_pos
|
|
134
|
+
mult_pos = source_top_property_multiplicity(connector, heading, anchor,
|
|
135
|
+
[text_box, mult_box], mult) || mult_pos
|
|
124
136
|
if external_upward_property_source?(connector, heading, anchor, text_box, source_bounds)
|
|
125
137
|
text_pos = external_upward_property_role(anchor, role) || text_pos
|
|
126
138
|
end
|
|
@@ -143,6 +155,23 @@ module Ea
|
|
|
143
155
|
|
|
144
156
|
private
|
|
145
157
|
|
|
158
|
+
# ALN2 single-line target roles retain their horizontal placement
|
|
159
|
+
# and use the saved corner's baseline on a straight stored ray.
|
|
160
|
+
def horizontal_aligned_target_baseline?(connector, heading, box, role)
|
|
161
|
+
return false unless heading && heading[1].zero? && !heading[0].zero?
|
|
162
|
+
return false unless saved_target_ray?(connector) && !role_empty?(role)
|
|
163
|
+
return false unless connector_source_dest_stereotype(connector, :target).to_s.empty?
|
|
164
|
+
|
|
165
|
+
aligned_target_baseline_box?(box)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def aligned_target_baseline_box?(box)
|
|
169
|
+
return false unless seat_font? && font_weight == 400 && font_style == "normal"
|
|
170
|
+
return false unless box && box["alignment"] == 2 && [13, 14].include?(box["cy"])
|
|
171
|
+
|
|
172
|
+
cambria_box?(box.merge("alignment" => 0))
|
|
173
|
+
end
|
|
174
|
+
|
|
146
175
|
def plain_leftward_target_role(connector, heading, anchor, box, role)
|
|
147
176
|
return nil unless heading && heading[0].negative? && heading[1].zero?
|
|
148
177
|
return nil unless plain_target_role?(connector, box, role)
|
|
@@ -339,14 +368,27 @@ module Ea
|
|
|
339
368
|
# EDGE=1 certifies the top dock independently of the clipped ray's
|
|
340
369
|
# heading. An absent source box uses the upward Property seat.
|
|
341
370
|
def source_top_property_role(connector, heading, anchor, box, role)
|
|
342
|
-
return nil unless
|
|
343
|
-
return nil unless zero_source_property_box?(box)
|
|
344
|
-
|
|
345
|
-
return nil unless source_top_property_route?(connector.style.to_h)
|
|
371
|
+
return nil unless source_top_property_box?(connector, heading, box)
|
|
346
372
|
|
|
347
373
|
source_property_seat(connector, :up, anchor, box, role)
|
|
348
374
|
end
|
|
349
375
|
|
|
376
|
+
def source_top_property_multiplicity(connector, heading, anchor, boxes, mult)
|
|
377
|
+
return nil if mult_empty?(mult)
|
|
378
|
+
|
|
379
|
+
role_box, mult_box = boxes
|
|
380
|
+
return nil unless source_top_property_box?(connector, heading, role_box)
|
|
381
|
+
return nil unless source_top_property_box?(connector, heading, mult_box)
|
|
382
|
+
|
|
383
|
+
mult_seat(:up, anchor, mult_box)
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
def source_top_property_box?(connector, heading, box)
|
|
387
|
+
source_seat?(:source, heading) && heading[0].negative? && heading[1].positive? &&
|
|
388
|
+
zero_source_property_box?(box) && source_top_property_route?(connector.style.to_h) &&
|
|
389
|
+
source_property_seat?(connector, :up, box)
|
|
390
|
+
end
|
|
391
|
+
|
|
350
392
|
# A persisted origin above the drawn source outline keeps the
|
|
351
393
|
# upward seat's inset and the shared upper baseline, including
|
|
352
394
|
# steep diagonals. Origins clipped onto the face retain -6.
|
|
@@ -697,11 +739,21 @@ module Ea
|
|
|
697
739
|
def target_horizontal_multiplicity(heading, anchor, box, mult)
|
|
698
740
|
return nil unless seat_font? && heading && heading[1].zero? && !heading[0].zero?
|
|
699
741
|
return nil if mult_empty?(mult)
|
|
742
|
+
|
|
700
743
|
return directional_multiplicity(:left, anchor, box, mult) if heading[0].negative?
|
|
701
744
|
|
|
702
745
|
mult_seat(:right, anchor, box)
|
|
703
746
|
end
|
|
704
747
|
|
|
748
|
+
def target_left_face_multiplicity?(connector, heading, box, mult, target_face)
|
|
749
|
+
seat_font? && !mult_empty?(mult) && property_label?(connector, :target) && cambria_box?(box) &&
|
|
750
|
+
stored_offsets_zero?(box) && target_left_face_heading?(heading, target_face)
|
|
751
|
+
end
|
|
752
|
+
|
|
753
|
+
def target_left_face_heading?(heading, target_face)
|
|
754
|
+
heading && !heading[1].zero? && heading[0].negative? && target_face == [-1, 0]
|
|
755
|
+
end
|
|
756
|
+
|
|
705
757
|
def target_multiplicity_seat(connector, heading, anchor, box)
|
|
706
758
|
return nil unless seat_font?
|
|
707
759
|
return nil unless heading && heading[0].zero? && heading[1].negative?
|
|
@@ -100,6 +100,7 @@ module Ea
|
|
|
100
100
|
end_kind: :target, tree: tree && tree[:target],
|
|
101
101
|
bend: Label::TargetBendSeat.reference(points),
|
|
102
102
|
heading: (stored_tgt || stored_labels) && target_heading(connector, points),
|
|
103
|
+
target_face: target_dock_heading(connector, target_pt, target_heading(connector, points)),
|
|
103
104
|
stored_labels: stored_labels).each { |t| texts << t }
|
|
104
105
|
texts
|
|
105
106
|
end
|
|
@@ -202,6 +203,29 @@ module Ea
|
|
|
202
203
|
drawn_bounds[source]
|
|
203
204
|
end
|
|
204
205
|
|
|
206
|
+
def target_dock_bounds(connector)
|
|
207
|
+
return nil unless model_index && drawn_bounds
|
|
208
|
+
|
|
209
|
+
relationship = model_index[connector.relationship_ref]
|
|
210
|
+
return nil unless relationship
|
|
211
|
+
|
|
212
|
+
source, target = ConnectorRedock.end_refs(relationship)
|
|
213
|
+
return nil if source == target
|
|
214
|
+
return nil unless drawn_bounds[source]
|
|
215
|
+
|
|
216
|
+
drawn_bounds[target]
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
def target_dock_heading(connector, point, heading)
|
|
220
|
+
return nil unless heading
|
|
221
|
+
|
|
222
|
+
box = target_dock_bounds(connector)
|
|
223
|
+
face = box && dock_face_heading(point, box)
|
|
224
|
+
return nil unless face&.zip(heading)&.any? { |axis, delta| (axis * delta).positive? }
|
|
225
|
+
|
|
226
|
+
face
|
|
227
|
+
end
|
|
228
|
+
|
|
205
229
|
# Saved rays can start outside the box. Project onto its boundary;
|
|
206
230
|
# corners stay ambiguous and the face must still lead the emitted leg.
|
|
207
231
|
def source_dock_heading(connector, point, box)
|
data/lib/ea/svg/ea_emitter.rb
CHANGED
|
@@ -31,6 +31,8 @@ module Ea
|
|
|
31
31
|
autoload :Style, "ea/svg/ea_emitter/style"
|
|
32
32
|
autoload :Elements, "ea/svg/ea_emitter/elements"
|
|
33
33
|
autoload :Connectors, "ea/svg/ea_emitter/connectors"
|
|
34
|
+
autoload :ConnectorBridges, "ea/svg/ea_emitter/connector_bridges"
|
|
35
|
+
private_constant :ConnectorBridges
|
|
34
36
|
autoload :Markers, "ea/svg/ea_emitter/markers"
|
|
35
37
|
autoload :Labels, "ea/svg/ea_emitter/labels"
|
|
36
38
|
autoload :GhostLabels, "ea/svg/ea_emitter/ghost_labels"
|
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.133
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -622,6 +622,7 @@ files:
|
|
|
622
622
|
- lib/ea/fonts/carlito_metrics.json
|
|
623
623
|
- lib/ea/fonts/cjk_fallback_widths.json
|
|
624
624
|
- lib/ea/fonts/metrics.rb
|
|
625
|
+
- lib/ea/fonts/source_sans_pro_advances.json
|
|
625
626
|
- lib/ea/fonts/vertical_metrics.json
|
|
626
627
|
- lib/ea/guid_format.rb
|
|
627
628
|
- lib/ea/image.rb
|
|
@@ -850,6 +851,7 @@ files:
|
|
|
850
851
|
- lib/ea/sources/xmi/annotation_builder.rb
|
|
851
852
|
- lib/ea/sources/xmi/classifier_builder.rb
|
|
852
853
|
- lib/ea/sources/xmi/diagram_builder.rb
|
|
854
|
+
- lib/ea/sources/xmi/diagram_builder/umldi_edges.rb
|
|
853
855
|
- lib/ea/sources/xmi/extension_elements.rb
|
|
854
856
|
- lib/ea/sources/xmi/extension_geometry_parser.rb
|
|
855
857
|
- lib/ea/sources/xmi/extension_style_parser.rb
|
|
@@ -865,6 +867,7 @@ files:
|
|
|
865
867
|
- lib/ea/sources/xmi/relationship_builder.rb
|
|
866
868
|
- lib/ea/sources/xmi/relationship_type_map.rb
|
|
867
869
|
- lib/ea/sources/xmi/stereotype_builder.rb
|
|
870
|
+
- lib/ea/sources/xmi/stored_route.rb
|
|
868
871
|
- lib/ea/sources/xmi/tag_builder.rb
|
|
869
872
|
- lib/ea/sources/xmi/type_classifier_map.rb
|
|
870
873
|
- lib/ea/sources/xmi/umldi_keyword_extractor.rb
|
|
@@ -909,6 +912,7 @@ files:
|
|
|
909
912
|
- lib/ea/svg/ea_emitter/compartment/shape.rb
|
|
910
913
|
- lib/ea/svg/ea_emitter/compartment/stereotype_icon.rb
|
|
911
914
|
- lib/ea/svg/ea_emitter/compartment/tagged_values.rb
|
|
915
|
+
- lib/ea/svg/ea_emitter/connector_bridges.rb
|
|
912
916
|
- lib/ea/svg/ea_emitter/connector_redock.rb
|
|
913
917
|
- lib/ea/svg/ea_emitter/connectors.rb
|
|
914
918
|
- lib/ea/svg/ea_emitter/diagram_frame.rb
|