Class: VORuby::STC::V1_30::STCRegion

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

Overview

Type for STC Region.

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, region, options = {}) ⇒ STCRegion

Returns a new instance of STCRegion.



8562
8563
8564
8565
8566
# File 'lib/voruby/stc/1.30/stc.rb', line 8562

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

Instance Attribute Details

#coord_sysObject

Returns the value of attribute coord_sys.



8560
8561
8562
# File 'lib/voruby/stc/1.30/stc.rb', line 8560

def coord_sys
  @coord_sys
end

#regionObject

Returns the value of attribute region.



8560
8561
8562
# File 'lib/voruby/stc/1.30/stc.rb', line 8560

def region
  @region
end

Class Method Details

.from_xml(xml) ⇒ Object



8596
8597
8598
8599
8600
8601
8602
8603
8604
# File 'lib/voruby/stc/1.30/stc.rb', line 8596

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

Instance Method Details

#==(r) ⇒ Object



8580
8581
8582
8583
8584
# File 'lib/voruby/stc/1.30/stc.rb', line 8580

def ==(r)
  super(r) and
  self.coord_sys == r.coord_sys and
  self.region == r.region
end

#to_xml(name = nil) ⇒ Object



8586
8587
8588
8589
8590
8591
8592
8593
8594
# File 'lib/voruby/stc/1.30/stc.rb', line 8586

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