Class: Bio::PhyloXML::Point
- Defined in:
- lib/bio/db/phyloxml/phyloxml_elements.rb
Overview
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’.
Instance Attribute Summary collapse
-
#alt ⇒ Object
Float.
-
#alt_unit ⇒ Object
String.
-
#geodetic_datum ⇒ Object
Geodedic datum / map datum.
-
#lat ⇒ Object
Float.
-
#long ⇒ Object
Float.
Instance Method Summary collapse
-
#to_xml ⇒ Object
Converts elements to xml representation.
Instance Attribute Details
#alt ⇒ Object
Float. Altitude
446 447 448 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 446 def alt @alt end |
#alt_unit ⇒ Object
String. Altitude unit.
449 450 451 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 449 def alt_unit @alt_unit end |
#geodetic_datum ⇒ Object
Geodedic datum / map datum
452 453 454 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 452 def geodetic_datum @geodetic_datum end |
#lat ⇒ Object
Float. Latitude
440 441 442 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 440 def lat @lat end |
#long ⇒ Object
Float. Longitute
443 444 445 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 443 def long @long end |
Instance Method Details
#to_xml ⇒ Object
Converts elements to xml representation. Called by PhyloXML::Writer class.
467 468 469 470 471 472 473 474 475 476 477 478 479 |
# File 'lib/bio/db/phyloxml/phyloxml_elements.rb', line 467 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 |