Class: Proj4::ProjectionType

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

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


401
402
403
404
405
406
407
408
# File 'ext/projrb.c', line 401

static VALUE projection_type_list(VALUE self){
  struct PJ_LIST *pt;
  VALUE list = rb_ary_new();
  for (pt = pj_get_list_ref(); pt->id; pt++){
    rb_ary_push(list, Data_Wrap_Struct(cProjectionType, 0, 0, pt));
  }
  return list;
}

Instance Method Details

#descrObject

Get description of this projection type as a multiline string.

call-seq: descr -> String


424
425
426
427
428
# File 'ext/projrb.c', line 424

static VALUE projection_type_get_descr(VALUE self){
  struct PJ_LIST *pt;
  Data_Get_Struct(self,struct PJ_LIST,pt);
  return rb_str_new2(*(pt->descr));
}

#idObject

Get ID of this projection type.

call-seq: id -> String


414
415
416
417
418
# File 'ext/projrb.c', line 414

static VALUE projection_type_get_id(VALUE self){
  struct PJ_LIST *pt;
  Data_Get_Struct(self,struct PJ_LIST,pt);
  return rb_str_new2(pt->id);
}

#inspectObject

Returns a projection type as string in format ‘#<Proj4::PrimeMeridian id=“…”, name=“…”>’.

call-seq: inspect -> String



446
447
448
# File 'lib/proj4.rb', line 446

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

#nameObject

Gets name of this projection type.

call-seq: name -> String



454
455
456
# File 'lib/proj4.rb', line 454

def name
  descr.sub(/\n.*/m, '')
end