add onScreen() function to OpenLayers.Feature, and add tests to prove it.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@1510 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-09-27 21:56:17 +00:00
parent 1cedf957b0
commit 73fb43712f
2 changed files with 41 additions and 0 deletions

View File

@@ -72,6 +72,21 @@ OpenLayers.Feature.prototype= {
}
},
/**
* @returns Whether or not the feature is currently visible on screen
* (based on its 'lonlat' property)
* @type Boolean
*/
onScreen:function() {
var onScreen = false;
if ((this.layer != null) && (this.layer.map != null)) {
var screenBounds = this.layer.map.getExtent();
onScreen = screenBounds.containsLonLat(this.lonlat);
}
return onScreen;
},
/**
* @returns A Marker Object created from the 'lonlat' and 'icon' properties