Add a writeStyles option to KML format

This commit is contained in:
Éric Lemoine
2015-11-04 16:59:53 +01:00
parent dc3bf0d04b
commit 5c536aafc7
3 changed files with 49 additions and 4 deletions

View File

@@ -1779,6 +1779,28 @@ describe('ol.format.KML', function() {
expect(node).to.xmleql(ol.xml.parse(text));
});
it('does not write styles when writeStyles option is false', function() {
format = new ol.format.KML({writeStyles: false});
var style = new ol.style.Style({
image: new ol.style.Icon({
src: 'http://foo.png'
})
});
var feature = new ol.Feature();
feature.setStyle([style]);
var node = format.writeFeaturesNode([feature]);
var text =
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
' xmlns:gx="http://www.google.com/kml/ext/2.2"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(ol.xml.parse(text));
});
it('can write an feature\'s text style', function() {
var style = new ol.style.Style({
text: new ol.style.Text({