rgeo 2.3.1 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +6 -0
  3. data/README.md +23 -14
  4. data/ext/geos_c_impl/analysis.c +30 -25
  5. data/ext/geos_c_impl/analysis.h +8 -7
  6. data/ext/geos_c_impl/coordinates.c +27 -21
  7. data/ext/geos_c_impl/coordinates.h +5 -2
  8. data/ext/geos_c_impl/errors.c +19 -10
  9. data/ext/geos_c_impl/errors.h +11 -4
  10. data/ext/geos_c_impl/extconf.rb +42 -28
  11. data/ext/geos_c_impl/factory.c +540 -451
  12. data/ext/geos_c_impl/factory.h +105 -95
  13. data/ext/geos_c_impl/geometry.c +593 -387
  14. data/ext/geos_c_impl/geometry.h +10 -5
  15. data/ext/geos_c_impl/geometry_collection.c +306 -339
  16. data/ext/geos_c_impl/geometry_collection.h +6 -20
  17. data/ext/geos_c_impl/globals.c +169 -0
  18. data/ext/geos_c_impl/globals.h +46 -0
  19. data/ext/geos_c_impl/line_string.c +271 -231
  20. data/ext/geos_c_impl/line_string.h +5 -8
  21. data/ext/geos_c_impl/main.c +16 -16
  22. data/ext/geos_c_impl/point.c +65 -67
  23. data/ext/geos_c_impl/point.h +4 -7
  24. data/ext/geos_c_impl/polygon.c +137 -135
  25. data/ext/geos_c_impl/polygon.h +11 -11
  26. data/ext/geos_c_impl/preface.h +16 -10
  27. data/ext/geos_c_impl/ruby_more.c +67 -0
  28. data/ext/geos_c_impl/ruby_more.h +25 -0
  29. data/lib/rgeo/cartesian/analysis.rb +5 -3
  30. data/lib/rgeo/cartesian/bounding_box.rb +74 -79
  31. data/lib/rgeo/cartesian/calculations.rb +64 -33
  32. data/lib/rgeo/cartesian/factory.rb +57 -102
  33. data/lib/rgeo/cartesian/feature_classes.rb +68 -46
  34. data/lib/rgeo/cartesian/feature_methods.rb +67 -25
  35. data/lib/rgeo/cartesian/interface.rb +6 -41
  36. data/lib/rgeo/cartesian/planar_graph.rb +373 -0
  37. data/lib/rgeo/cartesian/sweepline_intersector.rb +147 -0
  38. data/lib/rgeo/cartesian/valid_op.rb +69 -0
  39. data/lib/rgeo/cartesian.rb +3 -0
  40. data/lib/rgeo/coord_sys/cs/entities.rb +303 -99
  41. data/lib/rgeo/coord_sys/cs/factories.rb +0 -2
  42. data/lib/rgeo/coord_sys/cs/wkt_parser.rb +90 -42
  43. data/lib/rgeo/coord_sys.rb +1 -20
  44. data/lib/rgeo/error.rb +15 -0
  45. data/lib/rgeo/feature/curve.rb +0 -11
  46. data/lib/rgeo/feature/factory.rb +26 -36
  47. data/lib/rgeo/feature/factory_generator.rb +6 -14
  48. data/lib/rgeo/feature/geometry.rb +146 -66
  49. data/lib/rgeo/feature/geometry_collection.rb +16 -9
  50. data/lib/rgeo/feature/line_string.rb +4 -5
  51. data/lib/rgeo/feature/linear_ring.rb +0 -1
  52. data/lib/rgeo/feature/multi_curve.rb +0 -6
  53. data/lib/rgeo/feature/multi_surface.rb +3 -4
  54. data/lib/rgeo/feature/point.rb +4 -5
  55. data/lib/rgeo/feature/polygon.rb +1 -2
  56. data/lib/rgeo/feature/surface.rb +3 -4
  57. data/lib/rgeo/feature/types.rb +69 -85
  58. data/lib/rgeo/geographic/factory.rb +98 -125
  59. data/lib/rgeo/geographic/interface.rb +69 -166
  60. data/lib/rgeo/geographic/projected_feature_classes.rb +21 -9
  61. data/lib/rgeo/geographic/projected_feature_methods.rb +67 -42
  62. data/lib/rgeo/geographic/projected_window.rb +36 -22
  63. data/lib/rgeo/geographic/{proj4_projector.rb → projector.rb} +3 -5
  64. data/lib/rgeo/geographic/simple_mercator_projector.rb +26 -25
  65. data/lib/rgeo/geographic/spherical_feature_classes.rb +29 -9
  66. data/lib/rgeo/geographic/spherical_feature_methods.rb +86 -9
  67. data/lib/rgeo/geographic/spherical_math.rb +17 -20
  68. data/lib/rgeo/geographic.rb +1 -1
  69. data/lib/rgeo/geos/capi_factory.rb +87 -158
  70. data/lib/rgeo/geos/capi_feature_classes.rb +50 -36
  71. data/lib/rgeo/geos/ffi_factory.rb +105 -173
  72. data/lib/rgeo/geos/ffi_feature_classes.rb +34 -10
  73. data/lib/rgeo/geos/ffi_feature_methods.rb +105 -127
  74. data/lib/rgeo/geos/interface.rb +20 -59
  75. data/lib/rgeo/geos/utils.rb +5 -5
  76. data/lib/rgeo/geos/zm_factory.rb +53 -95
  77. data/lib/rgeo/geos/zm_feature_methods.rb +30 -33
  78. data/lib/rgeo/geos.rb +8 -8
  79. data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +9 -22
  80. data/lib/rgeo/impl_helper/basic_geometry_methods.rb +1 -2
  81. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +28 -56
  82. data/lib/rgeo/impl_helper/basic_point_methods.rb +2 -14
  83. data/lib/rgeo/impl_helper/basic_polygon_methods.rb +17 -26
  84. data/lib/rgeo/impl_helper/utils.rb +21 -0
  85. data/lib/rgeo/impl_helper/valid_op.rb +350 -0
  86. data/lib/rgeo/impl_helper/validity_check.rb +139 -0
  87. data/lib/rgeo/impl_helper.rb +1 -0
  88. data/lib/rgeo/version.rb +1 -1
  89. data/lib/rgeo/wkrep/wkb_generator.rb +73 -63
  90. data/lib/rgeo/wkrep/wkb_parser.rb +33 -31
  91. data/lib/rgeo/wkrep/wkt_generator.rb +52 -45
  92. data/lib/rgeo/wkrep/wkt_parser.rb +48 -35
  93. data/lib/rgeo.rb +1 -3
  94. metadata +50 -13
  95. data/lib/rgeo/coord_sys/srs_database/entry.rb +0 -107
  96. data/lib/rgeo/coord_sys/srs_database/sr_org.rb +0 -64
  97. data/lib/rgeo/coord_sys/srs_database/url_reader.rb +0 -65
