rgeo 1.1.2 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +144 -0
  3. data/ext/geos_c_impl/analysis.c +78 -0
  4. data/ext/geos_c_impl/analysis.h +42 -0
  5. data/ext/geos_c_impl/errors.c +35 -0
  6. data/ext/geos_c_impl/errors.h +22 -0
  7. data/ext/geos_c_impl/extconf.rb +6 -3
  8. data/ext/geos_c_impl/factory.c +14 -5
  9. data/ext/geos_c_impl/factory.h +5 -1
  10. data/ext/geos_c_impl/geometry.c +20 -2
  11. data/ext/geos_c_impl/geometry_collection.c +0 -17
  12. data/ext/geos_c_impl/main.c +5 -2
  13. data/ext/geos_c_impl/preface.h +3 -0
  14. data/lib/rgeo.rb +11 -13
  15. data/lib/rgeo/cartesian.rb +13 -23
  16. data/lib/rgeo/cartesian/analysis.rb +44 -20
  17. data/lib/rgeo/cartesian/bounding_box.rb +83 -79
  18. data/lib/rgeo/cartesian/calculations.rb +40 -38
  19. data/lib/rgeo/cartesian/factory.rb +134 -169
  20. data/lib/rgeo/cartesian/feature_classes.rb +2 -18
  21. data/lib/rgeo/cartesian/feature_methods.rb +37 -39
  22. data/lib/rgeo/cartesian/interface.rb +11 -9
  23. data/lib/rgeo/coord_sys.rb +9 -8
  24. data/lib/rgeo/coord_sys/cs/entities.rb +345 -303
  25. data/lib/rgeo/coord_sys/cs/factories.rb +30 -28
  26. data/lib/rgeo/coord_sys/cs/wkt_parser.rb +128 -126
  27. data/lib/rgeo/coord_sys/srs_database/{interface.rb → entry.rb} +26 -32
  28. data/lib/rgeo/coord_sys/srs_database/sr_org.rb +19 -17
  29. data/lib/rgeo/coord_sys/srs_database/url_reader.rb +21 -19
  30. data/lib/rgeo/error.rb +7 -1
  31. data/lib/rgeo/feature.rb +40 -51
  32. data/lib/rgeo/feature/curve.rb +2 -0
  33. data/lib/rgeo/feature/factory.rb +15 -13
  34. data/lib/rgeo/feature/factory_generator.rb +7 -5
  35. data/lib/rgeo/feature/geometry.rb +31 -29
  36. data/lib/rgeo/feature/geometry_collection.rb +6 -4
  37. data/lib/rgeo/feature/line.rb +2 -0
  38. data/lib/rgeo/feature/line_string.rb +3 -1
  39. data/lib/rgeo/feature/linear_ring.rb +12 -0
  40. data/lib/rgeo/feature/multi_curve.rb +2 -0
  41. data/lib/rgeo/feature/multi_line_string.rb +2 -0
  42. data/lib/rgeo/feature/multi_point.rb +2 -0
  43. data/lib/rgeo/feature/multi_polygon.rb +2 -0
  44. data/lib/rgeo/feature/multi_surface.rb +2 -0
  45. data/lib/rgeo/feature/point.rb +2 -0
  46. data/lib/rgeo/feature/polygon.rb +3 -1
  47. data/lib/rgeo/feature/surface.rb +2 -0
  48. data/lib/rgeo/feature/types.rb +107 -103
  49. data/lib/rgeo/geographic.rb +27 -37
  50. data/lib/rgeo/geographic/factory.rb +154 -199
  51. data/lib/rgeo/geographic/interface.rb +141 -137
  52. data/lib/rgeo/geographic/proj4_projector.rb +28 -23
  53. data/lib/rgeo/geographic/projected_feature_classes.rb +2 -18
  54. data/lib/rgeo/geographic/projected_feature_methods.rb +64 -54
  55. data/lib/rgeo/geographic/projected_window.rb +4 -2
  56. data/lib/rgeo/geographic/simple_mercator_projector.rb +41 -39
  57. data/lib/rgeo/geographic/spherical_feature_classes.rb +3 -18
  58. data/lib/rgeo/geographic/spherical_feature_methods.rb +90 -67
  59. data/lib/rgeo/geographic/spherical_math.rb +81 -87
  60. data/lib/rgeo/geos.rb +40 -53
  61. data/lib/rgeo/geos/capi_factory.rb +111 -136
  62. data/lib/rgeo/geos/capi_feature_classes.rb +22 -36
  63. data/lib/rgeo/geos/ffi_factory.rb +276 -297
  64. data/lib/rgeo/geos/ffi_feature_classes.rb +2 -20
  65. data/lib/rgeo/geos/ffi_feature_methods.rb +177 -169
  66. data/lib/rgeo/geos/interface.rb +25 -23
  67. data/lib/rgeo/geos/utils.rb +47 -39
  68. data/lib/rgeo/geos/zm_factory.rb +171 -185
  69. data/lib/rgeo/geos/zm_feature_classes.rb +2 -20
  70. data/lib/rgeo/geos/zm_feature_methods.rb +76 -72
  71. data/lib/rgeo/impl_helper.rb +8 -18
  72. data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +84 -75
  73. data/lib/rgeo/impl_helper/basic_geometry_methods.rb +21 -23
  74. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +95 -48
  75. data/lib/rgeo/impl_helper/basic_point_methods.rb +29 -25
  76. data/lib/rgeo/impl_helper/basic_polygon_methods.rb +68 -27
  77. data/lib/rgeo/impl_helper/math.rb +2 -0
  78. data/lib/rgeo/impl_helper/utils.rb +9 -15
  79. data/lib/rgeo/version.rb +3 -1
  80. data/lib/rgeo/wkrep.rb +24 -34
  81. data/lib/rgeo/wkrep/wkb_generator.rb +87 -84
  82. data/lib/rgeo/wkrep/wkb_parser.rb +93 -93
  83. data/lib/rgeo/wkrep/wkt_generator.rb +67 -63
  84. data/lib/rgeo/wkrep/wkt_parser.rb +172 -168
  85. metadata +30 -36
  86. data/lib/rgeo/feature/mixins.rb +0 -143
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # -----------------------------------------------------------------------------
2
4
  #
