rgeo 3.0.0.pre.rc.3 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/ext/geos_c_impl/factory.c +41 -5
- data/ext/geos_c_impl/factory.h +13 -2
- data/ext/geos_c_impl/geometry.c +151 -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/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 +87 -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 +73 -83
- data/lib/rgeo/geographic/factory.rb +87 -80
- data/lib/rgeo/geographic/interface.rb +40 -23
- 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 +25 -13
- 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 +41 -42
- data/lib/rgeo/geos/ffi_feature_methods.rb +72 -97
- data/lib/rgeo/geos/interface.rb +16 -16
- data/lib/rgeo/geos/utils.rb +3 -3
- data/lib/rgeo/geos/zm_factory.rb +50 -42
- data/lib/rgeo/geos/zm_feature_methods.rb +15 -8
- 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 +5 -5
@@ -48,7 +48,6 @@ module RGeo
|
|
48
48
|
# [<tt>:default_srid</tt>]
|
49
49
|
# A SRID to pass to the factory generator if no SRID is present in
|
50
50
|
# the input. Defaults to nil (i.e. don't specify a SRID).
|
51
|
-
|
52
51
|
class WKTParser
|
53
52
|
# Create and configure a WKT parser. See the WKTParser
|
54
53
|
# documentation for the options that can be passed.
|
@@ -66,7 +65,12 @@ module RGeo
|
|
66
65
|
end
|
67
66
|
@support_ewkt = opts[:support_ewkt] ? true : false
|
68
67
|
@support_wkt12 = opts[:support_wkt12] ? true : false
|
69
|
-
@strict_wkt11 =
|
68
|
+
@strict_wkt11 =
|
69
|
+
if @support_ewkt || @support_wkt12
|
70
|
+
false
|
71
|
+
else
|
72
|
+
opts[:strict_wkt11] ? true : false
|
73
|
+
end
|
70
74
|
@ignore_extra_tokens = opts[:ignore_extra_tokens] ? true : false
|
71
75
|
@default_srid = opts[:default_srid]
|
72
76
|
@mutex = Mutex.new
|
@@ -127,12 +131,13 @@ module RGeo
|
|
127
131
|
@cur_expect_m = nil
|
128
132
|
@cur_srid = @default_srid
|
129
133
|
if @support_ewkt && str =~ /^srid=(\d+);/i
|
130
|
-
str =
|
134
|
+
str = Regexp.last_match&.post_match
|
131
135
|
@cur_srid = Regexp.last_match(1).to_i
|
132
136
|
end
|
133
137
|
begin
|
134
138
|
start_scanner(str)
|
135
139
|
obj = parse_type_tag
|
140
|
+
|
136
141
|
if @cur_token && !@ignore_extra_tokens
|
137
142
|
raise Error::ParseError, "Extra tokens beginning with #{@cur_token.inspect}."
|
138
143
|
end
|
@@ -149,14 +154,19 @@ module RGeo
|
|
149
154
|
if @cur_expect_z && !@cur_factory_support_z
|
150
155
|
raise Error::ParseError, "Geometry calls for Z coordinate but factory doesn't support it."
|
151
156
|
end
|
152
|
-
|
153
|
-
|
154
|
-
|
157
|
+
|
158
|
+
return unless @cur_expect_m && !@cur_factory_support_m
|
159
|
+
|
160
|
+
raise Error::ParseError, "Geometry calls for M coordinate but factory doesn't support it."
|
155
161
|
end
|
156
162
|
|
157
163
|
def ensure_factory
|
158
164
|
unless @cur_factory
|
159
|
-
@cur_factory = @factory_generator.call(
|
165
|
+
@cur_factory = @factory_generator.call(
|
166
|
+
srid: @cur_srid,
|
167
|
+
has_z_coordinate: @cur_expect_z,
|
168
|
+
has_m_coordinate: @cur_expect_m
|
169
|
+
)
|
160
170
|
@cur_factory_support_z = @cur_factory.property(:has_z_coordinate) ? true : false
|
161
171
|
@cur_factory_support_m = @cur_factory.property(:has_m_coordinate) ? true : false
|
162
172
|
check_factory_support unless @cur_expect_z.nil?
|
@@ -202,7 +212,7 @@ module RGeo
|
|
202
212
|
end
|
203
213
|
case type
|
204
214
|
when "point"
|
205
|
-
parse_point(true)
|
215
|
+
parse_point(convert_empty: true)
|
206
216
|
when "linestring"
|
207
217
|
parse_line_string
|
208
218
|
when "polygon"
|
@@ -238,9 +248,11 @@ module RGeo
|
|
238
248
|
num_extras -= 1 if @cur_expect_z
|
239
249
|
@cur_expect_m = num_extras > 0 && (!@cur_factory || @cur_factory_support_m) ? true : false
|
240
250
|
num_extras -= 1 if @cur_expect_m
|
251
|
+
|
241
252
|
if num_extras > 0
|
242
253
|
raise Error::ParseError, "Found #{extra.size + 2} coordinates, which is too many for this factory."
|
243
254
|
end
|
255
|
+
|
244
256
|
ensure_factory
|
245
257
|
else
|
246
258
|
val = 0
|
@@ -261,7 +273,7 @@ module RGeo
|
|
261
273
|
@cur_factory.point(x, y, *extra)
|
262
274
|
end
|
263
275
|
|
264
|
-
def parse_point(convert_empty
|
276
|
+
def parse_point(convert_empty: false)
|
265
277
|
if convert_empty && @cur_token == "empty"
|
266
278
|
point = ensure_factory.multi_point([])
|
267
279
|
else
|
@@ -390,13 +402,11 @@ module RGeo
|
|
390
402
|
end
|
391
403
|
|
392
404
|
def expect_token_type(type)
|
393
|
-
unless type === @cur_token
|
394
|
-
raise Error::ParseError, "#{type.inspect} expected but #{@cur_token.inspect} found."
|
395
|
-
end
|
405
|
+
raise Error::ParseError, "#{type.inspect} expected but #{@cur_token.inspect} found." unless type === @cur_token
|
396
406
|
end
|
397
407
|
|
398
408
|
def next_token
|
399
|
-
if @scanner.scan_until(/\(|\)|\[|\]|,|[^\s
|
409
|
+
if @scanner.scan_until(/\(|\)|\[|\]|,|[^\s()\[\],]+/)
|
400
410
|
token = @scanner.matched
|
401
411
|
case token
|
402
412
|
when /^[-+]?(\d+(\.\d*)?|\.\d+)(e[-+]?\d+)?$/
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rgeo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-01-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi-geos
|
@@ -238,12 +238,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
238
238
|
requirements:
|
239
239
|
- - ">="
|
240
240
|
- !ruby/object:Gem::Version
|
241
|
-
version: 2.
|
241
|
+
version: 2.6.0
|
242
242
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
243
|
requirements:
|
244
|
-
- - "
|
244
|
+
- - ">="
|
245
245
|
- !ruby/object:Gem::Version
|
246
|
-
version:
|
246
|
+
version: '0'
|
247
247
|
requirements: []
|
248
248
|
rubygems_version: 3.1.4
|
249
249
|
signing_key:
|