@@ -54,12 +54,6 @@ module RGeo
54
54
  # Support a Z coordinate. Default is false.
55
55
  # [<tt>:has_m_coordinate</tt>]
56
56
  # Support an M coordinate. Default is false.
57
- # [<tt>:uses_lenient_assertions</tt>]
58
- # If set to true, assertion checking is disabled. This includes
59
- # simplicity checking on LinearRing, and validity checks on
60
- # Polygon and MultiPolygon. This may speed up creation of certain
61
- # objects, at the expense of not doing the proper checking for
62
- # OGC compliance. Default is false.
63
57
  # [<tt>:buffer_resolution</tt>]
64
58
  # The resolution of buffers around geometries created by this
65
59
  # factory. This controls the number of line segments used to
@@ -70,30 +64,20 @@ module RGeo
70
64
  # for different kinds of buffers is not specified precisely,
71
65
  # but in general the value is taken as the number of segments
72
66
  # per 90-degree curve.
73
- # [<tt>:proj4</tt>]
74
- # Provide the coordinate system in Proj4 format. You may pass
75
- # either an RGeo::CoordSys::Proj4 object, or a string or hash
76
- # containing the Proj4 parameters. This coordinate system must be
77
- # a geographic (lat/long) coordinate system. The default is the
78
- # "popular visualization CRS" (EPSG 4055), represented by
79
- # "<tt>+proj=longlat +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +no_defs</tt>".
80
- # Has no effect if Proj4 is not available.
81
67
  # [<tt>:coord_sys</tt>]
