Class: Lambert::LambertPoint

Inherits:
Object
  • Object
show all
Defined in:
ext/lambert_ruby/lambert_ruby.c

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'ext/lambert_ruby/lambert_ruby.c', line 7

static VALUE p_init(int argc, VALUE* argv, VALUE self)
{

  VALUE x, y, z;

  rb_scan_args(argc,argv, "21",&x, &y, &z);

  if(NIL_P(z))
  {
  	z = rb_float_new(0.0);
  }

  Check_Type(x,T_FLOAT);
  Check_Type(y,T_FLOAT);
  Check_Type(z,T_FLOAT);

  rb_iv_set(self, "@x", x);
  rb_iv_set(self, "@y", y);
  rb_iv_set(self, "@z", z);

  return self;
}

Instance Attribute Details

#xObject

#yObject

#zObject

Instance Method Details

#wgs84(zone) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'ext/lambert_ruby/lambert_ruby.c', line 30

static VALUE p_convert(VALUE self,VALUE zone){

	double x, y, z;
	YGLambertZone cZone = NUM2INT(zone);

	x = NUM2DBL(rb_iv_get(self,"@x"));
	y = NUM2DBL(rb_iv_get(self,"@y"));
	z = NUM2DBL(rb_iv_get(self,"@z"));

	YGPoint org = YGMeterPoint(x,y,z);
	org = YGPointConvertWGS84(org,cZone);
	org = YGPointToDegree(org);

   rb_iv_set(self, "@x", rb_float_new(org.x));
   rb_iv_set(self, "@y", rb_float_new(org.y));
   rb_iv_set(self, "@z", rb_float_new(org.z));


	return Qnil;
}