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
  # Common tests for point implementations
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
@@ -40,34 +40,34 @@ require 'rgeo'
40
40
  module RGeo
41
41
  module Tests # :nodoc:
42
42
  module Common # :nodoc:
43
-
43
+
44
44
  module PointTests # :nodoc:
45
-
46
-
45
+
46
+
47
47
  def assert_close_enough(p1_, p2_)
48
48
  assert((p1_.x - p2_.x).abs < 0.00000001 && (p1_.y - p2_.y).abs < 0.00000001)
49
49
  end
50
-
51
-
50
+
51
+
52
52
  def assert_contains_approx(p_, mp_)
53
53
  assert(mp_.any?{ |q_| (p_.x - q_.x).abs < 0.00000001 && (p_.y - q_.y).abs < 0.00000001 })
54
54
  end
55
-
56
-
55
+
56
+
57
57
  def test_creation
58
58
  point_ = @factory.point(21, -22)
59
59
  assert_equal(21, point_.x)
60
60
  assert_equal(-22, point_.y)
61
61
  end
62
-
63
-
62
+
63
+
64
64
  def test_wkt_creation
65
65
  point1_ = @factory.parse_wkt('Point (21 -22)')
66
66
  assert_equal(21, point1_.x)
67
67
  assert_equal(-22, point1_.y)
68
68
  end
69
-
70
-
69
+
70
+
71
71
  def test_clone
72
72
  point1_ = @factory.point(11, 12)
73
73
  point2_ = point1_.clone
@@ -77,8 +77,8 @@ module RGeo
77
77
  assert_equal(point3_, point4_)
78
78
  assert_not_equal(point2_, point4_)
79
79
  end
80
-
81
-
80
+
81
+
82
82
  def test_type_check
83
83
  point_ = @factory.point(21, 22)
84
84
  assert(::RGeo::Feature::Geometry.check_type(point_))
@@ -86,67 +86,67 @@ module RGeo
86
86
  assert(!::RGeo::Feature::GeometryCollection.check_type(point_))
87
87
  assert(!::RGeo::Feature::Curve.check_type(point_))
88
88
  end
89
-
90
-
89
+
90
+
91
91
  def test_geometry_type
92
92
  point_ = @factory.point(11, 12)
93
93
  assert_equal(::RGeo::Feature::Point, point_.geometry_type)
94
94
  end
95
-
96
-
95
+
96
+
97
97
  def test_dimension
98
98
  point_ = @factory.point(11, 12)
99
99
  assert_equal(0, point_.dimension)
100
100
  end
101
-
102
-
101
+
102
+
103
103
  def test_envelope
104
104
  point_ = @factory.point(11, 12)
105
105
  assert_close_enough(point_, point_.envelope)
106
106
  end
107
-
108
-
107
+
108
+
109
109
  def test_as_text
110
110
  point_ = @factory.point(11, 12)
111
111
  assert_equal('POINT (11.0 12.0)', point_.as_text)
112
112
  end
113
-
114
-
113
+
114
+
115
115
  def test_as_text_wkt_round_trip
116
116
  point1_ = @factory.point(11, 12)
117
117
  text_ = point1_.as_text
118
118
  point2_ = @factory.parse_wkt(text_)
119
119
  assert_equal(point2_, point1_)
120
120
  end
121
-
122
-
121
+
122
+
123
123
  def test_as_binary_wkb_round_trip
124
124
  point1_ = @factory.point(211, 12)
125
125
  binary_ = point1_.as_binary
126
126
  point2_ = @factory.parse_wkb(binary_)
127
127
  assert_equal(point2_, point1_)
128
128
  end
129
-
130
-
129
+
130
+
131
131
  def test_is_empty
132
132
  point1_ = @factory.point(0, 0)
133
133
  assert(!point1_.is_empty?)
134
134
  end
135
-
136
-
135
+
136
+
137
137
  def test_is_simple
138
138
  point1_ = @factory.point(0, 0)
139
139
  assert(point1_.is_simple?)
140
140
  end
141
-
142
-
141
+
142
+
143
143
  def test_boundary