82
68
  # Provide a coordinate system in OGC format, either as an object
83
69
  # (one of the CoordSys::CS classes) or as a string in WKT format.
84
70
  # This coordinate system must be a GeographicCoordinateSystem.
85
71
  # The default is the "popular visualization CRS" (EPSG 4055).
72
+ # [<tt>:coord_sys_class</tt>]
73
+ # CoordSys::CS::CoordinateSystem implementation used to instansiate
74
+ # a coord_sys based on the :srid given.
86
75
  # [<tt>:srid</tt>]
87
76
  # The SRID that should be returned by features from this factory.
88
77
  # Default is 4055, indicating EPSG 4055, the "popular
89
78
  # visualization crs". You may alternatively wish to set the srid
90
79
  # to 4326, indicating the WGS84 crs, but note that that value
91
80
  # implies an ellipsoidal datum, not a spherical datum.
92
- # [<tt>:srs_database</tt>]
93
- # Optional. If provided, the object should respond to #get and
94
- # #clear_cache. If both this and an SRID are
95
- # provided, they are used to look up the proj4 and coord_sys
96
- # objects from a spatial reference system database.
97
81
  # [<tt>:wkt_parser</tt>]
98
82
  # Configure the parser for WKT. The value is a hash of
99
83
  # configuration parameters for WKRep::WKTParser.new. Default is
@@ -115,29 +99,21 @@ module RGeo
115
99
  # for WKRep::WKBGenerator.
116
100
 
117
101
  def spherical_factory(opts = {})
118
- proj4 = opts[:proj4]
119
102
  coord_sys = opts[:coord_sys]
120
103
  srid = opts[:srid]
121
- if (!proj4 || !coord_sys) && srid && (db_ = opts[:srs_database])
122
- entry_ = db_.get(srid.to_i)
123
- if entry_
124
- proj4 ||= entry_.proj4
125
- coord_sys ||= entry_.coord_sys
126
- end
127
- end
128
104
  srid ||= coord_sys.authority_code if coord_sys
129
- Geographic::Factory.new("Spherical",
105
+ Geographic::Factory.new(
106
+ "Spherical",
130
107
  has_z_coordinate: opts[:has_z_coordinate],
131
108
  has_m_coordinate: opts[:has_m_coordinate],
132
- proj4: proj4 || proj_4055,
133
- coord_sys: coord_sys || coord_sys_4055,
134
- uses_lenient_assertions: opts[:uses_lenient_assertions],
109
+ coord_sys: coord_sys || coord_sys4055,
135
110
  buffer_resolution: opts[:buffer_resolution],
136
111
  wkt_parser: opts[:wkt_parser],
137
112
  wkb_parser: opts[:wkb_parser],
138
113
  wkt_generator: opts[:wkt_generator],
139
114
  wkb_generator: opts[:wkb_generator],
140
- srid: (srid || 4055).to_i)
115
+ srid: (srid || 4055).to_i
116
+ )
141
117
  end
142
118
 
143
119
  # Creates and returns a geographic factory that is designed for
@@ -207,35 +183,33 @@ module RGeo
207
183
  #
208
184
  # You may also provide options understood by the underlying
209
185
  # projected Cartesian factory. For example, if GEOS is used for the
210
- # projected factory, you may also set the
211
- # <tt>:lenient_multi_polygon_assertions</tt> and
212
- # <tt>:buffer_resolution</tt> options. See RGeo::Geos.factory for
213
- # more details.
186
+ # projected factory, you may also set the <tt>:buffer_resolution</tt>
187
+ # options. See RGeo::Geos.factory for more details.
214
188
 
215
189
  def simple_mercator_factory(opts = {})
