rgeo 0.3.18 → 0.3.19

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.3.19 / 2012-09-20
2
+
3
+ * The Geos factories, as well as the projected geographic convenience factories such as simple_mercator, now support the :uses_lenient_assertions option.
4
+ * RGeo::Geographic::ProjectedWindow#height was incorrectly aliased to x_span rather than y_span. Fixed.
5
+
1
6
  === 0.3.18 / 2012-09-19
2
7
 
3
8
  * The coordinate system WKT parser now recognizes the nonstandard "EXTENSION" node. This node is not part of the WKT, but it is present in some data sets, including the coordinate systems shipped with Proj 4.8, so we now support it.
data/Version CHANGED
@@ -1 +1 @@
1
- 0.3.18
1
+ 0.3.19
@@ -122,6 +122,8 @@ module RGeo
122
122
  alias_method :==, :eql?
123
123
 
124
124
 
125
+ # Standard hash code
126
+
125
127
  def hash
126
128
  @hash ||= [@srid, @has_z, @has_m, @proj4].hash
127
129
  end
@@ -178,7 +178,9 @@ module RGeo
178
178
  class Base
179
179
 
180
180
 
181
- def inspect # :nodoc:
181
+ # Standard object inspection output
182
+
183
+ def inspect
182
184
  "#<#{self.class}:0x#{object_id.to_s(16)} #{to_wkt}>"
183
185
  end
184
186
 
@@ -192,6 +194,8 @@ module RGeo
192
194
  alias_method :==, :eql?
193
195
 
194
196
 
197
+ # Standard hash code
198
+
195
199
  def hash
196
200
  @hash ||= self.to_wkt.hash
197
201
  end
@@ -50,7 +50,7 @@ module RGeo
50
50
  end
51
51
 
52
52
 
53
- def parse(containing_type_=nil)
53
+ def parse(containing_type_=nil) # :nodoc:
54
54
  if @cur_token.kind_of?(QuotedString) ||
55
55
  @cur_token.kind_of?(::Numeric) ||
56
56
  (containing_type_ == 'AXIS' && @cur_token.kind_of?(TypeString))
@@ -231,12 +231,12 @@ module RGeo
231
231
 
232
232
  class AuthorityClause # :nodoc:
233
233
 
234
- def initialize(name_, code_)
234
+ def initialize(name_, code_) # :nodoc:
235
235
  @name = name_
236
236
  @code = code_
237
237
  end
238
238
 
239
- def to_a
239
+ def to_a # :nodoc:
240
240
  [@name, @code]
241
241
  end
242
242
 
@@ -245,28 +245,28 @@ module RGeo
245
245
 
246
246
  class ExtensionClause # :nodoc:
247
247
 
248
- def initialize(key_, value_)
248
+ def initialize(key_, value_) # :nodoc:
249
249
  @key = key_
250
250
  @value = value_
251
251
  end
252
252
 
253
- attr_reader :key
254
- attr_reader :value
253
+ attr_reader :key # :nodoc:
254
+ attr_reader :value # :nodoc:
255
255
 
256
256
  end
257
257
 
258
258
 
259
259
  class ArgumentList # :nodoc:
260
260
 
261
- def initialize
261
+ def initialize # :nodoc:
262
262
  @values = []
263
263
  end
264
264
 
265
- def <<(value_)
265
+ def <<(value_) # :nodoc:
266
266
  @values << value_
267
267
  end
268
268
 
269
- def assert_empty
269
+ def assert_empty # :nodoc:
270
270
  if @values.size > 0
271
271
  names_ = @values.map do |val_|
272
272
  val_.kind_of?(Base) ? val_._wkt_typename : val_.inspect
@@ -275,7 +275,7 @@ module RGeo
275
275
  end
276
276
  end
277
277
 
278
- def find_first(klass_)
278
+ def find_first(klass_) # :nodoc:
279
279
  @values.each_with_index do |val_, index_|
280
280
  if val_.kind_of?(klass_)
