rgeo 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +29 -0
  3. data/ext/geos_c_impl/Makefile_2.2.3 +260 -0
  4. data/ext/geos_c_impl/coordinates.c +65 -0
  5. data/ext/geos_c_impl/coordinates.h +2 -0
  6. data/ext/geos_c_impl/extconf.rb +19 -43
  7. data/ext/geos_c_impl/geometry.c +24 -0
  8. data/ext/geos_c_impl/geometry_collection.c +99 -1
  9. data/ext/geos_c_impl/geos_c_impl_2.2.3.bundle +0 -0
  10. data/ext/geos_c_impl/line_string.c +38 -0
  11. data/ext/geos_c_impl/mkmf.log +123 -0
  12. data/ext/geos_c_impl/point.c +27 -0
  13. data/ext/geos_c_impl/polygon.c +26 -0
  14. data/ext/proj4_c_impl/Makefile_2.2.3 +260 -0
  15. data/ext/proj4_c_impl/extconf.rb +32 -32
  16. data/ext/proj4_c_impl/mkmf.log +47 -0
  17. data/ext/proj4_c_impl/proj4_c_impl_2.2.3.bundle +0 -0
  18. data/lib/rgeo.rb +10 -11
  19. data/lib/rgeo/cartesian.rb +7 -12
  20. data/lib/rgeo/cartesian/analysis.rb +13 -26
  21. data/lib/rgeo/cartesian/bounding_box.rb +45 -114
  22. data/lib/rgeo/cartesian/calculations.rb +3 -21
  23. data/lib/rgeo/cartesian/factory.rb +101 -122
  24. data/lib/rgeo/cartesian/feature_classes.rb +9 -59
  25. data/lib/rgeo/cartesian/feature_methods.rb +15 -45
  26. data/lib/rgeo/cartesian/interface.rb +6 -17
  27. data/lib/rgeo/coord_sys.rb +9 -15
  28. data/lib/rgeo/coord_sys/cs/entities.rb +84 -330
  29. data/lib/rgeo/coord_sys/cs/factories.rb +2 -32
  30. data/lib/rgeo/coord_sys/cs/wkt_parser.rb +52 -80
  31. data/lib/rgeo/coord_sys/proj4.rb +28 -67
  32. data/lib/rgeo/coord_sys/proj4_c_impl.bundle +0 -0
  33. data/lib/rgeo/coord_sys/srs_database/interface.rb +4 -24
  34. data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +20 -38
  35. data/lib/rgeo/coord_sys/srs_database/sr_org.rb +6 -22
  36. data/lib/rgeo/coord_sys/srs_database/url_reader.rb +6 -21
  37. data/lib/rgeo/error.rb +0 -6
  38. data/lib/rgeo/feature.rb +18 -23
  39. data/lib/rgeo/feature/curve.rb +0 -14
  40. data/lib/rgeo/feature/factory.rb +13 -38
  41. data/lib/rgeo/feature/factory_generator.rb +4 -16
  42. data/lib/rgeo/feature/geometry.rb +18 -60
  43. data/lib/rgeo/feature/geometry_collection.rb +3 -17
  44. data/lib/rgeo/feature/line.rb +0 -10
  45. data/lib/rgeo/feature/line_string.rb +1 -13
  46. data/lib/rgeo/feature/linear_ring.rb +0 -9
  47. data/lib/rgeo/feature/mixins.rb +11 -36
  48. data/lib/rgeo/feature/multi_curve.rb +0 -11
  49. data/lib/rgeo/feature/multi_line_string.rb +0 -9
  50. data/lib/rgeo/feature/multi_point.rb +0 -9
  51. data/lib/rgeo/feature/multi_polygon.rb +0 -9
  52. data/lib/rgeo/feature/multi_surface.rb +0 -12
  53. data/lib/rgeo/feature/point.rb +0 -13
  54. data/lib/rgeo/feature/polygon.rb +1 -14
  55. data/lib/rgeo/feature/surface.rb +0 -12
  56. data/lib/rgeo/feature/types.rb +19 -61
  57. data/lib/rgeo/geographic.rb +10 -15
  58. data/lib/rgeo/geographic/factory.rb +126 -147
  59. data/lib/rgeo/geographic/interface.rb +67 -81
  60. data/lib/rgeo/geographic/proj4_projector.rb +13 -37
  61. data/lib/rgeo/geographic/projected_feature_classes.rb +7 -66
  62. data/lib/rgeo/geographic/projected_feature_methods.rb +15 -80
  63. data/lib/rgeo/geographic/projected_window.rb +15 -67
  64. data/lib/rgeo/geographic/simple_mercator_projector.rb +32 -56
  65. data/lib/rgeo/geographic/spherical_feature_classes.rb +9 -68
  66. data/lib/rgeo/geographic/spherical_feature_methods.rb +18 -51
  67. data/lib/rgeo/geographic/spherical_math.rb +26 -51
  68. data/lib/rgeo/geos.rb +23 -20
  69. data/lib/rgeo/geos/capi_factory.rb +125 -131
  70. data/lib/rgeo/geos/capi_feature_classes.rb +21 -88
  71. data/lib/rgeo/geos/ffi_factory.rb +90 -143
  72. data/lib/rgeo/geos/ffi_feature_classes.rb +8 -63
  73. data/lib/rgeo/geos/ffi_feature_methods.rb +46 -162
  74. data/lib/rgeo/geos/geos_c_impl.bundle +0 -0
  75. data/lib/rgeo/geos/interface.rb +4 -23
  76. data/lib/rgeo/geos/utils.rb +4 -19
  77. data/lib/rgeo/geos/zm_factory.rb +82 -131
  78. data/lib/rgeo/geos/zm_feature_classes.rb +8 -63
  79. data/lib/rgeo/geos/zm_feature_methods.rb +34 -107
  80. data/lib/rgeo/impl_helper.rb +8 -13
  81. data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +27 -71
  82. data/lib/rgeo/impl_helper/basic_geometry_methods.rb +10 -28
  83. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +21 -57
  84. data/lib/rgeo/impl_helper/basic_point_methods.rb +12 -30
  85. data/lib/rgeo/impl_helper/basic_polygon_methods.rb +9 -28
  86. data/lib/rgeo/impl_helper/math.rb +4 -10
  87. data/lib/rgeo/impl_helper/utils.rb +2 -10
  88. data/lib/rgeo/version.rb +1 -1
  89. data/lib/rgeo/wkrep.rb +4 -9
  90. data/lib/rgeo/wkrep/wkb_generator.rb +22 -46
  91. data/lib/rgeo/wkrep/wkb_parser.rb +25 -52
  92. data/lib/rgeo/wkrep/wkt_generator.rb +39 -69
  93. data/lib/rgeo/wkrep/wkt_parser.rb +52 -89
  94. data/lib/rgeo/yaml.rb +1 -7
  95. data/test/common/factory_tests.rb +4 -19
  96. data/test/common/geometry_collection_tests.rb +6 -39
  97. data/test/common/line_string_tests.rb +10 -39
  98. data/test/common/multi_line_string_tests.rb +10 -30
  99. data/test/common/multi_point_tests.rb +15 -34
  100. data/test/common/multi_polygon_tests.rb +26 -28
  101. data/test/common/point_tests.rb +37 -59
  102. data/test/common/polygon_tests.rb +16 -25
  103. data/test/coord_sys/tc_ogc_cs.rb +151 -186
  104. data/test/coord_sys/tc_proj4.rb +35 -60
  105. data/test/coord_sys/tc_proj4_srs_data.rb +15 -24
  106. data/test/coord_sys/tc_sr_org.rb +11 -19
  107. data/test/coord_sys/tc_url_reader.rb +13 -23
  108. data/test/geos_capi/tc_factory.rb +7 -16
  109. data/test/geos_capi/tc_geometry_collection.rb +6 -14
  110. data/test/geos_capi/tc_line_string.rb +7 -15
  111. data/test/geos_capi/tc_misc.rb +26 -41
  112. data/test/geos_capi/tc_multi_line_string.rb +6 -14
  113. data/test/geos_capi/tc_multi_point.rb +7 -15
  114. data/test/geos_capi/tc_multi_polygon.rb +8 -18
  115. data/test/geos_capi/tc_parsing_unparsing.rb +11 -21
  116. data/test/geos_capi/tc_point.rb +12 -26
  117. data/test/geos_capi/tc_polygon.rb +52 -17
  118. data/test/geos_capi/tc_zmfactory.rb +7 -18
  119. data/test/geos_ffi/tc_factory.rb +7 -16
  120. data/test/geos_ffi/tc_geometry_collection.rb +7 -15
  121. data/test/geos_ffi/tc_line_string.rb +7 -15
  122. data/test/geos_ffi/tc_misc.rb +8 -18
  123. data/test/geos_ffi/tc_multi_line_string.rb +7 -15
  124. data/test/geos_ffi/tc_multi_point.rb +8 -16
  125. data/test/geos_ffi/tc_multi_polygon.rb +9 -18
  126. data/test/geos_ffi/tc_parsing_unparsing.rb +14 -24
  127. data/test/geos_ffi/tc_point.rb +13 -28
  128. data/test/geos_ffi/tc_polygon.rb +7 -17
  129. data/test/geos_ffi/tc_zmfactory.rb +8 -19
  130. data/test/projected_geographic/tc_factory.rb +7 -15
  131. data/test/projected_geographic/tc_geometry_collection.rb +7 -15
  132. data/test/projected_geographic/tc_line_string.rb +7 -15
  133. data/test/projected_geographic/tc_multi_line_string.rb +7 -16
  134. data/test/projected_geographic/tc_multi_point.rb +8 -17
  135. data/test/projected_geographic/tc_multi_polygon.rb +8 -16
  136. data/test/projected_geographic/tc_point.rb +11 -23
  137. data/test/projected_geographic/tc_polygon.rb +7 -15
  138. data/test/simple_cartesian/tc_calculations.rb +6 -22
  139. data/test/simple_cartesian/tc_factory.rb +7 -16
  140. data/test/simple_cartesian/tc_geometry_collection.rb +6 -15
  141. data/test/simple_cartesian/tc_line_string.rb +6 -15
  142. data/test/simple_cartesian/tc_multi_line_string.rb +6 -15
  143. data/test/simple_cartesian/tc_multi_point.rb +7 -16
  144. data/test/simple_cartesian/tc_multi_polygon.rb +7 -16
  145. data/test/simple_cartesian/tc_point.rb +10 -21
  146. data/test/simple_cartesian/tc_polygon.rb +6 -15
  147. data/test/simple_mercator/tc_factory.rb +6 -14
  148. data/test/simple_mercator/tc_geometry_collection.rb +6 -14
  149. data/test/simple_mercator/tc_line_string.rb +6 -14
  150. data/test/simple_mercator/tc_multi_line_string.rb +6 -15
  151. data/test/simple_mercator/tc_multi_point.rb +7 -16
  152. data/test/simple_mercator/tc_multi_polygon.rb +7 -15
  153. data/test/simple_mercator/tc_point.rb +11 -24
  154. data/test/simple_mercator/tc_polygon.rb +6 -14
  155. data/test/simple_mercator/tc_window.rb +10 -34
  156. data/test/spherical_geographic/tc_calculations.rb +5 -32
  157. data/test/spherical_geographic/tc_factory.rb +6 -15
  158. data/test/spherical_geographic/tc_geometry_collection.rb +6 -15
  159. data/test/spherical_geographic/tc_line_string.rb +6 -15
  160. data/test/spherical_geographic/tc_multi_line_string.rb +6 -15
  161. data/test/spherical_geographic/tc_multi_point.rb +7 -16
  162. data/test/spherical_geographic/tc_multi_polygon.rb +7 -16
  163. data/test/spherical_geographic/tc_point.rb +10 -22
  164. data/test/spherical_geographic/tc_polygon.rb +6 -15
  165. data/test/tc_cartesian_analysis.rb +4 -16
  166. data/test/tc_cartesian_bbox.rb +7 -21
  167. data/test/tc_mixins.rb +8 -25
  168. data/test/tc_oneoff.rb +5 -13
  169. data/test/tc_types.rb +7 -16
  170. data/test/wkrep/tc_wkb_generator.rb +63 -97
  171. data/test/wkrep/tc_wkb_parser.rb +63 -100
  172. data/test/wkrep/tc_wkt_generator.rb +54 -92
  173. data/test/wkrep/tc_wkt_parser.rb +84 -133
  174. metadata +39 -9
  175. data/lib/rgeo/coord_sys/srs_database/active_record_table.rb +0 -166
  176. data/test/coord_sys/tc_active_record_table.rb +0 -79
