Class: VORuby::STC::V1_10::STC::SearchLocationType

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

Overview

Type for STC search location

Direct Known Subclasses

SearchLocation

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

Returns a new instance of SearchLocationType.



2934
2935
2936
2937
2938
# File 'lib/voruby/stc/1.10/stc.rb', line 2934

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

Class Method Details

.from_xml(xml) ⇒ Object



2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
# File 'lib/voruby/stc/1.10/stc.rb', line 2960

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



2954
2955
2956
2957
2958
# File 'lib/voruby/stc/1.10/stc.rb', line 2954

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



2940
2941
2942
2943
2944
2945
2946
2947
# File 'lib/voruby/stc/1.10/stc.rb', line 2940

def coord_sys=(ss)
  aise_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



2949
2950
2951
2952
# File 'lib/voruby/stc/1.10/stc.rb', line 2949

def coords=(c)
  raise_type_mismatch_error(c, AstroCoords) if c
  @coords = c
end