Add ol.geom.Polygon#containsCoordinate
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user