class Bio::PhyloXML::Point

Description

The coordinates of a point with an optional altitude. Required attribute 'geodetic_datum' is used to indicate the geodetic datum (also called 'map datum'), for example Google's KML uses 'WGS84'.

Attributes

alt[R]

Float. Altitude

alt_unit[RW]

String. Altitude unit.

geodetic_datum[RW]

Geodedic datum / map datum

lat[R]

Float. Latitude

long[R]

Float. Longitute

Public Instance Methods

alt=(str) click to toggle source

Float. Altitude

# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 471
def alt=(str)
  @alt = str.to_f unless str.nil?
end
lat=(str) click to toggle source

Float. Latitude

# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 461
def lat=(str)
  @lat = str.to_f unless str.nil?
end
long=(str) click to toggle source

Float. Longitute

# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 466
def long=(str)
  @long = str.to_f unless str.nil?
end
to_xml() click to toggle source

Converts elements to xml representation. Called by PhyloXML::Writer class.

# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 476
def to_xml
  raise "Geodedic datum is a required attribute of Point element." if @geodetic_datum.nil?

  p = LibXML::XML::Node.new('point')
  p["geodetic_datum"] = @geodetic_datum
  p["alt_unit"] = @alt_unit if @alt_unit != nil
  PhyloXML::Writer.generate_xml(p, self, [
      [:simple, 'lat', @lat],
      [:simple, 'long', @long],
      [:simple, 'alt', @alt]])
  return p
  #@todo check if characters are correctly generated, like Zuric
end