rgeo 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +29 -0
  3. data/ext/geos_c_impl/Makefile_2.2.3 +260 -0
  4. data/ext/geos_c_impl/coordinates.c +65 -0
  5. data/ext/geos_c_impl/coordinates.h +2 -0
  6. data/ext/geos_c_impl/extconf.rb +19 -43
  7. data/ext/geos_c_impl/geometry.c +24 -0
  8. data/ext/geos_c_impl/geometry_collection.c +99 -1
  9. data/ext/geos_c_impl/geos_c_impl_2.2.3.bundle +0 -0
  10. data/ext/geos_c_impl/line_string.c +38 -0
  11. data/ext/geos_c_impl/mkmf.log +123 -0
  12. data/ext/geos_c_impl/point.c +27 -0
  13. data/ext/geos_c_impl/polygon.c +26 -0
  14. data/ext/proj4_c_impl/Makefile_2.2.3 +260 -0
  15. data/ext/proj4_c_impl/extconf.rb +32 -32
  16. data/ext/proj4_c_impl/mkmf.log +47 -0
  17. data/ext/proj4_c_impl/proj4_c_impl_2.2.3.bundle +0 -0
  18. data/lib/rgeo.rb +10 -11
  19. data/lib/rgeo/cartesian.rb +7 -12
  20. data/lib/rgeo/cartesian/analysis.rb +13 -26
  21. data/lib/rgeo/cartesian/bounding_box.rb +45 -114
  22. data/lib/rgeo/cartesian/calculations.rb +3 -21
  23. data/lib/rgeo/cartesian/factory.rb +101 -122
  24. data/lib/rgeo/cartesian/feature_classes.rb +9 -59
  25. data/lib/rgeo/cartesian/feature_methods.rb +15 -45
  26. data/lib/rgeo/cartesian/interface.rb +6 -17
  27. data/lib/rgeo/coord_sys.rb +9 -15
  28. data/lib/rgeo/coord_sys/cs/entities.rb +84 -330
  29. data/lib/rgeo/coord_sys/cs/factories.rb +2 -32
  30. data/lib/rgeo/coord_sys/cs/wkt_parser.rb +52 -80
  31. data/lib/rgeo/coord_sys/proj4.rb +28 -67
  32. data/lib/rgeo/coord_sys/proj4_c_impl.bundle +0 -0
  33. data/lib/rgeo/coord_sys/srs_database/interface.rb +4 -24
  34. data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +20 -38
  35. data/lib/rgeo/coord_sys/srs_database/sr_org.rb +6 -22
  36. data/lib/rgeo/coord_sys/srs_database/url_reader.rb +6 -21
  37. data/lib/rgeo/error.rb +0 -6
  38. data/lib/rgeo/feature.rb +18 -23
  39. data/lib/rgeo/feature/curve.rb +0 -14
  40. data/lib/rgeo/feature/factory.rb +13 -38
  41. data/lib/rgeo/feature/factory_generator.rb +4 -16
  42. data/lib/rgeo/feature/geometry.rb +18 -60
  43. data/lib/rgeo/feature/geometry_collection.rb +3 -17
  44. data/lib/rgeo/feature/line.rb +0 -10
  45. data/lib/rgeo/feature/line_string.rb +1 -13
  46. data/lib/rgeo/feature/linear_ring.rb +0 -9
  47. data/lib/rgeo/feature/mixins.rb +11 -36
  48. data/lib/rgeo/feature/multi_curve.rb +0 -11
  49. data/lib/rgeo/feature/multi_line_string.rb +0 -9
  50. data/lib/rgeo/feature/multi_point.rb +0 -9
  51. data/lib/rgeo/feature/multi_polygon.rb +0 -9
  52. data/lib/rgeo/feature/multi_surface.rb +0 -12
  53. data/lib/rgeo/feature/point.rb +0 -13
  54. data/lib/rgeo/feature/polygon.rb +1 -14
  55. data/lib/rgeo/feature/surface.rb +0 -12
  56. data/lib/rgeo/feature/types.rb +19 -61
  57. data/lib/rgeo/geographic.rb +10 -15
  58. data/lib/rgeo/geographic/factory.rb +126 -147
  59. data/lib/rgeo/geographic/interface.rb +67 -81
  60. data/lib/rgeo/geographic/proj4_projector.rb +13 -37
  61. data/lib/rgeo/geographic/projected_feature_classes.rb +7 -66
  62. data/lib/rgeo/geographic/projected_feature_methods.rb +15 -80
  63. data/lib/rgeo/geographic/projected_window.rb +15 -67
  64. data/lib/rgeo/geographic/simple_mercator_projector.rb +32 -56
  65. data/lib/rgeo/geographic/spherical_feature_classes.rb +9 -68
  66. data/lib/rgeo/geographic/spherical_feature_methods.rb +18 -51
  67. data/lib/rgeo/geographic/spherical_math.rb +26 -51
  68. data/lib/rgeo/geos.rb +23 -20
  69. data/lib/rgeo/geos/capi_factory.rb +125 -131
  70. data/lib/rgeo/geos/capi_feature_classes.rb +21 -88
  71. data/lib/rgeo/geos/ffi_factory.rb +90 -143
  72. data/lib/rgeo/geos/ffi_feature_classes.rb +8 -63
  73. data/lib/rgeo/geos/ffi_feature_methods.rb +46 -162
  74. data/lib/rgeo/geos/geos_c_impl.bundle +0 -0
  75. data/lib/rgeo/geos/interface.rb +4 -23
  76. data/lib/rgeo/geos/utils.rb +4 -19
  77. data/lib/rgeo/geos/zm_factory.rb +82 -131
  78. data/lib/rgeo/geos/zm_feature_classes.rb +8 -63
  79. data/lib/rgeo/geos/zm_feature_methods.rb +34 -107
  80. data/lib/rgeo/impl_helper.rb +8 -13
  81. data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +27 -71
  82. data/lib/rgeo/impl_helper/basic_geometry_methods.rb +10 -28
  83. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +21 -57
  84. data/lib/rgeo/impl_helper/basic_point_methods.rb +12 -30
  85. data/lib/rgeo/impl_helper/basic_polygon_methods.rb +9 -28
  86. data/lib/rgeo/impl_helper/math.rb +4 -10
  87. data/lib/rgeo/impl_helper/utils.rb +2 -10
  88. data/lib/rgeo/version.rb +1 -1
  89. data/lib/rgeo/wkrep.rb +4 -9
  90. data/lib/rgeo/wkrep/wkb_generator.rb +22 -46
  91. data/lib/rgeo/wkrep/wkb_parser.rb +25 -52
  92. data/lib/rgeo/wkrep/wkt_generator.rb +39 -69
  93. data/lib/rgeo/wkrep/wkt_parser.rb +52 -89
  94. data/lib/rgeo/yaml.rb +1 -7
  95. data/test/common/factory_tests.rb +4 -19
  96. data/test/common/geometry_collection_tests.rb +6 -39
  97. data/test/common/line_string_tests.rb +10 -39
  98. data/test/common/multi_line_string_tests.rb +10 -30
  99. data/test/common/multi_point_tests.rb +15 -34
  100. data/test/common/multi_polygon_tests.rb +26 -28
  101. data/test/common/point_tests.rb +37 -59
  102. data/test/common/polygon_tests.rb +16 -25
  103. data/test/coord_sys/tc_ogc_cs.rb +151 -186
  104. data/test/coord_sys/tc_proj4.rb +35 -60
  105. data/test/coord_sys/tc_proj4_srs_data.rb +15 -24
  106. data/test/coord_sys/tc_sr_org.rb +11 -19
  107. data/test/coord_sys/tc_url_reader.rb +13 -23
  108. data/test/geos_capi/tc_factory.rb +7 -16
  109. data/test/geos_capi/tc_geometry_collection.rb +6 -14
  110. data/test/geos_capi/tc_line_string.rb +7 -15
  111. data/test/geos_capi/tc_misc.rb +26 -41
  112. data/test/geos_capi/tc_multi_line_string.rb +6 -14
  113. data/test/geos_capi/tc_multi_point.rb +7 -15
  114. data/test/geos_capi/tc_multi_polygon.rb +8 -18
  115. data/test/geos_capi/tc_parsing_unparsing.rb +11 -21
  116. data/test/geos_capi/tc_point.rb +12 -26
  117. data/test/geos_capi/tc_polygon.rb +52 -17
  118. data/test/geos_capi/tc_zmfactory.rb +7 -18
  119. data/test/geos_ffi/tc_factory.rb +7 -16
  120. data/test/geos_ffi/tc_geometry_collection.rb +7 -15
  121. data/test/geos_ffi/tc_line_string.rb +7 -15
  122. data/test/geos_ffi/tc_misc.rb +8 -18
  123. data/test/geos_ffi/tc_multi_line_string.rb +7 -15
  124. data/test/geos_ffi/tc_multi_point.rb +8 -16
  125. data/test/geos_ffi/tc_multi_polygon.rb +9 -18
  126. data/test/geos_ffi/tc_parsing_unparsing.rb +14 -24
  127. data/test/geos_ffi/tc_point.rb +13 -28
  128. data/test/geos_ffi/tc_polygon.rb +7 -17
  129. data/test/geos_ffi/tc_zmfactory.rb +8 -19
  130. data/test/projected_geographic/tc_factory.rb +7 -15
  131. data/test/projected_geographic/tc_geometry_collection.rb +7 -15
  132. data/test/projected_geographic/tc_line_string.rb +7 -15
  133. data/test/projected_geographic/tc_multi_line_string.rb +7 -16
  134. data/test/projected_geographic/tc_multi_point.rb +8 -17
  135. data/test/projected_geographic/tc_multi_polygon.rb +8 -16
  136. data/test/projected_geographic/tc_point.rb +11 -23
  137. data/test/projected_geographic/tc_polygon.rb +7 -15
  138. data/test/simple_cartesian/tc_calculations.rb +6 -22
  139. data/test/simple_cartesian/tc_factory.rb +7 -16
  140. data/test/simple_cartesian/tc_geometry_collection.rb +6 -15
  141. data/test/simple_cartesian/tc_line_string.rb +6 -15
  142. data/test/simple_cartesian/tc_multi_line_string.rb +6 -15
  143. data/test/simple_cartesian/tc_multi_point.rb +7 -16
  144. data/test/simple_cartesian/tc_multi_polygon.rb +7 -16
  145. data/test/simple_cartesian/tc_point.rb +10 -21
  146. data/test/simple_cartesian/tc_polygon.rb +6 -15
  147. data/test/simple_mercator/tc_factory.rb +6 -14
  148. data/test/simple_mercator/tc_geometry_collection.rb +6 -14
  149. data/test/simple_mercator/tc_line_string.rb +6 -14
  150. data/test/simple_mercator/tc_multi_line_string.rb +6 -15
  151. data/test/simple_mercator/tc_multi_point.rb +7 -16
  152. data/test/simple_mercator/tc_multi_polygon.rb +7 -15
  153. data/test/simple_mercator/tc_point.rb +11 -24
  154. data/test/simple_mercator/tc_polygon.rb +6 -14
  155. data/test/simple_mercator/tc_window.rb +10 -34
  156. data/test/spherical_geographic/tc_calculations.rb +5 -32
  157. data/test/spherical_geographic/tc_factory.rb +6 -15
  158. data/test/spherical_geographic/tc_geometry_collection.rb +6 -15
  159. data/test/spherical_geographic/tc_line_string.rb +6 -15
  160. data/test/spherical_geographic/tc_multi_line_string.rb +6 -15
  161. data/test/spherical_geographic/tc_multi_point.rb +7 -16
  162. data/test/spherical_geographic/tc_multi_polygon.rb +7 -16
  163. data/test/spherical_geographic/tc_point.rb +10 -22
  164. data/test/spherical_geographic/tc_polygon.rb +6 -15
  165. data/test/tc_cartesian_analysis.rb +4 -16
  166. data/test/tc_cartesian_bbox.rb +7 -21
  167. data/test/tc_mixins.rb +8 -25
  168. data/test/tc_oneoff.rb +5 -13
  169. data/test/tc_types.rb +7 -16
  170. data/test/wkrep/tc_wkb_generator.rb +63 -97
  171. data/test/wkrep/tc_wkb_parser.rb +63 -100
  172. data/test/wkrep/tc_wkt_generator.rb +54 -92
  173. data/test/wkrep/tc_wkt_parser.rb +84 -133
  174. metadata +39 -9
  175. data/lib/rgeo/coord_sys/srs_database/active_record_table.rb +0 -166
  176. data/test/coord_sys/tc_active_record_table.rb +0 -79
