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
@@ -5,145 +5,114 @@
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
7
  module RGeo
8
-
9
8
  module Geographic
10
-
11
-
12
- module ProjectedGeometryMethods # :nodoc:
13
-
14
-
9
+ module ProjectedGeometryMethods # :nodoc:
15
10
  def srid
16
11
  factory.srid
17
12
  end
18
13
 
19
-
20
14
  def projection
21
- unless defined?(@projection)
22
- @projection = factory.project(self)
23
- end
15
+ @projection = factory.project(self) unless defined?(@projection)
24
16
  @projection
25
17
  end
26
18
 
27
-
28
19
  def envelope
29
20
  factory.unproject(projection.envelope)
30
21
  end
31
22
 
32
-
33
23
  def is_empty?
34
24
  projection.is_empty?
35
25
  end
36
26
 
37
-
38
27
  def is_simple?
39
28
  projection.is_simple?
40
29
  end
41
30
 
42
-
43
31
  def boundary
44
32
  boundary_ = projection.boundary
45
33
  boundary_ ? factory.unproject(boundary_) : nil
46
34
  end
47
35
 
48
-
49
36
  def equals?(rhs_)
50
37
  projection.equals?(Feature.cast(rhs_, factory).projection)
51
38
  end
52
39
 
53
-
54
40
  def disjoint?(rhs_)
55
41
  projection.disjoint?(Feature.cast(rhs_, factory).projection)
56
42
  end
57
43
 
58
-
59
44
  def intersects?(rhs_)
60
45
  projection.intersects?(Feature.cast(rhs_, factory).projection)
61
46
  end
62
47
 
63
-
64
48
  def touches?(rhs_)
65
49
  projection.touches?(Feature.cast(rhs_, factory).projection)
66
50
  end
67
51
 
68
-
69
52
  def crosses?(rhs_)
70
53
  projection.crosses?(Feature.cast(rhs_, factory).projection)
71
54
  end
72
55
 
73
-
74
56
  def within?(rhs_)
75
57
  projection.within?(Feature.cast(rhs_, factory).projection)
76
58
  end
77
59
 
78
-
79
60
  def contains?(rhs_)
80
61
  projection.contains?(Feature.cast(rhs_, factory).projection)
81
62
  end
82
63
 
83
-
84
64
  def overlaps?(rhs_)
85
65
  projection.overlaps?(Feature.cast(rhs_, factory).projection)
86
66
  end
87
67
 
88
-
89
68
  def relate(rhs_, pattern_)
90
69
  projection.relate(Feature.cast(rhs_, factory).projection, pattern_)
91
70
  end
92
71
 
93
-
94
72
  def distance(rhs_)
95
73
  projection.distance(Feature.cast(rhs_, factory).projection)
96
74
  end
97
75
 
98
-
99
76
  def buffer(distance_)
100
77
  factory.unproject(projection.buffer(distance_))
101
78
  end
102
-
103
-
79
+
80
+ def buffer_with_style(distance_, endCapStyle_, joinStyle_, mitreLimit_)
81
+ factory.unproject(projection.buffer_with_style(distance_, endCapStyle_, joinStyle_, mitreLimit_))
82
+ end
83
+
104
84
  def simplify(tolerance_)
105
85
  factory.unproject(projection.simplify(tolerance_))
106
86
  end
107
-
108
87
 
109
88
  def convex_hull
110
89
  factory.unproject(projection.convex_hull)
111
90
  end
112
91
 
113
-
114
92
  def intersection(rhs_)
115
93
  factory.unproject(projection.intersection(Feature.cast(rhs_, factory).projection))
116
94
  end
117
95
 
118
-
119
96
  def union(rhs_)
120
97
  factory.unproject(projection.union(Feature.cast(rhs_, factory).projection))
121
98
  end
122
99
 
123
-
124
100
  def difference(rhs_)
125
101
  factory.unproject(projection.difference(Feature.cast(rhs_, factory).projection))
126
102
  end
127
103
 
128
-
129
104
  def sym_difference(rhs_)
130
105
  factory.unproject(projection.sym_difference(Feature.cast(rhs_, factory).projection))
131
106
  end
132
-
133
-
134
107
  end
135
108
 
136
-
137
- module ProjectedPointMethods # :nodoc:
138
-
139
-
109
+ module ProjectedPointMethods # :nodoc:
140
110
  def _validate_geometry
141
111
  @y = 85.0511287 if @y > 85.0511287
142
112
  @y = -85.0511287 if @y < -85.0511287
143
113
  super
144
114
  end
145
115
 
146
-
147
116
  def canonical_x
148
117
  x_ = @x % 360.0
