rgeo 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. data/History.rdoc +6 -0
  2. data/README.rdoc +1 -1
  3. data/Version +1 -1
  4. data/ext/geos_c_impl/extconf.rb +13 -13
  5. data/ext/geos_c_impl/factory.c +30 -18
  6. data/ext/geos_c_impl/factory.h +18 -12
  7. data/ext/geos_c_impl/geometry.c +11 -11
  8. data/ext/geos_c_impl/geometry.h +7 -7
  9. data/ext/geos_c_impl/geometry_collection.c +15 -15
  10. data/ext/geos_c_impl/geometry_collection.h +8 -8
  11. data/ext/geos_c_impl/line_string.c +14 -14
  12. data/ext/geos_c_impl/line_string.h +7 -7
  13. data/ext/geos_c_impl/main.c +7 -7
  14. data/ext/geos_c_impl/point.c +9 -9
  15. data/ext/geos_c_impl/point.h +7 -7
  16. data/ext/geos_c_impl/polygon.c +9 -9
  17. data/ext/geos_c_impl/polygon.h +7 -7
  18. data/ext/geos_c_impl/preface.h +7 -7
  19. data/ext/proj4_c_impl/extconf.rb +13 -13
  20. data/ext/proj4_c_impl/main.c +12 -12
  21. data/lib/rgeo.rb +26 -26
  22. data/lib/rgeo/cartesian.rb +12 -12
  23. data/lib/rgeo/cartesian/analysis.rb +26 -26
  24. data/lib/rgeo/cartesian/bounding_box.rb +83 -83
  25. data/lib/rgeo/cartesian/calculations.rb +36 -36
  26. data/lib/rgeo/cartesian/factory.rb +78 -78
  27. data/lib/rgeo/cartesian/feature_classes.rb +74 -74
  28. data/lib/rgeo/cartesian/feature_methods.rb +34 -34
  29. data/lib/rgeo/cartesian/interface.rb +33 -33
  30. data/lib/rgeo/coord_sys.rb +15 -15
  31. data/lib/rgeo/coord_sys/cs/entities.rb +533 -534
  32. data/lib/rgeo/coord_sys/cs/factories.rb +69 -69
  33. data/lib/rgeo/coord_sys/cs/wkt_parser.rb +44 -44
  34. data/lib/rgeo/coord_sys/proj4.rb +85 -85
  35. data/lib/rgeo/coord_sys/srs_database/active_record_table.rb +31 -31
  36. data/lib/rgeo/coord_sys/srs_database/interface.rb +44 -44
  37. data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +31 -31
  38. data/lib/rgeo/coord_sys/srs_database/sr_org.rb +31 -31
  39. data/lib/rgeo/coord_sys/srs_database/url_reader.rb +29 -29
  40. data/lib/rgeo/error.rb +17 -17
  41. data/lib/rgeo/feature.rb +15 -15
  42. data/lib/rgeo/feature/curve.rb +58 -58
  43. data/lib/rgeo/feature/factory.rb +84 -84
  44. data/lib/rgeo/feature/factory_generator.rb +32 -32
  45. data/lib/rgeo/feature/geometry.rb +215 -215
  46. data/lib/rgeo/feature/geometry_collection.rb +46 -46
  47. data/lib/rgeo/feature/line.rb +21 -21
  48. data/lib/rgeo/feature/line_string.rb +35 -35
  49. data/lib/rgeo/feature/linear_ring.rb +20 -20
  50. data/lib/rgeo/feature/mixins.rb +61 -61
  51. data/lib/rgeo/feature/multi_curve.rb +37 -37
  52. data/lib/rgeo/feature/multi_line_string.rb +20 -20
  53. data/lib/rgeo/feature/multi_point.rb +22 -22
  54. data/lib/rgeo/feature/multi_polygon.rb +28 -28
  55. data/lib/rgeo/feature/multi_surface.rb +39 -39
  56. data/lib/rgeo/feature/point.rb +42 -42
  57. data/lib/rgeo/feature/polygon.rb +50 -50
  58. data/lib/rgeo/feature/surface.rb +42 -42
  59. data/lib/rgeo/feature/types.rb +58 -58
  60. data/lib/rgeo/geographic.rb +14 -14
  61. data/lib/rgeo/geographic/factory.rb +87 -87
  62. data/lib/rgeo/geographic/interface.rb +55 -55
  63. data/lib/rgeo/geographic/proj4_projector.rb +35 -35
  64. data/lib/rgeo/geographic/projected_feature_classes.rb +95 -95
  65. data/lib/rgeo/geographic/projected_feature_methods.rb +81 -81
  66. data/lib/rgeo/geographic/projected_window.rb +103 -103
  67. data/lib/rgeo/geographic/simple_mercator_projector.rb +32 -32
  68. data/lib/rgeo/geographic/spherical_feature_classes.rb +93 -93
  69. data/lib/rgeo/geographic/spherical_feature_methods.rb +25 -25
  70. data/lib/rgeo/geographic/spherical_math.rb +58 -58
  71. data/lib/rgeo/geos.rb +22 -17
  72. data/lib/rgeo/geos/factory.rb +93 -93
  73. data/lib/rgeo/geos/ffi_classes.rb +306 -231
  74. data/lib/rgeo/geos/ffi_factory.rb +100 -96
  75. data/lib/rgeo/geos/impl_additions.rb +22 -22
  76. data/lib/rgeo/geos/interface.rb +45 -45
  77. data/lib/rgeo/geos/zm_factory.rb +90 -90
  78. data/lib/rgeo/geos/zm_impl.rb +167 -167
  79. data/lib/rgeo/impl_helper.rb +11 -11
  80. data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +71 -71
  81. data/lib/rgeo/impl_helper/basic_geometry_methods.rb +29 -29
  82. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +61 -61
  83. data/lib/rgeo/impl_helper/basic_point_methods.rb +43 -43
  84. data/lib/rgeo/impl_helper/basic_polygon_methods.rb +35 -35
  85. data/lib/rgeo/impl_helper/math.rb +13 -13
  86. data/lib/rgeo/version.rb +10 -10
  87. data/lib/rgeo/wkrep.rb +16 -16
  88. data/lib/rgeo/wkrep/wkb_generator.rb +51 -51
  89. data/lib/rgeo/wkrep/wkb_parser.rb +52 -52
  90. data/lib/rgeo/wkrep/wkt_generator.rb +51 -51
  91. data/lib/rgeo/wkrep/wkt_parser.rb +66 -66
  92. data/lib/rgeo/yaml.rb +14 -14
  93. data/test/common/geometry_collection_tests.rb +53 -53
  94. data/test/common/line_string_tests.rb +57 -57
  95. data/test/common/multi_line_string_tests.rb +43 -43
  96. data/test/common/multi_point_tests.rb +43 -43
  97. data/test/common/multi_polygon_tests.rb +43 -43
  98. data/test/common/point_tests.rb +75 -75
  99. data/test/common/polygon_tests.rb +37 -37
  100. data/test/coord_sys/tc_active_record_table.rb +25 -25
  101. data/test/coord_sys/tc_ogc_cs.rb +72 -72
  102. data/test/coord_sys/tc_proj4.rb +51 -51
  103. data/test/coord_sys/tc_proj4_srs_data.rb +17 -17
  104. data/test/coord_sys/tc_sr_org.rb +15 -15
  105. data/test/coord_sys/tc_url_reader.rb +19 -19
  106. data/test/geos_capi/tc_factory.rb +21 -21
  107. data/test/geos_capi/tc_geometry_collection.rb +15 -15
  108. data/test/geos_capi/tc_line_string.rb +15 -15
  109. data/test/geos_capi/tc_misc.rb +33 -22
  110. data/test/geos_capi/tc_multi_line_string.rb +15 -15
  111. data/test/geos_capi/tc_multi_point.rb +15 -15
  112. data/test/geos_capi/tc_multi_polygon.rb +15 -15
  113. data/test/geos_capi/tc_parsing_unparsing.rb +19 -19
  114. data/test/geos_capi/tc_point.rb +21 -21
  115. data/test/geos_capi/tc_polygon.rb +19 -19
  116. data/test/geos_capi/tc_zmfactory.rb +17 -17
  117. data/test/geos_ffi/tc_factory.rb +21 -21
  118. data/test/geos_ffi/tc_geometry_collection.rb +15 -15
  119. data/test/geos_ffi/tc_line_string.rb +15 -15
  120. data/test/geos_ffi/tc_misc.rb +49 -15
  121. data/test/geos_ffi/tc_multi_line_string.rb +15 -15
  122. data/test/geos_ffi/tc_multi_point.rb +15 -15
  123. data/test/geos_ffi/tc_multi_polygon.rb +15 -15
  124. data/test/geos_ffi/tc_parsing_unparsing.rb +19 -19
  125. data/test/geos_ffi/tc_point.rb +21 -21
  126. data/test/geos_ffi/tc_polygon.rb +19 -19
  127. data/test/geos_ffi/tc_zmfactory.rb +17 -17
  128. data/test/projected_geographic/tc_geometry_collection.rb +15 -15
  129. data/test/projected_geographic/tc_line_string.rb +15 -15
  130. data/test/projected_geographic/tc_multi_line_string.rb +15 -15
  131. data/test/projected_geographic/tc_multi_point.rb +15 -15
  132. data/test/projected_geographic/tc_multi_polygon.rb +15 -15
  133. data/test/projected_geographic/tc_point.rb +23 -23
  134. data/test/projected_geographic/tc_polygon.rb +15 -15
  135. data/test/simple_cartesian/tc_calculations.rb +31 -31
  136. data/test/simple_cartesian/tc_geometry_collection.rb +17 -17
  137. data/test/simple_cartesian/tc_line_string.rb +17 -17
  138. data/test/simple_cartesian/tc_multi_line_string.rb +17 -17
  139. data/test/simple_cartesian/tc_multi_point.rb +17 -17
  140. data/test/simple_cartesian/tc_multi_polygon.rb +17 -17
  141. data/test/simple_cartesian/tc_point.rb +21 -21
  142. data/test/simple_cartesian/tc_polygon.rb +17 -17
  143. data/test/simple_mercator/tc_geometry_collection.rb +15 -15
  144. data/test/simple_mercator/tc_line_string.rb +15 -15
  145. data/test/simple_mercator/tc_multi_line_string.rb +15 -15
  146. data/test/simple_mercator/tc_multi_point.rb +15 -15
  147. data/test/simple_mercator/tc_multi_polygon.rb +15 -15
  148. data/test/simple_mercator/tc_point.rb +23 -23
  149. data/test/simple_mercator/tc_polygon.rb +15 -15
  150. data/test/simple_mercator/tc_window.rb +50 -50
  151. data/test/spherical_geographic/tc_calculations.rb +47 -47
  152. data/test/spherical_geographic/tc_geometry_collection.rb +17 -17
  153. data/test/spherical_geographic/tc_line_string.rb +17 -17
  154. data/test/spherical_geographic/tc_multi_line_string.rb +17 -17
  155. data/test/spherical_geographic/tc_multi_point.rb +17 -17
  156. data/test/spherical_geographic/tc_multi_polygon.rb +17 -17
  157. data/test/spherical_geographic/tc_point.rb +23 -23
  158. data/test/spherical_geographic/tc_polygon.rb +17 -17
  159. data/test/tc_cartesian_analysis.rb +23 -23
  160. data/test/tc_mixins.rb +39 -39
  161. data/test/tc_oneoff.rb +15 -15
  162. data/test/tc_types.rb +17 -17
  163. data/test/wkrep/tc_wkb_generator.rb +67 -67
  164. data/test/wkrep/tc_wkb_parser.rb +73 -73
  165. data/test/wkrep/tc_wkt_generator.rb +75 -75
  166. data/test/wkrep/tc_wkt_parser.rb +97 -97
  167. metadata +3 -3
