add getDataExtent() method to layer (experimental) and to markers layer (api supported). thanks for the feature request and original patch, anonymous ol-er :-) (Closes #750)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@4051 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2007-08-27 14:44:44 +00:00
parent 1cf74313ab
commit 4636c4a6d4
3 changed files with 61 additions and 0 deletions
+28
View File
@@ -49,6 +49,34 @@
layer.destroy();
t.eq( layer.map, null, "layer.map is null after destroy" );
}
function test_03_Layer_Markers_getDataExtent(t) {
t.plan( 4 );
var layer = {};
var ret = OpenLayers.Layer.Markers.prototype.getDataExtent.apply(layer, []);
t.eq(ret, null, "does not crash, returns null on layer with null 'this.markers'");
layer.markers = [];
ret = OpenLayers.Layer.Markers.prototype.getDataExtent.apply(layer, []);
t.eq(ret, null, "returns null on layer with empty 'this.markers'");
layer.markers.push({
'lonlat': new OpenLayers.LonLat(4,5)
});
var expectedBounds = new OpenLayers.Bounds(4,5,4,5);
ret = OpenLayers.Layer.Markers.prototype.getDataExtent.apply(layer, []);
t.ok(ret.equals(expectedBounds), "returns expected bounds with only one marker");
layer.markers.push({
'lonlat': new OpenLayers.LonLat(1,2)
});
var expectedBounds = new OpenLayers.Bounds(1,2,4,5);
ret = OpenLayers.Layer.Markers.prototype.getDataExtent.apply(layer, []);
t.ok(ret.equals(expectedBounds), "returns expected bounds with multiple markers");
}
// -->
</script>
</head>