@@ -4,162 +4,144 @@
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- require 'test/unit'
8
- require 'rgeo'
9
-
7
+ require "test/unit"
8
+ require "rgeo"
10
9
 
11
10
  module RGeo
12
- module Tests # :nodoc:
13
- module WKRep # :nodoc:
14
-
15
- class TestWKBParser < ::Test::Unit::TestCase # :nodoc:
16
-
17
-
11
+ module Tests # :nodoc:
12
+ module WKRep # :nodoc:
13
+ class TestWKBParser < ::Test::Unit::TestCase # :nodoc:
18
14
  def test_point_2d_xdr_hex
19
15
  parser_ = ::RGeo::WKRep::WKBParser.new
20
- obj_ = parser_.parse('00000000013ff00000000000004000000000000000')
16
+ obj_ = parser_.parse("00000000013ff00000000000004000000000000000")
21
17
  assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
22
18
  assert_equal(1, obj_.x)
23
19
  assert_equal(2, obj_.y)
24
20
  end
25
21
 
26
-
27
22
  def test_point_2d_xdr_binary
28
23
  parser_ = ::RGeo::WKRep::WKBParser.new
29
- obj_ = parser_.parse(['00000000013ff00000000000004000000000000000'].pack('H*'))
24
+ obj_ = parser_.parse(["00000000013ff00000000000004000000000000000"].pack("H*"))
30
25
  assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