@@ -5,14 +5,10 @@
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
7
  module RGeo
8
-
9
8
  module Cartesian
10
-
11
-
12
9
  # Represents a line segment in the plane.
13
10
 
14
- class Segment # :nodoc:
15
-
11
+ class Segment # :nodoc:
16
12
  def initialize(start_, end_)
17
13
  @s = start_
18
14
  @e = end_
@@ -25,29 +21,24 @@ module RGeo
25
21
  @lensq = @dx * @dx + @dy * @dy
26
22
  end
27
23
 
28
-
29
24
  attr_reader :s
30
25
  attr_reader :e
31
26
  attr_reader :dx
32
27
  attr_reader :dy
33
28
 
34
-
35
29
  def to_s
36
30
  "#{@s} - #{@e}"
37
31
  end
38
32
 
39
-
40
33
  def eql?(rhs_)
41
- rhs_.kind_of?(Segment) && @s == rhs_.s && @e == rhs_.e
34
+ rhs_.is_a?(Segment) && @s == rhs_.s && @e == rhs_.e
42
35
  end
43
36
  alias_method :==, :eql?
44
37
 
45
-
46
38
  def degenerate?
47
39
  @lensq == 0
48
40
  end
49
41
 
50
-
51
42
  # Returns a negative value if the point is to the left,
