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


313
314
315
316
317
318
319
320
# File 'ext/projrb.c', line 313

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


346
347
348
349
350
# File 'ext/projrb.c', line 346

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


326
327
328
329
330
# File 'ext/projrb.c', line 326

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



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

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


336
337
338
339
340
# File 'ext/projrb.c', line 336

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


356
357
358
359
360
# File 'ext/projrb.c', line 356

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);
}