Class: VORuby::STC::V1_10::STC::ObservationLocation

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

Overview

Type for describing the coordinate volume occupied by observational data, as seen from the observatory location

Instance Attribute Summary

Attributes inherited from StcDescription

#coord_areas, #coord_sys, #coords

Attributes inherited from StcMetadataType

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from StcDescription

#==, #to_xml

Methods inherited from StcMetadataType

#==, #to_xml

Methods included from SerializableToXml

#element

Constructor Details

#initialize(options = {}) ⇒ ObservationLocation

Returns a new instance of ObservationLocation.



3080
3081
3082
3083
3084
3085
# File 'lib/voruby/stc/1.10/stc.rb', line 3080

def initialize(options={})
  raise_argument_required_error('astro coordinate systems') if !options.has_key?(:coord_sys)
  raise_argument_required_error('astro coordinate') if !options.has_key?(:coords)
  raise_argument_required_error('astro coordinate area') if !options.has_key?(:coord_areas)
  super(options)
end

Class Method Details

.from_xml(xml) ⇒ Object



3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
# File 'lib/voruby/stc/1.10/stc.rb', line 3108

def self.from_xml(xml)
  root = element_from(xml)
  
  options = {
    :coord_sys => xml_to_obj(root, AstroCoordSystem),
    :coords => xml_to_obj(root, AstroCoords, true, Coords),
    :coord_areas => xml_to_obj(root, AstroCoordArea, true)
  }
  
  id = root.attributes.get_attribute_ns(obj_ns.uri, 'ID')
  options[:id] = Id.new(id.value) if id
  
  self.new(options)
end

Instance Method Details

#coord_areas=(a) ⇒ Object



3102
3103
3104
3105
3106
# File 'lib/voruby/stc/1.10/stc.rb', line 3102

def coord_areas=(a)
  raise_argument_required_error('astro coordinate area') if !a
  raise_type_mismatch_error(a, AstroCoordArea)
  @coord_areas = a
end

#coord_sys=(ss) ⇒ Object



3087
3088
3089
3090
3091
3092
3093
3094
# File 'lib/voruby/stc/1.10/stc.rb', line 3087

def coord_sys=(ss)
  raise_argument_required_error('astro coordinate systems') if !ss
  
  ss = AstroCoordSystemList.new(ss) if ss.class == Array
  raise_type_mismatch_error(ss, AstroCoordSystemList)
  
  @coord_sys = ss
end

#coords=(c) ⇒ Object



3096
3097
3098
3099
3100
# File 'lib/voruby/stc/1.10/stc.rb', line 3096

def coords=(c)
  raise_argument_required_error('astro coordinate') if !c
  raise_type_mismatch_error(c, AstroCoords)
  @coords = c
end