Class: VORuby::STC::V1_30::STCCoordinate

Inherits:
STCMetadataType show all
Defined in:
lib/voruby/stc/1.30/stc.rb

Overview

Type for STC Coordinate.

Instance Attribute Summary collapse

Attributes included from STCReference

#id, #idref, #ucd, #xlink_href, #xlink_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from STCMetadataType

stc_metadata_from_xml

Methods inherited from STCBaseType

stc_base_from_xml

Methods included from STCReference

#stc_reference_eq, stc_reference_from_xml, #stc_reference_to_xml

Methods included from SerializableToXml

#element

Constructor Details

#initialize(coord_sys, coords, options = {}) ⇒ STCCoordinate

Returns a new instance of STCCoordinate.



8456
8457
8458
8459
8460
# File 'lib/voruby/stc/1.30/stc.rb', line 8456

def initialize(coord_sys, coords, options={})
  super(options)
  self.coord_sys = coord_sys
  self.coords = coords
end

Instance Attribute Details

#coord_sysObject

Returns the value of attribute coord_sys.



8454
8455
8456
# File 'lib/voruby/stc/1.30/stc.rb', line 8454

def coord_sys
  @coord_sys
end

#coordsObject

Returns the value of attribute coords.



8454
8455
8456
# File 'lib/voruby/stc/1.30/stc.rb', line 8454

def coords
  @coords
end

Class Method Details

.from_xml(xml) ⇒ Object



8490
8491
8492
8493
8494
8495
8496
8497
8498
# File 'lib/voruby/stc/1.30/stc.rb', line 8490

def self.from_xml(xml)
  root = element_from(xml)
  
  self.new(
    xml_to_obj(root, AstroCoordSystem, true),
    xml_to_obj(root, AstroCoords, true),
    *STCMetadataType.(root)
  )
end

Instance Method Details

#==(c) ⇒ Object



8474
8475
8476
8477
8478
# File 'lib/voruby/stc/1.30/stc.rb', line 8474

def ==(c)
  super(c) and
  self.coord_sys == c.coord_sys and
  self.coords == c.coords
end

#to_xml(name = nil) ⇒ Object



8480
8481
8482
8483
8484
8485
8486
8487
8488
# File 'lib/voruby/stc/1.30/stc.rb', line 8480

def to_xml(name=nil)
  el = super(name)
  
  el.add_element(self.coord_sys.to_xml)
  el.add_element(self.coords.to_xml)
  
  collapse_namespaces(el)
  el
end