281
281
  @values.slice!(index_)
@@ -285,7 +285,7 @@ module RGeo
285
285
  nil
286
286
  end
287
287
 
288
- def find_all(klass_)
288
+ def find_all(klass_) # :nodoc:
289
289
  results_ = []
290
290
  nvalues_ = []
291
291
  @values.each do |val_|
@@ -299,13 +299,13 @@ module RGeo
299
299
  results_
300
300
  end
301
301
 
302
- def create_optionals
302
+ def create_optionals # :nodoc:
303
303
  hash_ = {}
304
304
  find_all(ExtensionClause).each{ |ec_| hash_[ec_.key] = ec_.value }
305
305
  (find_first(AuthorityClause) || [nil, nil]).to_a + [nil, nil, nil, hash_]
306
306
  end
307
307
 
308
- def shift(klass_=nil)
308
+ def shift(klass_=nil) # :nodoc:
309
309
  val_ = @values.shift
310
310
  unless val_
311
311
  raise Error::ParseError, "No arguments left... expected #{klass_}"
@@ -127,6 +127,8 @@ module RGeo
127
127
  alias_method :==, :eql?
128
128
 
129
129
 
130
+ # Standard hash code
131
+
130
132
  def hash
131
133
  @hash ||= [@impl_prefix, @support_z, @support_m, @proj4].hash
132
134
  end
@@ -259,6 +259,7 @@ module RGeo
259
259
  projector_ = Geographic::SimpleMercatorProjector.new(factory_,
260
260
  :buffer_resolution => opts_[:buffer_resolution],
261
261
  :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions],
262
+ :uses_lenient_assertions => opts_[:uses_lenient_assertions],
262
263
  :has_z_coordinate => opts_[:has_z_coordinate],
263
264
  :has_m_coordinate => opts_[:has_m_coordinate])
264
265
  factory_._set_projector(projector_)
@@ -482,6 +483,7 @@ module RGeo
482
483
  :coord_sys => projection_coord_sys_,
483
484
  :buffer_resolution => opts_[:buffer_resolution],
484
485
  :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions],
486
+ :uses_lenient_assertions => opts_[:uses_lenient_assertions],
485
487
  :has_z_coordinate => opts_[:has_z_coordinate],
486
488
  :has_m_coordinate => opts_[:has_m_coordinate],
487
489
  :wkt_parser => opts_[:wkt_parser], :wkt_generator => opts_[:wkt_generator],
@@ -92,6 +92,7 @@ module RGeo
92
92
  :coord_sys => opts_[:coord_sys], :srid => opts_[:srid],
93
93
  :buffer_resolution => opts_[:buffer_resolution],
94
94
  :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions],
95
+ :uses_lenient_assertions => opts_[:uses_lenient_assertions],
95
96
  :has_z_coordinate => opts_[:has_z_coordinate],
96
97
  :has_m_coordinate => opts_[:has_m_coordinate],
97
98
  :wkt_parser => opts_[:wkt_parser], :wkt_generator => opts_[:wkt_generator],
@@ -181,7 +181,7 @@ module RGeo
181
181
  def y_span
182
182
  @y_max - @y_min
183
183
  end
184
- alias_method :height, :x_span
184
+ alias_method :height, :y_span
185
185
 
186
186
 
187
187
  # Returns a two-element array containing the x and y coordinates
@@ -51,6 +51,7 @@ module RGeo
51
51
  :coord_sys => SimpleMercatorProjector._coordsys_3785,
52
52
  :buffer_resolution => opts_[:buffer_resolution],
53
53
  :lenient_multi_polygon_assertions => opts_[:lenient_multi_polygon_assertions],
54
+ :uses_lenient_assertions => opts_[:uses_lenient_assertions],
54
55
  :has_z_coordinate => opts_[:has_z_coordinate],
55
56
  :has_m_coordinate => opts_[:has_m_coordinate])
56
57
  end
@@ -181,7 +181,7 @@ module RGeo
181
181
  end