3
5
  # Core calculations in the plane
@@ -9,9 +11,9 @@ module RGeo
9
11
  # Represents a line segment in the plane.
10
12
 
11
13
  class Segment # :nodoc:
12
- def initialize(start_, end_)
13
- @s = start_
14
- @e = end_
14
+ def initialize(start, stop)
15
+ @s = start
16
+ @e = stop
15
17
  @sx = @s.x
16
18
  @sy = @s.y
17
19
  @ex = @e.x
@@ -30,8 +32,8 @@ module RGeo
30
32
  "#{@s} - #{@e}"
31
33
  end
32
34
 
33
- def eql?(rhs_)
34
- rhs_.is_a?(Segment) && @s == rhs_.s && @e == rhs_.e
35
+ def eql?(rhs)
36
+ rhs.is_a?(Segment) && @s == rhs.s && @e == rhs.e
35
37
  end
36
38
  alias == eql?
37
39
 
@@ -43,70 +45,70 @@ module RGeo
43
45
  # a positive value if the point is to the right, or
44
46
  # 0 if the point is collinear to the segment.
45
47
 
46
- def side(p_)
47
- px_ = p_.x
48
- py_ = p_.y
49
- (@sx - px_) * (@ey - py_) - (@sy - py_) * (@ex - px_)
48
+ def side(p)
49
+ px = p.x
50
+ py = p.y
51
+ (@sx - px) * (@ey - py) - (@sy - py) * (@ex - px)
50
52
  end
51
53
 
52
- def tproj(p_)
54
+ def tproj(p)
53
55
  if @lensq == 0
54
56
  nil
55
57
  else
56
- (@dx * (p_.x - @sx) + @dy * (p_.y - @sy)) / @lensq
58
+ (@dx * (p.x - @sx) + @dy * (p.y - @sy)) / @lensq
57
59
  end
