rgeo 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/geos_c_impl/extconf.rb +12 -7
- data/lib/rgeo/version.rb +1 -1
- metadata +1 -26
- data/ext/geos_c_impl/Makefile_2.2.3 +0 -260
- data/ext/geos_c_impl/coordinates.c +0 -65
- data/ext/geos_c_impl/coordinates.h +0 -2
- data/ext/geos_c_impl/factory.c +0 -995
- data/ext/geos_c_impl/factory.h +0 -238
- data/ext/geos_c_impl/geometry.c +0 -1028
- data/ext/geos_c_impl/geometry.h +0 -23
- data/ext/geos_c_impl/geometry_collection.c +0 -757
- data/ext/geos_c_impl/geometry_collection.h +0 -46
- data/ext/geos_c_impl/geos_c_impl_2.2.3.bundle +0 -0
- data/ext/geos_c_impl/line_string.c +0 -675
- data/ext/geos_c_impl/line_string.h +0 -32
- data/ext/geos_c_impl/main.c +0 -40
- data/ext/geos_c_impl/mkmf.log +0 -123
- data/ext/geos_c_impl/point.c +0 -236
- data/ext/geos_c_impl/point.h +0 -30
- data/ext/geos_c_impl/polygon.c +0 -359
- data/ext/geos_c_impl/polygon.h +0 -43
- data/ext/geos_c_impl/preface.h +0 -38
- data/ext/proj4_c_impl/Makefile_2.2.3 +0 -260
- data/ext/proj4_c_impl/main.c +0 -315
- data/ext/proj4_c_impl/mkmf.log +0 -47
- data/ext/proj4_c_impl/proj4_c_impl_2.2.3.bundle +0 -0
- data/lib/rgeo/coord_sys/proj4_c_impl.bundle +0 -0
- data/lib/rgeo/geos/geos_c_impl.bundle +0 -0
data/ext/proj4_c_impl/main.c
DELETED
@@ -1,315 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Main initializer for Proj4 wrapper
|
3
|
-
*/
|
4
|
-
|
5
|
-
#ifdef HAVE_PROJ_API_H
|
6
|
-
#ifdef HAVE_PJ_INIT_PLUS
|
7
|
-
#define RGEO_PROJ4_SUPPORTED
|
8
|
-
#endif
|
9
|
-
#endif
|
10
|
-
|
11
|
-
#ifdef __cplusplus
|
12
|
-
#define RGEO_BEGIN_C extern "C" {
|
13
|
-
#define RGEO_END_C }
|
14
|
-
#else
|
15
|
-
#define RGEO_BEGIN_C
|
16
|
-
#define RGEO_END_C
|
17
|
-
#endif
|
18
|
-
|
19
|
-
|
20
|
-
#ifdef RGEO_PROJ4_SUPPORTED
|
21
|
-
|
22
|
-
#include <ruby.h>
|
23
|
-
#include <proj_api.h>
|
24
|
-
|
25
|
-
#endif
|
26
|
-
|
27
|
-
|
28
|
-
RGEO_BEGIN_C
|
29
|
-
|
30
|
-
|
31
|
-
#ifdef RGEO_PROJ4_SUPPORTED
|
32
|
-
|
33
|
-
|
34
|
-
typedef struct {
|
35
|
-
projPJ pj;
|
36
|
-
VALUE original_str;
|
37
|
-
char uses_radians;
|
38
|
-
} RGeo_Proj4Data;
|
39
|
-
|
40
|
-
|
41
|
-
#define RGEO_PROJ4_DATA_PTR(obj) ((RGeo_Proj4Data*)DATA_PTR(obj))
|
42
|
-
|
43
|
-
|
44
|
-
// Destroy function for proj data.
|
45
|
-
|
46
|
-
static void destroy_proj4_func(RGeo_Proj4Data* data)
|
47
|
-
{
|
48
|
-
if (data->pj) {
|
49
|
-
pj_free(data->pj);
|
50
|
-
}
|
51
|
-
free(data);
|
52
|
-
}
|
53
|
-
|
54
|
-
|
55
|
-
static void mark_proj4_func(RGeo_Proj4Data* data)
|
56
|
-
{
|
57
|
-
if (!NIL_P(data->original_str)) {
|
58
|
-
rb_gc_mark(data->original_str);
|
59
|
-
}
|
60
|
-
}
|
61
|
-
|
62
|
-
|
63
|
-
static VALUE alloc_proj4(VALUE klass)
|
64
|
-
{
|
65
|
-
VALUE result;
|
66
|
-
RGeo_Proj4Data* data;
|
67
|
-
|
68
|
-
result = Qnil;
|
69
|
-
data = ALLOC(RGeo_Proj4Data);
|
70
|
-
if (data) {
|
71
|
-
data->pj = NULL;
|
72
|
-
data->original_str = Qnil;
|
73
|
-
data->uses_radians = 0;
|
74
|
-
result = Data_Wrap_Struct(klass, mark_proj4_func, destroy_proj4_func, data);
|
75
|
-
}
|
76
|
-
return result;
|
77
|
-
}
|
78
|
-
|
79
|
-
|
80
|
-
static VALUE method_proj4_initialize_copy(VALUE self, VALUE orig)
|
81
|
-
{
|
82
|
-
RGeo_Proj4Data* self_data;
|
83
|
-
projPJ pj;
|
84
|
-
RGeo_Proj4Data* orig_data;
|
85
|
-
char* str;
|
86
|
-
|
87
|
-
// Clear out any existing value
|
88
|
-
self_data = RGEO_PROJ4_DATA_PTR(self);
|
89
|
-
pj = self_data->pj;
|
90
|
-
if (pj) {
|
91
|
-
pj_free(pj);
|
92
|
-
self_data->pj = NULL;
|
93
|
-
self_data->original_str = Qnil;
|
94
|
-
}
|
95
|
-
|
96
|
-
// Copy value from orig
|
97
|
-
orig_data = RGEO_PROJ4_DATA_PTR(orig);
|
98
|
-
if (!NIL_P(orig_data->original_str)) {
|
99
|
-
self_data->pj = pj_init_plus(RSTRING_PTR(orig_data->original_str));
|
100
|
-
}
|
101
|
-
else {
|
102
|
-
str = pj_get_def(orig_data->pj, 0);
|
103
|
-
self_data->pj = pj_init_plus(str);
|
104
|
-
pj_dalloc(str);
|
105
|
-
}
|
106
|
-
self_data->original_str = orig_data->original_str;
|
107
|
-
self_data->uses_radians = orig_data->uses_radians;
|
108
|
-
|
109
|
-
return self;
|
110
|
-
}
|
111
|
-
|
112
|
-
|
113
|
-
static VALUE method_proj4_set_value(VALUE self, VALUE str, VALUE uses_radians)
|
114
|
-
{
|
115
|
-
RGeo_Proj4Data* self_data;
|
116
|
-
projPJ pj;
|
117
|
-
|
118
|
-
Check_Type(str, T_STRING);
|
119
|
-
|
120
|
-
// Clear out any existing value
|
121
|
-
self_data = RGEO_PROJ4_DATA_PTR(self);
|
122
|
-
pj = self_data->pj;
|
123
|
-
if (pj) {
|
124
|
-
pj_free(pj);
|
125
|
-
self_data->pj = NULL;
|
126
|
-
self_data->original_str = Qnil;
|
127
|
-
}
|
128
|
-
|
129
|
-
// Set new data
|
130
|
-
self_data->pj = pj_init_plus(RSTRING_PTR(str));
|
131
|
-
self_data->original_str = str;
|
132
|
-
self_data->uses_radians = RTEST(uses_radians) ? 1 : 0;
|
133
|
-
|
134
|
-
return self;
|
135
|
-
}
|
136
|
-
|
137
|
-
|
138
|
-
static VALUE method_proj4_get_geographic(VALUE self)
|
139
|
-
{
|
140
|
-
VALUE result;
|
141
|
-
RGeo_Proj4Data* new_data;
|
142
|
-
RGeo_Proj4Data* self_data;
|
143
|
-
|
144
|
-
result = Qnil;
|
145
|
-
new_data = ALLOC(RGeo_Proj4Data);
|
146
|
-
if (new_data) {
|
147
|
-
self_data = RGEO_PROJ4_DATA_PTR(self);
|
148
|
-
new_data->pj = pj_latlong_from_proj(self_data->pj);
|
149
|
-
new_data->original_str = Qnil;
|
150
|
-
new_data->uses_radians = self_data->uses_radians;
|
151
|
-
result = Data_Wrap_Struct(CLASS_OF(self), mark_proj4_func, destroy_proj4_func, new_data);
|
152
|
-
}
|
153
|
-
return result;
|
154
|
-
}
|
155
|
-
|
156
|
-
|
157
|
-
static VALUE method_proj4_original_str(VALUE self)
|
158
|
-
{
|
159
|
-
return RGEO_PROJ4_DATA_PTR(self)->original_str;
|
160
|
-
}
|
161
|
-
|
162
|
-
|
163
|
-
static VALUE method_proj4_uses_radians(VALUE self)
|
164
|
-
{
|
165
|
-
return RGEO_PROJ4_DATA_PTR(self)->uses_radians ? Qtrue : Qfalse;
|
166
|
-
}
|
167
|
-
|
168
|
-
|
169
|
-
static VALUE method_proj4_canonical_str(VALUE self)
|
170
|
-
{
|
171
|
-
VALUE result;
|
172
|
-
projPJ pj;
|
173
|
-
char* str;
|
174
|
-
|
175
|
-
result = Qnil;
|
176
|
-
pj = RGEO_PROJ4_DATA_PTR(self)->pj;
|
177
|
-
if (pj) {
|
178
|
-
str = pj_get_def(pj, 0);
|
179
|
-
if (str) {
|
180
|
-
result = rb_str_new2(str);
|
181
|
-
pj_dalloc(str);
|
182
|
-
}
|
183
|
-
}
|
184
|
-
return result;
|
185
|
-
}
|
186
|
-
|
187
|
-
|
188
|
-
static VALUE method_proj4_is_geographic(VALUE self)
|
189
|
-
{
|
190
|
-
VALUE result;
|
191
|
-
projPJ pj;
|
192
|
-
|
193
|
-
result = Qnil;
|
194
|
-
pj = RGEO_PROJ4_DATA_PTR(self)->pj;
|
195
|
-
if (pj) {
|
196
|
-
result = pj_is_latlong(pj) ? Qtrue : Qfalse;
|
197
|
-
}
|
198
|
-
return result;
|
199
|
-
}
|
200
|
-
|
201
|
-
|
202
|
-
static VALUE method_proj4_is_geocentric(VALUE self)
|
203
|
-
{
|
204
|
-
VALUE result;
|
205
|
-
projPJ pj;
|
206
|
-
|
207
|
-
result = Qnil;
|
208
|
-
pj = RGEO_PROJ4_DATA_PTR(self)->pj;
|
209
|
-
if (pj) {
|
210
|
-
result = pj_is_geocent(pj) ? Qtrue : Qfalse;
|
211
|
-
}
|
212
|
-
return result;
|
213
|
-
}
|
214
|
-
|
215
|
-
|
216
|
-
static VALUE method_proj4_is_valid(VALUE self)
|
217
|
-
{
|
218
|
-
return RGEO_PROJ4_DATA_PTR(self)->pj ? Qtrue : Qfalse;
|
219
|
-
}
|
220
|
-
|
221
|
-
|
222
|
-
static VALUE cmethod_proj4_version(VALUE module)
|
223
|
-
{
|
224
|
-
return INT2NUM(PJ_VERSION);
|
225
|
-
}
|
226
|
-
|
227
|
-
|
228
|
-
static VALUE cmethod_proj4_transform(VALUE module, VALUE from, VALUE to, VALUE x, VALUE y, VALUE z)
|
229
|
-
{
|
230
|
-
VALUE result;
|
231
|
-
projPJ from_pj;
|
232
|
-
projPJ to_pj;
|
233
|
-
double xval, yval, zval;
|
234
|
-
int err;
|
235
|
-
|
236
|
-
result = Qnil;
|
237
|
-
from_pj = RGEO_PROJ4_DATA_PTR(from)->pj;
|
238
|
-
to_pj = RGEO_PROJ4_DATA_PTR(to)->pj;
|
239
|
-
if (from_pj && to_pj) {
|
240
|
-
xval = rb_num2dbl(x);
|
241
|
-
yval = rb_num2dbl(y);
|
242
|
-
zval = 0.0;
|
243
|
-
if (!NIL_P(z)) {
|
244
|
-
zval = rb_num2dbl(z);
|
245
|
-
}
|
246
|
-
err = pj_transform(from_pj, to_pj, 1, 1, &xval, &yval, NIL_P(z) ? NULL : &zval);
|
247
|
-
if (!err && xval != HUGE_VAL && yval != HUGE_VAL && (NIL_P(z) || zval != HUGE_VAL)) {
|
248
|
-
result = rb_ary_new2(NIL_P(z) ? 2 : 3);
|
249
|
-
rb_ary_push(result, rb_float_new(xval));
|
250
|
-
rb_ary_push(result, rb_float_new(yval));
|
251
|
-
if (!NIL_P(z)) {
|
252
|
-
rb_ary_push(result, rb_float_new(zval));
|
253
|
-
}
|
254
|
-
}
|
255
|
-
}
|
256
|
-
return result;
|
257
|
-
}
|
258
|
-
|
259
|
-
|
260
|
-
static VALUE cmethod_proj4_create(VALUE klass, VALUE str, VALUE uses_radians)
|
261
|
-
{
|
262
|
-
VALUE result;
|
263
|
-
RGeo_Proj4Data* data;
|
264
|
-
|
265
|
-
result = Qnil;
|
266
|
-
Check_Type(str, T_STRING);
|
267
|
-
data = ALLOC(RGeo_Proj4Data);
|
268
|
-
if (data) {
|
269
|
-
data->pj = pj_init_plus(RSTRING_PTR(str));
|
270
|
-
data->original_str = str;
|
271
|
-
data->uses_radians = RTEST(uses_radians) ? 1 : 0;
|
272
|
-
result = Data_Wrap_Struct(klass, mark_proj4_func, destroy_proj4_func, data);
|
273
|
-
}
|
274
|
-
return result;
|
275
|
-
}
|
276
|
-
|
277
|
-
|
278
|
-
static void rgeo_init_proj4()
|
279
|
-
{
|
280
|
-
VALUE rgeo_module;
|
281
|
-
VALUE coordsys_module;
|
282
|
-
VALUE proj4_class;
|
283
|
-
|
284
|
-
rgeo_module = rb_define_module("RGeo");
|
285
|
-
coordsys_module = rb_define_module_under(rgeo_module, "CoordSys");
|
286
|
-
proj4_class = rb_define_class_under(coordsys_module, "Proj4", rb_cObject);
|
287
|
-
|
288
|
-
rb_define_alloc_func(proj4_class, alloc_proj4);
|
289
|
-
rb_define_module_function(proj4_class, "_create", cmethod_proj4_create, 2);
|
290
|
-
rb_define_method(proj4_class, "initialize_copy", method_proj4_initialize_copy, 1);
|
291
|
-
rb_define_method(proj4_class, "_set_value", method_proj4_set_value, 2);
|
292
|
-
rb_define_method(proj4_class, "_original_str", method_proj4_original_str, 0);
|
293
|
-
rb_define_method(proj4_class, "_canonical_str", method_proj4_canonical_str, 0);
|
294
|
-
rb_define_method(proj4_class, "_valid?", method_proj4_is_valid, 0);
|
295
|
-
rb_define_method(proj4_class, "_geographic?", method_proj4_is_geographic, 0);
|
296
|
-
rb_define_method(proj4_class, "_geocentric?", method_proj4_is_geocentric, 0);
|
297
|
-
rb_define_method(proj4_class, "_radians?", method_proj4_uses_radians, 0);
|
298
|
-
rb_define_method(proj4_class, "_get_geographic", method_proj4_get_geographic, 0);
|
299
|
-
rb_define_module_function(proj4_class, "_transform_coords", cmethod_proj4_transform, 5);
|
300
|
-
rb_define_module_function(proj4_class, "_proj_version", cmethod_proj4_version, 0);
|
301
|
-
}
|
302
|
-
|
303
|
-
|
304
|
-
#endif
|
305
|
-
|
306
|
-
|
307
|
-
void Init_proj4_c_impl()
|
308
|
-
{
|
309
|
-
#ifdef RGEO_PROJ4_SUPPORTED
|
310
|
-
rgeo_init_proj4();
|
311
|
-
#endif
|
312
|
-
}
|
313
|
-
|
314
|
-
|
315
|
-
RGEO_END_C
|
data/ext/proj4_c_impl/mkmf.log
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
have_header: checking for proj_api.h... -------------------- yes
|
2
|
-
|
3
|
-
"clang -o conftest -I/Users/tee/.rubies/ruby-2.2.3/include/ruby-2.2.0/x86_64-darwin14 -I/Users/tee/.rubies/ruby-2.2.3/include/ruby-2.2.0/ruby/backward -I/Users/tee/.rubies/ruby-2.2.3/include/ruby-2.2.0 -I. -I/usr/local/include -I/Library/Frameworks/PROJ.framework/unix/include -I/usr/include -I/Users/tee/.rubies/ruby-2.2.3/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -pipe conftest.c -L/Users/tee/.rubies/ruby-2.2.3/lib -L/usr/local/lib -L/Library/Frameworks/PROJ.framework/unix/lib -L/usr/lib -L. -L/Users/tee/.rubies/ruby-2.2.3/lib -L. -L/Users/tee/.rubies/ruby-2.2.3/lib -fstack-protector -L/usr/local/lib -lruby-static -framework CoreFoundation -lpthread -lgmp -ldl -lobjc "
|
4
|
-
checked program was:
|
5
|
-
/* begin */
|
6
|
-
1: #include "ruby.h"
|
7
|
-
2:
|
8
|
-
3: int main(int argc, char **argv)
|
9
|
-
4: {
|
10
|
-
5: return 0;
|
11
|
-
6: }
|
12
|
-
/* end */
|
13
|
-
|
14
|
-
"clang -E -I/Users/tee/.rubies/ruby-2.2.3/include/ruby-2.2.0/x86_64-darwin14 -I/Users/tee/.rubies/ruby-2.2.3/include/ruby-2.2.0/ruby/backward -I/Users/tee/.rubies/ruby-2.2.3/include/ruby-2.2.0 -I. -I/usr/local/include -I/Library/Frameworks/PROJ.framework/unix/include -I/usr/include -I/Users/tee/.rubies/ruby-2.2.3/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -pipe conftest.c -o conftest.i"
|
15
|
-
checked program was:
|
16
|
-
/* begin */
|
17
|
-
1: #include "ruby.h"
|
18
|
-
2:
|
19
|
-
3: #include <proj_api.h>
|
20
|
-
/* end */
|
21
|
-
|
22
|
-
--------------------
|
23
|
-
|
24
|
-
have_func: checking for pj_init_plus() in proj_api.h... -------------------- yes
|
25
|
-
|
26
|
-
"clang -o conftest -I/Users/tee/.rubies/ruby-2.2.3/include/ruby-2.2.0/x86_64-darwin14 -I/Users/tee/.rubies/ruby-2.2.3/include/ruby-2.2.0/ruby/backward -I/Users/tee/.rubies/ruby-2.2.3/include/ruby-2.2.0 -I. -I/usr/local/include -I/Library/Frameworks/PROJ.framework/unix/include -I/usr/include -I/Users/tee/.rubies/ruby-2.2.3/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -pipe conftest.c -L/Users/tee/.rubies/ruby-2.2.3/lib -L/usr/local/lib -L/Library/Frameworks/PROJ.framework/unix/lib -L/usr/lib -L. -L/Users/tee/.rubies/ruby-2.2.3/lib -L. -L/Users/tee/.rubies/ruby-2.2.3/lib -fstack-protector -L/usr/local/lib -lproj -lruby-static -framework CoreFoundation -lproj -lpthread -lgmp -ldl -lobjc "
|
27
|
-
checked program was:
|
28
|
-
/* begin */
|
29
|
-
1: #include "ruby.h"
|
30
|
-
2:
|
31
|
-
3: #include <proj_api.h>
|
32
|
-
4:
|
33
|
-
5: /*top*/
|
34
|
-
6: extern int t(void);
|
35
|
-
7: int main(int argc, char **argv)
|
36
|
-
8: {
|
37
|
-
9: if (argc > 1000000) {
|
38
|
-
10: printf("%p", &t);
|
39
|
-
11: }
|
40
|
-
12:
|
41
|
-
13: return 0;
|
42
|
-
14: }
|
43
|
-
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))pj_init_plus; return 0; }
|
44
|
-
/* end */
|
45
|
-
|
46
|
-
--------------------
|
47
|
-
|
Binary file
|
Binary file
|
Binary file
|