Merge pull request #711 from ahocevar/kml-options

KML options not applied when library built separately from application. r=@bartvde
This commit is contained in:
ahocevar
2013-05-16 07:04:42 -07:00
2 changed files with 15 additions and 17 deletions
+4 -2
View File
@@ -295,14 +295,16 @@
/**
* @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.
* @property {Array.<string>|undefined} trackAttributes Track attributes to
* parse.
*/
/**
+11 -15
View File
@@ -45,22 +45,18 @@ 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.trackAttributes = goog.isDef(options.trackAttributes) ?
options.trackAttributes : null;
this.defaultNamespaceURI = 'http://www.opengis.net/kml/2.2';
this.readers = {
'http://www.opengis.net/kml/2.2': {