Class: VORuby::STC::V1_30::AstroCoordsFileType

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

Overview

Coordinate references to a specific FITS file.

Instance Attribute Summary collapse

Attributes inherited from CoordinateType

#frame_id, #name

Attributes included from STCReference

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CoordinateType

coordinate_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(fits_file, options = {}) ⇒ AstroCoordsFileType

Returns a new instance of AstroCoordsFileType.



3230
3231
3232
3233
# File 'lib/voruby/stc/1.30/stc.rb', line 3230

def initialize(fits_file, options={})
  self.fits_file = fits_file
  super(options)
end

Instance Attribute Details

#fits_fileObject

Returns the value of attribute fits_file.



3227
3228
3229
# File 'lib/voruby/stc/1.30/stc.rb', line 3227

def fits_file
  @fits_file
end

#fits_positionObject

Returns the value of attribute fits_position.



3227
3228
3229
# File 'lib/voruby/stc/1.30/stc.rb', line 3227

def fits_position
  @fits_position
end

#fits_redshiftObject

Returns the value of attribute fits_redshift.



3227
3228
3229
# File 'lib/voruby/stc/1.30/stc.rb', line 3227

def fits_redshift
  @fits_redshift
end

#fits_spectralObject

Returns the value of attribute fits_spectral.



3227
3228
3229
# File 'lib/voruby/stc/1.30/stc.rb', line 3227

def fits_spectral
  @fits_spectral
end

#fits_timeObject

Returns the value of attribute fits_time.



3227
3228
3229
# File 'lib/voruby/stc/1.30/stc.rb', line 3227

def fits_time
  @fits_time
end

#fits_velocityObject

Returns the value of attribute fits_velocity.



3227
3228
3229
# File 'lib/voruby/stc/1.30/stc.rb', line 3227

def fits_velocity
  @fits_velocity
end

Class Method Details

.from_xml(xml) ⇒ Object



3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
# File 'lib/voruby/stc/1.30/stc.rb', line 3289

def self.from_xml(xml)
  root = element_from(xml)
  
  options = CoordinateType.coordinate_from_xml(root)
  
  time = REXML::XPath.first(root, 'x:FITSTime', {'x' => obj_ns.uri})
  options[:fits_time] = CoordFITSColumnsType.from_xml(time) if time
  
  pos = REXML::XPath.first(root, 'x:FITSPosition', {'x' => obj_ns.uri})
  options[:fits_position] = CoordFITSColumnsType.from_xml(pos) if pos
  
  vel = REXML::XPath.first(root, 'x:FITSVelocity', {'x' => obj_ns.uri})
  options[:fits_velocity] = CoordFITSColumnsType.from_xml(vel) if vel
  
  spec = REXML::XPath.first(root, 'x:FITSSpectral', {'x' => obj_ns.uri})
  options[:fits_spectral] = CoordFITSColumnsType.from_xml(spec) if spec
  
  red = REXML::XPath.first(root, 'x:FITSRedshift', {'x' => obj_ns.uri})
  options[:fits_redshift] = CoordFITSColumnsType.from_xml(red) if red
  
  self.new(
    FitsType.from_xml(REXML::XPath.first(root, 'x:FITSFile', {'x' => obj_ns.uri})),
    options
  )
end

Instance Method Details

#==(f) ⇒ Object



3266
3267
3268
3269
3270
3271
3272
3273
3274
# File 'lib/voruby/stc/1.30/stc.rb', line 3266

def ==(f)
  super(f) and
  self.fits_file == f.fits_file and
  self.fits_time == f.fits_time and
  self.fits_position == f.fits_position and
  self.fits_velocity == f.fits_velocity and
  self.fits_spectral == f.fits_spectral and
  self.fits_redshift == f.fits_redshift
end

#to_xml(name = nil) ⇒ Object



3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
# File 'lib/voruby/stc/1.30/stc.rb', line 3276

def to_xml(name=nil)
  el = super(name)
  
  el.add_element(self.fits_file.to_xml('FITSFile'))
  el.add_element(self.fits_time.to_xml('FITSTime')) if self.fits_time
  el.add_element(self.fits_position.to_xml('FITSPosition')) if self.fits_position
  el.add_element(self.fits_velocity.to_xml('FITSVelocity')) if self.fits_velocity
  el.add_element(self.fits_spectral.to_xml('FITSSpectral')) if self.fits_spectral
  el.add_element(self.fits_redshift.to_xml('FITSRedshift')) if self.fits_redshift
  
  el
end