ffi-geos 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/ffi-geos.gemspec CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.description = "An ffi wrapper for GEOS, a C++ port of the Java Topology Suite (JTS)."
12
12
  s.summary = s.description
13
13
  s.email = "dark.panda@gmail.com"
14
+ s.license = "MIT"
14
15
  s.extra_rdoc_files = [
15
16
  "README.rdoc"
16
17
  ]
@@ -332,9 +332,16 @@ module Geos
332
332
  check_geometry(geom)
333
333
  bool_result(FFIGeos.GEOSEquals_r(Geos.current_handle, self.ptr, geom.ptr))
334
334
  end
335
- alias :== :eql?
336
335
  alias :equals? :eql?
337
336
 
337
+ def ==(geom)
338
+ if geom.is_a?(Geos::Geometry)
339
+ self.eql?(geom)
340
+ else
341
+ false
342
+ end
343
+ end
344
+
338
345
  def eql_exact?(geom, tolerance)
339
346
  check_geometry(geom)
340
347
  bool_result(FFIGeos.GEOSEqualsExact_r(Geos.current_handle, self.ptr, geom.ptr, tolerance))
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module Geos
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
6
6
 
@@ -1226,6 +1226,25 @@ class GeometryTests < MiniTest::Unit::TestCase
1226
1226
  end
1227
1227
  end
1228
1228
 
1229
+ def test_interpolate_normalized
1230
+ skip unless ENV['FORCE_TESTS'] || Geos::Geometry.method_defined?(:interpolate_normalized)
1231
+
1232
+ tester = lambda { |expected, g, d|
1233
+ geom = read(g)
1234
+ assert_equal(expected, write(geom.interpolate_normalized(d)))
1235
+ }
1236
+
1237
+ writer.trim = true
1238
+
1239
+ tester['POINT (0 0)', 'LINESTRING(0 0, 10 0)', 0]
1240
+ tester['POINT (5 0)', 'LINESTRING(0 0, 10 0)', 0.5]
1241
+ tester['POINT (10 0)', 'LINESTRING(0 0, 10 0)', 2]
1242
+
1243
+ assert_raises(RuntimeError) do
1244
+ read('POINT(1 2)').interpolate_normalized(0)
1245
+ end
1246
+ end
1247
+
1229
1248
  def test_start_and_end_points
1230
1249
  skip unless ENV['FORCE_TESTS'] || Geos::Geometry.method_defined?(:start_point)
1231
1250
 
@@ -1562,11 +1581,21 @@ class GeometryTests < MiniTest::Unit::TestCase
1562
1581
  geom_a = read('POINT(1.0 1.0)')
1563
1582
  geom_b = read('POINT(2.0 2.0)')
1564
1583
 
1565
- %w{ eql? equals? == }.each do |method|
1584
+ %w{ eql? equals? }.each do |method|
1585
+ assert(geom_a.send(method, geom_a), "Expected geoms to be equal using #{method}")
1566
1586
  refute(geom_a.send(method, geom_b), "Expected geoms to not be equal using #{method}")
1567
1587
  end
1568
1588
  end
1569
1589
 
1590
+ def test_equals_operator
1591
+ geom_a = read('POINT(1.0 1.0)')
1592
+ geom_b = read('POINT(2.0 2.0)')
1593
+
1594
+ assert(geom_a == geom_a, "Expected geoms to be equal using ==")
1595
+ refute(geom_a == geom_b, "Expected geoms to not be equal using ==")
1596
+ refute(geom_a == "test", "Expected geoms to not be equal using ==")
1597
+ end
1598
+
1570
1599
  def test_eql_exact
1571
1600
  geom_a = read('POINT(1.0 1.0)')
1572
1601
  geom_b = read('POINT(2.0 2.0)')
metadata CHANGED
@@ -1,29 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-geos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ prerelease:
5
+ version: 0.4.0
5
6
  platform: ruby
6
7
  authors:
7
8
  - J Smith
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-08-26 00:00:00.000000000 Z
12
+ date: 2014-01-03 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: ffi
16
+ type: :runtime
15
17
  requirement: !ruby/object:Gem::Requirement
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: 1.0.0
20
- type: :runtime
21
- prerelease: false
22
+ none: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
- - - '>='
25
+ - - ! '>='
25
26
  - !ruby/object:Gem::Version
26
27
  version: 1.0.0
28
+ none: false
29
+ prerelease: false
27
30
  description: An ffi wrapper for GEOS, a C++ port of the Java Topology Suite (JTS).
28
31
  email: dark.panda@gmail.com
29
32
  executables: []
@@ -79,27 +82,32 @@ files:
79
82
  - test/wkt_reader_tests.rb
80
83
  - test/wkt_writer_tests.rb
81
84
  homepage: http://github.com/dark-panda/ffi-geos
82
- licenses: []
83
- metadata: {}
85
+ licenses:
86
+ - MIT
84
87
  post_install_message:
85
88
  rdoc_options: []
86
89
  require_paths:
87
90
  - lib
88
91
  required_ruby_version: !ruby/object:Gem::Requirement
89
92
  requirements:
90
- - - '>='
93
+ - - ! '>='
91
94
  - !ruby/object:Gem::Version
95
+ segments:
96
+ - 0
97
+ hash: 1552105813238554661
92
98
  version: '0'
99
+ none: false
93
100
  required_rubygems_version: !ruby/object:Gem::Requirement
94
101
  requirements:
95
- - - '>='
102
+ - - ! '>='
96
103
  - !ruby/object:Gem::Version
97
104
  version: '0'
105
+ none: false
98
106
  requirements: []
99
107
  rubyforge_project:
100
- rubygems_version: 2.0.3
108
+ rubygems_version: 1.8.23
101
109
  signing_key:
102
- specification_version: 4
110
+ specification_version: 3
103
111
  summary: An ffi wrapper for GEOS, a C++ port of the Java Topology Suite (JTS).
104
112
  test_files:
105
113
  - test/coordinate_sequence_tests.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: ceab1a4b690aced547fbaea6008072689e803a35
4
- data.tar.gz: 3e0c22f99d9a9884a9d755c0dd09698b68dbe6bf
5
- SHA512:
6
- metadata.gz: 96aa99fbd28ad9fb6bfffaa08e77b5a788107c2e608976baf4b20e7a38e711942fcedc9de9eb8795174a9f7e9af5cf1641ccc40559122ce6080d993994067ae1
7
- data.tar.gz: 1307315dc60642d103c41df11c82c810c7c08f6b6d2c4b70e23aae224ea5bcf08fec0fe3ed1d816214f9bf306622b8b7fffda762402c85d7d4dddf53915d22da