Class: VORuby::STC::V1_30::CoordFlavorType

Inherits:
Object
  • Object
show all
Includes:
SerializableToXml
Defined in:
lib/voruby/stc/1.30/stc.rb

Overview

Provides the spatial coordinate definitions: number of axes, SPHERICAL, CARTESIAN, UNITSPHERE, POLAR, or HEALPIX, presence of velocities.

Direct Known Subclasses

CARTESIAN, HealpixType, POLAR, SPHERICAL, STRING, UNITSPHERE

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(coord_naxes = 2) ⇒ CoordFlavorType

Returns a new instance of CoordFlavorType.



7445
7446
7447
# File 'lib/voruby/stc/1.30/stc.rb', line 7445

def initialize(coord_naxes=2)
  self.coord_naxes = coord_naxes || 2
end

Instance Attribute Details

#coord_naxesObject

Returns the value of attribute coord_naxes.



7443
7444
7445
# File 'lib/voruby/stc/1.30/stc.rb', line 7443

def coord_naxes
  @coord_naxes
end

Class Method Details

.coord_flavor_from_xml(root) ⇒ Object



7467
7468
7469
7470
# File 'lib/voruby/stc/1.30/stc.rb', line 7467

def self.coord_flavor_from_xml(root)
  cn = root.attributes.get_attribute_ns(obj_ns.uri, 'coord_naxes')
  [cn ? Integer(cn.value) : nil]
end

.from_xml(xml) ⇒ Object



7472
7473
7474
7475
# File 'lib/voruby/stc/1.30/stc.rb', line 7472

def self.from_xml(xml)
  root = element_from(xml)
  self.new(*coord_flavor_from_xml(root))
end

Instance Method Details

#==(f) ⇒ Object



7457
7458
7459
# File 'lib/voruby/stc/1.30/stc.rb', line 7457

def ==(f)
  self.coord_naxes == f.coord_naxes
end

#to_xml(name = nil) ⇒ Object



7461
7462
7463
7464
7465
# File 'lib/voruby/stc/1.30/stc.rb', line 7461

def to_xml(name=nil)
  el = element(name)
  el.attributes["#{obj_ns.prefix}:coord_naxes"] = self.coord_naxes.to_s
  el
end