Class: Kamelopard::BalloonStyle

Inherits:
Object
  • Object
show all
Defined in:
lib/kamelopard/classes.rb

Overview

Corresponds to KML’s BalloonStyle 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

Attributes inherited from Object

#comment, #kml_id

Instance Method Summary collapse

Methods inherited from Object

#change

Constructor Details

#initialize(text = nil, options = {}) ⇒ BalloonStyle

Note: color element order is aabbggrr



903
904
905
906
907
908
909
910
# File 'lib/kamelopard/classes.rb', line 903

def initialize(text = nil, options = {})
#text = '', textColor = 'ff000000', bgColor = 'ffffffff', displayMode = :default)
    @bgColor = 'ffffffff'
    @textColor = 'ff000000'
    @displayMode = :default
    super options
    @text = text unless text.nil?
end

Instance Attribute Details

#bgColorObject

Returns the value of attribute bgColor.



900
901
902
# File 'lib/kamelopard/classes.rb', line 900

def bgColor
  @bgColor
end

#displayModeObject

Returns the value of attribute displayMode.



900
901
902
# File 'lib/kamelopard/classes.rb', line 900

def displayMode
  @displayMode
end

#textObject

Returns the value of attribute text.



900
901
902
# File 'lib/kamelopard/classes.rb', line 900

def text
  @text
end

#textColorObject

Returns the value of attribute textColor.



900
901
902
# File 'lib/kamelopard/classes.rb', line 900

def textColor
  @textColor
end

Instance Method Details

#to_kml(elem = nil) ⇒ Object



912
913
914
915
916
917
918
919
920
921
922
923
# File 'lib/kamelopard/classes.rb', line 912

def to_kml(elem = nil)
    k = XML::Node.new 'BalloonStyle'
    super k
    Kamelopard.kml_array(k, [
        [ @bgColor, 'bgColor' ],
        [ @text, 'text' ],
        [ @textColor, 'textColor' ],
        [ @displayMode, 'displayMode' ]
    ])
    elem << k unless elem.nil?
    k
end