Class: VORuby::STC::V1_30::STCCoordinateList

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

Overview

Type for STC Coordinate List.

Defined Under Namespace

Classes: AstroCoordsList

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 = {}) ⇒ STCCoordinateList

Returns a new instance of STCCoordinateList.



8510
8511
8512
8513
8514
# File 'lib/voruby/stc/1.30/stc.rb', line 8510

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.



8508
8509
8510
# File 'lib/voruby/stc/1.30/stc.rb', line 8508

def coord_sys
  @coord_sys
end

#coordsObject

Returns the value of attribute coords.



8508
8509
8510
# File 'lib/voruby/stc/1.30/stc.rb', line 8508

def coords
  @coords
end

Class Method Details

.from_xml(xml) ⇒ Object



8547
8548
8549
8550
8551
8552
8553
8554
8555
# File 'lib/voruby/stc/1.30/stc.rb', line 8547

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

Instance Method Details

#==(cl) ⇒ Object



8531
8532
8533
8534
8535
# File 'lib/voruby/stc/1.30/stc.rb', line 8531

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

#to_xml(name = nil) ⇒ Object



8537
8538
8539
8540
8541
8542
8543
8544
8545
# File 'lib/voruby/stc/1.30/stc.rb', line 8537

def to_xml(name=nil)
  el = element(name)
  
  el.add_element(self.coord_sys.to_xml)
  self.coords.each{ |c| el.add_element(c.to_xml) }
  
  collapse_namespaces(el)
  el
end