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
  # Proj4 projection
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
@@ -35,52 +35,52 @@
35
35
 
36
36
 
37
37
  module RGeo
38
-
38
+
39
39
  module Geographic
40
-
41
-
40
+
41
+
42
42
  class Proj4Projector # :nodoc:
43
-
44
-
43
+
44
+
45
45
  def initialize(geography_factory_, projection_factory_)
46
46
  @geography_factory = geography_factory_
47
47
  @projection_factory = projection_factory_
48
48
  end
49
-
50
-
49
+
50
+
51
51
  def project(geometry_)
52
52
  Feature.cast(geometry_, @projection_factory, :project)
53
53
  end
54
-
55
-
54
+
55
+
56
56
  def unproject(geometry_)
57
57
  Feature.cast(geometry_, @geography_factory, :project)
58
58
  end
59
-
60
-
59
+
60
+
61
61
  def projection_factory
62
62
  @projection_factory
63
63
  end
64
-
65
-
64
+
65
+
66
66
  def wraps?
67
67
  false
68
68
  end
69
-
70
-
69
+
70
+
71
71
  def limits_window
72
72
  nil
73
73
  end
74
-
75
-
74
+
75
+
76
76
  class << self
77
-
78
-
77
+
78
+
79
79
  def create_from_existing_factory(geography_factory_, projection_factory_)
80
80
  new(geography_factory_, projection_factory_)
81
81
  end
82
-
83
-
82
+
83
+
84
84
  def create_from_proj4(geography_factory_, proj4_, opts_={})
85
85
  projection_factory_ = Cartesian.preferred_factory(:proj4 => proj4_,
86
86
  :coord_sys => opts_[:coord_sys], :srid => opts_[:srid],
@@ -92,14 +92,14 @@ module RGeo
92
92
  :wkb_parser => opts_[:wkb_parser], :wkb_generator => opts_[:wkb_generator])
93
93
  new(geography_factory_, projection_factory_)
94
94
  end
95
-
96
-
95
+
96
+
97
97
  end
98
-
99
-
98
+
99
+
100
100
  end
101
-
102
-
101
+
102
+
103
103
  end
104
-
104
+
105
105
  end
@@ -1,15 +1,15 @@
1
1
  # -----------------------------------------------------------------------------
2
- #
2
+ #
3
3
  # Projtected geographic feature classes
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
@@ -35,26 +35,26 @@
35
35
 
36
36
 
37
37
  module RGeo
38
-
38
+
39
39
  module Geographic
40
-
41
-
40
+
41
+
42
42
  class ProjectedPointImpl # :nodoc:
43
-
44
-
43
+
44
+
45
45
  include Feature::Point
46
46
  include ImplHelper::BasicGeometryMethods
47
47
  include ImplHelper::BasicPointMethods
48
48
  include ProjectedGeometryMethods
49
-
50
-
49
+
50
+
51
51
  def _validate_geometry
52
52
  @y = 85.0511287 if @y > 85.0511287
53
53
  @y = -85.0511287 if @y < -85.0511287
54
54
  super
55
55
  end
56
-
57
-
56
+
57
+
58
58
  def canonical_x
59
59
  x_ = @x % 360.0
60
60
  x_ -= 360.0 if x_ >= 180.0
@@ -62,8 +62,8 @@ module RGeo
62
62
  end
63
63
  alias_method :canonical_longitude, :canonical_x
64
64
  alias_method :canonical_lon, :canonical_x
65
-
66
-
65
+
66
+
67
67
  def canonical_point
68
68
  if @x >= -180.0 && @x < 180.0
69
69
  self
@@ -71,40 +71,40 @@ module RGeo
71
71
  PointImpl.new(@factory, canonical_x, @y)
72
72
  end
73
73
  end
74
-
75
-
74
+
75
+
76
76
  alias_method :longitude, :x
77
77
  alias_method :lon, :x
78
78
  alias_method :latitude, :y
