Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var distance = pointToLineDistance(centerPoint, geometry);
if (distance < closestDistance) {
closest = row;
closestDistance = distance;
} else if (distance == closestDistance && closest.type != 'Point') {
closest = row;
closestDistance = distance;
}
} else if (geometry.type == 'Polygon') {
if (booleanPointInPolygon(centerPoint, geometry)) {
if (closestDistance != 0) {
closest = row;
closestDistance = 0;
}
} else {
var line = polygonToLine(geometry);
var distance = pointToLineDistance(centerPoint, line);
if (distance < closestDistance) {
closest = row;
closestDistance = distance;
}
}
}
}
closest.values.name.should.be.equal('point');
foundFeatures.should.be.deep.equal(['box1', 'box2', 'line', 'point']);
});
var distance = pointToLineDistance(centerPoint, geometry);
if (distance < closestDistance) {
closest = row;
closestDistance = distance;
} else if (distance == closestDistance && closest.type != 'Point') {
closest = row;
closestDistance = distance;
}
} else if (geometry.type == 'Polygon') {
if (booleanPointInPolygon(centerPoint, geometry)) {
if (closestDistance != 0) {
closest = row;
closestDistance = 0;
}
} else {
var line = polygonToLine(geometry);
var distance = pointToLineDistance(centerPoint, line);
if (distance < closestDistance) {
closest = row;
closestDistance = distance;
}
}
}
}
closest.properties.Name.should.be.equal('Rio Grande');
});
});
FeatureTiles.prototype.drawPolygon = function(path, geoJson, context, featureStyle) {
context.save();
context.beginPath();
path(PolyToLine(geoJson).geometry);
context.closePath();
var fillPaint = this.getPolygonFillPaint(featureStyle);
if (fillPaint !== undefined && fillPaint !== null) {
context.fillStyle = fillPaint.getColorRGBA();
context.fill();
}
var paint = this.getPolygonPaint(featureStyle);
context.strokeStyle = paint.getColorRGBA();
context.lineWidth = paint.getStrokeWidth();
context.stroke();
context.restore();
};