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, #master_only

Instance Method Summary collapse

Methods inherited from Object

#_alternate_to_kml, #change, #master_only?, parse

Constructor Details

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

Note: color element order is aabbggrr



1367
1368
1369
1370
1371
1372
1373
1374
# File 'lib/kamelopard/classes.rb', line 1367

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.



1364
1365
1366
# File 'lib/kamelopard/classes.rb', line 1364

def bgColor
  @bgColor
end

#displayModeObject

Returns the value of attribute displayMode.



1364
1365
1366
# File 'lib/kamelopard/classes.rb', line 1364

def displayMode
  @displayMode
end

#textObject

Returns the value of attribute text.



1364
1365
1366
# File 'lib/kamelopard/classes.rb', line 1364

def text
  @text
end

#textColorObject

Returns the value of attribute textColor.



1364
1365
1366
# File 'lib/kamelopard/classes.rb', line 1364

def textColor
  @textColor
end

Instance Method Details

#to_kml(elem = nil) ⇒ Object



1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
# File 'lib/kamelopard/classes.rb', line 1376

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