Class: Kamelopard::XY
- Inherits:
-
Object
- Object
- Kamelopard::XY
- Defined in:
- lib/kamelopard/classes.rb
Overview
Internal class used where KML requires X and Y values and units
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#xunits ⇒ Object
Returns the value of attribute xunits.
-
#y ⇒ Object
Returns the value of attribute y.
-
#yunits ⇒ Object
Returns the value of attribute yunits.
Instance Method Summary collapse
-
#initialize(x = 0.5, y = 0.5, xunits = :fraction, yunits = :fraction) ⇒ XY
constructor
A new instance of XY.
- #to_kml(name, elem = nil) ⇒ Object
Constructor Details
#initialize(x = 0.5, y = 0.5, xunits = :fraction, yunits = :fraction) ⇒ XY
Returns a new instance of XY.
929 930 931 932 933 934 |
# File 'lib/kamelopard/classes.rb', line 929 def initialize(x = 0.5, y = 0.5, xunits = :fraction, yunits = :fraction) @x = x @y = y @xunits = xunits @yunits = yunits end |
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x.
928 929 930 |
# File 'lib/kamelopard/classes.rb', line 928 def x @x end |
#xunits ⇒ Object
Returns the value of attribute xunits.
928 929 930 |
# File 'lib/kamelopard/classes.rb', line 928 def xunits @xunits end |
#y ⇒ Object
Returns the value of attribute y.
928 929 930 |
# File 'lib/kamelopard/classes.rb', line 928 def y @y end |
#yunits ⇒ Object
Returns the value of attribute yunits.
928 929 930 |
# File 'lib/kamelopard/classes.rb', line 928 def yunits @yunits end |
Instance Method Details
#to_kml(name, elem = nil) ⇒ Object
936 937 938 939 940 941 942 943 944 |
# File 'lib/kamelopard/classes.rb', line 936 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 |