58
60
  end
59
61
 
60
- def contains_point?(p_)
61
- if side(p_) == 0
62
- t_ = tproj(p_)
63
- t_ && t_ >= 0.0 && t_ <= 1.0
62
+ def contains_point?(p)
63
+ if side(p) == 0
64
+ t = tproj(p)
65
+ t && t >= 0.0 && t <= 1.0
64
66
  else
65
67
  false
66
68
  end
67
69
  end
68
70
 
69
- def intersects_segment?(seg_)
70
- s2_ = seg_.s
71
+ def intersects_segment?(seg)
72
+ s2 = seg.s
71
73
  # Handle degenerate cases
72
- if seg_.degenerate?
74
+ if seg.degenerate?
73
75
  if @lensq == 0
74
- return @s == s2_
76
+ return @s == s2
75
77
  else
76
- return contains_point?(s2_)
78
+ return contains_point?(s2)
77
79
  end
78
80
  elsif @lensq == 0
79
- return seg_.contains_point?(@s)
81
+ return seg.contains_point?(@s)
80
82
  end
81
83
  # Both segments have nonzero length.
82
- sx2_ = s2_.x
83
- sy2_ = s2_.y
84
- dx2_ = seg_.dx
85
- dy2_ = seg_.dy
86
- denom_ = @dx * dy2_ - @dy * dx2_
87
- if denom_ == 0
84
+ sx2 = s2.x
85
+ sy2 = s2.y
86
+ dx2 = seg.dx
87
+ dy2 = seg.dy
88
+ denom = @dx * dy2 - @dy * dx2
89
+ if denom == 0
88
90
  # Segments are parallel. Make sure they are collinear.
89
- return false unless side(s2_) == 0
91
+ return false unless side(s2) == 0
90
92
  # 1-D check.
91
- ts_ = (@dx * (sx2_ - @sx) + @dy * (sy2_ - @sy)) / @lensq
92
- te_ = (@dx * (sx2_ + dx2_ - @sx) + @dy * (sy2_ + dy2_ - @sy)) / @lensq
93
- if ts_ < te_
94
- te_ >= 0.0 && ts_ <= 1.0
93
+ ts = (@dx * (sx2 - @sx) + @dy * (sy2 - @sy)) / @lensq
94
+ te = (@dx * (sx2 + dx2 - @sx) + @dy * (sy2 + dy2 - @sy)) / @lensq
95
+ if ts < te
96
+ te >= 0.0 && ts <= 1.0
95
97
  else
96
- ts_ >= 0.0 && te_ <= 1.0
98
+ ts >= 0.0 && te <= 1.0
97
99
  end
98
100
  else
99
101
  # Segments are not parallel. Check the intersection of their
100
102
  # containing lines.
101
- t_ = (dy2_ * (sx2_ - @sx) + dx2_ * (@sy - sy2_)) / denom_
102
- return false if t_ < 0.0 || t_ > 1.0
103
- t2_ = (@dy * (sx2_ - @sx) + @dx * (@sy - sy2_)) / denom_
104
- t2_ >= 0.0 && t2_ <= 1.0
103
+ t = (dy2 * (sx2 - @sx) + dx2 * (@sy - sy2)) / denom
104
+ return false if t < 0.0 || t > 1.0
105
+ t2 = (@dy * (sx2 - @sx) + @dx * (@sy - sy2)) / denom
106
+ t2 >= 0.0 && t2 <= 1.0
105
107
  end
106
108
  end
107
109
 
108
110
  def length
109
- ::Math.sqrt(@lensq)
111
+ Math.sqrt(@lensq)
110
112
  end
111
113
  end
112
114
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # -----------------------------------------------------------------------------
2
4
  #
3
5
  # Geographic data factory implementation
@@ -11,67 +13,64 @@ module RGeo
11
13
 
12
14
  class Factory
13
15
  include Feature::Factory::Instance
16
+ include ImplHelper::Utils
14
17
 
15
18
  # Create a new simple cartesian factory.
16
19
  #
