Introduce ol.format.MVT

This commit is contained in:
Andreas Hocevar
2015-10-13 14:18:00 +02:00
parent 8f4756c99b
commit 598111b78e
8 changed files with 311 additions and 3 deletions

View File

@@ -61,7 +61,10 @@ ol.featureloader.loadFeaturesXhr = function(url, format, success) {
*/
function(extent, resolution, projection) {
var xhrIo = new goog.net.XhrIo();
xhrIo.setResponseType(goog.net.XhrIo.ResponseType.TEXT);
xhrIo.setResponseType(
format.getType() == ol.format.FormatType.ARRAY_BUFFER ?
goog.net.XhrIo.ResponseType.ARRAY_BUFFER :
goog.net.XhrIo.ResponseType.TEXT);
goog.events.listen(xhrIo, goog.net.EventType.COMPLETE,
/**
* @param {Event} event Event.
@@ -87,6 +90,8 @@ ol.featureloader.loadFeaturesXhr = function(url, format, success) {
if (!source) {
source = ol.xml.parse(xhrIo.getResponseText());
}
} else if (type == ol.format.FormatType.ARRAY_BUFFER) {
source = xhrIo.getResponse();
} else {
goog.asserts.fail('unexpected format type');
}