Class: VORuby::STC::V1_10::STC::CustomSpaceRefFrameType
- Inherits:
-
SpaceRefFrameType
- Object
- SpaceRefFrameType
- VORuby::STC::V1_10::STC::CustomSpaceRefFrameType
- Includes:
- SerializableToXml
- Defined in:
- lib/voruby/stc/1.10/stc.rb
Overview
A custome space reference frame type Define coordinate reference frame from scratch; pole and X-axis need to be defined in a known coordinate system
Direct Known Subclasses
Instance Attribute Summary collapse
-
#frame ⇒ Object
Returns the value of attribute frame.
-
#pole_zaxis ⇒ Object
Returns the value of attribute pole_zaxis.
-
#xaxis ⇒ Object
Returns the value of attribute xaxis.
Class Method Summary collapse
Instance Method Summary collapse
- #==(f) ⇒ Object
-
#initialize(options = {}) ⇒ CustomSpaceRefFrameType
constructor
A new instance of CustomSpaceRefFrameType.
- #to_xml(name = nil) ⇒ Object
Methods included from SerializableToXml
Constructor Details
#initialize(options = {}) ⇒ CustomSpaceRefFrameType
Returns a new instance of CustomSpaceRefFrameType.
151 152 153 154 155 156 |
# File 'lib/voruby/stc/1.10/stc.rb', line 151 def initialize(={}) raise_argument_required_error('frame') if !.has_key?(:frame) raise_argument_required_error('pole z axis') if !.has_key?(:pole_zaxis) raise_argument_required_error('x axis') if !.has_key?(:xaxis) .each { |key, value| send("#{key}=", value) } end |
Instance Attribute Details
#frame ⇒ Object
Returns the value of attribute frame.
149 150 151 |
# File 'lib/voruby/stc/1.10/stc.rb', line 149 def frame @frame end |
#pole_zaxis ⇒ Object
Returns the value of attribute pole_zaxis.
149 150 151 |
# File 'lib/voruby/stc/1.10/stc.rb', line 149 def pole_zaxis @pole_zaxis end |
#xaxis ⇒ Object
Returns the value of attribute xaxis.
149 150 151 |
# File 'lib/voruby/stc/1.10/stc.rb', line 149 def xaxis @xaxis end |
Class Method Details
.from_xml(xml) ⇒ Object
200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/voruby/stc/1.10/stc.rb', line 200 def self.from_xml(xml) root = element_from(xml) = { :frame => REXML::XPath.first(root, 'x:Frame', {'x' => obj_ns.uri}).text, :pole_zaxis => AstroCoords.from_xml(REXML::XPath.first(root, 'x:Pole_Zaxis', {'x' => obj_ns.uri})), :xaxis => AstroCoords.from_xml(REXML::XPath.first(root, 'x:Xaxis', {'x' => obj_ns.uri})) } CustomSpaceRefFrameType.new() end |
Instance Method Details
#==(f) ⇒ Object
175 176 177 178 179 180 |
# File 'lib/voruby/stc/1.10/stc.rb', line 175 def ==(f) super(f) and self.frame == f.frame and self.pole_zaxis == f.pole_zaxis and self.xaxis == f.xaxis end |
#to_xml(name = nil) ⇒ Object
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/voruby/stc/1.10/stc.rb', line 182 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) frame = REXML::Element.new("#{obj_ns.prefix}:Frame") frame.text = self.frame el.add_element(frame) el.add_element(self.pole_zaxis.to_xml('Pole_Zaxis', obj_ns)) el.add_element(self.xaxis.to_xml('Xaxis', obj_ns)) collapse_namespaces(el) el end |