17
20
  # See RGeo::Cartesian.simple_factory for a list of supported options.
18
21
 
19
- def initialize(opts_ = {})
20
- @has_z = opts_[:has_z_coordinate] ? true : false
21
- @has_m = opts_[:has_m_coordinate] ? true : false
22
- @proj4 = opts_[:proj4]
22
+ def initialize(opts = {})
23
+ @has_z = opts[:has_z_coordinate] ? true : false
24
+ @has_m = opts[:has_m_coordinate] ? true : false
25
+ @proj4 = opts[:proj4]
23
26
  if @proj4 && CoordSys.check!(:proj4)
24
- if @proj4.is_a?(::String) || @proj4.is_a?(::Hash)
27
+ if @proj4.is_a?(String) || @proj4.is_a?(Hash)
25
28
  @proj4 = CoordSys::Proj4.create(@proj4)
26
29
  end
27
30
  end
28
- srid_ = opts_[:srid]
29
- @coord_sys = opts_[:coord_sys]
30
- if @coord_sys.is_a?(::String)
31
- @coord_sys = begin
32
- CoordSys::CS.create_from_wkt(@coord_sys)
33
- rescue
34
- nil
35
- end
31
+ srid = opts[:srid]
32
+ @coord_sys = opts[:coord_sys]
33
+ if @coord_sys.is_a?(String)
34
+ @coord_sys = CoordSys::CS.create_from_wkt(@coord_sys)
36
35
  end
37
- if (!@proj4 || !@coord_sys) && srid_ && (db_ = opts_[:srs_database])
38
- entry_ = db_.get(srid_.to_i)
39
- if entry_
40
- @proj4 ||= entry_.proj4
41
- @coord_sys ||= entry_.coord_sys
36
+ if (!@proj4 || !@coord_sys) && srid && (db = opts[:srs_database])
37
+ entry = db.get(srid.to_i)
38
+ if entry
39
+ @proj4 ||= entry.proj4
40
+ @coord_sys ||= entry.coord_sys
42
41
  end
43
42
  end
44
- srid_ ||= @coord_sys.authority_code if @coord_sys
45
- @srid = srid_.to_i
46
- @lenient_assertions = opts_[:uses_lenient_assertions] ? true : false
47
- @buffer_resolution = opts_[:buffer_resolution].to_i
43
+ srid ||= @coord_sys.authority_code if @coord_sys
44
+ @srid = srid.to_i
45
+ @lenient_assertions = opts[:uses_lenient_assertions] ? true : false
46
+ @buffer_resolution = opts[:buffer_resolution].to_i
48
47
  @buffer_resolution = 1 if @buffer_resolution < 1
49
48
 
50
- wkt_generator_ = opts_[:wkt_generator]
51
- case wkt_generator_
52
- when ::Hash
53
- @wkt_generator = WKRep::WKTGenerator.new(wkt_generator_)
49
+ wkt_generator = opts[:wkt_generator]
50
+ case wkt_generator
51
+ when Hash
52
+ @wkt_generator = WKRep::WKTGenerator.new(wkt_generator)
54
53
  else
55
54
  @wkt_generator = WKRep::WKTGenerator.new(convert_case: :upper)
56
55
  end
57
- wkb_generator_ = opts_[:wkb_generator]
58
- case wkb_generator_
59
- when ::Hash
60
- @wkb_generator = WKRep::WKBGenerator.new(wkb_generator_)
56
+ wkb_generator = opts[:wkb_generator]
57
+ case wkb_generator
58
+ when Hash
59
+ @wkb_generator = WKRep::WKBGenerator.new(wkb_generator)
61
60
  else
62
61
  @wkb_generator = WKRep::WKBGenerator.new
63
62
  end
64
- wkt_parser_ = opts_[:wkt_parser]
65
- case wkt_parser_
66
- when ::Hash
67
- @wkt_parser = WKRep::WKTParser.new(self, wkt_parser_)
63
+ wkt_parser = opts[:wkt_parser]
64
+ case wkt_parser
65
+ when Hash
66
+ @wkt_parser = WKRep::WKTParser.new(self, wkt_parser)
68
67
  else