@@ -1,15 +1,15 @@
1
1
  # -----------------------------------------------------------------------------
2
- #
2
+ #
3
3
  # Tests for WKT parser
4
- #
4
+ #
5
5
  # -----------------------------------------------------------------------------
6
- # Copyright 2010 Daniel Azuma
7
- #
6
+ # Copyright 2010-2012 Daniel Azuma
7
+ #
8
8
  # All rights reserved.
9
- #
9
+ #
10
10
  # Redistribution and use in source and binary forms, with or without
11
11
  # modification, are permitted provided that the following conditions are met:
12
- #
12
+ #
13
13
  # * Redistributions of source code must retain the above copyright notice,
14
14
  # this list of conditions and the following disclaimer.
15
15
  # * Redistributions in binary form must reproduce the above copyright notice,
@@ -18,7 +18,7 @@
18
18
  # * Neither the name of the copyright holder, nor the names of any other
19
19
  # contributors to this software, may be used to endorse or promote products
20
20
  # derived from this software without specific prior written permission.
21
- #
21
+ #
22
22
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
23
  # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
24
  # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -41,10 +41,10 @@ require 'rgeo'
41
41
  module RGeo
42
42
  module Tests # :nodoc:
43
43
  module WKRep # :nodoc:
44
-
44
+
45
45
  class TestWKTParser < ::Test::Unit::TestCase # :nodoc:
46
-
47
-
46
+
47
+
48
48
  def test_point_2d
49
49
  parser_ = ::RGeo::WKRep::WKTParser.new
50
50
  obj_ = parser_.parse('POINT(1 2)')
@@ -52,8 +52,8 @@ module RGeo
52
52
  assert_equal(1, obj_.x)
53
53
  assert_equal(2, obj_.y)
54
54
  end
55
-
56
-
55
+
56
+
57
57
  def test_values_fractional
58
58
  parser_ = ::RGeo::WKRep::WKTParser.new
59
59
  obj_ = parser_.parse('POINT(1.000 2.5)')
@@ -61,8 +61,8 @@ module RGeo
61
61
  assert_equal(1.0, obj_.x)
62
62
  assert_equal(2.5, obj_.y)
63
63
  end
64
-
65
-
64
+
65
+
66
66
  def test_values_fractional2
67
67
  parser_ = ::RGeo::WKRep::WKTParser.new
68
68
  obj_ = parser_.parse('POINT(1. .5)')
@@ -70,8 +70,8 @@ module RGeo
70
70
  assert_equal(1.0, obj_.x)
71
71
  assert_equal(0.5, obj_.y)
72
72
  end
73
-
74
-
73
+
74
+
75
75
  def test_values_negative
76
76
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
77
77
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -81,8 +81,8 @@ module RGeo
81
81
  assert_equal(-0.5, obj_.y)