216
- factory = Geographic::Factory.new("Projected",
217
- proj4: proj_4326,
218
- coord_sys: coord_sys_4326,
190
+ factory = Geographic::Factory.new(
191
+ "Projected",
192
+ coord_sys: coord_sys4326,
219
193
  srid: 4326,
220
194
  wkt_parser: opts[:wkt_parser],
221
195
  wkb_parser: opts[:wkb_parser],
222
196
  wkt_generator: opts[:wkt_generator],
223
197
  wkb_generator: opts[:wkb_generator],
224
198
  has_z_coordinate: opts[:has_z_coordinate],
225
- has_m_coordinate: opts[:has_m_coordinate],
226
- uses_lenient_assertions: opts[:uses_lenient_assertions])
227
- projector = Geographic::SimpleMercatorProjector.new(factory,
199
+ has_m_coordinate: opts[:has_m_coordinate]
200
+ )
201
+ projector = Geographic::SimpleMercatorProjector.new(
202
+ factory,
228
203
  buffer_resolution: opts[:buffer_resolution],
229
- lenient_multi_polygon_assertions: opts[:lenient_multi_polygon_assertions],
230
- uses_lenient_assertions: opts[:uses_lenient_assertions],
231
204
  has_z_coordinate: opts[:has_z_coordinate],
232
- has_m_coordinate: opts[:has_m_coordinate])
205
+ has_m_coordinate: opts[:has_m_coordinate]
206
+ )
233
207
  factory.projector = projector
234
208
  factory
235
209
  end
236
210
 
237
211
  # Creates and returns a geographic factory that includes a
238
- # projection specified by a Proj4 coordinate system. Like all
212
+ # projection specified by a coordinate system. Like all
239
213
  # geographic factories, this one creates features using latitude-
240
214
  # longitude values. However, calculations such as intersections are
241
215
  # done in the projected coordinate system, and size and distance
@@ -251,30 +225,24 @@ module RGeo
251
225
  # === Options
252
226
  #
253
227
  # When creating a projected implementation, you must provide enough
254
- # information to construct a Proj4 specification for the projection.
228
+ # information to construct a CoordinateSystem specification for the projection.
255
229
  # Generally, this means you will provide either the projection's
256
230
  # factory itself (via the <tt>:projection_factory</tt> option), in
257
- # which case the factory must include a Proj4 coordinate system;
258
- # or, alternatively, you should provide the Proj4 coordinate system
231
+ # which case the factory must include a coord_sys;
232
+ # or, alternatively, you should provide the coordinate system
259
233
  # and let this method construct a projection factory for you (which
260
234
  # it will do using the preferred Cartesian factory generator).
261
- # If you choose this second method, you may provide the proj4
262
- # directly via the <tt>:projection_proj4</tt> option, or indirectly
263
- # by providing both an <tt>:srid</tt> and a <tt>:srs_database</tt>
264
- # to use to look up the coordinate system.
235
+ # If you choose this second method, you may provide the coord_sys
236
+ # via the <tt>:projection_coord_sys</tt> or <option or <tt>:projection_srid</tt>.
265
237
  #
266
238
  # Following are detailed descriptions of the various options you can
267
239
  # pass to this method.
268
240
  #
269
241
  # [<tt>:projection_factory</tt>]
270
242
  # Specify an existing Cartesian factory to use for the projection.
271
- # This factory must have a non-nil Proj4. If this is provided, any
272
- # <tt>:projection_proj4</tt>, <tt>:projection_coord_sys</tt>, and
243
+ # This factory must have a non-nil coord_sys. If this is provided, any
244
+ # <tt>:projection_coord_sys</tt> and
273
245
  # <tt>:projection_srid</tt> are ignored.
274
- # [<tt>:projection_proj4</tt>]
275
- # Specify a Proj4 projection to use to construct the projection
276
- # factory. This may be specified as a CoordSys::Proj4 object, or
277
- # as a Proj4 string or hash representation.
278
246
  # [<tt>:projection_coord_sys</tt>]
279
247
  # Specify a OGC coordinate system for the projection. This may be
280
248
  # specified as an RGeo::CoordSys::CS::GeographicCoordinateSystem
@@ -282,16 +250,12 @@ module RGeo
282
250
  # [<tt>:projection_srid</tt>]
283
251
  # The SRID value to use for the projection factory. Defaults to
