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
data/lib/rgeo/geos/zm_impl.rb
CHANGED
@@ -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
|
@@ -35,248 +35,248 @@
|
|
35
35
|
|
36
36
|
|
37
37
|
module RGeo
|
38
|
-
|
38
|
+
|
39
39
|
module Geos
|
40
|
-
|
41
|
-
|
40
|
+
|
41
|
+
|
42
42
|
class ZMGeometryImpl # :nodoc:
|
43
|
-
|
43
|
+
|
44
44
|
include Feature::Instance
|
45
|
-
|
46
|
-
|
45
|
+
|
46
|
+
|
47
47
|
def initialize(factory_, zgeometry_, mgeometry_)
|
48
48
|
@factory = factory_
|
49
49
|
@zgeometry = zgeometry_
|
50
50
|
@mgeometry = mgeometry_
|
51
51
|
end
|
52
|
-
|
53
|
-
|
52
|
+
|
53
|
+
|
54
54
|
def inspect # :nodoc:
|
55
55
|
"#<#{self.class}:0x#{object_id.to_s(16)} #{as_text.inspect}>"
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
def to_s # :nodoc:
|
59
59
|
as_text
|
60
60
|
end
|
61
|
-
|
62
|
-
|
61
|
+
|
62
|
+
|
63
63
|
def factory
|
64
64
|
@factory
|
65
65
|
end
|
66
|
-
|
67
|
-
|
66
|
+
|
67
|
+
|
68
68
|
def z_geometry
|
69
69
|
@zgeometry
|
70
70
|
end
|
71
|
-
|
72
|
-
|
71
|
+
|
72
|
+
|
73
73
|
def m_geometry
|
74
74
|
@mgeometry
|
75
75
|
end
|
76
|
-
|
77
|
-
|
76
|
+
|
77
|
+
|
78
78
|
def eql?(rhs_)
|
79
79
|
rhs_.is_a?(self.class) && @factory.eql?(rhs_.factory) && @zgeometry.eql?(rhs_.z_geometry) && @mgeometry.eql?(rhs_.m_geometry)
|
80
80
|
end
|
81
|
-
|
82
|
-
|
81
|
+
|
82
|
+
|
83
83
|
def dimension
|
84
84
|
@zgeometry.dimension
|
85
85
|
end
|
86
|
-
|
87
|
-
|
86
|
+
|
87
|
+
|
88
88
|
def geometry_type
|
89
89
|
@zgeometry.geometry_type
|
90
90
|
end
|
91
|
-
|
92
|
-
|
91
|
+
|
92
|
+
|
93
93
|
def srid
|
94
94
|
@factory.srid
|
95
95
|
end
|
96
|
-
|
97
|
-
|
96
|
+
|
97
|
+
|
98
98
|
def envelope
|
99
99
|
ZMGeometryImpl.create(@factory, @zgeometry.envelope, @mgeometry.envelope)
|
100
100
|
end
|
101
|
-
|
102
|
-
|
101
|
+
|
102
|
+
|
103
103
|
def as_text
|
104
104
|
@factory.instance_variable_get(:@wkt_generator).generate(self)
|
105
105
|
end
|
106
|
-
|
107
|
-
|
106
|
+
|
107
|
+
|
108
108
|
def as_binary
|
109
109
|
@factory.instance_variable_get(:@wkb_generator).generate(self)
|
110
110
|
end
|
111
|
-
|
112
|
-
|
111
|
+
|
112
|
+
|
113
113
|
def is_empty?
|
114
114
|
@zgeometry.is_empty?
|
115
115
|
end
|
116
|
-
|
117
|
-
|
116
|
+
|
117
|
+
|
118
118
|
def is_simple?
|
119
119
|
@zgeometry.is_simple?
|
120
120
|
end
|
121
|
-
|
122
|
-
|
121
|
+
|
122
|
+
|
123
123
|
def boundary
|
124
124
|
ZMGeometryImpl.create(@factory, @zgeometry.boundary, @mgeometry.boundary)
|
125
125
|
end
|
126
|
-
|
127
|
-
|
126
|
+
|
127
|
+
|
128
128
|
def equals?(rhs_)
|
129
129
|
@zgeometry.equals?(rhs_)
|
130
130
|
end
|
131
|
-
|
132
|
-
|
131
|
+
|
132
|
+
|
133
133
|
def disjoint?(rhs_)
|
134
134
|
@zgeometry.disjoint?(rhs_)
|
135
135
|
end
|
136
|
-
|
137
|
-
|
136
|
+
|
137
|
+
|
138
138
|
def intersects?(rhs_)
|
139
139
|
@zgeometry.intersects?(rhs_)
|
140
140
|
end
|
141
|
-
|
142
|
-
|
141
|
+
|
142
|
+
|
143
143
|
def touches?(rhs_)
|
144
144
|
@zgeometry.touches?(rhs_)
|
145
145
|
end
|
146
|
-
|
147
|
-
|
146
|
+
|
147
|
+
|
148
148
|
def crosses?(rhs_)
|
149
149
|
@zgeometry.crosses?(rhs_)
|
150
150
|
end
|
151
|
-
|
152
|
-
|
151
|
+
|
152
|
+
|
153
153
|
def within?(rhs_)
|
154
154
|
@zgeometry.within?(rhs_)
|
155
155
|
end
|
156
|
-
|
157
|
-
|
156
|
+
|
157
|
+
|
158
158
|
def contains?(rhs_)
|
159
159
|
@zgeometry.contains?(rhs_)
|
160
160
|
end
|
161
|
-
|
162
|
-
|
161
|
+
|
162
|
+
|
163
163
|
def overlaps?(rhs_)
|
164
164
|
@zgeometry.overlaps?(rhs_)
|
165
165
|
end
|
166
|
-
|
167
|
-
|
166
|
+
|
167
|
+
|
168
168
|
def relate(rhs_, pattern_)
|
169
169
|
@zgeometry.relate(rhs_, pattern_)
|
170
170
|
end
|
171
|
-
|
172
|
-
|
171
|
+
|
172
|
+
|
173
173
|
def distance(rhs_)
|
174
174
|
@zgeometry.distance(rhs_)
|
175
175
|
end
|
176
|
-
|
177
|
-
|
176
|
+
|
177
|
+
|
178
178
|
def buffer(distance_)
|
179
179
|
ZMGeometryImpl.create(@factory, @zgeometry.buffer(distance_), @mgeometry.buffer(distance_))
|
180
180
|
end
|
181
|
-
|
182
|
-
|
181
|
+
|
182
|
+
|
183
183
|
def convex_hull
|
184
184
|
ZMGeometryImpl.create(@factory, @zgeometry.convex_hull, @mgeometry.convex_hull)
|
185
185
|
end
|
186
|
-
|
187
|
-
|
186
|
+
|
187
|
+
|
188
188
|
def intersection(rhs_)
|
189
189
|
ZMGeometryImpl.create(@factory, @zgeometry.intersection(rhs_), @mgeometry.intersection(rhs_))
|
190
190
|
end
|
191
|
-
|
192
|
-
|
191
|
+
|
192
|
+
|
193
193
|
def union(rhs_)
|
194
194
|
ZMGeometryImpl.create(@factory, @zgeometry.union(rhs_), @mgeometry.union(rhs_))
|
195
195
|
end
|
196
|
-
|
197
|
-
|
196
|
+
|
197
|
+
|
198
198
|
def difference(rhs_)
|
199
199
|
ZMGeometryImpl.create(@factory, @zgeometry.difference(rhs_), @mgeometry.difference(rhs_))
|
200
200
|
end
|
201
|
-
|
202
|
-
|
201
|
+
|
202
|
+
|
203
203
|
def sym_difference(rhs_)
|
204
204
|
ZMGeometryImpl.create(@factory, @zgeometry.sym_difference(rhs_), @mgeometry.sym_difference(rhs_))
|
205
205
|
end
|
206
|
-
|
207
|
-
|
206
|
+
|
207
|
+
|
208
208
|
alias_method :==, :equals?
|
209
209
|
alias_method :-, :difference
|
210
210
|
alias_method :+, :union
|
211
211
|
alias_method :*, :intersection
|
212
|
-
|
212
|
+
|
213
213
|
end
|
214
|
-
|
215
|
-
|
214
|
+
|
215
|
+
|
216
216
|
class ZMPointImpl < ZMGeometryImpl # :nodoc:
|
217
|
-
|
218
|
-
|
217
|
+
|
218
|
+
|
219
219
|
def x
|
220
220
|
@zgeometry.x
|
221
221
|
end
|
222
|
-
|
223
|
-
|
222
|
+
|
223
|
+
|
224
224
|
def y
|
225
225
|
@zgeometry.y
|
226
226
|
end
|
227
|
-
|
228
|
-
|
227
|
+
|
228
|
+
|
229
229
|
def z
|
230
230
|
@zgeometry.z
|
231
231
|
end
|
232
|
-
|
233
|
-
|
232
|
+
|
233
|
+
|
234
234
|
def m
|
235
235
|
@mgeometry.m
|
236
236
|
end
|
237
|
-
|
238
|
-
|
237
|
+
|
238
|
+
|
239
239
|
end
|
240
|
-
|
241
|
-
|
240
|
+
|
241
|
+
|
242
242
|
class ZMLineStringImpl < ZMGeometryImpl # :nodoc:
|
243
|
-
|
244
|
-
|
243
|
+
|
244
|
+
|
245
245
|
def length
|
246
246
|
@zgeometry.length
|
247
247
|
end
|
248
|
-
|
249
|
-
|
248
|
+
|
249
|
+
|
250
250
|
def start_point
|
251
251
|
point_n(0)
|
252
252
|
end
|
253
|
-
|
254
|
-
|
253
|
+
|
254
|
+
|
255
255
|
def end_point
|
256
256
|
point_n(num_points - 1)
|
257
257
|
end
|
258
|
-
|
259
|
-
|
258
|
+
|
259
|
+
|
260
260
|
def is_closed?
|
261
261
|
@zgeometry.is_closed?
|
262
262
|
end
|
263
|
-
|
264
|
-
|
263
|
+
|
264
|
+
|
265
265
|
def is_ring?
|
266
266
|
@zgeometry.is_ring?
|
267
267
|
end
|
268
|
-
|
269
|
-
|
268
|
+
|
269
|
+
|
270
270
|
def num_points
|
271
271
|
@zgeometry.num_points
|
272
272
|
end
|
273
|
-
|
274
|
-
|
273
|
+
|
274
|
+
|
275
275
|
def point_n(n_)
|
276
276
|
ZMPointImpl.create(@factory, @zgeometry.point_n(n_), @mgeometry.point_n(n_))
|
277
277
|
end
|
278
|
-
|
279
|
-
|
278
|
+
|
279
|
+
|
280
280
|
def points
|
281
281
|
result_ = []
|
282
282
|
zpoints_ = @zgeometry.points
|
@@ -286,44 +286,44 @@ module RGeo
|
|
286
286
|
end
|
287
287
|
result_
|
288
288
|
end
|
289
|
-
|
290
|
-
|
289
|
+
|
290
|
+
|
291
291
|
end
|
292
|
-
|
293
|
-
|
292
|
+
|
293
|
+
|
294
294
|
class ZMPolygonImpl < ZMGeometryImpl # :nodoc:
|
295
|
-
|
296
|
-
|
295
|
+
|
296
|
+
|
297
297
|
def area
|
298
298
|
@zgeometry.area
|
299
299
|
end
|
300
|
-
|
301
|
-
|
300
|
+
|
301
|
+
|
302
302
|
def centroid
|
303
303
|
ZMPointImpl.create(@factory, @zgeometry.centroid, @mgeometry.centroid)
|
304
304
|
end
|
305
|
-
|
306
|
-
|
305
|
+
|
306
|
+
|
307
307
|
def point_on_surface
|
308
308
|
ZMPointImpl.create(@factory, @zgeometry.centroid, @mgeometry.centroid)
|
309
309
|
end
|
310
|
-
|
311
|
-
|
310
|
+
|
311
|
+
|
312
312
|
def exterior_ring
|
313
313
|
ZMLineStringImpl.create(@factory, @zgeometry.exterior_ring, @mgeometry.exterior_ring)
|
314
314
|
end
|
315
|
-
|
316
|
-
|
315
|
+
|
316
|
+
|
317
317
|
def num_interior_rings
|
318
318
|
@zgeometry.num_interior_rings
|
319
319
|
end
|
320
|
-
|
321
|
-
|
320
|
+
|
321
|
+
|
322
322
|
def interior_ring_n(n_)
|
323
323
|
ZMLineStringImpl.create(@factory, @zgeometry.interior_ring_n(n_), @mgeometry.interior_ring_n(n_))
|
324
324
|
end
|
325
|
-
|
326
|
-
|
325
|
+
|
326
|
+
|
327
327
|
def interior_rings
|
328
328
|
result_ = []
|
329
329
|
zrings_ = @zgeometry.interior_rings
|
@@ -333,78 +333,78 @@ module RGeo
|
|
333
333
|
end
|
334
334
|
result_
|
335
335
|
end
|
336
|
-
|
337
|
-
|
336
|
+
|
337
|
+
|
338
338
|
end
|
339
|
-
|
340
|
-
|
339
|
+
|
340
|
+
|
341
341
|
class ZMGeometryCollectionImpl < ZMGeometryImpl # :nodoc:
|
342
|
-
|
343
|
-
|
342
|
+
|
343
|
+
|
344
344
|
include ::Enumerable
|
345
|
-
|
346
|
-
|
345
|
+
|
346
|
+
|
347
347
|
def num_geometries
|
348
348
|
@zgeometry.num_geometries
|
349
349
|
end
|
350
350
|
alias_method :size, :num_geometries
|
351
|
-
|
352
|
-
|
351
|
+
|
352
|
+
|
353
353
|
def geometry_n(n_)
|
354
354
|
ZMGeometryImpl.create(@factory, @zgeometry.geometry_n(n_), @mgeometry.geometry_n(n_))
|
355
355
|
end
|
356
356
|
alias_method :[], :geometry_n
|
357
|
-
|
358
|
-
|
357
|
+
|
358
|
+
|
359
359
|
def each
|
360
360
|
num_geometries.times do |i_|
|
361
361
|
yield geometry_n(i_)
|
362
362
|
end
|
363
363
|
end
|
364
|
-
|
365
|
-
|
364
|
+
|
365
|
+
|
366
366
|
end
|
367
|
-
|
368
|
-
|
367
|
+
|
368
|
+
|
369
369
|
class ZMMultiLineStringImpl < ZMGeometryCollectionImpl # :nodoc:
|
370
|
-
|
371
|
-
|
370
|
+
|
371
|
+
|
372
372
|
def length
|
373
373
|
@zgeometry.length
|
374
374
|
end
|
375
|
-
|
376
|
-
|
375
|
+
|
376
|
+
|
377
377
|
def is_closed?
|
378
378
|
@zgeometry.is_closed?
|
379
379
|
end
|
380
|
-
|
381
|
-
|
380
|
+
|
381
|
+
|
382
382
|
end
|
383
|
-
|
384
|
-
|
383
|
+
|
384
|
+
|
385
385
|
class ZMMultiPolygonImpl < ZMGeometryCollectionImpl # :nodoc:
|
386
|
-
|
387
|
-
|
386
|
+
|
387
|
+
|
388
388
|
def area
|
389
389
|
@zgeometry.area
|
390
390
|
end
|
391
|
-
|
392
|
-
|
391
|
+
|
392
|
+
|
393
393
|
def centroid
|
394
394
|
ZMPointImpl.create(@factory, @zgeometry.centroid, @mgeometry.centroid)
|
395
395
|
end
|
396
|
-
|
397
|
-
|
396
|
+
|
397
|
+
|
398
398
|
def point_on_surface
|
399
399
|
ZMPointImpl.create(@factory, @zgeometry.centroid, @mgeometry.centroid)
|
400
400
|
end
|
401
|
-
|
402
|
-
|
401
|
+
|
402
|
+
|
403
403
|
end
|
404
|
-
|
405
|
-
|
404
|
+
|
405
|
+
|
406
406
|
class ZMGeometryImpl # :nodoc:
|
407
|
-
|
407
|
+
|
408
408
|
TYPE_KLASSES = {
|
409
409
|
Feature::Point => ZMPointImpl,
|
410
410
|
Feature::LineString => ZMLineStringImpl,
|
@@ -416,17 +416,17 @@ module RGeo
|
|
416
416
|
Feature::MultiLineString => ZMMultiLineStringImpl,
|
417
417
|
Feature::MultiPolygon => ZMMultiPolygonImpl,
|
418
418
|
}.freeze
|
419
|
-
|
420
|
-
|
419
|
+
|
420
|
+
|
421
421
|
def self.create(factory_, zgeometry_, mgeometry_)
|
422
422
|
klass_ = self == ZMGeometryImpl ? TYPE_KLASSES[zgeometry_.geometry_type] : self
|
423
423
|
klass_ && zgeometry_ && mgeometry_ ? klass_.new(factory_, zgeometry_, mgeometry_) : nil
|
424
424
|
end
|
425
|
-
|
426
|
-
|
425
|
+
|
426
|
+
|
427
427
|
end
|
428
|
-
|
429
|
-
|
428
|
+
|
429
|
+
|
430
430
|
end
|
431
|
-
|
431
|
+
|
432
432
|
end
|