144
144
  point_ = @factory.point(11, 12)
145
145
  boundary_ = point_.boundary
146
146
  assert(boundary_.is_empty?)
147
147
  end
148
-
149
-
148
+
149
+
150
150
  def test_equals
151
151
  point1_ = @factory.point(11, 12)
152
152
  point2_ = @factory.point(11, 12)
@@ -160,8 +160,8 @@ module RGeo
160
160
  assert(point1_ != 'hello')
161
161
  assert(!point1_.eql?('hello'))
162
162
  end
163
-
164
-
163
+
164
+
165
165
  def test_disjoint
166
166
  point1_ = @factory.point(11, 12)
167
167
  point2_ = @factory.point(11, 12)
@@ -169,8 +169,8 @@ module RGeo
169
169
  assert(!point1_.disjoint?(point2_))
170
170
  assert(point1_.disjoint?(point3_))
171
171
  end
172
-
173
-
172
+
173
+
174
174
  def test_intersects
175
175
  point1_ = @factory.point(11, 12)
176
176
  point2_ = @factory.point(11, 12)
@@ -178,8 +178,8 @@ module RGeo
178
178
  assert(point1_.intersects?(point2_))
179
179
  assert(!point1_.intersects?(point3_))
180
180
  end
181
-
182
-
181
+
182
+
183
183
  def test_touches
184
184
  point1_ = @factory.point(11, 12)
185
185
  point2_ = @factory.point(11, 12)
@@ -187,8 +187,8 @@ module RGeo
187
187
  assert(!point1_.touches?(point2_))
188
188
  assert(!point1_.touches?(point3_))
189
189
  end
190
-
191
-
190
+
191
+
192
192
  def test_crosses
193
193
  point1_ = @factory.point(11, 12)
194
194
  point2_ = @factory.point(11, 12)
@@ -196,8 +196,8 @@ module RGeo
196
196
  assert(!point1_.crosses?(point2_))
197
197
  assert(!point1_.crosses?(point3_))
198
198
  end
199
-
200
-
199
+
200
+
201
201
  def test_within
202
202
  point1_ = @factory.point(11, 12)
203
203
  point2_ = @factory.point(11, 12)
@@ -205,8 +205,8 @@ module RGeo
205
205
  assert(point1_.within?(point2_))
206
206
  assert(!point1_.within?(point3_))
207
207
  end
208
-
209
-
208
+
209
+
210
210
  def test_contains
211
211
  point1_ = @factory.point(11, 12)
212
212
  point2_ = @factory.point(11, 12)
@@ -214,8 +214,8 @@ module RGeo
214
214
  assert(point1_.contains?(point2_))
215
215
  assert(!point1_.contains?(point3_))
216
216
  end
217
-
218
-
217
+
218
+
219
219
  def test_overlaps
220
220
  point1_ = @factory.point(11, 12)
221
221
  point2_ = @factory.point(11, 12)
@@ -223,14 +223,14 @@ module RGeo
223
223
  assert(!point1_.overlaps?(point2_))
224
224
  assert(!point1_.overlaps?(point3_))
225
225
  end
226
-
227
-
226
+
227
+
228
228
  def test_convex_hull
229
229
  point_ = @factory.point(11, 12)
230
230
  assert_close_enough(point_, point_.convex_hull)
231
231
  end
232
-
233
-
232
+
233
+
234
234
  def test_intersection
235
235
  point1_ = @factory.point(11, 12)
236
236
  point2_ = @factory.point(11, 12)
@@ -239,8 +239,8 @@ module RGeo
239
239
  int13_ = point1_.intersection(point3_)
240
240
  assert(int13_.is_empty?)
241
241
  end
242
-
243
-
242
+
243
+
244
244
  def test_union
245
245
  point1_ = @factory.point(11, 12)
246
246
  point2_ = @factory.point(11, 12)
@@ -252,8 +252,8 @@ module RGeo
252
252
  assert_contains_approx(point1_, union13_)
253
253
  assert_contains_approx(point3_, union13_)
254
254
  end
255
-
256
-
255
+
256
+
257
257
  def test_difference
