Class: Kamelopard::IconStyle

Inherits:
ColorStyle show all
Includes:
Icon
Defined in:
lib/kamelopard/classes.rb

Overview

Corresponds to KML's IconStyle object.

Instance Attribute Summary collapse

Attributes included from Icon

#h, #href, #httpQuery, #refreshInterval, #refreshMode, #viewBoundScale, #viewFormat, #viewRefreshMode, #viewRefreshTime, #w, #x, #y

Attributes inherited from ColorStyle

#color, #colorMode

Attributes inherited from Object

#comment, #kml_id, #master_only

Instance Method Summary collapse

Methods included from Icon

#icon_to_kml

Methods inherited from ColorStyle

#alpha, #alpha=, #blue, #blue=, #green, #green=, #red, #red=, #validate_colorMode

Methods inherited from Object

#_alternate_to_kml, #change, #master_only?, parse

Constructor Details

#initialize(href = nil, options = {}) ⇒ IconStyle

Returns a new instance of IconStyle.



1449
1450
1451
1452
1453
# File 'lib/kamelopard/classes.rb', line 1449

def initialize(href = nil, options = {})
    @hotspot = XY.new(0.5, 0.5, :fraction, :fraction)
    super nil, options
    @href = href unless href.nil?
end

Instance Attribute Details

#heading ⇒ Object

Returns the value of attribute heading.



1445
1446
1447
# File 'lib/kamelopard/classes.rb', line 1445

def heading
  @heading
end

#hotspot ⇒ Object

Returns the value of attribute hotspot.



1445
1446
1447
# File 'lib/kamelopard/classes.rb', line 1445

def hotspot
  @hotspot
end

#scale ⇒ Object

Returns the value of attribute scale.



1445
1446
1447
# File 'lib/kamelopard/classes.rb', line 1445

def scale
  @scale
end

Instance Method Details

#hs_x=(a) ⇒ Object



1455
1456
1457
# File 'lib/kamelopard/classes.rb', line 1455

def hs_x=(a)
    @hotspot.x = a
end

#hs_xunits=(a) ⇒ Object



1463
1464
1465
# File 'lib/kamelopard/classes.rb', line 1463

def hs_xunits=(a)
    @hotspot.xunits = a
end

#hs_y=(a) ⇒ Object



1459
1460
1461
# File 'lib/kamelopard/classes.rb', line 1459

def hs_y=(a)
    @hotspot.y = a
end

#hs_yunits=(a) ⇒ Object



1467
1468
1469
# File 'lib/kamelopard/classes.rb', line 1467

def hs_yunits=(a)
    @hotspot.yunits = a
end

#to_kml(elem = nil) ⇒ Object



1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
# File 'lib/kamelopard/classes.rb', line 1471

def to_kml(elem = nil)
    k = XML::Node.new 'IconStyle'
    super(k)
    Kamelopard.kml_array( k, [
        [ @scale, 'scale' ],
        [ @heading, 'heading' ]
    ])
    if not @hotspot.nil? then
        h = XML::Node.new 'hotSpot'
        h.attributes['x'] = @hotspot.x.to_s
        h.attributes['y'] = @hotspot.y.to_s
        h.attributes['xunits'] = @hotspot.xunits.to_s
        h.attributes['yunits'] = @hotspot.yunits.to_s
        k << h
    end
    icon_to_kml(k)
    elem << k unless elem.nil?
    k
end