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

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

#change

Constructor Details

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

Returns a new instance of IconStyle.



985
986
987
988
989
# File 'lib/kamelopard/classes.rb', line 985

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

#headingObject

Returns the value of attribute heading.



981
982
983
# File 'lib/kamelopard/classes.rb', line 981

def heading
  @heading
end

#hotspotObject

Returns the value of attribute hotspot.



981
982
983
# File 'lib/kamelopard/classes.rb', line 981

def hotspot
  @hotspot
end

#scaleObject

Returns the value of attribute scale.



981
982
983
# File 'lib/kamelopard/classes.rb', line 981

def scale
  @scale
end

Instance Method Details

#hs_x=(a) ⇒ Object



991
992
993
# File 'lib/kamelopard/classes.rb', line 991

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

#hs_xunits=(a) ⇒ Object



999
1000
1001
# File 'lib/kamelopard/classes.rb', line 999

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

#hs_y=(a) ⇒ Object



995
996
997
# File 'lib/kamelopard/classes.rb', line 995

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

#hs_yunits=(a) ⇒ Object



1003
1004
1005
# File 'lib/kamelopard/classes.rb', line 1003

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

#to_kml(elem = nil) ⇒ Object



1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
# File 'lib/kamelopard/classes.rb', line 1007

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