Class: PolyStyle
- Inherits:
-
ColorStyle
- Object
- KMLObject
- ColorStyle
- PolyStyle
- 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
-
#fill ⇒ Object
Returns the value of attribute fill.
-
#outline ⇒ Object
Returns the value of attribute outline.
Attributes inherited from ColorStyle
Attributes inherited from KMLObject
Instance Method Summary collapse
-
#initialize(fill = 1, outline = 1, color = 'ffffffff', colormode = :normal) ⇒ PolyStyle
constructor
A new instance of PolyStyle.
- #to_kml(indent = 0) ⇒ Object
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
#fill ⇒ Object
Returns the value of attribute fill.
980 981 982 |
# File 'lib/kamelopard/classes.rb', line 980 def fill @fill end |
#outline ⇒ Object
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 |