Class: LineStyle

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

Overview

Corresponds to KML’s LineStyle 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(width = 1, outercolor = 'ffffffff', outerwidth = 0, physicalwidth = 0, color = 'ffffffff', colormode = :normal) ⇒ LineStyle

Returns a new instance of LineStyle.



923
924
925
926
927
928
929
# File 'lib/kamelopard/classes.rb', line 923

def initialize(width = 1, outercolor = 'ffffffff', outerwidth = 0, physicalwidth = 0, color = 'ffffffff', colormode = :normal)
    super(color, colormode)
    @width = width
    @outercolor = outercolor
    @outerwidth = outerwidth
    @physicalwidth = physicalwidth
end

Instance Attribute Details

#outercolorObject

Returns the value of attribute outercolor.



921
922
923
# File 'lib/kamelopard/classes.rb', line 921

def outercolor
  @outercolor
end

#outerwidthObject

Returns the value of attribute outerwidth.



921
922
923
# File 'lib/kamelopard/classes.rb', line 921

def outerwidth
  @outerwidth
end

#physicalwidthObject

Returns the value of attribute physicalwidth.



921
922
923
# File 'lib/kamelopard/classes.rb', line 921

def physicalwidth
  @physicalwidth
end

#widthObject

Returns the value of attribute width.



921
922
923
# File 'lib/kamelopard/classes.rb', line 921

def width
  @width
end

Instance Method Details

#to_kml(indent = 0) ⇒ Object



931
932
933
934
935
936
937
938
939
940
941
942
# File 'lib/kamelopard/classes.rb', line 931

def to_kml(indent = 0)

    <<-linestyle
#{ ' ' * indent }<LineStyle id="#{@id}">
#{ super(indent + 4) }
#{ ' ' * indent }    <width>#{@width}</width>
#{ ' ' * indent }    <gx:outerColor>#{@outercolor}</gx:outerColor>
#{ ' ' * indent }    <gx:outerWidth>#{@outerwidth}</gx:outerWidth>
#{ ' ' * indent }    <gx:physicalWidth>#{@physicalwidth}</gx:physicalWidth>
#{ ' ' * indent }</LineStyle>
    linestyle
end