69
68
  @wkt_parser = WKRep::WKTParser.new(self)
70
69
  end
71
- wkb_parser_ = opts_[:wkb_parser]
72
- case wkb_parser_
73
- when ::Hash
74
- @wkb_parser = WKRep::WKBParser.new(self, wkb_parser_)
70
+ wkb_parser = opts[:wkb_parser]
71
+ case wkb_parser
72
+ when Hash
73
+ @wkb_parser = WKRep::WKBParser.new(self, wkb_parser)
75
74
  else
76
75
  @wkb_parser = WKRep::WKBParser.new(self)
77
76
  end
@@ -79,11 +78,11 @@ module RGeo
79
78
 
80
79
  # Equivalence test.
81
80
 
82
- def eql?(rhs_)
83
- rhs_.is_a?(self.class) && @srid == rhs_.srid &&
84
- @has_z == rhs_.property(:has_z_coordinate) &&
85
- @has_m == rhs_.property(:has_m_coordinate) &&
86
- @proj4.eql?(rhs_.proj4)
81
+ def eql?(rhs)
82
+ rhs.is_a?(self.class) && @srid == rhs.srid &&
83
+ @has_z == rhs.property(:has_z_coordinate) &&
84
+ @has_m == rhs.property(:has_m_coordinate) &&
85
+ @proj4.eql?(rhs.proj4)
87
86
  end
88
87
  alias == eql?
89
88
 
@@ -100,10 +99,10 @@ module RGeo
100
99
  "hasz" => @has_z,
101
100
  "hasm" => @has_m,
102
101
  "srid" => @srid,
103
- "wktg" => @wkt_generator._properties,
104
- "wkbg" => @wkb_generator._properties,
105
- "wktp" => @wkt_parser._properties,
106
- "wkbp" => @wkb_parser._properties,
102
+ "wktg" => @wkt_generator.properties,
103
+ "wkbg" => @wkb_generator.properties,
104
+ "wktp" => @wkt_parser.properties,
105
+ "wkbp" => @wkb_parser.properties,
107
106
  "lena" => @lenient_assertions,
108
107
  "bufr" => @buffer_resolution
109
108
  }
@@ -112,79 +111,79 @@ module RGeo
112
111
  hash_
113
112
  end
114
113
 
115
- def marshal_load(data_) # :nodoc:
116
- if (proj4_data_ = data_["proj4"]) && CoordSys.check!(:proj4)
117
- proj4_ = CoordSys::Proj4.allocate
118
- proj4_.marshal_load(proj4_data_)
114
+ def marshal_load(data) # :nodoc:
115
+ if (proj4_data = data["proj4"]) && CoordSys.check!(:proj4)
116
+ proj4 = CoordSys::Proj4.allocate
117
+ proj4.marshal_load(proj4_data)
119
118
  else
120
- proj4_ = nil
119
+ proj4 = nil
121
120
  end
122
- if (coord_sys_data_ = data_["cs"])
123
- coord_sys_ = CoordSys::CS.create_from_wkt(coord_sys_data_)
121
+ if (coord_sys_data = data["cs"])
122
+ coord_sys = CoordSys::CS.create_from_wkt(coord_sys_data)
124
123
  else
125
- coord_sys_ = nil
124
+ coord_sys = nil
126
125
  end
127
126
  initialize(
128
- has_z_coordinate: data_["hasz"],
129
- has_m_coordinate: data_["hasm"],
130
- srid: data_["srid"],
131
- wkt_generator: ImplHelper::Utils.symbolize_hash(data_["wktg"]),
132
- wkb_generator: ImplHelper::Utils.symbolize_hash(data_["wkbg"]),
133
- wkt_parser: ImplHelper::Utils.symbolize_hash(data_["wktp"]),
134
- wkb_parser: ImplHelper::Utils.symbolize_hash(data_["wkbp"]),
135
- uses_lenient_assertions: data_["lena"],
136
- buffer_resolution: data_["bufr"],
137
- proj4: proj4_,
138
- coord_sys: coord_sys_
127
+ has_z_coordinate: data["hasz"],
128
+ has_m_coordinate: data["hasm"],
129
+ srid: data["srid"],
130
+ wkt_generator: symbolize_hash(data["wktg"]),
131
+ wkb_generator: symbolize_hash(data["wkbg"]),
132
+ wkt_parser: symbolize_hash(data["wktp"]),
133
+ wkb_parser: symbolize_hash(data["wkbp"]),
134
+ uses_lenient_assertions: data["lena"],
135
+ buffer_resolution: data["bufr"],
136
+ proj4: proj4,
137
+ coord_sys: coord_sys
139
138
  )