284
252
  # the given projection coordinate system's authority code, or to
285
- # 0 if no projection coordinate system is known.
286
- # [<tt>:proj4</tt>]
287
- # A proj4 projection for the geographic (lat-lon) factory. You may
288
- # pass either an RGeo::CoordSys::Proj4 object, or a string or hash
289
- # containing the Proj4 parameters. This coordinate system must be
290
- # a geographic (lat/long) coordinate system. It defaults to the
291
- # geographic part of the projection factory's coordinate system.
292
- # Generally, you should leave it at the default unless you want
293
- # the geographic coordinate system to be based on a different
294
- # horizontal datum than the projection.
253
+ # 0 if no projection coordinate system is known. If this is provided
254
+ # without a projection_coord_sys, one will be instansiated from
255
+ # the default_coord_sys_class or projection_coord_sys_class if given.
256
+ # [<tt>:projection_coord_sys_class</tt>]
257
+ # Class to create the projection_coord_sys from if only a projection_srid
258
+ # is provided.
295
259
  # [<tt>:coord_sys</tt>]
296
260
  # An OGC coordinate system for the geographic (lat-lon) factory,
297
261
  # which may be an RGeo::CoordSys::CS::GeographicCoordinateSystem
@@ -304,11 +268,6 @@ module RGeo
304
268
  # The SRID value to use for the main geographic factory. Defaults
305
269
  # to the given geographic coordinate system's authority code, or
306
270
  # to 0 if no geographic coordinate system is known.
307
- # [<tt>:srs_database</tt>]
308
- # Optional. If provided, the object should respond to #get and
309
- # #clear_cache. If both this and an SRID are
310
- # provided, they are used to look up the proj4 and coord_sys
311
- # objects from a spatial reference system database.
312
271
  # [<tt>:has_z_coordinate</tt>]
313
272
  # Support a Z coordinate. Default is false.
314
273
  # Note: this is ignored if a <tt>:projection_factory</tt> is
@@ -342,117 +301,77 @@ module RGeo
342
301
  # If a <tt>:projection_factory</tt> is _not_ provided, you may also
343
302
  # provide options for configuring the projected Cartesian factory.
344
303
  # For example, if GEOS is used for the projected factory, you may
345
- # also set the <tt>:lenient_multi_polygon_assertions</tt> and
346
- # <tt>:buffer_resolution</tt> options. See RGeo::Geos.factory for
347
- # more details.
304
+ # also set the <tt>:buffer_resolution</tt> option. See RGeo::Geos.factory
305
+ # for more details.
348
306
 
349
307
  def projected_factory(opts = {})
350
- CoordSys.check!(:proj4)
351
- db_ = opts[:srs_database]
352
308
  if (projection_factory = opts[:projection_factory])
353
309
  # Get the projection coordinate systems from the given factory
354
- projection_proj4 = projection_factory.proj4
355
- unless projection_proj4
356
- raise ArgumentError, "The :projection_factory does not have a proj4."
357
- end
358
310
  projection_coord_sys = projection_factory.coord_sys
359
- if projection_coord_sys && !projection_coord_sys.is_a?(CoordSys::CS::ProjectedCoordinateSystem)
311
+
312
+ if projection_coord_sys && !projection_coord_sys.projected?
360
313
  raise ArgumentError, "The :projection_factory's coord_sys is not a ProjectedCoordinateSystem."
361
314
  end
315
+
362
316
  # Determine geographic coordinate system. First check parameters.
363
- proj4 = opts[:proj4]
364
317
  coord_sys = opts[:coord_sys]
365
318
  srid = opts[:srid]
366
- # Lookup srid from srs database if needed
367
- if (!proj4 || !coord_sys) && srid && db_
368
- entry_ = db_.get(srid.to_i)
369
- if entry_
370
- proj4 ||= entry_.proj4
371
- coord_sys ||= entry_.coord_sys
372
- end
373
- end
374
319
  # Fall back to getting the values from the projection.
375
- proj4 ||= projection_proj4.get_geographic || _proj_4326
376
320
  coord_sys ||= projection_coord_sys.geographic_coordinate_system if projection_coord_sys