82
82
  assert_equal(-5.5, obj_.z)
83
83
  end
84
-
85
-
84
+
85
+
86
86
  def test_point_square_brackets
87
87
  parser_ = ::RGeo::WKRep::WKTParser.new
88
88
  obj_ = parser_.parse('POINT[1 2]')
@@ -90,16 +90,16 @@ module RGeo
90
90
  assert_equal(1, obj_.x)
91
91
  assert_equal(2, obj_.y)
92
92
  end
93
-
94
-
93
+
94
+
95
95
  def test_point_empty
96
96
  parser_ = ::RGeo::WKRep::WKTParser.new
97
97
  obj_ = parser_.parse('POINT EMPTY')
98
98
  assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
99
99
  assert_equal(0, obj_.num_geometries)
100
100
  end
101
-
102
-
101
+
102
+
103
103
  def test_point_with_z
104
104
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
105
105
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -108,8 +108,8 @@ module RGeo
108
108
  assert_equal(3, obj_.z)
109
109
  assert_nil(obj_.m)
110
110
  end
111
-
112
-
111
+
112
+
113
113
  def test_point_with_m
114
114
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_m_coordinate => true)
115
115
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -118,8 +118,8 @@ module RGeo
118
118
  assert_equal(3, obj_.m)
119
119
  assert_nil(obj_.z)
120
120
  end
121
-
122
-
121
+
122
+
123
123
  def test_point_with_too_many_coords
124
124
  factory_ = ::RGeo::Cartesian.preferred_factory
125
125
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -127,8 +127,8 @@ module RGeo
127
127
  obj_ = parser_.parse('POINT(1 2 3)')
128
128
  end
129
129
  end
130
-
131
-
130
+
131
+
132
132
  def test_point_wkt12_z
