Class: VORuby::STC::V1_10::STC::CoordSysType

Inherits:
Object
  • Object
show all
Includes:
SerializableToXml
Defined in:
lib/voruby/stc/1.10/stc.rb

Overview

A CoordSys consists of at least one coordinate frame

Direct Known Subclasses

AstroCoordSystemType, PixelCoordSystemType

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(options = {}) ⇒ CoordSysType

Returns a new instance of CoordSysType.



1436
1437
1438
1439
1440
# File 'lib/voruby/stc/1.10/stc.rb', line 1436

def initialize(options={})
  raise_argument_required_error('id') if !options.has_key?(:id)
  raise_argument_required_error('coordinate frames') if !options.has_key?(:coord_frames)
  options.each { |key, value| send("#{key}=", value) }
end

Instance Attribute Details

#coord_framesObject

Returns the value of attribute coord_frames.



1434
1435
1436
# File 'lib/voruby/stc/1.10/stc.rb', line 1434

def coord_frames
  @coord_frames
end

#idObject

Returns the value of attribute id.



1434
1435
1436
# File 'lib/voruby/stc/1.10/stc.rb', line 1434

def id
  @id
end

Class Method Details

.from_xml(xml) ⇒ Object



1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
# File 'lib/voruby/stc/1.10/stc.rb', line 1471

def self.from_xml(xml)
  root = element_from(xml)
  
  options = {
    :id => Id.new(root.attributes.get_attribute_ns(obj_ns.uri, 'ID').value),
    :coord_frames => xml_to_obj(root, CoordFrame)
  }
  
  self.new(options)
end

Instance Method Details

#==(c) ⇒ Object



1456
1457
1458
1459
# File 'lib/voruby/stc/1.10/stc.rb', line 1456

def ==(c)
  self.id == c.id and
  self.coord_frames == c.coord_frames
end

#to_xml(name = nil) ⇒ Object



1461
1462
1463
1464
1465
1466
1467
1468
1469
# File 'lib/voruby/stc/1.10/stc.rb', line 1461

def to_xml(name=nil)
  el = element(name)
  
  el.attributes["#{obj_ns.prefix}:ID"] = self.id.to_s
  self.coord_frames.each { |f| el.add_element(f.to_xml) }
  
  collapse_namespaces(el)
  el
end