149
118
  x_ -= 360.0 if x_ > 180.0
@@ -152,7 +121,6 @@ module RGeo
152
121
  alias_method :canonical_longitude, :canonical_x
153
122
  alias_method :canonical_lon, :canonical_x
154
123
 
155
-
156
124
  def canonical_point
157
125
  if @x >= -180.0 && @x < 180.0
158
126
  self
@@ -161,7 +129,6 @@ module RGeo
161
129
  end
162
130
  end
163
131
 
164
-
165
132
  def self.included(klass_)
166
133
  klass_.module_eval do
167
134
  alias_method :longitude, :x
@@ -170,25 +137,15 @@ module RGeo
170
137
  alias_method :lat, :y
171
138
  end
172
139
  end
173
-
174
-
175
140
  end
176
141
 
177
-
178
- module ProjectedNCurveMethods # :nodoc:
179
-
180
-
142
+ module ProjectedNCurveMethods # :nodoc:
181
143
  def length
182
144
  projection.length
183
145
  end
184
-
185
-
186
146
  end
187
147
 
188
-
189
- module ProjectedLineStringMethods # :nodoc:
190
-
191
-
148
+ module ProjectedLineStringMethods # :nodoc:
192
149
  def _validate_geometry
193
150
  size_ = @points.size
194
151
  if size_ > 1
@@ -214,60 +171,38 @@ module RGeo
214
171
  end
215
172
  super
216
173
  end
217
-
218
-
219
174
  end
220
175
 
221
-
222
- module ProjectedNSurfaceMethods # :nodoc:
223
-
224
-
176
+ module ProjectedNSurfaceMethods # :nodoc:
225
177
  def area
226
178
  projection.area
227
179
  end
228
180
 
229
-
230
181
  def centroid
231
182
  factory.unproject(projection.centroid)
232
183
  end
233
184
 
234
-
235
185
  def point_on_surface
236
186
  factory.unproject(projection.point_on_surface)
237
187
  end
238
-
239
-
240
188
  end
241
189
 
242
-
243
- module ProjectedPolygonMethods # :nodoc:
244
-
245
-
190
+ module ProjectedPolygonMethods # :nodoc:
246
191
  def _validate_geometry
247
192
  super
248
193
  unless projection
249
- raise Error::InvalidGeometry, 'Polygon failed assertions'
194
+ raise Error::InvalidGeometry, "Polygon failed assertions"
250
195
  end
251
196
  end
252
-
253
-
254
197
  end
255
198
 
256
-
257
- module ProjectedMultiPolygonMethods # :nodoc:
258
-
259
-
199
+ module ProjectedMultiPolygonMethods # :nodoc:
260
200
  def _validate_geometry
261
201
  super
262
202
  unless projection
263
- raise Error::InvalidGeometry, 'MultiPolygon failed assertions'
203
+ raise Error::InvalidGeometry, "MultiPolygon failed assertions"
264
204
  end
265
205
  end
266
-
267
-
268
206
  end
269
-
270
-
271
207
  end
272
-
273
208
  end
@@ -5,10 +5,7 @@
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
7
  module RGeo
8
-
9
8
  module Geographic
10
-
11
-
12
9
  # This object represents an axis-aligned rectangle in a map projection
13
10
  # coordinate system. It is commonly used to specify the viewport for a
14
11
  # map visualization, an envelope in a projected coordinate system, or
@@ -16,8 +13,6 @@ module RGeo
16
13
  # that has a projection.
17
14
 
18
15
  class ProjectedWindow
19
-
20
-
21
16
  # Create a new ProjectedWindow given the Geographic::Factory, and the
22
17
  # x and y extents of the rectangle.
23
18
  #
@@ -28,7 +23,7 @@ module RGeo
28
23
  # Generally, you will not need to call this low-level constructor
29
24
  # directly. Instead, use one of the provided class methods.
30
25
 
31
- def initialize(factory_, x_min_, y_min_, x_max_, y_max_, opts_={})
26
+ def initialize(factory_, x_min_, y_min_, x_max_, y_max_, opts_ = {})
32
27
  @factory = factory_
33
28
  limits_ = opts_[:is_limits] ? nil : factory_.projection_limits_window
34
29
  wraps_ = factory_.projection_wraps?
@@ -59,65 +54,47 @@ module RGeo
59
54
  @y_max = y_max_
60
55
  end
61
56
 
62
-
63
- def to_s # :nodoc:
57
+ def to_s # :nodoc:
64
58
  "#<#{self.class}:0x#{object_id.to_s(16)} s=#{@y_min} w=#{@x_min} n=#{@y_max} e=#{@x_max}>"
65
59
  end
66
60
 
