Class | Bio::PhyloXML::Point
In: | lib/bio/db/phyloxml/phyloxml_elements.rb
Parent: | Object

## 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’.

### Methods

alt= lat= long= to_xml

### Attributes

alt | [RW] | Float. Altitude
alt_unit | [RW] | String. Altitude unit.
geodetic_datum | [RW] | Geodedic datum / map datum
lat | [RW] | Float. Latitude
long | [RW] | Float. Longitute

### Public Instance methods

alt=(str)

[Source]

         # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 462
    462:       def alt=(str)
    463:         @alt = str.to_f unless str.nil?
    464:       end

lat=(str)

[Source]

         # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 454
    454:       def lat=(str)
    455:         @lat = str.to_f unless str.nil?
    456:       end

long=(str)

[Source]

         # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 458
    458:       def long=(str)
    459:         @long = str.to_f unless str.nil?
    460:       end

to_xml()

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

[Source]

         # File lib/bio/db/phyloxml/phyloxml_elements.rb, line 467
    467:       def to_xml
    468:         raise "Geodedic datum is a required attribute of Point element." if @geodetic_datum.nil?
    469:
    470:         p = LibXML::XML::Node.new('point')
    471:         p["geodetic_datum"] = @geodetic_datum
    472:         p["alt_unit"] = @alt_unit if @alt_unit != nil
    473:         PhyloXML::Writer.generate_xml(p, self, [
    474:             [:simple, 'lat', @lat],
    475:             [:simple, 'long', @long],
    476:             [:simple, 'alt', @alt]])
    477:         return p
    478:         #@todo check if characters are correctly generated, like Zuric
    479:       end

[Validate]