31
26
  assert_equal(1, obj_.x)
32
27
  assert_equal(2, obj_.y)
33
28
  end
34
29
 
35
-
36
30
  def test_point_2d_ndr
37
31
  parser_ = ::RGeo::WKRep::WKBParser.new
38
- obj_ = parser_.parse('0101000000000000000000f03f0000000000000040')
32
+ obj_ = parser_.parse("0101000000000000000000f03f0000000000000040")
39
33
  assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
40
34
  assert_equal(1, obj_.x)
41
35
  assert_equal(2, obj_.y)
42
36
  end
43
37
 
44
-
45
38
  def test_point_with_ewkb_z
46
- factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
47
- parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
48
- obj_ = parser_.parse('00800000013ff000000000000040000000000000004008000000000000')
39
+ factory_ = ::RGeo::Cartesian.preferred_factory(has_z_coordinate: true)
40
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, support_ewkb: true)
41
+ obj_ = parser_.parse("00800000013ff000000000000040000000000000004008000000000000")
49
42
  assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
50
43
  assert_equal(3, obj_.z)
51
44
  assert_nil(obj_.m)
52
45
  end
53
46
 
54
-
55
47
  def test_point_with_ewkb_m
56
- factory_ = ::RGeo::Cartesian.preferred_factory(:has_m_coordinate => true)
57
- parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
58
- obj_ = parser_.parse('00400000013ff000000000000040000000000000004008000000000000')
48
+ factory_ = ::RGeo::Cartesian.preferred_factory(has_m_coordinate: true)
49
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, support_ewkb: true)
50
+ obj_ = parser_.parse("00400000013ff000000000000040000000000000004008000000000000")
59
51
  assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
60
52
  assert_equal(3, obj_.m)
61
53
  assert_nil(obj_.z)
62
54
  end
63
55
 
64
-
65
56
  def test_point_with_ewkb_zm
66
- factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :has_m_coordinate => true)
67
- parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
68
- obj_ = parser_.parse('00c00000013ff0000000000000400000000000000040080000000000004010000000000000')
57
+ factory_ = ::RGeo::Cartesian.preferred_factory(has_z_coordinate: true, has_m_coordinate: true)
58
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, support_ewkb: true)
59
+ obj_ = parser_.parse("00c00000013ff0000000000000400000000000000040080000000000004010000000000000")
69
60
  assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
70
61
  assert_equal(3, obj_.z)
71
62
  assert_equal(4, obj_.m)
72
63
  end
73
64
 
74
-
75
65
  def test_point_with_wkb12_z
76
- factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
77
- parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_wkb12 => true)
78
- obj_ = parser_.parse('00000003e93ff000000000000040000000000000004008000000000000')
66
+ factory_ = ::RGeo::Cartesian.preferred_factory(has_z_coordinate: true)
67
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, support_wkb12: true)
68
+ obj_ = parser_.parse("00000003e93ff000000000000040000000000000004008000000000000")
79
69
  assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
80
70
  assert_equal(3, obj_.z)
81
71
  assert_nil(obj_.m)
82
72
  end
83
73
 
84
-
85
74
  def test_point_with_wkb12_m
86
- factory_ = ::RGeo::Cartesian.preferred_factory(:has_m_coordinate => true)
87
- parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_wkb12 => true)
88
- obj_ = parser_.parse('00000007d13ff000000000000040000000000000004008000000000000')
75
+ factory_ = ::RGeo::Cartesian.preferred_factory(has_m_coordinate: true)
76
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, support_wkb12: true)
77
+ obj_ = parser_.parse("00000007d13ff000000000000040000000000000004008000000000000")
89
78
  assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
90
79
  assert_equal(3, obj_.m)
91
80
  assert_nil(obj_.z)
92
81
  end
93
82
 
94
-
95
83
  def test_point_with_wkb12_zm
