Permalink
Browse files

worked on search in polygon fix

  • Loading branch information...
1 parent 6cce56f commit 8727a5d9fe770aa9cde96f742395f08cad5bf9c9 @phifty committed Mar 29, 2010
Showing with 18 additions and 9 deletions.
  1. +18 −9 spec/integration/basic_spec.rb
@@ -203,26 +203,35 @@
before :each do
@type = @geo.cartesian_type 1.0, 2.0, 2.0, 20.0, 20.0
@repository.statements.create "\"test_subject\"", "\"at\"", "\"+10+10\"^^#{@type}"
- @polygon = [ [ 2.0, 2.0 ], [ 11.0, 2.0 ], [ 11.0, 11.0 ], [ 2.0, 11.0 ] ]
+ @repository.statements.create "\"another_subject\"", "\"at\"", "\"+15+15\"^^#{@type}"
end
it "should find objects inside a box" do
result = @geo.inside_box @type, "\"at\"", 8.0, 8.0, 11.0, 11.0
- result.should include([ "\"test_subject\"", "\"at\"", "\"+10.000000000931323+10.000000000931323\"^^<http://franz.com/ns/allegrograph/3.0/geospatial/cartesian/2.0/20.0/2.0/20.0/1.0>"])
+ result.should include([ "\"test_subject\"", "\"at\"", "\"+10.000000000931323+10.000000000931323\"^^#{@type}"])
+ result.should_not include([ "\"another_subject\"", "\"at\"", "\"+15.000000000465661+15.000000000465661\"^^#{@type}"])
end
it "should find objects inside a circle" do
result = @geo.inside_circle @type, "\"at\"", 9.0, 9.0, 2.0
- result.should include([ "\"test_subject\"", "\"at\"", "\"+10.000000000931323+10.000000000931323\"^^<http://franz.com/ns/allegrograph/3.0/geospatial/cartesian/2.0/20.0/2.0/20.0/1.0>"])
+ result.should include([ "\"test_subject\"", "\"at\"", "\"+10.000000000931323+10.000000000931323\"^^#{@type}"])
+ result.should_not include([ "\"another_subject\"", "\"at\"", "\"+15.000000000465661+15.000000000465661\"^^#{@type}"])
end
- it "should find objects inside a polygon" do
- pending
- result = @geo.create_polygon "test_polygon", @type, @polygon
- result.should be_true
+ context "with a defined polygon" do
+
+ before :each do
+ @type = @geo.cartesian_type 1, -100, -100, 100, 100
+ @repository.statements.create "\"test_subject\"", "\"at\"", "\"+1+1\"^^#{@type}"
+ @geo.create_polygon "test_polygon", @type, [ [ 0, -100 ], [ 0, 100 ], [ 100, 100 ], [ 100, -100 ] ]
+ end
+
+ it "should find objects inside that polygon" do
+ pending
+ result = @geo.inside_polygon @type, "\"at\"", "test_polygon"
+ result.should include([ "\"test_subject\"", "\"at\"", "\"+1+1\"^^<http://franz.com/ns/allegrograph/3.0/geospatial/cartesian/2.0/20.0/2.0/20.0/1.0>"])
+ end
- result = @geo.inside_polygon @type, "\"at\"", "test_polygon"
- result.should include([ "\"test_subject\"", "\"at\"", "\"+10.000000000931323+10.000000000931323\"^^<http://franz.com/ns/allegrograph/3.0/geospatial/cartesian/2.0/20.0/2.0/20.0/1.0>"])
end
end

0 comments on commit 8727a5d

Please sign in to comment.