Class: Kamelopard::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 Object

#comment, #kml_id

Instance Method Summary collapse

Methods inherited from ColorStyle

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

Methods inherited from Object

#change

Constructor Details

#initialize(options = {}) ⇒ PolyStyle

Returns a new instance of PolyStyle.



1123
1124
1125
1126
1127
1128
# File 'lib/kamelopard/classes.rb', line 1123

def initialize(options = {})
#fill = 1, outline = 1, color = 'ffffffff', colormode = :normal)
    @fill = 1
    @outline = 1
    super nil, options
end

Instance Attribute Details

#fillObject

Returns the value of attribute fill.



1121
1122
1123
# File 'lib/kamelopard/classes.rb', line 1121

def fill
  @fill
end

#outlineObject

Returns the value of attribute outline.



1121
1122
1123
# File 'lib/kamelopard/classes.rb', line 1121

def outline
  @outline
end

Instance Method Details

#to_kml(elem = nil) ⇒ Object



1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
# File 'lib/kamelopard/classes.rb', line 1130

def to_kml(elem = nil)
    k = XML::Node.new 'PolyStyle'
    super k
    Kamelopard.kml_array( k, [
        [ @fill, 'fill' ],
        [ @outline, 'outline' ]
    ])
    elem << k unless elem.nil?
    k
end