133
133
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
134
134
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
@@ -137,8 +137,8 @@ module RGeo
137
137
  assert_equal(3, obj_.z)
138
138
  assert_nil(obj_.m)
139
139
  end
140
-
141
-
140
+
141
+
142
142
  def test_point_wkt12_z_unsupported_factory
143
143
  factory_ = ::RGeo::Cartesian.preferred_factory
144
144
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
@@ -146,8 +146,8 @@ module RGeo
146
146
  obj_ = parser_.parse('POINT Z(1 2 3)')
147
147
  end
148
148
  end
149
-
150
-
149
+
150
+
151
151
  def test_point_wkt12_m
152
152
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_m_coordinate => true)
153
153
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
@@ -156,8 +156,8 @@ module RGeo
156
156
  assert_equal(3, obj_.m)
157
157
  assert_nil(obj_.z)
158
158
  end
159
-
160
-
159
+
160
+
161
161
  def test_point_wkt12_m_with_factory_zm
162
162
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :has_m_coordinate => true)
163
163
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
@@ -166,8 +166,8 @@ module RGeo
166
166
  assert_equal(3, obj_.m)
167
167
  assert_equal(0, obj_.z)
168
168
  end
169
-
170
-
169
+
170
+
171
171
  def test_point_wkt12_m_too_many_coords
172
172
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_m_coordinate => true)
173
173
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
@@ -175,8 +175,8 @@ module RGeo
175
175
  obj_ = parser_.parse('POINT M(1 2 3 4)')
176
176
  end
177
177
  end
178
-
179
-
178
+
179
+
180
180
  def test_point_wkt12_zm
181
181
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :has_m_coordinate => true)
182
182
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
@@ -185,8 +185,8 @@ module RGeo
185
185
  assert_equal(3, obj_.z)
186
186
  assert_equal(4, obj_.m)
187
187
  end
188
-
189
-
188
+
189
+
190
190
  def test_point_wkt12_zm_not_enough_coords
191
191
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :has_m_coordinate => true)
192
192
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
@@ -194,8 +194,8 @@ module RGeo
194
194
  obj_ = parser_.parse('POINT ZM(1 2 3)')
195
195
  end
196
196
  end
197
-
198
-
197
+
198
+
199
199
  def test_point_ewkt_z
200
200
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
201
201
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_ewkt => true)
@@ -204,8 +204,8 @@ module RGeo
204
204
  assert_equal(3, obj_.z)
205
205
  assert_nil(obj_.m)
206
206
  end
207
-
208
-
207
+
208
+
209
209
  def test_point_ewkt_m
210
210
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_m_coordinate => true)
211
211
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_ewkt => true)
@@ -214,8 +214,8 @@ module RGeo
214
214
  assert_equal(3, obj_.m)
215
215
  assert_nil(obj_.z)
216
216
  end
217
-
218
-
217
+
218
+
219
219
  def test_point_ewkt_with_srid
220
220
  parser_ = ::RGeo::WKRep::WKTParser.new(::RGeo::Cartesian.method(:preferred_factory), :support_ewkt => true)
221
221
  obj_ = parser_.parse('SRID=1000;POINTM(1 2 3)')
@@ -224,8 +224,8 @@ module RGeo
224
224
  assert_nil(obj_.z)
225
225
  assert_equal(1000, obj_.srid)
226
226
  end
227
-
228
-
227
+
228
+
229
229
  def test_point_ewkt_m_too_many_coords
230
230
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_m_coordinate => true)
231
231
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_ewkt => true)
@@ -233,8 +233,8 @@ module RGeo
233
233
  obj_ = parser_.parse('POINTM(1 2 3 4)')
234
234
  end
235
235
  end
236
-
237
-
236
+
237
+
238
238
  def test_point_strict_wkt11_with_z
239
239
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
240
240
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :strict_wkt11 => true)
@@ -242,16 +242,16 @@ module RGeo
242
242
  obj_ = parser_.parse('POINT(1 2 3)')
243
243
  end
244
244
  end
245
-
246
-
245
+
246
+
247
247
  def test_point_non_ewkt_with_srid
