diff --git a/examples/KmlExample.js b/examples/KmlExample.js index 50215f6c..fd57ed3f 100644 --- a/examples/KmlExample.js +++ b/examples/KmlExample.js @@ -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); diff --git a/src/formats/kml/KmlFile.js b/src/formats/kml/KmlFile.js index 33e6cb1b..b471ba6a 100644 --- a/src/formats/kml/KmlFile.js +++ b/src/formats/kml/KmlFile.js @@ -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; diff --git a/test/formats/kml/KmlFile.test.js b/test/formats/kml/KmlFile.test.js index e47c443b..47cee3a7 100644 --- a/test/formats/kml/KmlFile.test.js +++ b/test/formats/kml/KmlFile.test.js @@ -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); });