ea 0.6.113 → 0.6.114

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: 673f03cddf9ae4a7cb297beaa9b9fab0b3e272e26771d976c90c521726465af5
4
- data.tar.gz: 1147cce73671336e59d68dc04caeee0cb66276ce946e5af3a8b07d378f21ac7b
3
+ metadata.gz: 251161fffac3b07a12851b0abd26a046998a61b19a9418da8c6d6ceea1cbb09f
4
+ data.tar.gz: 549486eec86fb19c6275db6ab7dafdcb7987c1a22b12df2740140e60c7bb2690
5
5
  SHA512:
6
- metadata.gz: 44fcd7c27d72d01fef2fdf70498bee178904e54af09484506ff61ff2372281cbc03b5c7d23d4750f4ad7f1c2a474ad3fb3c79cfbbcc61e520f151d11a670a2be
7
- data.tar.gz: 5a5ba8607a019d59be72fa1416cfbd66056e751420318bc02042a0ba02bd82dcc66452a97d25c26b2a0f408f132a2891a37db3e19f14f1c4ad98dfe1f4319c19
6
+ metadata.gz: c5cccbc615740b54619be7e36e4c6edb6382768d97b8a120841aca69018b73e693d9dadb8480e78c9e1e0a18ccfc09122668caf9680571496d99b44372c593cd
7
+ data.tar.gz: 87a9b79c59a7102d10aaf4968c052f5a63c1e707ef4daf2376d1278ca79b1317e2fc7d47988d57cb09c5abe88d57aeb12b611ba7066e421a1820ce07ac7ff581
@@ -126,6 +126,8 @@ module Ea
126
126
  @current_obj_row = obj_row
127
127
  style_hash = DiagramStyleParser.parse(obj_row.objectstyle)
128
128
  style_hash[:stored_attribute_order] = true
129
+ fqname = stereotype_fqname_for(obj_row)
130
+ style_hash[:stereotype_fqname] = fqname if fqname
129
131
  font_style = effective_font_style(obj_row, style_hash)