52
43
  # a positive value if the point is to the right, or
53
44
  # 0 if the point is collinear to the segment.
@@ -58,7 +49,6 @@ module RGeo
58
49
  (@sx - px_) * (@ey - py_) - (@sy - py_) * (@ex - px_)
59
50
  end
60
51
 
61
-
62
52
  def tproj(p_)
63
53
  if @lensq == 0
64
54
  nil
@@ -67,7 +57,6 @@ module RGeo
67
57
  end
68
58
  end
69
59
 
70
-
71
60
  def contains_point?(p_)
72
61
  if side(p_) == 0
73
62
  t_ = tproj(p_)
@@ -77,7 +66,6 @@ module RGeo
77
66
  end
78
67
  end
79
68
 
80
-
81
69
  def intersects_segment?(seg_)
82
70
  s2_ = seg_.s
83
71
  # Handle degenerate cases
@@ -95,7 +83,7 @@ module RGeo
95
83
  sy2_ = s2_.y
96
84
  dx2_ = seg_.dx
97
85
  dy2_ = seg_.dy
98
- denom_ = @dx*dy2_ - @dy*dx2_
86
+ denom_ = @dx * dy2_ - @dy * dx2_
99
87
  if denom_ == 0
100
88
  # Segments are parallel. Make sure they are collinear.
