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:
@@ -112,6 +112,15 @@ OpenLayers.Protocol.HTTP = OpenLayers.Class(OpenLayers.Protocol, {
|
||||
* options - {Object} Optional object for configuring the request.
|
||||
* This object is modified and should not be reused.
|
||||
*
|
||||
* Valid options:
|
||||
* url - {String} Url for the request.
|
||||
* params - {Object} Parameters to get serialized as a query string.
|
||||
* headers - {Object} Headers to be set on the request.
|
||||
* filter - {<OpenLayers.Filter.BBOX>} If a bbox filter is sent, it will be
|
||||
* serialized according to the OpenSearch Geo extension
|
||||
* (bbox=minx,miny,maxx,maxy). Note that a BBOX filter as the child
|
||||
* of a logical filter will not be serialized.
|
||||
*
|
||||
* Returns:
|
||||
* {<OpenLayers.Protocol.Response>} A response object, whose "priv" property
|
||||
* references the HTTP request, this object is also passed to the
|
||||
@@ -121,6 +130,14 @@ OpenLayers.Protocol.HTTP = OpenLayers.Class(OpenLayers.Protocol, {
|
||||
read: function(options) {
|
||||
options = OpenLayers.Util.applyDefaults(options, this.options);
|
||||
var resp = new OpenLayers.Protocol.Response({requestType: "read"});
|
||||
|
||||
if(options.filter && options.filter instanceof OpenLayers.Filter.Spatial) {
|
||||
if(options.filter.type == OpenLayers.Filter.Spatial.BBOX) {
|
||||
options.params = OpenLayers.Util.extend(options.params, {
|
||||
bbox: options.filter.value.toArray()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
resp.priv = OpenLayers.Request.GET({
|
||||
url: options.url,
|
||||
|
||||
Reference in New Issue
Block a user