140
139
  end
141
140
 
142
141
  # Psych support
143
142
 
144
- def encode_with(coder_) # :nodoc:
145
- coder_["has_z_coordinate"] = @has_z
146
- coder_["has_m_coordinate"] = @has_m
147
- coder_["srid"] = @srid
148
- coder_["lenient_assertions"] = @lenient_assertions
149
- coder_["buffer_resolution"] = @buffer_resolution
150
- coder_["wkt_generator"] = @wkt_generator._properties
151
- coder_["wkb_generator"] = @wkb_generator._properties
152
- coder_["wkt_parser"] = @wkt_parser._properties
153
- coder_["wkb_parser"] = @wkb_parser._properties
143
+ def encode_with(coder) # :nodoc:
144
+ coder["has_z_coordinate"] = @has_z
145
+ coder["has_m_coordinate"] = @has_m
146
+ coder["srid"] = @srid
147
+ coder["lenient_assertions"] = @lenient_assertions
148
+ coder["buffer_resolution"] = @buffer_resolution
149
+ coder["wkt_generator"] = @wkt_generator.properties
150
+ coder["wkb_generator"] = @wkb_generator.properties
151
+ coder["wkt_parser"] = @wkt_parser.properties
152
+ coder["wkb_parser"] = @wkb_parser.properties
154
153
  if @proj4
155
- str_ = @proj4.original_str || @proj4.canonical_str
156
- coder_["proj4"] = @proj4.radians? ? { "proj4" => str_, "radians" => true } : str_
154
+ str = @proj4.original_str || @proj4.canonical_str
155
+ coder["proj4"] = @proj4.radians? ? { "proj4" => str, "radians" => true } : str
157
156
  end
158
- coder_["coord_sys"] = @coord_sys.to_wkt if @coord_sys
157
+ coder["coord_sys"] = @coord_sys.to_wkt if @coord_sys
159
158
  end
160
159
 
161
- def init_with(coder_) # :nodoc:
162
- if (proj4_data_ = coder_["proj4"]) && CoordSys.check!(:proj4)
163
- if proj4_data_.is_a?(::Hash)
164
- proj4_ = CoordSys::Proj4.create(proj4_data_["proj4"], radians: proj4_data_["radians"])
160
+ def init_with(coder) # :nodoc:
161
+ if (proj4_data = coder["proj4"]) && CoordSys.check!(:proj4)
162
+ if proj4_data.is_a?(Hash)
163
+ proj4 = CoordSys::Proj4.create(proj4_data["proj4"], radians: proj4_data["radians"])
165
164
  else
166
- proj4_ = CoordSys::Proj4.create(proj4_data_.to_s)
165
+ proj4 = CoordSys::Proj4.create(proj4_data.to_s)
167
166
  end
168
167
  else
169
- proj4_ = nil
168
+ proj4 = nil
170
169
  end
171
- if (coord_sys_data_ = coder_["cs"])
172
- coord_sys_ = CoordSys::CS.create_from_wkt(coord_sys_data_.to_s)
170
+ if (coord_sys_data = coder["cs"])
171
+ coord_sys = CoordSys::CS.create_from_wkt(coord_sys_data.to_s)
173
172
  else
174
- coord_sys_ = nil
173
+ coord_sys = nil
175
174
  end