101
89
  return false unless side(s2_) == 0
@@ -117,15 +105,9 @@ module RGeo
117
105
  end
118
106
  end
119
107
 
120
-
121
108
  def length
122
109
  ::Math.sqrt(@lensq)
123
110
  end
124
-
125
-
126
111
  end
127
-
128
-
129
112
  end
130
-
131
113
  end
@@ -5,28 +5,23 @@
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
7
  module RGeo
8
-
9
8
  module Cartesian
10
-
11
-
12
9
  # This class implements the factory for the simple cartesian
13
10
  # implementation.
14
11
 
15
12
  class Factory
16
-
17
13
  include Feature::Factory::Instance
18
14
 
19
-
20
15
  # Create a new simple cartesian factory.
21
16
  #
22
17
  # See ::RGeo::Cartesian.simple_factory for a list of supported options.
23
18
 
24
- def initialize(opts_={})
19
+ def initialize(opts_ = {})
25
20
  @has_z = opts_[:has_z_coordinate] ? true : false
26
21
  @has_m = opts_[:has_m_coordinate] ? true : false
27
22
  @proj4 = opts_[:proj4]
28
23
  if CoordSys::Proj4.supported?
29
- if @proj4.kind_of?(::String) || @proj4.kind_of?(::Hash)
24
+ if @proj4.is_a?(::String) || @proj4.is_a?(::Hash)
30
25
  @proj4 = CoordSys::Proj4.create(@proj4)
