Class: Ea::Sources::Qea::Xref::LegendDefinition
- Inherits:
-
Struct
- Object
- Struct
- Ea::Sources::Qea::Xref::LegendDefinition
- Defined in:
- lib/ea/sources/qea/xref/legend_definition.rb
Overview
Legend definition record. Produced when the Description contains
@PROP= blocks with @TYPE=LEGEND_*. EA encodes legend
entries as color/style rules keyed by name.
Example source:
@PROP=@NAME=GMLに定義されたクラス@ENDNAME;
@TYPE=LEGEND_OBJECTSTYLE@ENDTYPE;
@VALU=#Back_Ground_Color#=13434828;#Pen_Color#=0;
#Pen_Size#=1;#Legend_Type#=LEGEND_OBJECTSTYLE;
@ENDVALU;@PRMT=0@ENDPRMT;@ENDPROP;
Instance Attribute Summary collapse
-
#colors ⇒ Object
Returns the value of attribute colors.
-
#legend_type ⇒ Object
Returns the value of attribute legend_type.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parameter ⇒ Object
Returns the value of attribute parameter.
Instance Method Summary collapse
-
#hex_color(key) ⇒ String?
EA encodes colors as signed 32-bit integers (VB-style).
Instance Attribute Details
#colors ⇒ Object
Returns the value of attribute colors
17 18 19 |
# File 'lib/ea/sources/qea/xref/legend_definition.rb', line 17 def colors @colors end |
#legend_type ⇒ Object
Returns the value of attribute legend_type
17 18 19 |
# File 'lib/ea/sources/qea/xref/legend_definition.rb', line 17 def legend_type @legend_type end |
#name ⇒ Object
Returns the value of attribute name
17 18 19 |
# File 'lib/ea/sources/qea/xref/legend_definition.rb', line 17 def name @name end |
#parameter ⇒ Object
Returns the value of attribute parameter
17 18 19 |
# File 'lib/ea/sources/qea/xref/legend_definition.rb', line 17 def parameter @parameter end |
Instance Method Details
#hex_color(key) ⇒ String?
EA encodes colors as signed 32-bit integers (VB-style).
Convert to #RRGGBB hex string for SVG consumption.
23 24 25 26 27 28 29 30 |
# File 'lib/ea/sources/qea/xref/legend_definition.rb', line 23 def hex_color(key) value = colors&.dig(key) return nil if value.nil? int = value.to_i int = (int + 2**32) % 2**32 if int.negative? format("#%06X", int & 0xFFFFFF) end |