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.



2177
2178
2179
2180
2181
# File 'lib/kamelopard/classes.rb', line 2177

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

Instance Attribute Details

#xObject

Returns the value of attribute x.



2176
2177
2178
# File 'lib/kamelopard/classes.rb', line 2176

def x
  @x
end

#yObject

Returns the value of attribute y.



2176
2177
2178
# File 'lib/kamelopard/classes.rb', line 2176

def y
  @y
end

#zObject

Returns the value of attribute z.



2176
2177
2178
# File 'lib/kamelopard/classes.rb', line 2176

def z
  @z
end

Instance Method Details

#to_kml(elem = nil) ⇒ Object



2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
# File 'lib/kamelopard/classes.rb', line 2183

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