79
79
  alias_method :lat, :y
80
-
81
-
80
+
81
+
82
82
  Feature::MixinCollection::GLOBAL.for_type(Feature::Point).include_in_class(self, true)
83
-
84
-
83
+
84
+
85
85
  end
86
-
87
-
86
+
87
+
88
88
  class ProjectedLineStringImpl # :nodoc:
89
-
90
-
89
+
90
+
91
91
  include Feature::LineString
92
92
  include ImplHelper::BasicGeometryMethods
93
93
  include ImplHelper::BasicLineStringMethods
94
94
  include ProjectedGeometryMethods
95
95
  include ProjectedNCurveMethods
96
96
  include ProjectedLineStringMethods
97
-
98
-
97
+
98
+
99
99
  Feature::MixinCollection::GLOBAL.for_type(Feature::LineString).include_in_class(self, true)
100
-
101
-
100
+
101
+
102
102
  end
103
-
104
-
103
+
104
+
105
105
  class ProjectedLinearRingImpl # :nodoc:
106
-
107
-
106
+
107
+
108
108
  include Feature::LinearRing
109
109
  include ImplHelper::BasicGeometryMethods
110
110
  include ImplHelper::BasicLineStringMethods
@@ -112,17 +112,17 @@ module RGeo
112
112
  include ProjectedGeometryMethods
113
113
  include ProjectedNCurveMethods
114
114
  include ProjectedLineStringMethods
115
-
116
-
115
+
116
+
117
117
  Feature::MixinCollection::GLOBAL.for_type(Feature::LinearRing).include_in_class(self, true)
118
-
119
-
118
+
119
+
120
120
  end
121
-
122
-
121
+
122
+
123
123
  class ProjectedLineImpl # :nodoc:
124
-
125
-
124
+
125
+
126
126
  include Feature::Line
127
127
  include ImplHelper::BasicGeometryMethods
128
128
  include ImplHelper::BasicLineStringMethods
@@ -130,111 +130,111 @@ module RGeo
130
130
  include ProjectedGeometryMethods
131
131
  include ProjectedNCurveMethods
132
132
  include ProjectedLineStringMethods
133
-
134
-
133
+
134
+
135
135
  Feature::MixinCollection::GLOBAL.for_type(Feature::Line).include_in_class(self, true)
136
-
137
-
136
+
137
+
138
138
  end
139
-
140
-
139
+
140
+
141
141
  class ProjectedPolygonImpl # :nodoc:
142
-
143
-
142
+
143
+
144
144
  include Feature::Polygon
145
145
  include ImplHelper::BasicGeometryMethods
146
146
  include ImplHelper::BasicPolygonMethods
147
147
  include ProjectedGeometryMethods
148
148
  include ProjectedNSurfaceMethods
149
-
150
-
149
+
150
+
151
151
  def _validate_geometry
152
152
  super
153
153
  unless projection
154
154
  raise Error::InvalidGeometry, 'Polygon failed assertions'
155
155
  end
156
156
  end
157
-
158
-
157
+
158
+
159
159
  Feature::MixinCollection::GLOBAL.for_type(Feature::Polygon).include_in_class(self, true)
160
-
161
-
160
+
161
+
162
162
  end
163
-
164
-
163
+
164
+
165
165
  class ProjectedGeometryCollectionImpl # :nodoc:
166
-
167
-
166
+
167
+
168
168
  include Feature::GeometryCollection
169
169
  include ImplHelper::BasicGeometryMethods
170
170
  include ImplHelper::BasicGeometryCollectionMethods
171
171
  include ProjectedGeometryMethods
172
-
173
-
172
+
173
+
174
174
  Feature::MixinCollection::GLOBAL.for_type(Feature::GeometryCollection).include_in_class(self, true)
175
-
176
-
175
+
176
+
177
177
  end
178
-
179
-
178
+
179
+
180
180
  class ProjectedMultiPointImpl # :nodoc:
181
-
182
-
181
+
182
+
183
183
  include Feature::MultiPoint
184
184
  include ImplHelper::BasicGeometryMethods
185
185
  include ImplHelper::BasicGeometryCollectionMethods
186
186
  include ImplHelper::BasicMultiPointMethods
187
187
  include ProjectedGeometryMethods
188
-
189
-
188
+
189
+
190
190
  Feature::MixinCollection::GLOBAL.for_type(Feature::MultiPoint).include_in_class(self, true)
191
-
192
-
191
+
192
+
193
193
  end
194
-
195
-
194
+
195
+
196
196
  class ProjectedMultiLineStringImpl # :nodoc:
197
-
198
-
197
+
198
+
199
199
  include Feature::MultiLineString
200
200
  include ImplHelper::BasicGeometryMethods
201
201
  include ImplHelper::BasicGeometryCollectionMethods
202
202
  include ImplHelper::BasicMultiLineStringMethods
203
203
  include ProjectedGeometryMethods
204
204
  include ProjectedNCurveMethods
205
-
206
-
205
+
206
+
207
207
  Feature::MixinCollection::GLOBAL.for_type(Feature::MultiLineString).include_in_class(self, true)
208
-
209
-
208
+
209
+
210
210
  end
211
-
212
-
211
+
212
+
213
213
  class ProjectedMultiPolygonImpl # :nodoc:
214
-
215
-
214
+
215
+
216
216
  include Feature::MultiPolygon
217
217
  include ImplHelper::BasicGeometryMethods
218
218
  include ImplHelper::BasicGeometryCollectionMethods
219
219
  include ImplHelper::BasicMultiPolygonMethods
220
220
  include ProjectedGeometryMethods
221
221
  include ProjectedNSurfaceMethods
222
-
223
-
222
+
223
+
224
224
  def _validate_geometry
225
225
  super
226
226
  unless projection
227
227
  raise Error::InvalidGeometry, 'MultiPolygon failed assertions'
228
228
  end
229
229
  end
230
-
231
-
230
+
231
+
232
232
  Feature::MixinCollection::GLOBAL.for_type(Feature::MultiPolygon).include_in_class(self, true)
233
-
234
-
233
+
234
+
235
235
  end
236
-
237
-
236
+
237
+
238
238
  end
239
-
239
+
240
240
  end
@@ -1,15 +1,15 @@
1
1
  # -----------------------------------------------------------------------------
2
- #
2
+ #
3
3
  # Projected geographic common method definitions
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
@@ -35,144 +35,144 @@
35
35
 
36
36
 
37
37
  module RGeo
38
-
38
+
39
39
  module Geographic
40
-
41
-
40
+
41
+
42
42
  module ProjectedGeometryMethods # :nodoc:
43
-
44
-
43
+
44
+
45
45
  def srid
46
46
  factory.srid
47
47
  end
48
-
49
-
48
+
49
+
50
50
  def projection
51
51
  unless defined?(@projection)
52
52
  @projection = factory.project(self)
53
53
  end
54
54
  @projection
55
55
  end
56
-
57
-
56
+
57
+
58
58
  def envelope
59
59
  factory.unproject(projection.envelope)
60
60
  end
61
-
62
-
61
+
62
+
63
63
  def is_empty?
64
64
  projection.is_empty?
65
65
  end
66
-
67
-
66
+
67
+
68
68
  def is_simple?
69
69
  projection.is_simple?
70
70
  end
71
-
72
-
71
+
72
+
73
73
  def boundary
74
74
  boundary_ = projection.boundary
75
75
  boundary_ ? factory.unproject(boundary_) : nil
76
76
  end
77
-
78
-
77
+
78
+
79
79
  def equals?(rhs_)
80
80
  projection.equals?(Feature.cast(rhs_, factory).projection)
81
81
  end
82
-
83
-
82
+
83
+
84
84
  def disjoint?(rhs_)
85
85
  projection.disjoint?(Feature.cast(rhs_, factory).projection)
