Add new olx.format.KMLOptions#extractStyles property
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user