Class: VORuby::STC::V1_10::STC::ObsDataLocationType

Inherits:
StcMetadataType show all
Defined in:
lib/voruby/stc/1.10/stc.rb

Overview

Type for observational STC metadata. Describes the spatial and temporal volume covered by an observation.

Direct Known Subclasses

ObsDataLocation

Instance Attribute Summary collapse

Attributes inherited from StcMetadataType

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from StcMetadataType

#==

Methods included from SerializableToXml

#element

Constructor Details

#initialize(options = {}) ⇒ ObsDataLocationType

Returns a new instance of ObsDataLocationType.



3182
3183
3184
3185
3186
# File 'lib/voruby/stc/1.10/stc.rb', line 3182

def initialize(options={})
  raise_argument_required_error('observatory location') if !options.has_key?(:observatory_location)
  raise_argument_required_error('observation location') if !options.has_key?(:observation_location)
  super(options)
end

Instance Attribute Details

#observation_locationObject

Returns the value of attribute observation_location.



3180
3181
3182
# File 'lib/voruby/stc/1.10/stc.rb', line 3180

def observation_location
  @observation_location
end

#observatory_locationObject

Returns the value of attribute observatory_location.



3180
3181
3182
# File 'lib/voruby/stc/1.10/stc.rb', line 3180

def observatory_location
  @observatory_location
end

#pixel_spaceObject

Returns the value of attribute pixel_space.



3180
3181
3182
# File 'lib/voruby/stc/1.10/stc.rb', line 3180

def pixel_space
  @pixel_space
end

Class Method Details

.from_xml(xml) ⇒ Object



3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
# File 'lib/voruby/stc/1.10/stc.rb', line 3219

def self.from_xml(xml)
  root = element_from(xml)
  
  options = {
    :observatory_location => ObservatoryLocation.from_xml(
      REXML::XPath.first(root, 'x:ObservatoryLocation', {'x' => obj_ns.uri})
    ),
    :observation_location => ObservationLocation.from_xml(
      REXML::XPath.first(root, 'x:ObservationLocation', {'x' => obj_ns.uri})
    )
  }
  
  id = root.attributes.get_attribute_ns(obj_ns.uri, 'ID')
  options[:id] = id.value if id
  
  pixel_space = REXML::XPath.first(root, 'x:PixelSpace', {'x' => obj_ns.uri})
  options[:pixel_space] = PixelSpace.from_xml(pixel_space) if pixel_space
  
  self.new(options)
end

Instance Method Details

#to_xml(name = nil) ⇒ Object



3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
# File 'lib/voruby/stc/1.10/stc.rb', line 3208

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