ea 0.6.103 → 0.6.104
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 53866c904e4fef2b317cd5aeb9e0b142e3d970507b65e9d9f14d2c768a56f1e8
|
|
4
|
+
data.tar.gz: 40ad1c86acd5461a89fe8e6b23a9da1f65eb43ef9eba632583344d09ed54b932
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f475a015d57fc2337ef3a19ea8e81fbd75e2f04532d79893e5fc01e1e9b344b07b973e4b833a4480dc49aed31f1ff4b45463950e53dc5e290f2b7304638be9e9
|
|
7
|
+
data.tar.gz: b8ca9731d6d2442f74778cbe4ad66550cada64399cbf33eb858a4e0ad59ad7e9488516732194d29ebaa7733c3beae401ae7e7856964b3d1c4fd0989abae0db6d
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ea
|
|
4
|
+
module Sources
|
|
5
|
+
module Qea
|
|
6
|
+
class DiagramBuilder
|
|
7
|
+
# Source-led routes for auto-routed associations with unequal end offsets.
|
|
8
|
+
module AutoRouting
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
# Nonuniform horizontal offsets seat the route at the source row.
|
|
12
|
+
# Uniform offsets retain the shared-overlap routing contract.
|
|
13
|
+
def source_row_association_ray(model, link_row, diagram_row, geom, context)
|
|
14
|
+
return model if context || !source_row_association?(model, link_row, geom)
|
|
15
|
+
|
|
16
|
+
origins = source_row_origins(*stored_ray_boxes(link_row, diagram_row), geom)
|
|
17
|
+
return model unless origins
|
|
18
|
+
|
|
19
|
+
model.source_anchor, model.target_anchor = origins
|
|
20
|
+
model.waypoints = origins.map { |point| Ea::Model::Waypoint.new(position: point) }
|
|
21
|
+
model.style[:overlap_ray] = true
|
|
22
|
+
model
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def source_row_origins(source, target, geom)
|
|
26
|
+
return nil unless source_row_faces_target?(source, target, geom[:edge])
|
|
27
|
+
|
|
28
|
+
row = source_row_y(source, geom)
|
|
29
|
+
return nil unless [source, target].all? { |box| within_height?(row, box) }
|
|
30
|
+
|
|
31
|
+
[source, target].map { |box| Ea::Model::Point.new(x: box.x + box.width / 2.0, y: row) }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def source_row_y(source, geom)
|
|
35
|
+
(source.y + source.height / 2.0 - geom[:sy]).floor
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def source_row_faces_target?(source, target, edge)
|
|
39
|
+
if edge == 2
|
|
40
|
+
source.x + source.width < target.x
|
|
41
|
+
else
|
|
42
|
+
target.x + target.width < source.x
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def source_row_association?(model, link_row, geom)
|
|
47
|
+
model.connector_type == "Association" && model.has_geometry_offsets &&
|
|
48
|
+
model.source_anchor && model.target_anchor &&
|
|
49
|
+
link_row.path.to_s.empty? && source_row_style?(model.style.to_h) &&
|
|
50
|
+
source_row_offsets?(geom)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def source_row_style?(style)
|
|
54
|
+
style[:mode] == "2" && style[:lwidth] == "2" && !style[:tree]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def source_row_offsets?(geom)
|
|
58
|
+
geom.values_at(:sx, :sy, :ex, :ey).all? &&
|
|
59
|
+
[2, 4].include?(geom[:edge]) && geom[:sy] != geom[:ey]
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ea
|
|
4
|
+
module Sources
|
|
5
|
+
module Qea
|
|
6
|
+
class DiagramBuilder
|
|
7
|
+
# Restore a saved square axis when its target remains on the outline
|
|
8
|
+
# but the source has moved beyond the saved endpoint into the gap.
|
|
9
|
+
module StoredSquarePorts
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def restore_stored_square_ports(model, link_row, diagram_row, geom, context)
|
|
13
|
+
return model if context || !stored_square_port_style?(model, link_row, geom)
|
|
14
|
+
|
|
15
|
+
connector = database.find_connector(link_row.connectorid)
|
|
16
|
+
points = stored_square_port_coordinates(connector)
|
|
17
|
+
boxes = stored_square_port_boxes(connector, diagram_row)
|
|
18
|
+
return model unless points && boxes
|
|
19
|
+
|
|
20
|
+
ends = reclip_stored_square_source(points, *boxes)
|
|
21
|
+
return model unless ends
|
|
22
|
+
|
|
23
|
+
model.source_anchor, model.target_anchor = ends
|
|
24
|
+
model.waypoints = ends.map { |point| Ea::Model::Waypoint.new(position: point) }
|
|
25
|
+
model
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def stored_square_port_style?(model, link_row, geom)
|
|
29
|
+
style = model.style.to_h
|
|
30
|
+
model.connector_type == "Association" && link_row.path.to_s.empty? &&
|
|
31
|
+
style.values_at(:mode, :tree, :lwidth) == %w[3 OS 2] &&
|
|
32
|
+
geom.values_at(:edge, :sx, :sy, :ex, :ey) == [1, 0, 0, 0, 0]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def stored_square_port_coordinates(connector)
|
|
36
|
+
return unless connector
|
|
37
|
+
|
|
38
|
+
values = [connector.ptstartx, connector.ptstarty, connector.ptendx, connector.ptendy]
|
|
39
|
+
return if values.any?(&:nil?)
|
|
40
|
+
|
|
41
|
+
[[values[0], -values[1]], [values[2], -values[3]]]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def stored_square_port_boxes(connector, diagram_row)
|
|
45
|
+
return unless connector
|
|
46
|
+
|
|
47
|
+
placements = [source_placement_for(connector, diagram_row),
|
|
48
|
+
target_placement_for(connector, diagram_row)]
|
|
49
|
+
placements.map { |placement| bounds_from_rect(placement) } if placements.all?
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def reclip_stored_square_source(points, source, target)
|
|
53
|
+
first, last = points
|
|
54
|
+
return unless first[0] == last[0] && square_axis_inside_boxes?(first[0], source, target)
|
|
55
|
+
|
|
56
|
+
return unless stored_square_source_in_gap?(points, source, target)
|
|
57
|
+
|
|
58
|
+
[Ea::Model::Point.new(x: first[0], y: source.y),
|
|
59
|
+
Ea::Model::Point.new(x: last[0], y: last[1])]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def stored_square_source_in_gap?(points, source, target)
|
|
63
|
+
first, last = points
|
|
64
|
+
target_edge = target.y + target.height + 1
|
|
65
|
+
last[1] == target_edge && target_edge < first[1] && first[1] < source.y
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def square_axis_inside_boxes?(axis, source, target)
|
|
69
|
+
[source, target].all? do |box|
|
|
70
|
+
box.width.positive? && box.height.positive? && axis.between?(box.x, box.x + box.width)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -11,8 +11,13 @@ module Ea
|
|
|
11
11
|
# styles).
|
|
12
12
|
class DiagramBuilder
|
|
13
13
|
autoload :Routing, "ea/sources/qea/diagram_builder/routing"
|
|
14
|
+
autoload :AutoRouting, "ea/sources/qea/diagram_builder/auto_routing"
|
|
15
|
+
autoload :StoredSquarePorts, "ea/sources/qea/diagram_builder/stored_square_ports"
|
|
14
16
|
include Routing
|
|
17
|
+
include AutoRouting
|
|
18
|
+
include StoredSquarePorts
|
|
15
19
|
private_constant :Routing
|
|
20
|
+
private_constant :AutoRouting, :StoredSquarePorts
|
|
16
21
|
|
|
17
22
|
attr_reader :database
|
|
18
23
|
|
|
@@ -436,8 +441,10 @@ module Ea
|
|
|
436
441
|
model = mode2_overlap_ray(model, link_row, diagram_row, geom, context)
|
|
437
442
|
model = association_stored_ray(model, link_row, diagram_row, geom, context)
|
|
438
443
|
model = correct_stored_ray_origins(model, link_row, diagram_row, geom, context)
|
|
444
|
+
model = source_row_association_ray(model, link_row, diagram_row, geom, context)
|
|
439
445
|
model = overlap_ray_origins(model, link_row, diagram_row, geom, context)
|
|
440
|
-
mark_default_square_ray(model, link_row, geom, context)
|
|
446
|
+
model = mark_default_square_ray(model, link_row, geom, context)
|
|
447
|
+
restore_stored_square_ports(model, link_row, diagram_row, geom, context)
|
|
441
448
|
end
|
|
442
449
|
|
|
443
450
|
# Ray origin for one connector end: the element's center
|
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.104
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -817,7 +817,9 @@ files:
|
|
|
817
817
|
- lib/ea/sources/qea/connector_relationship_map.rb
|
|
818
818
|
- lib/ea/sources/qea/context_diagram_support.rb
|
|
819
819
|
- lib/ea/sources/qea/diagram_builder.rb
|
|
820
|
+
- lib/ea/sources/qea/diagram_builder/auto_routing.rb
|
|
820
821
|
- lib/ea/sources/qea/diagram_builder/routing.rb
|
|
822
|
+
- lib/ea/sources/qea/diagram_builder/stored_square_ports.rb
|
|
821
823
|
- lib/ea/sources/qea/diagram_style_parser.rb
|
|
822
824
|
- lib/ea/sources/qea/id_normalizer.rb
|
|
823
825
|
- lib/ea/sources/qea/instance_builder.rb
|