96
- factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :has_m_coordinate => true)
97
- parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_wkb12 => true)
98
- obj_ = parser_.parse('0000000bb93ff0000000000000400000000000000040080000000000004010000000000000')
84
+ factory_ = ::RGeo::Cartesian.preferred_factory(has_z_coordinate: true, has_m_coordinate: true)
85
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, support_wkb12: true)
86
+ obj_ = parser_.parse("0000000bb93ff0000000000000400000000000000040080000000000004010000000000000")
99
87
  assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
100
88
  assert_equal(3, obj_.z)
101
89
  assert_equal(4, obj_.m)
102
90
  end
103
91
 
104
-
105
92
  def test_point_with_wkb12_z_without_wkb12_support
106
- factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
93
+ factory_ = ::RGeo::Cartesian.preferred_factory(has_z_coordinate: true)
107
94
  parser_ = ::RGeo::WKRep::WKBParser.new(factory_)
108
95
  assert_raise(::RGeo::Error::ParseError) do
109
- parser_.parse('00000003e93ff000000000000040000000000000004008000000000000')
96
+ parser_.parse("00000003e93ff000000000000040000000000000004008000000000000")
110
97
  end
111
98
  end
112
99
 
113
-
114
100
  def test_point_with_wkb12_z_without_enough_data
115
- factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
116
- parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_wkb12 => true)
101
+ factory_ = ::RGeo::Cartesian.preferred_factory(has_z_coordinate: true)
102
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, support_wkb12: true)
117
103
  assert_raise(::RGeo::Error::ParseError) do
118
- parser_.parse('00000003e93ff00000000000004000000000000000')
104
+ parser_.parse("00000003e93ff00000000000004000000000000000")
119
105
  end
120
106
  end
121
107
 
122
-
123
108
  def test_point_with_ewkb_z_and_srid
124
109
  factory_generator_ = ::Proc.new do |config_|
125
- ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :srid => config_[:srid])
110
+ ::RGeo::Cartesian.preferred_factory(has_z_coordinate: true, srid: config_[:srid])
126
111
  end
127
- parser_ = ::RGeo::WKRep::WKBParser.new(factory_generator_, :support_ewkb => true)
128
- obj_ = parser_.parse('00a0000001000003e83ff000000000000040000000000000004008000000000000')
112
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_generator_, support_ewkb: true)
113
+ obj_ = parser_.parse("00a0000001000003e83ff000000000000040000000000000004008000000000000")
129
114
  assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
130
115
  assert_equal(3, obj_.z)
131
116
  assert_nil(obj_.m)
132
117
  assert_equal(1000, obj_.srid)
133
118
  end
134
119
 
135
-
136
120
  def test_linestring_basic
137
121
  parser_ = ::RGeo::WKRep::WKBParser.new
138
- obj_ = parser_.parse('0000000002000000033ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
122
+ obj_ = parser_.parse("0000000002000000033ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000")
139
123
  assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
140
124
  assert_equal(3, obj_.num_points)
141
125
  assert_equal(1, obj_.point_n(0).x)
142
126
  assert_equal(6, obj_.point_n(2).y)
143
127
  end
144
128
 
145
-
146
129
  def test_linestring_with_ewkb_z
147
- factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
148
- parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
149
- obj_ = parser_.parse('0080000002000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
130
+ factory_ = ::RGeo::Cartesian.preferred_factory(has_z_coordinate: true)
131
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, support_ewkb: true)
132
+ obj_ = parser_.parse("0080000002000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000")
150
133
  assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
151
134
  assert_equal(2, obj_.num_points)
152
135
  assert_equal(1, obj_.point_n(0).x)
153
136
  assert_equal(6, obj_.point_n(1).z)
154
137
  end
155
138
 
156
-
157
139
  def test_linestring_with_ewkb_z_and_srid
158
140
  factory_generator_ = ::Proc.new do |config_|
159
- ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :srid => config_[:srid])
141
+ ::RGeo::Cartesian.preferred_factory(has_z_coordinate: true, srid: config_[:srid])
160
142
  end
161
- parser_ = ::RGeo::WKRep::WKBParser.new(factory_generator_, :support_ewkb => true)
162
- obj_ = parser_.parse('00a0000002000003e8000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
143
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_generator_, support_ewkb: true)
144
+ obj_ = parser_.parse("00a0000002000003e8000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000")
163
145
  assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
164
146
  assert_equal(2, obj_.num_points)
165
147
  assert_equal(1, obj_.point_n(0).x)
@@ -167,68 +149,61 @@ module RGeo
167
149
  assert_equal(1000, obj_.srid)
168
150
  end
169
151
 
170
-
171
152
  def test_linestring_with_wkb12_z
172
- factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
173
- parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_wkb12 => true)
174
- obj_ = parser_.parse('00000003ea000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
153
+ factory_ = ::RGeo::Cartesian.preferred_factory(has_z_coordinate: true)
154
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, support_wkb12: true)
155
+ obj_ = parser_.parse("00000003ea000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000")
175
156
  assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
176
157
  assert_equal(2, obj_.num_points)
177
158
  assert_equal(1, obj_.point_n(0).x)
178
159
  assert_equal(6, obj_.point_n(1).z)
179
160
  end
180
161
 
181
-
182
162
  def test_linestring_empty
183
163
  parser_ = ::RGeo::WKRep::WKBParser.new
184
- obj_ = parser_.parse('000000000200000000')
164
+ obj_ = parser_.parse("000000000200000000")
185
165
  assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
186
166
  assert_equal(0, obj_.num_points)
187
167
  end
188
168
 
189
-
190
169
  def test_polygon_basic
191
170
  parser_ = ::RGeo::WKRep::WKBParser.new
192
- obj_ = parser_.parse('000000000300000001000000043ff0000000000000400000000000000040080000000000004010000000000000401800000000000040140000000000003ff00000000000004000000000000000')
171
+ obj_ = parser_.parse("000000000300000001000000043ff0000000000000400000000000000040080000000000004010000000000000401800000000000040140000000000003ff00000000000004000000000000000")
193
172
  assert_equal(::RGeo::Feature::Polygon, obj_.geometry_type)
194
173
  assert_equal(4, obj_.exterior_ring.num_points)
