Add ol.geom.flat.contains.linearRingContainsExtent

This commit is contained in:
Éric Lemoine
2014-09-11 18:13:27 +02:00
parent 3ce6229d34
commit 49fa7c01d4

View File

@@ -1,6 +1,29 @@
goog.provide('ol.geom.flat.contains'); goog.provide('ol.geom.flat.contains');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('ol.extent');
/**
* @param {Array.<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {number} end End.
* @param {number} stride Stride.
* @param {ol.Extent} extent Extent.
* @return {boolean} Contains extent.
*/
ol.geom.flat.contains.linearRingContainsExtent =
function(flatCoordinates, offset, end, stride, extent) {
var outside = ol.extent.forEachCorner(extent,
/**
* @param {ol.Coordinate} coordinate Coordinate.
*/
function(coordinate) {
return !ol.geom.flat.contains.linearRingContainsXY(flatCoordinates,
offset, end, stride, coordinate[0], coordinate[1]);
});
return !outside;
};
/** /**