Make KML format ignore image styles that aren't icons

This commit is contained in:
Éric Lemoine
2015-11-04 16:07:29 +01:00
parent 3254e08785
commit daa970fe4c
2 changed files with 28 additions and 1 deletions

View File

@@ -1801,6 +1801,32 @@ describe('ol.format.KML', function() {
expect(node).to.xmleql(ol.xml.parse(text));
});
it('skips image styles that are not icon styles', function() {
var style = new ol.style.Style({
image: new ol.style.Circle({
radius: 4,
fill: new ol.style.Fill({
color: 'rgb(12, 34, 223)'
})
})
});
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>' +
' <Style>' +
' </Style>' +
' </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({
@@ -2747,6 +2773,7 @@ goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.style.Circle');
goog.require('ol.style.Fill');
goog.require('ol.style.Icon');
goog.require('ol.style.IconOrigin');