195
174
  assert_equal(1, obj_.exterior_ring.point_n(0).x)
196
175
  assert_equal(5, obj_.exterior_ring.point_n(2).y)
197
176
  end
198
177
 
199
-
200
178
  def test_polygon_empty
201
179
  parser_ = ::RGeo::WKRep::WKBParser.new
202
- obj_ = parser_.parse('000000000300000000')
180
+ obj_ = parser_.parse("000000000300000000")
203
181
  assert_equal(::RGeo::Feature::Polygon, obj_.geometry_type)
204
182
  assert_equal(0, obj_.exterior_ring.num_points)
205
183
  end
206
184
 
207
-
208
185
  def test_multipoint_basic
209
186
  parser_ = ::RGeo::WKRep::WKBParser.new
210
- obj_ = parser_.parse('00000000040000000200000000013ff00000000000004000000000000000000000000140080000000000004010000000000000')
187
+ obj_ = parser_.parse("00000000040000000200000000013ff00000000000004000000000000000000000000140080000000000004010000000000000")
211
188
  assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
212
189
  assert_equal(2, obj_.num_geometries)
213
190
  assert_equal(1, obj_[0].x)
214
191
  assert_equal(4, obj_[1].y)
215
192
  end
216
193
 
217
-
218
194
  def test_multipoint_mixed_byte_order
219
195
  parser_ = ::RGeo::WKRep::WKBParser.new
220
- obj_ = parser_.parse('0000000004000000020101000000000000000000f03f0000000000000040000000000140080000000000004010000000000000')
196
+ obj_ = parser_.parse("0000000004000000020101000000000000000000f03f0000000000000040000000000140080000000000004010000000000000")
221
197
  assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
222
198
  assert_equal(2, obj_.num_geometries)
223
199
  assert_equal(1, obj_[0].x)
224
200
  assert_equal(4, obj_[1].y)
225
201
  end
226
202
 
227
-
228
203
  def test_multipoint_with_ewkb_z
229
- factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
230
- parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
231
- obj_ = parser_.parse('00800000040000000200800000013ff0000000000000400000000000000040140000000000000080000001400800000000000040100000000000004018000000000000')
204
+ factory_ = ::RGeo::Cartesian.preferred_factory(has_z_coordinate: true)
205
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, support_ewkb: true)
206
+ obj_ = parser_.parse("00800000040000000200800000013ff0000000000000400000000000000040140000000000000080000001400800000000000040100000000000004018000000000000")
232
207
  assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
233
208
  assert_equal(2, obj_.num_geometries)
234
209
  assert_equal(1, obj_[0].x)
@@ -238,53 +213,47 @@ module RGeo
238
213
  assert_nil(obj_[0].m)
239
214
  end
240
215
 
241
-
242
216
  def test_multipoint_ewkb_with_mixed_z
243
- factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
244
- parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
217
+ factory_ = ::RGeo::Cartesian.preferred_factory(has_z_coordinate: true)
218
+ parser_ = ::RGeo::WKRep::WKBParser.new(factory_, support_ewkb: true)
245
219
  assert_raise(::RGeo::Error::ParseError) do
246
- parser_.parse('00800000040000000200800000013ff000000000000040000000000000004014000000000000000000000140080000000000004010000000000000')
220
+ parser_.parse("00800000040000000200800000013ff000000000000040000000000000004014000000000000000000000140080000000000004010000000000000")
247
221
  end
248
222
  end
249
223
 
250
-
251
224
  def test_multipoint_empty
252
225
  parser_ = ::RGeo::WKRep::WKBParser.new
253
- obj_ = parser_.parse('000000000400000000')
226
+ obj_ = parser_.parse("000000000400000000")
254
227
  assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
255
228
  assert_equal(0, obj_.num_geometries)
256
229
  end
257
230
 
258
-
259
231
  def test_multilinestring_basic
260
232
  parser_ = ::RGeo::WKRep::WKBParser.new
261
- obj_ = parser_.parse('0000000005000000020000000002000000033ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000000000000200000002bff0000000000000c000000000000000c008000000000000c010000000000000')
233
+ obj_ = parser_.parse("0000000005000000020000000002000000033ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000000000000200000002bff0000000000000c000000000000000c008000000000000c010000000000000")
262
234
  assert_equal(::RGeo::Feature::MultiLineString, obj_.geometry_type)
263
235
  assert_equal(2, obj_.num_geometries)
264
236
  assert_equal(1, obj_[0].point_n(0).x)
265
237
  assert_equal(-4, obj_[1].point_n(1).y)
266
238
  end
267
239
 
268
-
269
240
  def test_multilinestring_wrong_element_type
270
241
  parser_ = ::RGeo::WKRep::WKBParser.new
271
242
  assert_raise(::RGeo::Error::ParseError) do
272
- parser_.parse('0000000005000000020000000002000000033ff00000000000004000000000000000400800000000000040100000000000004014000000000000401800000000000000000000013ff00000000000004000000000000000')
243
+ parser_.parse("0000000005000000020000000002000000033ff00000000000004000000000000000400800000000000040100000000000004014000000000000401800000000000000000000013ff00000000000004000000000000000")
273
244
  end
274
245
  end
275
246
 
276
-
277
247
  def test_multilinestring_empty
278
248
  parser_ = ::RGeo::WKRep::WKBParser.new
279
- obj_ = parser_.parse('000000000500000000')
249
+ obj_ = parser_.parse("000000000500000000")
280
250
  assert_equal(::RGeo::Feature::MultiLineString, obj_.geometry_type)
281
251
  assert_equal(0, obj_.num_geometries)
282
252
  end
283
253
 
284
-
285
254
  def test_multipolygon_basic
286
255
  parser_ = ::RGeo::WKRep::WKBParser.new
287
- obj_ = parser_.parse('000000000600000002000000000300000001000000043ff0000000000000400000000000000040080000000000004010000000000000401800000000000040140000000000003ff00000000000004000000000000000000000000300000000')
256
+ obj_ = parser_.parse("000000000600000002000000000300000001000000043ff0000000000000400000000000000040080000000000004010000000000000401800000000000040140000000000003ff00000000000004000000000000000000000000300000000")
288
257
  assert_equal(::RGeo::Feature::MultiPolygon, obj_.geometry_type)
