OpenLayers的默认策略是Fixed。例如,请参阅:
http://openlayers.org/dev/examples/sundials.html
var sundials = new OpenLayers.Layer.Vector("KML", {
projection: map.displayProjection,
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "kml/sundials.kml",
format: new OpenLayers.Format.KML({
extractStyles: true,
extractAttributes: true
})
})
});是否可以传递回调来处理协议错误?如果我使用低级别的GET请求,我可以很容易地做到这一点,例如:
var loadkml = function() {
OpenLayers.Request.GET({
url: "kml/sundials.kml",
success: parseData,
failure: function(req) { alert(req.responseText); }
});
}但我不想实施一种全新的策略,修复就可以了。
发布于 2011-11-30 21:08:43
OpenLayers.Protocol.HTTP协议接受callback选项:
Function to be called when the <read>, <create>, <update>, <delete> or <commit> operation completes
但是这个函数从来没有被调用过,错误报告:https://github.com/openlayers/openlayers/pull/81
https://stackoverflow.com/questions/7655191
复制相似问题