Entertaining linter and compiler
This commit is contained in:
@@ -100,6 +100,7 @@ ol.geom.Polygon.prototype.getType = function() {
|
||||
*/
|
||||
ol.geom.Polygon.prototype.containsCoordinate = function(coordinate) {
|
||||
var rings = this.rings;
|
||||
/** @type {boolean} */
|
||||
var containsCoordinate;
|
||||
for (var i = 0, ii = rings.length; i < ii; ++i) {
|
||||
containsCoordinate = rings[i].containsCoordinate(coordinate);
|
||||
|
||||
@@ -58,48 +58,47 @@ describe('ol.geom.LinearRing', function() {
|
||||
|
||||
// contains: 1 (touches - not implemented), true (within), false (outside)
|
||||
var cases = [{
|
||||
point: [5, 5], contains: true
|
||||
point: [5, 5], contains: true
|
||||
}, {
|
||||
point: [20, 20], contains: false
|
||||
point: [20, 20], contains: false
|
||||
}, {
|
||||
point: [15, 15], contains: false
|
||||
point: [15, 15], contains: false
|
||||
}/*, {
|
||||
point: [0, 0], contains: 1 // lower left corner
|
||||
point: [0, 0], contains: 1 // lower left corner
|
||||
}, {
|
||||
point: [10, 0], contains: 1 // lower right corner
|
||||
point: [10, 0], contains: 1 // lower right corner
|
||||
}, {
|
||||
point: [15, 10], contains: 1 // upper right corner
|
||||
point: [15, 10], contains: 1 // upper right corner
|
||||
}, {
|
||||
point: [5, 10], contains: 1 // upper left corner
|
||||
point: [5, 10], contains: 1 // upper left corner
|
||||
}, {
|
||||
point: [5, 0], contains: 1 // on edge 1
|
||||
point: [5, 0], contains: 1 // on edge 1
|
||||
}*/, {
|
||||
point: [5, -0.1], contains: false // below edge 1
|
||||
point: [5, -0.1], contains: false // below edge 1
|
||||
}, {
|
||||
point: [5, 0.1], contains: true // above edge 1
|
||||
point: [5, 0.1], contains: true // above edge 1
|
||||
}/*, {
|
||||
point: [12.5, 5], contains: 1 // on edge 2
|
||||
point: [12.5, 5], contains: 1 // on edge 2
|
||||
}*/, {
|
||||
point: [12.4, 5], contains: true // left of edge 2
|
||||
point: [12.4, 5], contains: true // left of edge 2
|
||||
}, {
|
||||
point: [12.6, 5], contains: false // right of edge 2
|
||||
point: [12.6, 5], contains: false // right of edge 2
|
||||
}/*, {
|
||||
point: [10, 10], contains: 1 // on edge 3
|
||||
point: [10, 10], contains: 1 // on edge 3
|
||||
}*/, {
|
||||
point: [10, 9.9], contains: true // below edge 3
|
||||
point: [10, 9.9], contains: true // below edge 3
|
||||
}, {
|
||||
point: [10, 10.1], contains: false // above edge 3
|
||||
point: [10, 10.1], contains: false // above edge 3
|
||||
}/*, {
|
||||
point: [2.5, 5], contains: 1 // on edge 4
|
||||
point: [2.5, 5], contains: 1 // on edge 4
|
||||
}*/, {
|
||||
point: [2.4, 5], contains: false // left of edge 4
|
||||
point: [2.4, 5], contains: false // left of edge 4
|
||||
}, {
|
||||
point: [2.6, 5], contains: true // right of edge 4
|
||||
point: [2.6, 5], contains: true // right of edge 4
|
||||
}];
|
||||
|
||||
var len = cases.length;
|
||||
var c;
|
||||
for (var i=0; i<len; ++i) {
|
||||
for (var i = 0, ii = cases.length; i < ii; ++i) {
|
||||
c = cases[i];
|
||||
expect(ring.containsCoordinate(c.point)).to.be(c.contains);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user