rgeo 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +6 -0
- data/README.rdoc +1 -1
- data/Version +1 -1
- data/ext/geos_c_impl/extconf.rb +13 -13
- data/ext/geos_c_impl/factory.c +30 -18
- data/ext/geos_c_impl/factory.h +18 -12
- data/ext/geos_c_impl/geometry.c +11 -11
- data/ext/geos_c_impl/geometry.h +7 -7
- data/ext/geos_c_impl/geometry_collection.c +15 -15
- data/ext/geos_c_impl/geometry_collection.h +8 -8
- data/ext/geos_c_impl/line_string.c +14 -14
- data/ext/geos_c_impl/line_string.h +7 -7
- data/ext/geos_c_impl/main.c +7 -7
- data/ext/geos_c_impl/point.c +9 -9
- data/ext/geos_c_impl/point.h +7 -7
- data/ext/geos_c_impl/polygon.c +9 -9
- data/ext/geos_c_impl/polygon.h +7 -7
- data/ext/geos_c_impl/preface.h +7 -7
- data/ext/proj4_c_impl/extconf.rb +13 -13
- data/ext/proj4_c_impl/main.c +12 -12
- data/lib/rgeo.rb +26 -26
- data/lib/rgeo/cartesian.rb +12 -12
- data/lib/rgeo/cartesian/analysis.rb +26 -26
- data/lib/rgeo/cartesian/bounding_box.rb +83 -83
- data/lib/rgeo/cartesian/calculations.rb +36 -36
- data/lib/rgeo/cartesian/factory.rb +78 -78
- data/lib/rgeo/cartesian/feature_classes.rb +74 -74
- data/lib/rgeo/cartesian/feature_methods.rb +34 -34
- data/lib/rgeo/cartesian/interface.rb +33 -33
- data/lib/rgeo/coord_sys.rb +15 -15
- data/lib/rgeo/coord_sys/cs/entities.rb +533 -534
- data/lib/rgeo/coord_sys/cs/factories.rb +69 -69
- data/lib/rgeo/coord_sys/cs/wkt_parser.rb +44 -44
- data/lib/rgeo/coord_sys/proj4.rb +85 -85
- data/lib/rgeo/coord_sys/srs_database/active_record_table.rb +31 -31
- data/lib/rgeo/coord_sys/srs_database/interface.rb +44 -44
- data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +31 -31
- data/lib/rgeo/coord_sys/srs_database/sr_org.rb +31 -31
- data/lib/rgeo/coord_sys/srs_database/url_reader.rb +29 -29
- data/lib/rgeo/error.rb +17 -17
- data/lib/rgeo/feature.rb +15 -15
- data/lib/rgeo/feature/curve.rb +58 -58
- data/lib/rgeo/feature/factory.rb +84 -84
- data/lib/rgeo/feature/factory_generator.rb +32 -32
- data/lib/rgeo/feature/geometry.rb +215 -215
- data/lib/rgeo/feature/geometry_collection.rb +46 -46
- data/lib/rgeo/feature/line.rb +21 -21
- data/lib/rgeo/feature/line_string.rb +35 -35
- data/lib/rgeo/feature/linear_ring.rb +20 -20
- data/lib/rgeo/feature/mixins.rb +61 -61
- data/lib/rgeo/feature/multi_curve.rb +37 -37
- data/lib/rgeo/feature/multi_line_string.rb +20 -20
- data/lib/rgeo/feature/multi_point.rb +22 -22
- data/lib/rgeo/feature/multi_polygon.rb +28 -28
- data/lib/rgeo/feature/multi_surface.rb +39 -39
- data/lib/rgeo/feature/point.rb +42 -42
- data/lib/rgeo/feature/polygon.rb +50 -50
- data/lib/rgeo/feature/surface.rb +42 -42
- data/lib/rgeo/feature/types.rb +58 -58
- data/lib/rgeo/geographic.rb +14 -14
- data/lib/rgeo/geographic/factory.rb +87 -87
- data/lib/rgeo/geographic/interface.rb +55 -55
- data/lib/rgeo/geographic/proj4_projector.rb +35 -35
- data/lib/rgeo/geographic/projected_feature_classes.rb +95 -95
- data/lib/rgeo/geographic/projected_feature_methods.rb +81 -81
- data/lib/rgeo/geographic/projected_window.rb +103 -103
- data/lib/rgeo/geographic/simple_mercator_projector.rb +32 -32
- data/lib/rgeo/geographic/spherical_feature_classes.rb +93 -93
- data/lib/rgeo/geographic/spherical_feature_methods.rb +25 -25
- data/lib/rgeo/geographic/spherical_math.rb +58 -58
- data/lib/rgeo/geos.rb +22 -17
- data/lib/rgeo/geos/factory.rb +93 -93
- data/lib/rgeo/geos/ffi_classes.rb +306 -231
- data/lib/rgeo/geos/ffi_factory.rb +100 -96
- data/lib/rgeo/geos/impl_additions.rb +22 -22
- data/lib/rgeo/geos/interface.rb +45 -45
- data/lib/rgeo/geos/zm_factory.rb +90 -90
- data/lib/rgeo/geos/zm_impl.rb +167 -167
- data/lib/rgeo/impl_helper.rb +11 -11
- data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +71 -71
- data/lib/rgeo/impl_helper/basic_geometry_methods.rb +29 -29
- data/lib/rgeo/impl_helper/basic_line_string_methods.rb +61 -61
- data/lib/rgeo/impl_helper/basic_point_methods.rb +43 -43
- data/lib/rgeo/impl_helper/basic_polygon_methods.rb +35 -35
- data/lib/rgeo/impl_helper/math.rb +13 -13
- data/lib/rgeo/version.rb +10 -10
- data/lib/rgeo/wkrep.rb +16 -16
- data/lib/rgeo/wkrep/wkb_generator.rb +51 -51
- data/lib/rgeo/wkrep/wkb_parser.rb +52 -52
- data/lib/rgeo/wkrep/wkt_generator.rb +51 -51
- data/lib/rgeo/wkrep/wkt_parser.rb +66 -66
- data/lib/rgeo/yaml.rb +14 -14
- data/test/common/geometry_collection_tests.rb +53 -53
- data/test/common/line_string_tests.rb +57 -57
- data/test/common/multi_line_string_tests.rb +43 -43
- data/test/common/multi_point_tests.rb +43 -43
- data/test/common/multi_polygon_tests.rb +43 -43
- data/test/common/point_tests.rb +75 -75
- data/test/common/polygon_tests.rb +37 -37
- data/test/coord_sys/tc_active_record_table.rb +25 -25
- data/test/coord_sys/tc_ogc_cs.rb +72 -72
- data/test/coord_sys/tc_proj4.rb +51 -51
- data/test/coord_sys/tc_proj4_srs_data.rb +17 -17
- data/test/coord_sys/tc_sr_org.rb +15 -15
- data/test/coord_sys/tc_url_reader.rb +19 -19
- data/test/geos_capi/tc_factory.rb +21 -21
- data/test/geos_capi/tc_geometry_collection.rb +15 -15
- data/test/geos_capi/tc_line_string.rb +15 -15
- data/test/geos_capi/tc_misc.rb +33 -22
- data/test/geos_capi/tc_multi_line_string.rb +15 -15
- data/test/geos_capi/tc_multi_point.rb +15 -15
- data/test/geos_capi/tc_multi_polygon.rb +15 -15
- data/test/geos_capi/tc_parsing_unparsing.rb +19 -19
- data/test/geos_capi/tc_point.rb +21 -21
- data/test/geos_capi/tc_polygon.rb +19 -19
- data/test/geos_capi/tc_zmfactory.rb +17 -17
- data/test/geos_ffi/tc_factory.rb +21 -21
- data/test/geos_ffi/tc_geometry_collection.rb +15 -15
- data/test/geos_ffi/tc_line_string.rb +15 -15
- data/test/geos_ffi/tc_misc.rb +49 -15
- data/test/geos_ffi/tc_multi_line_string.rb +15 -15
- data/test/geos_ffi/tc_multi_point.rb +15 -15
- data/test/geos_ffi/tc_multi_polygon.rb +15 -15
- data/test/geos_ffi/tc_parsing_unparsing.rb +19 -19
- data/test/geos_ffi/tc_point.rb +21 -21
- data/test/geos_ffi/tc_polygon.rb +19 -19
- data/test/geos_ffi/tc_zmfactory.rb +17 -17
- data/test/projected_geographic/tc_geometry_collection.rb +15 -15
- data/test/projected_geographic/tc_line_string.rb +15 -15
- data/test/projected_geographic/tc_multi_line_string.rb +15 -15
- data/test/projected_geographic/tc_multi_point.rb +15 -15
- data/test/projected_geographic/tc_multi_polygon.rb +15 -15
- data/test/projected_geographic/tc_point.rb +23 -23
- data/test/projected_geographic/tc_polygon.rb +15 -15
- data/test/simple_cartesian/tc_calculations.rb +31 -31
- data/test/simple_cartesian/tc_geometry_collection.rb +17 -17
- data/test/simple_cartesian/tc_line_string.rb +17 -17
- data/test/simple_cartesian/tc_multi_line_string.rb +17 -17
- data/test/simple_cartesian/tc_multi_point.rb +17 -17
- data/test/simple_cartesian/tc_multi_polygon.rb +17 -17
- data/test/simple_cartesian/tc_point.rb +21 -21
- data/test/simple_cartesian/tc_polygon.rb +17 -17
- data/test/simple_mercator/tc_geometry_collection.rb +15 -15
- data/test/simple_mercator/tc_line_string.rb +15 -15
- data/test/simple_mercator/tc_multi_line_string.rb +15 -15
- data/test/simple_mercator/tc_multi_point.rb +15 -15
- data/test/simple_mercator/tc_multi_polygon.rb +15 -15
- data/test/simple_mercator/tc_point.rb +23 -23
- data/test/simple_mercator/tc_polygon.rb +15 -15
- data/test/simple_mercator/tc_window.rb +50 -50
- data/test/spherical_geographic/tc_calculations.rb +47 -47
- data/test/spherical_geographic/tc_geometry_collection.rb +17 -17
- data/test/spherical_geographic/tc_line_string.rb +17 -17
- data/test/spherical_geographic/tc_multi_line_string.rb +17 -17
- data/test/spherical_geographic/tc_multi_point.rb +17 -17
- data/test/spherical_geographic/tc_multi_polygon.rb +17 -17
- data/test/spherical_geographic/tc_point.rb +23 -23
- data/test/spherical_geographic/tc_polygon.rb +17 -17
- data/test/tc_cartesian_analysis.rb +23 -23
- data/test/tc_mixins.rb +39 -39
- data/test/tc_oneoff.rb +15 -15
- data/test/tc_types.rb +17 -17
- data/test/wkrep/tc_wkb_generator.rb +67 -67
- data/test/wkrep/tc_wkb_parser.rb +73 -73
- data/test/wkrep/tc_wkt_generator.rb +75 -75
- data/test/wkrep/tc_wkt_parser.rb +97 -97
- metadata +3 -3
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# FFI-GEOS factory implementation
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010 Daniel Azuma
|
7
|
-
#
|
6
|
+
# Copyright 2010-2012 Daniel Azuma
|
7
|
+
#
|
8
8
|
# All rights reserved.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# Redistribution and use in source and binary forms, with or without
|
11
11
|
# modification, are permitted provided that the following conditions are met:
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# * Redistributions of source code must retain the above copyright notice,
|
14
14
|
# this list of conditions and the following disclaimer.
|
15
15
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# * Neither the name of the copyright holder, nor the names of any other
|
19
19
|
# contributors to this software, may be used to endorse or promote products
|
20
20
|
# derived from this software without specific prior written permission.
|
21
|
-
#
|
21
|
+
#
|
22
22
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
23
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
24
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
@@ -35,23 +35,23 @@
|
|
35
35
|
|
36
36
|
|
37
37
|
module RGeo
|
38
|
-
|
38
|
+
|
39
39
|
module Geos
|
40
|
-
|
41
|
-
|
40
|
+
|
41
|
+
|
42
42
|
# This the FFI-GEOS implementation of ::RGeo::Feature::Factory.
|
43
|
-
|
43
|
+
|
44
44
|
class FFIFactory
|
45
|
-
|
46
|
-
|
45
|
+
|
46
|
+
|
47
47
|
include Feature::Factory::Instance
|
48
|
-
|
49
|
-
|
48
|
+
|
49
|
+
|
50
50
|
# Create a new factory. Returns nil if the FFI-GEOS implementation
|
51
51
|
# is not supported.
|
52
|
-
#
|
52
|
+
#
|
53
53
|
# See ::RGeo::Geos.factory for a list of supported options.
|
54
|
-
|
54
|
+
|
55
55
|
def initialize(opts_={})
|
56
56
|
# Main flags
|
57
57
|
@uses_lenient_multi_polygon_assertions = opts_[:lenient_multi_polygon_assertions] ||
|
@@ -64,7 +64,8 @@ module RGeo
|
|
64
64
|
@_has_3d = @has_z || @has_m
|
65
65
|
@buffer_resolution = opts_[:buffer_resolution].to_i
|
66
66
|
@buffer_resolution = 1 if @buffer_resolution < 1
|
67
|
-
|
67
|
+
@_auto_prepare = opts_[:auto_prepare] == :disabled ? false : true
|
68
|
+
|
68
69
|
# Interpret the generator options
|
69
70
|
wkt_generator_ = opts_[:wkt_generator]
|
70
71
|
case wkt_generator_
|
@@ -90,7 +91,7 @@ module RGeo
|
|
90
91
|
@wkb_generator = WKRep::WKBGenerator.new
|
91
92
|
@wkb_writer = nil
|
92
93
|
end
|
93
|
-
|
94
|
+
|
94
95
|
# Coordinate system (srid, proj4, and coord_sys)
|
95
96
|
@srid = opts_[:srid]
|
96
97
|
@proj4 = opts_[:proj4]
|
@@ -114,7 +115,7 @@ module RGeo
|
|
114
115
|
end
|
115
116
|
@srid ||= @coord_sys.authority_code if @coord_sys
|
116
117
|
@srid = @srid.to_i
|
117
|
-
|
118
|
+
|
118
119
|
# Interpret parser options
|
119
120
|
wkt_parser_ = opts_[:wkt_parser]
|
120
121
|
case wkt_parser_
|
@@ -141,47 +142,47 @@ module RGeo
|
|
141
142
|
@wkb_reader = nil
|
142
143
|
end
|
143
144
|
end
|
144
|
-
|
145
|
-
|
145
|
+
|
146
|
+
|
146
147
|
def inspect # :nodoc:
|
147
148
|
"#<#{self.class}:0x#{object_id.to_s(16)} srid=#{srid}>"
|
148
149
|
end
|
149
|
-
|
150
|
-
|
150
|
+
|
151
|
+
|
151
152
|
# Factory equivalence test.
|
152
|
-
|
153
|
+
|
153
154
|
def eql?(rhs_)
|
154
155
|
rhs_.is_a?(self.class) && @srid == rhs_.srid &&
|
155
156
|
@has_z == rhs_.property(:has_z_coordinate) &&
|
156
157
|
@has_m == rhs_.property(:has_m_coordinate)
|
157
158
|
end
|
158
159
|
alias_method :==, :eql?
|
159
|
-
|
160
|
-
|
160
|
+
|
161
|
+
|
161
162
|
# Returns the SRID of geometries created by this factory.
|
162
|
-
|
163
|
+
|
163
164
|
def srid
|
164
165
|
@srid
|
165
166
|
end
|
166
|
-
|
167
|
-
|
167
|
+
|
168
|
+
|
168
169
|
# Returns the resolution used by buffer calculations on geometries
|
169
170
|
# created by this factory
|
170
|
-
|
171
|
+
|
171
172
|
def buffer_resolution
|
172
173
|
@buffer_resolution
|
173
174
|
end
|
174
|
-
|
175
|
-
|
175
|
+
|
176
|
+
|
176
177
|
# Returns true if this factory is lenient with MultiPolygon assertions
|
177
|
-
|
178
|
+
|
178
179
|
def lenient_multi_polygon_assertions?
|
179
180
|
@uses_lenient_multi_polygon_assertions
|
180
181
|
end
|
181
|
-
|
182
|
-
|
182
|
+
|
183
|
+
|
183
184
|
# See ::RGeo::Feature::Factory#property
|
184
|
-
|
185
|
+
|
185
186
|
def property(name_)
|
186
187
|
case name_
|
187
188
|
when :has_z_coordinate
|
@@ -194,14 +195,16 @@ module RGeo
|
|
194
195
|
@buffer_resolution
|
195
196
|
when :uses_lenient_multi_polygon_assertions
|
196
197
|
@uses_lenient_multi_polygon_assertions
|
198
|
+
when :auto_prepare
|
199
|
+
@_auto_prepare ? :simple : :disabled
|
197
200
|
else
|
198
201
|
nil
|
199
202
|
end
|
200
203
|
end
|
201
|
-
|
202
|
-
|
204
|
+
|
205
|
+
|
203
206
|
# See ::RGeo::Feature::Factory#parse_wkt
|
204
|
-
|
207
|
+
|
205
208
|
def parse_wkt(str_)
|
206
209
|
if @wkt_reader
|
207
210
|
@wkt_reader.read(str_)
|
@@ -209,10 +212,10 @@ module RGeo
|
|
209
212
|
@wkt_parser.parse(str_)
|
210
213
|
end
|
211
214
|
end
|
212
|
-
|
213
|
-
|
215
|
+
|
216
|
+
|
214
217
|
# See ::RGeo::Feature::Factory#parse_wkb
|
215
|
-
|
218
|
+
|
216
219
|
def parse_wkb(str_)
|
217
220
|
if @wkb_reader
|
218
221
|
@wkb_reader.read(str_)
|
@@ -220,8 +223,8 @@ module RGeo
|
|
220
223
|
@wkb_parser.parse(str_)
|
221
224
|
end
|
222
225
|
end
|
223
|
-
|
224
|
-
|
226
|
+
|
227
|
+
|
225
228
|
def wrap_fg_geom(fg_geom_, klass_=nil) # :nodoc:
|
226
229
|
klasses_ = nil
|
227
230
|
unless klass_.kind_of?(::Class)
|
@@ -257,10 +260,10 @@ module RGeo
|
|
257
260
|
end
|
258
261
|
klass_.new(self, fg_geom_, klasses_)
|
259
262
|
end
|
260
|
-
|
261
|
-
|
263
|
+
|
264
|
+
|
262
265
|
# See ::RGeo::Feature::Factory#point
|
263
|
-
|
266
|
+
|
264
267
|
def point(x_, y_, z_=0)
|
265
268
|
cs_ = ::Geos::CoordinateSequence.new(1, 3)
|
266
269
|
cs_.set_x(0, x_)
|
@@ -268,10 +271,10 @@ module RGeo
|
|
268
271
|
cs_.set_z(0, z_)
|
269
272
|
FFIPointImpl.new(self, ::Geos::Utils.create_point(cs_), nil)
|
270
273
|
end
|
271
|
-
|
272
|
-
|
274
|
+
|
275
|
+
|
273
276
|
# See ::RGeo::Feature::Factory#line_string
|
274
|
-
|
277
|
+
|
275
278
|
def line_string(points_)
|
276
279
|
points_ = points_.to_a unless points_.kind_of?(::Array)
|
277
280
|
size_ = points_.size
|
@@ -289,10 +292,10 @@ module RGeo
|
|
289
292
|
end
|
290
293
|
FFILineStringImpl.new(self, ::Geos::Utils.create_line_string(cs_), nil)
|
291
294
|
end
|
292
|
-
|
293
|
-
|
295
|
+
|
296
|
+
|
294
297
|
# See ::RGeo::Feature::Factory#line
|
295
|
-
|
298
|
+
|
296
299
|
def line(start_, end_)
|
297
300
|
return nil unless ::RGeo::Feature::Point.check_type(start_) &&
|
298
301
|
::RGeo::Feature::Point.check_type(end_)
|
@@ -310,19 +313,19 @@ module RGeo
|
|
310
313
|
end
|
311
314
|
FFILineImpl.new(self, ::Geos::Utils.create_line_string(cs_), nil)
|
312
315
|
end
|
313
|
-
|
314
|
-
|
316
|
+
|
317
|
+
|
315
318
|
# See ::RGeo::Feature::Factory#linear_ring
|
316
|
-
|
319
|
+
|
317
320
|
def linear_ring(points_)
|
318
321
|
points_ = points_.to_a unless points_.kind_of?(::Array)
|
319
322
|
fg_geom_ = _create_fg_linear_ring(points_)
|
320
323
|
fg_geom_ ? FFILinearRingImpl.new(self, fg_geom_, nil) : nil
|
321
324
|
end
|
322
|
-
|
323
|
-
|
325
|
+
|
326
|
+
|
324
327
|
# See ::RGeo::Feature::Factory#polygon
|
325
|
-
|
328
|
+
|
326
329
|
def polygon(outer_ring_, inner_rings_=nil)
|
327
330
|
inner_rings_ = inner_rings_.to_a unless inner_rings_.kind_of?(::Array)
|
328
331
|
return nil unless ::RGeo::Feature::LineString.check_type(outer_ring_)
|
@@ -335,10 +338,10 @@ module RGeo
|
|
335
338
|
fg_geom_ = ::Geos::Utils.create_polygon(outer_ring_, *inner_rings_)
|
336
339
|
fg_geom_ ? FFIPolygonImpl.new(self, fg_geom_, nil) : nil
|
337
340
|
end
|
338
|
-
|
339
|
-
|
341
|
+
|
342
|
+
|
340
343
|
# See ::RGeo::Feature::Factory#collection
|
341
|
-
|
344
|
+
|
342
345
|
def collection(elems_)
|
343
346
|
elems_ = elems_.to_a unless elems_.kind_of?(::Array)
|
344
347
|
klasses_ = []
|
@@ -355,10 +358,10 @@ module RGeo
|
|
355
358
|
::Geos::GeomTypes::GEOS_GEOMETRYCOLLECTION, fg_geoms_)
|
356
359
|
fg_geom_ ? FFIGeometryCollectionImpl.new(self, fg_geom_, klasses_) : nil
|
357
360
|
end
|
358
|
-
|
359
|
-
|
361
|
+
|
362
|
+
|
360
363
|
# See ::RGeo::Feature::Factory#multi_point
|
361
|
-
|
364
|
+
|
362
365
|
def multi_point(elems_)
|
363
366
|
elems_ = elems_.to_a unless elems_.kind_of?(::Array)
|
364
367
|
fg_geoms_ = []
|
@@ -373,10 +376,10 @@ module RGeo
|
|
373
376
|
::Geos::GeomTypes::GEOS_MULTIPOINT, elems_)
|
374
377
|
fg_geom_ ? FFIMultiPointImpl.new(self, fg_geom_, klasses_) : nil
|
375
378
|
end
|
376
|
-
|
377
|
-
|
379
|
+
|
380
|
+
|
378
381
|
# See ::RGeo::Feature::Factory#multi_line_string
|
379
|
-
|
382
|
+
|
380
383
|
def multi_line_string(elems_)
|
381
384
|
elems_ = elems_.to_a unless elems_.kind_of?(::Array)
|
382
385
|
klasses_ = []
|
@@ -391,10 +394,10 @@ module RGeo
|
|
391
394
|
::Geos::GeomTypes::GEOS_MULTILINESTRING, elems_)
|
392
395
|
fg_geom_ ? FFIMultiLineStringImpl.new(self, fg_geom_, klasses_) : nil
|
393
396
|
end
|
394
|
-
|
395
|
-
|
397
|
+
|
398
|
+
|
396
399
|
# See ::RGeo::Feature::Factory#multi_polygon
|
397
|
-
|
400
|
+
|
398
401
|
def multi_polygon(elems_)
|
399
402
|
elems_ = elems_.to_a unless elems_.kind_of?(::Array)
|
400
403
|
elems_.map! do |elem_|
|
@@ -418,33 +421,34 @@ module RGeo
|
|
418
421
|
::Geos::GeomTypes::GEOS_MULTIPOLYGON, elems_)
|
419
422
|
fg_geom_ ? FFIMultiPolygonImpl.new(self, fg_geom_, klasses_) : nil
|
420
423
|
end
|
421
|
-
|
422
|
-
|
424
|
+
|
425
|
+
|
423
426
|
# See ::RGeo::Feature::Factory#proj4
|
424
|
-
|
427
|
+
|
425
428
|
def proj4
|
426
429
|
@proj4
|
427
430
|
end
|
428
|
-
|
429
|
-
|
431
|
+
|
432
|
+
|
430
433
|
# See ::RGeo::Feature::Factory#coord_sys
|
431
|
-
|
434
|
+
|
432
435
|
def coord_sys
|
433
436
|
@coord_sys
|
434
437
|
end
|
435
|
-
|
436
|
-
|
438
|
+
|
439
|
+
|
437
440
|
# See ::RGeo::Feature::Factory#override_cast
|
438
|
-
|
441
|
+
|
439
442
|
def override_cast(original_, ntype_, flags_)
|
440
443
|
false
|
441
444
|
# TODO
|
442
445
|
end
|
443
|
-
|
444
|
-
|
446
|
+
|
447
|
+
|
445
448
|
attr_reader :_has_3d # :nodoc:
|
446
|
-
|
447
|
-
|
449
|
+
attr_reader :_auto_prepare # :nodoc:
|
450
|
+
|
451
|
+
|
448
452
|
def _convert_to_fg_geometry(obj_, type_=nil) # :nodoc:
|
449
453
|
if type_.nil? && obj_.factory == self
|
450
454
|
obj_
|
@@ -453,8 +457,8 @@ module RGeo
|
|
453
457
|
end
|
454
458
|
obj_ ? obj_.fg_geom : nil
|
455
459
|
end
|
456
|
-
|
457
|
-
|
460
|
+
|
461
|
+
|
458
462
|
def _create_fg_linear_ring(points_) # :nodoc:
|
459
463
|
size_ = points_.size
|
460
464
|
return nil if size_ == 1 || size_ == 2
|
@@ -475,8 +479,8 @@ module RGeo
|
|
475
479
|
end
|
476
480
|
::Geos::Utils.create_linear_ring(cs_)
|
477
481
|
end
|
478
|
-
|
479
|
-
|
482
|
+
|
483
|
+
|
480
484
|
def _generate_wkt(geom_) # :nodoc:
|
481
485
|
if @wkt_writer
|
482
486
|
@wkt_writer.write(geom_.fg_geom)
|
@@ -484,8 +488,8 @@ module RGeo
|
|
484
488
|
@wkt_generator.generate(geom_)
|
485
489
|
end
|
486
490
|
end
|
487
|
-
|
488
|
-
|
491
|
+
|
492
|
+
|
489
493
|
def _generate_wkb(geom_) # :nodoc:
|
490
494
|
if @wkb_writer
|
491
495
|
@wkb_writer.write(geom_.fg_geom)
|
@@ -493,11 +497,11 @@ module RGeo
|
|
493
497
|
@wkb_generator.generate(geom_)
|
494
498
|
end
|
495
499
|
end
|
496
|
-
|
497
|
-
|
500
|
+
|
501
|
+
|
498
502
|
end
|
499
|
-
|
500
|
-
|
503
|
+
|
504
|
+
|
501
505
|
end
|
502
|
-
|
506
|
+
|
503
507
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# GEOS implementation additions written in Ruby
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010 Daniel Azuma
|
7
|
-
#
|
6
|
+
# Copyright 2010-2012 Daniel Azuma
|
7
|
+
#
|
8
8
|
# All rights reserved.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# Redistribution and use in source and binary forms, with or without
|
11
11
|
# modification, are permitted provided that the following conditions are met:
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# * Redistributions of source code must retain the above copyright notice,
|
14
14
|
# this list of conditions and the following disclaimer.
|
15
15
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# * Neither the name of the copyright holder, nor the names of any other
|
19
19
|
# contributors to this software, may be used to endorse or promote products
|
20
20
|
# derived from this software without specific prior written permission.
|
21
|
-
#
|
21
|
+
#
|
22
22
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
23
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
24
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
@@ -34,24 +34,24 @@
|
|
34
34
|
|
35
35
|
|
36
36
|
module RGeo
|
37
|
-
|
37
|
+
|
38
38
|
module Geos
|
39
|
-
|
40
|
-
|
39
|
+
|
40
|
+
|
41
41
|
class GeometryImpl # :nodoc:
|
42
|
-
|
42
|
+
|
43
43
|
include Feature::Instance
|
44
|
-
|
44
|
+
|
45
45
|
def inspect
|
46
46
|
"#<#{self.class}:0x#{object_id.to_s(16)} #{as_text.inspect}>"
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
end
|
50
|
-
|
51
|
-
|
50
|
+
|
51
|
+
|
52
52
|
class Factory
|
53
|
-
|
54
|
-
|
53
|
+
|
54
|
+
|
55
55
|
# :stopdoc:
|
56
56
|
if defined?(::RGeo::Geos::PointImpl)
|
57
57
|
IMPL_CLASSES = {
|
@@ -66,11 +66,11 @@ module RGeo
|
|
66
66
|
}.freeze
|
67
67
|
end
|
68
68
|
# :startdoc:
|
69
|
-
|
70
|
-
|
69
|
+
|
70
|
+
|
71
71
|
end
|
72
|
-
|
73
|
-
|
72
|
+
|
73
|
+
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
76
|
end
|