377
321
  srid ||= coord_sys.authority_code if coord_sys
378
322
  srid ||= 4326
379
323
  # Now we should have all the coordinate system info.
380
- factory = Geographic::Factory.new("Projected",
381
- proj4: proj4,
324
+ factory = Geographic::Factory.new(
325
+ "Projected",
382
326
  coord_sys: coord_sys,
383
327
  srid: srid.to_i,
384
328
  has_z_coordinate: projection_factory.property(:has_z_coordinate),
385
329
  has_m_coordinate: projection_factory.property(:has_m_coordinate),
386
330
  wkt_parser: opts[:wkt_parser], wkt_generator: opts[:wkt_generator],
387
- wkb_parser: opts[:wkb_parser], wkb_generator: opts[:wkb_generator])
388
- projector = Geographic::Proj4Projector.create_from_existing_factory(factory,
389
- projection_factory)
331
+ wkb_parser: opts[:wkb_parser], wkb_generator: opts[:wkb_generator]
332
+ )
333
+ projector = Geographic::Projector.create_from_existing_factory(
334
+ factory,
335
+ projection_factory
336
+ )
390
337
  else
391
338
  # Determine projection coordinate system. First check the parameters.
392
- projection_proj4 = opts[:projection_proj4]
393
- projection_coord_sys = opts[:projection_coord_sys]
394
- projection_srid = opts[:projection_srid]
395
- # Check the case where we need to look up a srid from an srs database.
396
- if (!projection_proj4 || !projection_coord_sys) && projection_srid && db_
397
- entry_ = db_.get(projection_srid.to_i)
398
- if entry_
399
- projection_proj4 ||= entry_.proj4
400
- projection_coord_sys ||= entry_.coord_sys
401
- end
402
- end
403
- # A projection proj4 is absolutely required.
404
- unless projection_proj4
405
- raise ArgumentError, "Unable to determine the Proj4 for the projected coordinate system."
406
- end
407
- # Check the projection coordinate systems, and parse if needed.
408
- if projection_proj4.is_a?(String) || projection_proj4.is_a?(Hash)
409
- actual_projection_proj4 = CoordSys::Proj4.create(projection_proj4)
410
- unless actual_projection_proj4
411
- raise ArgumentError, "Bad proj4 syntax: #{projection_proj4.inspect}"
412
- end
413
- projection_proj4 = actual_projection_proj4
414
- end
415
- if projection_coord_sys && !projection_coord_sys.is_a?(CoordSys::CS::ProjectedCoordinateSystem)
416
- raise ArgumentError, "The :projection_coord_sys is not a ProjectedCoordinateSystem."
417
- end
418
- projection_srid ||= projection_coord_sys.authority_code if projection_coord_sys
339
+ projection_coord_sys_info = ImplHelper::Utils.setup_coord_sys(
340
+ opts[:projection_srid],
341
+ opts[:projection_coord_sys],
342
+ opts[:projection_coord_sys_class]
343
+ )
344
+ projection_coord_sys = projection_coord_sys_info[:coord_sys]
345
+ projection_srid = projection_coord_sys_info[:srid]
346
+
419
347
  # Determine geographic coordinate system. First check parameters.
420
- proj4 = opts[:proj4]
421
348
  coord_sys = opts[:coord_sys]
422
349
  srid = opts[:srid]
423
- # Lookup srid from srs database if needed
424
- if (!proj4 || !coord_sys) && srid && db_
425
- entry_ = db_.get(srid.to_i)
426
- if entry_
427
- proj4 ||= entry_.proj4
428
- coord_sys ||= entry_.coord_sys
429
- end
430
- end
350
+
431
351
  # Fall back to getting the values from the projection.
432
- proj4 ||= projection_proj4.get_geographic || _proj_4326
433
352
  coord_sys ||= projection_coord_sys.geographic_coordinate_system if projection_coord_sys
434
353
  srid ||= coord_sys.authority_code if coord_sys
435
354
  srid ||= 4326
436
355
  # Now we should have all the coordinate system info.
