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 * @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 * @property {boolean|undefined} extractAttributes Should we extract attributes
* from the KML? Default is `true´. * from the KML? Default is `true´.
* @property {boolean|undefined} extractStyles Should we extract styles from the * @property {boolean|undefined} extractStyles Should we extract styles from the
* KML? Default is `false`. * 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. * @property {number|undefined} maxDepth Maximum depth to follow network links.
* Default is 0, which means we don't follow network links at all. * 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} * @extends {ol.parser.XML}
*/ */
ol.parser.KML = function(opt_options) { ol.parser.KML = function(opt_options) {
if (goog.isDef(opt_options)) { var options = /** @type {ol.parser.KMLOptions} */
goog.object.extend(this, opt_options); (goog.isDef(opt_options) ? opt_options : {});
} this.extractAttributes = goog.isDef(options.extractAttributes) ?
if (!goog.isDef(this.extractAttributes)) { options.extractAttributes : true;
this.extractAttributes = true; this.extractStyles = goog.isDef(options.extractStyles) ?
} options.extractStyles : false;
if (!goog.isDef(this.extractStyles)) {
this.extractStyles = false;
}
// TODO re-evaluate once shared structures support 3D // TODO re-evaluate once shared structures support 3D
if (!goog.isDef(this.dimension)) { this.dimension = goog.isDef(options.dimension) ? options.dimension : 3;
this.dimension = 3; this.maxDepth = goog.isDef(options.maxDepth) ? options.maxDepth : 0;
} this.trackAttributes = goog.isDef(options.trackAttributes) ?
if (!goog.isDef(this.maxDepth)) { options.trackAttributes : null;
this.maxDepth = 0;
}
this.defaultNamespaceURI = 'http://www.opengis.net/kml/2.2'; this.defaultNamespaceURI = 'http://www.opengis.net/kml/2.2';
this.readers = { this.readers = {
'http://www.opengis.net/kml/2.2': { 'http://www.opengis.net/kml/2.2': {