Class: Style

Inherits:
StyleSelector show all
Defined in:
lib/kamelopard/classes.rb

Overview

Corresponds to KML’s Style object. Attributes are expected to be IconStyle, LabelStyle, LineStyle, PolyStyle, BalloonStyle, and ListStyle objects.

Instance Attribute Summary collapse

Attributes inherited from StyleSelector

#attached

Attributes inherited from KMLObject

#comment, #id

Instance Method Summary collapse

Methods inherited from StyleSelector

#attach, #attached?

Constructor Details

#initialize(icon = nil, label = nil, line = nil, poly = nil, balloon = nil, list = nil) ⇒ Style

Returns a new instance of Style.



1024
1025
1026
1027
1028
1029
1030
1031
1032
# File 'lib/kamelopard/classes.rb', line 1024

def initialize(icon = nil, label = nil, line = nil, poly = nil, balloon = nil, list = nil)
    super()
    @icon = icon
    @label = label
    @line = line
    @poly = poly
    @balloon = balloon
    @list = list
end

Instance Attribute Details

#balloonObject

Returns the value of attribute balloon.



1023
1024
1025
# File 'lib/kamelopard/classes.rb', line 1023

def balloon
  @balloon
end

#iconObject

Returns the value of attribute icon.



1023
1024
1025
# File 'lib/kamelopard/classes.rb', line 1023

def icon
  @icon
end

#labelObject

Returns the value of attribute label.



1023
1024
1025
# File 'lib/kamelopard/classes.rb', line 1023

def label
  @label
end

#lineObject

Returns the value of attribute line.



1023
1024
1025
# File 'lib/kamelopard/classes.rb', line 1023

def line
  @line
end

#listObject

Returns the value of attribute list.



1023
1024
1025
# File 'lib/kamelopard/classes.rb', line 1023

def list
  @list
end

#polyObject

Returns the value of attribute poly.



1023
1024
1025
# File 'lib/kamelopard/classes.rb', line 1023

def poly
  @poly
end

Instance Method Details

#to_kml(indent = 0) ⇒ Object



1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
# File 'lib/kamelopard/classes.rb', line 1034

def to_kml(indent = 0)
    k = ''
    k << super + "#{ ' ' * indent }<Style id=\"#{@id}\">\n"
    k << @icon.to_kml(indent + 4) unless @icon.nil?
    k << @label.to_kml(indent + 4) unless @label.nil?
    k << @line.to_kml(indent + 4) unless @line.nil?
    k << @poly.to_kml(indent + 4) unless @poly.nil?
    k << @balloon.to_kml(indent + 4) unless @balloon.nil?
    k << @list.to_kml(indent + 4) unless @list.nil?
    k << "#{ ' ' * indent }</Style>\n"
    k
end