182
182
 
183
183
 
184
- module SphericalMultiLineStringMethods
184
+ module SphericalMultiLineStringMethods # :nodoc:
185
185
 
186
186
 
187
187
  def length
@@ -61,7 +61,7 @@ module RGeo
61
61
 
62
62
  # Get flags to pass to the C extension
63
63
  flags_ = 0
64
- flags_ |= 1 if opts_[:lenient_multi_polygon_assertions] || opts_[:uses_lenient_multi_polygon_assertions]
64
+ flags_ |= 1 if opts_[:uses_lenient_assertions] || opts_[:lenient_multi_polygon_assertions] || opts_[:uses_lenient_multi_polygon_assertions]
65
65
  flags_ |= 2 if opts_[:has_z_coordinate]
66
66
  flags_ |= 4 if opts_[:has_m_coordinate]
67
67
  if flags_ & 6 == 6
@@ -150,7 +150,9 @@ module RGeo
150
150
  end
151
151
 
152
152
 
153
- def inspect # :nodoc:
153
+ # Standard object inspection output
154
+
155
+ def inspect
154
156
  "#<#{self.class}:0x#{object_id.to_s(16)} srid=#{_srid} bufres=#{_buffer_resolution} flags=#{_flags}>"
155
157
  end
156
158
 
@@ -165,6 +167,8 @@ module RGeo
165
167
  alias_method :==, :eql?
166
168
 
167
169
 
170
+ # Standard hash code
171
+
168
172
  def hash
169
173
  @hash ||= [_srid, _buffer_resolution, _flags, _proj4].hash
170
174
  end
@@ -54,8 +54,8 @@ module RGeo
54
54
 
55
55
  def initialize(opts_={})
56
56
  # Main flags
57
- @uses_lenient_multi_polygon_assertions = opts_[:lenient_multi_polygon_assertions] ||
58
- opts_[:uses_lenient_multi_polygon_assertions]
57
+ @uses_lenient_multi_polygon_assertions = opts_[:uses_lenient_assertions] ||
58
+ opts_[:lenient_multi_polygon_assertions] || opts_[:uses_lenient_multi_polygon_assertions]
59
59
  @has_z = opts_[:has_z_coordinate] ? true : false
60
60
  @has_m = opts_[:has_m_coordinate] ? true : false
61
61
  if @has_z && @has_m
@@ -144,7 +144,9 @@ module RGeo
144
144
  end
145
145
 
146
146
 
147
- def inspect # :nodoc:
147
+ # Standard object inspection output
148
+
149
+ def inspect
148
150
  "#<#{self.class}:0x#{object_id.to_s(16)} srid=#{srid}>"
149
151
  end
150
152
 
@@ -161,6 +163,8 @@ module RGeo
161
163
  alias_method :==, :eql?
162
164
 
163
165
 
166
+ # Standard hash code
167
+
164
168
  def hash
165
169
  @hash ||= [@srid, @has_z, @has_m, @buffer_resolution, @proj4].hash
166
170
  end
@@ -287,6 +287,8 @@ module RGeo
287
287
  alias_method :==, :eql?
288
288
 
289
289
 
290
+ # Standard hash code
291
+
290
292
  def hash
291
293
  @hash ||= [@zfactory, @mfactory].hash
292
294
  end
data/lib/rgeo/geos.rb CHANGED
@@ -63,48 +63,54 @@ end
63
63
 
64
64
  # :stopdoc:
65
65
 