176
175
  initialize(
177
- has_z_coordinate: coder_["has_z_coordinate"],
178
- has_m_coordinate: coder_["has_m_coordinate"],
179
- srid: coder_["srid"],
180
- wkt_generator: ImplHelper::Utils.symbolize_hash(coder_["wkt_generator"]),
181
- wkb_generator: ImplHelper::Utils.symbolize_hash(coder_["wkb_generator"]),
182
- wkt_parser: ImplHelper::Utils.symbolize_hash(coder_["wkt_parser"]),
183
- wkb_parser: ImplHelper::Utils.symbolize_hash(coder_["wkb_parser"]),
184
- uses_lenient_assertions: coder_["lenient_assertions"],
185
- buffer_resolution: coder_["buffer_resolution"],
186
- proj4: proj4_,
187
- coord_sys: coord_sys_
176
+ has_z_coordinate: coder["has_z_coordinate"],
177
+ has_m_coordinate: coder["has_m_coordinate"],
178
+ srid: coder["srid"],
179
+ wkt_generator: symbolize_hash(coder["wkt_generator"]),
180
+ wkb_generator: symbolize_hash(coder["wkb_generator"]),
181
+ wkt_parser: symbolize_hash(coder["wkt_parser"]),
182
+ wkb_parser: symbolize_hash(coder["wkb_parser"]),
183
+ uses_lenient_assertions: coder["lenient_assertions"],
184
+ buffer_resolution: coder["buffer_resolution"],
185
+ proj4: proj4,
186
+ coord_sys: coord_sys
188
187
  )
189
188
  end
190
189
 
@@ -194,8 +193,8 @@ module RGeo
194
193
 
195
194
  # See RGeo::Feature::Factory#property
196
195
 
197
- def property(name_)
198
- case name_
196
+ def property(name)
197
+ case name
199
198
  when :has_z_coordinate
200
199
  @has_z
201
200
  when :has_m_coordinate
@@ -211,86 +210,68 @@ module RGeo
211
210
 
212
211
  # See RGeo::Feature::Factory#parse_wkt
213
212
 
214
- def parse_wkt(str_)
215
- @wkt_parser.parse(str_)
213
+ def parse_wkt(str)
214
+ @wkt_parser.parse(str)
216
215
  end
217
216
 
218
217
  # See RGeo::Feature::Factory#parse_wkb
219
218
 
220
- def parse_wkb(str_)
221
- @wkb_parser.parse(str_)
219
+ def parse_wkb(str)
220
+ @wkb_parser.parse(str)
222
221
  end
223
222
 
224
223
  # See RGeo::Feature::Factory#point
225
224
 
226
- def point(x_, y_, *extra_)
227
- PointImpl.new(self, x_, y_, *extra_)
228
- rescue
229
- nil
225
+ def point(x, y, *extra)
226
+ PointImpl.new(self, x, y, *extra)
230
227
  end
231
228
 
232
229
  # See RGeo::Feature::Factory#line_string
233
230
 
234
- def line_string(points_)
235
- LineStringImpl.new(self, points_)
236
- rescue
237
- nil
231
+ def line_string(points)
232
+ LineStringImpl.new(self, points)
238
233
  end
239
234
 
240
235
  # See RGeo::Feature::Factory#line
241
236
 
242
- def line(start_, end_)
243
- LineImpl.new(self, start_, end_)
244
- rescue
245
- nil
237
+ def line(start, stop)
238
+ LineImpl.new(self, start, stop)
246
239
  end
247
240
 
248
241
  # See RGeo::Feature::Factory#linear_ring
249
242
 
250
- def linear_ring(points_)
251
- LinearRingImpl.new(self, points_)
252
- rescue
253
- nil
243
+ def linear_ring(points)
244
+ LinearRingImpl.new(self, points)
254
245
  end
255
246
 
256
247
  # See RGeo::Feature::Factory#polygon
257
248
 
258
- def polygon(outer_ring_, inner_rings_ = nil)
259
- PolygonImpl.new(self, outer_ring_, inner_rings_)
260
- rescue
261
- nil
249
+ def polygon(outer_ring, inner_rings = nil)
250
+ PolygonImpl.new(self, outer_ring, inner_rings)
262
251
  end
