Class: KMLxy

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) ⇒ KMLxy

Returns a new instance of KMLxy.



830
831
832
833
834
835
# File 'lib/kamelopard/classes.rb', line 830

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.



829
830
831
# File 'lib/kamelopard/classes.rb', line 829

def x
  @x
end

#xunitsObject

Returns the value of attribute xunits.



829
830
831
# File 'lib/kamelopard/classes.rb', line 829

def xunits
  @xunits
end

#yObject

Returns the value of attribute y.



829
830
831
# File 'lib/kamelopard/classes.rb', line 829

def y
  @y
end

#yunitsObject

Returns the value of attribute yunits.



829
830
831
# File 'lib/kamelopard/classes.rb', line 829

def yunits
  @yunits
end

Instance Method Details

#to_kml(name, indent = 0) ⇒ Object



837
838
839
840
841
842
# File 'lib/kamelopard/classes.rb', line 837

def to_kml(name, indent = 0)

    <<-kmlxy
#{ ' ' * indent}<#{ name } x="#{ @x }" y="#{ @y }" xunits="#{ @xunits }" yunits="#{ @yunits }" />
    kmlxy
end