Class: BalloonStyle

Inherits:
ColorStyle 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 ColorStyle

#color, #colormode

Attributes inherited from KMLObject

#comment, #id

Instance Method Summary (collapse)

Methods inherited from ColorStyle

#alpha, #alpha=, #blue, #blue=, #green, #green=, #red, #red=, #validate_colormode

Constructor Details

- (BalloonStyle) initialize(text = '', textcolor = 'ff000000', bgcolor = 'ffffffff', displaymode = :default)

Note: color element order is aabbggrr



735
736
737
738
739
740
741
# File 'lib/kamelopard/classes.rb', line 735

def initialize(text = '', textcolor = 'ff000000', bgcolor = 'ffffffff', displaymode = :default)
    super(nil, :normal)
    @bgcolor = bgcolor
    @text = text
    @textcolor = textcolor
    @displaymode = displaymode
end

Instance Attribute Details

- (Object) bgcolor

Returns the value of attribute bgcolor



732
733
734
# File 'lib/kamelopard/classes.rb', line 732

def bgcolor
  @bgcolor
end

- (Object) displaymode

Returns the value of attribute displaymode



732
733
734
# File 'lib/kamelopard/classes.rb', line 732

def displaymode
  @displaymode
end

- (Object) text

Returns the value of attribute text



732
733
734
# File 'lib/kamelopard/classes.rb', line 732

def text
  @text
end

- (Object) textcolor

Returns the value of attribute textcolor



732
733
734
# File 'lib/kamelopard/classes.rb', line 732

def textcolor
  @textcolor
end

Instance Method Details

- (Object) to_kml(indent = 0)



743
744
745
746
747
748
749
750
751
752
# File 'lib/kamelopard/classes.rb', line 743

def to_kml(indent = 0)
    super + <<-balloonstyle
#{ ' ' * indent }<BalloonStyle id="#{@id}">
#{ ' ' * indent }    <bgColor>#{@bgcolor}</bgColor>
#{ ' ' * indent }    <text>#{@text}</text>
#{ ' ' * indent }    <textColor>#{@textcolor}</textColor>
#{ ' ' * indent }    <displayMode>#{@displaymode}</displayMode>
#{ ' ' * indent }</BalloonStyle>
    balloonstyle
end