263
252
 
264
253
  # See RGeo::Feature::Factory#collection
265
254
 
266
- def collection(elems_)
267
- GeometryCollectionImpl.new(self, elems_)
268
- rescue
269
- nil
255
+ def collection(elems)
256
+ GeometryCollectionImpl.new(self, elems)
270
257
  end
271
258
 
272
259
  # See RGeo::Feature::Factory#multi_point
273
260
 
274
- def multi_point(elems_)
275
- MultiPointImpl.new(self, elems_)
276
- rescue
277
- nil
261
+ def multi_point(elems)
262
+ MultiPointImpl.new(self, elems)
278
263
  end
279
264
 
280
265
  # See RGeo::Feature::Factory#multi_line_string
281
266
 
282
- def multi_line_string(elems_)
283
- MultiLineStringImpl.new(self, elems_)
284
- rescue
285
- nil
267
+ def multi_line_string(elems)
268
+ MultiLineStringImpl.new(self, elems)
286
269
  end
287
270
 
288
271
  # See RGeo::Feature::Factory#multi_polygon
289
272
 
290
- def multi_polygon(elems_)
291
- MultiPolygonImpl.new(self, elems_)
292
- rescue
293
- nil
273
+ def multi_polygon(elems)
274
+ MultiPolygonImpl.new(self, elems)
294
275
  end
295
276
 
296
277
  # See RGeo::Feature::Factory#proj4
@@ -301,44 +282,28 @@ module RGeo
301
282
 
302
283
  attr_reader :coord_sys
303
284
 
304
- def _generate_wkt(obj_) # :nodoc:
305
- @wkt_generator.generate(obj_)
285
+ def generate_wkt(obj)
286
+ @wkt_generator.generate(obj)
306
287
  end
307
288
 
308
- def _generate_wkb(obj_) # :nodoc:
309
- @wkb_generator.generate(obj_)
289
+ def generate_wkb(obj)
290
+ @wkb_generator.generate(obj)
310
291
  end
311
292
 
312
- def _marshal_wkb_generator # :nodoc:
313
- unless defined?(@marshal_wkb_generator)
314
- @marshal_wkb_generator = RGeo::WKRep::WKBGenerator.new(
315
- type_format: :wkb12)
316
- end
317
- @marshal_wkb_generator
293
+ def marshal_wkb_generator
294
+ @marshal_wkb_generator ||= RGeo::WKRep::WKBGenerator.new(type_format: :wkb12)
318
295
  end
319
296
 
320
- def _marshal_wkb_parser # :nodoc:
321
- unless defined?(@marshal_wkb_parser)
322
- @marshal_wkb_parser = RGeo::WKRep::WKBParser.new(self,
323
- support_wkb12: true)
324
- end
325
- @marshal_wkb_parser
297
+ def marshal_wkb_parser
298
+ @marshal_wkb_parser ||= RGeo::WKRep::WKBParser.new(self, support_wkb12: true)
326
299
  end
327
300
 
328
- def _psych_wkt_generator # :nodoc:
329
- unless defined?(@psych_wkt_generator)
330
- @psych_wkt_generator = RGeo::WKRep::WKTGenerator.new(
331
- tag_format: :wkt12)
332
- end
333
- @psych_wkt_generator
301
+ def psych_wkt_generator
302
+ @psych_wkt_generator ||= RGeo::WKRep::WKTGenerator.new(tag_format: :wkt12)
334
303
  end
335
304
 
336
- def _psych_wkt_parser # :nodoc:
337
- unless defined?(@psych_wkt_parser)
338
- @psych_wkt_parser = RGeo::WKRep::WKTParser.new(self,
339
- support_wkt12: true, support_ewkt: true)
340
- end
341
- @psych_wkt_parser
305
+ def psych_wkt_parser
306
+ @psych_wkt_parser ||= RGeo::WKRep::WKTParser.new(self, support_wkt12: true, support_ewkt: true)
342
307
  end
343
308
  end
344
309
  end