Class: VORuby::STC::V1_10::STC::CustomRefPosType

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

Overview

Type for custom positions: specifies reference origin<

Direct Known Subclasses

CustomRefPos

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(origin) ⇒ CustomRefPosType

Returns a new instance of CustomRefPosType.



725
726
727
# File 'lib/voruby/stc/1.10/stc.rb', line 725

def initialize(origin)
  self.coord_origin = origin
end

Instance Attribute Details

#coord_originObject

Returns the value of attribute coord_origin.



723
724
725
# File 'lib/voruby/stc/1.10/stc.rb', line 723

def coord_origin
  @coord_origin
end

Class Method Details

.from_xml(xml) ⇒ Object



747
748
749
750
751
752
# File 'lib/voruby/stc/1.10/stc.rb', line 747

def self.from_xml(xml)
  root = element_from(xml)
  self.new(
    AstroCoords.from_xml(REXML::XPath.first(root, 'x:CoordOrigin', {'x' => obj_ns.uri}))
  )
end

Instance Method Details

#==(p) ⇒ Object



754
755
756
# File 'lib/voruby/stc/1.10/stc.rb', line 754

def ==(p)
  self.coord_origin == p.coord_origin
end

#to_xml(name = nil) ⇒ Object



735
736
737
738
739
740
741
742
743
744
745
# File 'lib/voruby/stc/1.10/stc.rb', line 735

def to_xml(name=nil)
  el = element(name)
  
  coords_ns = NAMESPACES['VORuby::STC::V1_10::Coords']
  el.add_namespace(coords_ns.prefix, coords_ns.uri)
  
  el.add_element(self.coord_origin.to_xml('CoordOrigin', obj_ns))
  
  collapse_namespaces(el)
  el
end