437
- factory = Geographic::Factory.new("Projected",
438
- proj4: proj4,
356
+ factory = Geographic::Factory.new(
357
+ "Projected",
439
358
  coord_sys: coord_sys,
440
359
  srid: srid.to_i,
441
360
  has_z_coordinate: opts[:has_z_coordinate],
442
361
  has_m_coordinate: opts[:has_m_coordinate],
443
362
  wkt_parser: opts[:wkt_parser], wkt_generator: opts[:wkt_generator],
444
- wkb_parser: opts[:wkb_parser], wkb_generator: opts[:wkb_generator])
445
- projector = Geographic::Proj4Projector.create_from_proj4(factory,
446
- projection_proj4,
363
+ wkb_parser: opts[:wkb_parser], wkb_generator: opts[:wkb_generator]
364
+ )
365
+ projector = Geographic::Projector.create_from_opts(
366
+ factory,
447
367
  srid: projection_srid,
448
368
  coord_sys: projection_coord_sys,
449
369
  buffer_resolution: opts[:buffer_resolution],
450
- lenient_multi_polygon_assertions: opts[:lenient_multi_polygon_assertions],
451
- uses_lenient_assertions: opts[:uses_lenient_assertions],
452
370
  has_z_coordinate: opts[:has_z_coordinate],
453
371
  has_m_coordinate: opts[:has_m_coordinate],
454
372
  wkt_parser: opts[:wkt_parser], wkt_generator: opts[:wkt_generator],
455
- wkb_parser: opts[:wkb_parser], wkb_generator: opts[:wkb_generator])
373
+ wkb_parser: opts[:wkb_parser], wkb_generator: opts[:wkb_generator]
374
+ )
456
375
  end
457
376
  factory.projector = projector
458
377
  factory
@@ -460,32 +379,16 @@ module RGeo
460
379
 
461
380
  private
462
381
 
463
- def proj_4055
464
- unless defined?(@proj44055)
465
- @proj44055 = CoordSys.supported?(:proj4) && CoordSys::Proj4.create("+proj=longlat +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +no_defs")
466
- end
467
- @proj44055
468
- end
382
+ def coord_sys4055
383
+ return @coord_sys4055 if defined?(@coord_sys4055)
469
384
 
470
- def coord_sys_4055
471
- unless defined?(@coord_sys_4055)
472
- @coord_sys_4055 = CoordSys::CS.create_from_wkt('GEOGCS["Popular Visualisation CRS",DATUM["Popular_Visualisation_Datum",SPHEROID["Popular Visualisation Sphere",6378137,0,AUTHORITY["EPSG","7059"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6055"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4055"]]')
473
- end
474
- @coord_sys_4055
385
+ @coord_sys4055 = CoordSys::CONFIG.default_coord_sys_class.create(4055)
475
386
  end
476
387
 
