Class: Bio::PhyloXML::Point

Inherits:
Object
  • Object
show all
Defined in:
lib/bio-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

Instance Method Summary collapse

Instance Attribute Details

#altObject

Float. Altitude



441
442
443
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 441

def alt
  @alt
end

#alt_unitObject

String. Altitude unit.



444
445
446
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 444

def alt_unit
  @alt_unit
end

#geodetic_datumObject

Geodedic datum / map datum



447
448
449
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 447

def geodetic_datum
  @geodetic_datum
end

#latObject

Float. Latitude



435
436
437
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 435

def lat
  @lat
end

#longObject

Float. Longitute



438
439
440
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 438

def long
  @long
end

Instance Method Details

#to_xmlObject

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



465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/bio-phyloxml/phyloxml_elements.rb', line 465

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