31
26
  end
32
27
  else
@@ -34,8 +29,12 @@ module RGeo
34
29
  end
35
30
  srid_ = opts_[:srid]
36
31
  @coord_sys = opts_[:coord_sys]
37
- if @coord_sys.kind_of?(::String)
38
- @coord_sys = CoordSys::CS.create_from_wkt(@coord_sys) rescue nil
32
+ if @coord_sys.is_a?(::String)
33
+ @coord_sys = begin
34
+ CoordSys::CS.create_from_wkt(@coord_sys)
35
+ rescue
36
+ nil
37
+ end
39
38
  end
40
39
  if (!@proj4 || !@coord_sys) && srid_ && (db_ = opts_[:srs_database])
41
40
  entry_ = db_.get(srid_.to_i)
@@ -55,7 +54,7 @@ module RGeo
55
54
  when ::Hash
56
55
  @wkt_generator = WKRep::WKTGenerator.new(wkt_generator_)
57
56
  else
58
- @wkt_generator = WKRep::WKTGenerator.new(:convert_case => :upper)
57
+ @wkt_generator = WKRep::WKTGenerator.new(convert_case: :upper)
59
58
  end
60
59
  wkb_generator_ = opts_[:wkb_generator]
61
60
  case wkb_generator_
@@ -80,7 +79,6 @@ module RGeo
80
79
  end
81
80
  end
82
81
 
83
-
84
82
  # Equivalence test.
85
83
 
86
84
  def eql?(rhs_)
@@ -91,117 +89,110 @@ module RGeo
91
89
  end
92
90
  alias_method :==, :eql?
93
91
 
94
-
95
92
  # Standard hash code
96
93
 
97
94
  def hash
98
95
  @hash ||= [@srid, @has_z, @has_m, @proj4].hash
99
96
  end
100
97
 
101
-
102
98
  # Marshal support
103
99
 
104
- def marshal_dump # :nodoc:
100
+ def marshal_dump # :nodoc:
105
101
  hash_ = {
106
- 'hasz' => @has_z,
107
- 'hasm' => @has_m,
108
- 'srid' => @srid,
109
- 'wktg' => @wkt_generator._properties,
110
- 'wkbg' => @wkb_generator._properties,
111
- 'wktp' => @wkt_parser._properties,
112
- 'wkbp' => @wkb_parser._properties,
113
- 'lena' => @lenient_assertions,
114
- 'bufr' => @buffer_resolution,
102
+ "hasz" => @has_z,
103
+ "hasm" => @has_m,
104
+ "srid" => @srid,
105
+ "wktg" => @wkt_generator._properties,
106
+ "wkbg" => @wkb_generator._properties,
107
+ "wktp" => @wkt_parser._properties,
108
+ "wkbp" => @wkb_parser._properties,
109
+ "lena" => @lenient_assertions,
110
+ "bufr" => @buffer_resolution
115
111
  }
116
- hash_['proj4'] = @proj4.marshal_dump if @proj4
117
- hash_['cs'] = @coord_sys.to_wkt if @coord_sys
112
+ hash_["proj4"] = @proj4.marshal_dump if @proj4
113
+ hash_["cs"] = @coord_sys.to_wkt if @coord_sys
118
114
  hash_
119
115
  end
120
116
 
121
- def marshal_load(data_) # :nodoc:
122
- if CoordSys::Proj4.supported? && (proj4_data_ = data_['proj4'])
117
+ def marshal_load(data_) # :nodoc:
118
+ if CoordSys::Proj4.supported? && (proj4_data_ = data_["proj4"])
123
119
  proj4_ = CoordSys::Proj4.allocate
124
120
  proj4_.marshal_load(proj4_data_)
125
121
  else
126
122
  proj4_ = nil
127
123
  end
128
- if (coord_sys_data_ = data_['cs'])
124
+ if (coord_sys_data_ = data_["cs"])
129
125
  coord_sys_ = CoordSys::CS.create_from_wkt(coord_sys_data_)
130
126
  else
131
127
  coord_sys_ = nil
132
128
  end