477
- def proj_4326
478
- unless defined?(@proj_4326)
479
- @proj_4326 = CoordSys.supported?(:proj4) && CoordSys::Proj4.create("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
480
- end
481
- @proj_4326
482
- end
388
+ def coord_sys4326
389
+ return @coord_sys4326 if defined?(@coord_sys4326)
483
390
 
484
- def coord_sys_4326
485
- unless defined?(@coord_sys_4326)
486
- @coord_sys_4326 = CoordSys::CS.create_from_wkt('GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]')
487
- end
488
- @coord_sys_4326
391
+ @coord_sys4326 = CoordSys::CONFIG.default_coord_sys_class.create(4326)
489
392
  end
490
393
  end
491
394
  end
@@ -8,16 +8,18 @@
8
8
 
9
9
  module RGeo
10
10
  module Geographic
11
- class ProjectedPointImpl # :nodoc:
11
+ class ProjectedPointImpl
12
12
  include Feature::Point
13
+ include ImplHelper::ValidityCheck
13
14
  include ImplHelper::BasicGeometryMethods
14
15
  include ImplHelper::BasicPointMethods
15
16
  include ProjectedGeometryMethods
16
17
  include ProjectedPointMethods
17
18
  end
18
19
 
19
- class ProjectedLineStringImpl # :nodoc:
20
+ class ProjectedLineStringImpl
20
21
  include Feature::LineString
22
+ include ImplHelper::ValidityCheck
21
23
  include ImplHelper::BasicGeometryMethods
22
24
  include ImplHelper::BasicLineStringMethods
23
25
  include ProjectedGeometryMethods
@@ -25,18 +27,21 @@ module RGeo
25
27
  include ProjectedLineStringMethods
26
28
  end
27
29
 
28
- class ProjectedLinearRingImpl # :nodoc:
30
+ class ProjectedLinearRingImpl
29
31
  include Feature::LinearRing
32
+ include ImplHelper::ValidityCheck
30
33
  include ImplHelper::BasicGeometryMethods
31
34
  include ImplHelper::BasicLineStringMethods
32
35
  include ImplHelper::BasicLinearRingMethods
33
36
  include ProjectedGeometryMethods
34
37
  include ProjectedNCurveMethods
35
38
  include ProjectedLineStringMethods
39
+ include ProjectedLinearRingMethods
36
40
  end
37
41
 
38
- class ProjectedLineImpl # :nodoc:
42
+ class ProjectedLineImpl
39
43
  include Feature::Line
44
+ include ImplHelper::ValidityCheck
40
45
  include ImplHelper::BasicGeometryMethods
41
46
  include ImplHelper::BasicLineStringMethods
42
47
  include ImplHelper::BasicLineMethods
@@ -45,8 +50,9 @@ module RGeo
45
50
  include ProjectedLineStringMethods
46
51
  end
47
52
 
48
- class ProjectedPolygonImpl # :nodoc:
53
+ class ProjectedPolygonImpl
49
54
  include Feature::Polygon
55
+ include ImplHelper::ValidityCheck
50
56
  include ImplHelper::BasicGeometryMethods
51
57
  include ImplHelper::BasicPolygonMethods
52
58
  include ProjectedGeometryMethods
@@ -54,23 +60,26 @@ module RGeo
54
60
  include ProjectedPolygonMethods
55
61
  end
56
62
 
57
- class ProjectedGeometryCollectionImpl # :nodoc:
63
+ class ProjectedGeometryCollectionImpl
58
64
  include Feature::GeometryCollection
65
+ include ImplHelper::ValidityCheck
59
66
  include ImplHelper::BasicGeometryMethods
60
67
  include ImplHelper::BasicGeometryCollectionMethods
61
68
  include ProjectedGeometryMethods
62
69
  end
63
70
 
64
- class ProjectedMultiPointImpl # :nodoc:
71
+ class ProjectedMultiPointImpl
65
72
  include Feature::MultiPoint
73
+ include ImplHelper::ValidityCheck
66
74
  include ImplHelper::BasicGeometryMethods
67
75
  include ImplHelper::BasicGeometryCollectionMethods
68
76
  include ImplHelper::BasicMultiPointMethods
69
77
  include ProjectedGeometryMethods
70
78
  end
71
79
 
72
- class ProjectedMultiLineStringImpl # :nodoc:
80
+ class ProjectedMultiLineStringImpl
73
81
  include Feature::MultiLineString
82
+ include ImplHelper::ValidityCheck
74
83
  include ImplHelper::BasicGeometryMethods
75
84
  include ImplHelper::BasicGeometryCollectionMethods
76
85
  include ImplHelper::BasicMultiLineStringMethods
@@ -78,8 +87,9 @@ module RGeo
78
87
  include ProjectedNCurveMethods
79
88
  end
80
89
 
81
- class ProjectedMultiPolygonImpl # :nodoc:
90
+ class ProjectedMultiPolygonImpl
82
91
  include Feature::MultiPolygon
92
+ include ImplHelper::ValidityCheck
83
93
  include ImplHelper::BasicGeometryMethods
84
94
  include ImplHelper::BasicGeometryCollectionMethods
85
95
  include ImplHelper::BasicMultiPolygonMethods
@@ -87,5 +97,7 @@ module RGeo
87
97
  include ProjectedNSurfaceMethods
88
98
  include ProjectedMultiPolygonMethods
89
99
  end
100
+
101
+ ImplHelper::ValidityCheck.override_classes
90
102
  end
91
103
  end