258
258
  point1_ = @factory.point(11, 12)
259
259
  point2_ = @factory.point(11, 12)
@@ -264,8 +264,8 @@ module RGeo
264
264
  assert(diff12_.is_empty?)
265
265
  assert_close_enough(point1_, diff13_)
266
266
  end
267
-
268
-
267
+
268
+
269
269
  def test_sym_difference
270
270
  point1_ = @factory.point(11, 12)
271
271
  point2_ = @factory.point(11, 12)
@@ -278,8 +278,8 @@ module RGeo
278
278
  assert_contains_approx(point1_, diff13_)
279
279
  assert_contains_approx(point3_, diff13_)
280
280
  end
281
-
282
-
281
+
282
+
283
283
  def test_3dz_creation
284
284
  point_ = @zfactory.point(11, 12, 13)
285
285
  assert_equal(11, point_.x)
@@ -290,8 +290,8 @@ module RGeo
290
290
  assert_equal(22, point2_.y)
291
291
  assert_equal(0, point2_.z)
292
292
  end
293
-
294
-
293
+
294
+
295
295
  def test_3dm_creation
296
296
  point_ = @mfactory.point(11, 12, 13)
297
297
  assert_equal(11, point_.x)
@@ -302,8 +302,8 @@ module RGeo
302
302
  assert_equal(22, point2_.y)
303
303
  assert_equal(0, point2_.m)
304
304
  end
305
-
306
-
305
+
306
+
307
307
  def test_4d_creation
308
308
  point_ = @zmfactory.point(11, 12, 13, 14)
309
309
  assert_equal(11, point_.x)
@@ -316,8 +316,8 @@ module RGeo
316
316
  assert_equal(0, point2_.z)
317
317
  assert_equal(0, point2_.m)
318
318
  end
319
-
320
-
319
+
320
+
321
321
  def test_wkt_creation_3d
322
322
  point2_ = @zfactory.parse_wkt('POINT(11 12 13)')
323
323
  assert_equal(11, point2_.x)
@@ -330,10 +330,10 @@ module RGeo
330
330
  # We'd like to define it to be 0, but the GEOS
331
331
  # parser doesn't behave that way.
332
332
  end
333
-
334
-
333
+
334
+
335
335
  end
336
-
336
+
337
337
  end
338
338
  end
339
339
  end
@@ -1,15 +1,15 @@
1
1
  # -----------------------------------------------------------------------------
2
- #
2
+ #
3
3
  # Common tests for polygon implementations
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
@@ -40,10 +40,10 @@ require 'rgeo'
40
40
  module RGeo
41
41
  module Tests # :nodoc:
42
42
  module Common # :nodoc:
43
-
43
+
44
44
  module PolygonTests # :nodoc:
45
-
46
-
45
+
46
+
47
47
  def test_creation_simple
48
48
  point1_ = @factory.point(0, 0)
49
49
  point2_ = @factory.point(0, 1)
@@ -58,8 +58,8 @@ module RGeo
58
58
  assert_nil(polygon_.interior_ring_n(0))
59
59
  assert_nil(polygon_.interior_ring_n(-1))
60
60
  end
61
-
62
-
61
+
62
+
63
63
  def test_creation_one_hole
64
64
  point1_ = @factory.point(0, 0)
65
65
  point2_ = @factory.point(0, 10)
@@ -80,8 +80,8 @@ module RGeo
80
80
  assert_nil(polygon_.interior_ring_n(1))
81
81
  assert_nil(polygon_.interior_ring_n(-1))
82
82
  end
83
-
84
-
83
+
84
+
85
85
  def test_fully_equal
86
86
  point1_ = @factory.point(0, 0)
87
87
  point2_ = @factory.point(0, 1)
@@ -96,8 +96,8 @@ module RGeo
96
96
  assert(poly1_.eql?(poly2_))
97
97
  assert(poly1_.equals?(poly2_))
98
98
  end
99
-
100
-
99
+
100
+
101
101
  def test_geometrically_equal_but_ordered_different
102
102
  point1_ = @factory.point(0, 0)
103
103
  point2_ = @factory.point(0, 1)
