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 multi line string 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 MultiLineStringTests # :nodoc:
45
-
46
-
45
+
46
+
47
47
  def setup
48
48
  @factory = create_factory
49
49
  point1_ = @factory.point(0, 0)
@@ -56,8 +56,8 @@ module RGeo
56
56
  @linearring1 = @factory.linear_ring([point5_, point3_, point4_, point5_])
57
57
  @line1 = @factory.line(point1_, point2_)
58
58
  end
59
-
60
-
59
+
60
+
61
61
  def test_creation_simple
62
62
  geom_ = @factory.multi_line_string([@linestring1, @linestring2])
63
63
  assert_not_nil(geom_)
@@ -67,8 +67,8 @@ module RGeo
67
67
  assert(@linestring1.eql?(geom_[0]))
68
68
  assert(@linestring2.eql?(geom_[1]))
69
69
  end
70
-
71
-
70
+
71
+
72
72
  def test_creation_empty
73
73
  geom_ = @factory.multi_line_string([])
74
74
  assert_not_nil(geom_)
@@ -77,8 +77,8 @@ module RGeo
77
77
  assert_equal(0, geom_.num_geometries)
78
78
  assert_equal([], geom_.to_a)
79
79
  end
80
-
81
-
80
+
81
+
82
82
  def test_creation_save_types
83
83
  geom_ = @factory.multi_line_string([@linestring1, @linearring1, @line1])
84
84
  assert_not_nil(geom_)
@@ -88,8 +88,8 @@ module RGeo
88
88
  assert(geom_[1].eql?(@linearring1))
89
89
  assert(geom_[2].eql?(@line1))
90
90
  end
91
-
92
-
91
+
92
+
93
93
  def test_creation_casting
94
94
  mls1_ = @factory.collection([@line1])
95
95
  mls2_ = @factory.multi_line_string([@linearring1])
@@ -102,47 +102,47 @@ module RGeo
102
102
  assert(@line1.eql?(geom_[2]))
103
103
  assert(@linearring1.eql?(geom_[3]))
104
104
  end
105
-
106
-
105
+
106
+
107
107
  def test_fully_equal
108
108
  geom1_ = @factory.multi_line_string([@linestring1, @linestring2])
109
109
  geom2_ = @factory.multi_line_string([@linestring1, @linestring2])
110
110
  assert(geom1_.eql?(geom2_))
111
111
  assert(geom1_.equals?(geom2_))
112
112
  end
113
-
114
-
113
+
114
+
115
115
  def test_geometrically_equal
116
116
  geom1_ = @factory.multi_line_string([@linestring1, @linestring2, @linearring1])
117
117
  geom2_ = @factory.multi_line_string([@line1, @linearring1])
118
118
  assert(!geom1_.eql?(geom2_))
119
119
  assert(geom1_.equals?(geom2_))
120
120
  end
121
-
122
-
121
+
122
+
123
123
  def test_not_equal
124
124
  geom1_ = @factory.multi_line_string([@linestring2])
125
125
  geom2_ = @factory.multi_line_string([@linearring1])
126
126
  assert(!geom1_.eql?(geom2_))
127
127
  assert(!geom1_.equals?(geom2_))
128
128
  end
129
-
130
-
129
+
130
+
131
131
  def test_wkt_creation_simple
132
132
  parsed_geom_ = @factory.parse_wkt('MULTILINESTRING((0 0, 1 0), (-4 2, -5 3, -3 5))')
133
133
  built_geom_ = @factory.multi_line_string([@linestring1, @linestring2])
134
134
  assert(built_geom_.eql?(parsed_geom_))
135
135
  end
136
-
137
-
136
+
137
+
138
138
  def test_wkt_creation_empty
139
139
  parsed_geom_ = @factory.parse_wkt('MULTILINESTRING EMPTY')
140
140
  assert_equal(::RGeo::Feature::MultiLineString, parsed_geom_.geometry_type)
141
141
  assert_equal(0, parsed_geom_.num_geometries)
142
142
  assert_equal([], parsed_geom_.to_a)
143
143
  end
144
-
145
-
144
+
145
+
146
146
  def test_clone
147
147
  geom1_ = @factory.multi_line_string([@linestring1, @linestring2])
148
148
  geom2_ = geom1_.clone
@@ -152,8 +152,8 @@ module RGeo
152
152
  assert(@linestring1.eql?(geom2_[0]))
153
153
  assert(@linestring2.eql?(geom2_[1]))
154
154
  end
155
-
156
-
155
+
156
+
157
157
  def test_type_check
158
158
  geom1_ = @factory.multi_line_string([@linestring1, @linestring2])
159
159
  assert(::RGeo::Feature::Geometry.check_type(geom1_))
@@ -168,42 +168,42 @@ module RGeo
168
168
  assert(!::RGeo::Feature::MultiPoint.check_type(geom2_))
