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

#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.



985
986
987
988
989
990
991
# File 'lib/kamelopard/classes.rb', line 985

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.



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

def outerColor
  @outerColor
end

#outerWidthObject

Returns the value of attribute outerWidth.



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

def outerWidth
  @outerWidth
end

#physicalWidthObject

Returns the value of attribute physicalWidth.



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

def physicalWidth
  @physicalWidth
end

#widthObject

Returns the value of attribute width.



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

def width
  @width
end

Instance Method Details

#to_kml(elem = nil) ⇒ Object



993
994
995
996
997
998
999
1000
1001
1002
1003
1004
# File 'lib/kamelopard/classes.rb', line 993

def to_kml(elem = nil)
    k = REXML::Element.new 'LineStyle'
    super k
    Kamelopard.kml_array(k, [
        [ @width, 'width' ],
        [ @outerColor, 'gx:outerColor' ],
        [ @outerWidth, 'gx:outerWidth' ],
        [ @physicalWidth, 'gx:physicalWidth' ],
    ])
    elem.elements << k unless elem.nil?
    k
end