rgeo 1.0.0 → 1.1.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.
- checksums.yaml +4 -4
- data/lib/rgeo/cartesian/bounding_box.rb +1 -1
- data/lib/rgeo/cartesian/calculations.rb +1 -1
- data/lib/rgeo/cartesian/factory.rb +20 -20
- data/lib/rgeo/cartesian/feature_classes.rb +46 -46
- data/lib/rgeo/cartesian/feature_methods.rb +1 -1
- data/lib/rgeo/cartesian/interface.rb +4 -4
- data/lib/rgeo/coord_sys.rb +1 -1
- data/lib/rgeo/coord_sys/cs/entities.rb +1 -1
- data/lib/rgeo/feature/factory_generator.rb +1 -1
- data/lib/rgeo/feature/geometry.rb +2 -2
- data/lib/rgeo/feature/mixins.rb +1 -1
- data/lib/rgeo/feature/types.rb +11 -11
- data/lib/rgeo/geographic/factory.rb +21 -21
- data/lib/rgeo/geographic/projected_feature_methods.rb +2 -2
- data/lib/rgeo/geographic/projected_window.rb +4 -4
- data/lib/rgeo/geographic/spherical_math.rb +2 -2
- data/lib/rgeo/geos.rb +2 -2
- data/lib/rgeo/geos/capi_factory.rb +19 -19
- data/lib/rgeo/geos/capi_feature_classes.rb +1 -1
- data/lib/rgeo/geos/ffi_factory.rb +28 -28
- data/lib/rgeo/geos/ffi_feature_methods.rb +8 -8
- data/lib/rgeo/geos/interface.rb +3 -3
- data/lib/rgeo/geos/zm_factory.rb +20 -20
- data/lib/rgeo/geos/zm_feature_methods.rb +23 -23
- data/lib/rgeo/version.rb +1 -1
- data/lib/rgeo/wkrep/wkb_parser.rb +1 -1
- data/lib/rgeo/wkrep/wkt_generator.rb +1 -1
- metadata +5 -9
@@ -89,7 +89,7 @@ module RGeo
|
|
89
89
|
@support_m == rhs_.instance_variable_get(:@support_m) &&
|
90
90
|
@proj4 == rhs_.instance_variable_get(:@proj4)
|
91
91
|
end
|
92
|
-
|
92
|
+
alias == eql?
|
93
93
|
|
94
94
|
# Standard hash code
|
95
95
|
|
@@ -148,7 +148,7 @@ module RGeo
|
|
148
148
|
)
|
149
149
|
if (projklass_ = data_["prjc"]) && (projfactory_ = data_["prjf"])
|
150
150
|
klass_ = begin
|
151
|
-
|
151
|
+
RGeo::Geographic.const_get(projklass_)
|
152
152
|
rescue
|
153
153
|
nil
|
154
154
|
end
|
@@ -215,7 +215,7 @@ module RGeo
|
|
215
215
|
)
|
216
216
|
if (projklass_ = coder_["projector_class"]) && (projfactory_ = coder_["projection_factory"])
|
217
217
|
klass_ = begin
|
218
|
-
|
218
|
+
RGeo::Geographic.const_get(projklass_)
|
219
219
|
rescue
|
220
220
|
nil
|
221
221
|
end
|
@@ -296,7 +296,7 @@ module RGeo
|
|
296
296
|
end
|
297
297
|
end
|
298
298
|
|
299
|
-
# See
|
299
|
+
# See RGeo::Feature::Factory#property
|
300
300
|
|
301
301
|
def property(name_)
|
302
302
|
case name_
|
@@ -313,19 +313,19 @@ module RGeo
|
|
313
313
|
end
|
314
314
|
end
|
315
315
|
|
316
|
-
# See
|
316
|
+
# See RGeo::Feature::Factory#parse_wkt
|
317
317
|
|
318
318
|
def parse_wkt(str_)
|
319
319
|
@wkt_parser.parse(str_)
|
320
320
|
end
|
321
321
|
|
322
|
-
# See
|
322
|
+
# See RGeo::Feature::Factory#parse_wkb
|
323
323
|
|
324
324
|
def parse_wkb(str_)
|
325
325
|
@wkb_parser.parse(str_)
|
326
326
|
end
|
327
327
|
|
328
|
-
# See
|
328
|
+
# See RGeo::Feature::Factory#point
|
329
329
|
|
330
330
|
def point(x_, y_, *extra_)
|
331
331
|
@point_class.new(self, x_, y_, *extra_)
|
@@ -333,7 +333,7 @@ module RGeo
|
|
333
333
|
nil
|
334
334
|
end
|
335
335
|
|
336
|
-
# See
|
336
|
+
# See RGeo::Feature::Factory#line_string
|
337
337
|
|
338
338
|
def line_string(points_)
|
339
339
|
@line_string_class.new(self, points_)
|
@@ -341,7 +341,7 @@ module RGeo
|
|
341
341
|
nil
|
342
342
|
end
|
343
343
|
|
344
|
-
# See
|
344
|
+
# See RGeo::Feature::Factory#line
|
345
345
|
|
346
346
|
def line(start_, end_)
|
347
347
|
@line_class.new(self, start_, end_)
|
@@ -349,7 +349,7 @@ module RGeo
|
|
349
349
|
nil
|
350
350
|
end
|
351
351
|
|
352
|
-
# See
|
352
|
+
# See RGeo::Feature::Factory#linear_ring
|
353
353
|
|
354
354
|
def linear_ring(points_)
|
355
355
|
@linear_ring_class.new(self, points_)
|
@@ -357,7 +357,7 @@ module RGeo
|
|
357
357
|
nil
|
358
358
|
end
|
359
359
|
|
360
|
-
# See
|
360
|
+
# See RGeo::Feature::Factory#polygon
|
361
361
|
|
362
362
|
def polygon(outer_ring_, inner_rings_ = nil)
|
363
363
|
@polygon_class.new(self, outer_ring_, inner_rings_)
|
@@ -365,7 +365,7 @@ module RGeo
|
|
365
365
|
nil
|
366
366
|
end
|
367
367
|
|
368
|
-
# See
|
368
|
+
# See RGeo::Feature::Factory#collection
|
369
369
|
|
370
370
|
def collection(elems_)
|
371
371
|
@geometry_collection_class.new(self, elems_)
|
@@ -373,7 +373,7 @@ module RGeo
|
|
373
373
|
nil
|
374
374
|
end
|
375
375
|
|
376
|
-
# See
|
376
|
+
# See RGeo::Feature::Factory#multi_point
|
377
377
|
|
378
378
|
def multi_point(elems_)
|
379
379
|
@multi_point_class.new(self, elems_)
|
@@ -381,7 +381,7 @@ module RGeo
|
|
381
381
|
nil
|
382
382
|
end
|
383
383
|
|
384
|
-
# See
|
384
|
+
# See RGeo::Feature::Factory#multi_line_string
|
385
385
|
|
386
386
|
def multi_line_string(elems_)
|
387
387
|
@multi_line_string_class.new(self, elems_)
|
@@ -389,7 +389,7 @@ module RGeo
|
|
389
389
|
nil
|
390
390
|
end
|
391
391
|
|
392
|
-
# See
|
392
|
+
# See RGeo::Feature::Factory#multi_polygon
|
393
393
|
|
394
394
|
def multi_polygon(elems_)
|
395
395
|
@multi_polygon_class.new(self, elems_)
|
@@ -397,11 +397,11 @@ module RGeo
|
|
397
397
|
nil
|
398
398
|
end
|
399
399
|
|
400
|
-
# See
|
400
|
+
# See RGeo::Feature::Factory#proj4
|
401
401
|
|
402
402
|
attr_reader :proj4
|
403
403
|
|
404
|
-
# See
|
404
|
+
# See RGeo::Feature::Factory#coord_sys
|
405
405
|
|
406
406
|
attr_reader :coord_sys
|
407
407
|
|
@@ -415,7 +415,7 @@ module RGeo
|
|
415
415
|
|
416
416
|
def _marshal_wkb_generator # :nodoc:
|
417
417
|
unless defined?(@marshal_wkb_generator)
|
418
|
-
@marshal_wkb_generator =
|
418
|
+
@marshal_wkb_generator = RGeo::WKRep::WKBGenerator.new(
|
419
419
|
type_format: :wkb12)
|
420
420
|
end
|
421
421
|
@marshal_wkb_generator
|
@@ -423,7 +423,7 @@ module RGeo
|
|
423
423
|
|
424
424
|
def _marshal_wkb_parser # :nodoc:
|
425
425
|
unless defined?(@marshal_wkb_parser)
|
426
|
-
@marshal_wkb_parser =
|
426
|
+
@marshal_wkb_parser = RGeo::WKRep::WKBParser.new(self,
|
427
427
|
support_wkb12: true)
|
428
428
|
end
|
429
429
|
@marshal_wkb_parser
|
@@ -431,7 +431,7 @@ module RGeo
|
|
431
431
|
|
432
432
|
def _psych_wkt_generator # :nodoc:
|
433
433
|
unless defined?(@psych_wkt_generator)
|
434
|
-
@psych_wkt_generator =
|
434
|
+
@psych_wkt_generator = RGeo::WKRep::WKTGenerator.new(
|
435
435
|
tag_format: :wkt12)
|
436
436
|
end
|
437
437
|
@psych_wkt_generator
|
@@ -439,7 +439,7 @@ module RGeo
|
|
439
439
|
|
440
440
|
def _psych_wkt_parser # :nodoc:
|
441
441
|
unless defined?(@psych_wkt_parser)
|
442
|
-
@psych_wkt_parser =
|
442
|
+
@psych_wkt_parser = RGeo::WKRep::WKTParser.new(self,
|
443
443
|
support_wkt12: true, support_ewkt: true)
|
444
444
|
end
|
445
445
|
@psych_wkt_parser
|
@@ -122,8 +122,8 @@ module RGeo
|
|
122
122
|
x_ -= 360.0 if x_ > 180.0
|
123
123
|
x_
|
124
124
|
end
|
125
|
-
|
126
|
-
|
125
|
+
alias canonical_longitude canonical_x
|
126
|
+
alias canonical_lon canonical_x
|
127
127
|
|
128
128
|
def canonical_point
|
129
129
|
if @x >= -180.0 && @x < 180.0
|
@@ -67,7 +67,7 @@ module RGeo
|
|
67
67
|
@factory == obj_.factory && @x_min == obj_.x_min && @x_max == obj_.x_max &&
|
68
68
|
@y_min = obj_.y_min && @y_max = obj_.y_max
|
69
69
|
end
|
70
|
-
|
70
|
+
alias == eql?
|
71
71
|
|
72
72
|
def hash # :nodoc:
|
73
73
|
@factory.hash + @x_min.hash + @x_max.hash + @y_min.hash + @y_max.hash
|
@@ -116,14 +116,14 @@ module RGeo
|
|
116
116
|
span_ += @factory.projection_limits_window.x_span if span_ < 0
|
117
117
|
span_
|
118
118
|
end
|
119
|
-
|
119
|
+
alias width x_span
|
120
120
|
|
121
121
|
# Returns the height of the rectangle.
|
122
122
|
|
123
123
|
def y_span
|
124
124
|
@y_max - @y_min
|
125
125
|
end
|
126
|
-
|
126
|
+
alias height y_span
|
127
127
|
|
128
128
|
# Returns a two-element array containing the x and y coordinates
|
129
129
|
# of the center of the rectangle.
|
@@ -240,7 +240,7 @@ module RGeo
|
|
240
240
|
self
|
241
241
|
end
|
242
242
|
end
|
243
|
-
|
243
|
+
alias * scaled_by
|
244
244
|
|
245
245
|
# Returns a new window resulting from clamping this window to the
|
246
246
|
# given minimum and maximum widths and heights, in the projected
|
@@ -40,7 +40,7 @@ module RGeo
|
|
40
40
|
def eql?(rhs_)
|
41
41
|
rhs_.is_a?(PointXYZ) && @x == rhs_.x && @y == rhs_.y && @z == rhs_.z
|
42
42
|
end
|
43
|
-
|
43
|
+
alias == eql?
|
44
44
|
|
45
45
|
def latlon
|
46
46
|
lat_rad_ = ::Math.asin(@z)
|
@@ -146,7 +146,7 @@ module RGeo
|
|
146
146
|
def eql?(rhs_)
|
147
147
|
rhs_.is_a?(ArcXYZ) && @s == rhs_.s && @e == rhs_.e
|
148
148
|
end
|
149
|
-
|
149
|
+
alias == eql?
|
150
150
|
|
151
151
|
def degenerate?
|
152
152
|
axis_ = axis
|
data/lib/rgeo/geos.rb
CHANGED
@@ -19,7 +19,7 @@ module RGeo
|
|
19
19
|
# therefore not documented.
|
20
20
|
#
|
21
21
|
# To use the Geos implementation, first obtain a factory using the
|
22
|
-
#
|
22
|
+
# RGeo::Geos.factory method. You may then call any of the standard
|
23
23
|
# factory methods on the resulting object.
|
24
24
|
|
25
25
|
module Geos
|
@@ -36,7 +36,7 @@ module RGeo
|
|
36
36
|
begin
|
37
37
|
require "rgeo/geos/geos_c_impl"
|
38
38
|
rescue ::LoadError; end
|
39
|
-
CAPI_SUPPORTED =
|
39
|
+
CAPI_SUPPORTED = RGeo::Geos.const_defined?(:CAPIGeometryMethods)
|
40
40
|
if CAPI_SUPPORTED
|
41
41
|
require "rgeo/geos/capi_feature_classes"
|
42
42
|
require "rgeo/geos/capi_factory"
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module RGeo
|
8
8
|
module Geos
|
9
|
-
# This the GEOS CAPI implementation of
|
9
|
+
# This the GEOS CAPI implementation of RGeo::Feature::Factory.
|
10
10
|
|
11
11
|
class CAPIFactory
|
12
12
|
include Feature::Factory::Instance
|
@@ -15,7 +15,7 @@ module RGeo
|
|
15
15
|
# Create a new factory. Returns nil if the GEOS CAPI implementation
|
16
16
|
# is not supported.
|
17
17
|
#
|
18
|
-
# See
|
18
|
+
# See RGeo::Geos.factory for a list of supported options.
|
19
19
|
|
20
20
|
def create(opts_ = {})
|
21
21
|
# Make sure GEOS is available
|
@@ -110,7 +110,7 @@ module RGeo
|
|
110
110
|
# Return the result
|
111
111
|
result_
|
112
112
|
end
|
113
|
-
|
113
|
+
alias new create
|
114
114
|
end
|
115
115
|
|
116
116
|
# Standard object inspection output
|
@@ -126,7 +126,7 @@ module RGeo
|
|
126
126
|
rhs_._buffer_resolution == _buffer_resolution && rhs_._flags == _flags &&
|
127
127
|
rhs_.proj4 == _proj4
|
128
128
|
end
|
129
|
-
|
129
|
+
alias == eql?
|
130
130
|
|
131
131
|
# Standard hash code
|
132
132
|
|
@@ -259,7 +259,7 @@ module RGeo
|
|
259
259
|
_flags & 0x1 != 0
|
260
260
|
end
|
261
261
|
|
262
|
-
# See
|
262
|
+
# See RGeo::Feature::Factory#property
|
263
263
|
|
264
264
|
def property(name_)
|
265
265
|
case name_
|
@@ -278,7 +278,7 @@ module RGeo
|
|
278
278
|
end
|
279
279
|
end
|
280
280
|
|
281
|
-
# See
|
281
|
+
# See RGeo::Feature::Factory#parse_wkt
|
282
282
|
|
283
283
|
def parse_wkt(str_)
|
284
284
|
if (wkt_parser_ = _wkt_parser)
|
@@ -288,7 +288,7 @@ module RGeo
|
|
288
288
|
end
|
289
289
|
end
|
290
290
|
|
291
|
-
# See
|
291
|
+
# See RGeo::Feature::Factory#parse_wkb
|
292
292
|
|
293
293
|
def parse_wkb(str_)
|
294
294
|
if (wkb_parser_ = _wkb_parser)
|
@@ -298,7 +298,7 @@ module RGeo
|
|
298
298
|
end
|
299
299
|
end
|
300
300
|
|
301
|
-
# See
|
301
|
+
# See RGeo::Feature::Factory#point
|
302
302
|
|
303
303
|
def point(x_, y_, *extra_)
|
304
304
|
if extra_.length > (_flags & 6 == 0 ? 0 : 1)
|
@@ -312,7 +312,7 @@ module RGeo
|
|
312
312
|
end
|
313
313
|
end
|
314
314
|
|
315
|
-
# See
|
315
|
+
# See RGeo::Feature::Factory#line_string
|
316
316
|
|
317
317
|
def line_string(points_)
|
318
318
|
points_ = points_.to_a unless points_.is_a?(::Array)
|
@@ -323,7 +323,7 @@ module RGeo
|
|
323
323
|
end
|
324
324
|
end
|
325
325
|
|
326
|
-
# See
|
326
|
+
# See RGeo::Feature::Factory#line
|
327
327
|
|
328
328
|
def line(start_, end_)
|
329
329
|
CAPILineImpl.create(self, start_, end_)
|
@@ -331,7 +331,7 @@ module RGeo
|
|
331
331
|
nil
|
332
332
|
end
|
333
333
|
|
334
|
-
# See
|
334
|
+
# See RGeo::Feature::Factory#linear_ring
|
335
335
|
|
336
336
|
def linear_ring(points_)
|
337
337
|
points_ = points_.to_a unless points_.is_a?(::Array)
|
@@ -342,7 +342,7 @@ module RGeo
|
|
342
342
|
end
|
343
343
|
end
|
344
344
|
|
345
|
-
# See
|
345
|
+
# See RGeo::Feature::Factory#polygon
|
346
346
|
|
347
347
|
def polygon(outer_ring_, inner_rings_ = nil)
|
348
348
|
inner_rings_ = inner_rings_.to_a unless inner_rings_.is_a?(::Array)
|
@@ -353,7 +353,7 @@ module RGeo
|
|
353
353
|
end
|
354
354
|
end
|
355
355
|
|
356
|
-
# See
|
356
|
+
# See RGeo::Feature::Factory#collection
|
357
357
|
|
358
358
|
def collection(elems_)
|
359
359
|
elems_ = elems_.to_a unless elems_.is_a?(::Array)
|
@@ -364,7 +364,7 @@ module RGeo
|
|
364
364
|
end
|
365
365
|
end
|
366
366
|
|
367
|
-
# See
|
367
|
+
# See RGeo::Feature::Factory#multi_point
|
368
368
|
|
369
369
|
def multi_point(elems_)
|
370
370
|
elems_ = elems_.to_a unless elems_.is_a?(::Array)
|
@@ -375,7 +375,7 @@ module RGeo
|
|
375
375
|
end
|
376
376
|
end
|
377
377
|
|
378
|
-
# See
|
378
|
+
# See RGeo::Feature::Factory#multi_line_string
|
379
379
|
|
380
380
|
def multi_line_string(elems_)
|
381
381
|
elems_ = elems_.to_a unless elems_.is_a?(::Array)
|
@@ -386,7 +386,7 @@ module RGeo
|
|
386
386
|
end
|
387
387
|
end
|
388
388
|
|
389
|
-
# See
|
389
|
+
# See RGeo::Feature::Factory#multi_polygon
|
390
390
|
|
391
391
|
def multi_polygon(elems_)
|
392
392
|
elems_ = elems_.to_a unless elems_.is_a?(::Array)
|
@@ -397,19 +397,19 @@ module RGeo
|
|
397
397
|
end
|
398
398
|
end
|
399
399
|
|
400
|
-
# See
|
400
|
+
# See RGeo::Feature::Factory#proj4
|
401
401
|
|
402
402
|
def proj4
|
403
403
|
_proj4
|
404
404
|
end
|
405
405
|
|
406
|
-
# See
|
406
|
+
# See RGeo::Feature::Factory#coord_sys
|
407
407
|
|
408
408
|
def coord_sys
|
409
409
|
_coord_sys
|
410
410
|
end
|
411
411
|
|
412
|
-
# See
|
412
|
+
# See RGeo::Feature::Factory#override_cast
|
413
413
|
|
414
414
|
def override_cast(original_, ntype_, flags_)
|
415
415
|
return nil unless Geos.supported?
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module RGeo
|
8
8
|
module Geos
|
9
|
-
# This the FFI-GEOS implementation of
|
9
|
+
# This the FFI-GEOS implementation of RGeo::Feature::Factory.
|
10
10
|
|
11
11
|
class FFIFactory
|
12
12
|
include Feature::Factory::Instance
|
@@ -14,7 +14,7 @@ module RGeo
|
|
14
14
|
# Create a new factory. Returns nil if the FFI-GEOS implementation
|
15
15
|
# is not supported.
|
16
16
|
#
|
17
|
-
# See
|
17
|
+
# See RGeo::Geos.factory for a list of supported options.
|
18
18
|
|
19
19
|
def initialize(opts_ = {})
|
20
20
|
# Main flags
|
@@ -126,7 +126,7 @@ module RGeo
|
|
126
126
|
@buffer_resolution == rhs_.property(:buffer_resolution) &&
|
127
127
|
@proj4.eql?(rhs_.proj4)
|
128
128
|
end
|
129
|
-
|
129
|
+
alias == eql?
|
130
130
|
|
131
131
|
# Standard hash code
|
132
132
|
|
@@ -249,7 +249,7 @@ module RGeo
|
|
249
249
|
@uses_lenient_multi_polygon_assertions
|
250
250
|
end
|
251
251
|
|
252
|
-
# See
|
252
|
+
# See RGeo::Feature::Factory#property
|
253
253
|
|
254
254
|
def property(name_)
|
255
255
|
case name_
|
@@ -274,7 +274,7 @@ module RGeo
|
|
274
274
|
_wrap_fg_geom(fg_geom_, nil)
|
275
275
|
end
|
276
276
|
|
277
|
-
# See
|
277
|
+
# See RGeo::Feature::Factory#parse_wkt
|
278
278
|
|
279
279
|
def parse_wkt(str_)
|
280
280
|
if @wkt_reader
|
@@ -284,7 +284,7 @@ module RGeo
|
|
284
284
|
end
|
285
285
|
end
|
286
286
|
|
287
|
-
# See
|
287
|
+
# See RGeo::Feature::Factory#parse_wkb
|
288
288
|
|
289
289
|
def parse_wkb(str_)
|
290
290
|
if @wkb_reader
|
@@ -294,7 +294,7 @@ module RGeo
|
|
294
294
|
end
|
295
295
|
end
|
296
296
|
|
297
|
-
# See
|
297
|
+
# See RGeo::Feature::Factory#point
|
298
298
|
|
299
299
|
def point(x_, y_, z_ = 0)
|
300
300
|
cs_ = ::Geos::CoordinateSequence.new(1, 3)
|
@@ -304,7 +304,7 @@ module RGeo
|
|
304
304
|
FFIPointImpl.new(self, ::Geos::Utils.create_point(cs_), nil)
|
305
305
|
end
|
306
306
|
|
307
|
-
# See
|
307
|
+
# See RGeo::Feature::Factory#line_string
|
308
308
|
|
309
309
|
def line_string(points_)
|
310
310
|
points_ = points_.to_a unless points_.is_a?(::Array)
|
@@ -312,7 +312,7 @@ module RGeo
|
|
312
312
|
return nil if size_ == 1
|
313
313
|
cs_ = ::Geos::CoordinateSequence.new(size_, 3)
|
314
314
|
points_.each_with_index do |p_, i_|
|
315
|
-
return nil unless
|
315
|
+
return nil unless RGeo::Feature::Point.check_type(p_)
|
316
316
|
cs_.set_x(i_, p_.x)
|
317
317
|
cs_.set_y(i_, p_.y)
|
318
318
|
if @has_z
|
@@ -324,11 +324,11 @@ module RGeo
|
|
324
324
|
FFILineStringImpl.new(self, ::Geos::Utils.create_line_string(cs_), nil)
|
325
325
|
end
|
326
326
|
|
327
|
-
# See
|
327
|
+
# See RGeo::Feature::Factory#line
|
328
328
|
|
329
329
|
def line(start_, end_)
|
330
|
-
return nil unless
|
331
|
-
|
330
|
+
return nil unless RGeo::Feature::Point.check_type(start_) &&
|
331
|
+
RGeo::Feature::Point.check_type(end_)
|
332
332
|
cs_ = ::Geos::CoordinateSequence.new(2, 3)
|
333
333
|
cs_.set_x(0, start_.x)
|
334
334
|
cs_.set_x(1, end_.x)
|
@@ -344,7 +344,7 @@ module RGeo
|
|
344
344
|
FFILineImpl.new(self, ::Geos::Utils.create_line_string(cs_), nil)
|
345
345
|
end
|
346
346
|
|
347
|
-
# See
|
347
|
+
# See RGeo::Feature::Factory#linear_ring
|
348
348
|
|
349
349
|
def linear_ring(points_)
|
350
350
|
points_ = points_.to_a unless points_.is_a?(::Array)
|
@@ -352,14 +352,14 @@ module RGeo
|
|
352
352
|
fg_geom_ ? FFILinearRingImpl.new(self, fg_geom_, nil) : nil
|
353
353
|
end
|
354
354
|
|
355
|
-
# See
|
355
|
+
# See RGeo::Feature::Factory#polygon
|
356
356
|
|
357
357
|
def polygon(outer_ring_, inner_rings_ = nil)
|
358
358
|
inner_rings_ = inner_rings_.to_a unless inner_rings_.is_a?(::Array)
|
359
|
-
return nil unless
|
359
|
+
return nil unless RGeo::Feature::LineString.check_type(outer_ring_)
|
360
360
|
outer_ring_ = _create_fg_linear_ring(outer_ring_.points)
|
361
361
|
inner_rings_ = inner_rings_.map do |r_|
|
362
|
-
return nil unless
|
362
|
+
return nil unless RGeo::Feature::LineString.check_type(r_)
|
363
363
|
_create_fg_linear_ring(r_.points)
|
364
364
|
end
|
365
365
|
inner_rings_.compact!
|
@@ -367,7 +367,7 @@ module RGeo
|
|
367
367
|
fg_geom_ ? FFIPolygonImpl.new(self, fg_geom_, nil) : nil
|
368
368
|
end
|
369
369
|
|
370
|
-
# See
|
370
|
+
# See RGeo::Feature::Factory#collection
|
371
371
|
|
372
372
|
def collection(elems_)
|
373
373
|
elems_ = elems_.to_a unless elems_.is_a?(::Array)
|
@@ -375,7 +375,7 @@ module RGeo
|
|
375
375
|
fg_geoms_ = []
|
376
376
|
elems_.each do |elem_|
|
377
377
|
k_ = elem_._klasses if elem_.factory.is_a?(FFIFactory)
|
378
|
-
elem_ =
|
378
|
+
elem_ = RGeo::Feature.cast(elem_, self, :force_new, :keep_subtype)
|
379
379
|
if elem_
|
380
380
|
klasses_ << (k_ || elem_.class)
|
381
381
|
fg_geoms_ << elem_._detach_fg_geom
|
@@ -386,12 +386,12 @@ module RGeo
|
|
386
386
|
fg_geom_ ? FFIGeometryCollectionImpl.new(self, fg_geom_, klasses_) : nil
|
387
387
|
end
|
388
388
|
|
389
|
-
# See
|
389
|
+
# See RGeo::Feature::Factory#multi_point
|
390
390
|
|
391
391
|
def multi_point(elems_)
|
392
392
|
elems_ = elems_.to_a unless elems_.is_a?(::Array)
|
393
393
|
elems_ = elems_.map do |elem_|
|
394
|
-
elem_ =
|
394
|
+
elem_ = RGeo::Feature.cast(elem_, self, RGeo::Feature::Point,
|
395
395
|
:force_new, :keep_subtype)
|
396
396
|
return nil unless elem_
|
397
397
|
elem_._detach_fg_geom
|
@@ -402,13 +402,13 @@ module RGeo
|
|
402
402
|
fg_geom_ ? FFIMultiPointImpl.new(self, fg_geom_, klasses_) : nil
|
403
403
|
end
|
404
404
|
|
405
|
-
# See
|
405
|
+
# See RGeo::Feature::Factory#multi_line_string
|
406
406
|
|
407
407
|
def multi_line_string(elems_)
|
408
408
|
elems_ = elems_.to_a unless elems_.is_a?(::Array)
|
409
409
|
klasses_ = []
|
410
410
|
elems_ = elems_.map do |elem_|
|
411
|
-
elem_ =
|
411
|
+
elem_ = RGeo::Feature.cast(elem_, self, RGeo::Feature::LineString,
|
412
412
|
:force_new, :keep_subtype)
|
413
413
|
return nil unless elem_
|
414
414
|
klasses_ << elem_.class
|
@@ -419,12 +419,12 @@ module RGeo
|
|
419
419
|
fg_geom_ ? FFIMultiLineStringImpl.new(self, fg_geom_, klasses_) : nil
|
420
420
|
end
|
421
421
|
|
422
|
-
# See
|
422
|
+
# See RGeo::Feature::Factory#multi_polygon
|
423
423
|
|
424
424
|
def multi_polygon(elems_)
|
425
425
|
elems_ = elems_.to_a unless elems_.is_a?(::Array)
|
426
426
|
elems_ = elems_.map do |elem_|
|
427
|
-
elem_ =
|
427
|
+
elem_ = RGeo::Feature.cast(elem_, self, RGeo::Feature::Polygon,
|
428
428
|
:force_new, :keep_subtype)
|
429
429
|
return nil unless elem_
|
430
430
|
elem_._detach_fg_geom
|
@@ -445,15 +445,15 @@ module RGeo
|
|
445
445
|
fg_geom_ ? FFIMultiPolygonImpl.new(self, fg_geom_, klasses_) : nil
|
446
446
|
end
|
447
447
|
|
448
|
-
# See
|
448
|
+
# See RGeo::Feature::Factory#proj4
|
449
449
|
|
450
450
|
attr_reader :proj4
|
451
451
|
|
452
|
-
# See
|
452
|
+
# See RGeo::Feature::Factory#coord_sys
|
453
453
|
|
454
454
|
attr_reader :coord_sys
|
455
455
|
|
456
|
-
# See
|
456
|
+
# See RGeo::Feature::Factory#override_cast
|
457
457
|
|
458
458
|
def override_cast(_original_, _ntype_, _flags_)
|
459
459
|
false
|
@@ -523,7 +523,7 @@ module RGeo
|
|
523
523
|
end
|
524
524
|
cs_ = ::Geos::CoordinateSequence.new(size_, 3)
|
525
525
|
points_.each_with_index do |p_, i_|
|
526
|
-
return nil unless
|
526
|
+
return nil unless RGeo::Feature::Point.check_type(p_)
|
527
527
|
cs_.set_x(i_, p_.x)
|
528
528
|
cs_.set_y(i_, p_.y)
|
529
529
|
if @has_z
|