schleyfox-rgeo 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. data/History.rdoc +199 -0
  2. data/README.rdoc +172 -0
  3. data/Spatial_Programming_With_RGeo.rdoc +440 -0
  4. data/Version +1 -0
  5. data/ext/geos_c_impl/extconf.rb +84 -0
  6. data/ext/geos_c_impl/factory.c +468 -0
  7. data/ext/geos_c_impl/factory.h +224 -0
  8. data/ext/geos_c_impl/geometry.c +705 -0
  9. data/ext/geos_c_impl/geometry.h +55 -0
  10. data/ext/geos_c_impl/geometry_collection.c +482 -0
  11. data/ext/geos_c_impl/geometry_collection.h +69 -0
  12. data/ext/geos_c_impl/line_string.c +509 -0
  13. data/ext/geos_c_impl/line_string.h +64 -0
  14. data/ext/geos_c_impl/main.c +70 -0
  15. data/ext/geos_c_impl/point.c +193 -0
  16. data/ext/geos_c_impl/point.h +62 -0
  17. data/ext/geos_c_impl/polygon.c +265 -0
  18. data/ext/geos_c_impl/polygon.h +66 -0
  19. data/ext/geos_c_impl/preface.h +50 -0
  20. data/ext/proj4_c_impl/extconf.rb +88 -0
  21. data/ext/proj4_c_impl/main.c +271 -0
  22. data/lib/rgeo.rb +124 -0
  23. data/lib/rgeo/cartesian.rb +60 -0
  24. data/lib/rgeo/cartesian/analysis.rb +118 -0
  25. data/lib/rgeo/cartesian/bounding_box.rb +337 -0
  26. data/lib/rgeo/cartesian/calculations.rb +161 -0
  27. data/lib/rgeo/cartesian/factory.rb +209 -0
  28. data/lib/rgeo/cartesian/feature_classes.rb +173 -0
  29. data/lib/rgeo/cartesian/feature_methods.rb +106 -0
  30. data/lib/rgeo/cartesian/interface.rb +150 -0
  31. data/lib/rgeo/coord_sys.rb +79 -0
  32. data/lib/rgeo/coord_sys/cs/entities.rb +1524 -0
  33. data/lib/rgeo/coord_sys/cs/factories.rb +208 -0
  34. data/lib/rgeo/coord_sys/cs/wkt_parser.rb +308 -0
  35. data/lib/rgeo/coord_sys/proj4.rb +312 -0
  36. data/lib/rgeo/coord_sys/srs_database/active_record_table.rb +194 -0
  37. data/lib/rgeo/coord_sys/srs_database/interface.rb +165 -0
  38. data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +188 -0
  39. data/lib/rgeo/coord_sys/srs_database/sr_org.rb +108 -0
  40. data/lib/rgeo/coord_sys/srs_database/url_reader.rb +108 -0
  41. data/lib/rgeo/error.rb +63 -0
  42. data/lib/rgeo/feature.rb +88 -0
  43. data/lib/rgeo/feature/curve.rb +156 -0
  44. data/lib/rgeo/feature/factory.rb +332 -0
  45. data/lib/rgeo/feature/factory_generator.rb +138 -0
  46. data/lib/rgeo/feature/geometry.rb +614 -0
  47. data/lib/rgeo/feature/geometry_collection.rb +129 -0
  48. data/lib/rgeo/feature/line.rb +66 -0
  49. data/lib/rgeo/feature/line_string.rb +102 -0
  50. data/lib/rgeo/feature/linear_ring.rb +66 -0
  51. data/lib/rgeo/feature/multi_curve.rb +113 -0
  52. data/lib/rgeo/feature/multi_line_string.rb +66 -0
  53. data/lib/rgeo/feature/multi_point.rb +73 -0
  54. data/lib/rgeo/feature/multi_polygon.rb +97 -0
  55. data/lib/rgeo/feature/multi_surface.rb +116 -0
  56. data/lib/rgeo/feature/point.rb +120 -0
  57. data/lib/rgeo/feature/polygon.rb +141 -0
  58. data/lib/rgeo/feature/surface.rb +122 -0
  59. data/lib/rgeo/feature/types.rb +305 -0
  60. data/lib/rgeo/geographic.rb +75 -0
  61. data/lib/rgeo/geographic/factory.rb +287 -0
  62. data/lib/rgeo/geographic/interface.rb +410 -0
  63. data/lib/rgeo/geographic/proj4_projector.rb +98 -0
  64. data/lib/rgeo/geographic/projected_feature_classes.rb +213 -0
  65. data/lib/rgeo/geographic/projected_feature_methods.rb +228 -0
  66. data/lib/rgeo/geographic/projected_window.rb +467 -0
  67. data/lib/rgeo/geographic/simple_mercator_projector.rb +157 -0
  68. data/lib/rgeo/geographic/spherical_feature_classes.rb +212 -0
  69. data/lib/rgeo/geographic/spherical_feature_methods.rb +97 -0
  70. data/lib/rgeo/geographic/spherical_math.rb +206 -0
  71. data/lib/rgeo/geos.rb +72 -0
  72. data/lib/rgeo/geos/factory.rb +301 -0
  73. data/lib/rgeo/geos/impl_additions.rb +76 -0
  74. data/lib/rgeo/geos/interface.rb +139 -0
  75. data/lib/rgeo/geos/zm_factory.rb +275 -0
  76. data/lib/rgeo/geos/zm_impl.rb +432 -0
  77. data/lib/rgeo/impl_helper.rb +53 -0
  78. data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +235 -0
  79. data/lib/rgeo/impl_helper/basic_geometry_methods.rb +85 -0
  80. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +197 -0
  81. data/lib/rgeo/impl_helper/basic_point_methods.rb +138 -0
  82. data/lib/rgeo/impl_helper/basic_polygon_methods.rb +121 -0
  83. data/lib/rgeo/impl_helper/math.rb +50 -0
  84. data/lib/rgeo/version.rb +52 -0
  85. data/lib/rgeo/wkrep.rb +72 -0
  86. data/lib/rgeo/wkrep/wkb_generator.rb +267 -0
  87. data/lib/rgeo/wkrep/wkb_parser.rb +315 -0
  88. data/lib/rgeo/wkrep/wkt_generator.rb +275 -0
  89. data/lib/rgeo/wkrep/wkt_parser.rb +496 -0
  90. data/test/common/geometry_collection_tests.rb +238 -0
  91. data/test/common/line_string_tests.rb +324 -0
  92. data/test/common/multi_line_string_tests.rb +209 -0
  93. data/test/common/multi_point_tests.rb +201 -0
  94. data/test/common/multi_polygon_tests.rb +208 -0
  95. data/test/common/point_tests.rb +331 -0
  96. data/test/common/polygon_tests.rb +232 -0
  97. data/test/coord_sys/tc_active_record_table.rb +102 -0
  98. data/test/coord_sys/tc_ogc_cs.rb +356 -0
  99. data/test/coord_sys/tc_proj4.rb +138 -0
  100. data/test/coord_sys/tc_proj4_srs_data.rb +76 -0
  101. data/test/coord_sys/tc_sr_org.rb +70 -0
  102. data/test/coord_sys/tc_url_reader.rb +82 -0
  103. data/test/geos/tc_factory.rb +91 -0
  104. data/test/geos/tc_geometry_collection.rb +62 -0
  105. data/test/geos/tc_line_string.rb +62 -0
  106. data/test/geos/tc_misc.rb +72 -0
  107. data/test/geos/tc_multi_line_string.rb +62 -0
  108. data/test/geos/tc_multi_point.rb +62 -0
  109. data/test/geos/tc_multi_polygon.rb +63 -0
  110. data/test/geos/tc_point.rb +86 -0
  111. data/test/geos/tc_polygon.rb +86 -0
  112. data/test/geos/tc_zmfactory.rb +85 -0
  113. data/test/projected_geographic/tc_geometry_collection.rb +62 -0
  114. data/test/projected_geographic/tc_line_string.rb +62 -0
  115. data/test/projected_geographic/tc_multi_line_string.rb +62 -0
  116. data/test/projected_geographic/tc_multi_point.rb +62 -0
  117. data/test/projected_geographic/tc_multi_polygon.rb +63 -0
  118. data/test/projected_geographic/tc_point.rb +93 -0
  119. data/test/projected_geographic/tc_polygon.rb +62 -0
  120. data/test/simple_cartesian/tc_calculations.rb +145 -0
  121. data/test/simple_cartesian/tc_geometry_collection.rb +69 -0
  122. data/test/simple_cartesian/tc_line_string.rb +70 -0
  123. data/test/simple_cartesian/tc_multi_line_string.rb +67 -0
  124. data/test/simple_cartesian/tc_multi_point.rb +67 -0
  125. data/test/simple_cartesian/tc_multi_polygon.rb +70 -0
  126. data/test/simple_cartesian/tc_point.rb +91 -0
  127. data/test/simple_cartesian/tc_polygon.rb +67 -0
  128. data/test/simple_mercator/tc_geometry_collection.rb +62 -0
  129. data/test/simple_mercator/tc_line_string.rb +62 -0
  130. data/test/simple_mercator/tc_multi_line_string.rb +62 -0
  131. data/test/simple_mercator/tc_multi_point.rb +62 -0
  132. data/test/simple_mercator/tc_multi_polygon.rb +63 -0
  133. data/test/simple_mercator/tc_point.rb +93 -0
  134. data/test/simple_mercator/tc_polygon.rb +62 -0
  135. data/test/simple_mercator/tc_window.rb +219 -0
  136. data/test/spherical_geographic/tc_calculations.rb +203 -0
  137. data/test/spherical_geographic/tc_geometry_collection.rb +70 -0
  138. data/test/spherical_geographic/tc_line_string.rb +70 -0
  139. data/test/spherical_geographic/tc_multi_line_string.rb +67 -0
  140. data/test/spherical_geographic/tc_multi_point.rb +67 -0
  141. data/test/spherical_geographic/tc_multi_polygon.rb +70 -0
  142. data/test/spherical_geographic/tc_point.rb +100 -0
  143. data/test/spherical_geographic/tc_polygon.rb +67 -0
  144. data/test/tc_cartesian_analysis.rb +107 -0
  145. data/test/tc_oneoff.rb +63 -0
  146. data/test/wkrep/tc_wkb_generator.rb +249 -0
  147. data/test/wkrep/tc_wkb_parser.rb +353 -0
  148. data/test/wkrep/tc_wkt_generator.rb +362 -0
  149. data/test/wkrep/tc_wkt_parser.rb +480 -0
  150. metadata +267 -0
