Class: ListStyle
- Inherits:
-
ColorStyle
- Object
- KMLObject
- ColorStyle
- ListStyle
- Defined in:
- lib/kamelopard/classes.rb
Overview
Corresponds to KML’s ListStyle object. Color is stored as an 8-character hex string, with two characters each of alpha, blue, green, and red values, in that order, matching the ordering the KML spec demands.
Instance Attribute Summary collapse
-
#bgcolor ⇒ Object
Returns the value of attribute bgcolor.
-
#href ⇒ Object
Returns the value of attribute href.
-
#listitemtype ⇒ Object
Returns the value of attribute listitemtype.
-
#state ⇒ Object
Returns the value of attribute state.
Attributes inherited from ColorStyle
Attributes inherited from KMLObject
Instance Method Summary collapse
-
#initialize(bgcolor = nil, state = nil, href = nil, listitemtype = nil) ⇒ ListStyle
constructor
A new instance of ListStyle.
- #to_kml(indent = 0) ⇒ Object
Methods inherited from ColorStyle
#alpha, #alpha=, #blue, #blue=, #green, #green=, #red, #red=, #validate_colormode
Constructor Details
#initialize(bgcolor = nil, state = nil, href = nil, listitemtype = nil) ⇒ ListStyle
Returns a new instance of ListStyle.
951 952 953 954 955 956 957 |
# File 'lib/kamelopard/classes.rb', line 951 def initialize(bgcolor = nil, state = nil, href = nil, listitemtype = nil) super(nil, :normal) @bgcolor = bgcolor @state = state @href = href @listitemtype = listitemtype end |
Instance Attribute Details
#bgcolor ⇒ Object
Returns the value of attribute bgcolor.
949 950 951 |
# File 'lib/kamelopard/classes.rb', line 949 def bgcolor @bgcolor end |
#href ⇒ Object
Returns the value of attribute href.
949 950 951 |
# File 'lib/kamelopard/classes.rb', line 949 def href @href end |
#listitemtype ⇒ Object
Returns the value of attribute listitemtype.
949 950 951 |
# File 'lib/kamelopard/classes.rb', line 949 def listitemtype @listitemtype end |
#state ⇒ Object
Returns the value of attribute state.
949 950 951 |
# File 'lib/kamelopard/classes.rb', line 949 def state @state end |
Instance Method Details
#to_kml(indent = 0) ⇒ Object
959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 |
# File 'lib/kamelopard/classes.rb', line 959 def to_kml(indent = 0) k = "#{ ' ' * indent }<ListStyle id=\"#{@id}\">\n" k << kml_array([ [@listitemtype, 'listItemType', true], [@bgcolor, 'bgColor', true] ], indent + 4) if (! @state.nil? or ! @href.nil?) then k << "#{ ' ' * indent } <ItemIcon>\n" k << "#{ ' ' * indent } <state>#{@state}</state>\n" unless @state.nil? k << "#{ ' ' * indent } <href>#{@href}</href>\n" unless @href.nil? k << "#{ ' ' * indent } </ItemIcon>\n" end k << "#{ ' ' * indent }</ListStyle>\n" k end |