Class: KML::IconStyle

Inherits:
ColorStyle show all
Defined in:
lib/kml/icon_style.rb

Overview

Specifies how icons for point Placemarks are drawn, both in the Places panel and in the 3D viewer of Google Earth. The Icon object specifies the icon image. The scale specifies the x, y scaling of the icon.

Instance Attribute Summary collapse

Attributes inherited from ColorStyle

#color, #color_mode

Attributes inherited from Object

#id

Instance Method Summary collapse

Methods inherited from Object

#initialize, #parse

Constructor Details

This class inherits a constructor from KML::Object

Instance Attribute Details

#headingObject

Compass direction, in degrees. Default=0 (North). ( <a href=“earth.google.com/kml/kml_tags_21.html#heading”>See diagram.) Values range from 0 to ±180 degrees.



26
27
28
# File 'lib/kml/icon_style.rb', line 26

def heading
  @heading
end

#hot_spotObject

Specifies the position within the Icon that is “anchored” to the Point specified in the Placemark. See KML::HotSpot



36
37
38
# File 'lib/kml/icon_style.rb', line 36

def hot_spot
  @hot_spot
end

#iconObject

A custom Icon.



32
33
34
# File 'lib/kml/icon_style.rb', line 32

def icon
  @icon
end

#scaleObject

Resizes the icon (default=1).



29
30
31
# File 'lib/kml/icon_style.rb', line 29

def scale
  @scale
end

Instance Method Details

#render(xm = Builder::XmlMarkup.new(:indent => 2)) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/kml/icon_style.rb', line 38

def render(xm=Builder::XmlMarkup.new(:indent => 2))
  xm.IconStyle {
    super
    xm.scale(scale) unless scale.nil?
    xm.heading(heading) unless heading.nil?
    icon.render(xm) unless icon.nil?
    unless hot_spot.nil?
      xm.hotSpot(:x => hot_spot.x, :y => hot_spot.y, :xunits => hot_spot.xunits, :yunits => hot_spot.yunits)
    end
  }
end