rgeo 2.3.1 → 3.0.0.pre.rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +6 -0
  3. data/README.md +11 -10
  4. data/ext/geos_c_impl/analysis.c +8 -6
  5. data/ext/geos_c_impl/analysis.h +1 -3
  6. data/ext/geos_c_impl/errors.c +10 -8
  7. data/ext/geos_c_impl/errors.h +7 -3
  8. data/ext/geos_c_impl/extconf.rb +3 -0
  9. data/ext/geos_c_impl/factory.c +273 -202
  10. data/ext/geos_c_impl/factory.h +51 -63
  11. data/ext/geos_c_impl/geometry.c +124 -22
  12. data/ext/geos_c_impl/geometry.h +8 -3
  13. data/ext/geos_c_impl/geometry_collection.c +81 -185
  14. data/ext/geos_c_impl/geometry_collection.h +1 -14
  15. data/ext/geos_c_impl/globals.c +91 -0
  16. data/ext/geos_c_impl/globals.h +45 -0
  17. data/ext/geos_c_impl/line_string.c +28 -29
  18. data/ext/geos_c_impl/line_string.h +1 -3
  19. data/ext/geos_c_impl/main.c +10 -9
  20. data/ext/geos_c_impl/point.c +9 -8
  21. data/ext/geos_c_impl/point.h +1 -3
  22. data/ext/geos_c_impl/polygon.c +43 -72
  23. data/ext/geos_c_impl/polygon.h +1 -3
  24. data/ext/geos_c_impl/preface.h +12 -0
  25. data/ext/geos_c_impl/ruby_more.c +65 -0
  26. data/ext/geos_c_impl/ruby_more.h +16 -0
  27. data/lib/rgeo/cartesian/calculations.rb +54 -17
  28. data/lib/rgeo/cartesian/factory.rb +6 -14
  29. data/lib/rgeo/cartesian/feature_classes.rb +68 -46
  30. data/lib/rgeo/cartesian/feature_methods.rb +67 -20
  31. data/lib/rgeo/cartesian/interface.rb +0 -36
  32. data/lib/rgeo/cartesian/planar_graph.rb +379 -0
  33. data/lib/rgeo/cartesian/sweepline_intersector.rb +149 -0
  34. data/lib/rgeo/cartesian/valid_op.rb +71 -0
  35. data/lib/rgeo/cartesian.rb +3 -0
  36. data/lib/rgeo/coord_sys/cs/wkt_parser.rb +6 -6
  37. data/lib/rgeo/coord_sys.rb +0 -11
  38. data/lib/rgeo/error.rb +15 -0
  39. data/lib/rgeo/feature/factory_generator.rb +0 -3
  40. data/lib/rgeo/feature/geometry.rb +107 -28
  41. data/lib/rgeo/feature/geometry_collection.rb +13 -5
  42. data/lib/rgeo/feature/line_string.rb +3 -3
  43. data/lib/rgeo/feature/multi_surface.rb +3 -3
  44. data/lib/rgeo/feature/point.rb +4 -4
  45. data/lib/rgeo/feature/surface.rb +3 -3
  46. data/lib/rgeo/geographic/factory.rb +6 -7
  47. data/lib/rgeo/geographic/interface.rb +6 -49
  48. data/lib/rgeo/geographic/proj4_projector.rb +0 -2
  49. data/lib/rgeo/geographic/projected_feature_classes.rb +21 -9
  50. data/lib/rgeo/geographic/projected_feature_methods.rb +67 -28
  51. data/lib/rgeo/geographic/simple_mercator_projector.rb +0 -2
  52. data/lib/rgeo/geographic/spherical_feature_classes.rb +29 -9
  53. data/lib/rgeo/geographic/spherical_feature_methods.rb +79 -2
  54. data/lib/rgeo/geos/capi_factory.rb +21 -38
  55. data/lib/rgeo/geos/capi_feature_classes.rb +54 -11
  56. data/lib/rgeo/geos/ffi_factory.rb +6 -35
  57. data/lib/rgeo/geos/ffi_feature_classes.rb +34 -10
  58. data/lib/rgeo/geos/ffi_feature_methods.rb +39 -5
  59. data/lib/rgeo/geos/interface.rb +0 -24
  60. data/lib/rgeo/geos/zm_factory.rb +0 -19
  61. data/lib/rgeo/geos/zm_feature_methods.rb +16 -0
  62. data/lib/rgeo/geos.rb +6 -3
  63. data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +4 -4
  64. data/lib/rgeo/impl_helper/basic_geometry_methods.rb +1 -1
  65. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +15 -19
  66. data/lib/rgeo/impl_helper/basic_point_methods.rb +1 -1
  67. data/lib/rgeo/impl_helper/basic_polygon_methods.rb +1 -1
  68. data/lib/rgeo/impl_helper/valid_op.rb +354 -0
  69. data/lib/rgeo/impl_helper/validity_check.rb +139 -0
  70. data/lib/rgeo/impl_helper.rb +1 -0
  71. data/lib/rgeo/version.rb +1 -1
  72. metadata +45 -9
  73. data/lib/rgeo/coord_sys/srs_database/entry.rb +0 -107
  74. data/lib/rgeo/coord_sys/srs_database/sr_org.rb +0 -64
  75. data/lib/rgeo/coord_sys/srs_database/url_reader.rb +0 -65
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b93de3431a81612631cfa612d589bc0e1026f16276d3c1e848b71f1a3e682731
4
- data.tar.gz: 992a46705454a1fe1c77405e9b6f753739af0c80b9e6f58d8e60da07b75eea93
3
+ metadata.gz: 939fdbb8c9bbcb94342b99f952ad5524cb436683ea054bcab0aaa408f362ac2a
4
+ data.tar.gz: 4cd0c59ee3e08947c646c1b7e5c9a9755c44a0a87459437754867bbb5c2e304e
5
5
  SHA512:
6
- metadata.gz: aca5ecae4e1c3ee2d022591ccf612aae3e4f8539543cc740ba3875b15ae156da6e1e13180a305e0c2a41a9bcf3a60e3eafb5c87eb737f95ef194e08fe66c39f9
7
- data.tar.gz: 94ae519f52c0a6deada3e560722256e99fc482528be8ceea67496cf0dbc7488da9bf643ab2905a28294aaa68ac3f532e913c3afb7fea2877b438ecf282911153
6
+ metadata.gz: e6f02199e30b35334156d3a1107213b6dab9028572e423d2f0f6072a7a2032586e26dfa5a594a8132b33d4071f0d55f6bd75dcd60d1e5a60df4bde0c51b7a78f
7
+ data.tar.gz: 20404c7de6aec61e04eae659253ddf16f518afce40c64274d261acc1a160f5420866c8188fed18425e1a55788e5041ff9b7a93c653f61cdde0a7ce15dccfa1a1
data/.yardopts ADDED
@@ -0,0 +1,6 @@
1
+ --markup rdoc
2
+ --output-dir ./yardoc
3
+ lib/**/*.rb
4
+ ext/**/*.{c,h}
5
+ -
6
+ doc/*.md
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ## RGeo
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/rgeo.svg)](http://badge.fury.io/rb/rgeo)
4
- [![CI](https://github.com/rgeo/rgeo/workflows/CI/badge.svg)](https://github.com/rgeo/rgeo/actions?query=workflow%3ACI+branch%3Amaster+event%3Apush)
4
+ [![CI](https://github.com/rgeo/rgeo/workflows/CI/badge.svg)](https://github.com/rgeo/rgeo/actions?query=workflow%3ACI+branch%3Amain+event%3Apush)
5
5
 
6
6
  RGeo is a geospatial data library for Ruby.
7
7
 
@@ -109,7 +109,7 @@ ActiveRecord connection adapter for SpatiaLite, based on sqlite3 (*not maintaine
109
109
  RDoc Documentation is available at https://www.rubydoc.info/gems/rgeo
110
110
 
111
111
  Contributions are welcome. Please read the
112
- [Contributing guidelines](https://github.com/rgeo/rgeo/blob/master/CONTRIBUTING.md).
112
+ [Contributing guidelines](https://github.com/rgeo/rgeo/blob/main/CONTRIBUTING.md).
113
113
 
114
114
  Support may be available on the
115
115
  [rgeo-users google group](https://groups.google.com/forum/#!forum/rgeo-users)
@@ -124,13 +124,14 @@ generate documentation locally if you're working on RGeo: `yardoc server`.
124
124
 
125
125
  Here's the current list of available topics:
126
126
 
127
- - [An introduction to Spatial Programming With RGeo](https://github.com/rgeo/rgeo/blob/master/doc/An-Introduction-to-Spatial-Programming-With-RGeo.md)
128
- - [Enable GEOS and Proj4 on Heroku](https://github.com/rgeo/rgeo/blob/master/doc/Enable-GEOS-and-Proj4-on-Heroku.md)
129
- - [Installing GEOS](https://github.com/rgeo/rgeo/blob/master/doc/Installing-GEOS.md)
130
- - [Factory Compatibility](https://github.com/rgeo/rgeo/blob/master/doc/Factory-Compatibility.md)
131
- - [Which factory should I use?](https://github.com/rgeo/rgeo/blob/master/doc/Which-factory-should-I-use.md)
132
- - [Examples](https://github.com/rgeo/rgeo/blob/master/doc/Examples.md)
133
- - [Who uses `rgeo`?](https://github.com/rgeo/rgeo/blob/master/doc/Gallery.md)
127
+ - [An introduction to Spatial Programming With RGeo](https://github.com/rgeo/rgeo/blob/main/doc/An-Introduction-to-Spatial-Programming-With-RGeo.md)
128
+ - [Enable GEOS and Proj4 on Heroku](https://github.com/rgeo/rgeo/blob/main/doc/Enable-GEOS-and-Proj4-on-Heroku.md)
129
+ - [Installing GEOS](https://github.com/rgeo/rgeo/blob/main/doc/Installing-GEOS.md)
130
+ - [Factory Compatibility](https://github.com/rgeo/rgeo/blob/main/doc/Factory-Compatibility.md)
131
+ - [Which factory should I use?](https://github.com/rgeo/rgeo/blob/main/doc/Which-factory-should-I-use.md)
132
+ - [Geometry validity handling](https://github.com/rgeo/rgeo/blob/main/doc/Geometry-Validity.md)
133
+ - [Examples](https://github.com/rgeo/rgeo/blob/main/doc/Examples.md)
134
+ - [Who uses `rgeo`?](https://github.com/rgeo/rgeo/blob/main/doc/Gallery.md)
134
135
 
135
136
  You can see an exhaustive and up to date list at https://rubydoc.info/gems/rgeo/index.
136
137
  ### Acknowledgments
@@ -157,4 +158,4 @@ by [J Smith](https://github.com/dark-panda).
157
158
 
158
159
  Copyright (c) Daniel Azuma, Tee Parham
159
160
 
160
- [License](https://github.com/rgeo/rgeo/blob/master/LICENSE.txt)
161
+ [License](https://github.com/rgeo/rgeo/blob/main/LICENSE.txt)
@@ -9,6 +9,8 @@
9
9
  #include <ruby.h>
10
10
  #include <geos_c.h>
11
11
 
12
+ #include "globals.h"
13
+
12
14
  #include "analysis.h"
13
15
  #include "factory.h"
14
16
  #include "errors.h"
@@ -35,9 +37,9 @@ VALUE rgeo_geos_analysis_ccw_p(VALUE self, VALUE ring)
35
37
  ring_data = RGEO_GEOMETRY_DATA_PTR(ring);
36
38
 
37
39
  coord_seq = GEOSGeom_getCoordSeq_r(ring_data->geos_context, ring_data->geom);
38
- if (!coord_seq) { rb_raise(geos_error, "Could not retrieve CoordSeq from given ring."); }
40
+ if (!coord_seq) { rb_raise(rb_eGeosError, "Could not retrieve CoordSeq from given ring."); }
39
41
  if (!GEOSCoordSeq_isCCW_r(ring_data->geos_context, coord_seq, &is_ccw)) {
40
- rb_raise(geos_error, "Could not determine if the CoordSeq is CCW.");
42
+ rb_raise(rb_eGeosError, "Could not determine if the CoordSeq is CCW.");
41
43
  }
42
44
 
43
45
  return is_ccw ? Qtrue : Qfalse;
@@ -47,8 +49,8 @@ VALUE rgeo_geos_analysis_ccw_p(VALUE self, VALUE ring)
47
49
 
48
50
  /**
49
51
  * call-seq:
50
- * RGeo::Geos::Analysis.ccw_supported? -> true or false
51
- *
52
+ * RGeo::Geos::Analysis.ccw_supported? -> true or false
53
+ *
52
54
  * Checks if the RGEO_GEOS_SUPPORTS_ISCCW macro is defined, returns +true+
53
55
  * if it is, +false+ otherwise
54
56
  */