289
258
  assert_equal(2, obj_.num_geometries)
290
259
  assert_equal(4, obj_[0].exterior_ring.num_points)
@@ -293,18 +262,16 @@ module RGeo
293
262
  assert_equal(0, obj_[1].exterior_ring.num_points)
294
263
  end
295
264
 
296
-
297
265
  def test_multipolygon_empty
298
266
  parser_ = ::RGeo::WKRep::WKBParser.new
299
- obj_ = parser_.parse('000000000600000000')
267
+ obj_ = parser_.parse("000000000600000000")
300
268
  assert_equal(::RGeo::Feature::MultiPolygon, obj_.geometry_type)
301
269
  assert_equal(0, obj_.num_geometries)
302
270
  end
303
271
 
304
-
305
272
  def test_collection_basic
306
273
  parser_ = ::RGeo::WKRep::WKBParser.new
307
- obj_ = parser_.parse('0000000007000000020000000002000000033ff0000000000000400000000000000040080000000000004010000000000000401400000000000040180000000000000000000001bff0000000000000c000000000000000')
274
+ obj_ = parser_.parse("0000000007000000020000000002000000033ff0000000000000400000000000000040080000000000004010000000000000401400000000000040180000000000000000000001bff0000000000000c000000000000000")
308
275
  assert_equal(::RGeo::Feature::GeometryCollection, obj_.geometry_type)
309
276
  assert_equal(2, obj_.num_geometries)
310
277
  assert_equal(::RGeo::Feature::LineString, obj_[0].geometry_type)
@@ -314,17 +281,13 @@ module RGeo
314
281
  assert_equal(-1, obj_[1].x)
315
282
  end
316
283
 
317
-
318
284
  def test_collection_empty
319
285
  parser_ = ::RGeo::WKRep::WKBParser.new
320
- obj_ = parser_.parse('000000000700000000')
286
+ obj_ = parser_.parse("000000000700000000")
321
287
  assert_equal(::RGeo::Feature::GeometryCollection, obj_.geometry_type)
322
288
  assert_equal(0, obj_.num_geometries)
323
289
  end
324
-
325
-
326
290
  end
327
-
328
291
  end
329
292
  end
330
293
  end
@@ -4,161 +4,137 @@
4
4
  #
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- require 'test/unit'
8
- require 'rgeo'
9
-
7
+ require "test/unit"
8
+ require "rgeo"
10
9
 
11
10
  module RGeo
12
- module Tests # :nodoc:
13
- module WKRep # :nodoc:
14
-
15
- class TestWKTGenerator < ::Test::Unit::TestCase # :nodoc:
16
-
17
-
11
+ module Tests # :nodoc:
12
+ module WKRep # :nodoc:
13
+ class TestWKTGenerator < ::Test::Unit::TestCase # :nodoc:
18
14
  def setup
19
- @factory = ::RGeo::Cartesian.preferred_factory(:srid => 1000)
20
- @factoryz = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :has_z_coordinate => true)
21
- @factorym = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :has_m_coordinate => true)
22
- @factoryzm = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :has_z_coordinate => true, :has_m_coordinate => true)
15
+ @factory = ::RGeo::Cartesian.preferred_factory(srid: 1000)
16
+ @factoryz = ::RGeo::Cartesian.preferred_factory(srid: 1000, has_z_coordinate: true)
17
+ @factorym = ::RGeo::Cartesian.preferred_factory(srid: 1000, has_m_coordinate: true)
18
+ @factoryzm = ::RGeo::Cartesian.preferred_factory(srid: 1000, has_z_coordinate: true, has_m_coordinate: true)
23
19
  end
24
20
 
25
-
26
21
  def test_point_2d
27
22
  generator_ = ::RGeo::WKRep::WKTGenerator.new
28
23
  obj_ = @factory.point(1, 2)
29
- assert_equal('Point (1.0 2.0)', generator_.generate(obj_))
24
+ assert_equal("Point (1.0 2.0)", generator_.generate(obj_))
30
25
  end
31
26
 
32
-
33
27
  def test_point_z
34
28
  generator_ = ::RGeo::WKRep::WKTGenerator.new
35
29
  obj_ = @factoryz.point(1, 2, 3)
36
- assert_equal('Point (1.0 2.0 3.0)', generator_.generate(obj_))
30
+ assert_equal("Point (1.0 2.0 3.0)", generator_.generate(obj_))
37
31
  end
38
32
 
39
-
40
33
  def test_point_z_wkt11strict
41
- generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt11_strict)
34
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(tag_format: :wkt11_strict)
42
35
  obj_ = @factoryz.point(1, 2, 3)
43
- assert_equal('Point (1.0 2.0)', generator_.generate(obj_))
36
+ assert_equal("Point (1.0 2.0)", generator_.generate(obj_))
44
37
  end
45
38
 
46
-
47
39
  def test_point_m
48
40
  generator_ = ::RGeo::WKRep::WKTGenerator.new
49
41
  obj_ = @factorym.point(1, 2, 3)
50
- assert_equal('Point (1.0 2.0 3.0)', generator_.generate(obj_))
42
+ assert_equal("Point (1.0 2.0 3.0)", generator_.generate(obj_))
51
43
  end
52
44
 
53
-
54
45
  def test_point_zm
55
46
  generator_ = ::RGeo::WKRep::WKTGenerator.new
56
47
  obj_ = @factoryzm.point(1, 2, 3, 4)
57
- assert_equal('Point (1.0 2.0 3.0 4.0)', generator_.generate(obj_))
48
+ assert_equal("Point (1.0 2.0 3.0 4.0)", generator_.generate(obj_))
58
49
  end
59
50
 
60
-
61
51
  def test_point_squarebrackets
62
- generator_ = ::RGeo::WKRep::WKTGenerator.new(:square_brackets => true)
52
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(square_brackets: true)
63
53
  obj_ = @factory.point(1, 2)
