ea 0.6.27 → 0.6.29
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/sources/qea/diagram_builder.rb +78 -0
- data/lib/ea/svg/ea_emitter/marker/open_triangle.rb +13 -3
- data/lib/ea/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 521d4fdcc042ad06bd18a829f39810ccef7df8f750bbe229c6d7c38ea3e45c2e
|
|
4
|
+
data.tar.gz: 49f8e753ae47eda15409252023e894e66949e590c579c9da7fb4140acc74e550
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 151b418a45c19c998c41957ddb471127f6e110689372a01e046152024c271b10ccb069af527c877ee6404cfe22c0323f55232e9140ba5a4882b382534a26b4b6
|
|
7
|
+
data.tar.gz: d2b597bfebed6432a78285f8898d73ef6cfdbbf65362132eed375b387bdc0aa1cfb40ceddabea22695060b8467e70c94768618b7a102bca556f0ab5351882955
|
|
@@ -432,11 +432,89 @@ module Ea
|
|
|
432
432
|
points = sx_sy_ex_ey_waypoints(source_point, target_point, geom)
|
|
433
433
|
end
|
|
434
434
|
|
|
435
|
+
# Associations/Aggregations between DISJOINT boxes: when the
|
|
436
|
+
# stored route does not already dock the closest FACING edge
|
|
437
|
+
# pair, EA redraws a straight aligned line between those
|
|
438
|
+
# edges (corpus: edge pair = min facing gap, 85% accurate;
|
|
439
|
+
# dock coordinate = the stored route's own coordinate
|
|
440
|
+
# clamped into the edges' overlap; simulation on 417
|
|
441
|
+
# identity-paired connectors: exact routes 41 -> 100).
|
|
442
|
+
# Tree-style (EDGE=2) connectors are excluded — their
|
|
443
|
+
# computed routes are already byte-exact.
|
|
444
|
+
if %w[Association Aggregation].include?(connector.connector_type) &&
|
|
445
|
+
edge_out != 2
|
|
446
|
+
points = facing_edge_route(points,
|
|
447
|
+
bounds_from_rect(source_placement),
|
|
448
|
+
bounds_from_rect(target_placement))
|
|
449
|
+
end
|
|
450
|
+
|
|
435
451
|
points.map do |x, y|
|
|
436
452
|
Ea::Model::Waypoint.new(position: Ea::Model::Point.new(x: x, y: y))
|
|
437
453
|
end
|
|
438
454
|
end
|
|
439
455
|
|
|
456
|
+
# Returns a replacement 2-point route between the closest
|
|
457
|
+
# facing edges, or the original points when: the boxes overlap
|
|
458
|
+
# on both axes, the current route already docks those edges,
|
|
459
|
+
# or no aligned dock fits the edges' overlap range.
|
|
460
|
+
def facing_edge_route(points, src, tgt)
|
|
461
|
+
v_gap = v_dir = h_gap = h_dir = nil
|
|
462
|
+
if src.y >= tgt.y + tgt.height
|
|
463
|
+
v_gap = src.y - (tgt.y + tgt.height)
|
|
464
|
+
v_dir = [:t, :b]
|
|
465
|
+
elsif tgt.y >= src.y + src.height
|
|
466
|
+
v_gap = tgt.y - (src.y + src.height)
|
|
467
|
+
v_dir = [:b, :t]
|
|
468
|
+
end
|
|
469
|
+
if src.x >= tgt.x + tgt.width
|
|
470
|
+
h_gap = src.x - (tgt.x + tgt.width)
|
|
471
|
+
h_dir = [:l, :r]
|
|
472
|
+
elsif tgt.x >= src.x + src.width
|
|
473
|
+
h_gap = tgt.x - (tgt.x + tgt.width)
|
|
474
|
+
h_dir = [:r, :l]
|
|
475
|
+
end
|
|
476
|
+
return points if v_gap.nil? && h_gap.nil?
|
|
477
|
+
|
|
478
|
+
if !v_gap.nil? && (h_gap.nil? || v_gap <= h_gap)
|
|
479
|
+
src_edge, tgt_edge = v_dir
|
|
480
|
+
else
|
|
481
|
+
src_edge, tgt_edge = h_dir
|
|
482
|
+
end
|
|
483
|
+
return points if docks_edges?(points, src, src_edge, tgt, tgt_edge)
|
|
484
|
+
|
|
485
|
+
if %i[t b].include?(src_edge)
|
|
486
|
+
lo = [src.x, tgt.x].max
|
|
487
|
+
hi = [src.x + src.width, tgt.x + tgt.width].min
|
|
488
|
+
return points if lo > hi
|
|
489
|
+
|
|
490
|
+
x = points.first[0].clamp(lo, hi)
|
|
491
|
+
[[x, src_edge == :t ? src.y : src.y + src.height],
|
|
492
|
+
[x, tgt_edge == :t ? tgt.y : tgt.y + tgt.height]]
|
|
493
|
+
else
|
|
494
|
+
lo = [src.y, tgt.y].max
|
|
495
|
+
hi = [src.y + src.height, tgt.y + tgt.height].min
|
|
496
|
+
return points if lo > hi
|
|
497
|
+
|
|
498
|
+
y = points.first[1].clamp(lo, hi)
|
|
499
|
+
[[src_edge == :l ? src.x : src.x + src.width, y],
|
|
500
|
+
[tgt_edge == :l ? tgt.x : tgt.x + tgt.width, y]]
|
|
501
|
+
end
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
def docks_edges?(points, src, src_edge, tgt, tgt_edge)
|
|
505
|
+
on_edge?(points.first, src, src_edge) && on_edge?(points.last, tgt, tgt_edge)
|
|
506
|
+
end
|
|
507
|
+
|
|
508
|
+
def on_edge?(pt, b, edge, tol = 2)
|
|
509
|
+
x, y = pt
|
|
510
|
+
case edge
|
|
511
|
+
when :l then (x - b.x).abs <= tol && y.between?(b.y - tol, b.y + b.height + tol)
|
|
512
|
+
when :r then (x - (b.x + b.width)).abs <= tol && y.between?(b.y - tol, b.y + b.height + tol)
|
|
513
|
+
when :t then (y - b.y).abs <= tol && x.between?(b.x - tol, b.x + b.width + tol)
|
|
514
|
+
else (y - (b.y + b.height)).abs <= tol && x.between?(b.x - tol, b.x + b.width + tol)
|
|
515
|
+
end
|
|
516
|
+
end
|
|
517
|
+
|
|
440
518
|
# A tree Path is current when its bend height still falls
|
|
441
519
|
# within the source element's y-range (the exit height EA
|
|
442
520
|
# records); a bend outside the element is stale and EA
|
|
@@ -5,8 +5,13 @@ module Ea
|
|
|
5
5
|
module EaEmitter
|
|
6
6
|
module Marker
|
|
7
7
|
# Open triangle marker for UML generalization, realization,
|
|
8
|
-
# and dependency.
|
|
9
|
-
# general / supplier end
|
|
8
|
+
# and dependency. Generalization/Realization render a
|
|
9
|
+
# white-filled 3-point polygon at the general / supplier end;
|
|
10
|
+
# DEPENDENCY renders a line-style open path triangle (same
|
|
11
|
+
# style group as the connector line) — corpus-verified on
|
|
12
|
+
# E58034A3 where 22 directed dependencies converging on one
|
|
13
|
+
# package each draw a 'M a b L c d L a e' path triangle while
|
|
14
|
+
# the diagram's generalizations use polygons.
|
|
10
15
|
class OpenTriangle < Kind
|
|
11
16
|
def self.handles?(effective_type)
|
|
12
17
|
%w[Generalization Realization Dependency].include?(effective_type)
|
|
@@ -16,7 +21,12 @@ module Ea
|
|
|
16
21
|
whole_end_at_source = whole_end_at_source?(connector)
|
|
17
22
|
anchor = whole_end_at_source ? target : source
|
|
18
23
|
base = whole_end_at_source ? before_target : after_source
|
|
19
|
-
|
|
24
|
+
shape = effective_type?(connector) == "Dependency" ? :arrow : :triangle
|
|
25
|
+
[Registry::Spec.new(shape: shape, anchor: anchor, base: base)]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.effective_type?(connector)
|
|
29
|
+
connector.connector_type
|
|
20
30
|
end
|
|
21
31
|
end
|
|
22
32
|
end
|
data/lib/ea/version.rb
CHANGED