rgeo 3.0.0.pre.rc.3 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -3
- data/ext/geos_c_impl/extconf.rb +1 -0
- data/ext/geos_c_impl/factory.c +43 -5
- data/ext/geos_c_impl/factory.h +13 -2
- data/ext/geos_c_impl/geometry.c +178 -122
- data/ext/geos_c_impl/geometry_collection.c +17 -19
- data/ext/geos_c_impl/line_string.c +46 -36
- data/ext/geos_c_impl/point.c +0 -2
- data/ext/geos_c_impl/polygon.c +10 -11
- data/ext/geos_c_impl/polygon.h +1 -1
- data/ext/geos_c_impl/preface.h +3 -0
- data/ext/geos_c_impl/ruby_more.c +7 -0
- data/ext/geos_c_impl/ruby_more.h +8 -0
- data/lib/rgeo/cartesian/analysis.rb +5 -3
- data/lib/rgeo/cartesian/bounding_box.rb +74 -79
- data/lib/rgeo/cartesian/calculations.rb +20 -26
- data/lib/rgeo/cartesian/factory.rb +47 -49
- data/lib/rgeo/cartesian/planar_graph.rb +10 -16
- data/lib/rgeo/cartesian/sweepline_intersector.rb +1 -3
- data/lib/rgeo/cartesian/valid_op.rb +1 -3
- data/lib/rgeo/coord_sys/cs/entities.rb +91 -101
- data/lib/rgeo/coord_sys/cs/factories.rb +0 -2
- data/lib/rgeo/coord_sys/cs/wkt_parser.rb +70 -29
- data/lib/rgeo/feature/curve.rb +0 -1
- data/lib/rgeo/feature/factory.rb +25 -27
- data/lib/rgeo/feature/factory_generator.rb +3 -4
- data/lib/rgeo/feature/geometry.rb +41 -30
- data/lib/rgeo/feature/geometry_collection.rb +3 -4
- data/lib/rgeo/feature/line_string.rb +1 -2
- data/lib/rgeo/feature/linear_ring.rb +0 -1
- data/lib/rgeo/feature/multi_curve.rb +0 -1
- data/lib/rgeo/feature/multi_surface.rb +0 -1
- data/lib/rgeo/feature/point.rb +0 -1
- data/lib/rgeo/feature/polygon.rb +1 -2
- data/lib/rgeo/feature/surface.rb +0 -1
- data/lib/rgeo/feature/types.rb +69 -85
- data/lib/rgeo/geographic/factory.rb +87 -80
- data/lib/rgeo/geographic/interface.rb +44 -27
- data/lib/rgeo/geographic/projected_feature_methods.rb +2 -6
- data/lib/rgeo/geographic/projected_window.rb +35 -21
- data/lib/rgeo/geographic/simple_mercator_projector.rb +27 -15
- data/lib/rgeo/geographic/spherical_feature_methods.rb +8 -3
- data/lib/rgeo/geographic/spherical_math.rb +17 -20
- data/lib/rgeo/geos/capi_factory.rb +50 -50
- data/lib/rgeo/geos/ffi_factory.rb +50 -49
- data/lib/rgeo/geos/ffi_feature_methods.rb +72 -98
- data/lib/rgeo/geos/interface.rb +16 -16
- data/lib/rgeo/geos/utils.rb +5 -5
- data/lib/rgeo/geos/zm_factory.rb +50 -42
- data/lib/rgeo/geos/zm_feature_methods.rb +15 -9
- data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +4 -4
- data/lib/rgeo/impl_helper/basic_geometry_methods.rb +1 -2
- data/lib/rgeo/impl_helper/basic_line_string_methods.rb +18 -24
- data/lib/rgeo/impl_helper/basic_point_methods.rb +1 -3
- data/lib/rgeo/impl_helper/basic_polygon_methods.rb +15 -16
- data/lib/rgeo/impl_helper/utils.rb +3 -9
- data/lib/rgeo/impl_helper/valid_op.rb +12 -16
- data/lib/rgeo/version.rb +1 -1
- data/lib/rgeo/wkrep/wkb_generator.rb +42 -47
- data/lib/rgeo/wkrep/wkb_parser.rb +17 -18
- data/lib/rgeo/wkrep/wkt_generator.rb +23 -16
- data/lib/rgeo/wkrep/wkt_parser.rb +23 -13
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 792e1494e9ef340bb740e8675b2ce67e4d02fa6c4333ad93c523e348e5153812
|
4
|
+
data.tar.gz: a4051c1728401caca45807c9e786a5e5130761c95a95ff6bdb60265130aa2049
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a6ee8000fd92f7bef89915d9d7e11aea0fb413248778d0f5e5218516d98cc6d16afba66d92c670c9f0539d37a6c7e934a5fcc3ad839626d7299b7c5ae8ffc57
|
7
|
+
data.tar.gz: 580f0a56261c8ab5698e14a78e7f61bcdb8fa362160db4ed1662dbb792d1d8ec7272a1e3387568b00c6b8403547aae128363ad230cf622ec5b5908a0e17b8d6f
|
data/README.md
CHANGED
@@ -5,11 +5,10 @@
|
|
5
5
|
|
6
6
|
RGeo is a geospatial data library for Ruby.
|
7
7
|
|
8
|
-
|
8
|
+
***Contributors Wanted!***
|
9
9
|
|
10
|
-
|
10
|
+
If you use RGeo and are interested in contributing, please check out our [open issues](https://github.com/rgeo/rgeo/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22%2C%22help+wanted%22) to see if there's anything you're able to help with.
|
11
11
|
|
12
|
-
:warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning::warning:
|
13
12
|
|
14
13
|
### Summary
|
15
14
|
|
@@ -74,6 +73,14 @@ If you are using proj.4 extensions, include
|
|
74
73
|
gem "rgeo-proj4"
|
75
74
|
```
|
76
75
|
|
76
|
+
### Upgrading to Version 3.0
|
77
|
+
|
78
|
+
See [doc/Upgrading-to-v3.md](doc/Upgrading-to-v3.md) for a checklist of changes to make before upgrading to RGeo 3.0.
|
79
|
+
|
80
|
+
For a brief overview of the changes, see [NEWS.md](NEWS.md).
|
81
|
+
|
82
|
+
For a comprehensive list of all changes, see [History.md](History.md).
|
83
|
+
|
77
84
|
|
78
85
|
### Extensions
|
79
86
|
|
@@ -130,6 +137,7 @@ Here's the current list of available topics:
|
|
130
137
|
- [Factory Compatibility](https://github.com/rgeo/rgeo/blob/main/doc/Factory-Compatibility.md)
|
131
138
|
- [Which factory should I use?](https://github.com/rgeo/rgeo/blob/main/doc/Which-factory-should-I-use.md)
|
132
139
|
- [Geometry validity handling](https://github.com/rgeo/rgeo/blob/main/doc/Geometry-Validity.md)
|
140
|
+
- [Upgrading to Version 3](https://github.com/rgeo/rgeo/blob/main/doc/Upgrading-to-v3.md)
|
133
141
|
- [Examples](https://github.com/rgeo/rgeo/blob/main/doc/Examples.md)
|
134
142
|
- [Who uses `rgeo`?](https://github.com/rgeo/rgeo/blob/main/doc/Gallery.md)
|
135
143
|
|
data/ext/geos_c_impl/extconf.rb
CHANGED
@@ -45,6 +45,7 @@ if have_header("geos_c.h")
|
|
45
45
|
have_func("GEOSPreparedDisjoint_r", "geos_c.h")
|
46
46
|
have_func("GEOSUnaryUnion_r", "geos_c.h")
|
47
47
|
have_func("GEOSCoordSeq_isCCW_r", "geos_c.h")
|
48
|
+
have_func("GEOSDensify", "geos_c.h")
|
48
49
|
have_func("rb_memhash", "ruby.h")
|
49
50
|
have_func("rb_gc_mark_movable", "ruby.h")
|
50
51
|
end
|
data/ext/geos_c_impl/factory.c
CHANGED
@@ -378,6 +378,7 @@ method_factory_write_for_marshal(VALUE self, VALUE obj)
|
|
378
378
|
wkb_writer = self_data->marshal_wkb_writer;
|
379
379
|
if (!wkb_writer) {
|
380
380
|
wkb_writer = GEOSWKBWriter_create();
|
381
|
+
GEOSWKBWriter_setOutputDimension(wkb_writer, 2);
|
381
382
|
if (has_3d) {
|
382
383
|
GEOSWKBWriter_setOutputDimension(wkb_writer, 3);
|
383
384
|
}
|
@@ -427,6 +428,7 @@ method_factory_write_for_psych(VALUE self, VALUE obj)
|
|
427
428
|
wkt_writer = self_data->psych_wkt_writer;
|
428
429
|
if (!wkt_writer) {
|
429
430
|
wkt_writer = GEOSWKTWriter_create();
|
431
|
+
GEOSWKTWriter_setOutputDimension(wkt_writer, 2);
|
430
432
|
GEOSWKTWriter_setTrim(wkt_writer, 1);
|
431
433
|
if (has_3d) {
|
432
434
|
GEOSWKTWriter_setOutputDimension(wkt_writer, 3);
|
@@ -820,7 +822,7 @@ rgeo_wrap_geos_geometry_clone(VALUE factory,
|
|
820
822
|
}
|
821
823
|
|
822
824
|
const GEOSGeometry*
|
823
|
-
rgeo_convert_to_geos_geometry(VALUE factory, VALUE obj, VALUE type)
|
825
|
+
rgeo_convert_to_geos_geometry(VALUE factory, VALUE obj, VALUE type, int* state)
|
824
826
|
{
|
825
827
|
VALUE object;
|
826
828
|
|
@@ -831,10 +833,28 @@ rgeo_convert_to_geos_geometry(VALUE factory, VALUE obj, VALUE type)
|
|
831
833
|
object =
|
832
834
|
rb_funcall(rgeo_feature_module, rb_intern("cast"), 3, obj, factory, type);
|
833
835
|
}
|
834
|
-
if (NIL_P(object))
|
836
|
+
if (NIL_P(object)) {
|
837
|
+
rb_protect(
|
838
|
+
rb_exc_raise_value,
|
839
|
+
rb_exc_new_cstr(rb_eRGeoInvalidGeometry,
|
840
|
+
"Unable to cast the geometry to the GEOS Factory"),
|
841
|
+
state);
|
842
|
+
}
|
843
|
+
|
844
|
+
if (*state) {
|
845
|
+
return NULL;
|
846
|
+
}
|
847
|
+
|
848
|
+
if (!rgeo_is_geos_object(object)) {
|
849
|
+
rb_protect(rb_exc_raise_value,
|
850
|
+
rb_exc_new_cstr(rb_eRGeoError, "Not a GEOS Geometry object."),
|
851
|
+
state);
|
852
|
+
}
|
853
|
+
|
854
|
+
if (*state) {
|
835
855
|
return NULL;
|
856
|
+
}
|
836
857
|
|
837
|
-
Check_TypedStruct(object, &rgeo_geometry_type);
|
838
858
|
return RGEO_GEOMETRY_DATA_PTR(object)->geom;
|
839
859
|
}
|
840
860
|
|
@@ -849,6 +869,7 @@ rgeo_convert_to_detached_geos_geometry(VALUE obj,
|
|
849
869
|
GEOSGeometry* geom;
|
850
870
|
RGeo_GeometryData* object_data;
|
851
871
|
const GEOSPreparedGeometry* prep;
|
872
|
+
|
852
873
|
if (klasses) {
|
853
874
|
*klasses = Qnil;
|
854
875
|
}
|
@@ -862,7 +883,24 @@ rgeo_convert_to_detached_geos_geometry(VALUE obj,
|
|
862
883
|
type,
|
863
884
|
ID2SYM(rb_intern("force_new")),
|
864
885
|
ID2SYM(rb_intern("keep_subtype")));
|
865
|
-
|
886
|
+
|
887
|
+
if (NIL_P(object)) {
|
888
|
+
rb_protect(
|
889
|
+
rb_exc_raise_value,
|
890
|
+
rb_exc_new_cstr(rb_eRGeoInvalidGeometry,
|
891
|
+
"Unable to cast the geometry to the GEOS Factory"),
|
892
|
+
state);
|
893
|
+
}
|
894
|
+
if (*state) {
|
895
|
+
return NULL;
|
896
|
+
}
|
897
|
+
|
898
|
+
if (!rgeo_is_geos_object(object)) {
|
899
|
+
rb_protect(rb_exc_raise_value,
|
900
|
+
rb_exc_new_cstr(rb_eRGeoError, "Not a GEOS Geometry object."),
|
901
|
+
state);
|
902
|
+
}
|
903
|
+
if (*state) {
|
866
904
|
return NULL;
|
867
905
|
}
|
868
906
|
|
@@ -1023,7 +1061,7 @@ rgeo_geos_coordseq_hash(const GEOSGeometry* geom, st_index_t hash)
|
|
1023
1061
|
for (i = 0; i < len; ++i) {
|
1024
1062
|
if (GEOSCoordSeq_getX(cs, i, &hash_struct.x)) {
|
1025
1063
|
if (GEOSCoordSeq_getY(cs, i, &hash_struct.y)) {
|
1026
|
-
if (!
|
1064
|
+
if (!GEOSCoordSeq_getZ(cs, i, &hash_struct.z)) {
|
1027
1065
|
hash_struct.z = 0;
|
1028
1066
|
}
|
1029
1067
|
hash_struct.seed_hash = hash;
|
data/ext/geos_c_impl/factory.h
CHANGED
@@ -154,9 +154,18 @@ rgeo_wrap_geos_geometry_clone(VALUE factory,
|
|
154
154
|
specified by an appropriate feature module. Passing Qnil for the type
|
155
155
|
disables this auto-cast. The returned GEOS geometry is owned by rgeo,
|
156
156
|
and you should not dispose it or take ownership of it yourself.
|
157
|
+
|
158
|
+
The state parameter is given to follow `rb_protect*` ruby methods: this
|
159
|
+
method calls `#cast`, and this call may raise. if it does raise, state
|
160
|
+
will be set to a non-zero value, and you'll have access to the error
|
161
|
+
in `rb_errinfo()`. IT IS THE CALLER'S RESPONSIBILITY TO PROPAGATE THE
|
162
|
+
ERROR. You could also discard the error with `rb_set_errinfo(Qnil)`,
|
163
|
+
this will just ignore the error altogether. The error can be raised
|
164
|
+
with `rb_jump_tag(state)` which is helpful if you need to free data
|
165
|
+
before you raise the error.
|
157
166
|
*/
|
158
167
|
const GEOSGeometry*
|
159
|
-
rgeo_convert_to_geos_geometry(VALUE factory, VALUE obj, VALUE type);
|
168
|
+
rgeo_convert_to_geos_geometry(VALUE factory, VALUE obj, VALUE type, int* state);
|
160
169
|
|
161
170
|
/*
|
162
171
|
Gets a GEOS geometry for a given ruby Geometry object. You must provide
|
@@ -179,7 +188,9 @@ rgeo_convert_to_geos_geometry(VALUE factory, VALUE obj, VALUE type);
|
|
179
188
|
will be set to a non-zero value, and you'll have access to the error
|
180
189
|
in `rb_errinfo()`. IT IS THE CALLER'S RESPONSIBILITY TO PROPAGATE THE
|
181
190
|
ERROR. You could also discard the error with `rb_set_errinfo(Qnil)`,
|
182
|
-
this will just ignore the error altogether.
|
191
|
+
this will just ignore the error altogether. The error can be raised
|
192
|
+
with `rb_jump_tag(state)` which is helpful if you need to free data
|
193
|
+
before you raise the error.
|
183
194
|
*/
|
184
195
|
GEOSGeometry*
|
185
196
|
rgeo_convert_to_detached_geos_geometry(VALUE obj,
|