Class: PolyStyle

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

Overview

Corresponds to KML’s PolyStyle 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 ColorStyle

#color, #colormode

Attributes inherited from KMLObject

#comment, #id

Instance Method Summary collapse

Methods inherited from ColorStyle

#alpha, #alpha=, #blue, #blue=, #green, #green=, #red, #red=, #validate_colormode

Constructor Details

#initialize(fill = 1, outline = 1, color = 'ffffffff', colormode = :normal) ⇒ PolyStyle

Returns a new instance of PolyStyle.



982
983
984
985
986
# File 'lib/kamelopard/classes.rb', line 982

def initialize(fill = 1, outline = 1, color = 'ffffffff', colormode = :normal)
    super(color, colormode)
    @fill = fill
    @outline = outline
end

Instance Attribute Details

#fillObject

Returns the value of attribute fill.



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

def fill
  @fill
end

#outlineObject

Returns the value of attribute outline.



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

def outline
  @outline
end

Instance Method Details

#to_kml(indent = 0) ⇒ Object



988
989
990
991
992
993
994
995
996
997
998
# File 'lib/kamelopard/classes.rb', line 988

def to_kml(indent = 0)

    k = <<-polystyle
#{ ' ' * indent }<PolyStyle id="#{@id}">
#{ super(indent + 4) }
#{ ' ' * indent }    <fill>#{@fill}</fill>
    polystyle
    k << "#{ ' ' * indent }    <outline>#{@outline}</outline>\n" unless @outline.nil?
    k << "#{ ' ' * indent }</PolyStyle>\n"
    k
end