Class: VORuby::Simple::Parameters::Size

Inherits:
Object
  • Object
show all
Defined in:
lib/voruby/simple/parameters.rb

Overview

Represents an angular size on the sky.

Instance Method Summary collapse

Constructor Details

#initialize(ra_width, dec_width = nil) ⇒ Size

Returns a new instance of Size.



106
107
108
109
110
111
112
113
114
# File 'lib/voruby/simple/parameters.rb', line 106

def initialize(ra_width, dec_width=nil)
 if dec_width == nil
   ra_width(ra_width)
   dec_width(ra_width)
 else
   ra_width(ra_width)
   dec_width(dec_width)
 end
end

Instance Method Details

#dec_width(dec_width = nil) ⇒ Object

Set or get the value of the declination width. The width is specified in decimal degrees.



128
129
130
131
132
133
134
# File 'lib/voruby/simple/parameters.rb', line 128

def dec_width(dec_width=nil)
 if dec_width == nil
	  return @dec_width
	else
	  @dec_width = dec_width.to_f()
	end
end

#ra_width(ra_width = nil) ⇒ Object

Set or get the value of the RA width. The width is specifed in decimal degrees.



118
119
120
121
122
123
124
# File 'lib/voruby/simple/parameters.rb', line 118

def ra_width(ra_width=nil)
 if ra_width == nil
   return @ra_width
 else
   @ra_width = ra_width.to_f()
 end
end

#to_sObject

Convert the size to its SIAP-compliant form.



137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/voruby/simple/parameters.rb', line 137

def to_s
	if @ra_width == @dec_width
	  # size = 0 is a special case--it test whether
	  # the given point is in an image.
	  if @ra_width == 0.0
	    return URI.escape("SIZE=0")
	  else
	    return URI.escape(sprintf("SIZE=%.4f", @ra_width))
	  end
	else
	  return URI.escape(sprintf("SIZE=%.4f,%.4f", @ra_width, @dec_width))
	end
end