Class: VORuby::STC::V1_30::ObsDataLocationType

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

Overview

Type for observational STC metadata.

Direct Known Subclasses

ObsDataLocation

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(observatory_location, observation_location, pixel_space = nil, options = {}) ⇒ ObsDataLocationType

Returns a new instance of ObsDataLocationType.



8365
8366
8367
8368
8369
8370
# File 'lib/voruby/stc/1.30/stc.rb', line 8365

def initialize(observatory_location, observation_location, pixel_space=nil, options={})
  super(options)
  self.observatory_location = observatory_location
  self.observation_location = observation_location
  self.pixel_space = pixel_space
end

Instance Attribute Details

#observation_locationObject

Returns the value of attribute observation_location.



8363
8364
8365
# File 'lib/voruby/stc/1.30/stc.rb', line 8363

def observation_location
  @observation_location
end

#observatory_locationObject

Returns the value of attribute observatory_location.



8363
8364
8365
# File 'lib/voruby/stc/1.30/stc.rb', line 8363

def observatory_location
  @observatory_location
end

#pixel_spaceObject

Returns the value of attribute pixel_space.



8363
8364
8365
# File 'lib/voruby/stc/1.30/stc.rb', line 8363

def pixel_space
  @pixel_space
end

Class Method Details

.from_xml(xml) ⇒ Object



8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
# File 'lib/voruby/stc/1.30/stc.rb', line 8405

def self.from_xml(xml)
  root = element_from(xml)
  
  observatory = REXML::XPath.first(root, 'x:ObservatoryLocation', {'x' => obj_ns.uri})
  observation = REXML::XPath.first(root, 'x:ObservationLocation', {'x' => obj_ns.uri})
  space = REXML::XPath.first(root, 'x:PixelSpace', {'x' => obj_ns.uri})
  
  self.new(
    observatory ? ObservatoryLocationType.from_xml(observatory) : nil,
    observation ? AstroSTCDescriptionType.from_xml(observation) : nil,
    space ? PixelSpaceType.from_xml(space) : nil,
    *STCMetadataType.(root)
  )
end

Instance Method Details

#==(l) ⇒ Object



8387
8388
8389
8390
8391
8392
# File 'lib/voruby/stc/1.30/stc.rb', line 8387

def ==(l)
  super(l) and
  self.observatory_location == l.observatory_location and
  self.observation_location == l.observation_location and
  self.pixel_space == l.pixel_space
end

#to_xml(name = nil) ⇒ Object



8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
# File 'lib/voruby/stc/1.30/stc.rb', line 8394

def to_xml(name=nil)
  el = super(name)
  
  el.add_element(self.observatory_location.to_xml('ObservatoryLocation')) if self.observatory_location
  el.add_element(self.observation_location.to_xml('ObservationLocation')) if self.observation_location
  el.add_element(self.pixel_space.to_xml('PixelSpace')) if self.pixel_space
  
  collapse_namespaces(el)
  el
end