67
- def inspect # :nodoc:
61
+ def inspect # :nodoc:
68
62
  to_s
69
63
  end
70
64
 
71
-
72
- def eql?(obj_) # :nodoc:
73
- return false unless obj_.kind_of?(ProjectedWindow)
65
+ def eql?(obj_) # :nodoc:
66
+ return false unless obj_.is_a?(ProjectedWindow)
74
67
  @factory == obj_.factory && @x_min == obj_.x_min && @x_max == obj_.x_max &&
75
68
  @y_min = obj_.y_min && @y_max = obj_.y_max
76
69
  end
77
70
  alias_method :==, :eql?
78
71
 
79
- def hash # :nodoc:
72
+ def hash # :nodoc:
80
73
  @factory.hash + @x_min.hash + @x_max.hash + @y_min.hash + @y_max.hash
81
74
  end
82
75
 
83
-
84
76
  # Returns the Geographic::Factory associated with this window.
85
77
  # Note that this factory is the overall geography factory, not the
86
78
  # projected factory (which can be obtained by calling
87
79
  # Geographic::Factory#projection_factory on this factory).
88
80
 
89
- def factory
90
- @factory
91
- end
92
-
81
+ attr_reader :factory
93
82
 
94
83
  # Returns the lower limit in the x (easting) direction.
95
84
 
96
- def x_min
97
- @x_min
98
- end
99
-
85
+ attr_reader :x_min
100
86
 
101
87
  # Returns the upper limit in the x (easting) direction.
102
88
 
103
- def x_max
104
- @x_max
105
- end
106
-
89
+ attr_reader :x_max
107
90
 
108
91
  # Returns the lower limit in the y (northing) direction.
109
92
 
110
- def y_min
111
- @y_min
112
- end
113
-
93
+ attr_reader :y_min
114
94
 
115
95
  # Returns the upper limit in the y (northing) direction.
116
96
 
117
- def y_max
118
- @y_max
119
- end
120
-
97
+ attr_reader :y_max
121
98
 
122
99
  # Returns true if the projection wraps along the x axis, and this
123
100
  # rectangle crosses that seam.
@@ -126,26 +103,21 @@ module RGeo
126
103
  @x_max < @x_min
127
104
  end
128
105
 
129
-
130
106
  # Returns true if the rectangle has zero area.
131
107
 
132
108
  def degenerate?
133
109
  @x_min == @x_max || @y_min == @y_max
134
110
  end
135
111
 
136
-
137
112
  # Returns the width of the rectangle.
138
113
 
139
114
  def x_span
140
115
  span_ = @x_max - @x_min
141
- if span_ < 0
142
- span_ += @factory.projection_limits_window.x_span
143
- end
116
+ span_ += @factory.projection_limits_window.x_span if span_ < 0
144
117
  span_
145
118
  end
146
119
  alias_method :width, :x_span
147
120
 
148
-
149
121
  # Returns the height of the rectangle.
150
122
 
151
123
  def y_span
@@ -153,7 +125,6 @@ module RGeo
153
125
  end
154
126
  alias_method :height, :y_span
155
127
 
156
-
157
128
  # Returns a two-element array containing the x and y coordinates
158
129
  # of the center of the rectangle.
159
130
 
@@ -169,7 +140,6 @@ module RGeo
169
140
  [x_, y_]
170
141
  end
171
142
 
172
-
173
143
  # Returns the southwest corner of the rectangle in _unprojected_
174
144
  # (lat/lng) space, as a Feature::Point object.
175
145
 
@@ -177,7 +147,6 @@ module RGeo
177
147
  @sw ||= @factory.unproject(@factory.projection_factory.point(@x_min, @y_min))
178
148
  end
179
149
 
180
-
181
150
  # Returns the southeast corner of the rectangle in _unprojected_
182
151
  # (lat/lng) space, as a Feature::Point object.
183
152
 
@@ -185,7 +154,6 @@ module RGeo
185
154
  @se ||= @factory.unproject(@factory.projection_factory.point(@x_max, @y_min))
186
155
  end
187
156
 
188
-
189
157
  # Returns the northwest corner of the rectangle in _unprojected_
190
158
  # (lat/lng) space, as a Feature::Point object.
191
159
 
@@ -193,7 +161,6 @@ module RGeo
193
161
  @nw ||= @factory.unproject(@factory.projection_factory.point(@x_min, @y_max))
194
162
  end
195
163
 
196
-
197
164
  # Returns the northeast corner of the rectangle in _unprojected_
198
165
  # (lat/lng) space, as a Feature::Point object.
199
166
 
@@ -201,7 +168,6 @@ module RGeo
201
168
  @ne ||= @factory.unproject(@factory.projection_factory.point(@x_max, @y_max))
