Add ol.geom.Polygon#containsCoordinate

This commit is contained in:
Tom Payne
2013-11-11 17:22:06 +01:00
parent f2865e6dbf
commit 029d978949

View File

@@ -26,6 +26,26 @@ ol.geom.Polygon = function(coordinates, opt_layout) {
goog.inherits(ol.geom.Polygon, ol.geom.Geometry);
/**
* @param {ol.Coordinate} coordinate Coordinate.
* @return {boolean} Contains coordinate.
*/
ol.geom.Polygon.prototype.containsCoordinate = function(coordinate) {
return this.containsXY(coordinate[0], coordinate[1]);
};
/**
* @param {number} x X.
* @param {number} y Y.
* @return {boolean} Contains.
*/
ol.geom.Polygon.prototype.containsXY = function(x, y) {
return ol.geom.flatLinearRingsContainsXY(
this.flatCoordinates, 0, this.ends_, this.stride, x, y);
};
/**
* @return {ol.geom.RawPolygon} Coordinates.
*/