Updated Signature of KmlFile.

This commit is contained in:
Jakub Balhar 2016-01-29 14:04:01 +01:00
parent 253e6eb967
commit d7bdfd9350
3 changed files with 14 additions and 17 deletions

View File

@ -33,12 +33,7 @@ requirejs(['../src/WorldWind',
wwd.addLayer(layers[l].layer);
}
var kmlFileOptions = {
url: 'data/KML_Samples.kml',
controls:[new KmlTreeVisibility('treeControls', wwd)]
};
var kmlFilePromise = new KmlFile(kmlFileOptions);
var kmlFilePromise = new KmlFile('data/KML_Samples.kml', [new KmlTreeVisibility('treeControls', wwd)]);
kmlFilePromise.then(function (kmlFile) {
var renderableLayer = new WorldWind.RenderableLayer("Surface Shapes");
wwd.addLayer(renderableLayer);

View File

@ -41,15 +41,20 @@ define([
* Parses associated KmlFile and allows user to draw the whole KmlFile in passed layer. The whole file is
* rendered in one Layer.
* @constructor
* @param options {Object}
* @param options.document {String} String representing the document if it is local.
* @param options.url {String} Url of the remote document.
* @param options.local {Boolean} True if the document is local.
* @param options.controls {KmlControls[]} List of controls applied to this File.
* @param document {String} String representing the document if it is local.
* @param url {String} Url of the remote document.
* @param local {Boolean} True if the document is local.
* @param controls {KmlControls[]} List of controls applied to this File.
* @alias KmlFile
* @classdesc Support for Kml File parsing and display.
*/
var KmlFile = function (options) {
var KmlFile = function (url, controls, document, local) {
var options = {
document: document,
url: url,
local: local,
controls: controls
};
var self = this;
if (!options || (!options.document && !options.url)) {
throw new ArgumentError(
@ -58,7 +63,6 @@ define([
}
// Default values.
options.local = options.local || false;
this._controls = options.controls || null;
var filePromise;

View File

@ -28,7 +28,7 @@ require({
// This means we are at the end.
loadedFile = loaded;
});
var kmlFile = new KmlFile({local: true, document: kmlFileXml});
var kmlFile = new KmlFile('', null, kmlFileXml, true);
kmlFile.then(callback);
});
@ -47,9 +47,7 @@ require({
// This means we are at the end.
loadedFile = loaded;
});
var kmlFile = new KmlFile({
url: kmlLocation
});
var kmlFile = new KmlFile(kmlLocation);
kmlFile.then(callback);
});