@@ -109,8 +109,8 @@ module RGeo
109
109
  assert(!poly1_.eql?(poly2_))
110
110
  assert(poly1_.equals?(poly2_))
111
111
  end
112
-
113
-
112
+
113
+
114
114
  def test_geometrically_equal_but_different_directions
115
115
  point1_ = @factory.point(0, 0)
116
116
  point2_ = @factory.point(0, 1)
@@ -122,8 +122,8 @@ module RGeo
122
122
  assert(!poly1_.eql?(poly2_))
123
123
  assert(poly1_.equals?(poly2_))
124
124
  end
125
-
126
-
125
+
126
+
127
127
  def test_wkt_creation_simple
128
128
  parsed_poly_ = @factory.parse_wkt('POLYGON((0 0, 0 1, 1 0, 0 0))')
129
129
  point1_ = @factory.point(0, 0)
@@ -133,8 +133,8 @@ module RGeo
133
133
  built_poly_ = @factory.polygon(exterior_)
134
134
  assert(built_poly_.eql?(parsed_poly_))
135
135
  end
136
-
137
-
136
+
137
+
138
138
  def test_wkt_creation_one_hole
139
139
  parsed_poly_ = @factory.parse_wkt('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0), (4 4, 5 6, 6 4, 4 4))')
140
140
  point1_ = @factory.point(0, 0)
@@ -149,8 +149,8 @@ module RGeo
149
149
  built_poly_ = @factory.polygon(exterior_, [interior_])
150
150
  assert(built_poly_.eql?(parsed_poly_))
151
151
  end
152
-
153
-
152
+
153
+
154
154
  def test_clone
155
155
  point1_ = @factory.point(0, 0)
156
156
  point2_ = @factory.point(0, 1)
@@ -162,8 +162,8 @@ module RGeo
162
162
  assert(exterior_.eql?(poly2_.exterior_ring))
163
163
  assert_equal(0, poly2_.num_interior_rings)
164
164
  end
165
-
166
-
165
+
166
+
167
167
  def test_type_check
168
168
  point1_ = @factory.point(0, 0)
169
169
  point2_ = @factory.point(0, 1)
@@ -176,8 +176,8 @@ module RGeo
176
176
  assert(::RGeo::Feature::Surface.check_type(poly_))
177
177
  assert(::RGeo::Feature::Polygon.check_type(poly_))
178
178
  end
179
-
180
-
179
+
180
+
181
181
  def test_as_text_wkt_round_trip
182
182
  point1_ = @factory.point(0, 0)
183
183
  point2_ = @factory.point(0, 1)
@@ -188,8 +188,8 @@ module RGeo
188
188
  poly2_ = @factory.parse_wkt(text_)
189
189
  assert(poly1_.eql?(poly2_))
190
190
  end
191
-
192
-
191
+
192
+
193
193
  def test_as_binary_wkb_round_trip
194
194
  point1_ = @factory.point(0, 0)
195
195
  point2_ = @factory.point(0, 1)
@@ -200,8 +200,8 @@ module RGeo
200
200
  poly2_ = @factory.parse_wkb(binary_)
201
201
  assert(poly1_.eql?(poly2_))
202
202
  end
203
-
204
-
203
+
204
+
205
205
  def test_dimension
206
206
  point1_ = @factory.point(0, 0)
207
207
  point2_ = @factory.point(0, 10)
@@ -215,8 +215,8 @@ module RGeo
215
215
  poly_ = @factory.polygon(exterior_, [interior_])
216
216
  assert_equal(2, poly_.dimension)
217
217
  end
218
-
219
-
218
+
219
+
220
220
  def test_is_empty
221
221
  point1_ = @factory.point(0, 0)
222
222
  point2_ = @factory.point(0, 1)
@@ -227,10 +227,10 @@ module RGeo
227
227
  poly2_ = @factory.polygon(@factory.linear_ring([]))
228
228
  assert(poly2_.is_empty?)
229
229
  end
230
-
231
-
230
+
231
+
232
232
  end
233
-
233
+
234
234
  end
235
235
  end
236
236
  end