Class: Kamelopard::XY

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

Overview

Internal class used where KML requires X and Y values and units

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x = 0.5, y = 0.5, xunits = :fraction, yunits = :fraction) ⇒ XY

Returns a new instance of XY.



1289
1290
1291
1292
1293
1294
# File 'lib/kamelopard/classes.rb', line 1289

def initialize(x = 0.5, y = 0.5, xunits = :fraction, yunits = :fraction)
    @x = x
    @y = y
    @xunits = xunits
    @yunits = yunits
end

Instance Attribute Details

#xObject

Returns the value of attribute x.



1288
1289
1290
# File 'lib/kamelopard/classes.rb', line 1288

def x
  @x
end

#xunitsObject

Returns the value of attribute xunits.



1288
1289
1290
# File 'lib/kamelopard/classes.rb', line 1288

def xunits
  @xunits
end

#yObject

Returns the value of attribute y.



1288
1289
1290
# File 'lib/kamelopard/classes.rb', line 1288

def y
  @y
end

#yunitsObject

Returns the value of attribute yunits.



1288
1289
1290
# File 'lib/kamelopard/classes.rb', line 1288

def yunits
  @yunits
end

Instance Method Details

#to_kml(name, elem = nil) ⇒ Object



1296
1297
1298
1299
1300
1301
1302
1303
1304
# File 'lib/kamelopard/classes.rb', line 1296

def to_kml(name, elem = nil)
    k = XML::Node.new name
    k.attributes['x'] = @x.to_s
    k.attributes['y'] = @y.to_s
    k.attributes['xunits'] = @xunits.to_s
    k.attributes['yunits'] = @yunits.to_s
    elem << k unless elem.nil?
    k
end