202
169
  end
203
170
 
204
-
205
171
  # Returns the center of the rectangle in _unprojected_
206
172
  # (lat/lng) space, as a Feature::Point object.
207
173
 
@@ -209,7 +175,6 @@ module RGeo
209
175
  @center ||= @factory.unproject(@factory.projection_factory.point(*center_xy))
210
176
  end
211
177
 
212
-
213
178
  # Returns a random point inside the rectangle in _unprojected_
214
179
  # (lat/lng) space, as a Feature::Point object.
215
180
 
@@ -221,7 +186,6 @@ module RGeo
221
186
  @factory.unproject(@factory.projection_factory.point(x_, y_))
222
187
  end
223
188
 
224
-
225
189
  # Returns true if the rectangle contains the given point, which
226
190
  # must be a Feature::Point in _unprojected_ (lat/lng) space.
227
191
 
@@ -244,7 +208,6 @@ module RGeo
244
208
  end
245
209
  end
246
210
 
247
-
248
211
  # Returns true if the given window is completely contained within
249
212
  # this window.
250
213
 
@@ -261,13 +224,12 @@ module RGeo
261
224
  end
262
225
  end
263
226
 
264
-
265
227
  # Returns a new window resulting from scaling this window by the
266
228
  # given factors, which must be floating-point values.
267
229
  # If y_factor is not explicitly given, it defaults to the same as
268
230
  # the x_factor.
269
231
 
270
- def scaled_by(x_factor_, y_factor_=nil)
232
+ def scaled_by(x_factor_, y_factor_ = nil)
271
233
  y_factor_ ||= x_factor_
272
234
  if x_factor_ != 1.0 || y_factor_ != 1.0
273
235
  x_, y_ = *center_xy
@@ -280,7 +242,6 @@ module RGeo
280
242
  end
281
243
  alias_method :*, :scaled_by
282
244
 
283
-
284
245
  # Returns a new window resulting from clamping this window to the
285
246
  # given minimum and maximum widths and heights, in the projected
286
247
  # coordinate system. The center of the resulting window is the
@@ -317,13 +278,12 @@ module RGeo
317
278
  end
318
279
  end
319
280
 
320
-
321
281
  # Returns a new window resulting from adding the given margin to
322
282
  # this window. If y_margin is not given, it defaults to the same
323
283
  # value as x_margin. Note that the margins may be negative to
324
284
  # indicate shrinking of the window.
325
285
 
326
- def with_margin(x_margin_, y_margin_=nil)
286
+ def with_margin(x_margin_, y_margin_ = nil)
327
287
  y_margin_ ||= x_margin_
328
288
  if x_margin_ != 0.0 || y_margin_ != 0.0
329
289
  ProjectedWindow.new(@factory, @x_min - x_margin_, @y_min - y_margin_,
@@ -333,10 +293,7 @@ module RGeo
333
293
  end
334
294
  end
335
295
 
336
-
337
296
  class << self
338
-
339
-
340
297
  # Creates a new window whose coordinates are the given points,
341
298
  # which must be Feature::Point objects in unprojected (lat/lng)
342
299
  # space.
@@ -348,14 +305,13 @@ module RGeo
348
305
  ProjectedWindow.new(factory_, psw_.x, psw_.y, pne_.x, pne_.y)
349
306
  end
350
307
 
351
-
352
308
  # Creates a new window that surrounds the given point with the
353
309
  # given margin. The point must be a Feature::Point object in
354
310
  # unprojected (lat/lng) space, while the margins are numbers in
355
311
  # projected space. The y_margin may be given as nil, in which
356
312
  # case it is set to the same as the x_margin.
357
313
 
358
- def surrounding_point(point_, x_margin_=nil, y_margin_=nil)
314
+ def surrounding_point(point_, x_margin_ = nil, y_margin_ = nil)
359
315
  x_margin_ ||= 0.0
360
316
  y_margin_ ||= x_margin_
361
317
  factory_ = point_.factory
@@ -364,7 +320,6 @@ module RGeo
364
320
  projection_.x + x_margin_, projection_.y + y_margin_)
365
321
  end
366
322
 
367
-
368
323
  # Creates a new window that contains all of the given points.
369
324
  # which must be Feature::Point objects in unprojected (lat/lng)
370
325
  # space.
@@ -422,14 +377,7 @@ module RGeo
422
377
  end
423
378
  ProjectedWindow.new(factory_, x_min_, y_min_, x_max_, y_max_)
424
379
  end
425
-
426
-
427
380
  end
428
-
429
-
430
381
  end
431
-
432
-
433
382
  end
434
-
435
383
  end