rgeo 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -203,7 +203,7 @@ module RGeo
203
203
  end
204
204
 
205
205
 
206
- # Adjusts the extents of this bounding box to encomass the given
206
+ # Adjusts the extents of this bounding box to encompass the given
207
207
  # object, which may be a geometry or another bounding box.
208
208
  # Returns self.
209
209
 
@@ -55,11 +55,12 @@ module RGeo
55
55
  #
56
56
  # Factory is defined as a module and is provided primarily for the
57
57
  # sake of documentation. Implementations need not necessarily include
58
- # this module itself. Therefore, you should not depend on the
59
- # kind_of? method to check type. However, to support testing for
60
- # factory-ness, the Factory::Instance submodule is provided. All
61
- # factory implementation classes MUST include Factory::Instance, and
62
- # you may use it in kind_of?, ===, and case-when constructs.
58
+ # this module itself. Therefore, you should not depend on the result
59
+ # of <tt>is_a?(Factory)</tt> to check type. However, to support
60
+ # testing for factory-ness, the <tt>Factory::Instance</tt> submodule
61
+ # is provided. All factory implementation classes MUST include
62
+ # <tt>Factory::Instance</tt>, and you may use it in <tt>is_a?</tt>,
63
+ # <tt>===</tt>, and case-when constructs.
63
64
 
64
65
  module Factory
65
66
 
@@ -96,7 +97,7 @@ module RGeo
96
97
  # coordinate, and the Point#z method is available.
97
98
  # [<tt>:has_m_coordinate</tt>]
98
99
  # Set to true if geometries created by this factory include a M
99
- # coordinate, and the Point#z method is available.
100
+ # coordinate, and the Point#m method is available.
100
101
  # [<tt>:is_cartesian</tt>]
101
102
  # Set to true if this Factory guarantees that it operates in
102
103
  # Cartesian geometry. If false or nil, no such guarantee is made,
@@ -57,9 +57,10 @@ module RGeo
57
57
  #
58
58
  # Geometry is defined as a module and is provided primarily for the
59
59
  # sake of documentation. Implementations need not necessarily include
60
- # this module itself. Therefore, you should not depend on the
61
- # kind_of? method to check type. Instead, use the provided check_type
62
- # class method (or === operator) defined in the Type module.
60
+ # this module itself. Therefore, you should not depend on the result
61
+ # of <tt>is_a?(Geometry)</tt> to check type. Instead, use the
62
+ # provided check_type class method (or === operator) defined in the
63
+ # Type module.
63
64
  #
64
65
  # Some implementations may support higher dimensional objects or
65
66
  # coordinate systems, despite the limits of the SFS.
@@ -185,7 +185,7 @@ module RGeo
185
185
  if p_x_ < last_x_ - 180.0
186
186
  p_x_ += 360.0 while p_x_ < last_x_ - 180.0
187
187
  elsif p_x_ > last_x_ + 180.0
188
- p_x_ +- 360.0 while p_x_ > last_x_ + 180.0
188
+ p_x_ -= 360.0 while p_x_ > last_x_ + 180.0
189
189
  else
190
190
  changed_ = false
191
191
  end
@@ -194,7 +194,7 @@ module RGeo
194
194
  # the default) generates a prepared geometry the second time an
195
195
  # operation that would benefit from it is called. The latter
196
196
  # never automatically generates a prepared geometry (unless you
197
- # generate on explicitly using the <tt>prepare!</tt> method).
197
+ # generate one explicitly using the <tt>prepare!</tt> method).
198
198
  # Currently, prepared geometries are supported under CAPI but
199
199
  # not FFI.
200
200
 
@@ -380,7 +380,13 @@ module RGeo
380
380
  _expect_token_type(:begin)
381
381
  _next_token
382
382
  loop do
383
- points_ << _parse_point
383
+ uses_paren_ = @cur_token == :begin
384
+ _next_token if uses_paren_
385
+ points_ << _parse_coords
386
+ if uses_paren_
387
+ _expect_token_type(:end)
388
+ _next_token
389
+ end
384
390
  break if @cur_token == :end
385
391
  _expect_token_type(:comma)
386
392
  _next_token
@@ -360,6 +360,19 @@ module RGeo
360
360
  end
361
361
 
362
362
 
363
+ def test_multipoint_without_parens
364
+ # This syntax isn't strictly allowed by the spec, but apparently
365
+ # it does get used occasionally, so we do support parsing it.
366
+ factory_ = ::RGeo::Cartesian.preferred_factory
367
+ parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
368
+ obj_ = parser_.parse('MULTIPOINT(1 2, 0 3)')
369
+ assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
370
+ assert_equal(2, obj_.num_geometries)
371
+ assert_equal(1, obj_[0].x)
372
+ assert_equal(3, obj_[1].y)
373
+ end
374
+
375
+
363
376
  def test_multipoint_empty
364
377
  factory_ = ::RGeo::Cartesian.preferred_factory
365
378
  parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgeo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-12 00:00:00.000000000 Z
12
+ date: 2011-12-19 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: RGeo is a geospatial data library for Ruby. It provides an implementation
15
15
  of the Open Geospatial Consortium's Simple Features Specification, used by most
@@ -213,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
213
  version: 1.3.1
214
214
  requirements: []
215
215
  rubyforge_project: virtuoso
216
- rubygems_version: 1.8.7
216
+ rubygems_version: 1.8.12
217
217
  signing_key:
218
218
  specification_version: 3
219
219
  summary: RGeo is a geospatial data library for Ruby.