133
129
  initialize(
134
- :has_z_coordinate => data_['hasz'],
135
- :has_m_coordinate => data_['hasm'],
136
- :srid => data_['srid'],
137
- :wkt_generator => ImplHelper::Utils.symbolize_hash(data_['wktg']),
138
- :wkb_generator => ImplHelper::Utils.symbolize_hash(data_['wkbg']),
139
- :wkt_parser => ImplHelper::Utils.symbolize_hash(data_['wktp']),
140
- :wkb_parser => ImplHelper::Utils.symbolize_hash(data_['wkbp']),
141
- :uses_lenient_assertions => data_['lena'],
142
- :buffer_resolution => data_['bufr'],
143
- :proj4 => proj4_,
144
- :coord_sys => coord_sys_
130
+ has_z_coordinate: data_["hasz"],
131
+ has_m_coordinate: data_["hasm"],
132
+ srid: data_["srid"],
133
+ wkt_generator: ImplHelper::Utils.symbolize_hash(data_["wktg"]),
134
+ wkb_generator: ImplHelper::Utils.symbolize_hash(data_["wkbg"]),
135
+ wkt_parser: ImplHelper::Utils.symbolize_hash(data_["wktp"]),
136
+ wkb_parser: ImplHelper::Utils.symbolize_hash(data_["wkbp"]),
137
+ uses_lenient_assertions: data_["lena"],
138
+ buffer_resolution: data_["bufr"],
139
+ proj4: proj4_,
140
+ coord_sys: coord_sys_
145
141
  )
146
142
  end
147
143
 
148
-
149
144
  # Psych support
150
145
 
151
- def encode_with(coder_) # :nodoc:
152
- coder_['has_z_coordinate'] = @has_z
153
- coder_['has_m_coordinate'] = @has_m
154
- coder_['srid'] = @srid
155
- coder_['lenient_assertions'] = @lenient_assertions
156
- coder_['buffer_resolution'] = @buffer_resolution
157
- coder_['wkt_generator'] = @wkt_generator._properties
158
- coder_['wkb_generator'] = @wkb_generator._properties
159
- coder_['wkt_parser'] = @wkt_parser._properties
160
- coder_['wkb_parser'] = @wkb_parser._properties
146
+ def encode_with(coder_) # :nodoc:
147
+ coder_["has_z_coordinate"] = @has_z
148
+ coder_["has_m_coordinate"] = @has_m
149
+ coder_["srid"] = @srid
150
+ coder_["lenient_assertions"] = @lenient_assertions
151
+ coder_["buffer_resolution"] = @buffer_resolution
152
+ coder_["wkt_generator"] = @wkt_generator._properties
153
+ coder_["wkb_generator"] = @wkb_generator._properties
154
+ coder_["wkt_parser"] = @wkt_parser._properties
155
+ coder_["wkb_parser"] = @wkb_parser._properties
161
156
  if @proj4
162
157
  str_ = @proj4.original_str || @proj4.canonical_str
163
- coder_['proj4'] = @proj4.radians? ? {'proj4' => str_, 'radians' => true} : str_
158
+ coder_["proj4"] = @proj4.radians? ? { "proj4" => str_, "radians" => true } : str_
164
159
  end
165
- coder_['coord_sys'] = @coord_sys.to_wkt if @coord_sys
160
+ coder_["coord_sys"] = @coord_sys.to_wkt if @coord_sys
166
161
  end
167
162
 
168
- def init_with(coder_) # :nodoc:
169
- if (proj4_data_ = coder_['proj4'])
163
+ def init_with(coder_) # :nodoc:
164
+ if (proj4_data_ = coder_["proj4"])
170
165
  if proj4_data_.is_a?(::Hash)
171
- proj4_ = CoordSys::Proj4.create(proj4_data_['proj4'], :radians => proj4_data_['radians'])
166
+ proj4_ = CoordSys::Proj4.create(proj4_data_["proj4"], radians: proj4_data_["radians"])
172
167
  else
173
168
  proj4_ = CoordSys::Proj4.create(proj4_data_.to_s)
174
169
  end
175
170
  else
176
171
  proj4_ = nil
177
172
  end
178
- if (coord_sys_data_ = coder_['cs'])
173
+ if (coord_sys_data_ = coder_["cs"])
179
174
  coord_sys_ = CoordSys::CS.create_from_wkt(coord_sys_data_.to_s)
180
175
  else
