diff --git a/CHANGES.md b/CHANGES.md index a2263f7fe5c1..53ce75ad40ef 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ Change Log * Added `eyeSeparation` and `focalLength` properties to `Scene` to configure VR settings. [#5917](https://github.com/AnalyticalGraphicsInc/cesium/pull/5917) * Added `customTags` property to the UrlTemplateImageryProvider to allow custom keywords in the template URL. [#5696](https://github.com/AnalyticalGraphicsInc/cesium/pull/5696) * Improved CZML Reference Properties example [#5754](https://github.com/AnalyticalGraphicsInc/cesium/pull/5754) +* Fixed bug with placemarks in imported KML: placemarks with no specified icon would be displayed with default icon. [#5819](https://github.com/AnalyticalGraphicsInc/cesium/issues/5819) ### 1.38 - 2017-10-02 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index a9e5f51b5e3e..40c3a276c8bc 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -93,6 +93,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu * [Logilab](https://www.logilab.fr/) * [Florent Cayré](https://github.com/fcayre/) * [Novetta](http://www.novetta.com/) + * [Joshua Bernstein](https://github.com/jbernstein/) * [Natanael Rivera](https://github.com/nrivera-Novetta/) * [Justin Burr](https://github.com/jburr-nc/) diff --git a/Source/DataSources/KmlDataSource.js b/Source/DataSources/KmlDataSource.js index 364b1b3b96e3..ef41302c2250 100644 --- a/Source/DataSources/KmlDataSource.js +++ b/Source/DataSources/KmlDataSource.js @@ -729,6 +729,12 @@ define([ var iconNode = queryFirstNode(node, 'Icon', namespaces.kml); var icon = getIconHref(iconNode, dataSource, sourceUri, uriResolver, false, query); + + // If icon tags are present but blank, we do not want to show an icon + if (defined(iconNode) && !defined(icon)) { + icon = false; + } + var x = queryNumericValue(iconNode, 'x', namespaces.gx); var y = queryNumericValue(iconNode, 'y', namespaces.gx); var w = queryNumericValue(iconNode, 'w', namespaces.gx); @@ -1140,6 +1146,12 @@ define([ if (!defined(billboard.image)) { billboard.image = dataSource._pinBuilder.fromColor(Color.YELLOW, 64); + + // If there were empty tags in the KML, then billboard.image was set to false above + // However, in this case, the false value would have been converted to a property afterwards + // Thus, we check if billboard.image is defined with value of false + } else if (billboard.image && !billboard.image.getValue()) { + billboard.image = undefined; } var scale = 1.0; diff --git a/Specs/Data/KML/simpleEmptyIconStyle.kml b/Specs/Data/KML/simpleEmptyIconStyle.kml new file mode 100644 index 000000000000..1495faf4c004 --- /dev/null +++ b/Specs/Data/KML/simpleEmptyIconStyle.kml @@ -0,0 +1,15 @@ + + + + + + image.png]]> + + 1,2,3 + + + + \ No newline at end of file diff --git a/Specs/Data/KML/simpleNoIcon.kml b/Specs/Data/KML/simpleNoIcon.kml new file mode 100644 index 000000000000..629ca3c12ccb --- /dev/null +++ b/Specs/Data/KML/simpleNoIcon.kml @@ -0,0 +1,17 @@ + + + + + + image.png]]> + + 1,2,3 + + + + \ No newline at end of file diff --git a/Specs/Data/KML/simpleNoStyle.kml b/Specs/Data/KML/simpleNoStyle.kml new file mode 100644 index 000000000000..98849788f59d --- /dev/null +++ b/Specs/Data/KML/simpleNoStyle.kml @@ -0,0 +1,11 @@ + + + + + image.png]]> + + 1,2,3 + + + + \ No newline at end of file diff --git a/Specs/DataSources/KmlDataSourceSpec.js b/Specs/DataSources/KmlDataSourceSpec.js index acaacb86430c..d5daecf6fdb3 100644 --- a/Specs/DataSources/KmlDataSourceSpec.js +++ b/Specs/DataSources/KmlDataSourceSpec.js @@ -271,6 +271,42 @@ defineSuite([ }); }); + it('if load contains tag with no image included, no image is added', function() { + var dataSource = new KmlDataSource(options); + return loadBlob('Data/KML/simpleNoIcon.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).toBeUndefined(); + }); + }); + + it('if load does not contain icon