[OpenLayers-Commits] r2375 - in sandbox/vector-2.4/lib/OpenLayers: . Feature Geometry
commits at openlayers.org
commits at openlayers.org
Mon Mar 5 22:46:23 EST 2007
Author: euzuro
Date: 2007-03-05 22:46:22 -0500 (Mon, 05 Mar 2007)
New Revision: 2375
Modified:
sandbox/vector-2.4/lib/OpenLayers/Feature/Vector.js
sandbox/vector-2.4/lib/OpenLayers/Geometry.js
sandbox/vector-2.4/lib/OpenLayers/Geometry/Collection.js
Log:
remove defunct atPoint() from Collection, spruce up that of Geometry.js by calling getBounds() instead of directly accessing this.bounds(), code cleanup atPoint() in Feature.Vector
Modified: sandbox/vector-2.4/lib/OpenLayers/Feature/Vector.js
===================================================================
--- sandbox/vector-2.4/lib/OpenLayers/Feature/Vector.js 2007-03-06 03:25:25 UTC (rev 2374)
+++ sandbox/vector-2.4/lib/OpenLayers/Feature/Vector.js 2007-03-06 03:46:22 UTC (rev 2375)
@@ -165,16 +165,18 @@
},
/**
- * Takes an lonLat point and returns true if the feature is at this location.
* @param {OpenLayers.LonLat} lonlat
- * @param toleranceLon Optional tolerance in Geometric Coords
- * @param toleranceLat Optional tolerance in Geographic Coords
- * @return Boolean
+ * @param {float} toleranceLon Optional tolerance in Geometric Coords
+ * @param {float} toleranceLat Optional tolerance in Geographic Coords
+ *
+ * @returns Whether or not the feature is at the specified location
+ * @type Boolean
*/
- atPoint: function(lonlat,toleranceLon,toleranceLat){
- var atPoint=false;
+ atPoint: function(lonlat, toleranceLon, toleranceLat){
+ var atPoint = false;
if(this.geometry){
- atPoint=this.geometry.atPoint(lonlat,toleranceLon,toleranceLat);
+ atPoint = this.geometry.atPoint(lonlat, toleranceLon,
+ toleranceLat);
}
return atPoint;
},
Modified: sandbox/vector-2.4/lib/OpenLayers/Geometry/Collection.js
===================================================================
--- sandbox/vector-2.4/lib/OpenLayers/Geometry/Collection.js 2007-03-06 03:25:25 UTC (rev 2374)
+++ sandbox/vector-2.4/lib/OpenLayers/Geometry/Collection.js 2007-03-06 03:46:22 UTC (rev 2375)
@@ -115,32 +115,6 @@
this.bounds = null;
},
-// /**
-// * Takes an lonLat point and returns true if the feature is at this location.
-// * @param {OpenLayers.LonLat} lonlat
-// * @return Boolean
-// */
-// atPoint: function(lonlat){
-// var atPoint=false;
-// var bounds;
-// if(this.components){
-// for(var i=0;!atPoint&&(i<this.components.length);i++){
-// atPoint=this.components[i].atPoint(lonlat);
-// }
-// }else{
-// // The following code is probably not required as
-// // agregate geometries will always have components. Right?
-// // Cameron Shorter.
-// if(this.bounds){
-// atPoint=(this.bounds.bottom<=lonlat.lat)
-// && (lonlat.lat<=this.bounds.top)
-// && (this.bounds.left<=lonlat.lon)
-// && (lonlat.lon<=this.bounds.right);
-// }
-// }
-// return atPoint;
-// },
-
/**
* Returns the length of the geometry
*/
Modified: sandbox/vector-2.4/lib/OpenLayers/Geometry.js
===================================================================
--- sandbox/vector-2.4/lib/OpenLayers/Geometry.js 2007-03-06 03:25:25 UTC (rev 2374)
+++ sandbox/vector-2.4/lib/OpenLayers/Geometry.js 2007-03-06 03:46:22 UTC (rev 2375)
@@ -99,19 +99,20 @@
},
/**
- * Takes an lonLat point and returns true if the geometry is at this
- * location. This is only an approximation based on the bounds of the
+ * Note: This is only an approximation based on the bounds of the
* geometry.
*
* @param {OpenLayers.LonLat} lonlat
* @param {float} toleranceLon Optional tolerance in Geometric Coords
* @param {float} toleranceLat Optional tolerance in Geographic Coords
*
+ * @returns Whether or not the geometry is at the specified location
* @type Boolean
*/
atPoint: function(lonlat, toleranceLon, toleranceLat) {
var atPoint = false;
- if ((this.bounds != null) && (lonlat != null)) {
+ var bounds = this.getBounds();
+ if ((bounds != null) && (lonlat != null)) {
var dX = (toleranceLon != null) ? toleranceLon : 0;
var dY = (toleranceLat != null) ? toleranceLat : 0;
More information about the Commits
mailing list