Class: Ea::Svg::EaEmitter::Element::RowIconRenderer
- Inherits:
-
Object
- Object
- Ea::Svg::EaEmitter::Element::RowIconRenderer
- Defined in:
- lib/ea/svg/ea_emitter/element/row_icon_renderer.rb
Overview
Emits the small per-row icon EA draws next to each entry in a package-contents body (or a classifier's attribute row when ShowIcons is on). The icon's silhouette encodes the child's classifier type:
* Enumeration: a 12x13 green rect with a list-style glyph
(single rect + seven paths).
* Sub-Package: a small 13x9 folder rect (no extra paths).
* Other Classifier kinds (Klass/DataType/Primitive/etc.):
an 11x14 "folded paper" silhouette with white top + a
midline + four text-rule lines (two rects + seven paths).
The renderer returns the SVG body as a String. The caller
wraps it in the appropriate parent <g>.
Constant Summary collapse
- OUTER_FILL =
"#FEFAF5"- INNER_FILL =
"#FFFFFF"- ENUMERATION_FILL =
"#E6FFE1"- PACKAGE_FILL =
"#FEFAF5"- STROKE =
"#577AC1"- RED_STROKE =
"#EF8585"- GRAY_STROKE =
"#4D4D4D"- ENUM_RED_STROKE =
"#7D0000"- WIDTH =
11- HEIGHT =
14- INNER_HEIGHT =
4- ENUM_WIDTH =
12- ENUM_HEIGHT =
13- PACKAGE_WIDTH =
13- PACKAGE_HEIGHT =
9- DEFAULT_PATHS =
Default icon path specs: each entry is [x1, y1, x2, y2, stroke]. Coordinates are relative to the icon's top-left corner.
[ [0, 7, 10, 7, STROKE], [2, 5, 6, 5, RED_STROKE], [8, 5, 9, 5, RED_STROKE], [2, 9, 6, 9, GRAY_STROKE], [8, 9, 9, 9, GRAY_STROKE], [2, 11, 6, 11, GRAY_STROKE], [8, 11, 9, 11, GRAY_STROKE] ].freeze
- ENUM_PATHS =
Enumeration icon path specs. First entry is the red path drawn as a closed "L" shape; the rest are horizontal lines.
[ [:curve, 5, 2, 2, 2, 2, 6, 5, 6, ENUM_RED_STROKE], [:line, 2, 4, 4, 4, ENUM_RED_STROKE], [:line, 7, 2, 9, 2, STROKE], [:line, 7, 4, 9, 4, STROKE], [:line, 7, 6, 9, 6, STROKE], [:line, 0, 8, 11, 8, STROKE], [:line, 2, 10, 9, 10, STROKE] ].freeze
Class Method Summary collapse
-
.render(x_pos:, y_pos:, kind: :default) ⇒ Object
Returns the SVG body String for the icon at (x_pos, y_pos).
Class Method Details
.render(x_pos:, y_pos:, kind: :default) ⇒ Object
Returns the SVG body String for the icon at (x_pos, y_pos).
kind is one of :enumeration, :package, or :default.
65 66 67 68 69 70 71 |
# File 'lib/ea/svg/ea_emitter/element/row_icon_renderer.rb', line 65 def self.render(x_pos:, y_pos:, kind: :default) case kind when :enumeration then enumeration_icon(x_pos, y_pos) when :package then package_icon(x_pos, y_pos) else default_icon(x_pos, y_pos) end end |