169
169
  assert(::RGeo::Feature::MultiLineString.check_type(geom2_))
170
170
  end
171
-
172
-
171
+
172
+
173
173
  def test_as_text_wkt_round_trip
174
174
  geom1_ = @factory.multi_line_string([@linestring1, @linestring2])
175
175
  text_ = geom1_.as_text
176
176
  geom2_ = @factory.parse_wkt(text_)
177
177
  assert(geom1_.eql?(geom2_))
178
178
  end
179
-
180
-
179
+
180
+
181
181
  def test_as_binary_wkb_round_trip
182
182
  geom1_ = @factory.multi_line_string([@linestring1, @linestring2])
183
183
  binary_ = geom1_.as_binary
184
184
  geom2_ = @factory.parse_wkb(binary_)
185
185
  assert(geom1_.eql?(geom2_))
186
186
  end
187
-
188
-
187
+
188
+
189
189
  def test_dimension
190
190
  geom1_ = @factory.multi_line_string([@linestring1, @linestring2])
191
191
  assert_equal(1, geom1_.dimension)
192
192
  geom2_ = @factory.multi_line_string([])
193
193
  assert_equal(-1, geom2_.dimension)
194
194
  end
195
-
196
-
195
+
196
+
197
197
  def test_is_empty
198
198
  geom1_ = @factory.multi_line_string([@linestring1, @linestring2])
199
199
  assert(!geom1_.is_empty?)
200
200
  geom2_ = @factory.multi_line_string([])
201
201
  assert(geom2_.is_empty?)
202
202
  end
203
-
204
-
203
+
204
+
205
205
  end
206
-
206
+
207
207
  end
208
208
  end
209
209
  end
@@ -1,15 +1,15 @@
1
1
  # -----------------------------------------------------------------------------
2
- #
2
+ #
3
3
  # Common tests for multi 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,10 +40,10 @@ require 'rgeo'
40
40
  module RGeo
41
41
  module Tests # :nodoc:
42
42
  module Common # :nodoc:
43
-
43
+
44
44
  module MultiPointTests # :nodoc:
45
-
46
-
45
+
46
+
47
47
  def setup
48
48
  @factory = create_factory
49
49
  @point1 = @factory.point(0, 0)
@@ -52,8 +52,8 @@ module RGeo
52
52
  @point4 = @factory.point(-5, 3)
53
53
  @point5 = @factory.point(-5, 3)
54
54
  end
55
-
56
-
55
+
56
+
57
57
  def test_creation_simple
58
58
  geom_ = @factory.multi_point([@point1, @point2])
59
59
  assert_not_nil(geom_)
@@ -63,8 +63,8 @@ module RGeo
63
63
  assert(@point1.eql?(geom_[0]))
64
64
  assert(@point2.eql?(geom_[1]))
65
65
  end
66
-
67
-
66
+
67
+
68
68
  def test_creation_empty
69
69
  geom_ = @factory.multi_point([])
70
70
  assert_not_nil(geom_)
@@ -73,8 +73,8 @@ module RGeo
73
73
  assert_equal(0, geom_.num_geometries)
74
74
  assert_equal([], geom_.to_a)
75
75
  end
76
-
77
-
76
+
77
+
78
78
  def test_creation_casting
79
79
  mp1_ = @factory.collection([@point3])
80
80
  mp2_ = @factory.multi_point([@point4])
@@ -87,54 +87,54 @@ module RGeo
87
87
  assert(@point3.eql?(geom_[2]))
88
88
  assert(@point4.eql?(geom_[3]))
89
89
  end
90
-
91
-
90
+
91
+
92
92
  def test_creation_wrong_type
93
93
  line_ = @factory.line_string([@point1, @point2])
94
94
  geom_ = @factory.multi_point([@point3, line_])
95
95
  assert_nil(geom_)
96
96
  end
97
-
98
-
97
+
98
+
99
99
  def test_fully_equal
100
100
  geom1_ = @factory.multi_point([@point1, @point2])
101
101
  geom2_ = @factory.multi_point([@point1, @point2])
102
102
  assert(geom1_.eql?(geom2_))
103
103
  assert(geom1_.equals?(geom2_))
104
104
  end
105
-
106
-
105
+
106
+
107
107
  def test_geometrically_equal
108
108
  geom1_ = @factory.multi_point([@point1, @point4])
109
109
  geom2_ = @factory.multi_point([@point1, @point4, @point5])
110
110
  assert(!geom1_.eql?(geom2_))
111
111
  assert(geom1_.equals?(geom2_))
112
112
  end
113
-
114
-
113
+
114
+
115
115
  def test_not_equal
116
116
  geom1_ = @factory.multi_point([@point1, @point2])
117
117
  geom2_ = @factory.multi_point([@point1])
118
118
  assert(!geom1_.eql?(geom2_))
