Class: Proj4::Ellipsoid

Inherits:
Def
  • Object
show all
Defined in:
lib/proj4.rb,
ext/projrb.c

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Def

#<=>, #==, get, #initialize, #to_s

Constructor Details

This class inherits a constructor from Proj4::Def

Class Method Details

.listObject

Return list of all reference ellipsoids we know about.

call-seq: list -> Array of Proj4::Ellipsoid


319
320
321
322
323
324
325
326
# File 'ext/projrb.c', line 319

static VALUE ellipsoid_list(VALUE self){
  struct PJ_ELLPS *el;
  VALUE list = rb_ary_new();
  for (el = pj_get_ellps_ref(); el->id; el++){
    rb_ary_push(list, Data_Wrap_Struct(cEllipsoid, 0, 0, el));
  }
  return list;
}

Instance Method Details

#ellObject

Get elliptical parameter of the reference ellipsoid. This is either the polar radius (semi-minor axis, b value) or the inverse flattening (1/f, rf).

call-seq: ell -> String


352
353
354
355
356
# File 'ext/projrb.c', line 352

static VALUE ellipsoid_get_ell(VALUE self){
  struct PJ_ELLPS *el;
  Data_Get_Struct(self,struct PJ_ELLPS,el);
  return rb_str_new2(el->ell);
}

#idObject

Get ID of the reference ellipsoid.

call-seq: id -> String


332
333
334
335
336
# File 'ext/projrb.c', line 332

static VALUE ellipsoid_get_id(VALUE self){
  struct PJ_ELLPS *el;
  Data_Get_Struct(self,struct PJ_ELLPS,el);
  return rb_str_new2(el->id);
}

#inspectObject

Returns ellipsoid definition as string in format ‘#<Proj4::Ellipsoid id=“…”, major=“…”, ell=“…”, name=“…”>’.

call-seq: inspect -> String



421
422
423
# File 'lib/proj4.rb', line 421

def inspect
  "#<Proj4::Ellipsoid id=\"#{id}\", major=\"#{major}\", ell=\"#{ell}\", name=\"#{name}\">"
end

#majorObject

Get equatorial radius (semi-major axis, a value) of the reference ellipsoid.

call-seq: major -> String


342
343
344
345
346
# File 'ext/projrb.c', line 342

static VALUE ellipsoid_get_major(VALUE self){
  struct PJ_ELLPS *el;
  Data_Get_Struct(self,struct PJ_ELLPS,el);
  return rb_str_new2(el->major);
}

#nameObject

Get name of the reference ellipsoid.

call-seq: name -> String


362
363
364
365
366
# File 'ext/projrb.c', line 362

static VALUE ellipsoid_get_name(VALUE self){
  struct PJ_ELLPS *el;
  Data_Get_Struct(self,struct PJ_ELLPS,el);
  return rb_str_new2(el->name);
}