ea 0.6.153 → 0.6.155
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/cli/app.rb +8 -2
- data/lib/ea/cli/command/base.rb +1 -3
- data/lib/ea/cli/command/convert.rb +2 -2
- data/lib/ea/cli/command/diagrams.rb +4 -4
- data/lib/ea/cli/command/export.rb +1 -1
- data/lib/ea/cli/command/info.rb +1 -1
- data/lib/ea/cli/command/list.rb +2 -2
- data/lib/ea/cli/command/render.rb +1 -2
- data/lib/ea/cli/command/svg.rb +1 -1
- data/lib/ea/cli/command/validate.rb +1 -3
- data/lib/ea/cli/error.rb +1 -1
- data/lib/ea/cli/output.rb +1 -1
- data/lib/ea/diagram/display_config.rb +1 -1
- data/lib/ea/export/json/generator.rb +5 -5
- data/lib/ea/export/json_schema/generator.rb +2 -2
- data/lib/ea/export/plantuml/generator.rb +2 -2
- data/lib/ea/fonts/metrics.rb +3 -4
- data/lib/ea/lint/rules/cyclic_generalization.rb +1 -1
- data/lib/ea/lint/rules/duplicate_name.rb +1 -1
- data/lib/ea/lint/rules/missing_stereotype.rb +4 -3
- data/lib/ea/lint/rules/naming_convention.rb +11 -11
- data/lib/ea/lint/rules/orphan_element.rb +6 -6
- data/lib/ea/mdg/document.rb +0 -1
- data/lib/ea/mdg/loader.rb +0 -1
- data/lib/ea/mdg/xml/technology.rb +1 -1
- data/lib/ea/mdg/xml.rb +0 -1
- data/lib/ea/mdg.rb +0 -1
- data/lib/ea/model/document.rb +2 -2
- data/lib/ea/model/ghost_label.rb +0 -1
- data/lib/ea/model/legend.rb +1 -1
- data/lib/ea/model/property.rb +1 -1
- data/lib/ea/qea/benchmark.rb +9 -13
- data/lib/ea/qea/database.rb +26 -28
- data/lib/ea/qea/factory/association_builder.rb +5 -5
- data/lib/ea/qea/factory/association_transformer.rb +3 -6
- data/lib/ea/qea/factory/attribute_transformer.rb +3 -3
- data/lib/ea/qea/factory/base_transformer.rb +4 -4
- data/lib/ea/qea/factory/class_transformer.rb +5 -5
- data/lib/ea/qea/factory/constraint_transformer.rb +2 -2
- data/lib/ea/qea/factory/data_type_transformer.rb +5 -7
- data/lib/ea/qea/factory/diagram_transformer.rb +3 -7
- data/lib/ea/qea/factory/document_builder.rb +33 -37
- data/lib/ea/qea/factory/ea_to_uml_factory.rb +12 -18
- data/lib/ea/qea/factory/enum_transformer.rb +1 -2
- data/lib/ea/qea/factory/generalization_builder.rb +9 -9
- data/lib/ea/qea/factory/generalization_transformer.rb +3 -5
- data/lib/ea/qea/factory/instance_transformer.rb +3 -8
- data/lib/ea/qea/factory/operation_transformer.rb +2 -4
- data/lib/ea/qea/factory/package_transformer.rb +3 -3
- data/lib/ea/qea/factory/reference_resolver.rb +1 -1
- data/lib/ea/qea/factory/stereotype_loader.rb +1 -5
- data/lib/ea/qea/file_detector.rb +6 -12
- data/lib/ea/qea/infrastructure/database_connection.rb +1 -3
- data/lib/ea/qea/infrastructure/schema_reader.rb +4 -4
- data/lib/ea/qea/infrastructure/table_reader.rb +1 -1
- data/lib/ea/qea/models/ea_attribute.rb +1 -2
- data/lib/ea/qea/models/ea_attribute_tag.rb +1 -2
- data/lib/ea/qea/models/ea_author.rb +1 -1
- data/lib/ea/qea/models/ea_diagram_link.rb +4 -8
- data/lib/ea/qea/models/ea_diagram_object.rb +3 -4
- data/lib/ea/qea/models/ea_document.rb +4 -5
- data/lib/ea/qea/models/ea_glossary.rb +1 -1
- data/lib/ea/qea/models/ea_list.rb +1 -1
- data/lib/ea/qea/models/ea_object.rb +2 -2
- data/lib/ea/qea/models/ea_object_constraint.rb +1 -2
- data/lib/ea/qea/models/ea_object_property.rb +1 -2
- data/lib/ea/qea/models/ea_operation.rb +1 -2
- data/lib/ea/qea/models/ea_phase.rb +1 -1
- data/lib/ea/qea/models/ea_script.rb +5 -6
- data/lib/ea/qea/models/ea_tagged_value.rb +2 -3
- data/lib/ea/qea/models/ea_version.rb +1 -1
- data/lib/ea/qea/models/ea_xref.rb +6 -7
- data/lib/ea/qea/repositories/base_repository.rb +1 -1
- data/lib/ea/qea/services/database_loader.rb +2 -4
- data/lib/ea/qea/validation/association_validator.rb +12 -12
- data/lib/ea/qea/validation/attribute_validator.rb +25 -26
- data/lib/ea/qea/validation/base_validator.rb +5 -5
- data/lib/ea/qea/validation/class_validator.rb +34 -34
- data/lib/ea/qea/validation/database/circular_reference_validator.rb +7 -7
- data/lib/ea/qea/validation/database/ocl_constraint_validator.rb +3 -3
- data/lib/ea/qea/validation/database/orphan_validator.rb +5 -7
- data/lib/ea/qea/validation/database/referential_integrity_validator.rb +39 -39
- data/lib/ea/qea/validation/diagram_validator.rb +39 -39
- data/lib/ea/qea/validation/formatters/json_formatter.rb +16 -16
- data/lib/ea/qea/validation/formatters/text_formatter.rb +10 -10
- data/lib/ea/qea/validation/operation_validator.rb +13 -14
- data/lib/ea/qea/validation/package_validator.rb +18 -18
- data/lib/ea/qea/validation/validation_engine.rb +5 -5
- data/lib/ea/qea/validation/validation_message.rb +56 -73
- data/lib/ea/qea/validation/validation_result.rb +6 -6
- data/lib/ea/qea/verification/comparison_result.rb +13 -21
- data/lib/ea/qea/verification/document_normalizer.rb +6 -12
- data/lib/ea/qea/verification/document_verifier.rb +39 -39
- data/lib/ea/qea/verification/element_comparator.rb +27 -31
- data/lib/ea/qea/verification/structure_matcher.rb +10 -10
- data/lib/ea/qea.rb +5 -7
- data/lib/ea/query/builder.rb +3 -3
- data/lib/ea/render/image_converter.rb +5 -3
- data/lib/ea/shapescript/parser.rb +4 -4
- data/lib/ea/sources/qea/classifier_builder.rb +7 -3
- data/lib/ea/sources/qea/context_diagram_support.rb +2 -2
- data/lib/ea/sources/qea/diagram_builder/routing.rb +4 -4
- data/lib/ea/sources/qea/diagram_builder.rb +80 -51
- data/lib/ea/sources/qea/id_normalizer.rb +0 -1
- data/lib/ea/sources/qea/instance_builder.rb +2 -2
- data/lib/ea/sources/qea/legend_builder.rb +1 -1
- data/lib/ea/sources/qea/note_builder.rb +4 -4
- data/lib/ea/sources/xmi/diagram_builder/stereotype_profiles.rb +1 -1
- data/lib/ea/sources/xmi/extension_style_parser.rb +2 -2
- data/lib/ea/sources/xmi/property_builder.rb +10 -2
- data/lib/ea/sources/xmi/relationship_builder.rb +10 -2
- data/lib/ea/sources/xmi/relationship_type_map.rb +1 -1
- data/lib/ea/sources/xmi/tag_builder.rb +1 -1
- data/lib/ea/sources/xmi/type_classifier_map.rb +1 -1
- data/lib/ea/spa/configuration.rb +2 -4
- data/lib/ea/spa/generator.rb +3 -3
- data/lib/ea/spa/output/strategy.rb +7 -5
- data/lib/ea/spa/projector.rb +21 -17
- data/lib/ea/svg/connector_router.rb +5 -3
- data/lib/ea/svg/ea_emitter/background.rb +0 -1
- data/lib/ea/svg/ea_emitter/bounds_calculator.rb +8 -10
- data/lib/ea/svg/ea_emitter/canvas.rb +1 -1
- data/lib/ea/svg/ea_emitter/color_resolver.rb +1 -1
- data/lib/ea/svg/ea_emitter/compartment/note_body.rb +1 -1
- data/lib/ea/svg/ea_emitter/connector_redock.rb +6 -3
- data/lib/ea/svg/ea_emitter/diagram_frame.rb +2 -2
- data/lib/ea/svg/ea_emitter/document.rb +1 -1
- data/lib/ea/svg/ea_emitter/element/attribute_renderer.rb +2 -4
- data/lib/ea/svg/ea_emitter/element/compartment_geometry.rb +18 -14
- data/lib/ea/svg/ea_emitter/element/header_line_pipeline.rb +6 -5
- data/lib/ea/svg/ea_emitter/element/header_line_provider/name.rb +1 -3
- data/lib/ea/svg/ea_emitter/element/header_line_provider/stereotype_label.rb +1 -1
- data/lib/ea/svg/ea_emitter/element/icon_renderer.rb +1 -1
- data/lib/ea/svg/ea_emitter/element/legend_renderer.rb +1 -1
- data/lib/ea/svg/ea_emitter/element/note_shape_renderer.rb +5 -5
- data/lib/ea/svg/ea_emitter/element/operation_renderer.rb +2 -3
- data/lib/ea/svg/ea_emitter/element/package_shape_renderer.rb +3 -4
- data/lib/ea/svg/ea_emitter/element/stereotype_icon_renderer.rb +1 -1
- data/lib/ea/svg/ea_emitter/elements.rb +64 -63
- data/lib/ea/svg/ea_emitter/ghost_labels.rb +0 -1
- data/lib/ea/svg/ea_emitter/label/end_label.rb +7 -7
- data/lib/ea/svg/ea_emitter/labels.rb +1 -1
- data/lib/ea/svg/ea_emitter/layer_sequencer.rb +5 -5
- data/lib/ea/svg/ea_emitter/marker/arrow_path.rb +4 -2
- data/lib/ea/svg/ea_emitter/marker/open_triangle.rb +4 -4
- data/lib/ea/svg/ea_emitter/markers.rb +3 -1
- data/lib/ea/svg/ea_emitter/render_context.rb +1 -1
- data/lib/ea/svg/ea_emitter/text_renderer.rb +15 -4
- data/lib/ea/theme/definition.rb +17 -17
- data/lib/ea/transformers/qea_to_xmi/context.rb +1 -1
- data/lib/ea/transformers/qea_to_xmi/run_state.rb +1 -1
- data/lib/ea/transformers/qea_to_xmi/transformer.rb +44 -44
- data/lib/ea/transformers/qea_to_xmi/visibility.rb +3 -3
- data/lib/ea/version.rb +1 -1
- data/lib/ea/xmi/liquid_drops/connector_drop.rb +2 -2
- data/lib/ea/xmi/liquid_drops/enum_drop.rb +4 -4
- data/lib/ea/xmi/liquid_drops/generalization_attribute_drop.rb +2 -8
- data/lib/ea/xmi/liquid_drops/generalization_drop.rb +3 -3
- data/lib/ea/xmi/liquid_drops/package_drop.rb +9 -9
- data/lib/ea/xmi/liquid_drops/root_drop.rb +1 -1
- data/lib/ea/xmi/loader.rb +5 -11
- data/lib/ea/xmi/lookup_service.rb +3 -3
- data/lib/ea/xmi/parser.rb +75 -81
- data/lib/ea/xmi/slicer.rb +16 -12
- data/lib/ea/xref_format/legend_definition.rb +31 -0
- data/lib/ea/xref_format/parser.rb +146 -0
- data/lib/ea/xref_format/property_definition.rb +25 -0
- data/lib/ea/xref_format/record.rb +37 -0
- data/lib/ea/xref_format/stereotype_application.rb +33 -0
- data/lib/ea/xref_format.rb +36 -0
- data/lib/ea.rb +1 -0
- metadata +26 -25
- data/lib/ea/sources/qea/xref/legend_definition.rb +0 -35
- data/lib/ea/sources/qea/xref/parser.rb +0 -150
- data/lib/ea/sources/qea/xref/property_definition.rb +0 -29
- data/lib/ea/sources/qea/xref/record.rb +0 -41
- data/lib/ea/sources/qea/xref/stereotype_application.rb +0 -37
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "set"
|
|
4
|
-
|
|
5
3
|
module Ea
|
|
6
4
|
module Sources
|
|
7
5
|
module Qea
|
|
@@ -185,7 +183,7 @@ module Ea
|
|
|
185
183
|
end
|
|
186
184
|
|
|
187
185
|
def truthy?(raw)
|
|
188
|
-
|
|
186
|
+
["1", "-1"].include?(raw)
|
|
189
187
|
end
|
|
190
188
|
|
|
191
189
|
def stereotype_fqname_for(placement)
|
|
@@ -193,7 +191,7 @@ module Ea
|
|
|
193
191
|
return nil unless object
|
|
194
192
|
|
|
195
193
|
database.xrefs_for_client(object.ea_guid).each do |xref|
|
|
196
|
-
application =
|
|
194
|
+
application = Ea::XrefFormat::Parser.parse(xref.description).stereotype
|
|
197
195
|
next unless application && application.name == object.stereotype
|
|
198
196
|
|
|
199
197
|
return application.fqname
|
|
@@ -375,9 +373,9 @@ module Ea
|
|
|
375
373
|
|
|
376
374
|
def build_phantom_connector(conn, diagram_row, idx)
|
|
377
375
|
source_placement = diagram_object_placement(diagram_row.diagram_id,
|
|
378
|
-
|
|
376
|
+
conn.start_object_id)
|
|
379
377
|
target_placement = diagram_object_placement(diagram_row.diagram_id,
|
|
380
|
-
|
|
378
|
+
conn.end_object_id)
|
|
381
379
|
return nil unless source_placement && target_placement
|
|
382
380
|
|
|
383
381
|
source_bounds = bounds_from_rect(source_placement)
|
|
@@ -429,11 +427,19 @@ module Ea
|
|
|
429
427
|
|
|
430
428
|
if dx.abs * bounds.height > dy.abs * bounds.width
|
|
431
429
|
x = dx > 0 ? bounds.x + bounds.width : bounds.x
|
|
432
|
-
y =
|
|
430
|
+
y = begin
|
|
431
|
+
cy + dy * (x - cx).abs / dx.abs
|
|
432
|
+
rescue StandardError
|
|
433
|
+
cy
|
|
434
|
+
end
|
|
433
435
|
[x, y]
|
|
434
436
|
else
|
|
435
437
|
y = dy > 0 ? bounds.y + bounds.height : bounds.y
|
|
436
|
-
x =
|
|
438
|
+
x = begin
|
|
439
|
+
cx + dx * (y - cy).abs / dy.abs
|
|
440
|
+
rescue StandardError
|
|
441
|
+
cx
|
|
442
|
+
end
|
|
437
443
|
[x, y]
|
|
438
444
|
end
|
|
439
445
|
end
|
|
@@ -462,34 +468,42 @@ module Ea
|
|
|
462
468
|
context = ContextDiagramSupport.package_context(diagram_row) ||
|
|
463
469
|
ContextDiagramSupport.element_regenerate?(diagram_row)
|
|
464
470
|
model = collapse_computed_jog(Ea::Model::DiagramConnector.new(
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
471
|
+
id: IdNormalizer.synthetic("dc", diagram_row.diagram_id,
|
|
472
|
+
link_row.instance_id),
|
|
473
|
+
diagram_id: IdNormalizer.from_guid(diagram_row.ea_guid),
|
|
474
|
+
relationship_ref: ref_for_connector(link_row),
|
|
475
|
+
source_element_ref: unique_placement_ref(diagram_row.diagram_id,
|
|
476
|
+
connector&.start_object_id),
|
|
477
|
+
target_element_ref: unique_placement_ref(diagram_row.diagram_id,
|
|
478
|
+
connector&.end_object_id),
|
|
479
|
+
paint_order: paint_order_for(diagram_row.diagram_id, connector),
|
|
480
|
+
connector_type: connector&.connector_type,
|
|
481
|
+
direction: connector&.direction,
|
|
482
|
+
source_stereotype: connector&.sourcestereotype,
|
|
483
|
+
target_stereotype: connector&.deststereotype,
|
|
484
|
+
waypoints: if context
|
|
485
|
+
context_waypoints_for(connector, diagram_row)
|
|
486
|
+
else
|
|
487
|
+
waypoints_for_link(link_row, diagram_row)
|
|
488
|
+
end,
|
|
489
|
+
source_anchor: port_anchor_for(connector, diagram_row,
|
|
490
|
+
geom, :source),
|
|
491
|
+
target_anchor: port_anchor_for(connector, diagram_row,
|
|
492
|
+
geom, :target),
|
|
493
|
+
source_port: connection_port(diagram_row, connector, :source, geom),
|
|
494
|
+
target_port: connection_port(diagram_row, connector, :target, geom),
|
|
495
|
+
label_boxes: context ? {} : (geom[:label_boxes] || {}),
|
|
496
|
+
style: if context
|
|
497
|
+
{ direct: true }
|
|
498
|
+
else
|
|
499
|
+
DiagramStyleParser.parse(link_row.style)
|
|
500
|
+
end,
|
|
501
|
+
hidden: hidden?(link_row),
|
|
502
|
+
line_width: connector&.isbold,
|
|
503
|
+
ghost_labels: ghost_labels_for(connector, diagram_row, link_row),
|
|
504
|
+
has_geometry_offsets: geometry_has_offsets?(link_row.geometry),
|
|
505
|
+
is_substitutable: substitutable_connector?(connector)
|
|
506
|
+
), link_row, diagram_row, geom)
|
|
493
507
|
mark_plain_source_seat(model, link_row, context)
|
|
494
508
|
mark_plain_target_seat(model, link_row, context)
|
|
495
509
|
model = collapse_partial_port_jog(model, link_row, diagram_row)
|
|
@@ -517,8 +531,11 @@ module Ea
|
|
|
517
531
|
def port_anchor_for(connector, diagram_row, geom, end_kind)
|
|
518
532
|
return nil unless connector
|
|
519
533
|
|
|
520
|
-
object_id = end_kind == :source
|
|
521
|
-
|
|
534
|
+
object_id = if end_kind == :source
|
|
535
|
+
connector.start_object_id
|
|
536
|
+
else
|
|
537
|
+
connector.end_object_id
|
|
538
|
+
end
|
|
522
539
|
placement = diagram_object_placement(diagram_row.diagram_id,
|
|
523
540
|
object_id)
|
|
524
541
|
return nil unless placement
|
|
@@ -640,7 +657,7 @@ module Ea
|
|
|
640
657
|
# Ghost label anchors at the on-canvas end of the connector.
|
|
641
658
|
# When the source is off-canvas, anchor at the target's
|
|
642
659
|
# first waypoint; vice versa for target off-canvas.
|
|
643
|
-
def ghost_anchor(end_kind, connector,
|
|
660
|
+
def ghost_anchor(end_kind, connector, _link_row, diagram_row)
|
|
644
661
|
placement = if end_kind == :source
|
|
645
662
|
target_placement_for(connector, diagram_row)
|
|
646
663
|
else
|
|
@@ -686,9 +703,9 @@ module Ea
|
|
|
686
703
|
return [] unless connector
|
|
687
704
|
|
|
688
705
|
source_placement = diagram_object_placement(diagram_row.diagram_id,
|
|
689
|
-
|
|
706
|
+
connector.start_object_id)
|
|
690
707
|
target_placement = diagram_object_placement(diagram_row.diagram_id,
|
|
691
|
-
|
|
708
|
+
connector.end_object_id)
|
|
692
709
|
return [] unless source_placement && target_placement
|
|
693
710
|
|
|
694
711
|
geom = parse_geometry_fields(link_row.geometry)
|
|
@@ -698,10 +715,16 @@ module Ea
|
|
|
698
715
|
target_port = connection_port(diagram_row, connector, :target, geom)
|
|
699
716
|
# Waypoint points flow through this method as [x, y] arrays;
|
|
700
717
|
# keep the ports in the same shape.
|
|
701
|
-
source_point =
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
718
|
+
source_point = if source_port
|
|
719
|
+
[source_port.x, source_port.y]
|
|
720
|
+
else
|
|
721
|
+
element_edge_point(source_placement, :source, edge_out)
|
|
722
|
+
end
|
|
723
|
+
target_point = if target_port
|
|
724
|
+
[target_port.x, target_port.y]
|
|
725
|
+
else
|
|
726
|
+
element_edge_point(target_placement, :target, edge_out)
|
|
727
|
+
end
|
|
705
728
|
|
|
706
729
|
intermediate = intermediate_waypoints(link_row)
|
|
707
730
|
if DiagramStyleParser.parse(link_row.style)[:mode] == "1"
|
|
@@ -774,9 +797,7 @@ module Ea
|
|
|
774
797
|
end
|
|
775
798
|
end
|
|
776
799
|
|
|
777
|
-
if intermediate.any? && !tree_route
|
|
778
|
-
points = level_entry_route(points, link_row, connector, src, tgt)
|
|
779
|
-
end
|
|
800
|
+
points = level_entry_route(points, link_row, connector, src, tgt) if intermediate.any? && !tree_route
|
|
780
801
|
points = drop_zero_length_tree_segments(points, link_row)
|
|
781
802
|
points.map do |x, y|
|
|
782
803
|
Ea::Model::Waypoint.new(position: Ea::Model::Point.new(x: x, y: y))
|
|
@@ -830,8 +851,16 @@ module Ea
|
|
|
830
851
|
dy = -y_off.to_f
|
|
831
852
|
return nil if dx.zero? && dy.zero?
|
|
832
853
|
|
|
833
|
-
tx = dx.zero?
|
|
834
|
-
|
|
854
|
+
tx = if dx.zero?
|
|
855
|
+
Float::INFINITY
|
|
856
|
+
else
|
|
857
|
+
(dx > 0 ? b.x + b.width - center_x : b.x - center_x) / dx
|
|
858
|
+
end
|
|
859
|
+
ty = if dy.zero?
|
|
860
|
+
Float::INFINITY
|
|
861
|
+
else
|
|
862
|
+
(dy > 0 ? b.y + b.height - center_y : b.y - center_y) / dy
|
|
863
|
+
end
|
|
835
864
|
t = [tx, ty].min
|
|
836
865
|
Ea::Model::Point.new(x: (center_x + t * dx).round, y: (center_y + t * dy).round)
|
|
837
866
|
end
|
|
@@ -989,7 +1018,7 @@ module Ea
|
|
|
989
1018
|
end
|
|
990
1019
|
end
|
|
991
1020
|
|
|
992
|
-
def effective_edge(edge_code,
|
|
1021
|
+
def effective_edge(edge_code, _end_kind)
|
|
993
1022
|
mapping = {
|
|
994
1023
|
1 => :top, 2 => :right, 3 => :bottom, 4 => :left,
|
|
995
1024
|
5 => :top, 6 => :right, 7 => :bottom, 8 => :left
|
|
@@ -17,7 +17,7 @@ module Ea
|
|
|
17
17
|
(?:Value=(?<value>[^;]*);)?
|
|
18
18
|
(?:Op=(?<op>[^;]*);)?
|
|
19
19
|
@ENDVAR;
|
|
20
|
-
/x
|
|
20
|
+
/x
|
|
21
21
|
|
|
22
22
|
attr_reader :database
|
|
23
23
|
|
|
@@ -43,7 +43,7 @@ module Ea
|
|
|
43
43
|
qualified_name: qualified_name_for(row),
|
|
44
44
|
slots: slots_for(row),
|
|
45
45
|
annotations: AnnotationBuilder.from_note(row.note, row.ea_guid,
|
|
46
|
-
|
|
46
|
+
kind: "documentation")
|
|
47
47
|
)
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -13,9 +13,9 @@ module Ea
|
|
|
13
13
|
# their configuration is parsed from t_xref and attached as
|
|
14
14
|
# an `Ea::Model::Legend` payload on the Note.
|
|
15
15
|
class NoteBuilder
|
|
16
|
-
NOTE_OBJECT_TYPE = "Note"
|
|
17
|
-
TEXT_OBJECT_TYPE = "Text"
|
|
18
|
-
LEGEND_STYLEEX_TOKEN = "LegendOpts="
|
|
16
|
+
NOTE_OBJECT_TYPE = "Note"
|
|
17
|
+
TEXT_OBJECT_TYPE = "Text"
|
|
18
|
+
LEGEND_STYLEEX_TOKEN = "LegendOpts="
|
|
19
19
|
|
|
20
20
|
attr_reader :database
|
|
21
21
|
|
|
@@ -49,7 +49,7 @@ module Ea
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def note_type?(object_type)
|
|
52
|
-
|
|
52
|
+
[NOTE_OBJECT_TYPE, TEXT_OBJECT_TYPE].include?(object_type)
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def legend_for(obj)
|
|
@@ -24,7 +24,7 @@ module Ea
|
|
|
24
24
|
def matching_profile(value, name)
|
|
25
25
|
value.split("@STEREO;").drop(1).each do |block|
|
|
26
26
|
description = "@STEREO;#{block.partition("@ENDSTEREO;").first}@ENDSTEREO;"
|
|
27
|
-
application =
|
|
27
|
+
application = Ea::XrefFormat::Parser.parse(description).stereotype
|
|
28
28
|
return application.fqname if application.name == name
|
|
29
29
|
end
|
|
30
30
|
nil
|
|
@@ -40,7 +40,7 @@ module Ea
|
|
|
40
40
|
# as hidden in practice).
|
|
41
41
|
def tri_state_icon(value)
|
|
42
42
|
return nil if value.nil? || value.empty?
|
|
43
|
-
return :hidden if
|
|
43
|
+
return :hidden if ["1", "true", "-1"].include?(value)
|
|
44
44
|
return :shown if value == "0"
|
|
45
45
|
|
|
46
46
|
nil
|
|
@@ -64,7 +64,7 @@ module Ea
|
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
def truthy?(value)
|
|
67
|
-
|
|
67
|
+
["1", "true", "-1"].include?(value)
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
# fontsz is EA's tenths of a point, rendered through GDI's double
|
|
@@ -57,7 +57,11 @@ module Ea
|
|
|
57
57
|
value = attr.lower_value
|
|
58
58
|
return 1 unless value
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
begin
|
|
61
|
+
Integer(value.value)
|
|
62
|
+
rescue StandardError
|
|
63
|
+
1
|
|
64
|
+
end
|
|
61
65
|
end
|
|
62
66
|
|
|
63
67
|
def parse_upper(attr)
|
|
@@ -67,7 +71,11 @@ module Ea
|
|
|
67
71
|
raw = value.value
|
|
68
72
|
return -1 if raw.to_s == "*"
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
begin
|
|
75
|
+
Integer(raw)
|
|
76
|
+
rescue StandardError
|
|
77
|
+
1
|
|
78
|
+
end
|
|
71
79
|
end
|
|
72
80
|
|
|
73
81
|
def default_value_for(attr)
|
|
@@ -240,7 +240,11 @@ module Ea
|
|
|
240
240
|
value = end_element.lower_value
|
|
241
241
|
return 1 unless value
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
begin
|
|
244
|
+
Integer(value.value)
|
|
245
|
+
rescue StandardError
|
|
246
|
+
1
|
|
247
|
+
end
|
|
244
248
|
end
|
|
245
249
|
|
|
246
250
|
def parse_upper(end_element)
|
|
@@ -252,7 +256,11 @@ module Ea
|
|
|
252
256
|
raw = value.value
|
|
253
257
|
return -1 if raw.to_s == "*"
|
|
254
258
|
|
|
255
|
-
|
|
259
|
+
begin
|
|
260
|
+
Integer(raw)
|
|
261
|
+
rescue StandardError
|
|
262
|
+
1
|
|
263
|
+
end
|
|
256
264
|
end
|
|
257
265
|
|
|
258
266
|
def connector_index
|
|
@@ -15,7 +15,7 @@ module Ea
|
|
|
15
15
|
"uml:Realization" => "Ea::Model::Realization",
|
|
16
16
|
"uml:Dependency" => "Ea::Model::Dependency",
|
|
17
17
|
"uml:Usage" => "Ea::Model::Dependency",
|
|
18
|
-
"uml:Abstraction" => "Ea::Model::Dependency"
|
|
18
|
+
"uml:Abstraction" => "Ea::Model::Dependency"
|
|
19
19
|
}.freeze
|
|
20
20
|
|
|
21
21
|
def class_for(xmi_type)
|
|
@@ -27,7 +27,7 @@ module Ea
|
|
|
27
27
|
# blocks within <xmi:Extension>. The element itself is in
|
|
28
28
|
# no XML namespace; match by local-name to be safe.
|
|
29
29
|
doc.xpath(%(//*[local-name()="tags"]/*[local-name()="tag"]))
|
|
30
|
-
|
|
30
|
+
.each_with_object({}) do |node, acc|
|
|
31
31
|
me = node["modelElement"]
|
|
32
32
|
next unless me
|
|
33
33
|
|
|
@@ -15,7 +15,7 @@ module Ea
|
|
|
15
15
|
"uml:PrimitiveType" => "Ea::Model::PrimitiveType",
|
|
16
16
|
"uml:Enumeration" => "Ea::Model::Enumeration",
|
|
17
17
|
"uml:Interface" => "Ea::Model::Interface",
|
|
18
|
-
"uml:Signal" => "Ea::Model::Signal"
|
|
18
|
+
"uml:Signal" => "Ea::Model::Signal"
|
|
19
19
|
}.freeze
|
|
20
20
|
|
|
21
21
|
def class_for(xmi_type)
|
data/lib/ea/spa/configuration.rb
CHANGED
|
@@ -27,9 +27,7 @@ module Ea
|
|
|
27
27
|
|
|
28
28
|
def self.load(path)
|
|
29
29
|
return nil if path.nil? || path.empty?
|
|
30
|
-
unless File.exist?(path)
|
|
31
|
-
raise ArgumentError, "SPA config not found: #{path}"
|
|
32
|
-
end
|
|
30
|
+
raise ArgumentError, "SPA config not found: #{path}" unless File.exist?(path)
|
|
33
31
|
|
|
34
32
|
new(path, YAML.safe_load(File.read(path)) || {})
|
|
35
33
|
end
|
|
@@ -68,7 +66,7 @@ module Ea
|
|
|
68
66
|
return model_metadata unless model_metadata
|
|
69
67
|
|
|
70
68
|
merged = model_metadata_to_hash(model_metadata)
|
|
71
|
-
|
|
69
|
+
.merge(stringify_keys(metadata_override))
|
|
72
70
|
hash_to_metadata(merged)
|
|
73
71
|
end
|
|
74
72
|
|
data/lib/ea/spa/generator.rb
CHANGED
|
@@ -32,9 +32,9 @@ module Ea
|
|
|
32
32
|
|
|
33
33
|
def projector
|
|
34
34
|
@projector ||= Projector.new(document,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
shard_url_for: shard_url_for,
|
|
36
|
+
configuration: configuration,
|
|
37
|
+
frame: @frame)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def strategy_class
|
|
@@ -42,20 +42,22 @@ module Ea
|
|
|
42
42
|
# source checkout before `npm run build`).
|
|
43
43
|
def frontend_app_js
|
|
44
44
|
return nil unless File.exist?(FRONTEND_APP_JS)
|
|
45
|
+
|
|
45
46
|
File.read(FRONTEND_APP_JS)
|
|
46
47
|
end
|
|
47
48
|
|
|
48
49
|
def frontend_style_css
|
|
49
50
|
return nil unless File.exist?(FRONTEND_STYLE_CSS)
|
|
51
|
+
|
|
50
52
|
File.read(FRONTEND_STYLE_CSS)
|
|
51
53
|
end
|
|
52
54
|
|
|
53
55
|
def assert_frontend_bundle!
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
return if File.exist?(FRONTEND_APP_JS) && File.exist?(FRONTEND_STYLE_CSS)
|
|
57
|
+
|
|
58
|
+
raise Ea::Error,
|
|
59
|
+
"SPA frontend bundle not found under #{FRONTEND_DIST_DIR}. " \
|
|
60
|
+
"Run `cd frontend && npm install && npm run build`."
|
|
59
61
|
end
|
|
60
62
|
|
|
61
63
|
private
|
data/lib/ea/spa/projector.rb
CHANGED
|
@@ -143,16 +143,20 @@ module Ea
|
|
|
143
143
|
shard_url: shard_url_for.call(p)
|
|
144
144
|
)
|
|
145
145
|
end
|
|
146
|
-
diagram_entries = render_diagrams?
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
146
|
+
diagram_entries = if render_diagrams?
|
|
147
|
+
document.diagrams.map do |d|
|
|
148
|
+
SkeletonEntry.new(
|
|
149
|
+
id: d.id,
|
|
150
|
+
name: d.name,
|
|
151
|
+
kind: "diagram",
|
|
152
|
+
package_id: d.package_id,
|
|
153
|
+
qualified_name: d.name,
|
|
154
|
+
shard_url: shard_url_for.call(d)
|
|
155
|
+
)
|
|
156
|
+
end
|
|
157
|
+
else
|
|
158
|
+
[]
|
|
159
|
+
end
|
|
156
160
|
classifier_entries + package_entries + diagram_entries
|
|
157
161
|
end
|
|
158
162
|
|
|
@@ -263,14 +267,14 @@ module Ea
|
|
|
263
267
|
def augment_classifier_payload!(payload, classifier)
|
|
264
268
|
rels = document.relationships_for(classifier.id)
|
|
265
269
|
payload["generalizations"] = rels
|
|
266
|
-
|
|
267
|
-
|
|
270
|
+
.select { |r| r.is_a?(Ea::Model::Generalization) && r.specific_id == classifier.id }
|
|
271
|
+
.map { |r| { "id" => r.id, "targetId" => r.general_id } }
|
|
268
272
|
payload["specializations"] = rels
|
|
269
|
-
|
|
270
|
-
|
|
273
|
+
.select { |r| r.is_a?(Ea::Model::Generalization) && r.general_id == classifier.id }
|
|
274
|
+
.map { |r| { "id" => r.id, "targetId" => r.specific_id } }
|
|
271
275
|
payload["associations"] = rels
|
|
272
|
-
|
|
273
|
-
|
|
276
|
+
.select { |r| r.is_a?(Ea::Model::Association) }
|
|
277
|
+
.map { |r| association_stub(r, classifier.id) }
|
|
274
278
|
payload
|
|
275
279
|
end
|
|
276
280
|
|
|
@@ -317,4 +321,4 @@ module Ea
|
|
|
317
321
|
end
|
|
318
322
|
end
|
|
319
323
|
end
|
|
320
|
-
end
|
|
324
|
+
end
|
|
@@ -44,6 +44,7 @@ module Ea
|
|
|
44
44
|
|
|
45
45
|
def source_point
|
|
46
46
|
return nil unless source_bounds
|
|
47
|
+
|
|
47
48
|
pt = if @edge_code && @edge_code != 0
|
|
48
49
|
edge_point(source_bounds, @edge_code)
|
|
49
50
|
else
|
|
@@ -56,6 +57,7 @@ module Ea
|
|
|
56
57
|
|
|
57
58
|
def target_point
|
|
58
59
|
return nil unless target_bounds
|
|
60
|
+
|
|
59
61
|
pt = if @edge_code && @edge_code != 0
|
|
60
62
|
opposite_edge_point(source_bounds, target_bounds, @edge_code)
|
|
61
63
|
else
|
|
@@ -78,17 +80,17 @@ module Ea
|
|
|
78
80
|
when 2 then [bounds.x + bounds.width, center_y(bounds)]
|
|
79
81
|
when 3 then [center_x(bounds), bounds.y + bounds.height]
|
|
80
82
|
when 4 then [bounds.x, center_y(bounds)]
|
|
81
|
-
else
|
|
83
|
+
else [center_x(bounds), center_y(bounds)]
|
|
82
84
|
end
|
|
83
85
|
end
|
|
84
86
|
|
|
85
|
-
def opposite_edge_point(
|
|
87
|
+
def opposite_edge_point(_source, target, code)
|
|
86
88
|
case code
|
|
87
89
|
when 1 then [center_x(target), target.y + target.height]
|
|
88
90
|
when 2 then [target.x, center_y(target)]
|
|
89
91
|
when 3 then [center_x(target), target.y]
|
|
90
92
|
when 4 then [target.x + target.width, center_y(target)]
|
|
91
|
-
else
|
|
93
|
+
else [center_x(target), center_y(target)]
|
|
92
94
|
end
|
|
93
95
|
end
|
|
94
96
|
|
|
@@ -31,8 +31,6 @@ module Ea
|
|
|
31
31
|
INSET_TOP = 40
|
|
32
32
|
INSET_BOTTOM = 36
|
|
33
33
|
|
|
34
|
-
attr_reader :diagram, :model_index
|
|
35
|
-
|
|
36
34
|
# Where the leftmost model x lands: 30 + min_x capped at 35. A
|
|
37
35
|
# negative min_x keeps the 30 of min_x 0 (the corpus has none),
|
|
38
36
|
# so content left of the origin is not drawn off the canvas.
|
|
@@ -45,7 +43,7 @@ module Ea
|
|
|
45
43
|
@model_index = model_index
|
|
46
44
|
end
|
|
47
45
|
|
|
48
|
-
attr_reader :effective_inset_left, :max_x, :max_y
|
|
46
|
+
attr_reader :diagram, :model_index, :effective_inset_left, :max_x, :max_y
|
|
49
47
|
|
|
50
48
|
def compute
|
|
51
49
|
points = element_points
|
|
@@ -78,7 +76,7 @@ module Ea
|
|
|
78
76
|
next unless subtitle_extends_below?(e)
|
|
79
77
|
|
|
80
78
|
pts << [primary.x, primary.y + primary.height +
|
|
81
|
-
|
|
79
|
+
SUBTITLE_CANVAS_EXTRA]
|
|
82
80
|
end
|
|
83
81
|
pts
|
|
84
82
|
end
|
|
@@ -105,14 +103,14 @@ module Ea
|
|
|
105
103
|
pts << [primary.x + primary.width, primary.y + primary.height]
|
|
106
104
|
if subtitle_extends_below?(e)
|
|
107
105
|
pts << [primary.x, primary.y + primary.height +
|
|
108
|
-
|
|
106
|
+
SUBTITLE_CANVAS_EXTRA]
|
|
109
107
|
end
|
|
110
108
|
end
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
next unless e.bounds && e.image_bounds
|
|
110
|
+
|
|
111
|
+
ib = e.image_bounds
|
|
112
|
+
pts << [ib.x, ib.y]
|
|
113
|
+
pts << [ib.x + ib.width, ib.y + ib.height]
|
|
116
114
|
end
|
|
117
115
|
pts
|
|
118
116
|
end
|
|
@@ -39,7 +39,7 @@ module Ea
|
|
|
39
39
|
# empty source line adds one blank pitch row.
|
|
40
40
|
usable = context.bounds.width - 4
|
|
41
41
|
size = context.size
|
|
42
|
-
|
|
42
|
+
context.family
|
|
43
43
|
pitch, first_offset = vertical_layout(context)
|
|
44
44
|
y_index = 0
|
|
45
45
|
paragraphs = NoteHtml.paragraphs(body)
|
|
@@ -459,9 +459,12 @@ module Ea
|
|
|
459
459
|
# Interior rays use the nearest forward exit. External saved sources
|
|
460
460
|
# can request the first intersecting edge in clockwise perimeter order.
|
|
461
461
|
def anchor_exit(anchor, bounds, other, perimeter: false)
|
|
462
|
-
ax
|
|
463
|
-
|
|
464
|
-
|
|
462
|
+
ax = anchor.x.to_f
|
|
463
|
+
ay = anchor.y.to_f
|
|
464
|
+
ox = other.x.to_f
|
|
465
|
+
oy = other.y.to_f
|
|
466
|
+
dx = ox - ax
|
|
467
|
+
dy = oy - ay
|
|
465
468
|
candidates = []
|
|
466
469
|
if dx != 0
|
|
467
470
|
[bounds.x, bounds.x + bounds.width].each do |x|
|