181
176
  coord_sys_ = nil
182
177
  end
183
178
  initialize(
184
- :has_z_coordinate => coder_['has_z_coordinate'],
185
- :has_m_coordinate => coder_['has_m_coordinate'],
186
- :srid => coder_['srid'],
187
- :wkt_generator => ImplHelper::Utils.symbolize_hash(coder_['wkt_generator']),
188
- :wkb_generator => ImplHelper::Utils.symbolize_hash(coder_['wkb_generator']),
189
- :wkt_parser => ImplHelper::Utils.symbolize_hash(coder_['wkt_parser']),
190
- :wkb_parser => ImplHelper::Utils.symbolize_hash(coder_['wkb_parser']),
191
- :uses_lenient_assertions => coder_['lenient_assertions'],
192
- :buffer_resolution => coder_['buffer_resolution'],
193
- :proj4 => proj4_,
194
- :coord_sys => coord_sys_
179
+ has_z_coordinate: coder_["has_z_coordinate"],
180
+ has_m_coordinate: coder_["has_m_coordinate"],
181
+ srid: coder_["srid"],
182
+ wkt_generator: ImplHelper::Utils.symbolize_hash(coder_["wkt_generator"]),
183
+ wkb_generator: ImplHelper::Utils.symbolize_hash(coder_["wkb_generator"]),
184
+ wkt_parser: ImplHelper::Utils.symbolize_hash(coder_["wkt_parser"]),
185
+ wkb_parser: ImplHelper::Utils.symbolize_hash(coder_["wkb_parser"]),
186
+ uses_lenient_assertions: coder_["lenient_assertions"],
187
+ buffer_resolution: coder_["buffer_resolution"],
188
+ proj4: proj4_,
189
+ coord_sys: coord_sys_
195
190
  )
196
191
  end
197
192
 
198
-
199
193
  # Returns the SRID.
200
194
 
201
- def srid
202
- @srid
203
- end
204
-
195
+ attr_reader :srid
205
196
 
206
197
  # See ::RGeo::Feature::Factory#property
207
198
 
@@ -217,152 +208,140 @@ module RGeo
217
208
  @buffer_resolution
218
209
  when :is_cartesian
219
210
  true
220
- else
221
- nil
222
211
  end
223
212
  end
224
213
 
225
-
226
214
  # See ::RGeo::Feature::Factory#parse_wkt
227
215
 
228
216
  def parse_wkt(str_)
229
217
  @wkt_parser.parse(str_)
230
218
  end
231
219
 
232
-
233
220
  # See ::RGeo::Feature::Factory#parse_wkb
234
221
 
235
222
  def parse_wkb(str_)
236
223
  @wkb_parser.parse(str_)
237
224
  end
238
225
 
239
-
240
226
  # See ::RGeo::Feature::Factory#point
241
227
 
242
228
  def point(x_, y_, *extra_)
243
- PointImpl.new(self, x_, y_, *extra_) rescue nil
229
+ PointImpl.new(self, x_, y_, *extra_)
230
+ rescue
231
+ nil
244
232
  end
245
233
 
246
-
247
234
  # See ::RGeo::Feature::Factory#line_string
248
235
 
249
236
  def line_string(points_)
250
- LineStringImpl.new(self, points_) rescue nil
237
+ LineStringImpl.new(self, points_)
238
+ rescue
239
+ nil
251
240
  end
252
241
 
253
-
254
242
  # See ::RGeo::Feature::Factory#line
255
243
 
256
244
  def line(start_, end_)
257
- LineImpl.new(self, start_, end_) rescue nil
245
+ LineImpl.new(self, start_, end_)
246
+ rescue
247
+ nil
258
248
  end
259
249
 
260
-
261
250
  # See ::RGeo::Feature::Factory#linear_ring
262
251
 
263
252
  def linear_ring(points_)
264
- LinearRingImpl.new(self, points_) rescue nil
253
+ LinearRingImpl.new(self, points_)
254
+ rescue
255
+ nil
265
256
  end
266
257
 
267
-
268
258
  # See ::RGeo::Feature::Factory#polygon
269
259
 