119
119
  assert(!geom1_.equals?(geom2_))
120
120
  end
121
-
122
-
121
+
122
+
123
123
  def test_wkt_creation_simple
124
124
  parsed_geom_ = @factory.parse_wkt('MULTIPOINT((0 0), (-4 2), (-5 3))')
125
125
  built_geom_ = @factory.multi_point([@point1, @point3, @point4])
126
126
  assert(built_geom_.eql?(parsed_geom_))
127
127
  end
128
-
129
-
128
+
129
+
130
130
  def test_wkt_creation_empty
131
131
  parsed_geom_ = @factory.parse_wkt('MULTIPOINT EMPTY')
132
132
  assert(::RGeo::Feature::MultiPoint === parsed_geom_)
133
133
  assert_equal(0, parsed_geom_.num_geometries)
134
134
  assert_equal([], parsed_geom_.to_a)
135
135
  end
136
-
137
-
136
+
137
+
138
138
  def test_clone
139
139
  geom1_ = @factory.multi_point([@point1, @point2])
140
140
  geom2_ = geom1_.clone
@@ -144,8 +144,8 @@ module RGeo
144
144
  assert(@point1.eql?(geom2_[0]))
145
145
  assert(@point2.eql?(geom2_[1]))
146
146
  end
147
-
148
-
147
+
148
+
149
149
  def test_type_check
150
150
  geom1_ = @factory.multi_point([@point1, @point2])
151
151
  assert(::RGeo::Feature::Geometry.check_type(geom1_))
@@ -160,42 +160,42 @@ module RGeo
160
160
  assert(::RGeo::Feature::MultiPoint.check_type(geom2_))
161
161
  assert(!::RGeo::Feature::MultiLineString.check_type(geom2_))
162
162
  end
163
-
164
-
163
+
164
+
165
165
  def test_as_text_wkt_round_trip
166
166
  geom1_ = @factory.multi_point([@point1, @point2])
167
167
  text_ = geom1_.as_text
168
168
  geom2_ = @factory.parse_wkt(text_)
169
169
  assert(geom1_.eql?(geom2_))
170
170
  end
171
-
172
-
171
+
172
+
173
173
  def test_as_binary_wkb_round_trip
174
174
  geom1_ = @factory.multi_point([@point1, @point2])
175
175
  binary_ = geom1_.as_binary
176
176
  geom2_ = @factory.parse_wkb(binary_)
177
177
  assert(geom1_.eql?(geom2_))
178
178
  end
179
-
180
-
179
+
180
+
181
181
  def test_dimension
182
182
  geom1_ = @factory.multi_point([@point1, @point2])
183
183
  assert_equal(0, geom1_.dimension)
184
184
  geom2_ = @factory.multi_point([])
185
185
  assert_equal(-1, geom2_.dimension)
186
186
  end
187
-
188
-
187
+
188
+
189
189
  def test_is_empty
190
190
  geom1_ = @factory.multi_point([@point1, @point2])
191
191
  assert(!geom1_.is_empty?)
192
192
  geom2_ = @factory.multi_point([])
193
193
  assert(geom2_.is_empty?)
194
194
  end
195
-
196
-
195
+
196
+
197
197
  end
198
-
198
+
199
199
  end
200
200
  end
201
201
  end
@@ -1,15 +1,15 @@
1
1
  # -----------------------------------------------------------------------------
2
- #
2
+ #
3
3
  # Common tests for multi 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 MultiPolygonTests # :nodoc:
45
-
46
-
45
+
46
+
47
47
  def setup
48
48
  create_factories
49
49
  point1_ = @factory.point(0, 0)
@@ -66,8 +66,8 @@ module RGeo
66
66
  @poly4 = @factory.polygon(exterior4_)
67
67
  @line1 = interior1_
68
68
  end
69
-
70
-
69
+
70
+
71
71
  def test_creation_simple
72
72
  geom_ = @factory.multi_polygon([@poly1, @poly2])
73
73
  assert_not_nil(geom_)
@@ -77,8 +77,8 @@ module RGeo
77
77
  assert(@poly1.eql?(geom_[0]))
78
78
  assert(@poly2.eql?(geom_[1]))
79
79
  end
80
-
81
-
80
+
81
+
82
82
  def test_creation_empty
83
83
  geom_ = @factory.multi_polygon([])
84
84
  assert_not_nil(geom_)
@@ -87,61 +87,61 @@ module RGeo
87
87
  assert_equal(0, geom_.num_geometries)
88
88
  assert_equal([], geom_.to_a)
89
89
  end
90
-
91
-
90
+
91
+
92
92
  def test_creation_wrong_type
93
93
  geom_ = @factory.multi_polygon([@poly1, @line1])
94
94
  assert_nil(geom_)
95
95
  end
