From c245794e56ee10564a144237160759eb6221a4aa Mon Sep 17 00:00:00 2001 From: ahocevar Date: Thu, 16 May 2013 14:37:27 +0200 Subject: [PATCH 1/4] Sorting properties --- src/objectliterals.jsdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 349e3ca1a9..ee19686fc9 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -295,12 +295,12 @@ /** * @typedef {Object} ol.parser.KMLOptions + * @property {number|undefined} dimension Create geometries with `dimension` + * dimensions. Default is 3. * @property {boolean|undefined} extractAttributes Should we extract attributes * from the KML? Default is `true´. * @property {boolean|undefined} extractStyles Should we extract styles from the * KML? Default is `false`. - * @property {number|undefined} dimension Create geometries with `dimension` - * dimensions. Default is 3. * @property {number|undefined} maxDepth Maximum depth to follow network links. * Default is 0, which means we don't follow network links at all. */ From 1929403cdaacfc85f7d6032189cd148873876184 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Thu, 16 May 2013 14:37:40 +0200 Subject: [PATCH 2/4] Do not extend the instance with options --- src/ol/parser/kml.js | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/ol/parser/kml.js b/src/ol/parser/kml.js index 3de797d27f..ebbb58410b 100644 --- a/src/ol/parser/kml.js +++ b/src/ol/parser/kml.js @@ -45,22 +45,16 @@ goog.require('ol.style.PolygonLiteral'); * @extends {ol.parser.XML} */ ol.parser.KML = function(opt_options) { - if (goog.isDef(opt_options)) { - goog.object.extend(this, opt_options); - } - if (!goog.isDef(this.extractAttributes)) { - this.extractAttributes = true; - } - if (!goog.isDef(this.extractStyles)) { - this.extractStyles = false; - } + var options = /** @type {ol.parser.KMLOptions} */ + (goog.isDef(opt_options) ? opt_options : {}); + this.extractAttributes = goog.isDef(options.extractAttributes) ? + options.extractAttributes : true; + this.extractStyles = goog.isDef(options.extractStyles) ? + options.extractStyles : false; // TODO re-evaluate once shared structures support 3D - if (!goog.isDef(this.dimension)) { - this.dimension = 3; - } - if (!goog.isDef(this.maxDepth)) { - this.maxDepth = 0; - } + this.dimension = goog.isDef(options.dimension) ? options.dimension : 3; + this.maxDepth = goog.isDef(options.maxDepth) ? options.maxDepth : 0; + this.defaultNamespaceURI = 'http://www.opengis.net/kml/2.2'; this.readers = { 'http://www.opengis.net/kml/2.2': { From cde4ef435c39d34ae7c97b3d1ed7e8265565443f Mon Sep 17 00:00:00 2001 From: ahocevar Date: Thu, 16 May 2013 15:14:38 +0200 Subject: [PATCH 3/4] Adding another option --- src/objectliterals.jsdoc | 1 + src/ol/parser/kml.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index ee19686fc9..fcc9b895f0 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -303,6 +303,7 @@ * KML? Default is `false`. * @property {number|undefined} maxDepth Maximum depth to follow network links. * Default is 0, which means we don't follow network links at all. + * @property {Array.} trackAttributes Track attributes to parse. */ /** diff --git a/src/ol/parser/kml.js b/src/ol/parser/kml.js index ebbb58410b..8be3b5f61a 100644 --- a/src/ol/parser/kml.js +++ b/src/ol/parser/kml.js @@ -54,6 +54,8 @@ ol.parser.KML = function(opt_options) { // TODO re-evaluate once shared structures support 3D this.dimension = goog.isDef(options.dimension) ? options.dimension : 3; this.maxDepth = goog.isDef(options.maxDepth) ? options.maxDepth : 0; + this.trackAttributes = goog.isDef(options.trackAttributes) ? + options.trackAttributes : null; this.defaultNamespaceURI = 'http://www.opengis.net/kml/2.2'; this.readers = { From 3e6cdf89016d5433afb5a4752e798eb1929ed2f8 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Thu, 16 May 2013 15:26:54 +0200 Subject: [PATCH 4/4] trackAttributes is optional --- src/objectliterals.jsdoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index fcc9b895f0..afbf5f80d4 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -303,7 +303,8 @@ * KML? Default is `false`. * @property {number|undefined} maxDepth Maximum depth to follow network links. * Default is 0, which means we don't follow network links at all. - * @property {Array.} trackAttributes Track attributes to parse. + * @property {Array.|undefined} trackAttributes Track attributes to + * parse. */ /**