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.



1790
1791
1792
1793
1794
# File 'lib/kamelopard/classes.rb', line 1790

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

Instance Attribute Details

#xObject

Returns the value of attribute x.



1789
1790
1791
# File 'lib/kamelopard/classes.rb', line 1789

def x
  @x
end

#yObject

Returns the value of attribute y.



1789
1790
1791
# File 'lib/kamelopard/classes.rb', line 1789

def y
  @y
end

#zObject

Returns the value of attribute z.



1789
1790
1791
# File 'lib/kamelopard/classes.rb', line 1789

def z
  @z
end

Instance Method Details

#to_kml(elem = nil) ⇒ Object



1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
# File 'lib/kamelopard/classes.rb', line 1796

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