ffi-geos 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +20 -0
- data/.travis.yml +7 -3
- data/Gemfile +1 -1
- data/Guardfile +4 -5
- data/ffi-geos.gemspec +1 -1
- data/lib/ffi-geos.rb +212 -196
- data/lib/ffi-geos/buffer_params.rb +9 -20
- data/lib/ffi-geos/coordinate_sequence.rb +342 -58
- data/lib/ffi-geos/geometry.rb +167 -178
- data/lib/ffi-geos/geometry_collection.rb +60 -12
- data/lib/ffi-geos/interrupt.rb +2 -4
- data/lib/ffi-geos/line_string.rb +146 -37
- data/lib/ffi-geos/linear_ring.rb +2 -3
- data/lib/ffi-geos/multi_line_string.rb +1 -2
- data/lib/ffi-geos/multi_point.rb +0 -1
- data/lib/ffi-geos/multi_polygon.rb +0 -1
- data/lib/ffi-geos/point.rb +69 -14
- data/lib/ffi-geos/polygon.rb +110 -21
- data/lib/ffi-geos/prepared_geometry.rb +11 -12
- data/lib/ffi-geos/strtree.rb +41 -52
- data/lib/ffi-geos/tools.rb +15 -18
- data/lib/ffi-geos/utils.rb +27 -44
- data/lib/ffi-geos/version.rb +1 -3
- data/lib/ffi-geos/wkb_reader.rb +4 -9
- data/lib/ffi-geos/wkb_writer.rb +14 -18
- data/lib/ffi-geos/wkt_reader.rb +2 -5
- data/lib/ffi-geos/wkt_writer.rb +17 -22
- data/test/.rubocop.yml +36 -0
- data/test/coordinate_sequence_tests.rb +263 -14
- data/test/geometry_collection_tests.rb +412 -1
- data/test/geometry_tests.rb +156 -86
- data/test/interrupt_tests.rb +2 -4
- data/test/line_string_tests.rb +212 -23
- data/test/linear_ring_tests.rb +1 -2
- data/test/misc_tests.rb +28 -29
- data/test/multi_line_string_tests.rb +0 -1
- data/test/point_tests.rb +158 -1
- data/test/polygon_tests.rb +284 -1
- data/test/prepared_geometry_tests.rb +1 -3
- data/test/strtree_tests.rb +9 -10
- data/test/test_helper.rb +49 -18
- data/test/tools_tests.rb +1 -3
- data/test/utils_tests.rb +22 -22
- data/test/wkb_reader_tests.rb +10 -9
- data/test/wkb_writer_tests.rb +5 -13
- data/test/wkt_reader_tests.rb +1 -2
- data/test/wkt_writer_tests.rb +9 -14
- metadata +6 -3
data/lib/ffi-geos/utils.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
module Geos
|
@@ -35,102 +34,87 @@ module Geos
|
|
35
34
|
cs = args.first
|
36
35
|
elsif args.length == 2
|
37
36
|
cs = CoordinateSequence.new(1, 2)
|
38
|
-
cs.x[0]
|
37
|
+
cs.x[0] = args[0].to_f
|
38
|
+
cs.y[0] = args[1].to_f
|
39
39
|
elsif args.length == 3
|
40
40
|
cs = CoordinateSequence.new(1, 3)
|
41
41
|
cs.x[0], cs.y[0], cs.z[0] = args.map(&:to_f)
|
42
42
|
else
|
43
|
-
raise ArgumentError
|
43
|
+
raise ArgumentError, "Wrong number of arguments (#{args.length} for 1-3)"
|
44
44
|
end
|
45
45
|
|
46
46
|
if cs.length != 1
|
47
|
-
raise ArgumentError
|
47
|
+
raise ArgumentError, 'IllegalArgumentException: Point coordinate list must contain a single element'
|
48
48
|
end
|
49
49
|
|
50
50
|
cs_dup = cs.dup
|
51
51
|
cs_dup.ptr.autorelease = false
|
52
52
|
|
53
|
-
cast_geometry_ptr(FFIGeos.GEOSGeom_createPoint_r(Geos.current_handle_pointer, cs_dup.ptr),
|
54
|
-
:srid => options[:srid]
|
55
|
-
})
|
53
|
+
cast_geometry_ptr(FFIGeos.GEOSGeom_createPoint_r(Geos.current_handle_pointer, cs_dup.ptr), srid: options[:srid])
|
56
54
|
end
|
57
55
|
|
58
56
|
def create_line_string(cs, options = {})
|
59
57
|
cs = cs_from_cs_or_geom(cs)
|
60
58
|
|
61
59
|
if cs.length <= 1 && cs.length != 0
|
62
|
-
raise ArgumentError
|
60
|
+
raise ArgumentError, 'IllegalArgumentException: point array must contain 0 or >1 elements'
|
63
61
|
end
|
64
62
|
|
65
63
|
cs_dup = cs.dup
|
66
64
|
cs_dup.ptr.autorelease = false
|
67
65
|
|
68
|
-
cast_geometry_ptr(FFIGeos.GEOSGeom_createLineString_r(Geos.current_handle_pointer, cs_dup.ptr),
|
69
|
-
:srid => options[:srid]
|
70
|
-
})
|
66
|
+
cast_geometry_ptr(FFIGeos.GEOSGeom_createLineString_r(Geos.current_handle_pointer, cs_dup.ptr), srid: options[:srid])
|
71
67
|
end
|
72
68
|
|
73
69
|
def create_linear_ring(cs, options = {})
|
74
70
|
cs = cs_from_cs_or_geom(cs)
|
75
71
|
|
76
72
|
if cs.length <= 1 && cs.length != 0
|
77
|
-
raise ArgumentError
|
73
|
+
raise ArgumentError, 'IllegalArgumentException: point array must contain 0 or >1 elements'
|
78
74
|
end
|
79
75
|
|
80
76
|
cs.ptr.autorelease = false
|
81
77
|
|
82
|
-
cast_geometry_ptr(FFIGeos.GEOSGeom_createLinearRing_r(Geos.current_handle_pointer, cs.ptr),
|
83
|
-
:srid => options[:srid]
|
84
|
-
})
|
78
|
+
cast_geometry_ptr(FFIGeos.GEOSGeom_createLinearRing_r(Geos.current_handle_pointer, cs.ptr), srid: options[:srid])
|
85
79
|
end
|
86
80
|
|
87
81
|
def create_polygon(outer, *args)
|
88
82
|
options = extract_options!(args)
|
89
83
|
|
90
|
-
inner_dups = Array(args).flatten.collect
|
84
|
+
inner_dups = Array(args).flatten.collect do |i|
|
91
85
|
force_to_linear_ring(i) or
|
92
|
-
raise TypeError
|
93
|
-
|
86
|
+
raise TypeError, 'Expected inner Array to contain Geos::LinearRing or Geos::CoordinateSequence objects'
|
87
|
+
end
|
94
88
|
|
95
89
|
outer_dup = force_to_linear_ring(outer) or
|
96
|
-
raise TypeError
|
90
|
+
raise TypeError, 'Expected outer shell to be a Geos::LinearRing or Geos::CoordinateSequence'
|
97
91
|
|
98
92
|
ary = FFI::MemoryPointer.new(:pointer, inner_dups.length)
|
99
93
|
ary.write_array_of_pointer(inner_dups.map(&:ptr))
|
100
94
|
|
101
95
|
outer_dup.ptr.autorelease = false
|
102
|
-
inner_dups.each
|
96
|
+
inner_dups.each do |i|
|
103
97
|
i.ptr.autorelease = false
|
104
|
-
|
98
|
+
end
|
105
99
|
|
106
|
-
cast_geometry_ptr(FFIGeos.GEOSGeom_createPolygon_r(Geos.current_handle_pointer, outer_dup.ptr, ary, inner_dups.length),
|
107
|
-
:srid => options[:srid]
|
108
|
-
})
|
100
|
+
cast_geometry_ptr(FFIGeos.GEOSGeom_createPolygon_r(Geos.current_handle_pointer, outer_dup.ptr, ary, inner_dups.length), srid: options[:srid])
|
109
101
|
end
|
110
102
|
|
111
103
|
def create_empty_point(options = {})
|
112
|
-
cast_geometry_ptr(FFIGeos.GEOSGeom_createEmptyPoint_r(Geos.current_handle_pointer),
|
113
|
-
:srid => options[:srid]
|
114
|
-
})
|
104
|
+
cast_geometry_ptr(FFIGeos.GEOSGeom_createEmptyPoint_r(Geos.current_handle_pointer), srid: options[:srid])
|
115
105
|
end
|
116
106
|
|
117
107
|
def create_empty_line_string(options = {})
|
118
|
-
cast_geometry_ptr(FFIGeos.GEOSGeom_createEmptyLineString_r(Geos.current_handle_pointer),
|
119
|
-
:srid => options[:srid]
|
120
|
-
})
|
108
|
+
cast_geometry_ptr(FFIGeos.GEOSGeom_createEmptyLineString_r(Geos.current_handle_pointer), srid: options[:srid])
|
121
109
|
end
|
122
110
|
|
123
111
|
def create_empty_polygon(options = {})
|
124
|
-
cast_geometry_ptr(FFIGeos.GEOSGeom_createEmptyPolygon_r(Geos.current_handle_pointer),
|
125
|
-
:srid => options[:srid]
|
126
|
-
})
|
112
|
+
cast_geometry_ptr(FFIGeos.GEOSGeom_createEmptyPolygon_r(Geos.current_handle_pointer), srid: options[:srid])
|
127
113
|
end
|
128
114
|
|
129
115
|
def create_empty_collection(t, options = {})
|
130
116
|
check_enum_value(Geos::GeometryTypes, t)
|
131
|
-
cast_geometry_ptr(FFIGeos.GEOSGeom_createEmptyCollection_r(Geos.current_handle_pointer, t),
|
132
|
-
:srid => options[:srid]
|
133
|
-
})
|
117
|
+
cast_geometry_ptr(FFIGeos.GEOSGeom_createEmptyCollection_r(Geos.current_handle_pointer, t), srid: options[:srid])
|
134
118
|
end
|
135
119
|
|
136
120
|
def create_empty_multi_point(options = {})
|
@@ -169,23 +153,21 @@ module Geos
|
|
169
153
|
|
170
154
|
options = extract_options!(args)
|
171
155
|
|
172
|
-
geoms = Array(args).flatten.tap
|
156
|
+
geoms = Array(args).flatten.tap do |i|
|
173
157
|
if i.detect { |g| !g.is_a?(klass) }
|
174
|
-
raise TypeError
|
158
|
+
raise TypeError, "Expected geoms Array to contain #{klass} objects"
|
175
159
|
end
|
176
|
-
|
160
|
+
end
|
177
161
|
|
178
162
|
geoms_dups = geoms.map(&:dup)
|
179
|
-
geoms_dups.each
|
163
|
+
geoms_dups.each do |i|
|
180
164
|
i.ptr.autorelease = false
|
181
|
-
|
165
|
+
end
|
182
166
|
|
183
167
|
ary = FFI::MemoryPointer.new(:pointer, geoms.length)
|
184
168
|
ary.write_array_of_pointer(geoms_dups.map(&:ptr))
|
185
169
|
|
186
|
-
cast_geometry_ptr(FFIGeos.GEOSGeom_createCollection_r(Geos.current_handle_pointer, t, ary, geoms_dups.length),
|
187
|
-
:srid => options[:srid]
|
188
|
-
})
|
170
|
+
cast_geometry_ptr(FFIGeos.GEOSGeom_createCollection_r(Geos.current_handle_pointer, t, ary, geoms_dups.length), srid: options[:srid])
|
189
171
|
end
|
190
172
|
|
191
173
|
def create_multi_point(*args)
|
@@ -205,6 +187,7 @@ module Geos
|
|
205
187
|
end
|
206
188
|
|
207
189
|
private
|
190
|
+
|
208
191
|
def cs_from_cs_or_geom(geom_or_cs)
|
209
192
|
case geom_or_cs
|
210
193
|
when Array
|
data/lib/ffi-geos/version.rb
CHANGED
data/lib/ffi-geos/wkb_reader.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
module Geos
|
@@ -24,19 +23,15 @@ module Geos
|
|
24
23
|
end
|
25
24
|
|
26
25
|
def read(wkb, options = {})
|
27
|
-
cast_geometry_ptr(FFIGeos.GEOSWKBReader_read_r(Geos.current_handle_pointer,
|
28
|
-
:srid => options[:srid]
|
29
|
-
})
|
26
|
+
cast_geometry_ptr(FFIGeos.GEOSWKBReader_read_r(Geos.current_handle_pointer, ptr, wkb, wkb.bytesize), srid: options[:srid])
|
30
27
|
rescue Geos::GEOSException => e
|
31
|
-
raise ParseError
|
28
|
+
raise ParseError, e
|
32
29
|
end
|
33
30
|
|
34
31
|
def read_hex(wkb, options = {})
|
35
|
-
cast_geometry_ptr(FFIGeos.GEOSWKBReader_readHEX_r(Geos.current_handle_pointer,
|
36
|
-
:srid => options[:srid]
|
37
|
-
})
|
32
|
+
cast_geometry_ptr(FFIGeos.GEOSWKBReader_readHEX_r(Geos.current_handle_pointer, ptr, wkb, wkb.bytesize), srid: options[:srid])
|
38
33
|
rescue Geos::GEOSException => e
|
39
|
-
raise ParseError
|
34
|
+
raise ParseError, e
|
40
35
|
end
|
41
36
|
|
42
37
|
def self.release(ptr) #:nodoc:
|
data/lib/ffi-geos/wkb_writer.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
module Geos
|
@@ -9,7 +8,7 @@ module Geos
|
|
9
8
|
|
10
9
|
def initialize(options = {})
|
11
10
|
options = {
|
12
|
-
:
|
11
|
+
include_srid: false
|
13
12
|
}.merge(options)
|
14
13
|
|
15
14
|
ptr = FFIGeos.GEOSWKBWriter_create_r(Geos.current_handle_pointer)
|
@@ -30,14 +29,14 @@ module Geos
|
|
30
29
|
def write(geom, options = nil)
|
31
30
|
unless options.nil?
|
32
31
|
old_options = {
|
33
|
-
:
|
32
|
+
include_srid: include_srid
|
34
33
|
}
|
35
34
|
|
36
35
|
set_options(options)
|
37
36
|
end
|
38
37
|
|
39
38
|
size_t = FFI::MemoryPointer.new(:size_t)
|
40
|
-
FFIGeos.GEOSWKBWriter_write_r(Geos.current_handle_pointer,
|
39
|
+
FFIGeos.GEOSWKBWriter_write_r(Geos.current_handle_pointer, ptr, geom.ptr, size_t).get_bytes(0, size_t.read_int)
|
41
40
|
ensure
|
42
41
|
set_options(old_options) unless old_options.nil?
|
43
42
|
end
|
@@ -45,53 +44,50 @@ module Geos
|
|
45
44
|
def write_hex(geom, options = nil)
|
46
45
|
unless options.nil?
|
47
46
|
old_options = {
|
48
|
-
:
|
47
|
+
include_srid: include_srid
|
49
48
|
}
|
50
49
|
|
51
50
|
set_options(options)
|
52
51
|
end
|
53
52
|
|
54
53
|
size_t = FFI::MemoryPointer.new(:size_t)
|
55
|
-
FFIGeos.GEOSWKBWriter_writeHEX_r(Geos.current_handle_pointer,
|
54
|
+
FFIGeos.GEOSWKBWriter_writeHEX_r(Geos.current_handle_pointer, ptr, geom.ptr, size_t).get_string(0, size_t.read_int)
|
56
55
|
ensure
|
57
56
|
set_options(old_options) unless old_options.nil?
|
58
57
|
end
|
59
58
|
|
60
59
|
def output_dimensions=(dim)
|
61
60
|
if dim < 2 || dim > 3
|
62
|
-
raise ArgumentError
|
61
|
+
raise ArgumentError, 'Output dimensions must be either 2 or 3'
|
63
62
|
end
|
64
|
-
FFIGeos.GEOSWKBWriter_setOutputDimension_r(Geos.current_handle_pointer,
|
63
|
+
FFIGeos.GEOSWKBWriter_setOutputDimension_r(Geos.current_handle_pointer, ptr, dim)
|
65
64
|
end
|
66
65
|
|
67
66
|
def output_dimensions
|
68
|
-
FFIGeos.GEOSWKBWriter_getOutputDimension_r(Geos.current_handle_pointer,
|
67
|
+
FFIGeos.GEOSWKBWriter_getOutputDimension_r(Geos.current_handle_pointer, ptr)
|
69
68
|
end
|
70
69
|
|
71
70
|
def include_srid
|
72
|
-
bool_result(FFIGeos.GEOSWKBWriter_getIncludeSRID_r(Geos.current_handle_pointer,
|
71
|
+
bool_result(FFIGeos.GEOSWKBWriter_getIncludeSRID_r(Geos.current_handle_pointer, ptr))
|
73
72
|
end
|
74
73
|
|
75
74
|
def include_srid=(val)
|
76
|
-
FFIGeos.GEOSWKBWriter_setIncludeSRID_r(Geos.current_handle_pointer,
|
77
|
-
Geos::Tools.bool_to_int(val)
|
78
|
-
)
|
75
|
+
FFIGeos.GEOSWKBWriter_setIncludeSRID_r(Geos.current_handle_pointer, ptr, Geos::Tools.bool_to_int(val))
|
79
76
|
end
|
80
77
|
|
81
78
|
def byte_order
|
82
|
-
FFIGeos.GEOSWKBWriter_getByteOrder_r(Geos.current_handle_pointer,
|
79
|
+
FFIGeos.GEOSWKBWriter_getByteOrder_r(Geos.current_handle_pointer, ptr)
|
83
80
|
end
|
84
81
|
|
85
82
|
def byte_order=(val)
|
86
83
|
check_enum_value(Geos::ByteOrders, val)
|
87
|
-
FFIGeos.GEOSWKBWriter_setByteOrder_r(Geos.current_handle_pointer,
|
84
|
+
FFIGeos.GEOSWKBWriter_setByteOrder_r(Geos.current_handle_pointer, ptr, val)
|
88
85
|
end
|
89
86
|
|
90
87
|
private
|
88
|
+
|
91
89
|
def set_options(options) #:nodoc:
|
92
|
-
[
|
93
|
-
self.send("#{k}=", options[k]) if options.has_key?(k)
|
94
|
-
end
|
90
|
+
self.include_srid = options[:include_srid] if options.key?(:include_srid)
|
95
91
|
end
|
96
92
|
end
|
97
93
|
end
|
data/lib/ffi-geos/wkt_reader.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
module Geos
|
@@ -24,11 +23,9 @@ module Geos
|
|
24
23
|
end
|
25
24
|
|
26
25
|
def read(wkt, options = {})
|
27
|
-
cast_geometry_ptr(FFIGeos.GEOSWKTReader_read_r(Geos.current_handle_pointer,
|
28
|
-
:srid => options[:srid]
|
29
|
-
})
|
26
|
+
cast_geometry_ptr(FFIGeos.GEOSWKTReader_read_r(Geos.current_handle_pointer, ptr, wkt), srid: options[:srid])
|
30
27
|
rescue Geos::GEOSException => e
|
31
|
-
raise ParseError
|
28
|
+
raise ParseError, e
|
32
29
|
end
|
33
30
|
|
34
31
|
def self.release(ptr) #:nodoc:
|
data/lib/ffi-geos/wkt_writer.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
module Geos
|
@@ -10,10 +9,10 @@ module Geos
|
|
10
9
|
|
11
10
|
def initialize(options = {})
|
12
11
|
options = {
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
12
|
+
trim: false,
|
13
|
+
old_3d: false,
|
14
|
+
rounding_precision: -1,
|
15
|
+
output_dimensions: 2
|
17
16
|
}.merge(options)
|
18
17
|
|
19
18
|
ptr = FFIGeos.GEOSWKTWriter_create_r(Geos.current_handle_pointer)
|
@@ -31,7 +30,7 @@ module Geos
|
|
31
30
|
|
32
31
|
def set_options(options) #:nodoc:
|
33
32
|
[ :trim, :old_3d, :rounding_precision, :output_dimensions ].each do |k|
|
34
|
-
|
33
|
+
send("#{k}=", options[k]) if respond_to?("#{k}=") && options.key?(k)
|
35
34
|
end
|
36
35
|
end
|
37
36
|
private :set_options
|
@@ -42,16 +41,16 @@ module Geos
|
|
42
41
|
def write(geom, options = nil)
|
43
42
|
unless options.nil?
|
44
43
|
old_options = {
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
44
|
+
trim: trim,
|
45
|
+
old_3d: old_3d,
|
46
|
+
rounding_precision: rounding_precision,
|
47
|
+
output_dimensions: output_dimensions
|
49
48
|
}
|
50
49
|
|
51
50
|
set_options(options)
|
52
51
|
end
|
53
52
|
|
54
|
-
FFIGeos.GEOSWKTWriter_write_r(Geos.current_handle_pointer,
|
53
|
+
FFIGeos.GEOSWKTWriter_write_r(Geos.current_handle_pointer, ptr, geom.ptr)
|
55
54
|
ensure
|
56
55
|
set_options(old_options) unless options.nil?
|
57
56
|
end
|
@@ -60,9 +59,7 @@ module Geos
|
|
60
59
|
# Available in GEOS 3.3+.
|
61
60
|
def trim=(val)
|
62
61
|
@trim = !!val
|
63
|
-
FFIGeos.GEOSWKTWriter_setTrim_r(Geos.current_handle_pointer,
|
64
|
-
Geos::Tools.bool_to_int(@trim)
|
65
|
-
)
|
62
|
+
FFIGeos.GEOSWKTWriter_setTrim_r(Geos.current_handle_pointer, ptr, Geos::Tools.bool_to_int(@trim))
|
66
63
|
end
|
67
64
|
end
|
68
65
|
|
@@ -71,11 +68,11 @@ module Geos
|
|
71
68
|
def rounding_precision=(r)
|
72
69
|
r = r.to_i
|
73
70
|
if r > 255
|
74
|
-
raise ArgumentError
|
71
|
+
raise ArgumentError, 'Rounding precision cannot be greater than 255'
|
75
72
|
end
|
76
73
|
|
77
74
|
@rounding_precision = r
|
78
|
-
FFIGeos.GEOSWKTWriter_setRoundingPrecision_r(Geos.current_handle_pointer,
|
75
|
+
FFIGeos.GEOSWKTWriter_setRoundingPrecision_r(Geos.current_handle_pointer, ptr, @rounding_precision)
|
79
76
|
end
|
80
77
|
end
|
81
78
|
|
@@ -83,9 +80,7 @@ module Geos
|
|
83
80
|
# Available in GEOS 3.3+.
|
84
81
|
def old_3d=(val)
|
85
82
|
@old_3d = !!val
|
86
|
-
FFIGeos.GEOSWKTWriter_setOld3D_r(Geos.current_handle_pointer,
|
87
|
-
Geos::Tools.bool_to_int(@old_3d)
|
88
|
-
)
|
83
|
+
FFIGeos.GEOSWKTWriter_setOld3D_r(Geos.current_handle_pointer, ptr, Geos::Tools.bool_to_int(@old_3d))
|
89
84
|
end
|
90
85
|
end
|
91
86
|
|
@@ -94,16 +89,16 @@ module Geos
|
|
94
89
|
def output_dimensions=(dim)
|
95
90
|
dim = dim.to_i
|
96
91
|
if dim < 2 || dim > 3
|
97
|
-
raise ArgumentError
|
92
|
+
raise ArgumentError, 'Output dimensions must be either 2 or 3'
|
98
93
|
end
|
99
|
-
FFIGeos.GEOSWKTWriter_setOutputDimension_r(Geos.current_handle_pointer,
|
94
|
+
FFIGeos.GEOSWKTWriter_setOutputDimension_r(Geos.current_handle_pointer, ptr, dim)
|
100
95
|
end
|
101
96
|
end
|
102
97
|
|
103
98
|
if FFIGeos.respond_to?(:GEOSWKTWriter_getOutputDimension_r)
|
104
99
|
# Available in GEOS 3.3+.
|
105
100
|
def output_dimensions
|
106
|
-
FFIGeos.GEOSWKTWriter_getOutputDimension_r(Geos.current_handle_pointer,
|
101
|
+
FFIGeos.GEOSWKTWriter_getOutputDimension_r(Geos.current_handle_pointer, ptr)
|
107
102
|
end
|
108
103
|
end
|
109
104
|
end
|
data/test/.rubocop.yml
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
inherit_from:
|
3
|
+
- ../.rubocop.yml
|
4
|
+
|
5
|
+
Metrics/BlockLength:
|
6
|
+
Description: 'Avoid long blocks with many lines.'
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
Metrics/ModuleLength:
|
10
|
+
Description: 'Avoid modules longer than 300 lines of code.'
|
11
|
+
Enabled: false
|
12
|
+
Max: 300
|
13
|
+
|
14
|
+
Metrics/MethodLength:
|
15
|
+
Description: 'Avoid methods longer than 10 lines of code.'
|
16
|
+
StyleGuide: '#short-methods'
|
17
|
+
Enabled: false
|
18
|
+
Max: 50
|
19
|
+
|
20
|
+
Metrics/AbcSize:
|
21
|
+
Description: >-
|
22
|
+
A calculated magnitude based on number of assignments,
|
23
|
+
branches, and conditions.
|
24
|
+
Reference: 'http://c2.com/cgi/wiki?AbcMetric'
|
25
|
+
Enabled: true
|
26
|
+
Max: 50
|
27
|
+
|
28
|
+
Metrics/ClassLength:
|
29
|
+
Description: 'Avoid classes longer than 300 lines of code.'
|
30
|
+
Enabled: false
|
31
|
+
Max: 300
|
32
|
+
|
33
|
+
Metrics/ParameterLists:
|
34
|
+
Description: 'Avoid parameter lists longer than three or four parameters.'
|
35
|
+
StyleGuide: '#too-many-params'
|
36
|
+
Enabled: false
|