@@ -0,0 +1,353 @@
1
+ # -----------------------------------------------------------------------------
2
+ #
3
+ # Tests for WKT parser
4
+ #
5
+ # -----------------------------------------------------------------------------
6
+ # Copyright 2010 Daniel Azuma
7
+ #
8
+ # All rights reserved.
9
+ #
10
+ # Redistribution and use in source and binary forms, with or without
11
+ # modification, are permitted provided that the following conditions are met:
12
+ #
13
+ # * Redistributions of source code must retain the above copyright notice,
14
+ # this list of conditions and the following disclaimer.
15
+ # * Redistributions in binary form must reproduce the above copyright notice,
16
+ # this list of conditions and the following disclaimer in the documentation
17
+ # and/or other materials provided with the distribution.
18
+ # * Neither the name of the copyright holder, nor the names of any other
19
+ # contributors to this software, may be used to endorse or promote products
20
+ # derived from this software without specific prior written permission.
21
+ #
22
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
+ # POSSIBILITY OF SUCH DAMAGE.
33
+ # -----------------------------------------------------------------------------
34
+ ;
35
+
36
+
37
+ require 'test/unit'
38
+ require 'rgeo'
39
+
40
+
41
+ module RGeo
42
+ module Tests # :nodoc:
43
+ module WKRep # :nodoc:
44
+
45
+ class TestWKBParser < ::Test::Unit::TestCase # :nodoc:
46
+
47
+
48
+ def test_point_2d_xdr
49
+ parser_ = ::RGeo::WKRep::WKBParser.new
50
+ obj_ = parser_.parse_hex('00000000013ff00000000000004000000000000000')
51
+ assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
52
+ assert_equal(1, obj_.x)
53
+ assert_equal(2, obj_.y)
54
+ end
55
+
56
+
57
+ def test_point_2d_ndr
58
+ parser_ = ::RGeo::WKRep::WKBParser.new
59
+ obj_ = parser_.parse_hex('0101000000000000000000f03f0000000000000040')
60
+ assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
61
+ assert_equal(1, obj_.x)
62
+ assert_equal(2, obj_.y)
63
+ end
64
+
65
+
66
+ def test_point_with_ewkb_z
67
+ factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
68
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
69
+ obj_ = parser_.parse_hex('00800000013ff000000000000040000000000000004008000000000000')
70
+ assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
71
+ assert_equal(3, obj_.z)
72
+ assert_nil(obj_.m)
73
+ end
74
+
75
+
76
+ def test_point_with_ewkb_m
77
+ factory_ = ::RGeo::Cartesian.preferred_factory(:has_m_coordinate => true)
78
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
79
+ obj_ = parser_.parse_hex('00400000013ff000000000000040000000000000004008000000000000')
80
+ assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
81
+ assert_equal(3, obj_.m)
82
+ assert_nil(obj_.z)
83
+ end
84
+
85
+
86
+ def test_point_with_ewkb_zm
87
+ factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :has_m_coordinate => true)
88
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
89
+ obj_ = parser_.parse_hex('00c00000013ff0000000000000400000000000000040080000000000004010000000000000')
90
+ assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
91
+ assert_equal(3, obj_.z)
92
+ assert_equal(4, obj_.m)
93
+ end
94
+
95
+
96
+ def test_point_with_wkb12_z
97
+ factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
98
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_wkb12 => true)
99
+ obj_ = parser_.parse_hex('00000003e93ff000000000000040000000000000004008000000000000')
100
+ assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
101
+ assert_equal(3, obj_.z)
102
+ assert_nil(obj_.m)
103
+ end
104
+
105
+
106
+ def test_point_with_wkb12_m
107
+ factory_ = ::RGeo::Cartesian.preferred_factory(:has_m_coordinate => true)
108
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_wkb12 => true)
109
+ obj_ = parser_.parse_hex('00000007d13ff000000000000040000000000000004008000000000000')
110
+ assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
111
+ assert_equal(3, obj_.m)
112
+ assert_nil(obj_.z)
113
+ end
114
+
115
+
116
+ def test_point_with_wkb12_zm
117
+ factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :has_m_coordinate => true)
118
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_wkb12 => true)
119
+ obj_ = parser_.parse_hex('0000000bb93ff0000000000000400000000000000040080000000000004010000000000000')
120
+ assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
121
+ assert_equal(3, obj_.z)
122
+ assert_equal(4, obj_.m)
123
+ end
124
+
125
+
126
+ def test_point_with_wkb12_z_without_wkb12_support
127
+ factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
128
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_)
129
+ assert_raise(::RGeo::Error::ParseError) do
130
+ obj_ = parser_.parse_hex('00000003e93ff000000000000040000000000000004008000000000000')
131
+ end
132
+ end
133
+
134
+
135
+ def test_point_with_wkb12_z_without_enough_data
136
+ factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
137
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_wkb12 => true)
138
+ assert_raise(::RGeo::Error::ParseError) do
139
+ obj_ = parser_.parse_hex('00000003e93ff00000000000004000000000000000')
140
+ end
141
+ end
142
+
143
+
144
+ def test_point_with_ewkb_z_and_srid
145
+ factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
146
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
147
+ parser_.to_generate_factory do |config_|
148
+ ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :srid => config_[:srid])
149
+ end
150
+ obj_ = parser_.parse_hex('00a0000001000003e83ff000000000000040000000000000004008000000000000')
151
+ assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
152
+ assert_equal(3, obj_.z)
153
+ assert_nil(obj_.m)
154
+ assert_equal(1000, obj_.srid)
155
+ end
156
+
157
+
158
+ def test_linestring_basic
159
+ parser_ = ::RGeo::WKRep::WKBParser.new
160
+ obj_ = parser_.parse_hex('0000000002000000033ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
161
+ assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
162
+ assert_equal(3, obj_.num_points)
163
+ assert_equal(1, obj_.point_n(0).x)
164
+ assert_equal(6, obj_.point_n(2).y)
165
+ end
166
+
167
+
168
+ def test_linestring_with_ewkb_z
169
+ factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
170
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
171
+ obj_ = parser_.parse_hex('0080000002000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
172
+ assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
173
+ assert_equal(2, obj_.num_points)
174
+ assert_equal(1, obj_.point_n(0).x)
175
+ assert_equal(6, obj_.point_n(1).z)
176
+ end
177
+
178
+
179
+ def test_linestring_with_ewkb_z_and_srid
180
+ factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
181
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
182
+ parser_.to_generate_factory do |config_|
183
+ ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :srid => config_[:srid])
184
+ end
185
+ obj_ = parser_.parse_hex('00a0000002000003e8000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
186
+ assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
187
+ assert_equal(2, obj_.num_points)
188
+ assert_equal(1, obj_.point_n(0).x)
189
+ assert_equal(6, obj_.point_n(1).z)
190
+ assert_equal(1000, obj_.srid)
191
+ end
192
+
193
+
194
+ def test_linestring_with_wkb12_z
195
+ factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
196
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_wkb12 => true)
197
+ obj_ = parser_.parse_hex('00000003ea000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
198
+ assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
199
+ assert_equal(2, obj_.num_points)
200
+ assert_equal(1, obj_.point_n(0).x)
201
+ assert_equal(6, obj_.point_n(1).z)
202
+ end
203
+
204
+
205
+ def test_linestring_empty
206
+ parser_ = ::RGeo::WKRep::WKBParser.new
207
+ obj_ = parser_.parse_hex('000000000200000000')
208
+ assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
209
+ assert_equal(0, obj_.num_points)
210
+ end
211
+
212
+
213
+ def test_polygon_basic
214
+ parser_ = ::RGeo::WKRep::WKBParser.new
215
+ obj_ = parser_.parse_hex('000000000300000001000000043ff0000000000000400000000000000040080000000000004010000000000000401800000000000040140000000000003ff00000000000004000000000000000')
216
+ assert_equal(::RGeo::Feature::Polygon, obj_.geometry_type)
217
+ assert_equal(4, obj_.exterior_ring.num_points)
218
+ assert_equal(1, obj_.exterior_ring.point_n(0).x)
219
+ assert_equal(5, obj_.exterior_ring.point_n(2).y)
220
+ end
221
+
222
+
223
+ def test_polygon_empty
224
+ parser_ = ::RGeo::WKRep::WKBParser.new
225
+ obj_ = parser_.parse_hex('000000000300000000')
226
+ assert_equal(::RGeo::Feature::Polygon, obj_.geometry_type)
227
+ assert_equal(0, obj_.exterior_ring.num_points)
228
+ end
229
+
230
+
231
+ def test_multipoint_basic
232
+ parser_ = ::RGeo::WKRep::WKBParser.new
233
+ obj_ = parser_.parse_hex('00000000040000000200000000013ff00000000000004000000000000000000000000140080000000000004010000000000000')
234
+ assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
235
+ assert_equal(2, obj_.num_geometries)
236
+ assert_equal(1, obj_[0].x)
237
+ assert_equal(4, obj_[1].y)
238
+ end
239
+
240
+
241
+ def test_multipoint_mixed_byte_order
242
+ parser_ = ::RGeo::WKRep::WKBParser.new
243
+ obj_ = parser_.parse_hex('0000000004000000020101000000000000000000f03f0000000000000040000000000140080000000000004010000000000000')
244
+ assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
245
+ assert_equal(2, obj_.num_geometries)
246
+ assert_equal(1, obj_[0].x)
247
+ assert_equal(4, obj_[1].y)
248
+ end
249
+
250
+
251
+ def test_multipoint_with_ewkb_z
252
+ factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
253
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
254
+ obj_ = parser_.parse_hex('00800000040000000200800000013ff0000000000000400000000000000040140000000000000080000001400800000000000040100000000000004018000000000000')
255
+ assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
256
+ assert_equal(2, obj_.num_geometries)
257
+ assert_equal(1, obj_[0].x)
258
+ assert_equal(5, obj_[0].z)
259
+ assert_equal(4, obj_[1].y)
260
+ assert_equal(6, obj_[1].z)
261
+ assert_nil(obj_[0].m)
262
+ end
263
+
264
+
265
+ def test_multipoint_ewkb_with_mixed_z
266
+ factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
267
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
268
+ assert_raise(::RGeo::Error::ParseError) do
269
+ obj_ = parser_.parse_hex('00800000040000000200800000013ff000000000000040000000000000004014000000000000000000000140080000000000004010000000000000')
270
+ end
271
+ end
272
+
273
+
274
+ def test_multipoint_empty
275
+ parser_ = ::RGeo::WKRep::WKBParser.new
276
+ obj_ = parser_.parse_hex('000000000400000000')
277
+ assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
278
+ assert_equal(0, obj_.num_geometries)
279
+ end
280
+
281
+
282
+ def test_multilinestring_basic
283
+ parser_ = ::RGeo::WKRep::WKBParser.new
284
+ obj_ = parser_.parse_hex('0000000005000000020000000002000000033ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000000000000200000002bff0000000000000c000000000000000c008000000000000c010000000000000')
285
+ assert_equal(::RGeo::Feature::MultiLineString, obj_.geometry_type)
286
+ assert_equal(2, obj_.num_geometries)
287
+ assert_equal(1, obj_[0].point_n(0).x)
288
+ assert_equal(-4, obj_[1].point_n(1).y)
289
+ end
290
+
291
+
292
+ def test_multilinestring_wrong_element_type
293
+ parser_ = ::RGeo::WKRep::WKBParser.new
294
+ assert_raise(::RGeo::Error::ParseError) do
295
+ obj_ = parser_.parse_hex('0000000005000000020000000002000000033ff00000000000004000000000000000400800000000000040100000000000004014000000000000401800000000000000000000013ff00000000000004000000000000000')
296
+ end
297
+ end
298
+
299
+
300
+ def test_multilinestring_empty
301
+ parser_ = ::RGeo::WKRep::WKBParser.new
302
+ obj_ = parser_.parse_hex('000000000500000000')
303
+ assert_equal(::RGeo::Feature::MultiLineString, obj_.geometry_type)
304
+ assert_equal(0, obj_.num_geometries)
305
+ end
306
+
307
+
308
+ def test_multipolygon_basic
309
+ parser_ = ::RGeo::WKRep::WKBParser.new
310
+ obj_ = parser_.parse_hex('000000000600000002000000000300000001000000043ff0000000000000400000000000000040080000000000004010000000000000401800000000000040140000000000003ff00000000000004000000000000000000000000300000000')
311
+ assert_equal(::RGeo::Feature::MultiPolygon, obj_.geometry_type)
312
+ assert_equal(2, obj_.num_geometries)
313
+ assert_equal(4, obj_[0].exterior_ring.num_points)
314
+ assert_equal(1, obj_[0].exterior_ring.point_n(0).x)
315
+ assert_equal(5, obj_[0].exterior_ring.point_n(2).y)
316
+ assert_equal(0, obj_[1].exterior_ring.num_points)
317
+ end
318
+
319
+
320
+ def test_multipolygon_empty
321
+ parser_ = ::RGeo::WKRep::WKBParser.new
322
+ obj_ = parser_.parse_hex('000000000600000000')
323
+ assert_equal(::RGeo::Feature::MultiPolygon, obj_.geometry_type)
324
+ assert_equal(0, obj_.num_geometries)
325
+ end
326
+
327
+
328
+ def test_collection_basic
329
+ parser_ = ::RGeo::WKRep::WKBParser.new
330
+ obj_ = parser_.parse_hex('0000000007000000020000000002000000033ff0000000000000400000000000000040080000000000004010000000000000401400000000000040180000000000000000000001bff0000000000000c000000000000000')
331
+ assert_equal(::RGeo::Feature::GeometryCollection, obj_.geometry_type)
332
+ assert_equal(2, obj_.num_geometries)
333
+ assert_equal(::RGeo::Feature::LineString, obj_[0].geometry_type)
334
+ assert_equal(1, obj_[0].point_n(0).x)
335
+ assert_equal(6, obj_[0].point_n(2).y)
336
+ assert_equal(::RGeo::Feature::Point, obj_[1].geometry_type)
337
+ assert_equal(-1, obj_[1].x)
338
+ end
339
+
340
+
341
+ def test_collection_empty
342
+ parser_ = ::RGeo::WKRep::WKBParser.new
343
+ obj_ = parser_.parse_hex('000000000700000000')
344
+ assert_equal(::RGeo::Feature::GeometryCollection, obj_.geometry_type)
345
+ assert_equal(0, obj_.num_geometries)
346
+ end
347
+
348
+
349
+ end
350
+
351
+ end
352
+ end
353
+ end
@@ -0,0 +1,362 @@
1
+ # -----------------------------------------------------------------------------
2
+ #
3
+ # Tests for WKT generator
4
+ #
5
+ # -----------------------------------------------------------------------------
6
+ # Copyright 2010 Daniel Azuma
7
+ #
8
+ # All rights reserved.
9
+ #
10
+ # Redistribution and use in source and binary forms, with or without
11
+ # modification, are permitted provided that the following conditions are met:
12
+ #
13
+ # * Redistributions of source code must retain the above copyright notice,
14
+ # this list of conditions and the following disclaimer.
15
+ # * Redistributions in binary form must reproduce the above copyright notice,
16
+ # this list of conditions and the following disclaimer in the documentation
17
+ # and/or other materials provided with the distribution.
18
+ # * Neither the name of the copyright holder, nor the names of any other
19
+ # contributors to this software, may be used to endorse or promote products
20
+ # derived from this software without specific prior written permission.
21
+ #
22
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
+ # POSSIBILITY OF SUCH DAMAGE.
33
+ # -----------------------------------------------------------------------------
34
+ ;
35
+
36
+
37
+ require 'test/unit'
38
+ require 'rgeo'
39
+
40
+
41
+ module RGeo
42
+ module Tests # :nodoc:
43
+ module WKRep # :nodoc:
44
+
45
+ class TestWKTGenerator < ::Test::Unit::TestCase # :nodoc:
46
+
47
+
48
+ def setup
49
+ @factory = ::RGeo::Cartesian.preferred_factory(:srid => 1000)
50
+ @factoryz = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :has_z_coordinate => true)
51
+ @factorym = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :has_m_coordinate => true)
52
+ @factoryzm = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :has_z_coordinate => true, :has_m_coordinate => true)
53
+ end
54
+
55
+
56
+ def test_point_2d
57
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
58
+ obj_ = @factory.point(1, 2)
59
+ assert_equal('Point(1.0 2.0)', generator_.generate(obj_))
60
+ end
61
+
62
+
63
+ def test_point_z
64
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
65
+ obj_ = @factoryz.point(1, 2, 3)
66
+ assert_equal('Point(1.0 2.0 3.0)', generator_.generate(obj_))
67
+ end
68
+
69
+
70
+ def test_point_z_wkt11strict
71
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt11_strict)
72
+ obj_ = @factoryz.point(1, 2, 3)
73
+ assert_equal('Point(1.0 2.0)', generator_.generate(obj_))
74
+ end
75
+
76
+
77
+ def test_point_m
78
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
79
+ obj_ = @factorym.point(1, 2, 3)
80
+ assert_equal('Point(1.0 2.0 3.0)', generator_.generate(obj_))
81
+ end
82
+
83
+
84
+ def test_point_zm
85
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
86
+ obj_ = @factoryzm.point(1, 2, 3, 4)
87
+ assert_equal('Point(1.0 2.0 3.0 4.0)', generator_.generate(obj_))
88
+ end
89
+
90
+
91
+ def test_point_squarebrackets
92
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(:square_brackets => true)
93
+ obj_ = @factory.point(1, 2)
94
+ assert_equal('Point[1.0 2.0]', generator_.generate(obj_))
95
+ end
96
+
97
+
98
+ def test_point_uppercase
99
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(:convert_case => :upper)
100
+ obj_ = @factory.point(1, 2)
101
+ assert_equal('POINT(1.0 2.0)', generator_.generate(obj_))
102
+ end
103
+
104
+
105
+ def test_point_lowercase
106
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(:convert_case => :lower)
107
+ obj_ = @factory.point(1, 2)
108
+ assert_equal('point(1.0 2.0)', generator_.generate(obj_))
109
+ end
110
+
111
+
112
+ def test_point_wkt12
113
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt12)
114
+ obj_ = @factory.point(1, 2)
115
+ assert_equal('Point(1.0 2.0)', generator_.generate(obj_))
116
+ end
117
+
118
+
119
+ def test_point_wkt12_z
120
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt12)
121
+ obj_ = @factoryz.point(1, 2, 3)
122
+ assert_equal('Point Z(1.0 2.0 3.0)', generator_.generate(obj_))
123
+ end
124
+
125
+
126
+ def test_point_wkt12_m
127
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt12)
128
+ obj_ = @factorym.point(1, 2, 3)
129
+ assert_equal('Point M(1.0 2.0 3.0)', generator_.generate(obj_))
130
+ end
131
+
132
+
133
+ def test_point_wkt12_zm
134
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt12)
135
+ obj_ = @factoryzm.point(1, 2, 3, 4)
136
+ assert_equal('Point ZM(1.0 2.0 3.0 4.0)', generator_.generate(obj_))
137
+ end
138
+
139
+
140
+ def test_point_ewkt
141
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :ewkt)
142
+ obj_ = @factory.point(1, 2)
143
+ assert_equal('Point(1.0 2.0)', generator_.generate(obj_))
144
+ end
145
+
146
+
147
+ def test_point_ewkt_z
148
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :ewkt)
149
+ obj_ = @factoryz.point(1, 2, 3)
150
+ assert_equal('Point(1.0 2.0 3.0)', generator_.generate(obj_))
151
+ end
152
+
153
+
154
+ def test_point_ewkt_m
155
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :ewkt)
156
+ obj_ = @factorym.point(1, 2, 3)
157
+ assert_equal('PointM(1.0 2.0 3.0)', generator_.generate(obj_))
158
+ end
159
+
160
+
161
+ def test_point_ewkt_zm
162
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :ewkt)
163
+ obj_ = @factoryzm.point(1, 2, 3, 4)
164
+ assert_equal('Point(1.0 2.0 3.0 4.0)', generator_.generate(obj_))
165
+ end
166
+
167
+
168
+ def test_point_ewkt_with_srid
169
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :ewkt, :emit_ewkt_srid => true)
170
+ obj_ = @factory.point(1, 2)
171
+ assert_equal('SRID=1000;Point(1.0 2.0)', generator_.generate(obj_))
172
+ end
173
+
174
+
175
+ def test_linestring_basic
176
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
177
+ p1_ = @factory.point(1, 2)
178
+ p2_ = @factory.point(2, 2)
179
+ p3_ = @factory.point(1, 1)
180
+ obj_ = @factory.line_string([p1_, p2_, p3_])
181
+ assert_equal('LineString(1.0 2.0,2.0 2.0,1.0 1.0)', generator_.generate(obj_))
182
+ end
183
+
184
+
185
+ def test_linestring_empty
186
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
187
+ obj_ = @factory.line_string([])
188
+ assert_equal('LineString EMPTY', generator_.generate(obj_))
189
+ end
190
+
191
+
192
+ def test_polygon_basic
193
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
194
+ p1_ = @factory.point(0, 0)
195
+ p2_ = @factory.point(10, 0)
196
+ p3_ = @factory.point(10, 10)
197
+ p4_ = @factory.point(0, 10)
198
+ ext_ = @factory.line_string([p1_, p2_, p3_, p4_, p1_])
199
+ obj_ = @factory.polygon(ext_)
200
+ assert_equal('Polygon((0.0 0.0,10.0 0.0,10.0 10.0,0.0 10.0,0.0 0.0))', generator_.generate(obj_))
201
+ end
202
+
203
+
204
+ def test_polygon_with_hole
205
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
206
+ p1_ = @factory.point(0, 0)
207
+ p2_ = @factory.point(10, 0)
208
+ p3_ = @factory.point(10, 10)
209
+ p4_ = @factory.point(0, 10)
210
+ p5_ = @factory.point(1, 1)
211
+ p6_ = @factory.point(2, 2)
212
+ p7_ = @factory.point(3, 1)
213
+ ext_ = @factory.line_string([p1_, p2_, p3_, p4_, p1_])
214
+ int_ = @factory.line_string([p5_, p6_, p7_, p5_])
215
+ obj_ = @factory.polygon(ext_, [int_])
216
+ assert_equal('Polygon((0.0 0.0,10.0 0.0,10.0 10.0,0.0 10.0,0.0 0.0),(1.0 1.0,2.0 2.0,3.0 1.0,1.0 1.0))', generator_.generate(obj_))
217
+ end
218
+
219
+
220
+ def test_polygon_empty
221
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
222
+ obj_ = @factory.polygon(@factory.line_string([]))
223
+ assert_equal('Polygon EMPTY', generator_.generate(obj_))
224
+ end
225
+
226
+
227
+ def test_multipoint_basic
228
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
229
+ p1_ = @factory.point(1, 2)
230
+ p2_ = @factory.point(2, 2)
231
+ p3_ = @factory.point(1, 1)
232
+ obj_ = @factory.multi_point([p1_, p2_, p3_])
233
+ assert_equal('MultiPoint((1.0 2.0),(2.0 2.0),(1.0 1.0))', generator_.generate(obj_))
234
+ end
235
+
236
+
237
+ def test_multipoint_empty
238
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
239
+ obj_ = @factory.multi_point([])
240
+ assert_equal('MultiPoint EMPTY', generator_.generate(obj_))
241
+ end
242
+
243
+
244
+ def test_multilinestring_basic
245
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
246
+ p1_ = @factory.point(0, 0)
247
+ p2_ = @factory.point(10, 0)
248
+ p3_ = @factory.point(10, 10)
249
+ p4_ = @factory.point(0, 10)
250
+ p5_ = @factory.point(1, 1)
251
+ p6_ = @factory.point(2, 2)
252
+ p7_ = @factory.point(3, 1)
253
+ ls1_ = @factory.line_string([p1_, p2_, p3_, p4_, p1_])
254
+ ls2_ = @factory.line_string([p5_, p6_, p7_])
255
+ ls3_ = @factory.line_string([])
256
+ obj_ = @factory.multi_line_string([ls1_, ls2_, ls3_])
257
+ assert_equal('MultiLineString((0.0 0.0,10.0 0.0,10.0 10.0,0.0 10.0,0.0 0.0),(1.0 1.0,2.0 2.0,3.0 1.0),EMPTY)', generator_.generate(obj_))
258
+ end
259
+
260
+
261
+ def test_multilinestring_empty
262
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
263
+ obj_ = @factory.multi_line_string([])
264
+ assert_equal('MultiLineString EMPTY', generator_.generate(obj_))
265
+ end
266
+
267
+
268
+ def test_multipolygon_basic
269
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
270
+ p1_ = @factory.point(0, 0)
271
+ p2_ = @factory.point(10, 0)
272
+ p3_ = @factory.point(10, 10)
273
+ p4_ = @factory.point(0, 10)
274
+ p5_ = @factory.point(1, 1)
275
+ p6_ = @factory.point(2, 2)
276
+ p7_ = @factory.point(3, 1)
277
+ p8_ = @factory.point(20, 20)
278
+ p9_ = @factory.point(30, 20)
279
+ p10_ = @factory.point(30, 30)
280
+ p11_ = @factory.point(20, 30)
281
+ ext1_ = @factory.line_string([p1_, p2_, p3_, p4_, p1_])
282
+ int1_ = @factory.line_string([p5_, p6_, p7_, p5_])
283
+ ext3_ = @factory.line_string([p8_, p9_, p10_, p11_, p8_])
284
+ poly1_ = @factory.polygon(ext1_, [int1_])
285
+ poly2_ = @factory.polygon(@factory.line_string([]))
286
+ poly3_ = @factory.polygon(ext3_)
287
+ obj_ = @factory.multi_polygon([poly1_, poly2_, poly3_])
288
+ assert_equal('MultiPolygon(((0.0 0.0,10.0 0.0,10.0 10.0,0.0 10.0,0.0 0.0),(1.0 1.0,2.0 2.0,3.0 1.0,1.0 1.0)),EMPTY,((20.0 20.0,30.0 20.0,30.0 30.0,20.0 30.0,20.0 20.0)))', generator_.generate(obj_))
289
+ end
290
+
291
+
292
+ def test_multipolygon_empty
293
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
294
+ obj_ = @factory.multi_polygon([])
295
+ assert_equal('MultiPolygon EMPTY', generator_.generate(obj_))
296
+ end
297
+
298
+
299
+ def test_collection_basic
300
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
301
+ p1_ = @factory.point(0, 0)
302
+ p2_ = @factory.point(10, 0)
303
+ p3_ = @factory.point(10, 10)
304
+ p4_ = @factory.point(0, 10)
305
+ p5_ = @factory.point(1, 1)
306
+ p6_ = @factory.point(2, 2)
307
+ p7_ = @factory.point(3, 1)
308
+ p8_ = @factory.point(20, 20)
309
+ p9_ = @factory.point(30, 20)
310
+ p10_ = @factory.point(30, 30)
311
+ p11_ = @factory.point(20, 30)
312
+ ext1_ = @factory.line_string([p1_, p2_, p3_, p4_, p1_])
313
+ int1_ = @factory.line_string([p5_, p6_, p7_, p5_])
314
+ ext3_ = @factory.line_string([p8_, p9_, p10_, p11_, p8_])
315
+ poly1_ = @factory.polygon(ext1_, [int1_])
316
+ poly2_ = @factory.polygon(@factory.line_string([]))
317
+ poly3_ = @factory.polygon(ext3_)
318
+ obj1_ = @factory.multi_polygon([poly1_, poly2_, poly3_])
319
+ obj2_ = @factory.point(1, 2)
320
+ obj_ = @factory.collection([obj1_, obj2_])
321
+ assert_equal('GeometryCollection(MultiPolygon(((0.0 0.0,10.0 0.0,10.0 10.0,0.0 10.0,0.0 0.0),(1.0 1.0,2.0 2.0,3.0 1.0,1.0 1.0)),EMPTY,((20.0 20.0,30.0 20.0,30.0 30.0,20.0 30.0,20.0 20.0))),Point(1.0 2.0))', generator_.generate(obj_))
322
+ end
323
+
324
+
325
+ def test_collection_wkt12_z
326
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt12)
327
+ p1_ = @factoryz.point(0, 0)
328
+ p2_ = @factoryz.point(10, 0)
329
+ p3_ = @factoryz.point(10, 10)
330
+ p4_ = @factoryz.point(0, 10)
331
+ p5_ = @factoryz.point(1, 1)
332
+ p6_ = @factoryz.point(2, 2)
333
+ p7_ = @factoryz.point(3, 1)
334
+ p8_ = @factoryz.point(20, 20)
335
+ p9_ = @factoryz.point(30, 20)
336
+ p10_ = @factoryz.point(30, 30)
337
+ p11_ = @factoryz.point(20, 30)
338
+ ext1_ = @factoryz.line_string([p1_, p2_, p3_, p4_, p1_])
339
+ int1_ = @factoryz.line_string([p5_, p6_, p7_, p5_])
340
+ ext3_ = @factoryz.line_string([p8_, p9_, p10_, p11_, p8_])
341
+ poly1_ = @factoryz.polygon(ext1_, [int1_])
342
+ poly2_ = @factoryz.polygon(@factory.line_string([]))
343
+ poly3_ = @factoryz.polygon(ext3_)
344
+ obj1_ = @factoryz.multi_polygon([poly1_, poly2_, poly3_])
345
+ obj2_ = @factoryz.point(1, 2, 3)
346
+ obj_ = @factoryz.collection([obj1_, obj2_])
347
+ assert_equal('GeometryCollection Z(MultiPolygon Z(((0.0 0.0 0.0,10.0 0.0 0.0,10.0 10.0 0.0,0.0 10.0 0.0,0.0 0.0 0.0),(1.0 1.0 0.0,2.0 2.0 0.0,3.0 1.0 0.0,1.0 1.0 0.0)),EMPTY,((20.0 20.0 0.0,30.0 20.0 0.0,30.0 30.0 0.0,20.0 30.0 0.0,20.0 20.0 0.0))),Point Z(1.0 2.0 3.0))', generator_.generate(obj_))
348
+ end
349
+
350
+
351
+ def test_collection_empty
352
+ generator_ = ::RGeo::WKRep::WKTGenerator.new
353
+ obj_ = @factory.collection([])
354
+ assert_equal('GeometryCollection EMPTY', generator_.generate(obj_))
355
+ end
356
+
357
+
358
+ end
359
+
360
+ end
361
+ end
362
+ end