Update OpenLayers.Bounds.containsLonLat input type

'll' parameter can now be either a OpenLayers.LonLat instance or a
simple javascript object with a 'lon' and 'lat' properties.
This commit is contained in:
fredj
2012-01-16 14:25:15 +01:00
parent 657b47abb0
commit 3a69729074
3 changed files with 10 additions and 8 deletions

View File

@@ -359,7 +359,8 @@ OpenLayers.Bounds = OpenLayers.Class({
* APIMethod: containsLonLat
*
* Parameters:
* ll - {<OpenLayers.LonLat>}
* ll - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
* object with a 'lon' and 'lat' properties.
* options - {Object} Optional parameters
*
* Acceptable options:
@@ -382,13 +383,12 @@ OpenLayers.Bounds = OpenLayers.Class({
worldBounds = options.worldBounds;
if (worldBounds && !contains) {
var worldWidth = worldBounds.getWidth();
ll = ll.clone();
var worldCenterX = (worldBounds.left + worldBounds.right) / 2;
var worldsAway = Math.round((ll.lon - worldCenterX) / worldWidth);
ll.lon -= (worldsAway * worldWidth);
contains = this.containsLonLat(
ll, {inclusive: options.inclusive}
);
contains = this.containsLonLat({
lon: ll.lon - worldsAway * worldWidth,
lat: ll.lat
}, {inclusive: options.inclusive});
}
return contains;
},

View File

@@ -267,7 +267,8 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
* Determins whether the feature intersects with the specified location.
*
* Parameters:
* lonlat - {<OpenLayers.LonLat>}
* lonlat - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
* object with a 'lon' and 'lat' properties.
* toleranceLon - {float} Optional tolerance in Geometric Coords
* toleranceLat - {float} Optional tolerance in Geographic Coords
*

View File

@@ -176,7 +176,8 @@ OpenLayers.Geometry = OpenLayers.Class({
* geometry.
*
* Parameters:
* lonlat - {<OpenLayers.LonLat>}
* lonlat - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
* object with a 'lon' and 'lat' properties.
* toleranceLon - {float} Optional tolerance in Geometric Coords
* toleranceLat - {float} Optional tolerance in Geographic Coords
*