130
132
  Ea::Model::DiagramElement.new(
131
133
  id: IdNormalizer.synthetic("de", diagram_row.diagram_id,
@@ -150,6 +152,19 @@ module Ea
150
152
  raw == "1" || raw == "-1"
151
153
  end
152
154
 
155
+ def stereotype_fqname_for(placement)
156
+ object = database.find_object(placement.ea_object_id)
157
+ return nil unless object
158
+
159
+ database.xrefs_for_client(object.ea_guid).each do |xref|
160
+ application = Xref::Parser.parse(xref.description).stereotype
161
+ next unless application && application.name == object.stereotype
162
+
163
+ return application.fqname
164
+ end
165
+ nil
166
+ end
167
+
153
168
  def build_connectors(diagram_row)
154
169
  links = database.diagram_links_for(diagram_row.diagram_id) || []
155
170
  context = ContextDiagramSupport.context?(diagram_row)
@@ -389,6 +389,7 @@ module Ea
389
389
  dividers = [divider_y_by_ref[source_ref],
390
390
  divider_y_by_ref[target_ref]]
391
391
  return nil unless bounds.all? && dividers.all?
392
+ return nil if flush_lateral_line?(connector, pairs, *bounds)
392
393
 
393
394
  preserve_source = explicit_horizontal_source_dock?(pairs, connector)
394
395
  adjusted = row_slot_pairs(pairs, bounds, dividers, preserve_source: preserve_source)
@@ -23,6 +23,7 @@ module Ea
23
23
  :off_canvas_parent_name,
24
24
  :foreign_package_name,
25
25
  :suppress_stereotypes,
26
+ :stereotype_fqname,
26
27
  keyword_init: true)
27
28
 
28
29
  PROVIDERS = [
@@ -22,7 +22,7 @@ module Ea
22
22
  # render zero «...» lines, classes included).
23
23
  return [] if context.suppress_stereotypes
24
24
 
25
- labels = label_for(classifier, context.umldi_keyword)
25
+ labels = label_for(classifier, context.umldi_keyword, context.stereotype_fqname)
26
26
  return [] if labels.empty?
27
27
 
28
28
  labels.map { |l| [l, :normal] }
@@ -30,10 +30,10 @@ module Ea
30
30
 
31
31
  # @return [Array<String>] «name» labels (EA renders one
32
32
  # line per applied stereotype)
33
- def self.label_for(classifier, umldi_keyword)
33
+ def self.label_for(classifier, umldi_keyword, stereotype_fqname = nil)
34
34
  return ["«#{umldi_keyword}»"] if umldi_keyword && !umldi_keyword.empty?
35
35
 
36
- explicit = explicit_stereotype(classifier)
36
+ explicit = explicit_stereotype(classifier, stereotype_fqname)
37
37
  return explicit if explicit
38
38
 
39
39
  case classifier
@@ -45,21 +45,21 @@ module Ea
45
45
  end
46
46
  end
47
47
 
48
- def self.explicit_stereotype(classifier)
48
+ def self.explicit_stereotype(classifier, stereotype_fqname = nil)
49
49
  return nil unless classifier.is_a?(Ea::Model::Classifier) ||
50
50
  classifier.is_a?(Ea::Model::Package)
51
51
 
52
52
  refs = classifier.stereotype_refs
53
53
  return nil unless refs&.any?
54
54
 
55
- refs.map { |ref| "«#{canonical(ref)}»" }
55
+ refs.map { |ref| "«#{canonical(ref, stereotype_fqname)}»" }
56
56
  end
57
57
 
58
- # EA renders the stereotype string exactly as stored in
59
- # t_object.Stereotype — corpus-verified: 3,284 placements
60
- # render verbatim ('CodeList', 'codeList', 'codelist',
61
- # 'featureType' …), zero case-canonicalized.
62
- def self.canonical(ref)
58
+ # EA's standard Class stereotype displays as «type» while
59
+ # its semantic name remains Type. Custom profiles retain case.
60
+ def self.canonical(ref, stereotype_fqname = nil)
61
+ return "type" if ref == "Type" && stereotype_fqname == "StandardProfileL2::Type"
62
+
63
63
  ref
64
64
  end
65
65
 
@@ -166,10 +166,12 @@ module Ea
166
166
  )
167
167
  end
168
168
  end
169
+ stereotype_fqname = element.style&.fetch(:stereotype_fqname, nil)
169
170
  header_lines = classifier ? Element::HeaderLines.for(classifier,
170
171
  diagram_package_id: diagram.package_id,
171
172
  visually_nested: visually_nested?(element),
172
173
  umldi_keyword: element.umldi_keyword,
174
+ stereotype_fqname: stereotype_fqname,
173
175
  bounds_width: bounds.width,
174
176
  font_size: size, logical_height: logical_height,
175
177
  family: family,
@@ -452,7 +454,7 @@ module Ea
452
454
  def tagged_values_for(classifier)
453
455
  return [] unless classifier.is_a?(Ea::Model::Classifier)
454
456
 
455
- classifier.tagged_values || []
457
+ (classifier.tagged_values || []).reject { |tag| tag.value.nil? || tag.value.empty? }
456
458
  end
457
459
 
458
460
  # Real OCL constraints render trailing, after the content
@@ -10,7 +10,7 @@ module Ea
10
10
  # 2. theme.font_family / theme.font_size (when theme is themed)
11
11
  # 3. diagram-level default (most common non-nil value across
12
12
  # the diagram's elements)
13
- # 4. locale fallback (Calibri 10)
13
+ # 4. unthemed fallback (Cambria)
14
14
  #
15
15
  # Lives outside the Elements emitter so the resolution rule is
16
16
  # defined once (MECE) and reusable by Labels and any future
@@ -83,14 +83,8 @@ module Ea
83
83
  theme.element_font_family || theme.font_family
84
84
  end
85
85
 
86
- # EA's app-default font depends on the system locale:
87
- # Japanese Windows → "Yu Gothic UI" 13, English Windows →
88
- # "Calibri" 10. We can't query EA's runtime, so we infer
89
- # from the diagram:
90
- #
91
- # - If ANY element specifies font=, use the most common.
92
- # - If NO element specifies font= (all are "use default"),
93
- # assume the EA English-locale default: Calibri 10.
86
+ # Unthemed diagrams without a saved family use Cambria.
87
+ # Saved families still supply the diagram default.
94
88
  def diagram_default_family
95
89
  families = element_families
96
90
  return FALLBACK_DEFAULT_FAMILY if families.empty?
@@ -98,7 +92,7 @@ module Ea
98
92
  most_common(families)
99
93
  end
100
94
 
101
- FALLBACK_DEFAULT_FAMILY = "Calibri"
95
+ FALLBACK_DEFAULT_FAMILY = "Cambria"
102
96
 
103
97
  def most_common(values)
104
98
  return nil if values.empty?
@@ -247,12 +247,15 @@ module Ea
247
247
  def source_bottom_dock?(connector, heading, box)
248
248
  source_seat?(:source, heading) && heading[0].zero? && heading[1].positive? &&
249
249
  zero_source_property_box?(box) && default_presentation?(box) &&
250
- source_bottom_property_route?(connector.style.to_h) &&
251
- source_property_font?(connector, :down)
250
+ source_bottom_property_route?(connector.style.to_h) && source_property_cambria?(connector)
252
251
  end
253
252
 
253
+ # A downward leg on the horizontal lateral tree seats an absent
254
+ # box like the up leg already does on the same route.
254
255
  def source_bottom_property_route?(style)
255
- style[:stored_association_ray] == true && style.values_at(:mode, :lwidth, :tree) == ["3", "2", nil]
256
+ return false unless style.values_at(:mode, :lwidth) == %w[3 2]
257
+
258
+ style[:tree] == "LH" || (style[:stored_association_ray] == true && style[:tree].nil?)
256
259
  end
257
260
 
258
261
  def plain_upward_seat(connector, direction, anchor, box, role)
@@ -386,11 +389,14 @@ module Ea
386
389
  end
387
390
 
388
391
  def source_property_font?(connector, direction)
389
- font_family.to_s.casecmp("Cambria").zero? &&
390
- property_label?(connector, :source) &&
392
+ source_property_cambria?(connector) &&
391
393
  source_property_route?(connector.style.to_h, direction)
392
394
  end
393
395
 
396
+ def source_property_cambria?(connector)
397
+ font_family.to_s.casecmp("Cambria").zero? && property_label?(connector, :source)
398
+ end
399
+
394
400
  def source_property_route?(style, direction)
395
401
  case direction
396
402
  when :left then left_property_route?(style)
data/lib/ea/version.rb CHANGED
@@ -4,5 +4,5 @@ module Ea
4
4
  # Gem release version. Extracted to its own file so the
5
5
  # `gem-release` tool's `gem bump` can find and update it via the
6
6
  # standard `lib/<gem>/version.rb` convention.
7
- VERSION = "0.6.113"
7
+ VERSION = "0.6.114"
8
8
  end
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.113
4
+ version: 0.6.114
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.