248
248
  parser_ = ::RGeo::WKRep::WKTParser.new(::RGeo::Cartesian.method(:preferred_factory))
249
249
  assert_raise(::RGeo::Error::ParseError) do
250
250
  obj_ = parser_.parse('SRID=1000;POINT(1 2)')
251
251
  end
252
252
  end
253
-
254
-
253
+
254
+
255
255
  def test_linestring_basic
256
256
  factory_ = ::RGeo::Cartesian.preferred_factory
257
257
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -261,8 +261,8 @@ module RGeo
261
261
  assert_equal(1, obj_.point_n(0).x)
262
262
  assert_equal(6, obj_.point_n(2).y)
263
263
  end
264
-
265
-
264
+
265
+
266
266
  def test_linestring_with_z
267
267
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
268
268
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -272,8 +272,8 @@ module RGeo
272
272
  assert_equal(1, obj_.point_n(0).x)
273
273
  assert_equal(9, obj_.point_n(2).z)
274
274
  end
275
-
276
-
275
+
276
+
277
277
  def test_linestring_with_inconsistent_coords
278
278
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
279
279
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -281,8 +281,8 @@ module RGeo
281
281
  obj_ = parser_.parse('LINESTRING(1 2 3, 4 5,7 8 9)')
282
282
  end
283
283
  end
284
-
285
-
284
+
285
+
286
286
  def test_linestring_wkt12_m
287
287
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :has_m_coordinate => true)
288
288
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
@@ -294,8 +294,8 @@ module RGeo
294
294
  assert_equal(0, obj_.point_n(1).z)
295
295
  assert_equal(7, obj_.point_n(1).m)
296
296
  end
297
-
298
-
297
+
298
+
299
299
  def test_linestring_ewkt_with_srid
300
300
  parser_ = ::RGeo::WKRep::WKTParser.new(::RGeo::Cartesian.method(:preferred_factory), :support_ewkt => true)
301
301
  obj_ = parser_.parse('SRID=1000;LINESTRINGM(1 2 3, 4 5 6)')
@@ -304,8 +304,8 @@ module RGeo
304
304
  assert_nil(obj_.point_n(0).z)
305
305
  assert_equal(1000, obj_.srid)
306
306
  end
307
-
308
-
307
+
308
+
309
309
  def test_linestring_empty
310
310
  factory_ = ::RGeo::Cartesian.preferred_factory
311
311
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -313,8 +313,8 @@ module RGeo
313
313
  assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
314
314
  assert_equal(0, obj_.num_points)
315
315
  end
316
-
317
-
316
+
317
+
318
318
  def test_polygon_basic
319
319
  factory_ = ::RGeo::Cartesian.preferred_factory
320
320
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -324,8 +324,8 @@ module RGeo
324
324
  assert_equal(1, obj_.exterior_ring.point_n(0).x)
325
325
  assert_equal(7, obj_.exterior_ring.point_n(2).y)
326
326
  end
327
-
328
-
327
+
328
+
329
329
  def test_polygon_with_holes_and_z
330
330
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
331
331
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -338,8 +338,8 @@ module RGeo
338
338
  assert_equal(-6, obj_.interior_ring_n(0).point_n(0).z)
339
339
  assert_equal(-7, obj_.interior_ring_n(0).point_n(1).z)
340
340
  end
341
-
342
-
341
+
342
+
343
343
  def test_polygon_empty
344
344
  factory_ = ::RGeo::Cartesian.preferred_factory
345
345
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -347,8 +347,8 @@ module RGeo
347
347
  assert_equal(::RGeo::Feature::Polygon, obj_.geometry_type)
348
348
  assert_equal(0, obj_.exterior_ring.num_points)
349
349
  end
350
-
351
-
350
+
351
+
352
352
  def test_multipoint_basic
353
353
  factory_ = ::RGeo::Cartesian.preferred_factory
354
354
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -358,8 +358,8 @@ module RGeo
358
358
  assert_equal(1, obj_[0].x)
359
359
  assert_equal(3, obj_[1].y)
360
360
  end
361
-
362
-
361
+
362
+
363
363
  def test_multipoint_without_parens
364
364
  # This syntax isn't strictly allowed by the spec, but apparently
