Class: Proj4::Datum

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 datums we know about.

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


265
266
267
268
269
270
271
272
# File 'ext/projrb.c', line 265

static VALUE datum_list(VALUE self){
  struct PJ_DATUMS *datum;
  VALUE list = rb_ary_new();
  for (datum = pj_get_datums_ref(); datum->id; datum++){
    rb_ary_push(list, Data_Wrap_Struct(cDatum, 0, 0, datum));
  }
  return list;
}

Instance Method Details

#commentsObject

Get comments about the datum.

call-seq: comments -> String


308
309
310
311
312
# File 'ext/projrb.c', line 308

static VALUE datum_get_comments(VALUE self){
  struct PJ_DATUMS *datum;
  Data_Get_Struct(self,struct PJ_DATUMS,datum);
  return rb_str_new2(datum->comments);
}

#defnObject

Get definition of the datum.

call-seq: defn -> String


298
299
300
301
302
# File 'ext/projrb.c', line 298

static VALUE datum_get_defn(VALUE self){
  struct PJ_DATUMS *datum;
  Data_Get_Struct(self,struct PJ_DATUMS,datum);
  return rb_str_new2(datum->defn);
}

#ellipse_idObject

Get ID of the ellipse used by the datum.

call-seq: ellipse_id -> String


288
289
290
291
292
# File 'ext/projrb.c', line 288

static VALUE datum_get_ellipse_id(VALUE self){
  struct PJ_DATUMS *datum;
  Data_Get_Struct(self,struct PJ_DATUMS,datum);
  return rb_str_new2(datum->ellipse_id);
}

#idObject

Get ID of the datum.

call-seq: id -> String


278
279
280
281
282
# File 'ext/projrb.c', line 278

static VALUE datum_get_id(VALUE self){
  struct PJ_DATUMS *datum;
  Data_Get_Struct(self,struct PJ_DATUMS,datum);
  return rb_str_new2(datum->id);
}

#inspectObject

Returns datum definition as string in format ‘#<Proj4::Datum id=“…”, ellipse_id=“…”, defn=“…”, comments=“…”>’.

call-seq: inspect -> String



409
410
411
# File 'lib/proj4.rb', line 409

def inspect
  "#<Proj4::Datum id=\"#{id}\", ellipse_id=\"#{ellipse_id}\", defn=\"#{defn}\", comments=\"#{comments}\">"
end