64
- assert_equal('Point [1.0 2.0]', generator_.generate(obj_))
54
+ assert_equal("Point [1.0 2.0]", generator_.generate(obj_))
65
55
  end
66
56
 
67
-
68
57
  def test_point_uppercase
69
- generator_ = ::RGeo::WKRep::WKTGenerator.new(:convert_case => :upper)
58
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(convert_case: :upper)
70
59
  obj_ = @factory.point(1, 2)
71
- assert_equal('POINT (1.0 2.0)', generator_.generate(obj_))
60
+ assert_equal("POINT (1.0 2.0)", generator_.generate(obj_))
72
61
  end
73
62
 
74
-
75
63
  def test_point_lowercase
76
- generator_ = ::RGeo::WKRep::WKTGenerator.new(:convert_case => :lower)
64
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(convert_case: :lower)
77
65
  obj_ = @factory.point(1, 2)
78
- assert_equal('point (1.0 2.0)', generator_.generate(obj_))
66
+ assert_equal("point (1.0 2.0)", generator_.generate(obj_))
79
67
  end
80
68
 
81
-
82
69
  def test_point_wkt12
83
- generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt12)
70
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(tag_format: :wkt12)
84
71
  obj_ = @factory.point(1, 2)
85
- assert_equal('Point (1.0 2.0)', generator_.generate(obj_))
72
+ assert_equal("Point (1.0 2.0)", generator_.generate(obj_))
86
73
  end
87
74
 
88
-
89
75
  def test_point_wkt12_z
90
- generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt12)
76
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(tag_format: :wkt12)
91
77
  obj_ = @factoryz.point(1, 2, 3)
92
- assert_equal('Point Z (1.0 2.0 3.0)', generator_.generate(obj_))
78
+ assert_equal("Point Z (1.0 2.0 3.0)", generator_.generate(obj_))
93
79
  end
94
80
 
95
-
96
81
  def test_point_wkt12_m
97
- generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt12)
82
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(tag_format: :wkt12)
98
83
  obj_ = @factorym.point(1, 2, 3)
99
- assert_equal('Point M (1.0 2.0 3.0)', generator_.generate(obj_))
84
+ assert_equal("Point M (1.0 2.0 3.0)", generator_.generate(obj_))
100
85
  end
101
86
 
102
-
103
87
  def test_point_wkt12_zm
104
- generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt12)
88
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(tag_format: :wkt12)
105
89
  obj_ = @factoryzm.point(1, 2, 3, 4)
106
- assert_equal('Point ZM (1.0 2.0 3.0 4.0)', generator_.generate(obj_))
90
+ assert_equal("Point ZM (1.0 2.0 3.0 4.0)", generator_.generate(obj_))
107
91
  end
108
92
 
109
-
110
93
  def test_point_ewkt
111
- generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :ewkt)
94
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(tag_format: :ewkt)
112
95
  obj_ = @factory.point(1, 2)
113
- assert_equal('Point (1.0 2.0)', generator_.generate(obj_))
96
+ assert_equal("Point (1.0 2.0)", generator_.generate(obj_))
114
97
  end
115
98
 
116
-
117
99
  def test_point_ewkt_z
118
- generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :ewkt)
100
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(tag_format: :ewkt)
119
101
  obj_ = @factoryz.point(1, 2, 3)
120
- assert_equal('Point (1.0 2.0 3.0)', generator_.generate(obj_))
102
+ assert_equal("Point (1.0 2.0 3.0)", generator_.generate(obj_))
121
103
  end
122
104
 
123
-
124
105
  def test_point_ewkt_m
125
- generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :ewkt)
106
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(tag_format: :ewkt)
126
107
  obj_ = @factorym.point(1, 2, 3)
127
- assert_equal('PointM (1.0 2.0 3.0)', generator_.generate(obj_))
108
+ assert_equal("PointM (1.0 2.0 3.0)", generator_.generate(obj_))
128
109
  end
129
110
 
130
-
131
111
  def test_point_ewkt_zm
132
- generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :ewkt)
112
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(tag_format: :ewkt)
133
113
  obj_ = @factoryzm.point(1, 2, 3, 4)
134
- assert_equal('Point (1.0 2.0 3.0 4.0)', generator_.generate(obj_))
114
+ assert_equal("Point (1.0 2.0 3.0 4.0)", generator_.generate(obj_))
135
115
  end
136
116
 
137
-
138
117
  def test_point_ewkt_with_srid
139
- generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :ewkt, :emit_ewkt_srid => true)
118
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(tag_format: :ewkt, emit_ewkt_srid: true)
140
119
  obj_ = @factory.point(1, 2)
141
- assert_equal('SRID=1000;Point (1.0 2.0)', generator_.generate(obj_))
120
+ assert_equal("SRID=1000;Point (1.0 2.0)", generator_.generate(obj_))
142
121
  end
143
122
 
144
-
145
123
  def test_linestring_basic
146
124
  generator_ = ::RGeo::WKRep::WKTGenerator.new
147
125
  p1_ = @factory.point(1, 2)
148
126
  p2_ = @factory.point(2, 2)
149
127
  p3_ = @factory.point(1, 1)
150
128
  obj_ = @factory.line_string([p1_, p2_, p3_])
151
- assert_equal('LineString (1.0 2.0, 2.0 2.0, 1.0 1.0)', generator_.generate(obj_))
129
+ assert_equal("LineString (1.0 2.0, 2.0 2.0, 1.0 1.0)", generator_.generate(obj_))
152
130
  end
153
131
 
154
-
155
132
  def test_linestring_empty
156
133
  generator_ = ::RGeo::WKRep::WKTGenerator.new
157
134
  obj_ = @factory.line_string([])
158
- assert_equal('LineString EMPTY', generator_.generate(obj_))
135
+ assert_equal("LineString EMPTY", generator_.generate(obj_))
159
136
  end
160
137
 
161
-
162
138
  def test_polygon_basic
163
139
  generator_ = ::RGeo::WKRep::WKTGenerator.new
