rgeo 2.3.0 → 3.0.0.pre.rc.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.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +6 -0
  3. data/README.md +1 -0
  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 +251 -182
  10. data/ext/geos_c_impl/factory.h +43 -62
  11. data/ext/geos_c_impl/geometry.c +56 -24
  12. data/ext/geos_c_impl/geometry.h +8 -3
  13. data/ext/geos_c_impl/geometry_collection.c +41 -148
  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 +15 -51
  23. data/ext/geos_c_impl/polygon.h +1 -3
  24. data/ext/geos_c_impl/preface.h +8 -0
  25. data/lib/rgeo/cartesian/analysis.rb +2 -2
  26. data/lib/rgeo/cartesian/calculations.rb +54 -17
  27. data/lib/rgeo/cartesian/factory.rb +0 -7
  28. data/lib/rgeo/cartesian/feature_classes.rb +66 -46
  29. data/lib/rgeo/cartesian/feature_methods.rb +56 -20
  30. data/lib/rgeo/cartesian/interface.rb +0 -6
  31. data/lib/rgeo/cartesian/planar_graph.rb +379 -0
  32. data/lib/rgeo/cartesian/sweepline_intersector.rb +149 -0
  33. data/lib/rgeo/cartesian/valid_op.rb +71 -0
  34. data/lib/rgeo/cartesian.rb +3 -0
  35. data/lib/rgeo/coord_sys/cs/wkt_parser.rb +6 -6
  36. data/lib/rgeo/error.rb +15 -0
  37. data/lib/rgeo/feature/curve.rb +12 -2
  38. data/lib/rgeo/feature/geometry.rb +38 -28
  39. data/lib/rgeo/feature/geometry_collection.rb +13 -5
  40. data/lib/rgeo/feature/line_string.rb +3 -3
  41. data/lib/rgeo/feature/multi_curve.rb +6 -1
  42. data/lib/rgeo/feature/multi_surface.rb +3 -3
  43. data/lib/rgeo/feature/point.rb +4 -4
  44. data/lib/rgeo/feature/surface.rb +3 -3
  45. data/lib/rgeo/geographic/factory.rb +0 -7
  46. data/lib/rgeo/geographic/interface.rb +4 -18
  47. data/lib/rgeo/geographic/proj4_projector.rb +0 -2
  48. data/lib/rgeo/geographic/projected_feature_classes.rb +21 -9
  49. data/lib/rgeo/geographic/projected_feature_methods.rb +63 -30
  50. data/lib/rgeo/geographic/simple_mercator_projector.rb +0 -2
  51. data/lib/rgeo/geographic/spherical_feature_classes.rb +29 -9
  52. data/lib/rgeo/geographic/spherical_feature_methods.rb +68 -2
  53. data/lib/rgeo/geos/capi_factory.rb +21 -31
  54. data/lib/rgeo/geos/capi_feature_classes.rb +64 -11
  55. data/lib/rgeo/geos/ffi_factory.rb +0 -28
  56. data/lib/rgeo/geos/ffi_feature_classes.rb +34 -10
  57. data/lib/rgeo/geos/ffi_feature_methods.rb +53 -10
  58. data/lib/rgeo/geos/interface.rb +18 -10
  59. data/lib/rgeo/geos/zm_factory.rb +0 -12
  60. data/lib/rgeo/geos/zm_feature_methods.rb +30 -5
  61. data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +18 -8
  62. data/lib/rgeo/impl_helper/basic_geometry_methods.rb +1 -1
  63. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +37 -26
  64. data/lib/rgeo/impl_helper/basic_point_methods.rb +13 -3
  65. data/lib/rgeo/impl_helper/basic_polygon_methods.rb +8 -3
  66. data/lib/rgeo/impl_helper/valid_op.rb +354 -0
  67. data/lib/rgeo/impl_helper/validity_check.rb +138 -0
  68. data/lib/rgeo/impl_helper.rb +1 -0
  69. data/lib/rgeo/version.rb +1 -1
  70. data/lib/rgeo/wkrep/wkb_generator.rb +1 -1
  71. data/lib/rgeo/wkrep/wkt_generator.rb +6 -6
  72. metadata +30 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e86885f1c2a19a3b89ea73784add4644f6cbfa6afb1cf73dc0f1dda22151923
4
- data.tar.gz: 83690993b988a200dc689750e31f8aabdb78fc7aade2af339a068f5adb41b9a1
3
+ metadata.gz: e26b01fb2fff6915756d98e206ee4bdabefeaceadae3cd0b85cb7be9ee6d8285
4
+ data.tar.gz: 9b94dd4e6c57e9fa5ab07c7b5fb9c622a52d843b67d146b52454933cb817a4a1
5
5
  SHA512:
6
- metadata.gz: 733c109fc5858536ca56a18bac9d9ab78204365a1ea5cd2e4eb7f9d06eaf833cafb28907a547698954c5b5963be921b415b9e5cc881f7235d644be2619de482f
7
- data.tar.gz: 7ab29b70bcfb8f7a58832271245a6a125861c5298db870a3ecad3ff2869aa56045fb42213b44609b44edcf7531349a205ef0e688773bab1f652508c66925730d
6
+ metadata.gz: 9adb8cc283c8663fb0a178eeb7a1629fe466265f7fa15c54d4e8dac4188646a2682f591a3e76d12271df5dc6c875961833600b88952d035f824933bd454211de
7
+ data.tar.gz: c1f7e26d5a5edcc060cac2efaa782a586c9ee95e1dda08f7af771648ecc1ea2373a1e4ba9053aae00288332e401370c7f61e254367231ceabb4fb36ad5406209
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
@@ -129,6 +129,7 @@ Here's the current list of available topics:
129
129
  - [Installing GEOS](https://github.com/rgeo/rgeo/blob/master/doc/Installing-GEOS.md)
130
130
  - [Factory Compatibility](https://github.com/rgeo/rgeo/blob/master/doc/Factory-Compatibility.md)
131
131
  - [Which factory should I use?](https://github.com/rgeo/rgeo/blob/master/doc/Which-factory-should-I-use.md)
132
+ - [Geometry validity handling](https://github.com/rgeo/rgeo/blob/master/doc/Geometry-Validity.md)
132
133
  - [Examples](https://github.com/rgeo/rgeo/blob/master/doc/Examples.md)
133
134
  - [Who uses `rgeo`?](https://github.com/rgeo/rgeo/blob/master/doc/Gallery.md)
134
135
 
@@ -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_