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.



2345
2346
2347
2348
2349
# File 'lib/kamelopard/classes.rb', line 2345

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

Instance Attribute Details

#xObject

Returns the value of attribute x.



2344
2345
2346
# File 'lib/kamelopard/classes.rb', line 2344

def x
  @x
end

#yObject

Returns the value of attribute y.



2344
2345
2346
# File 'lib/kamelopard/classes.rb', line 2344

def y
  @y
end

#zObject

Returns the value of attribute z.



2344
2345
2346
# File 'lib/kamelopard/classes.rb', line 2344

def z
  @z
end

Instance Method Details

#to_kml(elem = nil) ⇒ Object



2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
# File 'lib/kamelopard/classes.rb', line 2351

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