164
140
  p1_ = @factory.point(0, 0)
@@ -167,10 +143,9 @@ module RGeo
167
143
  p4_ = @factory.point(0, 10)
168
144
  ext_ = @factory.line_string([p1_, p2_, p3_, p4_, p1_])
169
145
  obj_ = @factory.polygon(ext_)
170
- 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_))
146
+ 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_))
171
147
  end
172
148
 
173
-
174
149
  def test_polygon_with_hole
175
150
  generator_ = ::RGeo::WKRep::WKTGenerator.new
176
151
  p1_ = @factory.point(0, 0)
@@ -183,34 +158,30 @@ module RGeo
183
158
  ext_ = @factory.line_string([p1_, p2_, p3_, p4_, p1_])
184
159
  int_ = @factory.line_string([p5_, p6_, p7_, p5_])
185
160
  obj_ = @factory.polygon(ext_, [int_])
186
- 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_))
161
+ 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_))
187
162
  end
188
163
 
189
-
190
164
  def test_polygon_empty
191
165
  generator_ = ::RGeo::WKRep::WKTGenerator.new
192
166
  obj_ = @factory.polygon(@factory.line_string([]))
193
- assert_equal('Polygon EMPTY', generator_.generate(obj_))
167
+ assert_equal("Polygon EMPTY", generator_.generate(obj_))
194
168
  end
195
169
 
196
-
197
170
  def test_multipoint_basic
198
171
  generator_ = ::RGeo::WKRep::WKTGenerator.new
199
172
  p1_ = @factory.point(1, 2)
200
173
  p2_ = @factory.point(2, 2)
201
174
  p3_ = @factory.point(1, 1)
202
175
  obj_ = @factory.multi_point([p1_, p2_, p3_])
203
- assert_equal('MultiPoint ((1.0 2.0), (2.0 2.0), (1.0 1.0))', generator_.generate(obj_))
176
+ assert_equal("MultiPoint ((1.0 2.0), (2.0 2.0), (1.0 1.0))", generator_.generate(obj_))
204
177
  end
205
178
 
206
-
207
179
  def test_multipoint_empty
208
180
  generator_ = ::RGeo::WKRep::WKTGenerator.new
209
181
  obj_ = @factory.multi_point([])
210
- assert_equal('MultiPoint EMPTY', generator_.generate(obj_))
182
+ assert_equal("MultiPoint EMPTY", generator_.generate(obj_))
211
183
  end
212
184
 
213
-
214
185
  def test_multilinestring_basic
215
186
  generator_ = ::RGeo::WKRep::WKTGenerator.new
216
187
  p1_ = @factory.point(0, 0)
@@ -224,17 +195,15 @@ module RGeo
224
195
  ls2_ = @factory.line_string([p5_, p6_, p7_])
225
196
  ls3_ = @factory.line_string([])
226
197
  obj_ = @factory.multi_line_string([ls1_, ls2_, ls3_])
227
- 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_))
198
+ 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_))
228
199
  end
229
200
 
230
-
231
201
  def test_multilinestring_empty
232
202
  generator_ = ::RGeo::WKRep::WKTGenerator.new
233
203
  obj_ = @factory.multi_line_string([])
234
- assert_equal('MultiLineString EMPTY', generator_.generate(obj_))
204
+ assert_equal("MultiLineString EMPTY", generator_.generate(obj_))
235
205
  end
236
206
 
237
-
238
207
  def test_multipolygon_basic
239
208
  generator_ = ::RGeo::WKRep::WKTGenerator.new
240
209
  p1_ = @factory.point(0, 0)
@@ -255,17 +224,15 @@ module RGeo
255
224
  poly2_ = @factory.polygon(@factory.line_string([]))
256
225
  poly3_ = @factory.polygon(ext3_)
257
226
  obj_ = @factory.multi_polygon([poly1_, poly2_, poly3_])
258
- 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_))
227
+ 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_))
259
228
  end
260
229
 
261
-
262
230
  def test_multipolygon_empty
263
231
  generator_ = ::RGeo::WKRep::WKTGenerator.new
264
232
  obj_ = @factory.multi_polygon([])
265
- assert_equal('MultiPolygon EMPTY', generator_.generate(obj_))
233
+ assert_equal("MultiPolygon EMPTY", generator_.generate(obj_))
266
234
  end
267
235
 
268
-
269
236
  def test_collection_basic
270
237
  generator_ = ::RGeo::WKRep::WKTGenerator.new
271
238
  p1_ = @factory.point(0, 0)
@@ -288,12 +255,11 @@ module RGeo
288
255
  obj1_ = @factory.multi_polygon([poly1_, poly2_, poly3_])
289
256
  obj2_ = @factory.point(1, 2)
290
257
  obj_ = @factory.collection([obj1_, obj2_])
291
- 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_))
258
+ 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_))
292
259
  end
293
260
 
294
-
295
261
  def test_collection_wkt12_z
296
- generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt12)
262
+ generator_ = ::RGeo::WKRep::WKTGenerator.new(tag_format: :wkt12)
297
263
  p1_ = @factoryz.point(0, 0)
298
264
  p2_ = @factoryz.point(10, 0)
299
265
  p3_ = @factoryz.point(10, 10)
@@ -314,19 +280,15 @@ module RGeo
314
280
  obj1_ = @factoryz.multi_polygon([poly1_, poly2_, poly3_])
315
281
  obj2_ = @factoryz.point(1, 2, 3)
316
282
  obj_ = @factoryz.collection([obj1_, obj2_])
317
- 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_))
283
+ 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_))
318
284
  end
319
285
 
320
-
321
286
  def test_collection_empty
322
287
  generator_ = ::RGeo::WKRep::WKTGenerator.new
323
288
  obj_ = @factory.collection([])
324
- assert_equal('GeometryCollection EMPTY', generator_.generate(obj_))
289
+ assert_equal("GeometryCollection EMPTY", generator_.generate(obj_))
325
290
  end
326
-
327
-
328
291
  end
329
-
330
292
  end
331
293
  end
332
294
  end