Class: Kamelopard::Scale

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

Overview

Sub-object in the KML Model class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y, z = 1) ⇒ Scale

Returns a new instance of Scale.



1724
1725
1726
1727
1728
# File 'lib/kamelopard/classes.rb', line 1724

def initialize(x, y, z = 1)
    @x = x
    @y = y
    @z = z
end

Instance Attribute Details

#xObject

Returns the value of attribute x.



1723
1724
1725
# File 'lib/kamelopard/classes.rb', line 1723

def x
  @x
end

#yObject

Returns the value of attribute y.



1723
1724
1725
# File 'lib/kamelopard/classes.rb', line 1723

def y
  @y
end

#zObject

Returns the value of attribute z.



1723
1724
1725
# File 'lib/kamelopard/classes.rb', line 1723

def z
  @z
end

Instance Method Details

#to_kml(elem = nil) ⇒ Object



1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
# File 'lib/kamelopard/classes.rb', line 1730

def to_kml(elem = nil)
    x = REXML::Element.new 'Scale'
    {
        :x => @x,
        :y => @y,
        :z => @z
    }.each do |k, v|
        d = REXML::Element.new k.to_s
        d.text = v
        x << d
    end
    elem << x unless elem.nil?
    x
end