Fix ol.geom.flat.linearRingContainsXY
This commit is contained in:
@@ -344,9 +344,9 @@ ol.geom.flat.linearRingContainsXY =
|
|||||||
function(flatCoordinates, offset, end, stride, x, y) {
|
function(flatCoordinates, offset, end, stride, x, y) {
|
||||||
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
|
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
|
||||||
var contains = false;
|
var contains = false;
|
||||||
var x1 = flatCoordinates[offset];
|
var x1 = flatCoordinates[end - stride];
|
||||||
var y1 = flatCoordinates[offset + 1];
|
var y1 = flatCoordinates[end - stride + 1];
|
||||||
for (offset += stride; offset < end; offset += stride) {
|
for (; offset < end; offset += stride) {
|
||||||
var x2 = flatCoordinates[offset];
|
var x2 = flatCoordinates[offset];
|
||||||
var y2 = flatCoordinates[offset + 1];
|
var y2 = flatCoordinates[offset + 1];
|
||||||
var intersect = ((y1 > y) != (y2 > y)) &&
|
var intersect = ((y1 > y) != (y2 > y)) &&
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// FIXME why do the skip tests below fail? I don't understand!
|
|
||||||
|
|
||||||
goog.provide('ol.test.geom.Polygon');
|
goog.provide('ol.test.geom.Polygon');
|
||||||
|
|
||||||
|
|
||||||
@@ -291,7 +289,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
expect(polygon.getFlatCoordinates()).to.eql(flatCoordinates);
|
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);
|
expect(polygon.containsCoordinate(outsideOuter)).to.be(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -304,10 +302,6 @@ describe('ol.geom.Polygon', function() {
|
|||||||
expect(polygon.containsCoordinate(insideInner2)).to.be(false);
|
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() {
|
describe('with a simple polygon', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user