rgeo 1.1.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/geos_c_impl/extconf.rb +5 -3
- data/ext/geos_c_impl/factory.c +4 -4
- data/ext/geos_c_impl/geometry.c +1 -1
- data/lib/rgeo.rb +2 -4
- data/lib/rgeo/cartesian.rb +6 -16
- data/lib/rgeo/cartesian/analysis.rb +22 -20
- data/lib/rgeo/cartesian/bounding_box.rb +83 -79
- data/lib/rgeo/cartesian/calculations.rb +40 -38
- data/lib/rgeo/cartesian/factory.rb +134 -169
- data/lib/rgeo/cartesian/feature_classes.rb +2 -18
- data/lib/rgeo/cartesian/feature_methods.rb +37 -39
- data/lib/rgeo/cartesian/interface.rb +11 -9
- data/lib/rgeo/coord_sys.rb +9 -8
- data/lib/rgeo/coord_sys/cs/entities.rb +345 -303
- data/lib/rgeo/coord_sys/cs/factories.rb +30 -28
- data/lib/rgeo/coord_sys/cs/wkt_parser.rb +128 -126
- data/lib/rgeo/coord_sys/srs_database/{interface.rb → entry.rb} +26 -32
- data/lib/rgeo/coord_sys/srs_database/sr_org.rb +19 -17
- data/lib/rgeo/coord_sys/srs_database/url_reader.rb +21 -19
- data/lib/rgeo/error.rb +3 -1
- data/lib/rgeo/feature.rb +23 -34
- data/lib/rgeo/feature/curve.rb +2 -0
- data/lib/rgeo/feature/factory.rb +15 -13
- data/lib/rgeo/feature/factory_generator.rb +7 -5
- data/lib/rgeo/feature/geometry.rb +31 -29
- data/lib/rgeo/feature/geometry_collection.rb +6 -4
- data/lib/rgeo/feature/line.rb +2 -0
- data/lib/rgeo/feature/line_string.rb +3 -1
- data/lib/rgeo/feature/linear_ring.rb +2 -0
- data/lib/rgeo/feature/multi_curve.rb +2 -0
- data/lib/rgeo/feature/multi_line_string.rb +2 -0
- data/lib/rgeo/feature/multi_point.rb +2 -0
- data/lib/rgeo/feature/multi_polygon.rb +2 -0
- data/lib/rgeo/feature/multi_surface.rb +2 -0
- data/lib/rgeo/feature/point.rb +2 -0
- data/lib/rgeo/feature/polygon.rb +3 -1
- data/lib/rgeo/feature/surface.rb +2 -0
- data/lib/rgeo/feature/types.rb +107 -103
- data/lib/rgeo/geographic.rb +17 -27
- data/lib/rgeo/geographic/factory.rb +154 -199
- data/lib/rgeo/geographic/interface.rb +141 -137
- data/lib/rgeo/geographic/proj4_projector.rb +28 -23
- data/lib/rgeo/geographic/projected_feature_classes.rb +2 -18
- data/lib/rgeo/geographic/projected_feature_methods.rb +59 -49
- data/lib/rgeo/geographic/projected_window.rb +4 -2
- data/lib/rgeo/geographic/simple_mercator_projector.rb +41 -39
- data/lib/rgeo/geographic/spherical_feature_classes.rb +2 -18
- data/lib/rgeo/geographic/spherical_feature_methods.rb +67 -67
- data/lib/rgeo/geographic/spherical_math.rb +81 -87
- data/lib/rgeo/geos.rb +23 -34
- data/lib/rgeo/geos/capi_factory.rb +106 -135
- data/lib/rgeo/geos/capi_feature_classes.rb +19 -37
- data/lib/rgeo/geos/ffi_factory.rb +276 -297
- data/lib/rgeo/geos/ffi_feature_classes.rb +2 -20
- data/lib/rgeo/geos/ffi_feature_methods.rb +170 -166
- data/lib/rgeo/geos/interface.rb +25 -23
- data/lib/rgeo/geos/utils.rb +47 -39
- data/lib/rgeo/geos/zm_factory.rb +171 -185
- data/lib/rgeo/geos/zm_feature_classes.rb +2 -20
- data/lib/rgeo/geos/zm_feature_methods.rb +76 -72
- data/lib/rgeo/impl_helper.rb +1 -11
- data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +72 -75
- data/lib/rgeo/impl_helper/basic_geometry_methods.rb +21 -23
- data/lib/rgeo/impl_helper/basic_line_string_methods.rb +57 -49
- data/lib/rgeo/impl_helper/basic_point_methods.rb +29 -25
- data/lib/rgeo/impl_helper/basic_polygon_methods.rb +31 -27
- data/lib/rgeo/impl_helper/math.rb +2 -0
- data/lib/rgeo/impl_helper/utils.rb +9 -15
- data/lib/rgeo/version.rb +3 -1
- data/lib/rgeo/wkrep.rb +20 -30
- data/lib/rgeo/wkrep/wkb_generator.rb +87 -84
- data/lib/rgeo/wkrep/wkb_parser.rb +93 -93
- data/lib/rgeo/wkrep/wkt_generator.rb +67 -63
- data/lib/rgeo/wkrep/wkt_parser.rb +172 -168
- metadata +17 -32
- data/lib/rgeo/feature/mixins.rb +0 -143
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# -----------------------------------------------------------------------------
|
2
4
|
#
|
3
5
|
# Geographic data factory implementation
|
@@ -12,74 +14,69 @@ module RGeo
|
|
12
14
|
|
13
15
|
class Factory
|
14
16
|
include Feature::Factory::Instance
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
@
|
21
|
-
@
|
22
|
-
@
|
23
|
-
@
|
24
|
-
@
|
25
|
-
@
|
26
|
-
@
|
27
|
-
@
|
28
|
-
@
|
29
|
-
@
|
30
|
-
@
|
17
|
+
include ImplHelper::Utils
|
18
|
+
|
19
|
+
attr_writer :projector
|
20
|
+
|
21
|
+
def initialize(impl_prefix, opts = {}) # :nodoc:
|
22
|
+
@impl_prefix = impl_prefix
|
23
|
+
@point_class = Geographic.const_get("#{impl_prefix}PointImpl")
|
24
|
+
@line_string_class = Geographic.const_get("#{impl_prefix}LineStringImpl")
|
25
|
+
@linear_ring_class = Geographic.const_get("#{impl_prefix}LinearRingImpl")
|
26
|
+
@line_class = Geographic.const_get("#{impl_prefix}LineImpl")
|
27
|
+
@polygon_class = Geographic.const_get("#{impl_prefix}PolygonImpl")
|
28
|
+
@geometry_collection_class = Geographic.const_get("#{impl_prefix}GeometryCollectionImpl")
|
29
|
+
@multi_point_class = Geographic.const_get("#{impl_prefix}MultiPointImpl")
|
30
|
+
@multi_line_string_class = Geographic.const_get("#{impl_prefix}MultiLineStringImpl")
|
31
|
+
@multi_polygon_class = Geographic.const_get("#{impl_prefix}MultiPolygonImpl")
|
32
|
+
@support_z = opts[:has_z_coordinate] ? true : false
|
33
|
+
@support_m = opts[:has_m_coordinate] ? true : false
|
34
|
+
@srid = (opts[:srid] || 4326).to_i
|
35
|
+
@proj4 = opts[:proj4]
|
31
36
|
if @proj4 && CoordSys.check!(:proj4)
|
32
|
-
if @proj4.is_a?(
|
37
|
+
if @proj4.is_a?(String) || @proj4.is_a?(Hash)
|
33
38
|
@proj4 = CoordSys::Proj4.create(@proj4)
|
34
39
|
end
|
35
40
|
end
|
36
|
-
@coord_sys =
|
37
|
-
if @coord_sys.is_a?(
|
38
|
-
@coord_sys =
|
39
|
-
CoordSys::CS.create_from_wkt(@coord_sys)
|
40
|
-
rescue
|
41
|
-
nil
|
42
|
-
end
|
41
|
+
@coord_sys = opts[:coord_sys]
|
42
|
+
if @coord_sys.is_a?(String)
|
43
|
+
@coord_sys = CoordSys::CS.create_from_wkt(@coord_sys)
|
43
44
|
end
|
44
|
-
@lenient_assertions =
|
45
|
-
@buffer_resolution =
|
45
|
+
@lenient_assertions = opts[:uses_lenient_assertions] ? true : false
|
46
|
+
@buffer_resolution = opts[:buffer_resolution].to_i
|
46
47
|
@buffer_resolution = 1 if @buffer_resolution < 1
|
47
48
|
|
48
|
-
|
49
|
-
case
|
50
|
-
when
|
51
|
-
@wkt_generator = WKRep::WKTGenerator.new(
|
49
|
+
wkt_generator = opts[:wkt_generator]
|
50
|
+
case wkt_generator
|
51
|
+
when Hash
|
52
|
+
@wkt_generator = WKRep::WKTGenerator.new(wkt_generator)
|
52
53
|
else
|
53
54
|
@wkt_generator = WKRep::WKTGenerator.new(convert_case: :upper)
|
54
55
|
end
|
55
|
-
|
56
|
-
case
|
57
|
-
when
|
58
|
-
@wkb_generator = WKRep::WKBGenerator.new(
|
56
|
+
wkb_generator = opts[:wkb_generator]
|
57
|
+
case wkb_generator
|
58
|
+
when Hash
|
59
|
+
@wkb_generator = WKRep::WKBGenerator.new(wkb_generator)
|
59
60
|
else
|
60
61
|
@wkb_generator = WKRep::WKBGenerator.new
|
61
62
|
end
|
62
|
-
|
63
|
-
case
|
64
|
-
when
|
65
|
-
@wkt_parser = WKRep::WKTParser.new(self,
|
63
|
+
wkt_parser = opts[:wkt_parser]
|
64
|
+
case wkt_parser
|
65
|
+
when Hash
|
66
|
+
@wkt_parser = WKRep::WKTParser.new(self, wkt_parser)
|
66
67
|
else
|
67
68
|
@wkt_parser = WKRep::WKTParser.new(self)
|
68
69
|
end
|
69
|
-
|
70
|
-
case
|
71
|
-
when
|
72
|
-
@wkb_parser = WKRep::WKBParser.new(self,
|
70
|
+
wkb_parser = opts[:wkb_parser]
|
71
|
+
case wkb_parser
|
72
|
+
when Hash
|
73
|
+
@wkb_parser = WKRep::WKBParser.new(self, wkb_parser)
|
73
74
|
else
|
74
75
|
@wkb_parser = WKRep::WKBParser.new(self)
|
75
76
|
end
|
76
77
|
@projector = nil
|
77
78
|
end
|
78
79
|
|
79
|
-
def _set_projector(projector_) # :nodoc:
|
80
|
-
@projector = projector_
|
81
|
-
end
|
82
|
-
|
83
80
|
# Equivalence test.
|
84
81
|
|
85
82
|
def eql?(rhs_)
|
@@ -105,10 +102,10 @@ module RGeo
|
|
105
102
|
"hasz" => @support_z,
|
106
103
|
"hasm" => @support_m,
|
107
104
|
"srid" => @srid,
|
108
|
-
"wktg" => @wkt_generator.
|
109
|
-
"wkbg" => @wkb_generator.
|
110
|
-
"wktp" => @wkt_parser.
|
111
|
-
"wkbp" => @wkb_parser.
|
105
|
+
"wktg" => @wkt_generator.properties,
|
106
|
+
"wkbg" => @wkb_generator.properties,
|
107
|
+
"wktp" => @wkt_parser.properties,
|
108
|
+
"wkbp" => @wkb_parser.properties,
|
112
109
|
"lena" => @lenient_assertions,
|
113
110
|
"bufr" => @buffer_resolution
|
114
111
|
}
|
@@ -122,107 +119,99 @@ module RGeo
|
|
122
119
|
end
|
123
120
|
|
124
121
|
def marshal_load(data_) # :nodoc:
|
125
|
-
if (
|
126
|
-
|
127
|
-
|
122
|
+
if (proj4_data = data_["proj4"]) && CoordSys.check!(:proj4)
|
123
|
+
proj4 = CoordSys::Proj4.allocate
|
124
|
+
proj4.marshal_load(proj4_data)
|
128
125
|
else
|
129
|
-
|
126
|
+
proj4 = nil
|
130
127
|
end
|
131
|
-
if (
|
132
|
-
|
128
|
+
if (coord_sys_data = data_["cs"])
|
129
|
+
coord_sys = CoordSys::CS.create_from_wkt(coord_sys_data)
|
133
130
|
else
|
134
|
-
|
131
|
+
coord_sys = nil
|
135
132
|
end
|
136
133
|
initialize(data_["pref"],
|
137
134
|
has_z_coordinate: data_["hasz"],
|
138
135
|
has_m_coordinate: data_["hasm"],
|
139
136
|
srid: data_["srid"],
|
140
|
-
wkt_generator:
|
141
|
-
wkb_generator:
|
142
|
-
wkt_parser:
|
143
|
-
wkb_parser:
|
137
|
+
wkt_generator: symbolize_hash(data_["wktg"]),
|
138
|
+
wkb_generator: symbolize_hash(data_["wkbg"]),
|
139
|
+
wkt_parser: symbolize_hash(data_["wktp"]),
|
140
|
+
wkb_parser: symbolize_hash(data_["wkbp"]),
|
144
141
|
uses_lenient_assertions: data_["lena"],
|
145
142
|
buffer_resolution: data_["bufr"],
|
146
|
-
proj4:
|
147
|
-
coord_sys:
|
148
|
-
|
149
|
-
if (
|
150
|
-
klass_ =
|
151
|
-
RGeo::Geographic.const_get(projklass_)
|
152
|
-
rescue
|
153
|
-
nil
|
154
|
-
end
|
143
|
+
proj4: proj4,
|
144
|
+
coord_sys: coord_sys
|
145
|
+
)
|
146
|
+
if (proj_klass = data_["prjc"]) && (proj_factory = data_["prjf"])
|
147
|
+
klass_ = RGeo::Geographic.const_get(proj_klass)
|
155
148
|
if klass_
|
156
|
-
|
157
|
-
|
158
|
-
|
149
|
+
projector = klass_.allocate
|
150
|
+
projector.set_factories(self, proj_factory)
|
151
|
+
@projector = projector
|
159
152
|
end
|
160
153
|
end
|
161
154
|
end
|
162
155
|
|
163
156
|
# Psych support
|
164
157
|
|
165
|
-
def encode_with(
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
158
|
+
def encode_with(coder) # :nodoc:
|
159
|
+
coder["impl_prefix"] = @impl_prefix
|
160
|
+
coder["has_z_coordinate"] = @support_z
|
161
|
+
coder["has_m_coordinate"] = @support_m
|
162
|
+
coder["srid"] = @srid
|
163
|
+
coder["wkt_generator"] = @wkt_generator.properties
|
164
|
+
coder["wkb_generator"] = @wkb_generator.properties
|
165
|
+
coder["wkt_parser"] = @wkt_parser.properties
|
166
|
+
coder["wkb_parser"] = @wkb_parser.properties
|
167
|
+
coder["lenient_assertions"] = @lenient_assertions
|
168
|
+
coder["buffer_resolution"] = @buffer_resolution
|
176
169
|
if @proj4
|
177
|
-
|
178
|
-
|
170
|
+
str = @proj4.original_str || @proj4.canonical_str
|
171
|
+
coder["proj4"] = @proj4.radians? ? { "proj4" => str, "radians" => true } : str
|
179
172
|
end
|
180
|
-
|
173
|
+
coder["coord_sys"] = @coord_sys.to_wkt if @coord_sys
|
181
174
|
if @projector
|
182
|
-
|
183
|
-
|
175
|
+
coder["projectorclass"] = @projector.class.name.sub(/.*::/, "")
|
176
|
+
coder["projection_factory"] = @projector.projection_factory
|
184
177
|
end
|
185
178
|
end
|
186
179
|
|
187
|
-
def init_with(
|
188
|
-
if (
|
180
|
+
def init_with(coder) # :nodoc:
|
181
|
+
if (proj4_data = coder["proj4"])
|
189
182
|
CoordSys.check!(:proj4)
|
190
|
-
if
|
191
|
-
|
183
|
+
if proj4_data.is_a?(Hash)
|
184
|
+
proj4 = CoordSys::Proj4.create(proj4_data["proj4"], radians: proj4_data["radians"])
|
192
185
|
else
|
193
|
-
|
186
|
+
proj4 = CoordSys::Proj4.create(proj4_data.to_s)
|
194
187
|
end
|
195
188
|
else
|
196
|
-
|
189
|
+
proj4 = nil
|
197
190
|
end
|
198
|
-
if (
|
199
|
-
|
191
|
+
if (coord_sys_data = coder["cs"])
|
192
|
+
coord_sys = CoordSys::CS.create_from_wkt(coord_sys_data.to_s)
|
200
193
|
else
|
201
|
-
|
194
|
+
coord_sys = nil
|
202
195
|
end
|
203
|
-
initialize(
|
204
|
-
has_z_coordinate:
|
205
|
-
has_m_coordinate:
|
206
|
-
srid:
|
207
|
-
wkt_generator:
|
208
|
-
wkb_generator:
|
209
|
-
wkt_parser:
|
210
|
-
wkb_parser:
|
211
|
-
uses_lenient_assertions:
|
212
|
-
buffer_resolution:
|
213
|
-
proj4:
|
214
|
-
coord_sys:
|
215
|
-
|
216
|
-
if (
|
217
|
-
klass_ =
|
218
|
-
RGeo::Geographic.const_get(projklass_)
|
219
|
-
rescue
|
220
|
-
nil
|
221
|
-
end
|
196
|
+
initialize(coder["impl_prefix"],
|
197
|
+
has_z_coordinate: coder["has_z_coordinate"],
|
198
|
+
has_m_coordinate: coder["has_m_coordinate"],
|
199
|
+
srid: coder["srid"],
|
200
|
+
wkt_generator: symbolize_hash(coder["wkt_generator"]),
|
201
|
+
wkb_generator: symbolize_hash(coder["wkb_generator"]),
|
202
|
+
wkt_parser: symbolize_hash(coder["wkt_parser"]),
|
203
|
+
wkb_parser: symbolize_hash(coder["wkb_parser"]),
|
204
|
+
uses_lenient_assertions: coder["lenient_assertions"],
|
205
|
+
buffer_resolution: coder["buffer_resolution"],
|
206
|
+
proj4: proj4,
|
207
|
+
coord_sys: coord_sys
|
208
|
+
)
|
209
|
+
if (proj_klass = coder["projectorclass"]) && (proj_factory = coder["projection_factory"])
|
210
|
+
klass_ = RGeo::Geographic.const_get(proj_klass)
|
222
211
|
if klass_
|
223
|
-
|
224
|
-
|
225
|
-
|
212
|
+
projector = klass_.allocate
|
213
|
+
projector.set_factories(self, proj_factory)
|
214
|
+
@projector = projector
|
226
215
|
end
|
227
216
|
end
|
228
217
|
end
|
@@ -241,7 +230,7 @@ module RGeo
|
|
241
230
|
# or nil if this factory does not support a projection.
|
242
231
|
|
243
232
|
def projection_factory
|
244
|
-
@projector
|
233
|
+
@projector&.projection_factory
|
245
234
|
end
|
246
235
|
|
247
236
|
# Projects the given geometry into the projected coordinate space,
|
@@ -250,12 +239,12 @@ module RGeo
|
|
250
239
|
# Raises Error::InvalidGeometry if the given geometry is not of
|
251
240
|
# this factory.
|
252
241
|
|
253
|
-
def project(
|
254
|
-
return
|
255
|
-
unless
|
242
|
+
def project(geometry)
|
243
|
+
return unless @projector && geometry
|
244
|
+
unless geometry.factory == self
|
256
245
|
raise Error::InvalidGeometry, "Wrong geometry type"
|
257
246
|
end
|
258
|
-
@projector.project(
|
247
|
+
@projector.project(geometry)
|
259
248
|
end
|
260
249
|
|
261
250
|
# Reverse-projects the given geometry from the projected coordinate
|
@@ -263,12 +252,12 @@ module RGeo
|
|
263
252
|
# Raises Error::InvalidGeometry if the given geometry is not of
|
264
253
|
# the projection defined by this factory.
|
265
254
|
|
266
|
-
def unproject(
|
267
|
-
return
|
268
|
-
unless @projector && @projector.projection_factory ==
|
255
|
+
def unproject(geometry)
|
256
|
+
return unless geometry
|
257
|
+
unless @projector && @projector.projection_factory == geometry.factory
|
269
258
|
raise Error::InvalidGeometry, "You can unproject only features that are in the projected coordinate space."
|
270
259
|
end
|
271
|
-
@projector.unproject(
|
260
|
+
@projector.unproject(geometry)
|
272
261
|
end
|
273
262
|
|
274
263
|
# Returns true if this factory supports a projection and the
|
@@ -298,8 +287,8 @@ module RGeo
|
|
298
287
|
|
299
288
|
# See RGeo::Feature::Factory#property
|
300
289
|
|
301
|
-
def property(
|
302
|
-
case
|
290
|
+
def property(name)
|
291
|
+
case name
|
303
292
|
when :has_z_coordinate
|
304
293
|
@support_z
|
305
294
|
when :has_m_coordinate
|
@@ -315,86 +304,68 @@ module RGeo
|
|
315
304
|
|
316
305
|
# See RGeo::Feature::Factory#parse_wkt
|
317
306
|
|
318
|
-
def parse_wkt(
|
319
|
-
@wkt_parser.parse(
|
307
|
+
def parse_wkt(str)
|
308
|
+
@wkt_parser.parse(str)
|
320
309
|
end
|
321
310
|
|
322
311
|
# See RGeo::Feature::Factory#parse_wkb
|
323
312
|
|
324
|
-
def parse_wkb(
|
325
|
-
@wkb_parser.parse(
|
313
|
+
def parse_wkb(str)
|
314
|
+
@wkb_parser.parse(str)
|
326
315
|
end
|
327
316
|
|
328
317
|
# See RGeo::Feature::Factory#point
|
329
318
|
|
330
|
-
def point(
|
331
|
-
@point_class.new(self,
|
332
|
-
rescue
|
333
|
-
nil
|
319
|
+
def point(x, y, *extra)
|
320
|
+
@point_class.new(self, x, y, *extra)
|
334
321
|
end
|
335
322
|
|
336
323
|
# See RGeo::Feature::Factory#line_string
|
337
324
|
|
338
|
-
def line_string(
|
339
|
-
@line_string_class.new(self,
|
340
|
-
rescue
|
341
|
-
nil
|
325
|
+
def line_string(points)
|
326
|
+
@line_string_class.new(self, points)
|
342
327
|
end
|
343
328
|
|
344
329
|
# See RGeo::Feature::Factory#line
|
345
330
|
|
346
|
-
def line(
|
347
|
-
@line_class.new(self,
|
348
|
-
rescue
|
349
|
-
nil
|
331
|
+
def line(start, stop)
|
332
|
+
@line_class.new(self, start, stop)
|
350
333
|
end
|
351
334
|
|
352
335
|
# See RGeo::Feature::Factory#linear_ring
|
353
336
|
|
354
|
-
def linear_ring(
|
355
|
-
@linear_ring_class.new(self,
|
356
|
-
rescue
|
357
|
-
nil
|
337
|
+
def linear_ring(points)
|
338
|
+
@linear_ring_class.new(self, points)
|
358
339
|
end
|
359
340
|
|
360
341
|
# See RGeo::Feature::Factory#polygon
|
361
342
|
|
362
|
-
def polygon(
|
363
|
-
@polygon_class.new(self,
|
364
|
-
rescue
|
365
|
-
nil
|
343
|
+
def polygon(outer_ring, inner_rings = nil)
|
344
|
+
@polygon_class.new(self, outer_ring, inner_rings)
|
366
345
|
end
|
367
346
|
|
368
347
|
# See RGeo::Feature::Factory#collection
|
369
348
|
|
370
|
-
def collection(
|
371
|
-
@geometry_collection_class.new(self,
|
372
|
-
rescue
|
373
|
-
nil
|
349
|
+
def collection(elems)
|
350
|
+
@geometry_collection_class.new(self, elems)
|
374
351
|
end
|
375
352
|
|
376
353
|
# See RGeo::Feature::Factory#multi_point
|
377
354
|
|
378
|
-
def multi_point(
|
379
|
-
@multi_point_class.new(self,
|
380
|
-
rescue
|
381
|
-
nil
|
355
|
+
def multi_point(elems)
|
356
|
+
@multi_point_class.new(self, elems)
|
382
357
|
end
|
383
358
|
|
384
359
|
# See RGeo::Feature::Factory#multi_line_string
|
385
360
|
|
386
|
-
def multi_line_string(
|
387
|
-
@multi_line_string_class.new(self,
|
388
|
-
rescue
|
389
|
-
nil
|
361
|
+
def multi_line_string(elems)
|
362
|
+
@multi_line_string_class.new(self, elems)
|
390
363
|
end
|
391
364
|
|
392
365
|
# See RGeo::Feature::Factory#multi_polygon
|
393
366
|
|
394
|
-
def multi_polygon(
|
395
|
-
@multi_polygon_class.new(self,
|
396
|
-
rescue
|
397
|
-
nil
|
367
|
+
def multi_polygon(elems)
|
368
|
+
@multi_polygon_class.new(self, elems)
|
398
369
|
end
|
399
370
|
|
400
371
|
# See RGeo::Feature::Factory#proj4
|
@@ -405,44 +376,28 @@ module RGeo
|
|
405
376
|
|
406
377
|
attr_reader :coord_sys
|
407
378
|
|
408
|
-
def
|
409
|
-
@wkt_generator.generate(
|
379
|
+
def generate_wkt(obj)
|
380
|
+
@wkt_generator.generate(obj)
|
410
381
|
end
|
411
382
|
|
412
|
-
def
|
413
|
-
@wkb_generator.generate(
|
383
|
+
def generate_wkb(obj) # :nodoc:
|
384
|
+
@wkb_generator.generate(obj)
|
414
385
|
end
|
415
386
|
|
416
|
-
def
|
417
|
-
|
418
|
-
@marshal_wkb_generator = RGeo::WKRep::WKBGenerator.new(
|
419
|
-
type_format: :wkb12)
|
420
|
-
end
|
421
|
-
@marshal_wkb_generator
|
387
|
+
def marshal_wkb_generator
|
388
|
+
@marshal_wkb_generator ||= RGeo::WKRep::WKBGenerator.new(type_format: :wkb12)
|
422
389
|
end
|
423
390
|
|
424
|
-
def
|
425
|
-
|
426
|
-
@marshal_wkb_parser = RGeo::WKRep::WKBParser.new(self,
|
427
|
-
support_wkb12: true)
|
428
|
-
end
|
429
|
-
@marshal_wkb_parser
|
391
|
+
def marshal_wkb_parser
|
392
|
+
@marshal_wkb_parser ||= RGeo::WKRep::WKBParser.new(self, support_wkb12: true)
|
430
393
|
end
|
431
394
|
|
432
|
-
def
|
433
|
-
|
434
|
-
@psych_wkt_generator = RGeo::WKRep::WKTGenerator.new(
|
435
|
-
tag_format: :wkt12)
|
436
|
-
end
|
437
|
-
@psych_wkt_generator
|
395
|
+
def psych_wkt_generator
|
396
|
+
@psych_wkt_generator ||= RGeo::WKRep::WKTGenerator.new(tag_format: :wkt12)
|
438
397
|
end
|
439
398
|
|
440
|
-
def
|
441
|
-
|
442
|
-
@psych_wkt_parser = RGeo::WKRep::WKTParser.new(self,
|
443
|
-
support_wkt12: true, support_ewkt: true)
|
444
|
-
end
|
445
|
-
@psych_wkt_parser
|
399
|
+
def psych_wkt_parser
|
400
|
+
@psych_wkt_parser ||= RGeo::WKRep::WKTParser.new(self, support_wkt12: true, support_ewkt: true)
|
446
401
|
end
|
447
402
|
end
|
448
403
|
end
|