Class: VORuby::STC::V1_30::RedshiftFrameType

Inherits:
CoordFrameType show all
Defined in:
lib/voruby/stc/1.30/stc.rb

Overview

Contains the Doppler definitions, including whether the values are velocity or redshift (value_type).

Direct Known Subclasses

RedshiftFrame

Instance Attribute Summary collapse

Attributes inherited from CoordFrameType

#name

Attributes included from STCReference

#id, #idref, #ucd, #xlink_href, #xlink_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CoordFrameType

coord_frame_from_xml

Methods inherited from STCBaseType

stc_base_from_xml

Methods included from STCReference

#stc_reference_eq, stc_reference_from_xml, #stc_reference_to_xml

Methods included from SerializableToXml

#element

Constructor Details

#initialize(reference_position, doppler_definition = nil, value_type = ValueType.new('VELOCITY'), name = nil, options = {}) ⇒ RedshiftFrameType

Returns a new instance of RedshiftFrameType.



7850
7851
7852
7853
7854
7855
# File 'lib/voruby/stc/1.30/stc.rb', line 7850

def initialize(reference_position, doppler_definition=nil, value_type=ValueType.new('VELOCITY'), name=nil, options={})
  super(name, options)
  self.reference_position = reference_position
  self.doppler_definition = doppler_definition
  self.value_type = value_type || ValueType.new('VELOCITY')
end

Instance Attribute Details

#doppler_definitionObject

Returns the value of attribute doppler_definition.



7848
7849
7850
# File 'lib/voruby/stc/1.30/stc.rb', line 7848

def doppler_definition
  @doppler_definition
end

#reference_positionObject

Returns the value of attribute reference_position.



7848
7849
7850
# File 'lib/voruby/stc/1.30/stc.rb', line 7848

def reference_position
  @reference_position
end

#value_typeObject

Returns the value of attribute value_type.



7848
7849
7850
# File 'lib/voruby/stc/1.30/stc.rb', line 7848

def value_type
  @value_type
end

Class Method Details

.from_xml(xml) ⇒ Object



7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
# File 'lib/voruby/stc/1.30/stc.rb', line 7905

def self.from_xml(xml)
  root = element_from(xml)
  
  dd = REXML::XPath.first(root, 'x:DopplerDefinition', {'x' => obj_ns.uri})
  vt = root.attributes.get_attribute_ns(obj_ns.uri, 'value_type')
  
  self.new(
    xml_to_obj(root, ReferencePosition, true),
    dd ? DopplerDefinitionType.new(dd.text) : nil,
    vt ? ValueType.new(vt.value) : nil,
    *CoordFrameType.coord_frame_from_xml(root)
  )
end

Instance Method Details

#==(f) ⇒ Object



7882
7883
7884
7885
7886
7887
# File 'lib/voruby/stc/1.30/stc.rb', line 7882

def ==(f)
  super(f) and
  self.reference_position == f.reference_position and
  self.doppler_definition == f.doppler_definition and
  self.value_type == f.value_type
end

#to_xml(name = nil) ⇒ Object



7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
# File 'lib/voruby/stc/1.30/stc.rb', line 7889

def to_xml(name=nil)
  el = super(name)
  
  if self.doppler_definition
    dd = REXML::Element.new("#{obj_ns.prefix}:DopplerDefinition")
    dd.text = self.doppler_definition.to_s
    el.add_element(dd)
  end
  
  el.add_element(self.reference_position.to_xml)
  el.attributes["#{obj_ns.prefix}:value_type"] = self.value_type.to_s if self.value_type
  
  collapse_namespaces(el)
  el
end