ffi-geos 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3954 -4
- data/.travis.yml +23 -11
- data/Gemfile +7 -9
- data/Guardfile +3 -4
- data/MIT-LICENSE +1 -1
- data/README.rdoc +2 -20
- data/Rakefile +3 -2
- data/ffi-geos.gemspec +2 -2
- data/lib/ffi-geos.rb +93 -44
- data/lib/ffi-geos/coordinate_sequence.rb +147 -145
- data/lib/ffi-geos/geometry.rb +68 -17
- data/lib/ffi-geos/geometry_collection.rb +22 -8
- data/lib/ffi-geos/interrupt.rb +11 -14
- data/lib/ffi-geos/line_string.rb +57 -42
- data/lib/ffi-geos/point.rb +16 -16
- data/lib/ffi-geos/polygon.rb +42 -28
- data/lib/ffi-geos/strtree.rb +3 -5
- data/lib/ffi-geos/tools.rb +1 -1
- data/lib/ffi-geos/utils.rb +4 -12
- data/lib/ffi-geos/version.rb +1 -1
- data/lib/ffi-geos/wkb_writer.rb +2 -3
- data/lib/ffi-geos/wkt_writer.rb +4 -7
- data/sonar-project.properties +16 -0
- data/test/coordinate_sequence_tests.rb +144 -122
- data/test/geometry_collection_tests.rb +38 -65
- data/test/geometry_tests.rb +106 -17
- data/test/interrupt_tests.rb +7 -7
- data/test/line_string_tests.rb +10 -10
- data/test/point_tests.rb +2 -2
- data/test/polygon_tests.rb +3 -4
- data/test/prepared_geometry_tests.rb +8 -8
- data/test/strtree_tests.rb +5 -5
- data/test/test_helper.rb +20 -35
- data/test/utils_tests.rb +69 -59
- data/test/wkb_reader_tests.rb +9 -9
- data/test/wkb_writer_tests.rb +14 -12
- data/test/wkt_reader_tests.rb +0 -1
- data/test/wkt_writer_tests.rb +2 -5
- metadata +4 -4
data/test/wkb_reader_tests.rb
CHANGED
@@ -105,7 +105,7 @@ class WkbReaderTests < Minitest::Test
|
|
105
105
|
def test_2d_little_endian_binary
|
106
106
|
wkb_tester(
|
107
107
|
'POINT(6 7)',
|
108
|
-
|
108
|
+
[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 64, 0, 0, 0, 0, 0, 0, 28, 64].pack('C*'),
|
109
109
|
Geos::GEOS_POINT,
|
110
110
|
'Point',
|
111
111
|
Geos::Point,
|
@@ -117,7 +117,7 @@ class WkbReaderTests < Minitest::Test
|
|
117
117
|
def test_2d_big_endian_binary
|
118
118
|
wkb_tester(
|
119
119
|
'POINT (6 7)',
|
120
|
-
|
120
|
+
[0, 0, 0, 0, 1, 64, 24, 0, 0, 0, 0, 0, 0, 64, 28, 0, 0, 0, 0, 0, 0].pack('C*'),
|
121
121
|
Geos::GEOS_POINT,
|
122
122
|
'Point',
|
123
123
|
Geos::Point,
|
@@ -129,7 +129,7 @@ class WkbReaderTests < Minitest::Test
|
|
129
129
|
def test_2d_little_endian_srid_binary
|
130
130
|
wkb_tester(
|
131
131
|
'POINT (6 7)',
|
132
|
-
|
132
|
+
[1, 1, 0, 0, 32, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 64, 0, 0, 0, 0, 0, 0, 28, 64].pack('C*'),
|
133
133
|
Geos::GEOS_POINT,
|
134
134
|
'Point',
|
135
135
|
Geos::Point,
|
@@ -141,7 +141,7 @@ class WkbReaderTests < Minitest::Test
|
|
141
141
|
def test_2d_big_endian_srid_binary
|
142
142
|
wkb_tester(
|
143
143
|
'POINT (6 7)',
|
144
|
-
|
144
|
+
[0, 32, 0, 0, 1, 0, 0, 0, 43, 64, 24, 0, 0, 0, 0, 0, 0, 64, 28, 0, 0, 0, 0, 0, 0].pack('C*'),
|
145
145
|
Geos::GEOS_POINT,
|
146
146
|
'Point',
|
147
147
|
Geos::Point,
|
@@ -153,7 +153,7 @@ class WkbReaderTests < Minitest::Test
|
|
153
153
|
def test_3d_little_endian_binary
|
154
154
|
wkb_tester(
|
155
155
|
'POINT Z (6 7 8)',
|
156
|
-
|
156
|
+
[1, 1, 0, 0, 128, 0, 0, 0, 0, 0, 0, 24, 64, 0, 0, 0, 0, 0, 0, 28, 64, 0, 0, 0, 0, 0, 0, 32, 64].pack('C*'),
|
157
157
|
Geos::GEOS_POINT,
|
158
158
|
'Point',
|
159
159
|
Geos::Point,
|
@@ -165,7 +165,7 @@ class WkbReaderTests < Minitest::Test
|
|
165
165
|
def test_3d_big_endian_binary
|
166
166
|
wkb_tester(
|
167
167
|
'POINT Z (6 7 8)',
|
168
|
-
|
168
|
+
[0, 128, 0, 0, 1, 64, 24, 0, 0, 0, 0, 0, 0, 64, 28, 0, 0, 0, 0, 0, 0, 64, 32, 0, 0, 0, 0, 0, 0].pack('C*'),
|
169
169
|
Geos::GEOS_POINT,
|
170
170
|
'Point',
|
171
171
|
Geos::Point,
|
@@ -177,7 +177,7 @@ class WkbReaderTests < Minitest::Test
|
|
177
177
|
def test_3d_big_endian_srid_binary
|
178
178
|
wkb_tester(
|
179
179
|
'POINT Z (6 7 8)',
|
180
|
-
|
180
|
+
[0, 160, 0, 0, 1, 0, 0, 0, 53, 64, 24, 0, 0, 0, 0, 0, 0, 64, 28, 0, 0, 0, 0, 0, 0, 64, 32, 0, 0, 0, 0, 0, 0].pack('C*'),
|
181
181
|
Geos::GEOS_POINT,
|
182
182
|
'Point',
|
183
183
|
Geos::Point,
|
@@ -188,11 +188,11 @@ class WkbReaderTests < Minitest::Test
|
|
188
188
|
|
189
189
|
def test_read_with_srid
|
190
190
|
assert_equal(43,
|
191
|
-
@wkb_reader.read(
|
191
|
+
@wkb_reader.read([1, 1, 0, 0, 32, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 64, 0, 0, 0, 0, 0, 0, 28, 64].pack('C*')).srid)
|
192
192
|
|
193
193
|
assert_equal(4326,
|
194
194
|
@wkb_reader.read(
|
195
|
-
|
195
|
+
[1, 1, 0, 0, 32, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 64, 0, 0, 0, 0, 0, 0, 28, 64].pack('C*'),
|
196
196
|
srid: 4326
|
197
197
|
).srid)
|
198
198
|
end
|
data/test/wkb_writer_tests.rb
CHANGED
@@ -333,7 +333,7 @@ class WkbWriterTests < Minitest::Test
|
|
333
333
|
|
334
334
|
def test_2d_big_endian_with_3d_input_binary
|
335
335
|
wkb_tester(
|
336
|
-
|
336
|
+
[0, 0, 0, 0, 1, 64, 24, 0, 0, 0, 0, 0, 0, 64, 28, 0, 0, 0, 0, 0, 0].pack('C*'),
|
337
337
|
'POINT(6 7 8)',
|
338
338
|
2,
|
339
339
|
0,
|
@@ -345,7 +345,7 @@ class WkbWriterTests < Minitest::Test
|
|
345
345
|
|
346
346
|
def test_2d_big_endian_with_3d_input_with_srid_binary
|
347
347
|
wkb_tester(
|
348
|
-
|
348
|
+
[0, 32, 0, 0, 1, 0, 0, 0, 53, 64, 24, 0, 0, 0, 0, 0, 0, 64, 28, 0, 0, 0, 0, 0, 0].pack('C*'),
|
349
349
|
'POINT(6 7 8)',
|
350
350
|
2,
|
351
351
|
0,
|
@@ -357,7 +357,7 @@ class WkbWriterTests < Minitest::Test
|
|
357
357
|
|
358
358
|
def test_3d_little_endian_with_3d_input_binary
|
359
359
|
wkb_tester(
|
360
|
-
|
360
|
+
[1, 1, 0, 0, 128, 0, 0, 0, 0, 0, 0, 24, 64, 0, 0, 0, 0, 0, 0, 28, 64, 0, 0, 0, 0, 0, 0, 32, 64].pack('C*'),
|
361
361
|
'POINT(6 7 8)',
|
362
362
|
3,
|
363
363
|
1,
|
@@ -369,7 +369,7 @@ class WkbWriterTests < Minitest::Test
|
|
369
369
|
|
370
370
|
def test_3d_big_endian_with_3d_input_binary
|
371
371
|
wkb_tester(
|
372
|
-
|
372
|
+
[0, 128, 0, 0, 1, 64, 24, 0, 0, 0, 0, 0, 0, 64, 28, 0, 0, 0, 0, 0, 0, 64, 32, 0, 0, 0, 0, 0, 0].pack('C*'),
|
373
373
|
'POINT(6 7 8)',
|
374
374
|
3,
|
375
375
|
0,
|
@@ -381,7 +381,7 @@ class WkbWriterTests < Minitest::Test
|
|
381
381
|
|
382
382
|
def test_3d_big_endian_with_3d_input_with_srid_binary
|
383
383
|
wkb_tester(
|
384
|
-
|
384
|
+
[0, 160, 0, 0, 1, 0, 0, 0, 53, 64, 24, 0, 0, 0, 0, 0, 0, 64, 28, 0, 0, 0, 0, 0, 0, 64, 32, 0, 0, 0, 0, 0, 0].pack('C*'),
|
385
385
|
'POINT(6 7 8)',
|
386
386
|
3,
|
387
387
|
0,
|
@@ -394,7 +394,7 @@ class WkbWriterTests < Minitest::Test
|
|
394
394
|
def test_try_bad_byte_order_value_binary
|
395
395
|
assert_raises(TypeError) do
|
396
396
|
wkb_tester(
|
397
|
-
|
397
|
+
[1, 1, 0, 0, 128, 0, 0, 0, 0, 0, 0, 24, 64, 0, 0, 0, 0, 0, 0, 28, 64, 0, 0, 0, 0, 0, 0, 32, 64].pack('C*'),
|
398
398
|
'POINT(6 7 8)',
|
399
399
|
3,
|
400
400
|
'gibberish',
|
@@ -406,7 +406,7 @@ class WkbWriterTests < Minitest::Test
|
|
406
406
|
|
407
407
|
assert_raises(TypeError) do
|
408
408
|
wkb_tester(
|
409
|
-
|
409
|
+
[1, 1, 0, 0, 128, 0, 0, 0, 0, 0, 0, 24, 64, 0, 0, 0, 0, 0, 0, 28, 64, 0, 0, 0, 0, 0, 0, 32, 64].pack('C*'),
|
410
410
|
'POINT(6 7 8)',
|
411
411
|
3,
|
412
412
|
1000,
|
@@ -433,12 +433,12 @@ class WkbWriterTests < Minitest::Test
|
|
433
433
|
}
|
434
434
|
|
435
435
|
tester[
|
436
|
-
|
436
|
+
[1, 1, 0, 0, 32, 230, 16, 0, 0, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 0, 64].pack('C*'),
|
437
437
|
include_srid: true
|
438
438
|
]
|
439
439
|
|
440
440
|
tester[
|
441
|
-
|
441
|
+
[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 0, 64].pack('C*')
|
442
442
|
]
|
443
443
|
end
|
444
444
|
|
@@ -448,9 +448,11 @@ class WkbWriterTests < Minitest::Test
|
|
448
448
|
geom = read('POINT(1 2 3)')
|
449
449
|
geom.srid = 4326
|
450
450
|
|
451
|
-
assert_equal('0101000020E6100000000000000000F03F0000000000000040',
|
452
|
-
|
453
|
-
|
451
|
+
assert_equal('0101000020E6100000000000000000F03F0000000000000040',
|
452
|
+
@wkb_writer.write_hex(
|
453
|
+
geom,
|
454
|
+
include_srid: true
|
455
|
+
))
|
454
456
|
|
455
457
|
assert_equal('0101000000000000000000F03F0000000000000040', @wkb_writer.write_hex(geom))
|
456
458
|
end
|
data/test/wkt_reader_tests.rb
CHANGED
data/test/wkt_writer_tests.rb
CHANGED
@@ -9,9 +9,7 @@ class WktWriterTests < Minitest::Test
|
|
9
9
|
geom = read('POINT(12.3456789 98.7654321)')
|
10
10
|
wkt = write(geom)
|
11
11
|
|
12
|
-
x, y = if wkt =~ /^POINT\s\((\d+\.\d+)\s*(\d+\.\d+)\)$/
|
13
|
-
[ Regexp.last_match[1].to_f, Regexp.last_match[2].to_f ]
|
14
|
-
end
|
12
|
+
x, y = ([Regexp.last_match[1].to_f, Regexp.last_match[2].to_f] if wkt =~ /^POINT\s\((\d+\.\d+)\s*(\d+\.\d+)\)$/)
|
15
13
|
|
16
14
|
assert_in_delta(12.3456789, x, TOLERANCE)
|
17
15
|
assert_in_delta(98.7654321, y, TOLERANCE)
|
@@ -122,8 +120,7 @@ class WktWriterTests < Minitest::Test
|
|
122
120
|
|
123
121
|
assert_equal('POINT Z (1 2 3)', write(geom,
|
124
122
|
output_dimensions: 3,
|
125
|
-
trim: true
|
126
|
-
))
|
123
|
+
trim: true))
|
127
124
|
|
128
125
|
assert_equal('POINT (1.00 2.00)', write(geom))
|
129
126
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-geos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- J Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- lib/ffi-geos/wkb_writer.rb
|
63
63
|
- lib/ffi-geos/wkt_reader.rb
|
64
64
|
- lib/ffi-geos/wkt_writer.rb
|
65
|
+
- sonar-project.properties
|
65
66
|
- test/.rubocop.yml
|
66
67
|
- test/coordinate_sequence_tests.rb
|
67
68
|
- test/geometry_collection_tests.rb
|
@@ -101,8 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
102
|
- !ruby/object:Gem::Version
|
102
103
|
version: '0'
|
103
104
|
requirements: []
|
104
|
-
|
105
|
-
rubygems_version: 2.7.6
|
105
|
+
rubygems_version: 3.0.3
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: An ffi wrapper for GEOS, a C++ port of the Java Topology Suite (JTS).
|