Class: VORuby::STC::V1_10::STC::CatalogEntryLocationType

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

Overview

Type for STC catalog entry description

Direct Known Subclasses

CatalogEntryLocation

Defined Under Namespace

Classes: AstroCoordAreaList, AstroCoordsList

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

Returns a new instance of CatalogEntryLocationType.



2987
2988
2989
2990
2991
# File 'lib/voruby/stc/1.10/stc.rb', line 2987

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

Class Method Details

.from_xml(xml) ⇒ Object



3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
# File 'lib/voruby/stc/1.10/stc.rb', line 3020

def self.from_xml(xml)
  root = element_from(xml)
  
  options = {
    :coord_sys => xml_to_obj(root, AstroCoordSystem),
    :coords => xml_to_obj(root, AstroCoords, false, Coords),
    :coord_areas => xml_to_obj(root, AstroCoordArea)
  }
  
  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=(as) ⇒ Object



3011
3012
3013
3014
3015
3016
3017
3018
# File 'lib/voruby/stc/1.10/stc.rb', line 3011

def coord_areas=(as)
  if as
    as = CatalogEntryLocationType::AstroCoordAreaList.new(as) if as.class == Array
    raise_type_mismatch_error(as, CatalogEntryLocationType::AstroCoordAreaList)
  end
  
  @coord_areas = as
end

#coord_sys=(ss) ⇒ Object



2993
2994
2995
2996
2997
2998
2999
3000
# File 'lib/voruby/stc/1.10/stc.rb', line 2993

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=(cs) ⇒ Object



3002
3003
3004
3005
3006
3007
3008
3009
# File 'lib/voruby/stc/1.10/stc.rb', line 3002

def coords=(cs)
  raise_argument_required_error('astro coordinates') if !cs
  
  cs = CatalogEntryLocationType::AstroCoordsList.new(cs) if cs.class == Array
  raise_type_mismatch_error(cs, CatalogEntryLocationType::AstroCoordsList)
  
  @coords = cs
end