Add new olx.format.KMLOptions#extractStyles property

This commit is contained in:
Frederic Junod
2014-08-04 11:27:22 +02:00
parent 0a963d4615
commit 9e37aa796a
5 changed files with 31 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
// FIXME why does node.getAttribute return an unknown type?
// FIXME text
// FIXME serialize arbitrary feature properties
// FIXME don't parse style if extractStyles is false
goog.provide('ol.format.KML');
@@ -98,6 +99,13 @@ ol.format.KML = function(opt_options) {
}
};
/**
* @private
* @type {boolean}
*/
this.extractStyles_ = goog.isDef(options.extractStyles) ?
options.extractStyles : true;
/**
* @private
* @type {Object.<string, (Array.<ol.style.Style>|string)>}
@@ -1427,7 +1435,9 @@ ol.format.KML.prototype.readPlacemark_ = function(node, objectStack) {
feature.setId(id);
}
feature.setProperties(object);
feature.setStyle(this.featureStyleFunction_);
if (this.extractStyles_) {
feature.setStyle(this.featureStyleFunction_);
}
return feature;
};

View File

@@ -23,6 +23,7 @@ ol.source.KML = function(opt_options) {
attributions: options.attributions,
doc: options.doc,
format: new ol.format.KML({
extractStyles: options.extractStyles,
defaultStyle: options.defaultStyle
}),
logo: options.logo,