@@ -62,11 +64,11 @@ VALUE rgeo_geos_analysis_supports_ccw(VALUE self)
62
64
  }
63
65
 
64
66
 
65
- void rgeo_init_geos_analysis(RGeo_Globals* globals)
67
+ void rgeo_init_geos_analysis()
66
68
  {
67
69
  VALUE geos_analysis_module;
68
70
 
69
- geos_analysis_module = rb_define_module_under(globals->geos_module, "Analysis");
71
+ geos_analysis_module = rb_define_module_under(rgeo_geos_module, "Analysis");
70
72
  rb_define_singleton_method(geos_analysis_module, "ccw_supported?", rgeo_geos_analysis_supports_ccw, 0);
71
73
  #ifdef RGEO_GEOS_SUPPORTS_ISCCW
72
74
  rb_define_singleton_method(geos_analysis_module, "ccw?", rgeo_geos_analysis_ccw_p, 1);
@@ -9,8 +9,6 @@
9
9
 
10
10
  #ifdef RGEO_GEOS_SUPPORTED
11
11
 
12
- #include "factory.h"
13
-
14
12
  RGEO_BEGIN_C
15
13
 
16
14
  /*
@@ -33,7 +31,7 @@ VALUE rgeo_geos_analysis_ccw_p(VALUE self, VALUE ring);
33
31
  */
34
32
  VALUE rgeo_geos_analysis_supports_ccw(VALUE self);
35
33
 
36
- void rgeo_init_geos_analysis(RGeo_Globals* globals);
34
+ void rgeo_init_geos_analysis();
37
35
 
38
36
  RGEO_END_C
39
37
 
@@ -8,24 +8,26 @@
8
8
 
9
9
  #ifdef RGEO_GEOS_SUPPORTED
10
10
 
11
+ #include "globals.h"
12
+
11
13
  #include "errors.h"
12
14
 
13
15
  RGEO_BEGIN_C
14
16
 
15
- // Any error relative to RGeo.
16
- VALUE rgeo_error;
17
- // RGeo error specific to the GEOS implementation.
18
- VALUE geos_error;
17
+ VALUE rb_eRGeoError;
18
+ VALUE rb_eRGeoInvalidGeometry;
19
+ VALUE rb_eRGeoUnsupportedOperation;
20
+ VALUE rb_eGeosError;
19
21
 
20
22
 
21
23
  void rgeo_init_geos_errors() {
22
- VALUE rgeo_module;
23
24
  VALUE error_module;
24
25
 
25
- rgeo_module = rb_define_module("RGeo");
26
26
  error_module = rb_define_module_under(rgeo_module, "Error");
27
- rgeo_error = rb_define_class_under(error_module, "RGeoError", rb_eRuntimeError);
28
- geos_error = rb_define_class_under(error_module, "GeosError", rgeo_error);
27
+ rb_eRGeoError = rb_define_class_under(error_module, "RGeoError", rb_eRuntimeError);
28
+ rb_eRGeoInvalidGeometry = rb_define_class_under(error_module, "InvalidGeometry", rb_eRGeoError);
29
+ rb_eRGeoUnsupportedOperation = rb_define_class_under(error_module, "UnsupportedOperation", rb_eRGeoError);
30
+ rb_eGeosError = rb_define_class_under(error_module, "GeosError", rb_eRGeoError);
29
31
  }
30
32
 
31
33
  RGEO_END_C
@@ -8,10 +8,14 @@
8
8
 
9
9
  RGEO_BEGIN_C
10
10
 
11
- // Any error relative to RGeo.
12
- extern VALUE rgeo_error;
11
+ // Main rgeo error type
12
+ extern VALUE rb_eRGeoError;
13
+ // RGeo::Error::InvalidGeometry
14
+ extern VALUE rb_eRGeoInvalidGeometry;
15
+ // RGeo::Error::UnsupportedOperation
16
+ extern VALUE rb_eRGeoUnsupportedOperation;
13
17
  // RGeo error specific to the GEOS implementation.
14
- extern VALUE geos_error;
18
+ extern VALUE rb_eGeosError;
15
19
 
16
20
  void rgeo_init_geos_errors();
17
21
 
@@ -14,6 +14,8 @@ if RUBY_DESCRIPTION =~ /^jruby\s/
14
14
  else
15
15
  require "mkmf"
16
16
 
17
+ $CFLAGS << " -DRGEO_GEOS_DEBUG" if ENV.key?("DEBUG") || ENV.key?("RGEO_GEOS_DEBUG")
18
+
17
19
  geosconfig = with_config("geos-config") || find_executable("geos-config")
18
20
 
19
21
  if geosconfig
@@ -33,6 +35,7 @@ else
33
35
  have_func("GEOSUnaryUnion_r", "geos_c.h")
34
36
  have_func("GEOSCoordSeq_isCCW_r", "geos_c.h")
35
37
  have_func("rb_memhash", "ruby.h")
38
+ have_func("rb_gc_mark_movable", "ruby.h")
36
39
  end
37
40
 
38
41
  if found_geos_