96
-
97
-
96
+
97
+
98
98
  def test_creation_overlapping
99
99
  geom_ = @factory.multi_polygon([@poly1, @poly1])
100
100
  assert_nil(geom_)
101
101
  geom2_ = @lenient_factory.multi_polygon([@poly1, @poly1])
102
102
  assert_not_nil(geom2_)
103
103
  end
104
-
105
-
104
+
105
+
106
106
  def test_creation_connected
107
107
  geom_ = @factory.multi_polygon([@poly3, @poly4])
108
108
  assert_nil(geom_)
109
109
  geom2_ = @lenient_factory.multi_polygon([@poly3, @poly4])
110
110
  assert_not_nil(geom2_)
111
111
  end
112
-
113
-
112
+
113
+
114
114
  def test_equal
115
115
  geom1_ = @factory.multi_polygon([@poly1, @poly2])
116
116
  geom2_ = @factory.multi_polygon([@poly1, @poly2])
117
117
  assert(geom1_.eql?(geom2_))
118
118
  assert(geom1_.equals?(geom2_))
119
119
  end
120
-
121
-
120
+
121
+
122
122
  def test_not_equal
123
123
  geom1_ = @factory.multi_polygon([@poly1])
124
124
  geom2_ = @factory.multi_polygon([@poly2])
125
125
  assert(!geom1_.eql?(geom2_))
126
126
  assert(!geom1_.equals?(geom2_))
127
127
  end
128
-
129
-
128
+
129
+
130
130
  def test_wkt_creation_simple
131
131
  parsed_geom_ = @factory.parse_wkt('MULTIPOLYGON(((0 0, 0 -10, -10 0, 0 0)), ((0 0, 0 10, 10 10, 10 0, 0 0), (4 4, 5 6, 6 4, 4 4)))')
132
132
  built_geom_ = @factory.multi_polygon([@poly1, @poly2])
133
133
  assert(built_geom_.eql?(parsed_geom_))
134
134
  end
135
-
136
-
135
+
136
+
137
137
  def test_wkt_creation_empty
138
138
  parsed_geom_ = @factory.parse_wkt('MULTIPOLYGON EMPTY')
139
139
  assert_equal(::RGeo::Feature::MultiPolygon, parsed_geom_.geometry_type)
140
140
  assert_equal(0, parsed_geom_.num_geometries)
141
141
  assert_equal([], parsed_geom_.to_a)
142
142
  end
143
-
144
-
143
+
144
+
145
145
  def test_clone
146
146
  geom1_ = @factory.multi_polygon([@poly1, @poly2])
147
147
  geom2_ = geom1_.clone
@@ -151,8 +151,8 @@ module RGeo
151
151
  assert(@poly1.eql?(geom2_[0]))
152
152
  assert(@poly2.eql?(geom2_[1]))
153
153
  end
154
-
155
-
154
+
155
+
156
156
  def test_type_check
157
157
  geom1_ = @factory.multi_polygon([@poly1, @poly2])
158
158
  assert(::RGeo::Feature::Geometry.check_type(geom1_))
@@ -167,42 +167,42 @@ module RGeo
167
167
  assert(!::RGeo::Feature::MultiPoint.check_type(geom2_))
168
168
  assert(::RGeo::Feature::MultiPolygon.check_type(geom2_))
169
169
  end
170
-
171
-
170
+
171
+
172
172
  def test_as_text_wkt_round_trip
173
173
  geom1_ = @factory.multi_polygon([@poly1, @poly2])
174
174
  text_ = geom1_.as_text
175
175
  geom2_ = @factory.parse_wkt(text_)
176
176
  assert(geom1_.eql?(geom2_))
177
177
  end
178
-
179
-
178
+
179
+
180
180
  def test_as_binary_wkb_round_trip
181
181
  geom1_ = @factory.multi_polygon([@poly1, @poly2])
182
182
  binary_ = geom1_.as_binary
183
183
  geom2_ = @factory.parse_wkb(binary_)
184
184
  assert(geom1_.eql?(geom2_))
185
185
  end
186
-
187
-
186
+
187
+
188
188
  def test_dimension
189
189
  geom1_ = @factory.multi_polygon([@poly1, @poly2])
190
190
  assert_equal(2, geom1_.dimension)
191
191
  geom2_ = @factory.multi_polygon([])
192
192
  assert_equal(-1, geom2_.dimension)
193
193
  end
194
-
195
-
194
+
195
+
196
196
  def test_is_empty
197
197
  geom1_ = @factory.multi_polygon([@poly1, @poly2])
198
198
  assert(!geom1_.is_empty?)
199
199
  geom2_ = @factory.multi_polygon([])
200
200
  assert(geom2_.is_empty?)
201
201
  end
202
-
203
-
202
+
203
+
204
204
  end
205
-
205
+
206
206
  end
207
207
  end
208
208
  end