Fix ol.geom.flat.linearRingContainsXY

This commit is contained in:
Tom Payne
2014-01-06 18:19:08 +01:00
parent b795ddf430
commit ffb68c951a
2 changed files with 4 additions and 10 deletions

View File

@@ -344,9 +344,9 @@ ol.geom.flat.linearRingContainsXY =
function(flatCoordinates, offset, end, stride, x, y) {
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
var contains = false;
var x1 = flatCoordinates[offset];
var y1 = flatCoordinates[offset + 1];
for (offset += stride; offset < end; offset += stride) {
var x1 = flatCoordinates[end - stride];
var y1 = flatCoordinates[end - stride + 1];
for (; offset < end; offset += stride) {
var x2 = flatCoordinates[offset];
var y2 = flatCoordinates[offset + 1];
var intersect = ((y1 > y) != (y2 > y)) &&

View File

@@ -1,5 +1,3 @@
// FIXME why do the skip tests below fail? I don't understand!
goog.provide('ol.test.geom.Polygon');
@@ -291,7 +289,7 @@ describe('ol.geom.Polygon', function() {
expect(polygon.getFlatCoordinates()).to.eql(flatCoordinates);
});
it.skip('does not contain outside coordinates', function() {
it('does not contain outside coordinates', function() {
expect(polygon.containsCoordinate(outsideOuter)).to.be(false);
});
@@ -304,10 +302,6 @@ describe('ol.geom.Polygon', function() {
expect(polygon.containsCoordinate(insideInner2)).to.be(false);
});
it.skip('fails in strange ways', function() {
expect(polygon.containsCoordinate([0, 0])).to.be(false);
});
});
describe('with a simple polygon', function() {