365
365
  # it does get used occasionally, so we do support parsing it.
@@ -371,8 +371,8 @@ module RGeo
371
371
  assert_equal(1, obj_[0].x)
372
372
  assert_equal(3, obj_[1].y)
373
373
  end
374
-
375
-
374
+
375
+
376
376
  def test_multipoint_empty
377
377
  factory_ = ::RGeo::Cartesian.preferred_factory
378
378
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -380,8 +380,8 @@ module RGeo
380
380
  assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
381
381
  assert_equal(0, obj_.num_geometries)
382
382
  end
383
-
384
-
383
+
384
+
385
385
  def test_multilinestring_basic
386
386
  factory_ = ::RGeo::Cartesian.preferred_factory
387
387
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -391,8 +391,8 @@ module RGeo
391
391
  assert_equal(1, obj_[0].point_n(0).x)
392
392
  assert_equal(-5, obj_[1].point_n(2).y)
393
393
  end
394
-
395
-
394
+
395
+
396
396
  def test_multilinestring_empty
397
397
  factory_ = ::RGeo::Cartesian.preferred_factory
398
398
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -400,8 +400,8 @@ module RGeo
400
400
  assert_equal(::RGeo::Feature::MultiLineString, obj_.geometry_type)
401
401
  assert_equal(0, obj_.num_geometries)
402
402
  end
403
-
404
-
403
+
404
+
405
405
  def test_multipolygon_basic
406
406
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
407
407
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -418,8 +418,8 @@ module RGeo
418
418
  assert_equal(-6, obj_[1].interior_ring_n(0).point_n(0).z)
419
419
  assert_equal(-7, obj_[1].interior_ring_n(0).point_n(1).z)
420
420
  end
421
-
422
-
421
+
422
+
423
423
  def test_multipolygon_empty
424
424
  factory_ = ::RGeo::Cartesian.preferred_factory
425
425
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -427,8 +427,8 @@ module RGeo
427
427
  assert_equal(::RGeo::Feature::MultiPolygon, obj_.geometry_type)
428
428
  assert_equal(0, obj_.num_geometries)
429
429
  end
430
-
431
-
430
+
431
+
432
432
  def test_collection_basic
433
433
  factory_ = ::RGeo::Cartesian.preferred_factory
434
434
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -441,8 +441,8 @@ module RGeo
441
441
  assert_equal(1, obj_[1].point_n(0).x)
442
442
  assert_equal(6, obj_[1].point_n(2).y)
443
443
  end
444
-
445
-
444
+
445
+
446
446
  def test_collection_z
447
447
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
448
448
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -455,8 +455,8 @@ module RGeo
455
455
  assert_equal(1, obj_[1].point_n(0).x)
456
456
  assert_equal(6, obj_[1].point_n(2).y)
457
457
  end
458
-
459
-
458
+
459
+
460
460
  def test_collection_dimension_mismatch
461
461
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
462
462
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -464,8 +464,8 @@ module RGeo
464
464
  obj_ = parser_.parse('GEOMETRYCOLLECTION(POINT(-1 -2),LINESTRING(1 2 0, 3 4 0, 5 6 0))')
465
465
  end
466
466
  end
467
-
468
-
467
+
468
+
469
469
  def test_collection_wkt12_type_mismatch
470
470
  factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :has_m_coordinate => true)
471
471
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
@@ -473,8 +473,8 @@ module RGeo
473
473
  obj_ = parser_.parse('GEOMETRYCOLLECTION Z(POINT Z(-1 -2 0),LINESTRING M(1 2 0, 3 4 0, 5 6 0))')
474
474
  end
475
475
  end
476
-
477
-
476
+
477
+
478
478
  def test_collection_empty
479
479
  factory_ = ::RGeo::Cartesian.preferred_factory
480
480
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
@@ -482,10 +482,10 @@ module RGeo
482
482
  assert_equal(::RGeo::Feature::GeometryCollection, obj_.geometry_type)
483
483
  assert_equal(0, obj_.num_geometries)
484
484
  end
485
-
486
-
485
+
486
+
487
487
  end
488
-
488
+
489
489
  end
490
490
  end
491
491
  end