Skip to content

Commit

Permalink
Fix case with no style tag, and add test CesiumGS#5819
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Bernstein committed Sep 29, 2017
1 parent 848e6af commit b60dc73
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Source/DataSources/KmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,10 @@ define([
entity.billboard = billboard;
}

if (!defined(styleEntity.billboard) && !defined(billboard.image)) {
billboard.image = dataSource._pinBuilder.fromColor(Color.YELLOW, 64);
}

var scale = 1.0;
if (defined(billboard.scale)) {
scale = billboard.scale.getValue();
Expand Down
14 changes: 13 additions & 1 deletion Specs/DataSources/KmlDataSourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,19 @@ defineSuite([
expect(source.entities);
expect(source.entities.values.length).toEqual(1);
expect(source.entities._entities._array.length).toEqual(1);
expect(!source.entities._entities._array[0]._billboard._image);
expect(source.entities._entities._array[0]._billboard._image).toBeUndefined();
});
});

it('if load does not contain icon <style> tag for placemark, default yellow pin does show', function() {
var dataSource = new KmlDataSource(options);
return loadBlob('Data/KML/simpleNoStyle.kml').then(function(blob) {
return dataSource.load(blob);
}).then(function(source) {
expect(source.entities);
expect(source.entities.values.length).toEqual(1);
expect(source.entities._entities._array.length).toEqual(1);
expect(source.entities._entities._array[0]._billboard._image == dataSource._pinBuilder.fromColor(Color.YELLOW, 64));
});
});

Expand Down

0 comments on commit b60dc73

Please sign in to comment.