86
86
  end
87
-
88
-
87
+
88
+
89
89
  def intersects?(rhs_)
90
90
  projection.intersects?(Feature.cast(rhs_, factory).projection)
91
91
  end
92
-
93
-
92
+
93
+
94
94
  def touches?(rhs_)
95
95
  projection.touches?(Feature.cast(rhs_, factory).projection)
96
96
  end
97
-
98
-
97
+
98
+
99
99
  def crosses?(rhs_)
100
100
  projection.crosses?(Feature.cast(rhs_, factory).projection)
101
101
  end
102
-
103
-
102
+
103
+
104
104
  def within?(rhs_)
105
105
  projection.within?(Feature.cast(rhs_, factory).projection)
106
106
  end
107
-
108
-
107
+
108
+
109
109
  def contains?(rhs_)
110
110
  projection.contains?(Feature.cast(rhs_, factory).projection)
111
111
  end
112
-
113
-
112
+
113
+
114
114
  def overlaps?(rhs_)
115
115
  projection.overlaps?(Feature.cast(rhs_, factory).projection)
116
116
  end
117
-
118
-
117
+
118
+
119
119
  def relate(rhs_, pattern_)
120
120
  projection.relate(Feature.cast(rhs_, factory).projection, pattern_)
121
121
  end
122
-
123
-
122
+
123
+
124
124
  def distance(rhs_)
125
125
  projection.distance(Feature.cast(rhs_, factory).projection)
126
126
  end
127
-
128
-
127
+
128
+
129
129
  def buffer(distance_)
130
130
  factory.unproject(projection.buffer(distance_))
131
131
  end
132
-
133
-
132
+
133
+
134
134
  def convex_hull
135
135
  factory.unproject(projection.convex_hull)
136
136
  end
137
-
138
-
137
+
138
+
139
139
  def intersection(rhs_)
140
140
  factory.unproject(projection.intersection(Feature.cast(rhs_, factory).projection))
141
141
  end
142
-
143
-
142
+
143
+
144
144
  def union(rhs_)
145
145
  factory.unproject(projection.union(Feature.cast(rhs_, factory).projection))
146
146
  end
147
-
148
-
147
+
148
+
149
149
  def difference(rhs_)
150
150
  factory.unproject(projection.difference(Feature.cast(rhs_, factory).projection))
151
151
  end
152
-
153
-
152
+
153
+
154
154
  def sym_difference(rhs_)
155
155
  factory.unproject(projection.sym_difference(Feature.cast(rhs_, factory).projection))
156
156
  end
157
-
158
-
157
+
158
+
159
159
  end
160
-
161
-
160
+
161
+
162
162
  module ProjectedNCurveMethods # :nodoc:
163
-
164
-
163
+
164
+
165
165
  def length
166
166
  projection.length
167
167
  end
168
-
169
-
168
+
169
+
170
170
  end
171
-
172
-
171
+
172
+
173
173
  module ProjectedLineStringMethods # :nodoc:
174
-
175
-
174
+
175
+
176
176
  def _validate_geometry
177
177
  size_ = @points.size
178
178
  if size_ > 1
@@ -198,32 +198,32 @@ module RGeo
198
198
  end
199
199
  super
200
200
  end
201
-
202
-
201
+
202
+
203
203
  end
204
-
205
-
204
+
205
+
206
206
  module ProjectedNSurfaceMethods # :nodoc:
207
-
208
-
207
+
208
+
209
209
  def area
210
210
  projection.area
211
211
  end
212
-
213
-
212
+
213
+
214
214
  def centroid
215
215
  factory.unproject(projection.centroid)
216
216
  end
217
-
218
-
217
+
218
+
219
219
  def point_on_surface
220
220
  factory.unproject(projection.point_on_surface)
221
221
  end
222
-
223
-
222
+
223
+
224
224
  end
225
-
226
-
225
+
226
+
227
227
  end
228
-
228
+
229
229
  end