Adding a BBOX strategy. This triggers requests for data within a bounding box. When the map bounds invalidate previous data bounds, another request is issued. Reads are triggered with a spatial filter, and protocols that understand how to deal with filters may serialize the filter to request a subset of the data collection. The HTTP protocol understands one filter - the bbox filter. So the BBOX strategy can be used in conjunction with the HTTP protocol to request data via http in a bounding box. Thanks for the collaboration and tests Eric. r=elemoine,crschmidt (#1731)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@8000 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2008-09-11 17:39:41 +00:00
parent 1662f2adba
commit 33fbc1d22f
7 changed files with 484 additions and 0 deletions

View File

@@ -104,6 +104,31 @@
var resp = protocol.read(readOptions);
}
function test_read_bbox(t) {
t.plan(1);
var protocol = new OpenLayers.Protocol.HTTP();
// fake XHR request object
var request = {'status': 200};
var _get = OpenLayers.Request.GET;
var bounds = new OpenLayers.Bounds(1, 2, 3, 4);
var filter = new OpenLayers.Filter.Spatial({
type: OpenLayers.Filter.Spatial.BBOX,
value: bounds,
projection: "foo"
});
OpenLayers.Request.GET = function(options) {
t.eq(options.params['bbox'].toString(), bounds.toArray().toString(),
'GET called with bbox filter in params');
return request;
};
var resp = protocol.read({filter: filter});
}
function test_parseFeatures(t) {
t.plan(5);