270
- def polygon(outer_ring_, inner_rings_=nil)
271
- PolygonImpl.new(self, outer_ring_, inner_rings_) rescue nil
260
+ def polygon(outer_ring_, inner_rings_ = nil)
261
+ PolygonImpl.new(self, outer_ring_, inner_rings_)
262
+ rescue
263
+ nil
272
264
  end
273
265
 
274
-
275
266
  # See ::RGeo::Feature::Factory#collection
276
267
 
277
268
  def collection(elems_)
278
- GeometryCollectionImpl.new(self, elems_) rescue nil
269
+ GeometryCollectionImpl.new(self, elems_)
270
+ rescue
271
+ nil
279
272
  end
280
273
 
281
-
282
274
  # See ::RGeo::Feature::Factory#multi_point
283
275
 
284
276
  def multi_point(elems_)
285
- MultiPointImpl.new(self, elems_) rescue nil
277
+ MultiPointImpl.new(self, elems_)
278
+ rescue
279
+ nil
286
280
  end
287
281
 
288
-
289
282
  # See ::RGeo::Feature::Factory#multi_line_string
290
283
 
291
284
  def multi_line_string(elems_)
292
- MultiLineStringImpl.new(self, elems_) rescue nil
285
+ MultiLineStringImpl.new(self, elems_)
286
+ rescue
287
+ nil
293
288
  end
294
289
 
295
-
296
290
  # See ::RGeo::Feature::Factory#multi_polygon
297
291
 
298
292
  def multi_polygon(elems_)
299
- MultiPolygonImpl.new(self, elems_) rescue nil
293
+ MultiPolygonImpl.new(self, elems_)
294
+ rescue
295
+ nil
300
296
  end
301
297
 
302
-
303
298
  # See ::RGeo::Feature::Factory#proj4
304
299
 
305
- def proj4
306
- @proj4
307
- end
308
-
300
+ attr_reader :proj4
309
301
 
310
302
  # See ::RGeo::Feature::Factory#coord_sys
311
303
 
312
- def coord_sys
313
- @coord_sys
314
- end
315
-
304
+ attr_reader :coord_sys
316
305
 
317
306
  def _generate_wkt(obj_) # :nodoc:
318
307
  @wkt_generator.generate(obj_)
319
308
  end
320
309
 
321
-
322
310
  def _generate_wkb(obj_) # :nodoc:
323
311
  @wkb_generator.generate(obj_)
324
312
  end
325
313
 
326
-
327
- def _marshal_wkb_generator # :nodoc:
314
+ def _marshal_wkb_generator # :nodoc:
328
315
  unless defined?(@marshal_wkb_generator)
329
316
  @marshal_wkb_generator = ::RGeo::WKRep::WKBGenerator.new(
330
- :type_format => :wkb12)
317
+ type_format: :wkb12)
331
318
  end
332
319
  @marshal_wkb_generator
333
320
  end
334
321
 
335
-
336
- def _marshal_wkb_parser # :nodoc:
322
+ def _marshal_wkb_parser # :nodoc:
337
323
  unless defined?(@marshal_wkb_parser)
338
324
  @marshal_wkb_parser = ::RGeo::WKRep::WKBParser.new(self,
339
- :support_wkb12 => true)
325
+ support_wkb12: true)
340
326
  end
341
327
  @marshal_wkb_parser
342
328
  end
343
329
 
344
-
345
- def _psych_wkt_generator # :nodoc:
330
+ def _psych_wkt_generator # :nodoc:
346
331
  unless defined?(@psych_wkt_generator)
347
332
  @psych_wkt_generator = ::RGeo::WKRep::WKTGenerator.new(
348
- :tag_format => :wkt12)
333
+ tag_format: :wkt12)
349
334
  end
350
335
  @psych_wkt_generator
351
336
  end
352
337
 
353
-
354
- def _psych_wkt_parser # :nodoc:
338
+ def _psych_wkt_parser # :nodoc:
355
339
  unless defined?(@psych_wkt_parser)
356
340
  @psych_wkt_parser = ::RGeo::WKRep::WKTParser.new(self,
357
- :support_wkt12 => true, :support_ewkt => true)
341
+ support_wkt12: true, support_ewkt: true)
358
342
  end
359
343
  @psych_wkt_parser
360
344
  end
361
-
362
-
363
345
  end
364
-
365
-
366
346
  end
367
-
368
347
  end