66
- # Implementation files
67
- require 'rgeo/geos/utils'
68
- require 'rgeo/geos/interface'
69
- begin
70
- require 'rgeo/geos/geos_c_impl'
71
- rescue ::LoadError; end
72
- ::RGeo::Geos::CAPI_SUPPORTED = ::RGeo::Geos.const_defined?(:CAPIGeometryMethods)
73
- if ::RGeo::Geos::CAPI_SUPPORTED
74
- require 'rgeo/geos/capi_feature_classes'
75
- require 'rgeo/geos/capi_factory'
76
- end
77
- require 'rgeo/geos/ffi_feature_methods'
78
- require 'rgeo/geos/ffi_feature_classes'
79
- require 'rgeo/geos/ffi_factory'
80
- require 'rgeo/geos/zm_feature_methods'
81
- require 'rgeo/geos/zm_feature_classes'
82
- require 'rgeo/geos/zm_factory'
83
-
84
- # Determine ffi support.
85
- begin
86
- require 'ffi-geos'
87
- # An additional check to make sure FFI loaded okay. This can fail on
88
- # some versions of ffi-geos and some versions of Rubinius.
89
- raise 'Problem loading FFI' unless ::FFI::AutoPointer
90
- ::RGeo::Geos::FFI_SUPPORTED = true
91
- ::RGeo::Geos::FFI_SUPPORT_EXCEPTION = nil
92
- rescue ::LoadError => ex_
93
- ::RGeo::Geos::FFI_SUPPORTED = false
94
- ::RGeo::Geos::FFI_SUPPORT_EXCEPTION = ex_
95
- rescue => ex_
96
- ::RGeo::Geos::FFI_SUPPORTED = false
97
- ::RGeo::Geos::FFI_SUPPORT_EXCEPTION = ex_
98
- end
66
+ module RGeo
67
+ module Geos
99
68
 
100
- # Determine preferred native interface
101
- if ::RGeo::Geos::CAPI_SUPPORTED
102
- ::RGeo::Geos.preferred_native_interface = :capi
103
- elsif ::RGeo::Geos::FFI_SUPPORTED
104
- ::RGeo::Geos.preferred_native_interface = :ffi
105
- end
69
+ # Implementation files
70
+ require 'rgeo/geos/utils'
71
+ require 'rgeo/geos/interface'
72
+ begin
73
+ require 'rgeo/geos/geos_c_impl'
74
+ rescue ::LoadError; end
75
+ CAPI_SUPPORTED = ::RGeo::Geos.const_defined?(:CAPIGeometryMethods)
76
+ if CAPI_SUPPORTED
77
+ require 'rgeo/geos/capi_feature_classes'
78
+ require 'rgeo/geos/capi_factory'
79
+ end
80
+ require 'rgeo/geos/ffi_feature_methods'
81
+ require 'rgeo/geos/ffi_feature_classes'
82
+ require 'rgeo/geos/ffi_factory'
83
+ require 'rgeo/geos/zm_feature_methods'
84
+ require 'rgeo/geos/zm_feature_classes'
85
+ require 'rgeo/geos/zm_factory'
106
86
 
107
- # Init internal utilities
108
- ::RGeo::Geos::Utils._init
87
+ # Determine ffi support.
88
+ begin
89
+ require 'ffi-geos'
90
+ # An additional check to make sure FFI loaded okay. This can fail on
91
+ # some versions of ffi-geos and some versions of Rubinius.
92
+ raise 'Problem loading FFI' unless ::FFI::AutoPointer
93
+ FFI_SUPPORTED = true
94
+ FFI_SUPPORT_EXCEPTION = nil
95
+ rescue ::LoadError => ex_
96
+ FFI_SUPPORTED = false
97
+ FFI_SUPPORT_EXCEPTION = ex_
98
+ rescue => ex_
99
+ FFI_SUPPORTED = false
100
+ FFI_SUPPORT_EXCEPTION = ex_
101
+ end
102
+
103
+ # Default preferred native interface
104
+ if CAPI_SUPPORTED
105
+ self.preferred_native_interface = :capi
106
+ elsif FFI_SUPPORTED
107
+ self.preferred_native_interface = :ffi
108
+ end
109
+
110
+ # Init internal utilities
111
+ Utils._init
112
+
113
+ end
114
+ end
109
115
 
110
116
  # :startdoc:
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.18
4
+ version: 0.3.19
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: 2012-09-19 00:00:00.000000000 Z
12
+ date: 2012-09-20 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