rgeo 2.0.1 → 2.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e65e0bd3f3ad73fe0b4ecbb05adbb7f19a440b504cecfb56ad06a404737b026
4
- data.tar.gz: 388abecc5c42a5c4ea09715211d1b593bf1190e3caf7e5ad9bb207fd38b9a280
3
+ metadata.gz: 2430c81b8d65c3e98a0e4411c4b10d5b71e6eb1d90ae59bffeab5f71c2da2cb3
4
+ data.tar.gz: 55aca2dc0b4f7b08641d54b40d8248e594a58574c13690e092dcd8718a392c1c
5
5
  SHA512:
6
- metadata.gz: 6fe60599325d792e895e7be38304e16dd6d8d47eccdd5bf15a7cbacf9f64964d6b2b90cca4558169c9fd4c76ea705c30aa5f01048d41dc814de62b59ff576ace
7
- data.tar.gz: 408507969d099f0265dda08b6213d711dc7cd8a9c157cd97f36080db2ccc18f854516d547712c3b0f81e0e8d36b38859b9ead8efc2ed50270737cda5000d59e7
6
+ metadata.gz: 70f91cfbacb9c87fc6aa974eeeb3863452ebe3a041544249e8a9824864352f9f1f32525c6c952a37091b4f632b29269e9249a57098533c9a971c4d79c6406e29
7
+ data.tar.gz: 708edf08257aa5f3215aeb43fbcfe3aa36afe1950974b9a1120805d0512b6cd2edeaf334baf44f486cbf766cd1faa44b52d084e1ae415dae5d0f5e6014cd5e04
@@ -756,7 +756,9 @@ static VALUE method_geometry_buffer_with_style(VALUE self, VALUE distance, VALUE
756
756
  GEOSBufferWithStyle_r(self_data->geos_context, self_geom,
757
757
  rb_num2dbl(distance),
758
758
  RGEO_FACTORY_DATA_PTR(factory)->buffer_resolution,
759
- endCapStyle, joinStyle, mitreLimit),
759
+ rb_num2int(endCapStyle),
760
+ rb_num2int(joinStyle),
761
+ rb_num2dbl(mitreLimit)),
760
762
  Qnil);
761
763
  }
762
764
  return result;
@@ -1053,6 +1055,21 @@ static VALUE method_geometry_invalid_reason(VALUE self)
1053
1055
  return result;
1054
1056
  }
1055
1057
 
1058
+ static VALUE method_geometry_point_on_surface(VALUE self)
1059
+ {
1060
+ VALUE result;
1061
+ RGeo_GeometryData* self_data;
1062
+ const GEOSGeometry* self_geom;
1063
+
1064
+ result = Qnil;
1065
+ self_data = RGEO_GEOMETRY_DATA_PTR(self);
1066
+ self_geom = self_data->geom;
1067
+ if (self_geom) {
1068
+ result = rgeo_wrap_geos_geometry(self_data->factory, GEOSPointOnSurface_r(self_data->geos_context, self_geom), Qnil);
1069
+ }
1070
+ return result;
1071
+ }
1072
+
1056
1073
 
1057
1074
  /**** INITIALIZATION FUNCTION ****/
1058
1075
 
@@ -1107,6 +1124,7 @@ void rgeo_init_geos_geometry(RGeo_Globals* globals)
1107
1124
  rb_define_method(geos_geometry_methods, "sym_difference", method_geometry_sym_difference, 1);
1108
1125
  rb_define_method(geos_geometry_methods, "valid?", method_geometry_is_valid, 0);
1109
1126
  rb_define_method(geos_geometry_methods, "invalid_reason", method_geometry_invalid_reason, 0);
1127
+ rb_define_method(geos_geometry_methods, "point_on_surface", method_geometry_point_on_surface, 0);
1110
1128
  }
1111
1129
 
1112
1130
 
@@ -559,22 +559,6 @@ static VALUE method_multi_polygon_centroid(VALUE self)
559
559
  }
560
560
 
561
561
 
