Class: Kamelopard::ListStyle

Inherits:
Object
  • Object
show all
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. – This doesn’t descend from ColorStyle because I don’t want the to_kml() call to super() adding color and colorMode elements to the KML – Google Earth complains about ‘em ++

Instance Attribute Summary collapse

Attributes inherited from Object

#comment, #kml_id

Instance Method Summary collapse

Methods inherited from Object

#change

Constructor Details

#initialize(options = {}) ⇒ ListStyle

Returns a new instance of ListStyle.



1089
1090
1091
1092
1093
1094
# File 'lib/kamelopard/classes.rb', line 1089

def initialize(options = {})
#bgcolor = nil, state = nil, href = nil, listitemtype = nil)
    @state = :open
    @bgColor = 'ffffffff'
    super
end

Instance Attribute Details

#bgColorObject

Returns the value of attribute bgColor.



1087
1088
1089
# File 'lib/kamelopard/classes.rb', line 1087

def bgColor
  @bgColor
end

#hrefObject

Returns the value of attribute href.



1087
1088
1089
# File 'lib/kamelopard/classes.rb', line 1087

def href
  @href
end

#listItemTypeObject

Returns the value of attribute listItemType.



1087
1088
1089
# File 'lib/kamelopard/classes.rb', line 1087

def listItemType
  @listItemType
end

#stateObject

Returns the value of attribute state.



1087
1088
1089
# File 'lib/kamelopard/classes.rb', line 1087

def state
  @state
end

Instance Method Details

#to_kml(elem = nil) ⇒ Object



1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
# File 'lib/kamelopard/classes.rb', line 1096

def to_kml(elem = nil)
    k = XML::Node.new 'ListStyle'

    super k
    Kamelopard.kml_array(k, [
        [@listItemType, 'listItemType'],
        [@bgColor, 'bgColor']
    ])
    if (! @state.nil? or ! @href.nil?) then
        i = XML::Node.new 'ItemIcon'
        Kamelopard.kml_array(i, [
            [ @state, 'state' ],
            [ @href, 'href' ]
        ])
        k << i
    end
    elem << k unless elem.nil?
    k
end