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.
@@ -1,32 +0,0 @@
1
- /*
2
- Line string methods for GEOS wrapper
3
- */
4
-
5
-
6
- #ifndef RGEO_GEOS_LINE_STRING_INCLUDED
7
- #define RGEO_GEOS_LINE_STRING_INCLUDED
8
-
9
- #include <ruby.h>
10
- #include <geos_c.h>
11
-
12
- #include "factory.h"
13
-
14
- RGEO_BEGIN_C
15
-
16
-
17
- /*
18
- Initializes the line string module. This should be called after
19
- the geometry module is initialized.
20
- */
21
- void rgeo_init_geos_line_string(RGeo_Globals* globals);
22
-
23
- /*
24
- Determines whether the given GEOS line string is closed.
25
- Returns Qtrue if true, Qfalse if false, or Qnil on an error.
26
- */
27
- VALUE rgeo_is_geos_line_string_closed(GEOSContextHandle_t context, const GEOSGeometry* geom);
28
-
29
-
30
- RGEO_END_C
31
-
32
- #endif
@@ -1,40 +0,0 @@
1
- /*
2
- Main initializer for GEOS wrapper
3
- */
4
-
5
-
6
- #include "preface.h"
7
-
8
- #ifdef RGEO_GEOS_SUPPORTED
9
-
10
- #include <ruby.h>
11
- #include <geos_c.h>
12
-
13
- #include "factory.h"
14
- #include "geometry.h"
15
- #include "point.h"
16
- #include "line_string.h"
17
- #include "polygon.h"
18
- #include "geometry_collection.h"
19
-
20
- #endif
21
-
22
- RGEO_BEGIN_C
23
-
24
-
25
- void Init_geos_c_impl()
26
- {
27
- #ifdef RGEO_GEOS_SUPPORTED
28
- RGeo_Globals* globals;
29
-
30
- globals = rgeo_init_geos_factory();
31
- rgeo_init_geos_geometry(globals);
32
- rgeo_init_geos_point(globals);
33
- rgeo_init_geos_line_string(globals);
34
- rgeo_init_geos_polygon(globals);
35
- rgeo_init_geos_geometry_collection(globals);
36
- #endif
37
- }
38
-
39
-
40
- RGEO_END_C
@@ -1,123 +0,0 @@
1
- find_executable: checking for geos-config... -------------------- yes
2
-
3
- --------------------
4
-
5
- have_header: checking for geos_c.h... -------------------- yes
6
-
7
- "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/Cellar/geos/3.5.0/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. -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 -L/usr/local/Cellar/geos/3.5.0/lib -lgeos_c -lruby-static -framework CoreFoundation -lpthread -lgmp -ldl -lobjc "
8
- checked program was:
9
- /* begin */
10
- 1: #include "ruby.h"
11
- 2:
12
- 3: int main(int argc, char **argv)
13
- 4: {
14
- 5: return 0;
15
- 6: }
16
- /* end */
17
-
18
- "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/Cellar/geos/3.5.0/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"
19
- checked program was:
20
- /* begin */
21
- 1: #include "ruby.h"
22
- 2:
23
- 3: #include <geos_c.h>
24
- /* end */
25
-
26
- --------------------
27
-
28
- have_func: checking for GEOSSetSRID_r() in geos_c.h... -------------------- yes
29
-
30
- "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/Cellar/geos/3.5.0/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. -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 -L/usr/local/Cellar/geos/3.5.0/lib -lgeos_c -lruby-static -framework CoreFoundation -L/usr/local/Cellar/geos/3.5.0/lib -lgeos_c -lpthread -lgmp -ldl -lobjc "
31
- checked program was:
32
- /* begin */
33
- 1: #include "ruby.h"
34
- 2:
35
- 3: #include <geos_c.h>
36
- 4:
37
- 5: /*top*/
38
- 6: extern int t(void);
39
- 7: int main(int argc, char **argv)
40
- 8: {
41
- 9: if (argc > 1000000) {
42
- 10: printf("%p", &t);
43
- 11: }
44
- 12:
45
- 13: return 0;
46
- 14: }
47
- 15: int t(void) { void ((*volatile p)()); p = (void ((*)()))GEOSSetSRID_r; return 0; }
48
- /* end */
49
-
50
- --------------------
51
-
52
- have_func: checking for GEOSPreparedContains_r() in geos_c.h... -------------------- yes
53
-
54
- "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/Cellar/geos/3.5.0/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. -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 -L/usr/local/Cellar/geos/3.5.0/lib -lgeos_c -lruby-static -framework CoreFoundation -L/usr/local/Cellar/geos/3.5.0/lib -lgeos_c -lpthread -lgmp -ldl -lobjc "
55
- checked program was:
56
- /* begin */
57
- 1: #include "ruby.h"
58
- 2:
59
- 3: #include <geos_c.h>
60
- 4:
61
- 5: /*top*/
62
- 6: extern int t(void);
63
- 7: int main(int argc, char **argv)
64
- 8: {
65
- 9: if (argc > 1000000) {
66
- 10: printf("%p", &t);
67
- 11: }
68
- 12:
69
- 13: return 0;
70
- 14: }
71
- 15: int t(void) { void ((*volatile p)()); p = (void ((*)()))GEOSPreparedContains_r; return 0; }
72
- /* end */
73
-
74
- --------------------
75
-
76
- have_func: checking for GEOSPreparedDisjoint_r() in geos_c.h... -------------------- yes
77
-
78
- "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/Cellar/geos/3.5.0/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. -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 -L/usr/local/Cellar/geos/3.5.0/lib -lgeos_c -lruby-static -framework CoreFoundation -L/usr/local/Cellar/geos/3.5.0/lib -lgeos_c -lpthread -lgmp -ldl -lobjc "
79
- checked program was:
80
- /* begin */
81
- 1: #include "ruby.h"
82
- 2:
83
- 3: #include <geos_c.h>
84
- 4:
85
- 5: /*top*/
86
- 6: extern int t(void);
87
- 7: int main(int argc, char **argv)
88
- 8: {
89
- 9: if (argc > 1000000) {
90
- 10: printf("%p", &t);
91
- 11: }
92
- 12:
93
- 13: return 0;
94
- 14: }
95
- 15: int t(void) { void ((*volatile p)()); p = (void ((*)()))GEOSPreparedDisjoint_r; return 0; }
96
- /* end */
97
-
98
- --------------------
99
-
100
- have_func: checking for rb_memhash() in ruby.h... -------------------- yes
101
-
102
- "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/Cellar/geos/3.5.0/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. -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 -L/usr/local/Cellar/geos/3.5.0/lib -lgeos_c -lruby-static -framework CoreFoundation -L/usr/local/Cellar/geos/3.5.0/lib -lgeos_c -lpthread -lgmp -ldl -lobjc "
103
- checked program was:
104
- /* begin */
105
- 1: #include "ruby.h"
106
- 2:
107
- 3: #include <ruby.h>
108
- 4:
109
- 5: /*top*/
110
- 6: extern int t(void);
111
- 7: int main(int argc, char **argv)
112
- 8: {
113
- 9: if (argc > 1000000) {
114
- 10: printf("%p", &t);
115
- 11: }
116
- 12:
117
- 13: return 0;
118
- 14: }
119
- 15: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_memhash; return 0; }
120
- /* end */
121
-
122
- --------------------
123
-
@@ -1,236 +0,0 @@
1
- /*
2
- Point methods for GEOS wrapper
3
- */
4
-
5
- #include "preface.h"
6
-
7
- #ifdef RGEO_GEOS_SUPPORTED
8
-
9
- #include <ruby.h>
10
- #include <geos_c.h>
11
-
12
- #include "factory.h"
13
- #include "geometry.h"
14
- #include "point.h"
15
-
16
- #include "coordinates.h"
17
-
18
- RGEO_BEGIN_C
19
-
20
-
21
- static VALUE method_point_geometry_type(VALUE self)
22
- {
23
- VALUE result;
24
- RGeo_GeometryData* self_data;
25
-
26
- result = Qnil;
27
- self_data = RGEO_GEOMETRY_DATA_PTR(self);
28
- if (self_data->geom) {
29
- result = RGEO_FACTORY_DATA_PTR(self_data->factory)->globals->feature_point;
30
- }
31
- return result;
32
- }
33
-
34
-
35
- static VALUE method_point_coordinates(VALUE self)
36
- {
37
- VALUE result = Qnil;
38
- RGeo_GeometryData* self_data;
39
- const GEOSGeometry* self_geom;
40
- GEOSContextHandle_t context;
41
- const GEOSCoordSequence* coord_sequence;
42
- int zCoordinate;
43
-
44
- self_data = RGEO_GEOMETRY_DATA_PTR(self);
45
- self_geom = self_data->geom;
46
-
47
- if (self_geom) {
48
- zCoordinate = RGEO_FACTORY_DATA_PTR(self_data->factory)->flags & RGEO_FACTORYFLAGS_SUPPORTS_Z_OR_M;
49
- context = self_data->geos_context;
50
- coord_sequence = GEOSGeom_getCoordSeq_r(context, self_geom);
51
- if(coord_sequence) {
52
- result = rb_ary_pop(extract_points_from_coordinate_sequence(context, coord_sequence, zCoordinate));
53
- }
54
- }
55
- return result;
56
- }
57
-
58
-
59
- static VALUE method_point_x(VALUE self)
60
- {
61
- VALUE result;
62
- RGeo_GeometryData* self_data;
63
- const GEOSGeometry* self_geom;
64
- GEOSContextHandle_t self_context;
65
- const GEOSCoordSequence* coord_seq;
66
- double val;
67
-
68
- result = Qnil;
69
- self_data = RGEO_GEOMETRY_DATA_PTR(self);
70
- self_geom = self_data->geom;
71
- if (self_geom) {
72
- self_context = self_data->geos_context;
73
- coord_seq = GEOSGeom_getCoordSeq_r(self_context, self_geom);
74
- if (coord_seq) {
75
- if (GEOSCoordSeq_getX_r(self_context, coord_seq, 0, &val)) {
76
- result = rb_float_new(val);
77
- }
78
- }
79
- }
80
- return result;
81
- }
82
-
83
-
84
- static VALUE method_point_y(VALUE self)
85
- {
86
- VALUE result;
87
- RGeo_GeometryData* self_data;
88
- const GEOSGeometry* self_geom;
89
- GEOSContextHandle_t self_context;
90
- const GEOSCoordSequence* coord_seq;
91
- double val;
92
-
93
- result = Qnil;
94
- self_data = RGEO_GEOMETRY_DATA_PTR(self);
95
- self_geom = self_data->geom;
96
- if (self_geom) {
97
- self_context = self_data->geos_context;
98
- coord_seq = GEOSGeom_getCoordSeq_r(self_context, self_geom);
99
- if (coord_seq) {
100
- if (GEOSCoordSeq_getY_r(self_context, coord_seq, 0, &val)) {
101
- result = rb_float_new(val);
102
- }
103
- }
104
- }
105
- return result;
106
- }
107
-
108
-
109
- static VALUE get_3d_point(VALUE self, int flag)
110
- {
111
- VALUE result;
112
- RGeo_GeometryData* self_data;
113
- const GEOSGeometry* self_geom;
114
- GEOSContextHandle_t self_context;
115
- const GEOSCoordSequence* coord_seq;
116
- double val;
117
-
118
- result = Qnil;
119
- self_data = RGEO_GEOMETRY_DATA_PTR(self);
120
- self_geom = self_data->geom;
121
- if (self_geom) {
122
- if (RGEO_FACTORY_DATA_PTR(self_data->factory)->flags & flag) {
123
- self_context = self_data->geos_context;
124
- coord_seq = GEOSGeom_getCoordSeq_r(self_context, self_geom);
125
- if (coord_seq) {
126
- if (GEOSCoordSeq_getZ_r(self_context, coord_seq, 0, &val)) {
127
- result = rb_float_new(val);
128
- }
129
- }
130
- }
131
- }
132
- return result;
133
- }
134
-
135
-
136
- static VALUE method_point_z(VALUE self)
137
- {
138
- return get_3d_point(self, RGEO_FACTORYFLAGS_SUPPORTS_Z);
139
- }
140
-
141
-
142
- static VALUE method_point_m(VALUE self)
143
- {
144
- return get_3d_point(self, RGEO_FACTORYFLAGS_SUPPORTS_M);
145
- }
146
-
147
-
148
- static VALUE method_point_eql(VALUE self, VALUE rhs)
149
- {
150
- VALUE result;
151
- RGeo_GeometryData* self_data;
152
-
153
- result = rgeo_geos_klasses_and_factories_eql(self, rhs);
154
- if (RTEST(result)) {
155
- self_data = RGEO_GEOMETRY_DATA_PTR(self);
156
- result = rgeo_geos_coordseqs_eql(self_data->geos_context, self_data->geom, RGEO_GEOMETRY_DATA_PTR(rhs)->geom, RGEO_FACTORY_DATA_PTR(self_data->factory)->flags & RGEO_FACTORYFLAGS_SUPPORTS_Z_OR_M);
157
- }
158
- return result;
159
- }
160
-
161
-
162
- static VALUE method_point_hash(VALUE self)
163
- {
164
- st_index_t hash;
165
- RGeo_GeometryData* self_data;
166
- VALUE factory;
167
-
168
- self_data = RGEO_GEOMETRY_DATA_PTR(self);
169
- factory = self_data->factory;
170
- hash = rb_hash_start(0);
171
- hash = rgeo_geos_objbase_hash(factory,
172
- RGEO_FACTORY_DATA_PTR(factory)->globals->feature_point, hash);
173
- hash = rgeo_geos_coordseq_hash(self_data->geos_context, self_data->geom, hash);
174
- return LONG2FIX(rb_hash_end(hash));
175
- }
176
-
177
-
178
- static VALUE cmethod_create(VALUE module, VALUE factory, VALUE x, VALUE y, VALUE z)
179
- {
180
- return rgeo_create_geos_point(factory, rb_num2dbl(x), rb_num2dbl(y),
181
- RGEO_FACTORY_DATA_PTR(factory)->flags & RGEO_FACTORYFLAGS_SUPPORTS_Z_OR_M ? rb_num2dbl(z) : 0);
182
- }
183
-
184
-
185
- void rgeo_init_geos_point(RGeo_Globals* globals)
186
- {
187
- VALUE geos_point_methods;
188
-
189
- // Class methods for CAPIPointImpl
190
- rb_define_module_function(globals->geos_point, "create", cmethod_create, 4);
191
-
192
- // CAPIPointMethods module
193
- geos_point_methods = rb_define_module_under(globals->geos_module, "CAPIPointMethods");
194
- rb_define_method(geos_point_methods, "rep_equals?", method_point_eql, 1);
195
- rb_define_method(geos_point_methods, "eql?", method_point_eql, 1);
196
- rb_define_method(geos_point_methods, "hash", method_point_hash, 0);
197
- rb_define_method(geos_point_methods, "geometry_type", method_point_geometry_type, 0);
198
- rb_define_method(geos_point_methods, "x", method_point_x, 0);
199
- rb_define_method(geos_point_methods, "y", method_point_y, 0);
200
- rb_define_method(geos_point_methods, "z", method_point_z, 0);
201
- rb_define_method(geos_point_methods, "m", method_point_m, 0);
202
- rb_define_method(geos_point_methods, "coordinates", method_point_coordinates, 0);
203
- }
204
-
205
-
206
- VALUE rgeo_create_geos_point(VALUE factory, double x, double y, double z)
207
- {
208
- VALUE result;
209
- RGeo_FactoryData* factory_data;
210
- GEOSContextHandle_t context;
211
- GEOSCoordSequence* coord_seq;
212
- GEOSGeometry* geom;
213
-
214
- result = Qnil;
215
- factory_data = RGEO_FACTORY_DATA_PTR(factory);
216
- context = factory_data->geos_context;
217
- coord_seq = GEOSCoordSeq_create_r(context, 1, 3);
218
- if (coord_seq) {
219
- if (GEOSCoordSeq_setX_r(context, coord_seq, 0, x)) {
220
- if (GEOSCoordSeq_setY_r(context, coord_seq, 0, y)) {
221
- if (GEOSCoordSeq_setZ_r(context, coord_seq, 0, z)) {
222
- geom = GEOSGeom_createPoint_r(context, coord_seq);
223
- if (geom) {
224
- result = rgeo_wrap_geos_geometry(factory, geom, factory_data->globals->geos_point);
225
- }
226
- }
227
- }
228
- }
229
- }
230
- return result;
231
- }
232
-
233
-
234
- RGEO_END_C
235
-
236
- #endif
@@ -1,30 +0,0 @@
1
- /*
2
- Point methods for GEOS wrapper
3
- */
4
-
5
-
6
- #ifndef RGEO_GEOS_POINT_INCLUDED
7
- #define RGEO_GEOS_POINT_INCLUDED
8
-
9
- #include <ruby.h>
10
-
11
- #include "factory.h"
12
-
13
- RGEO_BEGIN_C
14
-
15
-
16
- /*
17
- Initializes the point module. This should be called after
18
- the geometry module is initialized.
19
- */
20
- void rgeo_init_geos_point(RGeo_Globals* globals);
21
-
22
- /*
23
- Creates a 3d point and returns the ruby object.
24
- */
25
- VALUE rgeo_create_geos_point(VALUE factory, double x, double y, double z);
26
-
27
-
28
- RGEO_END_C
29
-
30
- #endif