562
- static VALUE method_multi_polygon_point_on_surface(VALUE self)
563
- {
564
- VALUE result;
565
- RGeo_GeometryData* self_data;
566
- const GEOSGeometry* self_geom;
567
-
568
- result = Qnil;
569
- self_data = RGEO_GEOMETRY_DATA_PTR(self);
570
- self_geom = self_data->geom;
571
- if (self_geom) {
572
- result = rgeo_wrap_geos_geometry(self_data->factory, GEOSPointOnSurface_r(self_data->geos_context, self_geom), Qnil);
573
- }
574
- return result;
575
- }
576
-
577
-
578
562
  static VALUE cmethod_geometry_collection_create(VALUE module, VALUE factory, VALUE array)
579
563
  {
580
564
  return create_geometry_collection(module, GEOS_GEOMETRYCOLLECTION, factory, array);
@@ -648,7 +632,6 @@ void rgeo_init_geos_geometry_collection(RGeo_Globals* globals)
648
632
  rb_define_method(geos_multi_polygon_methods, "geometry_type", method_multi_polygon_geometry_type, 0);
649
633
  rb_define_method(geos_multi_polygon_methods, "area", method_multi_polygon_area, 0);
650
634
  rb_define_method(geos_multi_polygon_methods, "centroid", method_multi_polygon_centroid, 0);
651
- rb_define_method(geos_multi_polygon_methods, "point_on_surface", method_multi_polygon_point_on_surface, 0);
652
635
  rb_define_method(geos_multi_polygon_methods, "hash", method_multi_polygon_hash, 0);
653
636
  rb_define_method(geos_multi_polygon_methods, "coordinates", method_multi_polygon_coordinates, 0);
654
637
  }
@@ -110,6 +110,10 @@ module RGeo
110
110
  def sym_difference(rhs)
111
111
  factory.unproject(projection.sym_difference(Feature.cast(rhs, factory).projection))
112
112
  end
113
+
114
+ def point_on_surface
115
+ factory.unproject(projection.point_on_surface)
116
+ end
113
117
  end
114
118
 
115
119
  module ProjectedPointMethods # :nodoc:
@@ -170,10 +174,6 @@ module RGeo
170
174
  def centroid
171
175
  factory.unproject(projection.centroid)
172
176
  end
173
-
174
- def point_on_surface
175
- factory.unproject(projection.point_on_surface)
176
- end
177
177
  end
178
178
 
179
179
  module ProjectedPolygonMethods # :nodoc:
data/lib/rgeo/geos.rb CHANGED
@@ -63,15 +63,13 @@ module RGeo
63
63
  self.preferred_native_interface = :ffi
64
64
  end
65
65
 
66
- # There is some trouble with END_CAP in GEOS
67
- # In docs CAP_ROUND = 1, but it's work properly with 0
68
- CAP_ROUND = 0
69
- CAP_FLAT = 1
70
- CAP_SQUARE = 2
66
+ CAP_ROUND = 1
67
+ CAP_FLAT = 2
68
+ CAP_SQUARE = 3
71
69
 
72
- JOIN_ROUND = 0
73
- JOIN_MITRE = 1
74
- JOIN_BEVEL = 2
70
+ JOIN_ROUND = 1
71
+ JOIN_MITRE = 2
72
+ JOIN_BEVEL = 3
75
73
  end
76
74
  end
77
75
 
@@ -266,6 +266,10 @@ module RGeo
266
266
  fg
267
267
  end
268
268
 
269
+ def point_on_surface
270
+ @factory.wrap_fg_geom(@fg_geom.point_on_surface, FFIPointImpl)
271
+ end
272
+
269
273
  private
270
274
 
271
275
  def request_prepared
@@ -571,10 +575,6 @@ module RGeo
571
575
  @factory.wrap_fg_geom(@fg_geom.centroid, FFIPointImpl)
572
576
  end
573
577
 
574
- def point_on_surface
575
- @factory.wrap_fg_geom(@fg_geom.point_on_surface, FFIPointImpl)
576
- end
577
-
578
578
  def coordinates
579
579
  each.map(&:coordinates)
580
580
  end
data/lib/rgeo/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RGeo
4
- VERSION = "2.0.1"
4
+ VERSION = "2.1.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgeo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma, Tee Parham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-07 00:00:00.000000000 Z
11
+ date: 2019-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi-geos
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
198
  - !ruby/object:Gem::Version
199
199
  version: '0'
200
200
  requirements: []
201
- rubygems_version: 3.0.3
201
+ rubygems_version: 3.0.4
202
202
  signing_key:
203
203
  specification_version: 4
204
204
  summary: RGeo is a geospatial data library for Ruby.