Merge pull request #1454 from twpayne/vector-api-vector-file-urls

[vector-api] Add urls option to ol.source.VectorFile
This commit is contained in:
Tom Payne
2014-01-06 23:55:24 -08:00
6 changed files with 32 additions and 29 deletions

View File

@@ -527,6 +527,7 @@
* @property {ol.proj.ProjectionLike} reprojectTo Re-project to.
* @property {string|undefined} text Text.
* @property {string|undefined} url URL.
* @property {Array.<string>|undefined} urls URLs.
*/
/**
@@ -535,6 +536,7 @@
* Possible values are `barometric`, `gps`, and `none`. Default is `none`.
* @property {string|undefined} text Text.
* @property {string|undefined} url URL.
* @property {Array.<string>|undefined} urls URLs.
*/
/**
@@ -567,6 +569,7 @@
* @property {ol.proj.ProjectionLike} reprojectTo Re-project to.
* @property {string|undefined} text Text.
* @property {string|undefined} url URL.
* @property {Array.<string>|undefined} urls URLs.
*/
/**
@@ -712,6 +715,7 @@
* @property {ol.proj.ProjectionLike} projection Projection.
* @property {string|undefined} text Text.
* @property {string|undefined} url URL.
* @property {Array.<string>|undefined} urls URLs.
*/
/**

View File

@@ -25,7 +25,8 @@ ol.source.GeoJSON = function(opt_options) {
projection: options.projection,
reprojectTo: options.reprojectTo,
text: options.text,
url: options.url
url: options.url,
urls: options.urls
});
};

View File

@@ -19,7 +19,8 @@ ol.source.IGC = function(opt_options) {
altitudeMode: options.altitudeMode
}),
text: options.text,
url: options.url
url: options.url,
urls: options.urls
});
};

View File

@@ -24,7 +24,8 @@ ol.source.KML = function(opt_options) {
projection: options.projection,
reprojectTo: options.reprojectTo,
text: options.text,
url: options.url
url: options.url,
urls: options.urls
});
};

View File

@@ -57,9 +57,19 @@ ol.source.VectorFile = function(opt_options) {
this.readFeatures_(options.text);
}
if (goog.isDef(options.url)) {
if (goog.isDef(options.url) || goog.isDef(options.urls)) {
this.setState(ol.source.State.LOADING);
goog.net.XhrIo.send(options.url, goog.bind(this.handleXhrIo_, this));
var handleXhrIo = goog.bind(this.handleXhrIo_, this);
if (goog.isDef(options.url)) {
goog.net.XhrIo.send(options.url, handleXhrIo);
}
if (goog.isDef(options.urls)) {
var urls = options.urls;
var i, ii;
for (i = 0, ii = urls.length; i < ii; ++i) {
goog.net.XhrIo.send(urls[i], handleXhrIo);
}
}
}
};